mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Merged with main
This commit is contained in:
commit
990c73987e
65 changed files with 567 additions and 424 deletions
|
|
@ -130,11 +130,16 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
const typeForDefeated = ['character', 'adversary', 'companion'].find(x => x === this.parent.type);
|
||||
if (defeatedSettings.enabled && typeForDefeated) {
|
||||
const resource = typeForDefeated === 'companion' ? 'stress' : 'hitPoints';
|
||||
if (changes.system.resources[resource]) {
|
||||
const becameMax = changes.system.resources[resource].value === this.resources[resource].max;
|
||||
const resourceValue = changes.system.resources[resource];
|
||||
if (
|
||||
resourceValue &&
|
||||
this.resources[resource].max &&
|
||||
resourceValue.value !== this.resources[resource].value
|
||||
) {
|
||||
const becameMax = resourceValue.value === this.resources[resource].max;
|
||||
const wasMax =
|
||||
this.resources[resource].value === this.resources[resource].max &&
|
||||
this.resources[resource].value !== changes.system.resources[resource].value;
|
||||
this.resources[resource].value !== resourceValue.value;
|
||||
if (becameMax) {
|
||||
this.parent.toggleDefeated(true);
|
||||
} else if (wasMax) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue