feat(stat-list): add addStat helper method to UnitStatList

This commit is contained in:
troytt 2026-09-22 03:52:05 +00:00
parent 3c827be346
commit 19e612241c
1 changed files with 8 additions and 0 deletions

View File

@ -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