Rethink item ammo to item consumables, start item type datatype

This commit is contained in:
2021-11-29 16:22:31 +00:00
parent 3a605b8156
commit f40d486d68
31 changed files with 238 additions and 193 deletions
+8 -7
View File
@@ -20,7 +20,7 @@ rewindGun :: Item
rewindGun = defaultGun
{ _itName = "REWINDER"
, _itIdentity = Rewinder
, _wpAmmo = ChargeableAmmo
, _itConsumption = ChargeableAmmo
{ _wpMaxCharge = 250
, _wpCharge = 0
}
@@ -30,11 +30,12 @@ rewindGun = defaultGun
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
rewindEffect _ cr invid w
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take maxcharge . (w' : ))
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpCharge .~ length (_rewindWorlds w)
& ptrWpCharge .~ length (_rewindWorlds w)
| otherwise = w & rewindWorlds .~ []
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpCharge .~ 0
& ptrWpCharge .~ 0
where
maxcharge = _wpMaxCharge . _wpAmmo $ _crInv cr IM.! invid
ptrWpCharge = creatures . ix (_crID cr) . crInv . ix invid . itConsumption . wpCharge
maxcharge = _wpMaxCharge . _itConsumption $ _crInv cr IM.! invid
w' = w & rewindWorlds .~ []
& rewinding .~ True
@@ -55,7 +56,7 @@ shrinkGun :: Item
shrinkGun = defaultGun
{ _itName = "SHRINKER"
, _itIdentity = Generic
, _wpAmmo = defaultAmmo
, _itConsumption = defaultAmmo
{ _wpMaxAmmo = 100
, _wpLoadedAmmo = 100
, _wpReloadTime = 20
@@ -87,7 +88,7 @@ blinkGun :: Item
blinkGun = defaultGun
{ _itName = "BLINKER"
, _itIdentity = Blinker
, _wpAmmo = defaultAmmo
, _itConsumption = defaultAmmo
{ _wpMaxAmmo = 100
, _wpLoadedAmmo = 100
, _wpReloadTime = 20
@@ -121,7 +122,7 @@ forceFieldGun :: Item
forceFieldGun = defaultGun
{ _itName = "FORCEFIELD"
, _itIdentity = ForceFieldGun
, _wpAmmo = defaultAmmo
, _itConsumption = defaultAmmo
{ _wpMaxAmmo = 100
, _wpLoadedAmmo = 100
, _wpReloadTime = 40