Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+11 -32
View File
@@ -18,29 +18,21 @@ itemCombinations =
, po [cr CAN, cr HARDWARE] bangCone
, po [HELD BANGCONE, cr PLANK] blunderbuss
, po [HELD BLUNDERBUSS, cr DRUM] (grapeCannon 1)
, -- , po [BANGCONE,PUMP,HARDWARE] $ grenadeLauncher 1
-- , po [GRENADELAUNCHER 1,MOTOR,DRUM] $ grenadeLauncher 2
-- , po [cr PIPE, cr HARDWARE] (volleyGun 1)
po [HELD (BANGSTICK 1), cr PLANK] rifle
, po [HELD (BANGSTICK 1), cr PLANK] rifle
, po [HELD (BANGSTICK 1), HELD (BANGSTICK 1), HELD (BANGSTICK 1)] (volleyGun 3)
, po [HELD RIFLE, cr TIN] repeater
, po [HELD REPEATER, cr SPRING] autoRifle
, po [HELD REPEATER, cr CAN] burstRifle
-- , po [BURSTRIFLE,cr SPRING,cr HARDWARE] fastBurstRifle
-- , po [FASTBURSTRIFLE,cr SPRING,cr HARDWARE] completeBurstRifle
]
++ [ po [cr MOTOR, HELD (VOLLEYGUN i)] $ miniGunX i | i <- [3 .. 10]
]
++
-- , po [BANGSTICK 1,cr TUBE] elephantGun
[ po [HELD AMR, cr PIPE] sniperRifle
, po [HELD RIFLE, cr PIPE] amr
, po [HELD AMR, cr SPRING] autoAmr
, po [HELD AMR, cr MOTOR] machineGun
, p [p 2 $ cr TUBE, o $ cr HARDWARE] launcher
, p [p 2 $ cr TUBE, o $ HELD LAUNCHER] (launcherX 2)
]
++ [ po [HELD AMR, cr PIPE] sniperRifle
, po [HELD RIFLE, cr PIPE] amr
, po [HELD AMR, cr SPRING] autoAmr
, po [HELD AMR, cr MOTOR] machineGun
, p [p 2 $ cr TUBE, o $ cr HARDWARE] launcher
, p [p 2 $ cr TUBE, o $ HELD LAUNCHER] (launcherX 2)
]
++ [p [p 2 $ cr TUBE, o $ HELD (LAUNCHERX i)] (launcherX (i + 1)) | i <- [2 .. 9]]
++ [ po [cr LIGHTER, cr PUMP, cr CAN] flameSpitter
, po [HELD FLAMESPITTER, cr CAN, cr PUMP] blowTorch
@@ -48,12 +40,8 @@ itemCombinations =
, po [HELD FLAMETHROWER, cr DRUM] flameWall
, po [HELD FLAMETHROWER, cr PUMP] flameTorrent
, p [o $ cr PRISM, o $ cr TRANSFORMER, o $ cr PIPE] lasGun
, -- , p [o LASGUN,o $ cr PRISM] lasSway
-- , p [o LASGUN,o $ cr HARDWARE] lasSwing
-- , p [o LASGUN,o PIPE] lasGunPulse
po [HELD LASGUN, HELD LASGUN, cr HARDWARE] dualBeam
, -- , p [o LASGUN,o $ cr PIPE, o $ cr PRISM] lasWidePulse
po [HELD LASGUN, cr TRANSFORMER] (lasWide 2)
, po [HELD LASGUN, HELD LASGUN, cr HARDWARE] dualBeam
, po [HELD LASGUN, cr TRANSFORMER] (lasWide 2)
, po [HELD LASGUN, HELD LASGUN, HELD LASGUN, cr HARDWARE] lasCircle
, p [o $ cr TRANSFORMER, p 2 $ cr CAN] sparkGun
, p [o (HELD SPARKGUN), p 2 $ cr PIPE] teslaGun
@@ -77,7 +65,6 @@ itemCombinations =
, po [cr TRANSFORMER, cr BATTERY, cr MICROCHIP] (makeTypeCraft STATICMODULE)
]
++ map (\i -> po [HELD (LASWIDE i), cr TRANSFORMER] $ lasWide (i + 1)) [2 .. 9]
-- ++ map (\i -> po [LASGUNWIDE i,cr HARDWARE] $ lasFocus i) [2..10]
++ map (\i -> po [cr PIPE, HELD (BANGSTICK i)] $ bangStick (i + 1)) [1 .. 8]
++ map (\i -> po [hd (REVOLVERX i), cr CAN] $ revolverX (i + 1)) [1 .. 5]
++ map (\i -> po [hd (VOLLEYGUN i), HELD (BANGSTICK 1)] $ volleyGun (i + 1)) [3 .. 5]
@@ -107,7 +94,6 @@ moduleCombinations =
[ repeater
, autoRifle
, burstRifle
-- ,fastBurstRifle
]
,
[ amod [cr DRUM, cr HARDWARE] DRUMMAG
@@ -214,15 +200,10 @@ batteryGuns =
[ teslaGun
, sparkGun
, lasGun
-- , lasSway
-- , lasSwing
]
++ [ lasWide i | i <- [2 .. 10]
]
-- ++
-- [ lasFocus i | i <- [1..10]]
teleportableWeapons :: [Item]
teleportableWeapons = bulletWeapons ++ batteryGuns ++ homingLaunchers
@@ -242,9 +223,7 @@ bulletWeapons =
, repeater
, autoRifle
, burstRifle
, -- ,fastBurstRifle
-- ,completeBurstRifle
bangCone
, bangCone
, blunderbuss
, machineGun
, elephantGun
+1 -1
View File
@@ -1,7 +1,7 @@
--{-# LANGUAGE TypeSynonymInstances #-}
--{-# LANGUAGE FlexibleInstances #-}
module Dodge.Combine.Graph where
import Dodge.Data hiding (East,West,North,South)
import Dodge.Data.Item
import Dodge.Combine.Combinations
import LensHelp
import GraphHelp
+38 -31
View File
@@ -1,43 +1,50 @@
module Dodge.Combine.Module where
import Dodge.Data
import Dodge.Item.Targeting
import Dodge.Data.Beam
import Dodge.Data.Item
--import Dodge.Item.Weapon.ExtraEffect
import Dodge.Tesla
import Dodge.Item.Weapon.ExtraEffect
import LensHelp
import Geometry
import LensHelp
moduleModification :: ItemModuleType -> Item -> Item
moduleModification imt = case imt of
EMPTYMODULE -> id
DRUMMAG -> itUse . heldConsumption . laMax .~ 45
BELTMAG -> itUse . heldConsumption . laMax .~ 150
MAGNETMAG -> itUse . useDelay . rateMax .~ 4
INCENDBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall IncBall
BOUNCEBUL -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ BounceBullet
PENBUL -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ PenetrateBullet
STATICBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall TeslaBall
CONCUSBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall ConcBall
TARGCR -> itTargeting .~ targetRBCreature
TARGLAS -> itTargeting .~ targetLaser
TARGPOS -> itTargeting .~ targetRBPress
MAGNETTRAJ -> (itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0)
. (itUse . heldConsumption . laAmmoType . amBullet . buVel .~ V2 10 0)
FLECHETRAJ -> itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ FlechetteTrajectory 0
BEZIERTRAJ -> itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ BezierTrajectory 0 0 0
INCENDLAS -> itParams . lasBeam .~ BeamCombine FlameBeamCombine
SPLITLAS -> itParams . lasBeam .~ BeamCombine SplitBeamCombine
STATICLAS -> (itParams . lasBeam .~ BeamCombine TeslaBeamCombine)
. (itParams . subParams ?~ teslaParams)
WEPTELE -> makeDirectedTele
LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
DRUMMAG -> itUse . heldConsumption . laMax .~ 45
BELTMAG -> itUse . heldConsumption . laMax .~ 150
MAGNETMAG -> itUse . heldDelay . rateMax .~ 4
INCENDBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall IncBall
BOUNCEBUL -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ BounceBullet
PENBUL -> itUse . heldConsumption . laAmmoType . amBullet . buEffect .~ PenetrateBullet
STATICBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall TeslaBall
CONCUSBUL -> itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulBall ConcBall
TARGCR -> itTargeting .~ targetRBCreature
TARGLAS -> itTargeting .~ targetLaser
TARGPOS -> itTargeting .~ targetRBPress
MAGNETTRAJ ->
(itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ MagnetTrajectory 0)
. (itUse . heldConsumption . laAmmoType . amBullet . buVel .~ V2 10 0)
FLECHETRAJ -> itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ FlechetteTrajectory 0
BEZIERTRAJ -> itUse . heldConsumption . laAmmoType . amBullet . buTrajectory .~ BezierTrajectory 0 0 0
INCENDLAS -> itParams . lasBeam .~ BeamCombine FlameBeamCombine
SPLITLAS -> itParams . lasBeam .~ BeamCombine SplitBeamCombine
STATICLAS ->
(itParams . lasBeam .~ BeamCombine TeslaBeamCombine)
. (itParams . subParams ?~ teslaParams)
WEPTELE -> makeDirectedTele
LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
EXTRABATTERY -> itUse . heldConsumption . laMax +~ 1000
ATTACHTORCH -> id
ATTACHTORCH -> id
where
makeDirectedTele it = it
& itTargeting .~ targetRBPress
& itUse . useMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
-- for the camera: the simplest option is to remove all zoom/offset
& itUse . useAim . aimZoom . itZoomFac .~ 1
& itUse . useAim . aimRange .~ 0
makeDirectedTele it =
it
& itTargeting .~ targetRBPress
& itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
-- for the camera: the simplest option is to remove all zoom/offset
& itUse . heldAim . aimZoom . itZoomFac .~ 1
& itUse . heldAim . aimRange .~ 0
-- a better option would be to involve a "scope" centered on the firing
-- position
-- directedTelPos it cr w = (p,a)
+10 -13
View File
@@ -1,19 +1,16 @@
module Dodge.Combine.Trie where
import Dodge.Combine.Combinations
import Dodge.Data
--import Dodge.Combine.Module
--import Dodge.Combine.Data
--import Multiset
import SimpleTrie
import Data.Bifunctor
--import qualified Data.IntSet as IS
--import Data.Map.Merge.Strict
import Data.List (sort)
import Dodge.Combine.Combinations
import Dodge.Data.Item
import SimpleTrie
import Data.Foldable
combinationsTrie :: Trie (ItAmount,ItemBaseType) Item
combinationsTrie :: Trie (ItAmount, ItemBaseType) Item
{-# INLINE combinationsTrie #-}
combinationsTrie = foldr
(uncurry insertInTrie . first sort)
emptyTrie
itemCombinations
combinationsTrie =
foldl'
(flip $ uncurry insertInTrie . first sort)
emptyTrie
itemCombinations