This commit is contained in:
2022-12-29 12:54:34 +00:00
parent bdd022e40b
commit 5bc764655d
15 changed files with 54 additions and 30 deletions
+7 -7
View File
@@ -50,22 +50,22 @@ crHoldReloading cr w =
tryStartLoading :: Creature -> Creature
tryStartLoading cr = case cr ^? crInv . ix (crSel cr) . itUse . heldConsumption of
Just hc -> tryStartLoading' hc cr
Just hc -> startLoading hc cr
Nothing -> cr
tryStartLoading' :: HeldConsumption -> Creature -> Creature
tryStartLoading' ic cr = case ic ^? laProgress . _Just . ix 0 of
Just la -> cr & startLoadAction la
startLoading :: HeldConsumption -> Creature -> Creature
startLoading ic cr = case ic ^? laProgress . _Just . ix 0 of
Just la -> cr & startLoadingStep la
Nothing -> case ic ^? laCycle of
Nothing -> cr
Just [] -> error ("item has empty load cycle" ++ show (cr ^?! crInv . ix (crSel cr) . itType))
Just _ | _laLoaded ic >= _laMax ic -> cr
Just (la : las) ->
cr & startLoadAction la
cr & startLoadingStep la
& crInv . ix (crSel cr) . itUse . heldConsumption . laProgress ?~ (la : las)
startLoadAction :: LoadAction -> Creature -> Creature
startLoadAction la cr = cr & crInvSel . iselAction .~ ReloadAction (_actionTime la) la NoHammer
startLoadingStep :: LoadAction -> Creature -> Creature
startLoadingStep la cr = cr & crInvSel . iselAction .~ ReloadAction (_actionTime la) la NoHammer
rotateActionProgress :: HeldConsumption -> HeldConsumption
rotateActionProgress ic = case ic ^? laProgress . _Just of