Generalise weapon character modes

This commit is contained in:
2021-04-29 23:13:41 +02:00
parent 6a38950501
commit 619756dd73
8 changed files with 129 additions and 127 deletions
+6 -16
View File
@@ -7,31 +7,21 @@ import Dodge.Data
import Dodge.Base
import Dodge.Item.Attachment.Data
import Data.Sequence
import Control.Lens
import Control.Monad
-- MODES SHOULD BE MADE UNIFORM
-- not sure if this is in the right place...
basicWeaponDisplay :: Item -> String
basicWeaponDisplay it = case it ^? itAttachment . _Just . itCharMode of
Just c -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ [' ',c]
otherwise -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded)
Just (c :<| _) -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ [' ',c]
_ -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded)
where
availableAmmo = show $ _wpMaxAmmo it
aIfLoaded = case (_wpReloadState it) of
0 -> show $ _wpLoadedAmmo it
x -> "R" ++ show x
displayAutoGun :: Item -> String
displayAutoGun it@(Weapon {_itAttachment = mayMode})
= midPadL 10 ' ' "AUTOGUN" (' ':aIfLoaded) ++ (' ':phaseS)
where aIfLoaded = case (_wpReloadState it) of
0 -> show $ _wpLoadedAmmo it
x -> "R" ++ show x
phaseS = case mayMode of
Just (ItMode 0) -> "M"
Just (ItMode 1) -> "S"
Just (ItMode 2) -> "B"
0 -> show $ _wpLoadedAmmo it
x -> "R" ++ show x
displayLasGun :: Item -> String
displayLasGun it@(Weapon {_itAttachment = mayPhase})