feat(combat): Standardize wound stacking logic to respect skill value limits
- Apply consistent wound stacking calculation across all targets (including commander) - Enforce skill.value as upper bound for wounds applied, accounting for existing wound stacks - Prevent negative or zero wound applications by early-returning when toApply <= 0
This commit is contained in:
parent
d5a30da9aa
commit
fd78f75c83
|
|
@ -84,9 +84,7 @@ export class SkillProcessor {
|
||||||
if (targets.length === 0) return;
|
if (targets.length === 0) return;
|
||||||
const allTargets = [];
|
const allTargets = [];
|
||||||
for (const t of targets) {
|
for (const t of targets) {
|
||||||
const toApply = t.type === 'commander'
|
const toApply = Math.min(canApply, Math.max(0, skill.value - (t.woundStacks || 0)));
|
||||||
? Math.min(canApply, Math.max(0, skill.value - (t.woundStacks || 0)))
|
|
||||||
: canApply;
|
|
||||||
if (toApply <= 0) continue;
|
if (toApply <= 0) continue;
|
||||||
t.woundStacks = (t.woundStacks || 0) + toApply;
|
t.woundStacks = (t.woundStacks || 0) + toApply;
|
||||||
allTargets.push({ target: t, stacks: toApply });
|
allTargets.push({ target: t, stacks: toApply });
|
||||||
|
|
@ -106,9 +104,11 @@ export class SkillProcessor {
|
||||||
if (context) { context.woundTarget = defender; context.woundStacks = toApply; }
|
if (context) { context.woundTarget = defender; context.woundStacks = toApply; }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
defender.woundStacks = (defender.woundStacks || 0) + canApply;
|
const toApply = Math.min(canApply, Math.max(0, skill.value - (defender.woundStacks || 0)));
|
||||||
if (tracker) tracker.applied += canApply;
|
if (toApply <= 0) return;
|
||||||
if (context) { context.woundTarget = defender; context.woundStacks = canApply; }
|
defender.woundStacks = (defender.woundStacks || 0) + toApply;
|
||||||
|
if (tracker) tracker.applied += toApply;
|
||||||
|
if (context) { context.woundTarget = defender; context.woundStacks = toApply; }
|
||||||
}
|
}
|
||||||
|
|
||||||
berserk(skill, attacker, defender, allies, enemies, context) {
|
berserk(skill, attacker, defender, allies, enemies, context) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue