Fold in more ammo parameters, distinguish loadable and charging weapons

This commit is contained in:
2021-11-27 14:29:44 +00:00
parent 92a8dd59b8
commit 224db733f6
19 changed files with 112 additions and 111 deletions
+11 -12
View File
@@ -20,20 +20,21 @@ rewindGun :: Item
rewindGun = defaultGun
{ _itName = "REWINDER"
, _itIdentity = Rewinder
, _wpAmmo = defaultAmmo
{ _wpMaxAmmo = 0
, _wpLoadedAmmo = 0
, _wpAmmo = ChargeableAmmo
{ _wpMaxCharge = 250
, _wpCharge = 0
}
, _itEffect = ItRewindEffect rewindEffect []
, _itUse = LeftUse $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
}
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
rewindEffect _ cr invid w
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take 250 . (w' : ))
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpLoadedAmmo .~ length (_rewindWorlds w)
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take maxcharge . (w' : ))
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpCharge .~ length (_rewindWorlds w)
| otherwise = w & rewindWorlds .~ []
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpLoadedAmmo .~ 0
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpCharge .~ 0
where
maxcharge = _wpMaxCharge . _wpAmmo $ _crInv cr IM.! invid
w' = w & rewindWorlds .~ []
& rewinding .~ True
@@ -57,9 +58,8 @@ shrinkGun = defaultGun
, _wpAmmo = defaultAmmo
{ _wpMaxAmmo = 100
, _wpLoadedAmmo = 100
, _wpReloadTime = 20
}
, _wpReloadTime = 20
, _wpReloadState = 0
, _itUseRate = 0
, _itUseTime = 0
, _itAimStance = TwoHandFlat
@@ -97,9 +97,8 @@ blinkGun = defaultGun
, _wpAmmo = defaultAmmo
{ _wpMaxAmmo = 100
, _wpLoadedAmmo = 100
, _wpReloadTime = 20
}
, _wpReloadTime = 20
, _wpReloadState = 0
, _itUseRate = 0
, _itUseTime = 0
, _itUse = LeftUse $ hammerCheckL $ shootL aSelfL
@@ -138,9 +137,9 @@ forceFieldGun = defaultGun
, _wpAmmo = defaultAmmo
{ _wpMaxAmmo = 100
, _wpLoadedAmmo = 100
, _wpReloadTime = 40
, _wpReloadState = 0
}
, _wpReloadTime = 40
, _wpReloadState = 0
, _itUseRate = 10
, _itUseTime = 0
, _itUse = undefined