mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
.
This commit is contained in:
parent
e22928b59e
commit
f5e00dedb2
2 changed files with 47 additions and 66 deletions
|
|
@ -1,50 +1,41 @@
|
||||||
import DHSummonField from '../fields/action/summonField.mjs';
|
|
||||||
import DHBaseAction from './baseAction.mjs';
|
import DHBaseAction from './baseAction.mjs';
|
||||||
import DHSummonDialog from '../../applications/dialogs/summonDialog.mjs';
|
|
||||||
|
|
||||||
export default class DHSummonAction extends DHBaseAction {
|
export default class DHSummonAction extends DHBaseAction {
|
||||||
static defineSchema() {
|
static extraSchemas = [...super.extraSchemas, 'summon'];
|
||||||
return {
|
|
||||||
...super.defineSchema(),
|
|
||||||
summon: new DHSummonField({ required: false, initial: [] })
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static extraSchemas=[...super.extraSchemas,'summon'];
|
// get defaultValues() {
|
||||||
|
// return {
|
||||||
|
// summon: []
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
get defaultValues() {
|
// async trigger(event, ...args) {
|
||||||
return {
|
// if (!this.canSummon || !canvas.scene){
|
||||||
summon: []
|
// ui.notifications.warn(game.i18n.localize("DAGGERHEART.ACTIONS.TYPES.summon.error"));
|
||||||
};
|
// return;
|
||||||
}
|
// }
|
||||||
|
// await this._performAction();
|
||||||
|
// }
|
||||||
|
|
||||||
async trigger(event, ...args) {
|
// get canSummon() {
|
||||||
if (!this.canSummon || !canvas.scene){
|
// return game.user.can('TOKEN_CREATE');
|
||||||
ui.notifications.warn(game.i18n.localize("DAGGERHEART.ACTIONS.TYPES.summon.error"));
|
// }
|
||||||
return;
|
|
||||||
}
|
|
||||||
await this._performAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
get canSummon() {
|
// async _performAction(event, ...args) {
|
||||||
return game.user.can('TOKEN_CREATE');
|
// const validSummons = this.summon.filter(entry => entry.actorUUID);
|
||||||
}
|
// if (validSummons.length === 0) {
|
||||||
|
// ui.notifications.warn("No actors configured for this Summon action.");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// // FOR NOW: Just log the data to prove the schema working or not
|
||||||
|
// console.group("Summon Action Triggered");
|
||||||
|
|
||||||
async _performAction(event, ...args) {
|
// for (const entry of validSummons) {
|
||||||
const validSummons = this.summon.filter(entry => entry.actorUUID);
|
// const actor = await fromUuid(entry.actorUUID);
|
||||||
if (validSummons.length === 0) {
|
// console.log(`- Ready to summon ${entry.count}x [${actor?.name || "Unknown Actor"}]`);
|
||||||
ui.notifications.warn("No actors configured for this Summon action.");
|
// }
|
||||||
return;
|
// console.groupEnd();
|
||||||
}
|
|
||||||
// FOR NOW: Just log the data to prove the schema working or not
|
|
||||||
console.group("Summon Action Triggered");
|
|
||||||
|
|
||||||
for (const entry of validSummons) {
|
// //Todo: Open Summon Dialog
|
||||||
const actor = await fromUuid(entry.actorUUID);
|
// }
|
||||||
console.log(`- Ready to summon ${entry.count}x [${actor?.name || "Unknown Actor"}]`);
|
|
||||||
}
|
|
||||||
console.groupEnd();
|
|
||||||
|
|
||||||
//Todo: Open Summon Dialog
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -7,32 +7,22 @@ export default class DHSummonField extends fields.ArrayField {
|
||||||
static order = 120;
|
static order = 120;
|
||||||
|
|
||||||
constructor(options = {}, context = {}) {
|
constructor(options = {}, context = {}) {
|
||||||
const summonFields = new fields.SchemaField({
|
const summonFields = new fields.SchemaField({
|
||||||
actorUUID: new fields.DocumentUUIDField({
|
actorUUID: new fields.DocumentUUIDField({
|
||||||
type: 'Actor',
|
type: 'Actor',
|
||||||
required: true
|
required: true
|
||||||
}),
|
}),
|
||||||
count: new fields.NumberField({
|
count: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
default: 1,
|
default: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
integer: true
|
integer: true
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
});
|
||||||
super(summonFields, options, context);
|
super(summonFields, options, context);
|
||||||
|
|
||||||
// summon: new fields.ArrayField(new fields.SchemaField({
|
|
||||||
// actorUUID: new fields.DocumentUUIDField({
|
|
||||||
// type: 'Actor',
|
|
||||||
// required: true }),
|
|
||||||
// count: new fields.NumberField({
|
|
||||||
// required: true,
|
|
||||||
// default: 1,
|
|
||||||
// min: 1,
|
|
||||||
// integer: true })
|
|
||||||
// }), { required: false, initial: [] })
|
|
||||||
// };
|
|
||||||
// super(summonFields, options, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async execute(config) {
|
||||||
|
console.log('something');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue