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
+8 -9
View File
@@ -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