Simplify creature action/impulse code
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
|
||||
module Dodge.Creature.Impulse (followImpulses) where
|
||||
module Dodge.Creature.Impulse (followImpulse) where
|
||||
|
||||
import Control.Monad.State
|
||||
import Data.Foldable
|
||||
import Data.Maybe
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Creature.Impulse.Movement
|
||||
import Dodge.Creature.MoveType
|
||||
--import Dodge.Creature.Impulse.UseItem
|
||||
@@ -21,11 +19,6 @@ import Linear
|
||||
import NewInt
|
||||
import System.Random
|
||||
|
||||
followImpulses :: Int -> World -> World
|
||||
followImpulses cid w =
|
||||
let (is, cr) = performActions w (w ^?! cWorld . lWorld . creatures . ix cid)
|
||||
in foldl' (followImpulse cid) (w & cWorld . lWorld . creatures . ix cid .~ cr) is
|
||||
|
||||
-- note SwitchToItem doesn't necessarily update the root item correctly
|
||||
followImpulse :: Int -> World -> Impulse -> World
|
||||
followImpulse cid w imp = case imp of
|
||||
|
||||
Reference in New Issue
Block a user