Cleanup, allow more general magShield deflection

This commit is contained in:
2024-12-24 12:54:28 +00:00
parent 75958c1e2c
commit 15317882e6
5 changed files with 85 additions and 89 deletions
+5 -4
View File
@@ -35,21 +35,22 @@ useE :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
useE loc cr = case eo of
Nothing -> id
Just EDoNothing -> id
Just EMagShield -> useMagShield itm cr
Just (EMagShield mt) -> useMagShield mt itm cr
Just EWristShield -> setWristShieldPos itm cr
Just EHeadLamp -> createHeadLamp itm cr
where
itm = loc ^. locLDT . ldtValue . _1
eo = itm ^? itUse . uequipEffect . eeUse
useMagShield :: Item -> Creature -> World -> World
useMagShield _ cr w = w & cWorld . lWorld . magnets .:~ themagnet
-- this should probably drain energy
useMagShield :: MagnetBuBu -> Item -> Creature -> World -> World
useMagShield mt _ cr w = w & cWorld . lWorld . magnets .:~ themagnet
where
themagnet =
Magnet
{ _mgPos = _crPos cr
--, _mgField = MagnetBuBuCurveAroundField 50 200
, _mgField = MagnetDeflect
, _mgField = mt
}
onEquipWristShield :: Item -> Creature -> World -> World