Allow for bullet drag

This commit is contained in:
2021-12-02 18:29:46 +00:00
parent 85ededc158
commit 8b8d75b016
35 changed files with 362 additions and 228 deletions
+17 -21
View File
@@ -11,40 +11,36 @@ import qualified Data.Map.Strict as M
import Control.Monad
import Data.Maybe
combineList :: IM.IntMap ItemCombineType -> [([Int],ItemCombineType)]
combineList :: IM.IntMap CombineType -> [([Int],CombineType)]
combineList m = mapMaybe (pushoutmaybe . second (combine . toMultiset) . unzip)
. powlist
. powlistN 4
$ IM.toList m
where
pushoutmaybe (_,Nothing) = Nothing
pushoutmaybe (x,Just y) = Just (x,y)
powlistN :: Int -> [a] ->[[a]]
powlistN _ [] = [[]]
powlistN n (x:xs)
| n <=0 = [[]]
| otherwise = ((x:) <$> powlistN (n-1) xs) ++ powlistN n xs
-- expo
powlist :: [a] -> [[a]]
powlist = filterM (const [True,False])
combine :: M.Map ItemCombineType Int -> Maybe ItemCombineType
combine :: M.Map CombineType Int -> Maybe CombineType
combine m = lookup m combinations
toMultiset :: Ord a => [a] -> M.Map a Int
toMultiset = foldr (uncurry $ M.insertWith (+)) M.empty . map (,1)
combinations :: [(M.Map ItemCombineType Int, ItemCombineType)]
combinations :: [(M.Map CombineType Int, CombineType)]
combinations = map (first toMultiset)
[ ( [ TPistol, TPipe, THardware ] , TRifle )
, ( [ NoCombineType ] , TPistol )
, ( [ TRifle, THardware ] , TPistol )
, ( [ TPistol, TPistol, THardware ] , TSpreadGun 2 )
, ( [ TSpreadGun 2, TPistol, THardware ] , TSpreadGun 3 )
, ( [ TSpreadGun 3, TPistol, THardware ] , TSpreadGun 4 )
, ( [ TSpreadGun 4, TPistol, THardware ] , TSpreadGun 5 )
, ( [ TPistol, TAutoGun, THardware ] , TLtAutoGun )
, ( [ TLtAutoGun, TPipe, THardware ] , TAutoGun )
, ( [ TRifle, TRifle, THardware ] , TMultGun 2 )
, ( [ TMultGun 2, TRifle, THardware ] , TMultGun 3 )
, ( [ TMultGun 3, TRifle, THardware ] , TMultGun 4 )
, ( [ TMultGun 4, TRifle, THardware ] , TMultGun 5 )
, ( [ TLtAutoGun, TPipe, THardware ] , TAutoGun )
, ( [ TPistol, TTube, THardware] , TLauncher 1 )
, ( [ TLauncher 1, TTube, TPistol, THardware] , TLauncher 2)
, ( [ TLauncher 2, TTube, TPistol, THardware] , TLauncher 3)
[ ( [ PIPE, HARDWARE ] , BANGSTICK )
, ( [ LONGPIPE, HARDWARE ] , BANGCANE )
, ( [ VERYLONGPIPE, HARDWARE ] , BANGROD )
, ( [ PIPE, PIPE ] , LONGPIPE )
, ( [ LONGPIPE, PIPE ] , VERYLONGPIPE )
]
+44 -3
View File
@@ -1,9 +1,50 @@
module Dodge.Combine.Data
(ItemCombineType (..)
(CombineType (..)
)
where
data ItemCombineType
= TPipe
data CombineType
= NOTDEFINED
-- Weapons
| BANGSTICK
| BANGCANE
| BANGROD
| PISTOL
| HVAUTOGUN
| LTAUTOGUN
| MINIGUN
| AUTOGUN
| SPREADGUN
| MULTGUN
| LONGGUN
| TESLAGUN
| LASGUN
| TRACTORGUN
| LAUNCHER
| SPRAYER
| SQUIRTER
| DRONELAUNCHER
| GRENADE
| REMOTEBOMB
-- Utility items
| BOOSTER
| REWINDER
| BLINKER
| FORCEFIELD
| SHRINKER
-- Equipment
| RADAR
| MAGSHIELD
| FLAMESHIELD
| FRONTARMOUR
| FLATSHIELD
| JETPACK
-- Crafting
| PIPE
| LONGPIPE
| VERYLONGPIPE
| HARDWARE
| SPRING
| TPipe
| NoCombineType
| TLongPipe
| TVeryLongPipe