mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 12:54:16 +02:00
Fix issues with companions
This commit is contained in:
parent
6d09c5504d
commit
899f286def
6 changed files with 25 additions and 13 deletions
|
|
@ -189,6 +189,9 @@ export default class DhpAdversary extends DhCreature {
|
|||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
this.attack.roll.isStandardAttack = true;
|
||||
|
||||
// Clamp resources (must be done last to ensure all updates occur)
|
||||
this.resources.clamp();
|
||||
}
|
||||
|
||||
_getTags() {
|
||||
|
|
|
|||
|
|
@ -778,6 +778,8 @@ export default class DhCharacter extends DhCreature {
|
|||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
|
||||
this.resources.hope.max -= this.scars;
|
||||
if (this.companion) {
|
||||
for (let levelKey in this.companion.system.levelData.levelups) {
|
||||
const level = this.companion.system.levelData.levelups[levelKey];
|
||||
|
|
@ -791,7 +793,6 @@ export default class DhCharacter extends DhCreature {
|
|||
}
|
||||
}
|
||||
|
||||
this.resources.hope.max -= this.scars;
|
||||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||
|
||||
this.resources.armor = {
|
||||
|
|
@ -801,6 +802,9 @@ export default class DhCharacter extends DhCreature {
|
|||
};
|
||||
|
||||
this.attack.damage.parts.hitPoints.value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
||||
|
||||
// Clamp resources (must be done last to ensure all updates occur)
|
||||
this.resources.clamp();
|
||||
}
|
||||
|
||||
getRollData() {
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ export default class DhCompanion extends DhCreature {
|
|||
for (let selection of level.selections) {
|
||||
switch (selection.type) {
|
||||
case 'hope':
|
||||
this.resources.hope += selection.value;
|
||||
this.resources.hope.max += selection.value;
|
||||
break;
|
||||
case 'vicious':
|
||||
if (selection.data[0] === 'damage') {
|
||||
|
|
@ -183,6 +183,9 @@ export default class DhCompanion extends DhCreature {
|
|||
return acc;
|
||||
}, this.partner.system.companionData.levelupChoices);
|
||||
}
|
||||
|
||||
// Clamp resources (must be done last to ensure all updates occur)
|
||||
this.resources.clamp();
|
||||
}
|
||||
|
||||
async _preUpdate(changes, options, userId) {
|
||||
|
|
|
|||
|
|
@ -60,14 +60,4 @@ export default class DhCreature extends BaseDataActor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
const minLimitResource = resource => {
|
||||
if (resource) resource.value = Math.min(resource.value, resource.max);
|
||||
};
|
||||
|
||||
minLimitResource(this.resources.stress);
|
||||
minLimitResource(this.resources.hitPoints);
|
||||
minLimitResource(this.resources.hope);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue