Cleanup
This commit is contained in:
@@ -21,21 +21,6 @@ applyIndividualDamage cr w (Inertial _ _ v _) = w
|
||||
applyIndividualDamage cr w dm =
|
||||
let (i,w') = damMatSideEffect dm (crMaterial (_crType cr)) (Left cr) w
|
||||
in w' & damageHP cr i
|
||||
-- case dm of
|
||||
-- Piercing{} -> applyPiercingDamage cr dm w
|
||||
-- _ -> w & damageHP cr (_dmAmount dm)
|
||||
|
||||
--applyPiercingDamage :: Creature -> Damage -> World -> World
|
||||
--applyPiercingDamage cr dm w
|
||||
-- | crIsArmouredFrom (w ^. cWorld . lWorld . items) p cr
|
||||
-- = f . makeSpark NormalSpark p1 (argV (p1 - p)) $ w
|
||||
-- | otherwise = f . damageHP cr (_dmAmount dm) $ w
|
||||
-- where
|
||||
-- f = cWorld . lWorld . creatures . ix (_crID cr) . crPos . _xy +~ _dmVector dm
|
||||
-- / V2 x x
|
||||
-- x = crMass (_crType cr)
|
||||
-- p = _dmPos dm
|
||||
-- p1 = p + 2 *.* squashNormalizeV (p - cr ^. crPos . _xy)
|
||||
|
||||
damageHP :: Creature -> Int -> World -> World
|
||||
damageHP cr x =
|
||||
|
||||
@@ -271,10 +271,9 @@ viewTarget w cr = case cr ^? crIntention . viewPoint . _Just of
|
||||
|
||||
doStrategyActions :: Creature -> Creature
|
||||
doStrategyActions cr = case cr ^? crActionPlan . apStrategy of
|
||||
Just (StrategyActions strat acs) ->
|
||||
Just (SetStrategyAction strat acs) ->
|
||||
cr
|
||||
-- & crActionPlan . apAction .~ acs
|
||||
& crActionPlan . apAction .~ head acs
|
||||
& crActionPlan . apAction .~ acs
|
||||
& crActionPlan . apStrategy .~ strat
|
||||
_ -> cr
|
||||
|
||||
@@ -317,11 +316,11 @@ searchIfDamaged cr
|
||||
&& _apStrategy (_crActionPlan cr) == WatchAndWait =
|
||||
cr & crPerception . cpVigilance .~ Vigilant
|
||||
& crActionPlan . apStrategy
|
||||
.~ StrategyActions
|
||||
.~ SetStrategyAction
|
||||
LookAround
|
||||
[ TurnToPoint (cr ^. crPos . _xy -.- unitVectorAtAngle (_crDir cr))
|
||||
( TurnToPoint (cr ^. crPos . _xy -.- unitVectorAtAngle (_crDir cr))
|
||||
`DoActionThen` 40 `WaitThen` bfsThenReturn 500
|
||||
]
|
||||
)
|
||||
| otherwise = cr
|
||||
|
||||
bfsThenReturn :: Int -> Action
|
||||
|
||||
@@ -10,14 +10,14 @@ import Dodge.Data.Creature
|
||||
goToPostStrat :: Creature -> Strategy
|
||||
goToPostStrat cr = case find sentinelGoal $ _apGoal $ _crActionPlan cr of
|
||||
Just (SentinelAt p _) ->
|
||||
StrategyActions
|
||||
SetStrategyAction
|
||||
(GetTo p)
|
||||
[ DoActionThen (WaitThen 150 holsterIfAiming) $
|
||||
( DoActionThen (WaitThen 150 holsterIfAiming) $
|
||||
DoActionThen
|
||||
(PathTo p NoAction)
|
||||
NoAction
|
||||
-- $ DoImpulses [ChangeStrategy WatchAndWait]
|
||||
]
|
||||
)
|
||||
_ -> WatchAndWait
|
||||
where
|
||||
sentinelGoal (SentinelAt _ _) = True
|
||||
|
||||
@@ -66,11 +66,8 @@ updateLivingCreature cr = case cr ^. crType of
|
||||
. yourControl
|
||||
LampCrit{} -> updateLampoid cr
|
||||
BarrelCrit bt -> updateBarreloid bt cr
|
||||
ChaseCrit{} -> \w ->
|
||||
crUpdate cid . performActions cid $
|
||||
over (cWorld . lWorld . creatures . ix cid) (chaseCritInternal w) w
|
||||
CrabCrit{} ->
|
||||
crUpdate cid . performActions cid . crabCritInternal cid
|
||||
ChaseCrit{} -> crUpdate cid . performActions cid . updateChaseCrit cid
|
||||
CrabCrit{} -> crUpdate cid . performActions cid . crabCritInternal cid
|
||||
AutoCrit{} -> crUpdate cid
|
||||
SwarmCrit{} -> crUpdate cid
|
||||
HoverCrit{} -> \w ->
|
||||
@@ -97,7 +94,7 @@ updateHiveCrit cr cid w
|
||||
& tocr . crType . hiveGestation %~ (max 0 . subtract 1)
|
||||
| otherwise = w
|
||||
where
|
||||
nbees = 50
|
||||
nbees = 25
|
||||
tocr = cWorld . lWorld . creatures . ix cid
|
||||
nid = IM.newKey $ w ^. cWorld . lWorld . creatures
|
||||
ncr = beeCrit & crPos .~ (cr ^. crPos + (0 & _xy +~ 25))
|
||||
@@ -144,6 +141,7 @@ updateAggroBee cr cid w
|
||||
t = \case
|
||||
Avatar{} -> True
|
||||
ChaseCrit{} -> True
|
||||
CrabCrit{} -> True
|
||||
_ -> False
|
||||
|
||||
-- do bees need to be able to see slime targets?
|
||||
|
||||
@@ -144,7 +144,7 @@ data Strategy
|
||||
| LookAround
|
||||
| Wander
|
||||
| CloseToMelee {_meleeTarget :: Int}
|
||||
| StrategyActions Strategy [Action]
|
||||
| SetStrategyAction Strategy Action
|
||||
| GetTo Point2
|
||||
-- | Reload
|
||||
| Flee
|
||||
|
||||
@@ -43,7 +43,7 @@ defaultCreature =
|
||||
, _posture = AtEase
|
||||
}
|
||||
, _crVocalization = VocReady
|
||||
, _crActionPlan = ActionPlan NoAction (StrategyActions WatchAndWait [StartSentinelPost]) [LiveLongAndProsper]
|
||||
, _crActionPlan = ActionPlan NoAction (SetStrategyAction WatchAndWait StartSentinelPost) [LiveLongAndProsper]
|
||||
, _crPerception = defaultPerceptionState
|
||||
, _crMemory = defaultCreatureMemory
|
||||
, _crFaction = NoFaction
|
||||
|
||||
+17
-17
@@ -1,5 +1,5 @@
|
||||
module Dodge.Humanoid (
|
||||
chaseCritInternal,
|
||||
updateChaseCrit,
|
||||
crabCritInternal,
|
||||
hoverCritInternal,
|
||||
) where
|
||||
@@ -9,22 +9,22 @@ import Dodge.Creature
|
||||
import Dodge.Data.World
|
||||
import LensHelp
|
||||
|
||||
chaseCritInternal :: World -> Creature -> Creature
|
||||
chaseCritInternal w cr =
|
||||
foldl'
|
||||
(\c f -> f w c)
|
||||
cr
|
||||
[ const doStrategyActions
|
||||
, overrideMeleeCloseTarget
|
||||
, setViewPos
|
||||
, setMvPosToTargetCr
|
||||
, chaseCritMv
|
||||
, perceptionUpdate [0]
|
||||
, targetYouWhenCognizant
|
||||
, const searchIfDamaged
|
||||
, const (crType . meleeCooldown %~ max 0 . subtract 1)
|
||||
, const (crVocalization %~ updateVocTimer)
|
||||
]
|
||||
updateChaseCrit :: Int -> World -> World
|
||||
updateChaseCrit cid w =
|
||||
(tocr . crVocalization %~ updateVocTimer)
|
||||
. (tocr . crType . meleeCooldown %~ max 0 . subtract 1)
|
||||
. (tocr %~ searchIfDamaged)
|
||||
. (tocr %~ targetYouWhenCognizant w)
|
||||
. (tocr %~ perceptionUpdate [0] w)
|
||||
. (tocr %~ chaseCritMv w)
|
||||
. (tocr %~ setMvPosToTargetCr w)
|
||||
. (tocr %~ setViewPos w)
|
||||
. (tocr %~ overrideMeleeCloseTarget w)
|
||||
. (tocr %~ doStrategyActions)
|
||||
$ w
|
||||
where
|
||||
tocr = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
|
||||
crabCritInternal :: Int -> World -> World
|
||||
crabCritInternal cid w =
|
||||
|
||||
@@ -56,7 +56,8 @@ tutAnoTree :: State LayoutVars MTRS
|
||||
tutAnoTree = do
|
||||
foldMTRS
|
||||
[ tToBTree "TutStartRez" . return . cleatOnward <$> tutRezBox
|
||||
-- , corDoor
|
||||
, corDoor
|
||||
, chasmSpitTerminal
|
||||
-- , tToBTree "" . return . cleatOnward <$> slowDoorRoom
|
||||
, corDoor
|
||||
--, tToBTree "" . return . cleatOnward <$> (xChasm 200 200
|
||||
@@ -372,7 +373,7 @@ chasmSpitTerminal = do
|
||||
, [sps0 $ putShape $ gird (V2 0 20) (V2 300 20), sps0 $ putShape $ gird (V2 0 280) (V2 300 280)]
|
||||
]
|
||||
let y' = y & rmPmnts <>~ ls <> dec
|
||||
cr = PutCrit chaseCrit
|
||||
cr = PutCrit hoverCrit
|
||||
return $
|
||||
tToBTree "chasmTerm" $
|
||||
Node
|
||||
|
||||
Reference in New Issue
Block a user