Move equipment effects into "zipper" item update
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -48,4 +48,4 @@ armourChaseCrit =
|
||||
, _crMvType = defaultChaseMvType{_mvTurnRad = FloatConst 0.05}
|
||||
}
|
||||
& crEquipment . at OnChest ?~ 0
|
||||
& crInvEquipped . at 0 ?~ OnChest
|
||||
-- & crInvEquipped . at 0 ?~ OnChest
|
||||
|
||||
@@ -28,7 +28,7 @@ invisibleChaseCrit =
|
||||
& crCamouflage .~ Invisible
|
||||
& crInv . at 0 ?~ wristInvisibility
|
||||
& crEquipment . at OnLeftWrist ?~ 0
|
||||
& crInvEquipped . at 0 ?~ OnLeftWrist
|
||||
-- & crInvEquipped . at 0 ?~ OnLeftWrist
|
||||
|
||||
chaseCrit :: Creature
|
||||
chaseCrit =
|
||||
|
||||
@@ -70,7 +70,7 @@ crUpdate f =
|
||||
, updateInv -- upInv must be called before invSideEff 22.05.23
|
||||
, invRootItemEffs
|
||||
, invSideEff
|
||||
, equipmentEffects
|
||||
-- , equipmentEffects
|
||||
]
|
||||
|
||||
checkDeath :: Creature -> World -> World
|
||||
@@ -172,11 +172,11 @@ invRootItemEffs :: Creature -> World -> World
|
||||
invRootItemEffs cr =
|
||||
appEndo $
|
||||
foldMap
|
||||
(reduceLocLDT (Endo . invItemLocUpdate) . LocLDT TopLDT)
|
||||
(reduceLocLDT (Endo . invItemLocUpdate cr) . LocLDT TopLDT)
|
||||
(invLDT (_crInv cr))
|
||||
|
||||
invItemLocUpdate :: LocationLDT ItemLink ComposedItem -> World -> World
|
||||
invItemLocUpdate loc w = case itm ^. itType of
|
||||
invItemLocUpdate :: Creature -> LocationLDT ItemLink ComposedItem -> World -> World
|
||||
invItemLocUpdate cr loc w = doAnyEquipmentEffect cr loc $ case itm ^. itType of
|
||||
ATTACH BULLETSYNTH -> trySynthBullet loc w
|
||||
EQUIP WRIST_ECG | haspulse -> tryUseParent loc w
|
||||
_ -> w
|
||||
@@ -186,6 +186,13 @@ invItemLocUpdate loc w = case itm ^. itType of
|
||||
== Just 0
|
||||
itm = loc ^. locLDT . ldtValue . _1
|
||||
|
||||
doAnyEquipmentEffect :: Creature -> LocationLDT ItemLink ComposedItem -> World -> World
|
||||
doAnyEquipmentEffect cr loc = case itm ^? itLocation . ilEquipPosition . _Just of
|
||||
Just _ -> useE (_eeUse (_uequipEffect $ _itUse itm)) itm cr
|
||||
_ -> id
|
||||
where
|
||||
itm = loc ^. locLDT . ldtValue . _1
|
||||
|
||||
tryUseParent :: LocationLDT ItemLink ComposedItem -> World -> World
|
||||
tryUseParent loc w = fromMaybe w $ do
|
||||
t <- locUp loc
|
||||
|
||||
@@ -24,7 +24,7 @@ equipmentStrValue itm = case _itType itm of
|
||||
_ -> 0
|
||||
|
||||
crCurrentEquipment :: Creature -> IM.IntMap Item
|
||||
crCurrentEquipment = IM.filter (isJust . (^? itLocation . ilEquipPosition)) . _crInv
|
||||
crCurrentEquipment = IM.filter (isJust . (^? itLocation . ilEquipPosition . _Just)) . _crInv
|
||||
-- merge
|
||||
-- dropMissing
|
||||
-- dropMissing
|
||||
|
||||
Reference in New Issue
Block a user