Improve creature turning wrt inertia
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
module Dodge.Creature.Update (updateCreature) where
|
||||
|
||||
--import Dodge.WorldEvent.ThingsHit
|
||||
import Dodge.Creature.Radius
|
||||
import Dodge.Creature.MoveType
|
||||
import Dodge.Base.Collide
|
||||
import Data.List (sortOn)
|
||||
import Dodge.Creature.Radius
|
||||
import Dodge.Zoning.Creature
|
||||
import Dodge.Creature.ChaseCrit
|
||||
import Dodge.Creature.Damage
|
||||
@@ -96,7 +97,7 @@ updateHiveCrit cr cid w
|
||||
& tocr . crType . hiveGestation %~ (max 0 . subtract 1)
|
||||
| otherwise = w
|
||||
where
|
||||
nbees = 10
|
||||
nbees = 50
|
||||
tocr = cWorld . lWorld . creatures . ix cid
|
||||
nid = IM.newKey $ w ^. cWorld . lWorld . creatures
|
||||
ncr = beeCrit & crPos .~ (cr ^. crPos + (0 & _xy +~ 25))
|
||||
@@ -117,11 +118,24 @@ updateBeeCrit cr
|
||||
|
||||
updateAggroBee :: Creature -> Int -> World -> World
|
||||
updateAggroBee cr cid w
|
||||
| Mounted{} <- cr ^. crStance . carriage = w & tocr . crStance . carriage .~ Flying 0
|
||||
| Just tcr <- listToMaybe . sortOn (distance cxy . (^. crPos . _xy)) . IM.elems . IM.filter istarget $ crsNearCirc cxy 100 w
|
||||
, distance (tcr ^. crPos . _xy) (cr ^. crPos . _xy) < crRad (cr ^. crType) + crRad (tcr ^. crType) + 1
|
||||
, nearZeroAngle (argV (tcr ^. crPos . _xy - cr ^. crPos . _xy) - cr ^. crDir) < pi / 2
|
||||
, 0 <- cr ^?! crType . meleeCooldown
|
||||
= w & tocr . crPos .~ (cr ^. crOldPos & _xy -~ 5 *^ unitVectorAtAngle (cr ^. crDir))
|
||||
& tocr . crType . startStopMv .~ (cr ^?! to crMvType . mvPulseTime)
|
||||
& cWorld . lWorld . creatures . ix (tcr ^. crID) . crDamage
|
||||
.:~ Blunt 50 (cxy + crRad (cr ^. crType) *^ vdir) vdir (CrMeleeO (cr ^. crID))
|
||||
& tocr . crType . meleeCooldown .~ 20
|
||||
| Just tcr <- listToMaybe . sortOn (distance cxy . (^. crPos . _xy)) . IM.elems . IM.filter istarget $ crsNearCirc cxy 100 w = w & tocr . crActionPlan . apStrategy .~ CloseToMelee (tcr ^. crID)
|
||||
& tocr . crActionPlan . apAction .~ PathTo (tcr ^. crPos . _xy) NoAction
|
||||
& tocr . crType . meleeCooldown %~ (max 0 . subtract 1)
|
||||
| otherwise = w & tocr . crType . beeAggro -~ 1
|
||||
& tocr . crActionPlan . apStrategy .~ Search
|
||||
& tocr . crType . meleeCooldown %~ (max 0 . subtract 1)
|
||||
where
|
||||
vdir = unitVectorAtAngle (cr ^. crDir)
|
||||
cxy = cr ^. crPos . _xy
|
||||
tocr = cWorld . lWorld . creatures . ix cid
|
||||
istarget tcr = tcr ^. crID == 0
|
||||
|
||||
Reference in New Issue
Block a user