[Bug] Companion Trait Useage (#357)

* Removed trait useage for companion attack

* Fixes companion attack.roll.bonus

* More fixes

* Corrected companion resource change on duality

* .

* Added Dead/Unconcious
This commit is contained in:
WBHarry 2025-07-16 01:53:37 +02:00 committed by GitHub
parent f2176c6238
commit 5635bcaf7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 36 additions and 25 deletions

View file

@ -110,6 +110,18 @@ export const conditions = {
name: 'DAGGERHEART.CONFIG.Condition.restrained.name',
icon: 'icons/magic/control/debuff-chains-shackle-movement-red.webp',
description: 'DAGGERHEART.CONFIG.Condition.restrained.description'
},
unconcious: {
id: 'unconcious',
name: 'DAGGERHEART.CONFIG.Condition.unconcious.name',
icon: 'icons/magic/control/sleep-bubble-purple.webp',
description: 'DAGGERHEART.CONFIG.Condition.unconcious.description'
},
dead: {
id: 'dead',
name: 'DAGGERHEART.CONFIG.Condition.dead.name',
icon: 'icons/magic/death/grave-tombstone-glow-teal.webp',
description: 'DAGGERHEART.CONFIG.Condition.dead.description'
}
};

View file

@ -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() {

View file

@ -60,8 +60,7 @@ export default class DhCompanion extends BaseDataActor {
},
roll: {
type: 'attack',
bonus: 0,
trait: 'instinct'
bonus: 0
},
damage: {
parts: [
@ -87,20 +86,12 @@ export default class DhCompanion extends BaseDataActor {
};
}
get traits() {
return {
instinct: { value: this.attack.roll.bonus }
};
}
get proficiency() {
return this.partner?.system?.proficiency ?? 1;
}
prepareBaseData() {
const partnerSpellcastingModifier = this.partner?.system?.spellcastModifier;
const spellcastingModifier = this.partner?.system?.traits?.[partnerSpellcastingModifier]?.value;
this.attack.roll.bonus = spellcastingModifier ?? 0; // Needs to expand on which modifier it is that should be used because of multiclassing;
this.attack.roll.bonus = this.partner?.system?.spellcastModifier ?? 0;
for (let levelKey in this.levelData.levelups) {
const level = this.levelData.levelups[levelKey];
@ -133,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 });

View file

@ -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;

View file

@ -190,7 +190,12 @@ export const registerRollDiceHooks = () => {
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1 });
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1 });
if (updates.length) actor.modifyResource(updates);
if (updates.length) {
const target = actor.system.partner ?? actor;
if (!['dead', 'unconcious'].some(x => actor.statuses.has(x))) {
target.modifyResource(updates);
}
}
if (!config.roll.hasOwnProperty('success') && !config.targets?.length) return;