mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
More fixes
This commit is contained in:
parent
701a69a9c1
commit
d65c0f91fc
4 changed files with 15 additions and 11 deletions
|
|
@ -407,7 +407,8 @@ export default class DhCharacter extends BaseDataActor {
|
|||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
this.resources.hope.value = Math.min(this.resources.hope.value, this.resources.hope.max);
|
||||
const baseHope = this.resources.hope.value + (this.companion?.system?.resources?.hope ?? 0);
|
||||
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
|
||||
}
|
||||
|
||||
getRollData() {
|
||||
|
|
|
|||
|
|
@ -124,12 +124,6 @@ export default class DhCompanion extends BaseDataActor {
|
|||
}
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
if (this.partner) {
|
||||
this.partner.system.resources.hope.max += this.resources.hope;
|
||||
}
|
||||
}
|
||||
|
||||
async _preDelete() {
|
||||
if (this.partner) {
|
||||
await this.partner.update({ 'system.companion': null });
|
||||
|
|
|
|||
|
|
@ -130,9 +130,9 @@ export default class D20Roll extends DHRoll {
|
|||
value: this.options.roll.bonus
|
||||
});
|
||||
|
||||
modifiers.push(...this.getBonus(`roll.${this.options.type}`, `${this.options.type.capitalize()} Bonus`));
|
||||
modifiers.push(...this.getBonus(`roll.${this.options.type}`, `${this.options.type?.capitalize()} Bonus`));
|
||||
modifiers.push(
|
||||
...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type.capitalize()} Bonus`)
|
||||
...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type?.capitalize()} Bonus`)
|
||||
);
|
||||
|
||||
return modifiers;
|
||||
|
|
|
|||
|
|
@ -184,12 +184,21 @@ export const registerRollDiceHooks = () => {
|
|||
return;
|
||||
|
||||
const actor = await fromUuid(config.source.actor),
|
||||
updates = [];
|
||||
updates = [],
|
||||
hopeUpdates = [];
|
||||
if (!actor) return;
|
||||
if (config.roll.isCritical || config.roll.result.duality === 1) updates.push({ key: 'hope', value: 1 });
|
||||
if (config.roll.isCritical || config.roll.result.duality === 1) hopeUpdates.push({ key: 'hope', value: 1 });
|
||||
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1 });
|
||||
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1 });
|
||||
|
||||
if (hopeUpdates.length) {
|
||||
if (actor.system.partner) {
|
||||
actor.system.partner.modifyResource(hopeUpdates);
|
||||
} else {
|
||||
updates.push(...hopeUpdates);
|
||||
}
|
||||
}
|
||||
|
||||
if (updates.length) actor.modifyResource(updates);
|
||||
|
||||
if (!config.roll.hasOwnProperty('success') && !config.targets?.length) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue