mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
HBS idea formed. Need to recheck drag drop implementation
This commit is contained in:
parent
b8fcd440c6
commit
1375329541
7 changed files with 133 additions and 21 deletions
|
|
@ -6,18 +6,25 @@ export default class DHSummonAction extends DHBaseAction {
|
|||
const fields = foundry.data.fields;
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
tokenArray: new fields.ArrayField(new fields.SchemaField({
|
||||
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 })
|
||||
}), { required: false })
|
||||
count: new fields.NumberField({ required: true, default: 1, min: 1, integer: true })
|
||||
}), { required: false, initial: [] })
|
||||
};
|
||||
}
|
||||
|
||||
get defaultValues() {
|
||||
return {
|
||||
summon: { actorUUID: "", count: 1 }
|
||||
};
|
||||
}
|
||||
|
||||
async trigger(event, ...args) {
|
||||
if (!this.canSummon || !canvas.scene){
|
||||
ui.notifications.error(game.i18n.localize("DAGGERHEART.ACTIONS.TYPES.summon.error"));
|
||||
ui.notifications.warn(game.i18n.localize("DAGGERHEART.ACTIONS.TYPES.summon.error"));
|
||||
return;
|
||||
}
|
||||
await this._performAction();
|
||||
}
|
||||
|
||||
get canSummon() {
|
||||
|
|
@ -31,6 +38,18 @@ export default class DHSummonAction extends DHBaseAction {
|
|||
|
||||
//Logic to perform the summon action - incomplete implementation
|
||||
async _performAction(event, ...args) {
|
||||
return this.summonManager.summonTokens(this.tokenArray);
|
||||
}
|
||||
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");
|
||||
|
||||
for (const entry of validSummons) {
|
||||
const actor = await fromUuid(entry.actorUUID);
|
||||
console.log(`- Ready to summon ${entry.count}x [${actor?.name || "Unknown Actor"}]`);
|
||||
}
|
||||
console.groupEnd();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue