Improve machines, tweak wall ids
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
module Dodge.WorldEvent.DamageBlock
|
||||
( damageBlocksBy
|
||||
, damageWall
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Data.DamageType
|
||||
|
||||
import Control.Lens
|
||||
|
||||
damageWall :: DamageType -> Wall -> World -> World
|
||||
damageWall dt wl = case _wlStructure wl of
|
||||
MachinePart mcid -> machines . ix mcid . mcDamage %~ (dt :)
|
||||
BlockPart blid -> blocks . ix blid %~ damageBlockWith dt
|
||||
_ -> id
|
||||
|
||||
damageBlockWith :: DamageType -> Block -> Block
|
||||
damageBlockWith _ = id
|
||||
|
||||
damageBlocksBy :: Int -> Wall -> World -> World
|
||||
damageBlocksBy x wl = case wl ^? wlStructure . wlStBlock of
|
||||
Just blid -> blocks . ix blid . blHPs %~ reduceHeadBy x
|
||||
|
||||
Reference in New Issue
Block a user