This commit is contained in:
2024-09-30 12:54:31 +01:00
parent 65564c993b
commit fc5539cb38
58 changed files with 802 additions and 1255 deletions
+21 -54
View File
@@ -1,25 +1,26 @@
module Dodge.Item.Info where
module Dodge.Item.Info
( itemInfo
) where
import Data.Char
import qualified Data.Map.Strict as M
--import qualified Data.Map.Strict as M
import Dodge.Data.Item
import Dodge.Module.Info
--import Dodge.Module.Info
import LensHelp
import StringHelp
--import StringHelp
itemInfo :: Item -> String
itemInfo itm =
itmBaseInfo itm ++ " " ++ itmUsageInfo itm
++ itmSpaceInfo itm
-- ++ itmModuleInfo (itm ^. itType . iyModules)
itmSpaceInfo :: Item -> String
itmSpaceInfo itm = case ceiling $ _itInvSize itm of
itmSpaceInfo itm = case _itInvSize itm of
1 -> " It takes up one inventory slot. "
x -> " It takes up " ++ showInt x ++ " inventory slots. "
itmBaseInfo :: Item -> String
itmBaseInfo itm = case itm ^. itType . iyBase of
itmBaseInfo itm = case itm ^. itType of
HELD hit -> heldInfo hit
LEFT lit -> leftInfo lit
EQUIP eit -> equipInfo eit
@@ -112,7 +113,6 @@ equipInfo eit = case eit of
INVISIBILITYEQUIPMENT _ -> "A device that bends light around its user."
BRAINHAT -> "An iq enhancer. Useless."
HAT -> "A hat."
TARGETINGHAT tt -> "Headwear that " ++ targetingInfo tt
HEADLAMP -> "A torch strapped to a hat."
POWERLEGS -> "Strength enhancing legs."
SPEEDLEGS -> "Speed enhancing legs."
@@ -124,13 +124,13 @@ equipInfo eit = case eit of
BATTERYPACK -> "A collection of batteries with a universal adapter."
AUTODETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius. Pulses automatically. "
targetingInfo :: TargetingType -> String
targetingInfo tt = case tt of
TARGETLASER -> "creates a laser, the end of which becomes the target."
TargetRBPress -> "creates a fixed target."
TargetRBLine -> "creates a line target."
TargetRBCreature -> "targets a creature."
TargetCursor -> "creates a moving target."
--targetingInfo :: TargetingType -> String
--targetingInfo tt = case tt of
-- TARGETLASER -> "creates a laser, the end of which becomes the target."
-- TargetRBPress -> "creates a fixed target."
-- TargetRBLine -> "creates a line target."
-- TargetRBCreature -> "targets a creature."
-- TargetCursor -> "creates a moving target."
consumableInfo :: ConsumableItemType -> String
consumableInfo cit = case cit of
@@ -199,7 +199,7 @@ detectorInfo d = case d of
WALLDETECTOR -> "walls"
itmUsageInfo :: Item -> String
itmUsageInfo itm = case itm ^. itType . iyBase of
itmUsageInfo itm = case itm ^. itType of
HELD _ -> heldPositionInfo itm
LEFT _ ->
"This item can be equipped" ++ itmEquipSiteInfo itm
@@ -219,8 +219,6 @@ aimStanceInfo as = case as of
TwoHandFlat -> "It is held in two hands at its sides."
OneHand -> "It is held in one hand."
-- LeaveHolstered -> "It is to be left holstered."
itmEquipSiteInfo :: Item -> String
itmEquipSiteInfo = maybe "" equipSiteInfo . (^? itUse . equipEffect . eeSite)
@@ -232,39 +230,8 @@ equipSiteInfo es = case es of
GoesOnWrist -> " on a wrist"
GoesOnLegs -> " on both legs"
--itmModuleInfo :: M.Map ModuleSlot ItemModuleType -> String
--itmModuleInfo m
-- | m == mempty = ""
-- | otherwise = mms ++ ems
-- where
-- (mademods, emptymods) = M.partition (/= EMPTYMODULE) m
-- mms
-- | mademods == mempty = ""
-- | otherwise =
-- " Modifications have been made "
-- ++ makeCommaList (map moduleInfo $ M.keys mademods)
-- ems
-- | emptymods == mempty = ""
-- | otherwise =
-- " Modifications can be made "
-- ++ makeCommaList (map moduleInfo $ M.keys emptymods)
makeCommaList :: [String] -> String
makeCommaList [] = ""
makeCommaList [x] = x ++ "."
makeCommaList [x, y] = x ++ " and " ++ y ++ "."
makeCommaList (x : xs) = x ++ ", " ++ makeCommaList xs
--moduleInfo :: ModuleSlot -> String
--moduleInfo imt = case imt of
-- ModBulletCollision -> "to affect how fired bullets collide with objects"
-- ModBulletPayload -> "to bullet payloads"
-- ModRifleMag -> "to the magazine"
-- ModAutoMag -> "to the magazine"
-- ModTarget -> "to add a targeting system or scope"
-- ModBulletTrajectory -> "to utilize any installed targeting system to affect the trajectory of fired bullets"
-- ModLauncherHoming -> "to add a homing system"
-- ModBattery -> "to its battery system"
-- ModTeleport -> "to add a teleporation system"
-- ModDualBeam -> "to the dual beams"
-- ModHeldAttach -> "to add an attachment that may have any number of effects"
--makeCommaList :: [String] -> String
--makeCommaList [] = ""
--makeCommaList [x] = x ++ "."
--makeCommaList [x, y] = x ++ " and " ++ y ++ "."
--makeCommaList (x : xs) = x ++ ", " ++ makeCommaList xs