Merge branch 'development' into feature-rollTableSheet

This commit is contained in:
WBHarry 2026-01-17 17:41:40 +01:00
commit 48b76e2961
42 changed files with 1166 additions and 260 deletions

View file

@ -764,16 +764,24 @@ export default class DhpActor extends Actor {
};
}
} else {
const valueFunc = (base, resource, baseMax) => {
if (resource.clear) return baseMax && base.inverted ? baseMax : 0;
return (base.value ?? base) + resource.value;
};
switch (r.key) {
case 'fear':
ui.resources.updateFear(
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear) + r.value
valueFunc(
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear),
r
)
);
break;
case 'armor':
if (this.system.armor?.system?.marks) {
updates.armor.resources['system.marks.value'] = Math.max(
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
Math.min(valueFunc(this.system.armor.system.marks, r), this.system.armorScore),
0
);
}
@ -782,7 +790,7 @@ export default class DhpActor extends Actor {
if (this.system.resources?.[r.key]) {
updates.actor.resources[`system.resources.${r.key}.value`] = Math.max(
Math.min(
this.system.resources[r.key].value + r.value,
valueFunc(this.system.resources[r.key], r, this.system.resources[r.key].max),
this.system.resources[r.key].max
),
0

View file

@ -87,6 +87,15 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
break;
}
}
if (this.type === 'fateRoll') {
html.classList.add('fate');
if (this.system.roll?.fate.fateDie == 'Hope') {
html.classList.add('hope');
}
if (this.system.roll?.fate.fateDie == 'Fear') {
html.classList.add('fear');
}
}
const autoExpandRoll = game.settings.get(
CONFIG.DH.id,

View file

@ -217,7 +217,7 @@ export default class DHItem extends foundry.documents.Item {
game.system.registeredTriggers.unregisterTriggers(triggerKeys, this.uuid);
if (!(this.actor.parent instanceof game.system.api.documents.DhToken)) {
if (this.actor && !(this.actor.parent instanceof game.system.api.documents.DhToken)) {
for (const token of this.actor.getActiveTokens()) {
game.system.registeredTriggers.unregisterTriggers(triggerKeys, `${token.document.uuid}.${this.uuid}`);
}