Lift definition of alt outcomes up one step

This commit is contained in:
Carlos Fernandez 2026-05-15 22:43:57 -04:00
parent f607e8dfa4
commit 1ffde09568
7 changed files with 71 additions and 63 deletions

View file

@ -0,0 +1,19 @@
import { getDamageBaseFields } from '../fields/action/damageField.mjs';
const fields = foundry.data.fields;
export class AltOutcome extends foundry.abstract.DataModel {
static defineSchema() {
return {
damage: new fields.SchemaField(getDamageBaseFields())
// todo: add effects
};
}
get data() {
return {
...this.parent,
...this
};
}
}

View file

@ -1,8 +1,23 @@
import { AltOutcome } from './altOutcome.mjs';
import DHBaseAction from './baseAction.mjs';
const fields = foundry.data.fields;
export default class DHDamageAction extends DHBaseAction {
static extraSchemas = [...super.extraSchemas, 'damage', 'target', 'effects'];
static defineSchema() {
return {
...super.defineSchema(),
altOutcomes: new fields.SchemaField({
successHope: new fields.EmbeddedDataField(AltOutcome, { nullable: true, initial: null }),
successFear: new fields.EmbeddedDataField(AltOutcome, { nullable: true, initial: null }),
failureHope: new fields.EmbeddedDataField(AltOutcome, { nullable: true, initial: null }),
failureFear: new fields.EmbeddedDataField(AltOutcome, { nullable: true, initial: null })
})
};
}
/**
* Return a display ready damage formula string
* @returns Formula string