mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-07 21:34:16 +02:00
Changed to use DefaultOutcome and added successHope as an alt outcome
This commit is contained in:
parent
482b932cd6
commit
e12d5ce851
6 changed files with 41 additions and 22 deletions
|
|
@ -136,6 +136,8 @@
|
||||||
"criticalThreshold": "Critical Threshold",
|
"criticalThreshold": "Critical Threshold",
|
||||||
"includeBase": { "label": "Include Item Damage" },
|
"includeBase": { "label": "Include Item Damage" },
|
||||||
"groupAttack": { "label": "Group Attack" },
|
"groupAttack": { "label": "Group Attack" },
|
||||||
|
"inheritDefaultDamage": { "label": "Inherit Default Damage" },
|
||||||
|
"inheritDefaultEffects": { "label": "Inherit Default Effects" },
|
||||||
"multiplier": "Multiplier",
|
"multiplier": "Multiplier",
|
||||||
"saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.",
|
"saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.",
|
||||||
"resultBased": {
|
"resultBased": {
|
||||||
|
|
@ -1280,11 +1282,11 @@
|
||||||
"die": "Die"
|
"die": "Die"
|
||||||
},
|
},
|
||||||
"OutcomeType": {
|
"OutcomeType": {
|
||||||
|
"default": "Default Outcome",
|
||||||
"successHope": "Success/ Hope",
|
"successHope": "Success/ Hope",
|
||||||
"successFear": "Success/ Fear",
|
"successFear": "Success/ Fear",
|
||||||
"failureHope": "Failure/ Hope",
|
"failureHope": "Failure/ Hope",
|
||||||
"failureFear": "Failure/ Fear",
|
"failureFear": "Failure/ Fear"
|
||||||
"simpleOutcome": "Outcome"
|
|
||||||
},
|
},
|
||||||
"Range": {
|
"Range": {
|
||||||
"self": {
|
"self": {
|
||||||
|
|
@ -2359,7 +2361,8 @@
|
||||||
"deathMoves": "Deathmoves",
|
"deathMoves": "Deathmoves",
|
||||||
"sources": "Sources",
|
"sources": "Sources",
|
||||||
"packs": "Packs",
|
"packs": "Packs",
|
||||||
"range": "Range"
|
"range": "Range",
|
||||||
|
"outcomes": "Outcomes"
|
||||||
},
|
},
|
||||||
"Tiers": {
|
"Tiers": {
|
||||||
"singular": "Tier",
|
"singular": "Tier",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
/* Needs to consider effect altOutcomes aswell */
|
/* Needs to consider effect altOutcomes aswell */
|
||||||
static getOutcomeTabs(action) {
|
static getOutcomeTabs(action) {
|
||||||
const outcomeKeys = [
|
const outcomeKeys = [
|
||||||
'successHope',
|
'default',
|
||||||
...Object.keys(action.damage?.altOutcomes ?? {}).filter(key => action.damage.altOutcomes[key])
|
...Object.keys(action.damage?.altOutcomes ?? {}).filter(key => action.damage.altOutcomes[key])
|
||||||
];
|
];
|
||||||
return outcomeKeys.reduce((acc, key, index) => {
|
return outcomeKeys.reduce((acc, key, index) => {
|
||||||
|
|
@ -31,10 +31,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
group: 'outcomes',
|
group: 'outcomes',
|
||||||
id: key,
|
id: key,
|
||||||
icon: null,
|
icon: null,
|
||||||
label:
|
label: game.i18n.localize(CONFIG.DH.ACTIONS.outcomeTypes[key].label)
|
||||||
outcomeKeys.length === 1
|
|
||||||
? game.i18n.localize('DAGGERHEART.CONFIG.OutcomeType.simpleOutcome')
|
|
||||||
: game.i18n.localize(CONFIG.DH.ACTIONS.outcomeTypes[key].label)
|
|
||||||
};
|
};
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
@ -43,8 +40,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
/* Needs to consider effect altOutcomes aswell */
|
/* Needs to consider effect altOutcomes aswell */
|
||||||
static selectOutcome(action, callback) {
|
static selectOutcome(action, callback) {
|
||||||
const choices = Object.entries(CONFIG.DH.ACTIONS.outcomeTypes).reduce((acc, [key, value]) => {
|
const choices = Object.entries(CONFIG.DH.ACTIONS.outcomeTypes).reduce((acc, [key, value]) => {
|
||||||
if (key !== 'successHope' && action.damage.altOutcomes[key] === null)
|
if (action.damage.altOutcomes[key] === null) acc.push({ id: key, label: game.i18n.localize(value.label) });
|
||||||
acc.push({ id: key, label: game.i18n.localize(value.label) });
|
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -185,7 +181,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
group: 'primary',
|
group: 'primary',
|
||||||
id: 'effect',
|
id: 'effect',
|
||||||
icon: null,
|
icon: null,
|
||||||
label: 'DAGGERHEART.GENERAL.Tabs.effects'
|
label: 'DAGGERHEART.GENERAL.Tabs.outcomes'
|
||||||
},
|
},
|
||||||
trigger: {
|
trigger: {
|
||||||
active: false,
|
active: false,
|
||||||
|
|
@ -398,7 +394,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
|
|
||||||
const outcome = button.dataset.outcome;
|
const outcome = button.dataset.outcome;
|
||||||
const outcomeParts =
|
const outcomeParts =
|
||||||
outcome === 'successHope'
|
outcome === 'default'
|
||||||
? this.action._source.damage.parts
|
? this.action._source.damage.parts
|
||||||
: this.action._source.damage.altOutcomes[outcome].parts;
|
: this.action._source.damage.altOutcomes[outcome].parts;
|
||||||
const choices = getUnusedDamageTypes(outcomeParts);
|
const choices = getUnusedDamageTypes(outcomeParts);
|
||||||
|
|
@ -424,7 +420,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
if (type === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
|
if (type === CONFIG.DH.GENERAL.healingTypes.hitPoints.id)
|
||||||
part.type = this.action.schema.fields.damage.fields.parts.element.fields.type.element.initial;
|
part.type = this.action.schema.fields.damage.fields.parts.element.fields.type.element.initial;
|
||||||
|
|
||||||
if (outcome === 'successHope') data.damage.parts[type] = part;
|
if (outcome === 'default') data.damage.parts[type] = part;
|
||||||
else {
|
else {
|
||||||
if (!data.damage.altOutcomes[outcome]) {
|
if (!data.damage.altOutcomes[outcome]) {
|
||||||
data.damage.altOutcomes[outcome] = new AltDamageOutcome();
|
data.damage.altOutcomes[outcome] = new AltDamageOutcome();
|
||||||
|
|
@ -464,7 +460,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
if (!this.action.damage.parts) return;
|
if (!this.action.damage.parts) return;
|
||||||
const data = this.action.toObject();
|
const data = this.action.toObject();
|
||||||
const { key, outcome } = button.dataset;
|
const { key, outcome } = button.dataset;
|
||||||
if (outcome === 'successHope') {
|
if (outcome === 'default') {
|
||||||
delete data.damage.parts[key];
|
delete data.damage.parts[key];
|
||||||
data.damage.parts[`${key}`] = _del;
|
data.damage.parts[`${key}`] = _del;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,10 @@ export const areaTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const outcomeTypes = {
|
export const outcomeTypes = {
|
||||||
|
default: {
|
||||||
|
key: 'default',
|
||||||
|
label: 'DAGGERHEART.CONFIG.OutcomeType.default'
|
||||||
|
},
|
||||||
successHope: {
|
successHope: {
|
||||||
key: 'successHope',
|
key: 'successHope',
|
||||||
label: 'DAGGERHEART.CONFIG.OutcomeType.successHope'
|
label: 'DAGGERHEART.CONFIG.OutcomeType.successHope'
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ export default class DamageField extends fields.SchemaField {
|
||||||
const damageFields = {
|
const damageFields = {
|
||||||
...getDamageBaseFields(),
|
...getDamageBaseFields(),
|
||||||
altOutcomes: new fields.SchemaField({
|
altOutcomes: new fields.SchemaField({
|
||||||
|
successHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
|
||||||
successFear: 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 }),
|
failureHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
|
||||||
failureFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null })
|
failureFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null })
|
||||||
|
|
@ -345,7 +346,16 @@ export class DHDamageData extends DHResourceData {
|
||||||
export class AltDamageOutcome extends foundry.abstract.DataModel {
|
export class AltDamageOutcome extends foundry.abstract.DataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
useStandardHitPointDamage: new fields.BooleanField({ required: true, initial: true }),
|
inheritDefaultDamage: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: true,
|
||||||
|
label: 'DAGGERHEART.ACTIONS.Settings.inheritDefaultDamage.label'
|
||||||
|
}),
|
||||||
|
inheritDefaultEffects: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: true,
|
||||||
|
label: 'DAGGERHEART.ACTIONS.Settings.inheritDefaultEffects.label'
|
||||||
|
}),
|
||||||
...getDamageBaseFields()
|
...getDamageBaseFields()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@
|
||||||
{{#if (and @root.isNPC (not (eq path 'system.attack.')))}}
|
{{#if (and @root.isNPC (not (eq path 'system.attack.')))}}
|
||||||
{{formField baseFields.groupAttack value=source.groupAttack name=(concat path basePath ".groupAttack") localize=true classes="select"}}
|
{{formField baseFields.groupAttack value=source.groupAttack name=(concat path basePath ".groupAttack") localize=true classes="select"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#unless isDefaultDamage}}
|
||||||
|
{{formField @root.fields.damage.fields.altOutcomes.fields.successFear.fields.inheritDefaultDamage name=(concat path basePath ".inheritDefaultDamage") localize=true classes="checkbox"}}
|
||||||
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{!-- Handlebars uses Symbol.Iterator to produce index|key. This isn't compatible with our parts object, so we instead use applyTo, which is the same value --}}
|
{{!-- Handlebars uses Symbol.Iterator to produce index|key. This isn't compatible with our parts object, so we instead use applyTo, which is the same value --}}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
||||||
{{localize tab.label}}
|
{{localize tab.label}}
|
||||||
</a>
|
</a>
|
||||||
{{#unless (eq tab.id 'successHope')}}<a data-outcome="{{tab.id}}" data-action="removeOutcome"><i class="fa-solid fa-trash"></i></a>{{/unless}}
|
{{#unless (eq tab.id 'default')}}<a data-outcome="{{tab.id}}" data-action="removeOutcome"><i class="fa-solid fa-trash"></i></a>{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<a data-action="addOutcome" {{#if allOutcomesAssigned}}disabled{{/if}}><i class="fa-solid fa-plus"></i></a>
|
<a data-action="addOutcome" {{#if allOutcomesAssigned}}disabled{{/if}}><i class="fa-solid fa-plus"></i></a>
|
||||||
|
|
@ -21,13 +21,16 @@
|
||||||
data-group="outcomes"
|
data-group="outcomes"
|
||||||
data-tab="{{tab.id}}"
|
data-tab="{{tab.id}}"
|
||||||
>
|
>
|
||||||
{{#if (eq tab.id 'successHope')}}
|
{{#if ../fields.damage}}
|
||||||
{{#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}}
|
{{#if (eq tab.id 'default')}}
|
||||||
{{else}}
|
{{> '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" }}
|
||||||
{{#with (lookup ../fields.damage.fields.altOutcomes.fields tab.id) as |field|}}
|
{{else}}
|
||||||
{{> '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 (lookup ../fields.damage.fields.altOutcomes.fields tab.id) as |field|}}
|
||||||
{{/with }}
|
{{> '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}}
|
{{/if}}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue