Implement bullet trajectories using attachable items

This commit is contained in:
2024-09-29 21:51:14 +01:00
parent 88c3e02459
commit 4545caa7e6
26 changed files with 504 additions and 570 deletions
+6 -48
View File
@@ -8,6 +8,7 @@ module Dodge.Item.Display (
--import Control.Applicative
--import Control.Monad
import ShortShow
import Data.Maybe
import Dodge.Data.Creature
--import Dodge.Item.Info
@@ -71,6 +72,7 @@ itemBaseName itm = case _iyBase $ _itType itm of
ATTACH ait -> showAttachItem ait itm
AMMOMAG ait -> show ait
TARGETING tt -> show tt
HOMING btt -> show btt
showAttachItem :: AttachType -> Item -> String
showAttachItem t itm = case t of
@@ -117,11 +119,12 @@ itemNumberDisplay cr itm = case iu of
--ConsumeUse {_useAmount = x} -> [show $ x ^. getItAmount]
ConsumeUse {} -> []
AttachUse {} -> [] --[showReloadProgress cr itm]
AmmoMagUse {} -> [showLoadedAmount itm]
ScopeUse OpticScope {_opticZoom = x} -> [show x]
AmmoMagUse {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
ScopeUse OpticScope {_opticZoom = x} -> [shortShow x]
ScopeUse {} -> []
TargetingUse {_tgPos = mp} -> [maybe "" show mp]
TargetingUse {_tgPos = mp} -> [maybe "" shortShow mp]
-- this could be cleaner here...
BulletTrajectoryUse {} -> mempty
where
iu = itm ^?! itUse
@@ -134,51 +137,6 @@ showEquipmentNumber _ itm = case _eeUse ee of
where
ee = itm ^?! itUse . equipEffect
--showAmmoSource :: Creature -> Item -> [String]
--showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
-- eu <- itm ^? itUse . equipEffect . eeUse
-- atype <- eu ^? euseAmmoSourceType
-- x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
-- i <- itm ^? itLocation . ipInvID
-- ( do
-- at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
-- as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
-- guard (at' == atype && as == AboveSource)
-- return ["vvvv", x]
-- )
-- <|> Just [x]
showLoadedAmount :: Item -> String
showLoadedAmount itm = maybe [] show $ itm ^? itUse . amagLoadStatus . iaLoaded
--showReloadProgress :: Creature -> Item -> String
--showReloadProgress _ itm = fromMaybe [] $ do
-- ia <- itm ^? itUse . amagLoadStatus
-- return $ case ia ^? iaProgress . _Just . ix 0 of
-- Nothing -> maybe "" show $ ia ^? iaLoaded
-- Just la -> showLoadActionType la ia
--showReloadProgress :: Creature -> Item -> String
--showReloadProgress cr itm = case ic ^? laSource of
-- Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
-- Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
-- Just la -> showLoadActionType la (_laSource ic)
-- Just AboveSource -> fromMaybe "^^^^" $ do
-- i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
-- _ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
-- return ""
-- _ -> ""
-- where
-- ic = itm ^?! itUse . heldConsumption
--showLoadActionType :: LoadAction -> ReloadStatus -> String
--showLoadActionType la as = case la of
-- LoadEject{} -> "E"
-- LoadInsert{} -> "L"
-- LoadAdd{} -> "A" ++ x
-- LoadPrime{} -> "P"
-- where
-- x = maybe "" show $ as ^? iaLoaded
maybeWarmupStatus :: Item -> Maybe String
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
Nothing -> Nothing