mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Added ferocity trigger
This commit is contained in:
parent
ce2e5871bc
commit
4b86bb229a
11 changed files with 165 additions and 42 deletions
|
|
@ -6,7 +6,15 @@ export default class TriggerField extends foundry.data.fields.SchemaField {
|
|||
nullable: false,
|
||||
blank: false,
|
||||
initial: CONFIG.DH.TRIGGER.triggers.dualityRoll.id,
|
||||
choices: CONFIG.DH.TRIGGER.triggers
|
||||
choices: CONFIG.DH.TRIGGER.triggers,
|
||||
label: 'DAGGERHEART.CONFIG.Triggers.triggerType'
|
||||
}),
|
||||
triggeringActorType: new foundry.data.fields.StringField({
|
||||
nullable: false,
|
||||
blank: false,
|
||||
initial: CONFIG.DH.TRIGGER.triggerActorTargetType.any.id,
|
||||
choices: CONFIG.DH.TRIGGER.triggerActorTargetType,
|
||||
label: 'DAGGERHEART.CONFIG.Triggers.triggeringActorType'
|
||||
}),
|
||||
command: new foundry.data.fields.JavaScriptField({ async: true })
|
||||
},
|
||||
|
|
|
|||
|
|
@ -139,15 +139,19 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
super.prepareBaseData();
|
||||
|
||||
for (const action of this.actions ?? []) {
|
||||
if (!action.actor) continue;
|
||||
|
||||
const actionsToRegister = [];
|
||||
for (let i = 0; i < action.triggers.length; i++) {
|
||||
const trigger = action.triggers[i];
|
||||
const fn = new foundry.utils.AsyncFunction('roll', 'actor', `{${trigger.command}\n}`);
|
||||
const { args } = CONFIG.DH.TRIGGER.triggers[trigger.trigger];
|
||||
const fn = new foundry.utils.AsyncFunction(...args, `{${trigger.command}\n}`);
|
||||
actionsToRegister.push(fn.bind(action));
|
||||
if (i === action.triggers.length - 1)
|
||||
game.system.registeredTriggers.registerTriggers(
|
||||
trigger.trigger,
|
||||
action.actor?.uuid,
|
||||
trigger.triggeringActorType,
|
||||
this.parent.uuid,
|
||||
actionsToRegister
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue