Feature/233 234 235 (#246)

* #233 #234 #235 + Fixes

* Fix reaction roll
This commit is contained in:
Dapoulp 2025-07-02 21:13:06 +02:00 committed by GitHub
parent eb647f1e31
commit 750282aeec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 355 additions and 192 deletions

View file

@ -1,4 +1,3 @@
import CostSelectionDialog from '../../applications/costSelectionDialog.mjs';
import { DHActionDiceData, DHActionRollData, DHDamageData, DHDamageField } from './actionDice.mjs';
import DhpActor from '../../documents/actor.mjs';
import D20RollDialog from '../../dialogs/d20RollDialog.mjs';
@ -343,7 +342,9 @@ export class DHBaseAction extends foundry.abstract.DataModel {
label: 'Attack',
type: this.actionType,
difficulty: this.roll?.difficulty,
formula: this.roll.getFormula()
formula: this.roll.getFormula(),
bonus: this.roll.bonus,
advantage: SYSTEM.ACTIONS.advandtageState[this.roll.advState].value
};
if (this.roll?.type === 'diceSet') roll.lite = true;
@ -372,7 +373,7 @@ export class DHBaseAction extends foundry.abstract.DataModel {
/* ROLL */
get hasRoll() {
return !!this.roll?.type;
return !!this.roll?.type || !!this.roll?.bonus;
}
/* ROLL */

View file

@ -11,7 +11,8 @@ export class DHActionRollData extends foundry.abstract.DataModel {
type: new fields.StringField({ nullable: true, initial: null, choices: SYSTEM.GENERAL.rollTypes }),
trait: new fields.StringField({ nullable: true, initial: null, choices: SYSTEM.ACTOR.abilities }),
difficulty: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }),
bonus: new fields.NumberField({ nullable: true, initial: null, integer: true, min: 0 }),
bonus: new fields.NumberField({ nullable: true, initial: null, integer: true }),
advState: new fields.StringField({ choices: SYSTEM.ACTIONS.advandtageState, initial: 'neutral' }),
diceRolling: new fields.SchemaField({
multiplier: new fields.StringField({
choices: SYSTEM.GENERAL.diceSetNumbers,
@ -62,7 +63,7 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
label: 'Multiplier'
}),
flatMultiplier: new fields.NumberField({ nullable: true, initial: 1, label: 'Flat Multiplier' }),
dice: new fields.StringField({ choices: SYSTEM.GENERAL.diceTypes, initial: 'd6', label: 'Formula' }),
dice: new fields.StringField({ choices: SYSTEM.GENERAL.diceTypes, initial: 'd6', label: 'Dice' }),
bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }),
custom: new fields.SchemaField({
enabled: new fields.BooleanField({ label: 'Custom Formula' }),

View file

@ -1,9 +1,9 @@
import { actionsTypes } from '../action/_module.mjs';
// import { actionsTypes } from '../action/_module.mjs';
// Temporary Solution
export default class ActionField extends foundry.data.fields.ObjectField {
getModel(value) {
return actionsTypes[value.type] ?? actionsTypes.attack;
return game.system.api.models.actionsTypes[value.type] ?? game.system.api.models.actionsTypes.attack;
}
/* -------------------------------------------- */

View file

@ -1,4 +1,4 @@
import { actionsTypes } from '../action/_module.mjs';
// import { actionsTypes } from '../action/_module.mjs';
/**
* Describes metadata about the item data model type
@ -60,7 +60,8 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
const actionType = {
weapon: 'attack'
}[this.constructor.metadata.type],
cls = actionsTypes.attack,
cls = game.system.api.models.actionsTypes[actionType],
// cls = actionsTypes.attack,
action = new cls(
{
_id: foundry.utils.randomID(),