This commit is contained in:
WBHarry 2025-07-02 15:44:38 +02:00
parent eb647f1e31
commit 97f8da69cd
5 changed files with 57 additions and 18 deletions

View file

@ -1620,6 +1620,9 @@
},
"macro": {
"name": "Macro"
},
"beastform": {
"name": "Beastform"
}
},
"Settings": {

View file

@ -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'
}
};

View file

@ -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
};

View file

@ -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 })
})
};
}
}

View file

@ -5,7 +5,7 @@
"version": "0.0.1",
"compatibility": {
"minimum": "13",
"verified": "13.345",
"verified": "13.346",
"maximum": "13"
},
"authors": [