more
This commit is contained in:
parent
37087d08a7
commit
0b9ff1363b
45 changed files with 680 additions and 890 deletions
23
js/ants.js
23
js/ants.js
|
|
@ -265,13 +265,21 @@ class AntActor {
|
|||
}
|
||||
const haulers = Math.max(1, this.activeHaulersForTarget().length);
|
||||
const leadHauler = this.isLeadHauler();
|
||||
const targetWasSleeping = Boolean(target.sleeping || target.state === "sleep");
|
||||
target.antDraggedTimer = Math.max(target.antDraggedTimer || 0, 0.35);
|
||||
target.antDraggedBy = this.id;
|
||||
target.state = "panic";
|
||||
target.sleeping = false;
|
||||
target.target = null;
|
||||
target.fearTimer = Math.max(target.fearTimer || 0, 0.36);
|
||||
target.thought = "\u30a2\u30ea\u306b\u5de3\u3078\u904b\u3070\u308c\u3066\u3044\u308b";
|
||||
if (targetWasSleeping) {
|
||||
target.sleeping = true;
|
||||
target.state = "sleep";
|
||||
target.sleepTimer = Math.max(target.sleepTimer || 0, 0.8);
|
||||
target.thought = "眠ったままアリに運ばれている";
|
||||
} else {
|
||||
target.state = "panic";
|
||||
target.sleeping = false;
|
||||
target.fearTimer = Math.max(target.fearTimer || 0, 0.36);
|
||||
target.thought = "アリに巣へ運ばれている";
|
||||
}
|
||||
const dHome = distXY(target.x, target.y, home.x, home.y) || 1;
|
||||
if (dHome < Math.max(18, home.r * 0.66)) {
|
||||
this.world.completeAntHaul?.(home, target);
|
||||
|
|
@ -298,10 +306,11 @@ class AntActor {
|
|||
this.vy = uy * speed;
|
||||
|
||||
const aggression = Math.max(0, target.currentPersonality?.aggression || 0);
|
||||
const aggressiveAttack = target.shouldApplyPersonalityBehavior?.("aggression", 1) || aggression >= 0.5 || target.state === "ant_attack";
|
||||
const struggle = aggressiveAttack
|
||||
const stillSleeping = Boolean(target.sleeping || targetWasSleeping || target.state === "sleep");
|
||||
const aggressiveAttack = !stillSleeping && (target.shouldApplyPersonalityBehavior?.("aggression", 1) || aggression >= 0.5 || target.state === "ant_attack");
|
||||
const struggle = stillSleeping ? 0 : (aggressiveAttack
|
||||
? (1.25 + aggression * 1.6 + clamp((target.energy || 0) / 100, 0, 1) * 0.35) / Math.max(1, haulers * 0.9)
|
||||
: (0.42 + clamp((target.energy || 0) / 100, 0, 1) * 0.18) / Math.max(1, haulers);
|
||||
: (0.42 + clamp((target.energy || 0) / 100, 0, 1) * 0.18) / Math.max(1, haulers));
|
||||
this.hp -= dt * struggle;
|
||||
|
||||
if ((this.world.time || 0) - (this.carryLogAt || -999) > 8 && Math.random() < dt * 0.04) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue