From b361d2da04f89089d628f01279a0bdee3edbde16 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Thu, 7 Jan 2021 12:47:38 +0100 Subject: [PATCH] make hit points usable in resource bar --- src/module/actor/actor-data.ts | 7 ++++--- src/module/actor/actor.ts | 2 ++ src/system.json | 2 +- src/template.json | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/module/actor/actor-data.ts b/src/module/actor/actor-data.ts index 746ae439..4269bce0 100644 --- a/src/module/actor/actor-data.ts +++ b/src/module/actor/actor-data.ts @@ -25,8 +25,9 @@ interface UsableResource { used: T; } -interface CurrentData extends ModifiableData { - current: T; +interface ResourceData extends ModifiableData { + value: T; + max?: T; } // Blueprint in case we need more detailed differentiation @@ -42,7 +43,7 @@ interface DS4ActorDataTraits { } interface DS4ActorDataCombatValues { - hitPoints: CurrentData; + hitPoints: ResourceData; defense: ModifiableData; initiative: ModifiableData; movement: ModifiableData; diff --git a/src/module/actor/actor.ts b/src/module/actor/actor.ts index c17d6843..7f2f8209 100644 --- a/src/module/actor/actor.ts +++ b/src/module/actor/actor.ts @@ -18,5 +18,7 @@ export class DS4Actor extends Actor Object.values(combatValues).forEach( (combatValue: ModifiableData) => (combatValue.total = combatValue.base + combatValue.mod), ); + + combatValues.hitPoints.max = combatValues.hitPoints.total; } } diff --git a/src/system.json b/src/system.json index a57664c3..a64a1a8c 100644 --- a/src/system.json +++ b/src/system.json @@ -20,7 +20,7 @@ ], "gridDistance": 1, "gridUnits": "m", - "primaryTokenAttribute": "combatValues.hitPoints.current", + "primaryTokenAttribute": "combatValues.hitPoints", "url": "https://git.f3l.de/dungeonslayers/ds4", "manifest": "https://git.f3l.de/dungeonslayers/ds4/-/raw/master/src/system.json?inline=false", "download": "https://git.f3l.de/dungeonslayers/ds4/-/jobs/artifacts/0.1.0/download?job=build", diff --git a/src/template.json b/src/template.json index f4aef42d..fc61e8df 100644 --- a/src/template.json +++ b/src/template.json @@ -48,7 +48,7 @@ "hitPoints": { "base": 0, "mod": 0, - "current": 0 + "value": 0 }, "defense": { "base": 0,