feat: round stats after effects have been applied
With this change, all stats except for movement are rounded up to the next integer after all effects have been applied.
This commit is contained in:
parent
73a6ad4bbc
commit
5212509b5c
1 changed files with 16 additions and 0 deletions
|
@ -139,6 +139,22 @@ export class DS4Actor extends Actor {
|
|||
* Apply final transformations to the Actor data after all effects have been applied.
|
||||
*/
|
||||
prepareFinalDerivedData(): void {
|
||||
Object.values(this.data.data.attributes).forEach(
|
||||
(attribute: ModifiableDataBaseTotal<number>) => (attribute.total = Math.ceil(attribute.total)),
|
||||
);
|
||||
Object.values(this.data.data.traits).forEach(
|
||||
(trait: ModifiableDataBaseTotal<number>) => (trait.total = Math.ceil(trait.total)),
|
||||
);
|
||||
Object.entries(this.data.data.combatValues)
|
||||
.filter(([key]) => key !== "movement")
|
||||
.map(([, value]) => value)
|
||||
.forEach(
|
||||
(combatValue: ModifiableDataBaseTotal<number>) => (combatValue.total = Math.ceil(combatValue.total)),
|
||||
);
|
||||
(Object.keys(this.data.data.checks) as (keyof typeof this.data.data.checks)[]).forEach((key) => {
|
||||
this.data.data.checks[key] = Math.ceil(this.data.data.checks[key]);
|
||||
});
|
||||
|
||||
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") {
|
||||
|
|
Loading…
Reference in a new issue