Cleanup
This commit is contained in:
+13
-8
@@ -10,6 +10,7 @@ doInvEffect iie = case iie of
|
||||
NoInvEffect -> const $ const id
|
||||
ChargeIfEquipped -> chargeIfEquipped
|
||||
ChargeIfInInventory -> chargeIfInInventory
|
||||
SetCharge i -> setItemCharge i
|
||||
EffectIfHeld f g -> onOffEff f g
|
||||
CreateHeldLight -> createHeldLight
|
||||
CreateShieldWall -> createShieldWall
|
||||
@@ -31,27 +32,31 @@ onOffEff f g it
|
||||
-- , _futureWorlds = []
|
||||
-- }
|
||||
|
||||
setItemCharge :: Int -> Item -> Creature -> World -> World
|
||||
setItemCharge i itm cr w =
|
||||
w & ptrWpCharge %~ const i
|
||||
where
|
||||
invid = _ipInvID $ _itLocation itm
|
||||
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||
|
||||
chargeIfInInventory :: Item -> Creature -> World -> World
|
||||
chargeIfInInventory itm cr w =
|
||||
w & ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||
chargeIfInInventory itm cr w =
|
||||
w & ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||
where
|
||||
invid = _ipInvID $ _itLocation itm
|
||||
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
||||
|
||||
|
||||
chargeIfEquipped :: Item -> Creature -> World -> World
|
||||
chargeIfEquipped itm cr w
|
||||
chargeIfEquipped itm cr
|
||||
| Just invid == cr ^. crLeftInvSel . lisMPos =
|
||||
w & ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||
| otherwise =
|
||||
w & ptrWpCharge .~ 0
|
||||
ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||
| otherwise = ptrWpCharge .~ 0
|
||||
where
|
||||
invid = _ipInvID $ _itLocation itm
|
||||
ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||
maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
||||
|
||||
|
||||
--resetAttachmentEffect :: Item -> Creature -> World -> World
|
||||
--resetAttachmentEffect itm cr w
|
||||
-- | _ieCounter iteff < 0 = w & pointToIt . itAttachment .~ NoItAttachment
|
||||
|
||||
Reference in New Issue
Block a user