Make analyser into one machine
This commit is contained in:
@@ -9,6 +9,19 @@ import Dodge.Base
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
|
||||
machineUpdateLiveDieEff
|
||||
:: (Machine -> World -> World) -- | effect when hp >= 1
|
||||
-> (Machine -> World -> World) -- | effect (once) when hp < 1
|
||||
-> Machine -> World -> World
|
||||
machineUpdateLiveDieEff livef dief mc
|
||||
| _mcHP mc < 1 = dief mc
|
||||
. (machines %~ IM.delete mcid)
|
||||
. deleteWallIDs (_mcWallIDs mc)
|
||||
| otherwise = livef mc . (machines . ix mcid %~ ( (mcDamage .~ []) . (mcHP -~ dams) ))
|
||||
where
|
||||
dams = sum $ map _dmAmount $ _mcDamage mc
|
||||
mcid = _mcID mc
|
||||
|
||||
machineUpdateDeathEff :: (Machine -> World -> World)
|
||||
-> Machine -> World -> World
|
||||
machineUpdateDeathEff f mc
|
||||
|
||||
Reference in New Issue
Block a user