mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Fixed so that spellcast attacks use that modifier (#509)
This commit is contained in:
parent
c2de25693f
commit
90faf48b05
2 changed files with 14 additions and 3 deletions
|
|
@ -323,9 +323,16 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
return !(this.class.value || this.class.subclass || this.ancestry || this.community);
|
return !(this.class.value || this.class.subclass || this.ancestry || this.community);
|
||||||
}
|
}
|
||||||
|
|
||||||
get spellcastModifier() {
|
get spellcastModifierTrait() {
|
||||||
const subClasses = this.parent.items.filter(x => x.type === 'subclass') ?? [];
|
const subClasses = this.parent.items.filter(x => x.type === 'subclass') ?? [];
|
||||||
return Math.max(subClasses?.map(sc => this.traits[sc.system.spellcastingTrait]?.value));
|
const modifiers = subClasses
|
||||||
|
?.map(sc => ({ ...this.traits[sc.system.spellcastingTrait], key: sc.system.spellcastingTrait }))
|
||||||
|
.filter(x => x);
|
||||||
|
return modifiers.sort((a, b) => a.value - b.value)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
get spellcastModifier() {
|
||||||
|
return this.spellcastModifierTrait?.value ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
get spellcastingModifiers() {
|
get spellcastingModifiers() {
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,13 @@ export class DHActionRollData extends foundry.abstract.DataModel {
|
||||||
if (!this.parent?.actor) return modifiers;
|
if (!this.parent?.actor) return modifiers;
|
||||||
switch (this.parent.actor.type) {
|
switch (this.parent.actor.type) {
|
||||||
case 'character':
|
case 'character':
|
||||||
|
const spellcastingTrait =
|
||||||
|
this.type === 'spellcast'
|
||||||
|
? (this.parent.actor?.system?.spellcastModifierTrait?.key ?? 'agility')
|
||||||
|
: null;
|
||||||
const trait =
|
const trait =
|
||||||
this.useDefault || !this.trait
|
this.useDefault || !this.trait
|
||||||
? (this.parent.item.system.attack.roll.trait ?? 'agility')
|
? (spellcastingTrait ?? this.parent.item.system.attack.roll.trait ?? 'agility')
|
||||||
: this.trait;
|
: this.trait;
|
||||||
if (
|
if (
|
||||||
this.type === CONFIG.DH.GENERAL.rollTypes.attack.id ||
|
this.type === CONFIG.DH.GENERAL.rollTypes.attack.id ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue