Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+8 -7
View File
@@ -6,7 +6,7 @@ module Dodge.Item.Display (
import Data.Maybe
import Data.Sequence
import Dodge.Data
import Dodge.Data.Creature
import Dodge.Inventory.ItemSpace
import Dodge.Module
import LensHelp
@@ -37,6 +37,7 @@ itemString = head . itemDisplay
itemBaseName :: Item -> String
itemBaseName it = case _iyBase $ _itType it of
NoItemType -> show "NoItemType"
CRAFT str -> show str
HELD hit -> case hit ^? xNum of
Just i -> takeWhile (/= ' ') (show hit) ++ show i
@@ -51,7 +52,7 @@ selectedItemDisplay cr it = itemDisplayWithNumber (showSelectedConsumption cr (_
-- | Displays the item name, ammo if loaded, and any selected '_itCharMode'.
showSelectedConsumption :: Creature -> ItemUse -> String
showSelectedConsumption cr iu = case iu of
RightUse{} -> showReloadProgress cr (_heldConsumption iu)
HeldUse{} -> showReloadProgress cr (_heldConsumption iu)
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
EquipUse{} -> ""
_ -> show $ iu ^?! useAmount . getItAmount -- partial, be careful if adding new data constructors
@@ -72,7 +73,7 @@ showReloadProgress cr ic = case cr ^?! crInvSel . iselAction of
showConsumption :: ItemUse -> String
showConsumption iu = case iu of
RightUse{} -> showReloadProgress' (_heldConsumption iu)
HeldUse{} -> showReloadProgress' (_heldConsumption iu)
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
EquipUse{} -> ""
_ -> show $ iu ^?! useAmount . getItAmount
@@ -90,9 +91,9 @@ showLoadActionType la x = case la of
LoadPrime{} -> "P"
maybeWarmupStatus :: Item -> Maybe String
maybeWarmupStatus it = case it ^? itUse . useDelay . warmMax of
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
Nothing -> Nothing
Just m -> case m - (_warmTime . _useDelay $ _itUse it) of
Just m -> case m - (_warmTime . _heldDelay $ _itUse it) of
x
| x <= 1 -> Just "*WARM"
| otherwise ->
@@ -106,6 +107,6 @@ maybeModeStatus it = case it ^? itUse . heldScroll of
_ -> Nothing
maybeRateStatus :: Item -> Maybe String
maybeRateStatus it = case it ^? itUse . useDelay . rateMaxMax of
maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
Nothing -> Nothing
_ -> Just $ leftPad 3 ' ' (show (_rateMax . _useDelay $ _itUse it))
_ -> Just $ leftPad 3 ' ' (show (_rateMax . _heldDelay $ _itUse it))