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