Fix no damage to walls bug
This commit is contained in:
@@ -11,19 +11,16 @@ import Dodge.Data.World
|
||||
import Dodge.Wall.DamageEffect
|
||||
import LensHelp
|
||||
|
||||
-- maybeDestroyDoor should rather happen during the door mechanism update
|
||||
damageWall :: Damage -> Wall -> World -> World
|
||||
damageWall dt wl w = case _wlStructure wl of
|
||||
MachinePart mcid ->
|
||||
fst . defaultWallDamage dt wl $
|
||||
w
|
||||
& cWorld . machines . ix mcid . mcDamage .:~ dt
|
||||
BlockPart blid ->
|
||||
let (w', x) = defaultWallDamage dt wl w
|
||||
in w' & cWorld . blocks . ix blid . blHP -~ x & maybeDestroyBlock blid
|
||||
DoorPart drid ->
|
||||
let (w', x) = defaultWallDamage dt wl w
|
||||
in w' & cWorld . doors . ix drid . drHP -~ x & maybeDestroyDoor drid
|
||||
_ -> fst $ defaultWallDamage dt wl w
|
||||
MachinePart mcid -> w' & cWorld . machines . ix mcid . mcDamage .:~ dt
|
||||
BlockPart blid -> w' & cWorld . blocks . ix blid . blHP -~ x & maybeDestroyBlock blid
|
||||
DoorPart drid -> w' & cWorld . doors . ix drid . drHP -~ x & maybeDestroyDoor drid
|
||||
_ -> w'
|
||||
where
|
||||
x = dt' ^. dmAmount
|
||||
(w', dt') = damageWallEffect dt wl w
|
||||
|
||||
-- block destruction is convoluted...
|
||||
maybeDestroyBlock :: Int -> World -> World
|
||||
|
||||
Reference in New Issue
Block a user