Cleanup, split itemToBreakLists
This commit is contained in:
+80
-38
@@ -33,33 +33,27 @@ import ListHelp
|
||||
tryAttachItems :: DTree CItem -> DTree CItem -> Maybe (DTree CItem)
|
||||
tryAttachItems = leftRightCombine leftIsParentCombine rightIsParentCombine
|
||||
|
||||
itemToBreakLists :: Item -> ItemSF -> ([ItemSF], [ItemSF])
|
||||
itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
(HELD TORCH, _) -> (getAmmoLinks itm, [])
|
||||
(ATTACH UNDERBARRELSLOT, _) -> ([UnderBarrelPlatformSF], [])
|
||||
itemAboveAttachables :: CItem -> [ItemSF]
|
||||
itemAboveAttachables (itm,sf) = case (itm ^. itType, sf) of
|
||||
(_, HeldPlatformSF) ->
|
||||
( getAmmoLinks itm
|
||||
<> extraWeaponLinksBelow itm
|
||||
, [WeaponTargetingSF, WeaponScopeSF]
|
||||
[WeaponTargetingSF, WeaponScopeSF]
|
||||
<> getAutoSpringLinks itm
|
||||
<> extraWeaponLinks itm
|
||||
)
|
||||
(_, UnderBarrelPlatformSF) ->
|
||||
( getAmmoLinks itm,[])
|
||||
(DETECTOR {}, _) ->
|
||||
( getAmmoLinks itm
|
||||
, [ARHUDSF,TriggerSF,MapperSF]
|
||||
)
|
||||
(CRAFT TRANSFORMER, _) -> ([],[LaserWeaponSF])
|
||||
(MAPPER, _) ->
|
||||
( []
|
||||
, [ARHUDSF]
|
||||
)
|
||||
(_, GadgetPlatformSF) ->
|
||||
( getAmmoLinks itm
|
||||
, [TriggerSF, WeaponTargetingSF, WeaponScopeSF]
|
||||
)
|
||||
(_, AmmoMagSF{}) -> fromMaybe ([], []) $ do
|
||||
(DETECTOR {}, _) -> [ARHUDSF,TriggerSF,MapperSF]
|
||||
(CRAFT TRANSFORMER, _) -> [LaserWeaponSF]
|
||||
(MAPPER, _) -> [ARHUDSF]
|
||||
(_, GadgetPlatformSF) -> [TriggerSF, WeaponTargetingSF, WeaponScopeSF]
|
||||
_ -> []
|
||||
|
||||
itemBelowAttachables :: CItem -> [ItemSF]
|
||||
itemBelowAttachables (itm,sf) = case (itm ^. itType, sf) of
|
||||
(HELD TORCH, _) -> getAmmoLinks itm
|
||||
(ATTACH UNDERBARRELSLOT, _) -> [UnderBarrelPlatformSF]
|
||||
(_, HeldPlatformSF) -> getAmmoLinks itm <> extraWeaponLinksBelow itm
|
||||
(_, UnderBarrelPlatformSF) -> getAmmoLinks itm
|
||||
(DETECTOR {}, _) -> getAmmoLinks itm
|
||||
(_, GadgetPlatformSF) -> getAmmoLinks itm
|
||||
(_, AmmoMagSF{}) -> fromMaybe [] $ do
|
||||
atype <- magAmmoType itm
|
||||
let screenanddet = case atype of
|
||||
LauncherAmmo ->
|
||||
@@ -67,24 +61,72 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
, RemoteDetonatorSF
|
||||
]
|
||||
_ -> []
|
||||
return
|
||||
( [ AmmoModifierSF atype
|
||||
return $
|
||||
[ AmmoModifierSF atype
|
||||
, AmmoTargetingSF atype
|
||||
, AmmoPayloadSF atype
|
||||
, AmmoEffectSF atype
|
||||
, SmokeReducerSF
|
||||
]
|
||||
<> screenanddet
|
||||
, []
|
||||
)
|
||||
(_, RemoteScreenSF) ->
|
||||
( [JoystickSF]
|
||||
, []
|
||||
)
|
||||
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [ARHUDSF], [])
|
||||
(ATTACH BULLETSYNTH, _) ->
|
||||
([AmmoMagSF 0 ElectricalAmmo], [])
|
||||
_ -> ([], [])
|
||||
|
||||
(_, RemoteScreenSF) -> [JoystickSF]
|
||||
(_, WeaponTargetingSF) -> getAmmoLinks itm ++ [ARHUDSF]
|
||||
(ATTACH BULLETSYNTH, _) -> [AmmoMagSF 0 ElectricalAmmo]
|
||||
_ -> []
|
||||
|
||||
--itemToBreakLists :: Item -> ItemSF -> ([ItemSF], [ItemSF])
|
||||
--itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
-- (HELD TORCH, _) -> (getAmmoLinks itm, [])
|
||||
-- (ATTACH UNDERBARRELSLOT, _) -> ([UnderBarrelPlatformSF], [])
|
||||
-- (_, HeldPlatformSF) ->
|
||||
-- ( getAmmoLinks itm
|
||||
-- <> extraWeaponLinksBelow itm
|
||||
-- , [WeaponTargetingSF, WeaponScopeSF]
|
||||
-- <> getAutoSpringLinks itm
|
||||
-- <> extraWeaponLinks itm
|
||||
-- )
|
||||
-- (_, UnderBarrelPlatformSF) ->
|
||||
-- ( getAmmoLinks itm,[])
|
||||
-- (DETECTOR {}, _) ->
|
||||
-- ( getAmmoLinks itm
|
||||
-- , [ARHUDSF,TriggerSF,MapperSF]
|
||||
-- )
|
||||
-- (CRAFT TRANSFORMER, _) -> ([],[LaserWeaponSF])
|
||||
-- (MAPPER, _) ->
|
||||
-- ( []
|
||||
-- , [ARHUDSF]
|
||||
-- )
|
||||
-- (_, GadgetPlatformSF) ->
|
||||
-- ( getAmmoLinks itm
|
||||
-- , [TriggerSF, WeaponTargetingSF, WeaponScopeSF]
|
||||
-- )
|
||||
-- (_, AmmoMagSF{}) -> fromMaybe ([], []) $ do
|
||||
-- atype <- magAmmoType itm
|
||||
-- let screenanddet = case atype of
|
||||
-- LauncherAmmo ->
|
||||
-- [ RemoteScreenSF
|
||||
-- , RemoteDetonatorSF
|
||||
-- ]
|
||||
-- _ -> []
|
||||
-- return
|
||||
-- ( [ AmmoModifierSF atype
|
||||
-- , AmmoTargetingSF atype
|
||||
-- , AmmoPayloadSF atype
|
||||
-- , AmmoEffectSF atype
|
||||
-- , SmokeReducerSF
|
||||
-- ]
|
||||
-- <> screenanddet
|
||||
-- , []
|
||||
-- )
|
||||
-- (_, RemoteScreenSF) ->
|
||||
-- ( [JoystickSF]
|
||||
-- , []
|
||||
-- )
|
||||
-- (_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [ARHUDSF], [])
|
||||
-- (ATTACH BULLETSYNTH, _) ->
|
||||
-- ([AmmoMagSF 0 ElectricalAmmo], [])
|
||||
-- _ -> ([], [])
|
||||
|
||||
getAutoSpringLinks :: Item -> [ItemSF]
|
||||
getAutoSpringLinks itm = case baseItemTriggerType itm of
|
||||
@@ -171,13 +213,13 @@ rightIsParentCombine ltree rtree = do
|
||||
leftChildList :: DTree CItem -> [ItemSF]
|
||||
leftChildList t = foldl' f l (reverse $ t ^.. dtLeft . each . dtValue . _2)
|
||||
where
|
||||
l = fst $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
||||
l = itemBelowAttachables (t ^. dtValue)
|
||||
f x y = tail $ dropWhile (/=y) x
|
||||
|
||||
rightChildList :: DTree CItem -> [ItemSF]
|
||||
rightChildList t = foldl' f l (reverse $ t ^.. dtRight . each . dtValue . _2)
|
||||
where
|
||||
l = snd $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
||||
l = itemAboveAttachables (t ^. dtValue)
|
||||
f x y = tail $ dropWhile (/=y) x
|
||||
|
||||
leftRightCombine :: DTComb a -> DTComb a -> DTree a -> DTree a -> Maybe (DTree a)
|
||||
|
||||
Reference in New Issue
Block a user