mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-08 23:16:12 +01:00
actions
This commit is contained in:
parent
4e110e30b1
commit
22497dd6af
12 changed files with 308 additions and 117 deletions
|
|
@ -60,7 +60,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
|||
context.tabs = this._getTabs();
|
||||
context.config = SYSTEM;
|
||||
if (!!this.action.effects) context.effects = this.action.effects.map(e => this.action.item.effects.get(e._id));
|
||||
if (this.action.damage?.hasOwnProperty('includeBase')) context.hasBaseDamage = !!this.action.parent.damage;
|
||||
if (this.action.damage?.hasOwnProperty('includeBase') && this.action.type === 'attack') context.hasBaseDamage = !!this.action.parent.damage;
|
||||
context.getRealIndex = this.getRealIndex.bind(this);
|
||||
console.log(context)
|
||||
return context;
|
||||
|
|
|
|||
34
module/applications/roll.mjs
Normal file
34
module/applications/roll.mjs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
export default class DHRoll extends Roll {
|
||||
static async build(config={}, message={}) {
|
||||
const roll = await this.buildConfigure();
|
||||
await this.buildEvaluate(config, message={});
|
||||
await this.buildPost(config, message={});
|
||||
return roll;
|
||||
}
|
||||
|
||||
static async buildConfigure(config={}, message={}) {
|
||||
config.hooks = [...(config.hooks ?? []), ""];
|
||||
for ( const hook of config.hooks ) {
|
||||
if ( Hooks.call(`dnd5e.preRoll${hook.capitalize()}`, config, message) === false ) return null;
|
||||
}
|
||||
}
|
||||
|
||||
static async buildEvaluate(roll, config={}, message={}) {
|
||||
if(config.evaluate !== false) await roll.evalutate();
|
||||
}
|
||||
|
||||
static async buildPost(config, message) {
|
||||
for ( const hook of config.hooks ) {
|
||||
if ( Hooks.call(`dnd5e.postRoll${hook.capitalize()}`, config, message) === false ) return null;
|
||||
}
|
||||
// Create Chat Message
|
||||
await this.toMessage(roll, message.data);
|
||||
}
|
||||
|
||||
static async toMessage(roll, data) {
|
||||
|
||||
const cls = getDocumentClass("ChatMessage");
|
||||
const msg = new cls(data);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue