Make analyser into one machine

This commit is contained in:
2022-03-22 09:35:17 +00:00
parent 9c46027711
commit c0383dbd8a
8 changed files with 95 additions and 11 deletions
+13
View File
@@ -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