Tweak module display and logic

This commit is contained in:
2023-01-12 12:51:24 +00:00
parent 94c0af97fd
commit 37e26f53e6
19 changed files with 250 additions and 80 deletions
+26 -14
View File
@@ -1,5 +1,6 @@
module Dodge.Item.Info where
import Dodge.Module.Info
import Data.Char
import Dodge.Data.Item
import qualified Data.Map.Strict as M
@@ -8,11 +9,12 @@ import LensHelp
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
1 -> "It takes up one inventory slot. "
x -> "It takes up " ++ showInt x ++ " inventory slots. "
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
@@ -180,13 +182,10 @@ craftInfo fit = case fit of
BATTERY -> "A store of electical potential energy."
FUELCELL -> "A devices that converts chemical energy into electricity."
PORTABLEFUSION -> "A miniature nuclear reactor."
INCENDIARYMODULE -> "A device that converts projectiles into incendiary projectiles."
STATICMODULE -> "A device that converts projectiles into electrostatic projectiles."
CONCUSSMODULE -> "A device that converts projectiles into concussive projectiles."
BULPAYLOADMODULE ebt -> "A device that converts projectiles into " ++ displayBulletPayload ebt ++ " projectiles."
FRAGMODULE -> "A device that converts projectiles into fragmentation projectiles."
FLASHMODULE -> "A device that converts projectiles into flashbang projectiles."
BOUNCEMODULE -> "A device that converts projectiles into bouncing projectiles."
PENMODULE -> "A device that converts projectiles into pentrating projectiles."
BULBODYMODULE be -> "A device that converts projectiles into " ++ displayBulletBody be ++ " projectiles."
TELEPORTMODULE -> "A device that allows for near-instant translocation across space."
TIMEMODULE -> "A device that can affect temporality."
SIZEMODULE -> "A device that can affect physical size."
@@ -231,23 +230,36 @@ equipSiteInfo es = case es of
GoesOnBack -> " on the back"
GoesOnWrist -> " on a wrist"
GoesOnLegs -> " on both legs"
GoesOnSpecial -> " in a unique location"
itmModuleInfo :: M.Map ModuleSlot ItemModuleType -> String
itmModuleInfo m
| m == mempty = ""
| otherwise = "Modifications can be made "
| 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 -> "that affect how fired bullets collide with objects"
ModBulletPayload -> "that change bullet payloads"
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"
ModBulletTrajectory -> "to the trajectory of fired bullets"
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 -> "by adding an attachment"
ModHeldAttach -> "to add an attachment that may have any number of effects"