Feature/443 adversary action roll type (#456)

* Some tests

* Filter types choices

* Resource/Uses max as FormulaField

* Removed isReversed on item resources

* Stuffs

---------

Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
Dapoulp 2025-07-29 22:34:09 +02:00 committed by GitHub
parent 2608c4a5ae
commit 8e516df7cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 172 additions and 86 deletions

View file

@ -66,6 +66,43 @@ export class DHActionRollData extends foundry.abstract.DataModel {
}
return formula;
}
getModifier() {
const modifiers = [];
if(!this.parent?.actor) return modifiers;
switch (this.parent.actor.type) {
case 'character':
const trait = this.useDefault || !this.trait ? (this.parent.item.system.attack.roll.trait ?? 'agility') : this.trait;
if(this.type === CONFIG.DH.GENERAL.rollTypes.attack.id || this.type === CONFIG.DH.GENERAL.rollTypes.trait.id)
modifiers.push(
{
label: `DAGGERHEART.CONFIG.Traits.${trait}.name`,
value: this.parent.actor.system.traits[trait].value
}
)
else if(this.type === CONFIG.DH.GENERAL.rollTypes.spellcast.id)
modifiers.push(
{
label: `DAGGERHEART.CONFIG.RollTypes.spellcast.name`,
value: this.parent.actor.system.spellcastModifier
}
)
break;
case 'companion':
case 'adversary':
if(this.type === CONFIG.DH.GENERAL.rollTypes.attack.id)
modifiers.push(
{
label: 'Bonus to Hit',
value: this.bonus ?? this.parent.actor.system.attack.roll.bonus
}
)
break;
default:
break;
}
return modifiers;
}
}
export default class RollField extends fields.EmbeddedDataField {