more
This commit is contained in:
parent
37087d08a7
commit
0b9ff1363b
45 changed files with 680 additions and 890 deletions
|
|
@ -713,21 +713,14 @@
|
|||
b.fightTargetIds = b.fightTargetIds.slice(-4);
|
||||
a.fightTargetId = a.fightTargetIds[0];
|
||||
b.fightTargetId = b.fightTargetIds[0];
|
||||
const aAggressiveIntent = a.shouldApplyPersonalityBehavior?.("aggression", 1) ? 1 : 0;
|
||||
const bAggressiveIntent = b.shouldApplyPersonalityBehavior?.("aggression", 1) ? 1 : 0;
|
||||
const aScore = a.energy * 0.52 + a.mood * 0.30 + (a.type === "angry" ? 10 : 0) + aAggressiveIntent * 5 + ((a.fightMochiTimer || 0) > 0.04 ? 12 : 0) + (a.isZunchiSlave ? -14 : 0) + rand(-7, 7);
|
||||
const bScore = b.energy * 0.52 + b.mood * 0.30 + (b.type === "angry" ? 10 : 0) + bAggressiveIntent * 5 + ((b.fightMochiTimer || 0) > 0.04 ? 12 : 0) + (b.isZunchiSlave ? -14 : 0) + rand(-7, 7);
|
||||
const loser = aScore <= bScore ? a : b;
|
||||
const winner = loser === a ? b : a;
|
||||
loser.defeatedById = winner.id;
|
||||
loser.fightWinnerId = winner.id;
|
||||
winner.fightWinnerId = winner.id;
|
||||
winner.defeatedById = null;
|
||||
winner.defeatedTimer = 0;
|
||||
a.addStress ? a.addStress(rand(8, 18), { threshold: 8 }) : (a.stress = clamp(a.stress + rand(8, 18), 0, 130));
|
||||
b.addStress ? b.addStress(rand(8, 18), { threshold: 8 }) : (b.stress = clamp(b.stress + rand(8, 18), 0, 130));
|
||||
a.damage(b.outgoingDamage ? b.outgoingDamage(rand(2, 7)) : rand(2, 7), "\u55a7\u5629");
|
||||
b.damage(a.outgoingDamage ? a.outgoingDamage(rand(2, 7)) : rand(2, 7), "\u55a7\u5629");
|
||||
const damageToA = b.outgoingDamage ? b.outgoingDamage(rand(2, 7)) : rand(2, 7);
|
||||
const damageToB = a.outgoingDamage ? a.outgoingDamage(rand(2, 7)) : rand(2, 7);
|
||||
a.damage(damageToA, "\u55a7\u5629");
|
||||
b.damage(damageToB, "\u55a7\u5629");
|
||||
this.maybeDefeatFromFightDamage?.(a, b, damageToA);
|
||||
this.maybeDefeatFromFightDamage?.(b, a, damageToB);
|
||||
const dx = b.x - a.x, dy = b.y - a.y;
|
||||
const d = Math.hypot(dx, dy) || 1;
|
||||
a.vx -= dx / d * rand(32, 62); a.vy -= dy / d * rand(32, 62);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue