make hit points usable in resource bar

This commit is contained in:
Johannes Loher 2021-01-07 12:47:38 +01:00
parent cad0d74522
commit b361d2da04
4 changed files with 8 additions and 5 deletions

View file

@ -25,8 +25,9 @@ interface UsableResource<T> {
used: T; used: T;
} }
interface CurrentData<T> extends ModifiableData<T> { interface ResourceData<T> extends ModifiableData<T> {
current: T; value: T;
max?: T;
} }
// Blueprint in case we need more detailed differentiation // Blueprint in case we need more detailed differentiation
@ -42,7 +43,7 @@ interface DS4ActorDataTraits {
} }
interface DS4ActorDataCombatValues { interface DS4ActorDataCombatValues {
hitPoints: CurrentData<number>; hitPoints: ResourceData<number>;
defense: ModifiableData<number>; defense: ModifiableData<number>;
initiative: ModifiableData<number>; initiative: ModifiableData<number>;
movement: ModifiableData<number>; movement: ModifiableData<number>;

View file

@ -18,5 +18,7 @@ export class DS4Actor extends Actor<DS4ActorDataType, DS4ItemDataType, DS4Item>
Object.values(combatValues).forEach( Object.values(combatValues).forEach(
(combatValue: ModifiableData<number>) => (combatValue.total = combatValue.base + combatValue.mod), (combatValue: ModifiableData<number>) => (combatValue.total = combatValue.base + combatValue.mod),
); );
combatValues.hitPoints.max = combatValues.hitPoints.total;
} }
} }

View file

@ -20,7 +20,7 @@
], ],
"gridDistance": 1, "gridDistance": 1,
"gridUnits": "m", "gridUnits": "m",
"primaryTokenAttribute": "combatValues.hitPoints.current", "primaryTokenAttribute": "combatValues.hitPoints",
"url": "https://git.f3l.de/dungeonslayers/ds4", "url": "https://git.f3l.de/dungeonslayers/ds4",
"manifest": "https://git.f3l.de/dungeonslayers/ds4/-/raw/master/src/system.json?inline=false", "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", "download": "https://git.f3l.de/dungeonslayers/ds4/-/jobs/artifacts/0.1.0/download?job=build",

View file

@ -48,7 +48,7 @@
"hitPoints": { "hitPoints": {
"base": 0, "base": 0,
"mod": 0, "mod": 0,
"current": 0 "value": 0
}, },
"defense": { "defense": {
"base": 0, "base": 0,