From 97f8da69cd1db7b06910cc88f8ff7c3c36238e94 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Wed, 2 Jul 2025 15:44:38 +0200 Subject: [PATCH] Temp --- lang/en.json | 3 ++ module/config/actionConfig.mjs | 5 +++ module/data/action/_module.mjs | 4 ++- module/data/action/action.mjs | 61 +++++++++++++++++++++++++--------- system.json | 2 +- 5 files changed, 57 insertions(+), 18 deletions(-) diff --git a/lang/en.json b/lang/en.json index 4458d9ac..2277f6ab 100755 --- a/lang/en.json +++ b/lang/en.json @@ -1620,6 +1620,9 @@ }, "macro": { "name": "Macro" + }, + "beastform": { + "name": "Beastform" } }, "Settings": { diff --git a/module/config/actionConfig.mjs b/module/config/actionConfig.mjs index 6506e485..1ac34889 100644 --- a/module/config/actionConfig.mjs +++ b/module/config/actionConfig.mjs @@ -38,6 +38,11 @@ export const actionTypes = { id: 'macro', name: 'DAGGERHEART.Actions.Types.macro.name', icon: 'fa-scroll' + }, + beastform: { + id: 'beastform', + name: 'DAGGERHEART.Actions.Types.beastform.name', + icon: 'fa-paw' } }; diff --git a/module/data/action/_module.mjs b/module/data/action/_module.mjs index 23d4e3c1..09c027d1 100644 --- a/module/data/action/_module.mjs +++ b/module/data/action/_module.mjs @@ -1,6 +1,7 @@ import { DHAttackAction, DHBaseAction, + DhBeastformAction, DHDamageAction, DHEffectAction, DHHealingAction, @@ -19,5 +20,6 @@ export const actionsTypes = { healing: DHHealingAction, summon: DHSummonAction, effect: DHEffectAction, - macro: DHMacroAction + macro: DHMacroAction, + beastform: DhBeastformAction }; diff --git a/module/data/action/action.mjs b/module/data/action/action.mjs index af5e061e..00f3ef2c 100644 --- a/module/data/action/action.mjs +++ b/module/data/action/action.mjs @@ -270,6 +270,10 @@ export class DHBaseAction extends foundry.abstract.DataModel { }) */ } + if (this instanceof DhBeastformAction) { + console.log('Test'); + } + if (this.doFollowUp()) { if (this.rollDamage) await this.rollDamage(event, config); if (this.rollHealing) await this.rollHealing(event, config); @@ -402,11 +406,18 @@ export class DHBaseAction extends foundry.abstract.DataModel { hasCost(costs) { const realCosts = this.getRealCosts(costs), hasFearCost = realCosts.findIndex(c => c.type === 'fear'); - if(hasFearCost > -1) { + if (hasFearCost > -1) { const fearCost = realCosts.splice(hasFearCost, 1); - if(!game.user.isGM || fearCost[0].total > game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear)) return false; + if ( + !game.user.isGM || + fearCost[0].total > game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.Resources.Fear) + ) + return false; } - return realCosts.reduce((a, c) => a && this.actor.system.resources[c.type]?.value >= (c.total ?? c.value), true); + return realCosts.reduce( + (a, c) => a && this.actor.system.resources[c.type]?.value >= (c.total ?? c.value), + true + ); } /* COST */ @@ -498,19 +509,25 @@ export class DHBaseAction extends foundry.abstract.DataModel { /* SAVE */ async rollSave(target, event, message) { - if(!target?.actor) return; - return target.actor.diceRoll({ - event, - title: 'Roll Save', - roll: { - trait: this.save.trait, - difficulty: this.save.difficulty, - type: "reaction" - }, - data: target.actor.getRollData() - }).then(async (result) => { - if(result) this.updateChatMessage(message, target.id, {result: result.roll.total, success: result.roll.success}); - }) + if (!target?.actor) return; + return target.actor + .diceRoll({ + event, + title: 'Roll Save', + roll: { + trait: this.save.trait, + difficulty: this.save.difficulty, + type: 'reaction' + }, + data: target.actor.getRollData() + }) + .then(async result => { + if (result) + this.updateChatMessage(message, target.id, { + result: result.roll.total, + success: result.roll.success + }); + }); } async updateChatMessage(message, targetId, changes, chain = true) { @@ -743,3 +760,15 @@ export class DHMacroAction extends DHBaseAction { } } } + +export class DhBeastformAction extends DHBaseAction { + static defineSchema() { + return { + ...super.defineSchema(), + tierAccess: new fields.SchemaField({ + exact: new fields.NumberField({ integer: true, nullable: true, initial: null }), + characterBased: new fields.BooleanField({ initial: true }) + }) + }; + } +} diff --git a/system.json b/system.json index c1a5c501..9b22d117 100644 --- a/system.json +++ b/system.json @@ -5,7 +5,7 @@ "version": "0.0.1", "compatibility": { "minimum": "13", - "verified": "13.345", + "verified": "13.346", "maximum": "13" }, "authors": [