From b2490a2e2feee20a3a03d8142d3ac90964238517 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Thu, 18 Feb 2021 13:36:36 +0100 Subject: [PATCH] Simplify handling of optional values in a couple of places --- src/module/actor/sheets/actor-sheet.ts | 8 +++----- src/module/item/item.ts | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index 7644806..3df4f04 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -73,11 +73,9 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Data<DS4Actor>> { } protected _getTooltipForValue(value: ModifiableMaybeData<number | null>): string { - return `${value.base ?? 0} (${game.i18n.localize("DS4.TooltipBaseValue")}) + ${ - value.mod ?? 0 - } (${game.i18n.localize("DS4.TooltipModifier")}) ➞ ${game.i18n.localize("DS4.TooltipEffects")} ➞ ${ - value.total ?? 0 - }`; + return `${value.base} (${game.i18n.localize("DS4.TooltipBaseValue")}) + ${value.mod} (${game.i18n.localize( + "DS4.TooltipModifier", + )}) ➞ ${game.i18n.localize("DS4.TooltipEffects")} ➞ ${value.total}`; } /** @override */ diff --git a/src/module/item/item.ts b/src/module/item/item.ts index 0da5cff..5c0a9f3 100644 --- a/src/module/item/item.ts +++ b/src/module/item/item.ts @@ -26,9 +26,9 @@ export class DS4Item extends Item<DS4ItemData> { /** * The number of times that active effect changes originating from this item should be applied. */ - get activeEffectFactor(): number { + get activeEffectFactor(): number | undefined { if (this.data.type === "talent") { - return this.data.data.rank.total ?? this.data.data.rank.base + this.data.data.rank.mod; + return this.data.data.rank.total; } return 1; }