mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Fixed so that DamageRolls are actually stored with class='DamageRoll' in the chatMessage so they don't get instantiated as BaseRoll
This commit is contained in:
parent
863b5116f7
commit
14edc7f4ca
3 changed files with 3 additions and 3 deletions
|
|
@ -203,7 +203,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
||||||
const oldRoll = damageData.parts[0]?.roll;
|
const oldRoll = damageData.parts[0]?.roll;
|
||||||
return oldRoll ? JSON.stringify({
|
return oldRoll ? JSON.stringify({
|
||||||
...oldRoll,
|
...oldRoll,
|
||||||
class: 'BaseRoll',
|
class: 'DamageRoll',
|
||||||
options: {
|
options: {
|
||||||
...oldRoll.options,
|
...oldRoll.options,
|
||||||
damageTypes: damageData.parts[0].damageTypes ?? []
|
damageTypes: damageData.parts[0].damageTypes ?? []
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export class ChatDamageData extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
_prepareRolls() {
|
_prepareRolls() {
|
||||||
this.main &&= Roll.fromData({ ...this.main, class: 'DamageRoll' }); // Temp overriding to DamageRoll. Should be properly saved on creation instead
|
this.main &&= Roll.fromData(this.main);
|
||||||
for (const key of Object.keys(this.resources)) {
|
for (const key of Object.keys(this.resources)) {
|
||||||
this.resources[key] = Roll.fromData(this.resources[key]);
|
this.resources[key] = Roll.fromData(this.resources[key]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ export default class DamageRoll extends DHRoll {
|
||||||
if (!formulaData) return null;
|
if (!formulaData) return null;
|
||||||
this.options.isCritical = config.isCritical;
|
this.options.isCritical = config.isCritical;
|
||||||
|
|
||||||
formulaData.roll = new Roll(Roll.replaceFormulaData(formulaData.formula, config.data));
|
formulaData.roll = new this.constructor(Roll.replaceFormulaData(formulaData.formula, config.data));
|
||||||
formulaData.roll.terms = Roll.parse(formulaData.roll.formula, config.data);
|
formulaData.roll.terms = Roll.parse(formulaData.roll.formula, config.data);
|
||||||
|
|
||||||
if (formulaData.extraFormula) {
|
if (formulaData.extraFormula) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue