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
+12 -8
View File
@@ -11,12 +11,16 @@ import Data.Sequence
import Control.Lens
{- | Displays the item name, ammo if loaded, and any selected '_itCharMode'. -}
basicWeaponDisplay :: Item -> String
basicWeaponDisplay it = case it ^? itAttachment of
Just ItCharMode {_itCharMode = (c :<| _)} -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ [' ',c]
Just ItMode {_itMode = i} -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ show i
_ -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded)
basicWeaponDisplay it = midPadL 10 ' ' thename (' ' : thenumber) ++ theparam
where
aIfLoaded = case it ^? wpReloadState of
Just 0 -> show $ _wpLoadedAmmo (_wpAmmo it)
Just x -> "R" ++ show x
_ -> ""
thename = _itName it
thenumber = case it ^? wpAmmo of
Just am@LoadableAmmo{} -> case _wpReloadState am of
0 -> show $ _wpLoadedAmmo am
x -> "R" ++ show x
Just am@ChargeableAmmo{} -> show $ _wpCharge am
Nothing -> ""
theparam = case it ^? itAttachment of
Just ItCharMode {_itCharMode = (c :<| _)} -> [' ',c]
Just ItMode {_itMode = i} -> show i
_ -> []