Compare commits

..

No commits in common. "12119bfbfc037cd9f5537315a39713f878ebcb8c" and "482b932cd60309ee86b2b2e584121acbe9681f4f" have entirely different histories.

5 changed files with 22 additions and 26 deletions

View file

@ -1280,11 +1280,11 @@
"die": "Die"
},
"OutcomeType": {
"default": "Default Outcome",
"successHope": "Success/ Hope",
"successFear": "Success/ Fear",
"failureHope": "Failure/ Hope",
"failureFear": "Failure/ Fear"
"failureFear": "Failure/ Fear",
"simpleOutcome": "Outcome"
},
"Range": {
"self": {
@ -2359,8 +2359,7 @@
"deathMoves": "Deathmoves",
"sources": "Sources",
"packs": "Packs",
"range": "Range",
"outcomes": "Outcomes"
"range": "Range"
},
"Tiers": {
"singular": "Tier",

View file

@ -21,7 +21,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
/* Needs to consider effect altOutcomes aswell */
static getOutcomeTabs(action) {
const outcomeKeys = [
'default',
'successHope',
...Object.keys(action.damage?.altOutcomes ?? {}).filter(key => action.damage.altOutcomes[key])
];
return outcomeKeys.reduce((acc, key, index) => {
@ -31,7 +31,10 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
group: 'outcomes',
id: key,
icon: null,
label: game.i18n.localize(CONFIG.DH.ACTIONS.outcomeTypes[key].label)
label:
outcomeKeys.length === 1
? game.i18n.localize('DAGGERHEART.CONFIG.OutcomeType.simpleOutcome')
: game.i18n.localize(CONFIG.DH.ACTIONS.outcomeTypes[key].label)
};
return acc;
}, {});
@ -40,7 +43,8 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
/* Needs to consider effect altOutcomes aswell */
static selectOutcome(action, callback) {
const choices = Object.entries(CONFIG.DH.ACTIONS.outcomeTypes).reduce((acc, [key, value]) => {
if (action.damage.altOutcomes[key] === null) acc.push({ id: key, label: game.i18n.localize(value.label) });
if (key !== 'successHope' && action.damage.altOutcomes[key] === null)
acc.push({ id: key, label: game.i18n.localize(value.label) });
return acc;
}, []);
@ -181,7 +185,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
group: 'primary',
id: 'effect',
icon: null,
label: 'DAGGERHEART.GENERAL.Tabs.outcomes'
label: 'DAGGERHEART.GENERAL.Tabs.effects'
},
trigger: {
active: false,
@ -394,7 +398,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
const outcome = button.dataset.outcome;
const outcomeParts =
outcome === 'default'
outcome === 'successHope'
? this.action._source.damage.parts
: this.action._source.damage.altOutcomes[outcome].parts;
const choices = getUnusedDamageTypes(outcomeParts);
@ -420,7 +424,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
if (type === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
part.type = this.action.schema.fields.damage.fields.parts.element.fields.type.element.initial;
if (outcome === 'default') data.damage.parts[type] = part;
if (outcome === 'successHope') data.damage.parts[type] = part;
else {
if (!data.damage.altOutcomes[outcome]) {
data.damage.altOutcomes[outcome] = new AltDamageOutcome();
@ -460,7 +464,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
if (!this.action.damage.parts) return;
const data = this.action.toObject();
const { key, outcome } = button.dataset;
if (outcome === 'default') {
if (outcome === 'successHope') {
delete data.damage.parts[key];
data.damage.parts[`${key}`] = _del;
} else {

View file

@ -124,10 +124,6 @@ export const areaTypes = {
};
export const outcomeTypes = {
default: {
key: 'default',
label: 'DAGGERHEART.CONFIG.OutcomeType.default'
},
successHope: {
key: 'successHope',
label: 'DAGGERHEART.CONFIG.OutcomeType.successHope'

View file

@ -24,7 +24,6 @@ export default class DamageField extends fields.SchemaField {
const damageFields = {
...getDamageBaseFields(),
altOutcomes: new fields.SchemaField({
successHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
successFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
failureHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
failureFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null })
@ -346,6 +345,7 @@ export class DHDamageData extends DHResourceData {
export class AltDamageOutcome extends foundry.abstract.DataModel {
static defineSchema() {
return {
useStandardHitPointDamage: new fields.BooleanField({ required: true, initial: true }),
...getDamageBaseFields()
};
}

View file

@ -9,7 +9,7 @@
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
{{localize tab.label}}
</a>
{{#unless (eq tab.id 'default')}}<a data-outcome="{{tab.id}}" data-action="removeOutcome"><i class="fa-solid fa-trash"></i></a>{{/unless}}
{{#unless (eq tab.id 'successHope')}}<a data-outcome="{{tab.id}}" data-action="removeOutcome"><i class="fa-solid fa-trash"></i></a>{{/unless}}
</div>
{{/each}}
<a data-action="addOutcome" {{#if allOutcomesAssigned}}disabled{{/if}}><i class="fa-solid fa-plus"></i></a>
@ -21,16 +21,13 @@
data-group="outcomes"
data-tab="{{tab.id}}"
>
{{#if ../fields.damage}}
{{#if (eq tab.id 'default')}}
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=../fields.damage.fields.parts.element.fields source=../source.damage baseFields=../fields.damage.fields outcome=tab.id outcomePath="damage" isDefaultDamage="true" }}
{{else}}
{{#with (lookup ../fields.damage.fields.altOutcomes.fields tab.id) as |field|}}
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=field.fields.parts.element.fields source=(lookup ../../source.damage.altOutcomes ../id) baseFields=field.fields outcome=../id outcomePath=(concat "damage.altOutcomes." tab.id) }}
{{/with }}
{{/if}}
{{#if (eq tab.id 'successHope')}}
{{#if ../fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=../fields.damage.fields.parts.element.fields source=../source.damage baseFields=../fields.damage.fields outcome=tab.id outcomePath="damage" }}{{/if}}
{{else}}
{{#with (lookup ../fields.damage.fields.altOutcomes.fields tab.id) as |field|}}
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=field.fields.parts.element.fields source=(lookup ../../source.damage.altOutcomes ../id) baseFields=field.fields outcome=../id outcomePath=(concat "damage.altOutcomes." tab.id) }}
{{/with }}
{{/if}}
</section>
{{/each}}