Allow for stacking of items and combining sensibly

This commit is contained in:
2021-12-03 17:18:06 +00:00
parent b2a9192fe4
commit b41e3e3637
24 changed files with 166 additions and 159 deletions
+7 -4
View File
@@ -2,19 +2,22 @@
Display of weapon strings in the inventory.
-}
module Dodge.Item.Weapon.InventoryDisplay
( basicWeaponDisplay
( basicItemDisplay
, maybeWarmupStatus
, maybeRateStatus
) where
import Dodge.Data
import Padding
import Dodge.Inventory.ItemSpace
import Data.Maybe
import Data.Sequence
import Control.Lens
{- | Displays the item name, ammo if loaded, and any selected '_itCharMode'. -}
basicWeaponDisplay :: Item -> [String]
basicWeaponDisplay it = [midPadL 10 ' ' thename (' ' : thenumber) ++ theparam]
basicItemDisplay :: Item -> [String]
basicItemDisplay it = Prelude.take (itSlotsTaken it) $
[midPadL 15 ' ' thename (' ' : thenumber) ++ theparam]
++ repeat "*"
where
thename = _itName it
thenumber = case it ^? itConsumption of
@@ -22,7 +25,7 @@ basicWeaponDisplay it = [midPadL 10 ' ' thename (' ' : thenumber) ++ theparam]
Nothing' -> show (_ammoLoaded am)
Just' x -> show x ++ "R" ++ show (_ammoLoaded am)
Just am@ChargeableAmmo{} -> show $ _wpCharge am
Just x@ItemItselfConsumable{} -> show $ _itMaxStack' x
Just x@ItemItselfConsumable{} -> "x" ++ show (_itAmount' x)
Just NoConsumption -> "NOCONSUMPTION"
Nothing -> ""
theparam = fromMaybe []