Continue ai refactor

This commit is contained in:
2021-05-06 14:07:51 +02:00
parent 75c36e2c95
commit 436043b169
12 changed files with 94 additions and 35 deletions
+6 -6
View File
@@ -99,7 +99,7 @@ sumDamage cr dm x = x + _dmAmount dm
movementSideEff :: Creature -> World -> World
movementSideEff cr w
| hasJetPack
= case cr ^? crState . stance . carriage of
= case cr ^? crStance . carriage of
Just (Boosting v)
-> makeFlameletTimed
(oldPos +.+ (_crRad cr + 3) *.* (unitVectorAtAngle $ _crDir cr + pi))
@@ -110,7 +110,7 @@ movementSideEff cr w
$ set randGen g
w
_ -> w
| otherwise = case cr ^? crState . stance . carriage of
| otherwise = case cr ^? crStance . carriage of
Just (Walking x y) -> takeStep x y w
_ -> w
where hasJetPack = any (\it -> it ^? itIdentity == Just JetPack) $ _crInv cr
@@ -154,12 +154,12 @@ updateMovement g cr
| isFrictionless cr
= (over crPos (+.+ momentum) $ setOldPos cr, g')
| otherwise
= case cr ^? crState . stance . carriage of
= case cr ^? crStance . carriage of
Just (Walking x y)
-> (set (crState . stance . carriage) (Walking ((x+y)`mod`120) 0)
-> (set (crStance . carriage) (Walking ((x+y)`mod`120) 0)
$ setOldPos
cr, g)
_ -> (set (crState . stance . carriage) (Walking 0 0)
_ -> (set (crStance . carriage) (Walking 0 0)
$ setOldPos
cr, g)
where
@@ -170,7 +170,7 @@ updateMovement g cr
(randAng,g') = randomR (0,2*pi) g
isFrictionless :: Creature -> Bool
isFrictionless cr = case cr ^? crState . stance . carriage of
isFrictionless cr = case cr ^? crStance . carriage of
Just (Boosting _) -> True
Just (Floating) -> True
_ -> False