Update action actionType & roll type

This commit is contained in:
Dapoolp 2025-08-23 12:35:38 +02:00
parent 5045d481e5
commit b5ba7e7fba
7 changed files with 14 additions and 12 deletions

View file

@ -7,7 +7,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
this.roll = roll; this.roll = roll;
this.config = config; this.config = config;
this.config.experiences = []; this.config.experiences = [];
this.reactionOverride = config.roll?.type === 'reaction'; this.reactionOverride = config.actionType === 'reaction';
if (config.source?.action) { if (config.source?.action) {
this.item = config.data.parent.items.get(config.source.item) ?? config.data.parent; this.item = config.data.parent.items.get(config.source.item) ?? config.data.parent;
@ -114,7 +114,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
context.extraFormula = this.config.extraFormula; context.extraFormula = this.config.extraFormula;
context.formula = this.roll.constructFormula(this.config); context.formula = this.roll.constructFormula(this.config);
context.showReaction = !context.rollConfig.type && context.rollType === 'DualityRoll'; context.showReaction = !context.config.roll?.type && context.rollType === 'DualityRoll';
context.reactionOverride = this.reactionOverride; context.reactionOverride = this.reactionOverride;
} }
return context; return context;
@ -171,11 +171,11 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
static toggleReaction() { static toggleReaction() {
if (this.config.roll) { if (this.config.roll) {
this.reactionOverride = !this.reactionOverride; this.reactionOverride = !this.reactionOverride;
this.config.roll.type = this.reactionOverride this.config.actionType = this.reactionOverride
? CONFIG.DH.ITEM.actionTypes.reaction.id ? CONFIG.DH.ITEM.actionTypes.reaction.id
: this.config.roll.type === CONFIG.DH.ITEM.actionTypes.reaction.id : this.config.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id
? null ? null
: this.config.roll.type; : this.config.actionType;
this.render(); this.render();
} }
} }

View file

@ -661,7 +661,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
}) })
}); });
game.system.api.fields.ActionFields.CostField.execute.call(this, result); if(result) game.system.api.fields.ActionFields.CostField.execute.call(this, result);
} }
//TODO: redo toggleEquipItem method //TODO: redo toggleEquipItem method

View file

@ -215,7 +215,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
actor: this.actor.uuid actor: this.actor.uuid
}, },
dialog: {}, dialog: {},
type: this.type, actionType: this.actionType,
hasRoll: this.hasRoll, hasRoll: this.hasRoll,
hasDamage: this.hasDamage, hasDamage: this.hasDamage,
hasHealing: this.hasHealing, hasHealing: this.hasHealing,

View file

@ -144,7 +144,7 @@ export default class RollField extends fields.EmbeddedDataField {
const roll = { const roll = {
baseModifiers: this.roll.getModifier(), baseModifiers: this.roll.getModifier(),
label: 'Attack', label: 'Attack',
type: this.actionType, type: this.roll?.type,
difficulty: this.roll?.difficulty, difficulty: this.roll?.difficulty,
formula: this.roll.getFormula(), formula: this.roll.getFormula(),
advantage: CONFIG.DH.ACTIONS.advantageState[this.roll.advState].value advantage: CONFIG.DH.ACTIONS.advantageState[this.roll.advState].value

View file

@ -128,7 +128,9 @@ export default class D20Roll extends DHRoll {
applyBaseBonus() { applyBaseBonus() {
const modifiers = foundry.utils.deepClone(this.options.roll.baseModifiers) ?? []; const modifiers = foundry.utils.deepClone(this.options.roll.baseModifiers) ?? [];
modifiers.push(...this.getBonus(`roll.${this.options.type}`, `${this.options.type?.capitalize()} Bonus`)); modifiers.push(
...this.getBonus(`roll.${this.options.actionType}`, `${this.options.actionType?.capitalize()} Bonus`)
);
modifiers.push( modifiers.push(
...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type?.capitalize()} Bonus`) ...this.getBonus(`roll.${this.options.roll.type}`, `${this.options.roll.type?.capitalize()} Bonus`)
); );
@ -138,7 +140,7 @@ export default class D20Roll extends DHRoll {
static postEvaluate(roll, config = {}) { static postEvaluate(roll, config = {}) {
const data = super.postEvaluate(roll, config); const data = super.postEvaluate(roll, config);
data.type = config.roll?.type; data.type = config.actionType;
data.difficulty = config.roll.difficulty; data.difficulty = config.roll.difficulty;
if (config.targets?.length) { if (config.targets?.length) {
config.targets.forEach(target => { config.targets.forEach(target => {

View file

@ -223,7 +223,7 @@ export const registerRollDiceHooks = () => {
if ( if (
!config.source?.actor || !config.source?.actor ||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) || (game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||
config.roll.type === 'reaction' config.actionType === 'reaction'
) )
return; return;

View file

@ -19,7 +19,7 @@ export default class DualityRoll extends D20Roll {
get title() { get title() {
return game.i18n.localize( return game.i18n.localize(
`DAGGERHEART.GENERAL.${this.options?.roll?.type === CONFIG.DH.ITEM.actionTypes.reaction.id ? 'reactionRoll' : 'dualityRoll'}` `DAGGERHEART.GENERAL.${this.options?.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id ? 'reactionRoll' : 'dualityRoll'}`
); );
} }