Allow for partial reloading

This commit is contained in:
2021-12-01 17:40:09 +00:00
parent d75ea2b252
commit 016a1faf80
21 changed files with 181 additions and 143 deletions
+6 -5
View File
@@ -4,6 +4,7 @@ Display of weapon strings in the inventory.
module Dodge.Item.Weapon.InventoryDisplay
( basicWeaponDisplay
, maybeWarmupStatus
, maybeRateStatus
) where
import Dodge.Data
import Padding
@@ -17,9 +18,9 @@ basicWeaponDisplay it = [midPadL 10 ' ' thename (' ' : thenumber) ++ theparam]
where
thename = _itName it
thenumber = case it ^? itConsumption of
Just am@LoadableAmmo{} -> case _wpReloadState am of
0 -> show $ _wpLoadedAmmo am
x -> "R" ++ show x
Just am@LoadableAmmo{} -> case _reloadState am of
Nothing' -> show (_ammoLoaded am)
Just' x -> show x ++ "R" ++ show (_ammoLoaded am)
Just am@ChargeableAmmo{} -> show $ _wpCharge am
Just x@ItemItselfConsumable{} -> show $ _itMaxStack' x
Nothing -> ""
@@ -28,7 +29,7 @@ basicWeaponDisplay it = [midPadL 10 ' ' thename (' ' : thenumber) ++ theparam]
$ mapMaybe ($ it)
[ maybeModeStatus
-- , maybeWarmupStatus
, maybeRateStatus
-- , maybeRateStatus
]
maybeModeStatus :: Item -> Maybe String
@@ -40,7 +41,7 @@ maybeModeStatus it = case it ^? itAttachment of
maybeRateStatus :: Item -> Maybe String
maybeRateStatus it = case it ^? itUse . useDelay . rateMaxMax of
Nothing -> Nothing
_ -> Just $ ' ' : "T" ++ leftPad 3 ' ' (show (_rateMax . _useDelay $ _itUse it))
_ -> Just $ ' ' : " " ++ leftPad 4 ' ' (show (_rateMax . _useDelay $ _itUse it))
maybeWarmupStatus :: Item -> Maybe String
maybeWarmupStatus it = case it ^? itUse . useDelay . warmMax of