From e34a17a02705c1bfb0da22ec95c9a3a637d62bc6 Mon Sep 17 00:00:00 2001 From: justin Date: Fri, 20 Dec 2024 17:28:42 +0000 Subject: [PATCH] Cleanup, use pattern guards --- src/Dodge/Item/Display.hs | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/Dodge/Item/Display.hs b/src/Dodge/Item/Display.hs index 7a25332b6..06a37df6d 100644 --- a/src/Dodge/Item/Display.hs +++ b/src/Dodge/Item/Display.hs @@ -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 = "*****"