Move item effect functions

This commit is contained in:
2022-07-20 22:43:30 +01:00
parent b36e7f8b78
commit 866196ab3e
16 changed files with 257 additions and 229 deletions
+1 -13
View File
@@ -20,24 +20,12 @@ rewindGun = defaultLeftItem
{ _wpMaxCharge = 250
, _wpCharge = 0
}
, _itEffect = ItRewindEffect rewindEffect []
, _itEffect = ItRewindEffect RewindEffect []
, _itUse = defaultlUse
& lUse .~ LRewind --useRewindGun
& eqEq . eqSite .~ GoesOnChest
}
& itType . iyBase .~ LEFT REWINDER
rewindEffect :: Item -> Creature -> World -> World
rewindEffect itm cr w
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take maxcharge . (w' : ))
& ptrWpCharge .~ length (_rewindWorlds w)
| otherwise = w & rewindWorlds .~ []
& ptrWpCharge .~ 0
where
invid = _ipInvID $ _itPos itm
ptrWpCharge = creatures . ix (_crID cr) . crInv . ix invid . itConsumption . wpCharge
maxcharge = _wpMaxCharge . _itConsumption $ itm
w' = w & rewindWorlds .~ []
& timeFlow .~ NormalTimeFlow
-- needs to shift this item to the current inventory slot
shrinkGun :: Item