feat(stat-list): add addStat helper method to UnitStatList
This commit is contained in:
parent
3c827be346
commit
19e612241c
|
|
@ -76,6 +76,14 @@ export class UnitStatList {
|
||||||
this.baseStats.set(key, Math.trunc(value))
|
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 {
|
getBaseStat(statNameOrId: string | number): number {
|
||||||
const key = this.normalizeStatKey(statNameOrId)
|
const key = this.normalizeStatKey(statNameOrId)
|
||||||
return this.baseStats.get(key) ?? 0
|
return this.baseStats.get(key) ?? 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue