[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

@ -43,7 +43,7 @@ Hooks.once('init', () => {
); );
CONFIG.statusEffects = [ CONFIG.statusEffects = [
...CONFIG.statusEffects, ...CONFIG.statusEffects.filter(x => !['dead', 'unconscious'].includes(x.id)),
...Object.values(SYSTEM.GENERAL.conditions).map(x => ({ ...Object.values(SYSTEM.GENERAL.conditions).map(x => ({
...x, ...x,
name: game.i18n.localize(x.name), name: game.i18n.localize(x.name),

View file

@ -559,9 +559,9 @@
"twoHanded": "Two-Handed" "twoHanded": "Two-Handed"
}, },
"Condition": { "Condition": {
"vulnerable": { "dead": {
"name": "Vulnerable", "name": "Dead",
"description": "While a creature is Vulnerable, all rolls targeting them have advantage.\nA creature who is already Vulnerable cant be made to take the condition again." "description": "The character is dead"
}, },
"hidden": { "hidden": {
"name": "Hidden", "name": "Hidden",
@ -570,6 +570,14 @@
"restrained": { "restrained": {
"name": "Restrained", "name": "Restrained",
"description": "When an effect makes a creature Restrained, it means they cannot move until this condition is cleared.\nThey can still take actions from their current position." "description": "When an effect makes a creature Restrained, it means they cannot move until this condition is cleared.\nThey can still take actions from their current position."
},
"unconcious": {
"name": "Unconcious",
"description": "Your character cant move or act while unconscious, they cant be targeted by an attack."
},
"vulnerable": {
"name": "Vulnerable",
"description": "While a creature is Vulnerable, all rolls targeting them have advantage.\nA creature who is already Vulnerable cant be made to take the condition again."
} }
}, },
"CountdownType": { "CountdownType": {

View file

@ -110,6 +110,18 @@ export const conditions = {
name: 'DAGGERHEART.CONFIG.Condition.restrained.name', name: 'DAGGERHEART.CONFIG.Condition.restrained.name',
icon: 'icons/magic/control/debuff-chains-shackle-movement-red.webp', icon: 'icons/magic/control/debuff-chains-shackle-movement-red.webp',
description: 'DAGGERHEART.CONFIG.Condition.restrained.description' 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() { 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() { getRollData() {

View file

@ -60,8 +60,7 @@ export default class DhCompanion extends BaseDataActor {
}, },
roll: { roll: {
type: 'attack', type: 'attack',
bonus: 0, bonus: 0
trait: 'instinct'
}, },
damage: { damage: {
parts: [ parts: [
@ -87,20 +86,12 @@ export default class DhCompanion extends BaseDataActor {
}; };
} }
get traits() {
return {
instinct: { value: this.attack.roll.bonus }
};
}
get proficiency() { get proficiency() {
return this.partner?.system?.proficiency ?? 1; return this.partner?.system?.proficiency ?? 1;
} }
prepareBaseData() { prepareBaseData() {
const partnerSpellcastingModifier = this.partner?.system?.spellcastModifier; this.attack.roll.bonus = this.partner?.system?.spellcastModifier ?? 0;
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;
for (let levelKey in this.levelData.levelups) { for (let levelKey in this.levelData.levelups) {
const level = this.levelData.levelups[levelKey]; 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() { async _preDelete() {
if (this.partner) { if (this.partner) {
await this.partner.update({ 'system.companion': null }); await this.partner.update({ 'system.companion': null });

View file

@ -130,9 +130,9 @@ export default class D20Roll extends DHRoll {
value: this.options.roll.bonus 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( 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; return modifiers;

View file

@ -190,7 +190,12 @@ export const registerRollDiceHooks = () => {
if (config.roll.isCritical) updates.push({ key: 'stress', 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 (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; if (!config.roll.hasOwnProperty('success') && !config.targets?.length) return;