From 19e612241c231cf990c099f76e4d4c12d52d0806 Mon Sep 17 00:00:00 2001 From: troytt <47798984@qq.com> Date: Tue, 22 Sep 2026 03:52:05 +0000 Subject: [PATCH] feat(stat-list): add addStat helper method to UnitStatList --- src/game/engine/stat-list.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/engine/stat-list.ts b/src/game/engine/stat-list.ts index fcda6e4..47c5624 100644 --- a/src/game/engine/stat-list.ts +++ b/src/game/engine/stat-list.ts @@ -76,6 +76,14 @@ export class UnitStatList { this.baseStats.set(key, Math.trunc(value)) } + addStat(statNameOrId: string | number, delta: number): void { + const key = this.normalizeStatKey(statNameOrId) + if (key === 'item_allskills') { + this.allSkillsBonus += Math.trunc(delta) + } + this.baseStats.set(key, (this.baseStats.get(key) ?? 0) + Math.trunc(delta)) + } + getBaseStat(statNameOrId: string | number): number { const key = this.normalizeStatKey(statNameOrId) return this.baseStats.get(key) ?? 0