Cleanup
This commit is contained in:
@@ -12,7 +12,7 @@ import Dodge.Data.Item
|
||||
import Dodge.Item
|
||||
import LensHelp
|
||||
|
||||
watchCombinations :: [([(ItAmount, ItemBaseType)], Item)]
|
||||
watchCombinations :: [([(ItAmount, ItemType)], Item)]
|
||||
watchCombinations =
|
||||
[ po [LEFT STOPWATCH, LEFT REWINDWATCH] scrollWatch
|
||||
, po [CRAFT TIMEMODULE, CRAFT MICROCHIP, CRAFT HARDDRIVE] scrollWatch
|
||||
@@ -22,7 +22,7 @@ watchCombinations =
|
||||
po xs it = (map o xs, it)
|
||||
o = (1,)
|
||||
|
||||
backpackCombinations :: [([(ItAmount,ItemBaseType)],Item)]
|
||||
backpackCombinations :: [([(ItAmount,ItemType)],Item)]
|
||||
backpackCombinations =
|
||||
[ po [CRAFT HOSE, CRAFT STEELDRUM] fuelPack
|
||||
]
|
||||
@@ -38,7 +38,7 @@ backpackCombinations =
|
||||
-- po xs it = (map o xs, it)
|
||||
-- o = (1,)
|
||||
|
||||
magazineCombinations :: [([(ItAmount,ItemBaseType)],Item)]
|
||||
magazineCombinations :: [([(ItAmount,ItemType)],Item)]
|
||||
magazineCombinations =
|
||||
[ po [CRAFT TIN, CRAFT SPRING] tinMag
|
||||
]
|
||||
@@ -46,12 +46,12 @@ magazineCombinations =
|
||||
po xs it = (map o xs, it)
|
||||
o = (1,)
|
||||
|
||||
flatItemCombinations :: [([ItemBaseType], Item)]
|
||||
flatItemCombinations :: [([ItemType], Item)]
|
||||
flatItemCombinations = map (over _1 (concatMap f)) itemCombinations
|
||||
where
|
||||
f (x,it) = replicate (_getItAmount x) it
|
||||
|
||||
itemCombinations :: [([(ItAmount, ItemBaseType)], Item)]
|
||||
itemCombinations :: [([(ItAmount, ItemType)], Item)]
|
||||
itemCombinations =
|
||||
watchCombinations ++
|
||||
backpackCombinations ++
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--{-# LANGUAGE TypeSynonymInstances #-}
|
||||
--{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
module Dodge.Combine.Graph where
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Combine.Combinations
|
||||
@@ -19,7 +18,7 @@ data CombClust
|
||||
| JoinClust
|
||||
deriving (Eq,Ord,Show,Enum,Bounded)
|
||||
|
||||
newtype CombNode = CombNode {_unCombNode :: Either ItemBaseType [(ItAmount,ItemBaseType)]}
|
||||
newtype CombNode = CombNode {_unCombNode :: Either ItemType [(ItAmount,ItemType)]}
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
instance Labellable CombNode where
|
||||
@@ -32,17 +31,17 @@ instance Labellable CombEdge where
|
||||
toLabelValue (CombEdge 0) = StrLabel (pack "")
|
||||
toLabelValue (CombEdge x) = StrLabel (pack $ show x)
|
||||
|
||||
bulletCombinations :: [([(ItAmount,ItemBaseType)],Item)]
|
||||
bulletCombinations :: [([(ItAmount,ItemType)],Item)]
|
||||
bulletCombinations = filter
|
||||
( (`elem` map totype bulletWeapons)
|
||||
. totype
|
||||
. snd
|
||||
) itemCombinations
|
||||
where
|
||||
totype = _iyBase . _itType
|
||||
totype = _itType
|
||||
|
||||
maxShowX :: ItemBaseType -> Maybe Int
|
||||
maxShowX bt = case bt of
|
||||
maxShowX :: ItemType -> Maybe Int
|
||||
maxShowX = \case
|
||||
HELD (BANGSTICK _) -> Just 2
|
||||
HELD (VOLLEYGUN _) -> Just 3
|
||||
HELD (MINIGUNX _) -> Just 3
|
||||
@@ -53,7 +52,7 @@ maxShowX bt = case bt of
|
||||
_ -> Nothing
|
||||
|
||||
itemCombinationsEdges :: [(CombNode,CombNode,Int)]
|
||||
itemCombinationsEdges = concatMap (f . over _2 (_iyBase . _itType)) itemCombinations
|
||||
itemCombinationsEdges = concatMap (f . over _2 (_itType)) itemCombinations
|
||||
--itemCombinationsEdges = concatMap (f . over _2 (_iyBase . _itType)) bulletCombinations
|
||||
where
|
||||
f (abts,bt)
|
||||
@@ -74,7 +73,7 @@ combinationsGraph = FGL.labnfilter (f . _unCombNode . snd)
|
||||
Nothing -> True
|
||||
Just i -> _xNum (_ibtHeld bt) <= i
|
||||
|
||||
belowNumX :: ItemBaseType -> Bool
|
||||
belowNumX :: ItemType -> Bool
|
||||
belowNumX bt = case maxShowX bt of
|
||||
Nothing -> True
|
||||
Just i -> _xNum (_ibtHeld bt) <= i
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
module Dodge.Combine.Module where
|
||||
|
||||
import Data.Foldable
|
||||
import Dodge.Data.Beam
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Tesla
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
--moduleModification :: ItemModuleType -> Item -> Item
|
||||
--moduleModification imt = case imt of
|
||||
-- EMPTYMODULE -> id
|
||||
---- BELTMAG -> itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 150
|
||||
-- MAGNETMAG -> itUse . heldDelay . rateMax .~ 4
|
||||
-- BULPAY BulFlak -> (itUse . amagParams . ampBullet . buPayload .~ BulFlak)
|
||||
-- . (itUse . amagParams . ampBullet . buTimer .~ 3)
|
||||
-- BULPAY thepayload -> itUse . amagParams . ampBullet . buPayload .~ thepayload
|
||||
-- BULBODY thebody -> itUse . amagParams . ampBullet . buEffect .~ thebody
|
||||
-- TARGET {} -> id -- itUse . useTargeting ?~ t
|
||||
-- BULTRAJ BasicBulletTrajectoryType -> id
|
||||
-- BULTRAJ MagnetTrajectoryType ->
|
||||
-- (itUse . amagParams . ampBullet . buTrajectory .~ MagnetTrajectory 0)
|
||||
-- . (itUse . amagParams . ampBullet . buVel .~ V2 10 0)
|
||||
-- BULTRAJ FlechetteTrajectoryType ->
|
||||
-- itUse . amagParams . ampBullet . buTrajectory .~ FlechetteTrajectory 0
|
||||
-- BULTRAJ BezierTrajectoryType ->
|
||||
-- itUse . amagParams . ampBullet . 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
|
||||
-- LAUNCHHOME -> id
|
||||
-- ATTACHTORCH -> id
|
||||
---- where
|
||||
---- makeDirectedTele it =
|
||||
---- it
|
||||
---- & itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
|
||||
---- -- for the camera: the simplest option is to remove all zoom/offset
|
||||
---- & itUse . heldAim . aimZoom . izFac .~ 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)
|
||||
-- where
|
||||
-- p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
|
||||
-- a = argV (mouseWorldPos w -.- p)
|
||||
|
||||
--applyModules :: Item -> Item
|
||||
--applyModules it = foldl' (flip moduleModification) it (it ^. itType . iyModules)
|
||||
@@ -1,4 +1,6 @@
|
||||
module Dodge.Combine.Trie where
|
||||
module Dodge.Combine.Trie
|
||||
( combinationsTrie
|
||||
) where
|
||||
|
||||
import Data.Bifunctor
|
||||
import Data.List (sort)
|
||||
@@ -7,14 +9,14 @@ import Dodge.Data.Item
|
||||
import SimpleTrie
|
||||
import Data.Foldable
|
||||
|
||||
flatCombinationsTrie :: Trie ItemBaseType Item
|
||||
{-# INLINE flatCombinationsTrie #-}
|
||||
flatCombinationsTrie = foldl'
|
||||
(flip $ uncurry insertInTrie . first sort)
|
||||
emptyTrie
|
||||
flatItemCombinations
|
||||
--flatCombinationsTrie :: Trie ItemType Item
|
||||
--{-# INLINE flatCombinationsTrie #-}
|
||||
--flatCombinationsTrie = foldl'
|
||||
-- (flip $ uncurry insertInTrie . first sort)
|
||||
-- emptyTrie
|
||||
-- flatItemCombinations
|
||||
|
||||
combinationsTrie :: Trie (ItAmount, ItemBaseType) Item
|
||||
combinationsTrie :: Trie (ItAmount, ItemType) Item
|
||||
{-# INLINE combinationsTrie #-}
|
||||
combinationsTrie =
|
||||
foldl'
|
||||
|
||||
Reference in New Issue
Block a user