Fix slime suck bug

This commit is contained in:
2026-05-18 19:25:07 +01:00
parent 3119f10c2c
commit eb817d34ef
5 changed files with 16 additions and 25 deletions
+1 -1
View File
@@ -230,7 +230,7 @@ updateCalmBee cr cid w
& tocr . crActionPlan . apStrategy .~ SearchTimed 200 & tocr . crActionPlan . apStrategy .~ SearchTimed 200
(p,g) = runState (randOnCirc 200) (w ^. randGen) (p,g) = runState (randOnCirc 200) (w ^. randGen)
cxy = cr ^. crPos . _xy cxy = cr ^. crPos . _xy
mountshakeoff mid = fromMaybe True $ do mountshakeoff mid = fromMaybe False $ do
mcr <- w ^? cWorld . lWorld . creatures . ix mid mcr <- w ^? cWorld . lWorld . creatures . ix mid
x <- mcr ^? crType . slimeDistortion . sdTime x <- mcr ^? crType . slimeDistortion . sdTime
return $ x > 8 return $ x > 8
-7
View File
@@ -83,10 +83,6 @@ data Action
{ _waitThenTimer :: Int { _waitThenTimer :: Int
, _waitThenAction :: Action , _waitThenAction :: Action
} }
-- | DoActionWhile
-- { _doActionWhileCondition :: WdCrBl
-- , _doActionWhileAction :: Action
-- }
| DoActionWhilePartial | DoActionWhilePartial
{ _doActionWhilePartial :: Action { _doActionWhilePartial :: Action
, _doActionWhileCondition :: WdCrBl , _doActionWhileCondition :: WdCrBl
@@ -122,9 +118,6 @@ data Action
} }
| LeadTarget { _leadTargetBy :: Point2 } | LeadTarget { _leadTargetBy :: Point2 }
| NoAction | NoAction
-- | StartSentinelPost
-- | UseSelf { _useSelf :: CrAc }
-- | ArbitraryAction {_arbitraryAction :: CrWdAc}
-- | Repeatedly perform impulses alongside a main action until the main action terminates -- | Repeatedly perform impulses alongside a main action until the main action terminates
| DoImpulsesAlongside | DoImpulsesAlongside
{ _sideImpulses :: [Impulse] { _sideImpulses :: [Impulse]
+2 -3
View File
@@ -454,8 +454,7 @@ itemSidePush = \case
applyInvLock :: Item -> Creature -> World -> World applyInvLock :: Item -> Creature -> World -> World
applyInvLock itm cr = case itemInvLock itm of applyInvLock itm cr = case itemInvLock itm of
i i | i > 0 && cid == 0 ->
| i > 0 && cid == 0 ->
(cWorld . lWorld . delayedEvents .:~ (i, UnlockInv)) . lockInv (cWorld . lWorld . delayedEvents .:~ (i, UnlockInv)) . lockInv
_ -> id _ -> id
where where
@@ -470,7 +469,7 @@ heldItemInvLock :: HeldItemType -> Int
heldItemInvLock = \case heldItemInvLock = \case
FLAMESPITTER -> 10 FLAMESPITTER -> 10
VOLLEYGUN i -> i + 1 VOLLEYGUN i -> i + 1
BURSTRIFLE -> 70 BURSTRIFLE -> 8
_ -> 0 _ -> 0
applySoundCME :: Item -> Creature -> World -> World applySoundCME :: Item -> Creature -> World -> World
+12 -14
View File
@@ -2,13 +2,11 @@ module Dodge.Item.Location (
pointerToItemID, pointerToItemID,
--pointerToItemLocation, --pointerToItemLocation,
pointerToItem, pointerToItem,
pointerYourSelectedItem,
pointerYourRootItem,
) where ) where
import NewInt import NewInt
import Control.Lens import Control.Lens
import Data.Maybe --import Data.Maybe
import Dodge.Data.World import Dodge.Data.World
--pointerToItemLocation :: --pointerToItemLocation ::
@@ -23,17 +21,17 @@ import Dodge.Data.World
---- cWorld . lWorld . floorItems . ix (_unNInt flid) . flIt ---- cWorld . lWorld . floorItems . ix (_unNInt flid) . flIt
--pointerToItemLocation _ = const pure --pointerToItemLocation _ = const pure
pointerYourSelectedItem :: Applicative a => (Item -> a Item) -> World -> a World --pointerYourSelectedItem :: Applicative a => (Item -> a Item) -> World -> a World
pointerYourSelectedItem f w = fromMaybe (pure w) $ do --pointerYourSelectedItem f w = fromMaybe (pure w) $ do
Sel 0 itinvid <- w ^? hud.diSelection._Just -- Sel 0 itinvid <- w ^? hud.diSelection._Just
itid <- w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix (NInt itinvid) -- itid <- w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix (NInt itinvid)
Just $ (cWorld . lWorld . items . ix itid) f w -- Just $ (cWorld . lWorld . items . ix itid) f w
--
pointerYourRootItem :: Applicative a => (Item -> a Item) -> World -> a World --pointerYourRootItem :: Applicative a => (Item -> a Item) -> World -> a World
pointerYourRootItem f w = fromMaybe (pure w) $ do --pointerYourRootItem f w = fromMaybe (pure w) $ do
itinvid <- w ^? hud. manObject . hiRootSelectedItem -- itinvid <- w ^? hud. manObject . hiRootSelectedItem
itid <- w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix itinvid -- itid <- w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix itinvid
Just $ (cWorld . lWorld . items . ix itid) f w -- Just $ (cWorld . lWorld . items . ix itid) f w
pointerToItem :: Applicative f => Item -> (Item -> f Item) -> World -> f World pointerToItem :: Applicative f => Item -> (Item -> f Item) -> World -> f World
pointerToItem x = cWorld . lWorld . items . ix (x ^. itID . unNInt) pointerToItem x = cWorld . lWorld . items . ix (x ^. itID . unNInt)
+1
View File
@@ -1027,6 +1027,7 @@ crCrSpring c1 c2
, distance xy1 xy2 < r1 - (r2 + 5) , distance xy1 xy2 < r1 - (r2 + 5)
= feedSlime c1 c2 = feedSlime c1 c2
| maybe True not (c1 ^? crType . slimeDistortion . sdIsSplit) | maybe True not (c1 ^? crType . slimeDistortion . sdIsSplit)
, SlimeCrit{} <- c1 ^. crType
, slimeFood c2 = slimeSuck c1 c2 , slimeFood c2 = slimeSuck c1 c2
| SlimeCrit{} <- c1 ^. crType = id | SlimeCrit{} <- c1 ^. crType = id
| SlimeCrit{} <- c2 ^. crType = id | SlimeCrit{} <- c2 ^. crType = id