Add randomness to multiple crab evasions

This commit is contained in:
2026-04-09 13:28:39 +01:00
parent 0a8a2210c0
commit c8a06bc084
14 changed files with 194 additions and 179 deletions
+14 -8
View File
@@ -85,12 +85,15 @@ drawChaseCrit w cr = mconcat
crabUpperBody :: World -> Creature -> Shape
crabUpperBody _ cr = colorSH (_skinUpper cskin)
$
(overPosSH (Q.apply torsoq) (upperPrismPolyHalfMI 5 $ polyCirc 4 12
(
overPosSH (Q.apply torsoq) (upperPrismPolyHalfMI 5 $ polyCirc 4 10
& each . _x *~ 0.6)
)
<> overPosSH (Q.apply lclawq) (upperPrismPolyHalfMI 4 $ rectNSWE 20 0 (-2) 2)
<> overPosSH (Q.apply rclawq) (upperPrismPolyHalfMI 4 $ rectNSWE 0 (-20) (-2) 2)
)
<> colorSH (_skinHead cskin)
--(overPosSH (Q.apply headq) (upperPrismPolyHalfMI 2 $ [V2 0 (-4), V2 2 (-2), 2, V2 0 4]))
(overPosSH (Q.apply headq) (upperPrismPolyHalfMI 1 $ square 2))
where
-- i = fromIntegral (mod (w ^. cWorld . cClock) 100) / 100
torsoq = (V3 0 0 10,Q.qid)
@@ -104,6 +107,14 @@ crabUpperBody _ cr = colorSH (_skinUpper cskin)
ratck = Q.axisAngle (V3 0 0 1) (0.5 * pi)
rrest = Q.axisAngle (V3 1 0 0) (-1)
rcool = 1 - min 10 (fromIntegral . _meleeCooldownR $ _crType cr) / 10
headq = torsoq `Q.comp` (V3 0 0 5, Q.qid)
-- headq = torsoq `Q.comp` (V3 0 0 5, (Q.qz aimrot ))
-- cxy = cr ^. crPos . _xy
-- aimrot = fromMaybe pi $ do
-- i <- cr ^. crIntention . targetCr
-- tcxy <- w ^? cWorld . lWorld . creatures . ix i . crPos . _xy
-- guard $ hasLOSIndirect cxy tcxy w
-- return $ argV (tcxy - cxy) - cr ^. crDir
chaseUpperBody :: World -> Creature -> Shape
@@ -178,12 +189,7 @@ crabFeet cr =
f p q = q + 2 *^ (p - q)
cdir = -cr ^. crDir
cxy = cr ^. crPos . _xy
-- sh x = translateSHxy x off aFoot <> translateSHxy (- x) (- off) aFoot
afoot = upperPrismPolyST 10 $ polyCirc 3 2
off = 10
sLen = strideLength cr
-- f i = 8 * (sLen - 2*i) / sLen
-- f i = 8 * oneSmooth ((sLen - 2*i) / sLen)
deadFeet :: Creature -> Shape
{-# INLINE deadFeet #-}