Allow for bullet drag
This commit is contained in:
@@ -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 )
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user