Work on time scrolling

This commit is contained in:
2022-10-27 10:23:52 +01:00
parent 4ffd361f11
commit 35f2992fe4
12 changed files with 127 additions and 83 deletions
+28 -19
View File
@@ -8,8 +8,8 @@ import Dodge.LightSource.Torch
doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
doInvEffect iie = case iie of
NoInvEffect -> const $ const id
RewindEffect -> rewindEffect
TimeScrollEffect -> timeScrollEffect
ChargeIfEquipped -> chargeIfEquipped
ChargeIfInInventory -> chargeIfInInventory
EffectIfHeld f g -> onOffEff f g
CreateHeldLight -> createHeldLight
CreateShieldWall -> createShieldWall
@@ -24,24 +24,33 @@ onOffEff f g it
| _itIsHeld it = doInvEffect f it
| otherwise = doInvEffect g it
timeScrollEffect :: Item -> Creature -> World -> World
timeScrollEffect _ _ w = w & timeFlow .~ ScrollTimeFlow 0
--timeScrollEffect :: Item -> Creature -> World -> World
--timeScrollEffect itm _ w = w & timeFlow .~ ScrollTimeFlow
-- { _scrollSmoothing = 0
-- , _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge
-- , _futureWorlds = []
-- }
chargeIfInInventory :: Item -> Creature -> World -> World
chargeIfInInventory itm cr w =
w & ptrWpCharge %~ (min maxcharge . (+ 1))
where
invid = _ipInvID $ _itLocation itm
ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
chargeIfEquipped :: Item -> Creature -> World -> World
chargeIfEquipped itm cr w
| Just invid == _crLeftInvSel cr =
w & ptrWpCharge %~ (min maxcharge . (+ 1))
| otherwise =
w & ptrWpCharge .~ 0
where
invid = _ipInvID $ _itLocation itm
ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
rewindEffect :: Item -> Creature -> World -> World
rewindEffect _ _ w = w
--rewindEffect itm cr w =
-- | Just invid == _crLeftInvSel cr =
-- w & cwTime . rewindWorlds %~ (take maxcharge . (cw :))
-- & ptrWpCharge .~ length (w ^. cwTime . rewindWorlds)
-- | otherwise =
-- w & cwTime . rewindWorlds .~ []
-- & ptrWpCharge .~ 0
-- where
-- invid = _ipInvID $ _itLocation itm
-- ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
-- cw =
-- _cWorld w
--resetAttachmentEffect :: Item -> Creature -> World -> World
--resetAttachmentEffect itm cr w