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