This commit is contained in:
2024-09-30 12:03:23 +01:00
parent 9ad1b8cc5b
commit 65564c993b
11 changed files with 147 additions and 290 deletions
+12 -9
View File
@@ -3,14 +3,14 @@ module Dodge.Combine (
combineList,
) where
import Control.Lens
import Control.Monad
--import Control.Lens
--import Control.Monad
import Data.Bifunctor
import qualified Data.IntSet as IS
--import qualified Data.IntSet as IS
import Data.List (sortOn)
import Data.Map.Merge.Strict
--import Data.Map.Merge.Strict
import qualified Data.Map.Strict as M
import Data.Maybe
--import Data.Maybe
import Dodge.Base.You
import Dodge.Combine.Trie
import Dodge.Data.Combine
@@ -18,7 +18,7 @@ import Dodge.Data.Universe
import Dodge.Item.Display
import Dodge.Item.InventoryColor
import Dodge.Item.SlotsTaken
import Dodge.Module
--import Dodge.Module
import qualified IntMapHelp as IM
import SimpleTrie
@@ -55,13 +55,16 @@ combineList = map f . combineListInfo
}
combineListInfo :: World -> [([Int], ([String], Item))]
combineListInfo w = filter f . map (cmm inv) $ combineItemListYouX w
combineListInfo w = map (cmm inv) $ combineItemListYouX w
where
inv = yourInv w
f (is, (_, itm)) = _itType itm `notElem` fmap _itType (IM.restrictKeys inv (IS.fromList is))
--combineListInfo w = filter f . map (cmm inv) $ combineItemListYouX w
-- where
-- inv = yourInv w
-- f (is, (_, itm)) = _itType itm `notElem` fmap _itType (IM.restrictKeys inv (IS.fromList is))
cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
cmm inv (is, itm) = (is, ([], itm))
cmm _ (is, itm) = (is, ([], itm))
--cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
--cmm inv (is, itm) = (is, itm & itType . iyModules %%~ flip combineModuleMaps mms)
+17 -19
View File
@@ -30,13 +30,13 @@ backpackCombinations =
po xs it = (map o xs, it)
o = (1,)
hatCombinations :: [([(ItAmount,ItemBaseType)],Item)]
hatCombinations =
[ po [EQUIP HAT, CRAFT (TARGETMODULE tt)] (targetingHat tt) | tt <- [minBound..]
]
where
po xs it = (map o xs, it)
o = (1,)
--hatCombinations :: [([(ItAmount,ItemBaseType)],Item)]
--hatCombinations =
-- [ po [EQUIP HAT, CRAFT (TARGETMODULE tt)] (targetingHat tt) | tt <- [minBound..]
-- ]
-- where
-- po xs it = (map o xs, it)
-- o = (1,)
magazineCombinations :: [([(ItAmount,ItemBaseType)],Item)]
magazineCombinations =
@@ -55,7 +55,7 @@ itemCombinations :: [([(ItAmount, ItemBaseType)], Item)]
itemCombinations =
watchCombinations ++
backpackCombinations ++
hatCombinations ++
-- hatCombinations ++
magazineCombinations ++
[ po [CRAFT PIPE, CRAFT HARDWARE] (bangStick 1)
, po [HELD (BANGSTICK 1), CRAFT TIN] pistol
@@ -108,8 +108,8 @@ itemCombinations =
, po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (autoDetector CREATUREDETECTOR)
, po [AMMOMAG BATTERY, cr LED] torch
, po [hd TORCH, eq HAT] headLamp
, po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (energyBallCraft IncBall)
, po [cr TRANSFORMER, AMMOMAG BATTERY, cr MICROCHIP] (energyBallCraft TeslaBall)
-- , po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (energyBallCraft IncBall)
-- , po [cr TRANSFORMER, AMMOMAG BATTERY, cr MICROCHIP] (energyBallCraft TeslaBall)
]
-- ++ map (\i -> po [HELD (LASWIDE i), cr TRANSFORMER] $ lasWide (i + 1)) [2 .. 9]
++ map (\i -> po [cr PIPE, HELD (BANGSTICK i)] $ bangStick (i + 1)) [1 .. 8]
@@ -222,8 +222,6 @@ itemCombinations =
-- amod = (,)
-- cr = CRAFT
homingLaunchers :: [Item]
homingLaunchers = launcher : [launcherX i | i <- [2 .. 10]]
--batteryGuns :: [Item]
--batteryGuns =
@@ -237,13 +235,13 @@ homingLaunchers = launcher : [launcherX i | i <- [2 .. 10]]
--teleportableWeapons :: [Item]
--teleportableWeapons = bulletWeapons ++ batteryGuns ++ homingLaunchers
bulletMagazines :: [Item]
bulletMagazines =
[tinMag
,revolveMag
,drumMag
,beltMag
]
--bulletMagazines :: [Item]
--bulletMagazines =
-- [tinMag
-- ,revolveMag
-- ,drumMag
-- ,beltMag
-- ]
bulletWeapons :: [Item]
bulletWeapons =
+14 -14
View File
@@ -176,7 +176,7 @@ inventoryX c = case c of
, makeTypeCraftNum 5 TRANSFORMER
, makeTypeCraftNum 5 PRISM
, makeTypeCraftNum 5 LIGHTER
, makeTypeCraftNum 5 (ENERGYBALLCRAFT IncBall)
-- , makeTypeCraftNum 5 (ENERGYBALLCRAFT IncBall)
]
'G' ->
[ autoPistol
@@ -186,11 +186,11 @@ inventoryX c = case c of
] <> fold
[ makeTypeCraftNum 2 HARDWARE
, makeTypeCraftNum 2 MAGNET
, makeTypeCraftNum 5 (ENERGYBALLCRAFT IncBall)
, makeTypeCraftNum 5 (ENERGYBALLCRAFT TeslaBall)
, makeTypeCraftNum 5 (ENERGYBALLCRAFT ConcBall)
, makeTypeCraftNum 5 (BULBODYCRAFT BounceBullet)
, makeTypeCraftNum 5 (BULBODYCRAFT PenetrateBullet)
-- , makeTypeCraftNum 5 (ENERGYBALLCRAFT IncBall)
-- , makeTypeCraftNum 5 (ENERGYBALLCRAFT TeslaBall)
-- , makeTypeCraftNum 5 (ENERGYBALLCRAFT ConcBall)
-- , makeTypeCraftNum 5 (BULBODYCRAFT BounceBullet)
-- , makeTypeCraftNum 5 (BULBODYCRAFT PenetrateBullet)
]
'H' -> [shatterGun]
'I' ->
@@ -219,11 +219,11 @@ inventoryX c = case c of
, makeTypeCraftNum 1 LIGHTSENSOR
, makeTypeCraftNum 1 SOUNDSENSOR
, makeTypeCraftNum 1 HEATSENSOR
, makeTypeCraftNum 1 (BULBODYCRAFT BounceBullet)
, makeTypeCraftNum 1 (BULBODYCRAFT PenetrateBullet)
, makeTypeCraftNum 1 (ENERGYBALLCRAFT IncBall)
, makeTypeCraftNum 1 (ENERGYBALLCRAFT TeslaBall)
, makeTypeCraftNum 1 (ENERGYBALLCRAFT ConcBall)
-- , makeTypeCraftNum 1 (BULBODYCRAFT BounceBullet)
-- , makeTypeCraftNum 1 (BULBODYCRAFT PenetrateBullet)
-- , makeTypeCraftNum 1 (ENERGYBALLCRAFT IncBall)
-- , makeTypeCraftNum 1 (ENERGYBALLCRAFT TeslaBall)
-- , makeTypeCraftNum 1 (ENERGYBALLCRAFT ConcBall)
]
'L' -> [scrollWatch]
'M' -> stackedInventory
@@ -271,9 +271,9 @@ testInventory =
, wristArmour
, flatShield
, sniperRifle
, makeTypeCraft (ENERGYBALLCRAFT IncBall)
, makeTypeCraft (ENERGYBALLCRAFT TeslaBall)
, makeTypeCraft (ENERGYBALLCRAFT ConcBall)
-- , makeTypeCraft (ENERGYBALLCRAFT IncBall)
-- , makeTypeCraft (ENERGYBALLCRAFT TeslaBall)
-- , makeTypeCraft (ENERGYBALLCRAFT ConcBall)
, teleportModule
] <> fold
[ makeTypeCraftNum 1 MOTOR
+6 -65
View File
@@ -1,5 +1,5 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
--{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
@@ -16,17 +16,9 @@ import Dodge.Data.Item.Use.Consumption
data ItemType = ItemType
{ _iyBase :: ItemBaseType
-- , _iyModules :: M.Map ModuleSlot ItemModuleType
}
deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Stack = NoStack | Stack ItAmount
deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data CraftType
= PIPE
| TUBE
@@ -72,17 +64,15 @@ data CraftType
| GASINJECTOR
| FLAKCRAFT
| FRAGCRAFT
| ENERGYBALLCRAFT EnergyBallType
| BULBODYCRAFT BulletEffect
-- | ENERGYBALLCRAFT EnergyBallType
-- | BULBODYCRAFT BulletEffect
| TELEPORTMODULE
| TIMEMODULE
| SIZEMODULE
| GRAVITYMODULE
| TARGETMODULE TargetingType
-- | TARGETMODULE TargetingType
deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Enum, Read) --Generic, Flat)
data ItemBaseType
= HELD {_ibtHeld :: HeldItemType}
| LEFT {_ibtLeft :: LeftItemType}
@@ -95,17 +85,12 @@ data ItemBaseType
| BULLETMOD {_ibtBulletMod :: BulletMod}
deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data AttachType
= ZOOMSCOPE
| BULLETSYNTHESIZER
| REMOTESCREEN
| HOMINGMODULE
| AUGMENTEDHUD
-- | FLETCHINGMODULE
-- | BULPAYLOADATTACH
-- | BULTRAJECTORYATTACH
deriving (Eq, Ord, Show, Read)
data AmmoMagType
@@ -124,8 +109,6 @@ data ConsumableItemType
| EXPLOSIVES
deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data EquipItemType
= MAGSHIELD
| FLAMESHIELD
@@ -147,8 +130,6 @@ data EquipItemType
| AUTODETECTOR Detector
deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data LeftItemType
= BOOSTER
| STOPWATCH
@@ -172,7 +153,6 @@ data HeldItemType
| MINIGUNX {_xNum :: Int}
| VOLLEYGUN {_xNum :: Int}
| RIFLE
-- | REPEATER
| AUTORIFLE
| BURSTRIFLE
| BANGROD
@@ -180,7 +160,6 @@ data HeldItemType
| AMR
| AUTOAMR
| SNIPERRIFLE
-- | MACHINEGUN
| FLAMESPITTER
| FLAMETHROWER
| FLAMETORRENT
@@ -189,13 +168,9 @@ data HeldItemType
| SPARKGUN
| TESLAGUN
| LASGUN
-- | LASCIRCLE
-- | DUALBEAM
-- | LASWIDE {_xNum :: Int}
| TRACTORGUN
| LAUNCHER
| LAUNCHERX {_xNum :: Int}
-- | REMOTELAUNCHER
| POISONSPRAYER
| DRONELAUNCHER
| SHATTERGUN
@@ -206,47 +181,16 @@ data HeldItemType
| KEYCARD Int
deriving (Eq, Ord, Show, Read) --Generic, Flat)
--data ItemModuleType
-- = EMPTYMODULE
-- | MAGNETMAG
-- | BULPAY BulletPayload
-- | BULBODY BulletEffect
-- | BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType}
-- | TARGET {_imtTargetType :: TargetingType}
-- | INCENDLAS
-- | SPLITLAS
-- | STATICLAS
---- | WEPTELE
-- | LAUNCHHOME
-- | ATTACHTORCH
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Detector
= ITEMDETECTOR
| CREATUREDETECTOR
| WALLDETECTOR
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data ModuleSlot
= ModBulletCollision
| ModBulletPayload
| ModRifleMag
| ModAutoMag
| ModTarget
| ModBulletTrajectory
| ModLauncherHoming
| ModBattery
| ModTeleport
| ModDualBeam
| ModHeldAttach
deriving (Eq, Ord, Show, Read) --Generic, Flat)
makeLenses ''ItemType
makeLenses ''ItemBaseType
makeLenses ''HeldItemType
--makeLenses ''ItemModuleType
makeLenses ''AttachType
deriveJSON defaultOptions ''Stack
deriveJSON defaultOptions ''CraftType
deriveJSON defaultOptions ''ConsumableItemType
deriveJSON defaultOptions ''AmmoMagType
@@ -255,11 +199,8 @@ deriveJSON defaultOptions ''Detector
deriveJSON defaultOptions ''EquipItemType
deriveJSON defaultOptions ''LeftItemType
deriveJSON defaultOptions ''HeldItemType
--deriveJSON defaultOptions ''ItemModuleType
deriveJSON defaultOptions ''ModuleSlot
deriveJSON defaultOptions ''ItemBaseType
deriveJSON defaultOptions ''ItemType
instance ToJSONKey ModuleSlot
instance FromJSONKey ModuleSlot
--instance ToJSONKey ModuleSlot
--instance FromJSONKey ModuleSlot
+3 -1
View File
@@ -34,7 +34,9 @@ initialAnoTree =
[ IntAnno $ AnTree . startRoom
, IntAnno $
PassthroughLockKeyLists
[(sensorRoomRunPast ELECTRICAL, takeOne [CRAFT (ENERGYBALLCRAFT TeslaBall), HELD SPARKGUN])]
[(sensorRoomRunPast ELECTRICAL, takeOne
[-- CRAFT (ENERGYBALLCRAFT TeslaBall) ,
HELD SPARKGUN])]
itemRooms
, IntAnno $ AnTree . lasSensorTurretTest
, -- , AnRoom $ tanksRoom [] [] <&> rmPmnts .~ []
+10 -10
View File
@@ -15,19 +15,19 @@ makeTypeCraftNum i ct = replicate i $
makeTypeCraft :: CraftType -> Item
makeTypeCraft = head . makeTypeCraftNum 1
energyBallCraft :: EnergyBallType -> Item
energyBallCraft ebt = makeTypeCraft (ENERGYBALLCRAFT ebt) & itInvSize .~ 1
--energyBallCraft :: EnergyBallType -> Item
--energyBallCraft ebt = makeTypeCraft (ENERGYBALLCRAFT ebt) & itInvSize .~ 1
incendiaryModule :: Item
incendiaryModule = energyBallCraft IncBall
--incendiaryModule :: Item
--incendiaryModule = energyBallCraft IncBall
bulletBodyCraft :: BulletEffect -> Item
bulletBodyCraft ebt =
makeTypeCraft (BULBODYCRAFT ebt)
& itInvSize .~ 1
--bulletBodyCraft :: BulletEffect -> Item
--bulletBodyCraft ebt =
-- makeTypeCraft (BULBODYCRAFT ebt)
-- & itInvSize .~ 1
bounceModule :: Item
bounceModule = bulletBodyCraft BounceBullet
--bounceModule :: Item
--bounceModule = bulletBodyCraft BounceBullet
teleportModule :: Item
teleportModule = makeTypeCraft TELEPORTMODULE & itInvSize .~ 1
+16 -16
View File
@@ -180,15 +180,15 @@ craftInfo fit = case fit of
FUELCELL -> "A devices that converts chemical energy into electricity."
PORTABLEFUSION -> "A miniature nuclear reactor."
GASINJECTOR -> "A device that can inject small quantities of gas into objects."
ENERGYBALLCRAFT ebt -> "A device that can create " ++ addIndefiniteArticle (displayEnergyBallType ebt) ++ " effect."
-- ENERGYBALLCRAFT ebt -> "A device that can create " ++ addIndefiniteArticle (displayEnergyBallType ebt) ++ " effect."
FRAGMODULE -> "A device that converts projectiles into fragmentation projectiles."
FLASHMODULE -> "A device that converts projectiles into flashbang projectiles."
BULBODYCRAFT be -> "A device that converts bullets into " ++ displayBulletBody be ++ " projectiles."
-- BULBODYCRAFT be -> "A device that converts bullets 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."
GRAVITYMODULE -> "A device that can affect gravitational fields."
TARGETMODULE _ -> "A targeting module."
-- TARGETMODULE _ -> "A targeting module."
FLAKCRAFT -> "Creates flak bullets."
FRAGCRAFT -> "Creates fragmentation bullets."
@@ -255,16 +255,16 @@ 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"
--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"
-84
View File
@@ -1,84 +0,0 @@
module Dodge.Item.Module where
import Dodge.Data.Item.Combine
import Geometry.Data
moduleAttachPosition :: ItemBaseType -> ModuleSlot -> (Point3, Point3)
moduleAttachPosition ibt ms = case ms of
ModBulletCollision -> (V3 (x - 2.5) y (0.5 * z) , V3 0 1 0)
ModBulletPayload -> (V3 (-x) 0 (0.5 * z), V3 (-1) 0 0)
ModRifleMag -> undefined
ModAutoMag -> undefined
ModTarget -> (V3 0 0 z, V3 0 0 1)
ModBulletTrajectory -> undefined
ModLauncherHoming -> undefined
ModBattery -> undefined
ModTeleport -> undefined
ModDualBeam -> undefined
ModHeldAttach -> undefined
where
V3 x y z = itBounds ibt
itBounds :: ItemBaseType -> Point3
itBounds ibt = case ibt of
HELD hit -> heldBounds hit
_ -> V3 0 0 0
heldBounds :: HeldItemType -> Point3
heldBounds hit = case hit of
BANGSTICK _ -> V3 0 0 0
PISTOL -> bss
MACHINEPISTOL -> bss
AUTOPISTOL -> bss
SMG -> smgs
BANGCONE -> cs
BLUNDERBUSS -> bbs
GRAPECANNON _ -> bbs
MINIGUNX _ -> minis
VOLLEYGUN _ -> undefined
RIFLE -> rs
-- REPEATER -> rs
AUTORIFLE -> rs
BURSTRIFLE -> rs
BANGROD -> amrs
ELEPHANTGUN -> amrs
AMR -> amrs
AUTOAMR -> amrs
SNIPERRIFLE -> amrs
-- MACHINEGUN -> amrs
FLAMESPITTER -> fs
FLAMETHROWER -> fs
FLAMETORRENT -> fs
FLAMEWALL -> fs
BLOWTORCH -> fs
SPARKGUN -> ts
TESLAGUN -> ts
LASGUN -> ls
-- LASCIRCLE -> ls
-- DUALBEAM -> ls
--LASWIDE _ -> ls
TRACTORGUN -> ls
LAUNCHER -> launchs
LAUNCHERX _ -> launchs
-- REMOTELAUNCHER -> launchs
POISONSPRAYER -> fs
DRONELAUNCHER -> fs
SHATTERGUN -> launchs
FORCEFIELDGUN -> launchs
HELDDETECTOR _ -> launchs
TORCH -> launchs
FLATSHIELD -> launchs
KEYCARD _ -> launchs
where
bss = V3 10 2 3
smgs = V3 20 2 3
cs = V3 5 2 3
bbs = V3 20 2 3
minis = V3 10 2 3
rs = V3 25 2 3
amrs = V3 30 2 3
fs = V3 10 2 3
ts = V3 10 2 3
ls = V3 30 2 3
launchs = V3 10 10 10
+16 -16
View File
@@ -25,8 +25,8 @@ lockRoomMultiItems =
lockRoomKeyItems :: RandomGen g => [(Int -> State g (MetaTree Room String), State g ItemBaseType)]
lockRoomKeyItems =
[ (lasCenSensEdge, takeOne [HELD LAUNCHER, HELD LASGUN, HELD SPARKGUN, HELD FLATSHIELD, HELD FORCEFIELDGUN])
, (sensorRoomRunPast ELECTRICAL, takeOne [CRAFT (ENERGYBALLCRAFT TeslaBall), HELD SPARKGUN])
, (sensorRoomRunPast FLAMING, takeOne [HELD FLAMESPITTER, CRAFT (ENERGYBALLCRAFT IncBall)])
-- , (sensorRoomRunPast ELECTRICAL, takeOne [CRAFT (ENERGYBALLCRAFT TeslaBall), HELD SPARKGUN])
-- , (sensorRoomRunPast FLAMING, takeOne [HELD FLAMESPITTER, CRAFT (ENERGYBALLCRAFT IncBall)])
, (sensorRoomRunPast LASERING, return $ HELD LASGUN)
, (const slowDoorRoomRunPast, return $ HELD (MINIGUNX 3))
, (const longRoomRunPast, takeOne [HELD SNIPERRIFLE, HELD FLATSHIELD])
@@ -106,20 +106,20 @@ itemRooms =
[ rc [keyCard 0]
]
)
,
( CRAFT (ENERGYBALLCRAFT IncBall)
, join $
takeOne
[ rc [incendiaryModule]
]
)
,
( CRAFT (ENERGYBALLCRAFT TeslaBall)
, join $
takeOne
[ rc [makeTypeCraft (ENERGYBALLCRAFT TeslaBall)]
]
)
-- ,
-- ( CRAFT (ENERGYBALLCRAFT IncBall)
-- , join $
-- takeOne
-- [ rc [incendiaryModule]
-- ]
-- )
-- ,
-- ( CRAFT (ENERGYBALLCRAFT TeslaBall)
-- , join $
-- takeOne
-- [ rc [makeTypeCraft (ENERGYBALLCRAFT TeslaBall)]
-- ]
-- )
]
where
rc its = do
+3 -1
View File
@@ -1,4 +1,6 @@
module Dodge.Module.Info where
module Dodge.Module.Info
()
where
--import qualified Data.Map.Strict as M
import Dodge.Data.Item