Add optional tracking of slayer points
This commit is contained in:
parent
8d3e381d56
commit
eb49c15d5f
12 changed files with 83 additions and 6 deletions
|
@ -55,6 +55,7 @@ interface DS4CharacterDataData extends DS4ActorDataDataBase {
|
|||
language: DS4CharacterDataDataLanguage;
|
||||
profile: DS4CharacterDataDataProfile;
|
||||
currency: DS4CharacterDataDataCurrency;
|
||||
slayerPoints: DS4CharacterDataDataSlayerPoints;
|
||||
}
|
||||
export interface DS4CharacterDataDataBaseInfo {
|
||||
race: string;
|
||||
|
@ -93,6 +94,10 @@ export interface DS4CharacterDataDataCurrency {
|
|||
copper: number;
|
||||
}
|
||||
|
||||
export interface DS4CharacterDataDataSlayerPoints {
|
||||
value: number;
|
||||
}
|
||||
|
||||
interface DS4CreatureDataData extends DS4ActorDataDataBase {
|
||||
baseInfo: DS4CreatureDataDataBaseInfo;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
DS4CharacterDataDataLanguage,
|
||||
DS4CharacterDataDataProfile,
|
||||
DS4CharacterDataDataProgression,
|
||||
DS4CharacterDataDataSlayerPoints,
|
||||
DS4CreatureDataDataBaseInfo,
|
||||
} from "./actor-data";
|
||||
|
||||
|
@ -74,6 +75,11 @@ interface DS4CharacterPreparedDataData extends DS4ActorPreparedDataDataBase {
|
|||
language: DS4CharacterDataDataLanguage;
|
||||
profile: DS4CharacterDataDataProfile;
|
||||
currency: DS4CharacterDataDataCurrency;
|
||||
slayerPoints: DS4CharacterPreparedDataDataSlayerPoints;
|
||||
}
|
||||
|
||||
export interface DS4CharacterPreparedDataDataSlayerPoints extends DS4CharacterDataDataSlayerPoints {
|
||||
max: number;
|
||||
}
|
||||
|
||||
interface DS4CreaturePreparedDataData extends DS4ActorPreparedDataDataBase {
|
||||
|
|
|
@ -131,6 +131,9 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
|
|||
prepareFinalDerivedData(): void {
|
||||
this.data.data.combatValues.hitPoints.max = this.data.data.combatValues.hitPoints.total;
|
||||
this.data.data.checks.defend = this.data.data.combatValues.defense.total;
|
||||
if (this.data.type === "character") {
|
||||
this.data.data.slayerPoints.max = 3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,7 +141,9 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
|
|||
* given in dot notation.
|
||||
*/
|
||||
get finalDerivedDataProperties(): string[] {
|
||||
return ["data.combatValues.hitPoints.max", "data.checks.defend"];
|
||||
return ["data.combatValues.hitPoints.max", "data.checks.defend"].concat(
|
||||
this.data.type === "character" ? ["data.slayerPoints.max"] : [],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,7 @@ import { DS4 } from "../../config";
|
|||
import { getCanvas } from "../../helpers";
|
||||
import { DS4Item } from "../../item/item";
|
||||
import { DS4ItemData } from "../../item/item-data";
|
||||
import { getDS4Settings } from "../../settings";
|
||||
import notifications from "../../ui/notifications";
|
||||
import { DS4Actor } from "../actor";
|
||||
import { isCheck } from "../actor-prepared-data";
|
||||
|
@ -61,6 +62,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Data<DS4Actor>> {
|
|||
config: DS4,
|
||||
// Add the items explicitly sorted by type to the data:
|
||||
itemsByType,
|
||||
settings: getDS4Settings(),
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue