Work on crab evasion

This commit is contained in:
2026-04-07 17:24:53 +01:00
parent f0e568e694
commit 333f2875cb
9 changed files with 227 additions and 191 deletions
+5 -3
View File
@@ -10,6 +10,7 @@ module Dodge.Creature.Action (
youDropItem,
) where
import RandomHelp
import Dodge.WorldEvent.ThingsHit
import Control.Applicative
import Control.Monad
@@ -103,10 +104,11 @@ performAction cr w ac = case ac of
NoAction -> ([], NoAction)
tryEvadeSideways :: Creature -> World -> Point2 -> Float -> Int -> ActionUpdate
tryEvadeSideways _ _ p a i = jumpleft -- (mv,mempty)
tryEvadeSideways _ w p a i = jumpleft -- (mv,mempty)
where
jumpleft = (mv,EvadeAim p a (i-1))
mv = [Move (V2 0 3)]
jumpleft = (mv,DoReplicate 5 (DoImpulses mv))
mv = [Walk (V2 0 d)]
d = evalState (takeOne [3,-3]) (w ^. randGen)
performAimAt :: Creature -> World -> Int -> Point2 -> ActionUpdate
performAimAt cr w tcid p = ([TurnToward tpos aimSp], AimAt tcid tpos)