Remove creature records

This commit is contained in:
2025-06-06 13:36:18 +01:00
parent 73c79f2f4d
commit 0f55257bff
48 changed files with 621 additions and 610 deletions
+5 -4
View File
@@ -13,6 +13,7 @@ module Dodge.Creature.ReaderUpdate (
setViewPos,
) where
import Dodge.Creature.Radius
import RandomHelp
import Dodge.Creature.Perception
import qualified IntMapHelp as IM
@@ -35,9 +36,9 @@ overrideMeleeCloseTarget cr = maybe cr (tryMeleeAttack cr) (_targetCr $ _crInten
tryMeleeAttack :: Creature -> Creature -> Creature
tryMeleeAttack cr tcr
| _crMeleeCooldown cr == 0
| _meleeCooldown (_crType cr) == 0
&& Just (_crID tcr) == cr ^? crActionPlan . apStrategy . meleeTarget
&& dist tpos cpos < _crRad cr + _crRad tcr + 5
&& dist tpos cpos < crRad (cr ^. crType) + crRad (tcr ^. crType) + 5
&& abs (_crDir cr - argV (tpos -.- cpos)) < pi / 4 =
cr & crActionPlan . apImpulse .~ [Melee $ _crID tcr]
& crActionPlan . apAction .~ [DoReplicate 10 NoAction `DoActionThen` DoImpulses
@@ -101,7 +102,7 @@ flockACC w cr = case cr ^? crIntention . targetCr . _Just of
in case macr of
Nothing -> cr
Just acr ->
let r = _crRad acr + _crRad cr + 10
let r = crRad (acr ^. crType) + crRad (cr ^. crType) + 10
horDir = normalizeV (vNormal (cpos -.- tpos))
horShift =
if isLHS tpos cpos (_crPos acr)
@@ -126,7 +127,7 @@ chaseCritMv w cr = case _apStrategy (_crActionPlan cr) of
numjits = fst $ randomR (15, 25) (_randGen w)
_ -> case cr ^? crIntention . mvToPoint . _Just of
Just p
| dist (_crPos cr) p > _crRad cr -> cr & crActionPlan . apAction .~ [PathTo p]
| dist (_crPos cr) p > crRad (cr ^. crType) -> cr & crActionPlan . apAction .~ [PathTo p]
| otherwise ->
cr & crActionPlan . apAction .~ [bfsThenReturn 500 `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]]
& crActionPlan . apStrategy .~ WatchAndWait