Cleanup, use pattern guards

This commit is contained in:
2024-12-20 17:28:42 +00:00
parent 58635466ae
commit e34a17a027
+9 -17
View File
@@ -71,23 +71,15 @@ showEquipItem eit = case eit of
_ -> show eit
itemNumberDisplay :: Creature -> ComposedItem -> [String]
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
_ | EQUIP WRIST_ECG <- itm ^. itType
-> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
-- (_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
-- (WeaponTargetingSF,_,_)
_ | WeaponTargetingSF <- ci ^. _2
-> [maybe "" (const "!TARG!") (itm ^? itTargeting . itTgPos . _Just)]
_ | hasammo -> [maybe "" shortShow
$ itm ^? itConsumables . magLoadStatus . iaLoaded]
--(_,UseAttach (APInt i),_) -> [show i]
_ | UseAttach (APInt i) <- itm ^. itUse -> [show i]
_ | UseScope OpticScope {_opticZoom = x} <- itm ^. itUse -> [shortShow x]
-- (_,UseScope OpticScope {_opticZoom = x},_) -> [shortShow x]
(_,_,_) -> mempty
where
itm = ci ^. _1
hasammo = isJust $ itm ^? itConsumables . magLoadStatus . iaLoaded
itemNumberDisplay cr ci
| EQUIP WRIST_ECG <- ci ^. _1 . itType
= [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
| WeaponTargetingSF <- ci ^. _2
= [maybe "" (const "!TARG!") (ci ^? _1 . itTargeting . itTgPos . _Just)]
| Just x <- ci ^? _1 . itConsumables . magLoadStatus . iaLoaded = [shortShow x]
| UseAttach (APInt i) <- ci ^. _1 . itUse = [show i]
| UseScope OpticScope {_opticZoom = x} <- ci ^. _1 . itUse = [shortShow x]
| otherwise = mempty
displayPulse :: Int -> String
displayPulse 0 = "*****"