mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 12:41:07 +01:00
Merged with development
This commit is contained in:
commit
c32e812803
120 changed files with 2380 additions and 469 deletions
|
|
@ -132,9 +132,12 @@ export default class DualityRoll extends D20Roll {
|
|||
this.terms = [this.terms[0], this.terms[1], this.terms[2]];
|
||||
return;
|
||||
}
|
||||
this.terms[0] = new foundry.dice.terms.Die({ faces: 12 });
|
||||
|
||||
const { defaultHopeDice, defaultFearDice } = this.data.rules.dualityRoll;
|
||||
|
||||
this.terms[0] = new foundry.dice.terms.Die({ faces: defaultHopeDice });
|
||||
this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' });
|
||||
this.terms[2] = new foundry.dice.terms.Die({ faces: 12 });
|
||||
this.terms[2] = new foundry.dice.terms.Die({ faces: defaultFearDice });
|
||||
}
|
||||
|
||||
applyAdvantage() {
|
||||
|
|
@ -190,6 +193,34 @@ export default class DualityRoll extends D20Roll {
|
|||
return super.buildConfigure(config, message);
|
||||
}
|
||||
|
||||
getActionChangeKeys() {
|
||||
const changeKeys = new Set([`system.bonuses.roll.${this.options.actionType}`]);
|
||||
|
||||
if (this.options.roll.type !== CONFIG.DH.GENERAL.rollTypes.attack.id) {
|
||||
changeKeys.add(`system.bonuses.roll.${this.options.roll.type}`);
|
||||
}
|
||||
|
||||
if (
|
||||
this.options.roll.type === CONFIG.DH.GENERAL.rollTypes.attack.id ||
|
||||
(this.options.roll.type === CONFIG.DH.GENERAL.rollTypes.spellcast.id && this.options.hasDamage)
|
||||
) {
|
||||
changeKeys.add(`system.bonuses.roll.attack`);
|
||||
}
|
||||
|
||||
if (this.options.roll.trait && this.data.traits?.[this.options.roll.trait]) {
|
||||
if (this.options.roll.type !== CONFIG.DH.GENERAL.rollTypes.spellcast.id)
|
||||
changeKeys.add('system.bonuses.roll.trait');
|
||||
}
|
||||
|
||||
const weapons = ['primaryWeapon', 'secondaryWeapon'];
|
||||
weapons.forEach(w => {
|
||||
if (this.options.source.item && this.options.source.item === this.data[w]?.id)
|
||||
changeKeys.add(`system.bonuses.roll.${w}`);
|
||||
});
|
||||
|
||||
return changeKeys;
|
||||
}
|
||||
|
||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||
await super.buildEvaluate(roll, config, message);
|
||||
|
||||
|
|
@ -241,6 +272,30 @@ export default class DualityRoll extends D20Roll {
|
|||
await super.buildPost(roll, config, message);
|
||||
|
||||
await DualityRoll.dualityUpdate(config);
|
||||
await DualityRoll.handleTriggers(roll, config);
|
||||
}
|
||||
|
||||
static async handleTriggers(roll, config) {
|
||||
const updates = [];
|
||||
const dualityUpdates = await game.system.registeredTriggers.runTrigger(
|
||||
CONFIG.DH.TRIGGER.triggers.dualityRoll.id,
|
||||
roll.data?.parent,
|
||||
roll,
|
||||
roll.data?.parent
|
||||
);
|
||||
if (dualityUpdates?.length) updates.push(...dualityUpdates);
|
||||
|
||||
if (config.roll.result.duality === -1) {
|
||||
const fearUpdates = await game.system.registeredTriggers.runTrigger(
|
||||
CONFIG.DH.TRIGGER.triggers.fearRoll.id,
|
||||
roll.data?.parent,
|
||||
roll,
|
||||
roll.data?.parent
|
||||
);
|
||||
if (fearUpdates?.length) updates.push(...fearUpdates);
|
||||
}
|
||||
|
||||
config.resourceUpdates.addResources(updates);
|
||||
}
|
||||
|
||||
static async addDualityResourceUpdates(config) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue