mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Initial
This commit is contained in:
parent
1cece731ee
commit
dbb08fec8c
7 changed files with 113 additions and 12 deletions
|
|
@ -2347,7 +2347,8 @@
|
||||||
"triggers": "Triggers",
|
"triggers": "Triggers",
|
||||||
"deathMoves": "Deathmoves",
|
"deathMoves": "Deathmoves",
|
||||||
"sources": "Sources",
|
"sources": "Sources",
|
||||||
"packs": "Packs"
|
"packs": "Packs",
|
||||||
|
"range": "Range"
|
||||||
},
|
},
|
||||||
"Tiers": {
|
"Tiers": {
|
||||||
"singular": "Tier",
|
"singular": "Tier",
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
id: 'configuration',
|
id: 'configuration',
|
||||||
template: 'systems/daggerheart/templates/sheets-settings/action-settings/configuration.hbs'
|
template: 'systems/daggerheart/templates/sheets-settings/action-settings/configuration.hbs'
|
||||||
},
|
},
|
||||||
|
configuration: {
|
||||||
|
id: 'range',
|
||||||
|
template: 'systems/daggerheart/templates/sheets-settings/action-settings/range.hbs'
|
||||||
|
},
|
||||||
effect: {
|
effect: {
|
||||||
id: 'effect',
|
id: 'effect',
|
||||||
template: 'systems/daggerheart/templates/sheets-settings/action-settings/effect.hbs'
|
template: 'systems/daggerheart/templates/sheets-settings/action-settings/effect.hbs'
|
||||||
|
|
@ -89,6 +93,14 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
icon: null,
|
icon: null,
|
||||||
label: 'DAGGERHEART.GENERAL.Tabs.configuration'
|
label: 'DAGGERHEART.GENERAL.Tabs.configuration'
|
||||||
},
|
},
|
||||||
|
range: {
|
||||||
|
active: false,
|
||||||
|
cssClass: '',
|
||||||
|
group: 'primary',
|
||||||
|
id: 'range',
|
||||||
|
icon: null,
|
||||||
|
label: 'DAGGERHEART.GENERAL.Tabs.range'
|
||||||
|
},
|
||||||
effect: {
|
effect: {
|
||||||
active: false,
|
active: false,
|
||||||
cssClass: '',
|
cssClass: '',
|
||||||
|
|
@ -107,6 +119,25 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static OUTCOME_TABS = {
|
||||||
|
successWithHope: {
|
||||||
|
active: true,
|
||||||
|
cssClass: '',
|
||||||
|
group: 'outcomes',
|
||||||
|
id: 'successWithHope',
|
||||||
|
icon: null,
|
||||||
|
label: 'Success With Hope'
|
||||||
|
},
|
||||||
|
successWithFear: {
|
||||||
|
active: false,
|
||||||
|
cssClass: '',
|
||||||
|
group: 'outcomes',
|
||||||
|
id: 'successWithFear',
|
||||||
|
icon: null,
|
||||||
|
label: 'Success With Fear'
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
static CLEAN_ARRAYS = ['cost', 'effects', 'summon'];
|
static CLEAN_ARRAYS = ['cost', 'effects', 'summon'];
|
||||||
|
|
||||||
_getTabs(tabs) {
|
_getTabs(tabs) {
|
||||||
|
|
@ -155,6 +186,10 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
|
||||||
|
|
||||||
context.openSection = this.openSection;
|
context.openSection = this.openSection;
|
||||||
context.tabs = this._getTabs(this.constructor.TABS);
|
context.tabs = this._getTabs(this.constructor.TABS);
|
||||||
|
|
||||||
|
context.outcomeTabs = this._getTabs(this.constructor.OUTCOME_TABS);
|
||||||
|
context.outcomeData = context.outcomeTabs.successWithHope.active ? context.source.damage : context.source.damage.altOutcomes.successWithFear;
|
||||||
|
|
||||||
context.config = CONFIG.DH;
|
context.config = CONFIG.DH;
|
||||||
if (this.action.damage) {
|
if (this.action.damage) {
|
||||||
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
|
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,15 @@ import IterableTypedObjectField from '../iterableTypedObjectField.mjs';
|
||||||
|
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
|
const getDamageBaseFields = () => ({
|
||||||
|
parts: new IterableTypedObjectField(DHDamageData),
|
||||||
|
includeBase: new fields.BooleanField({
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
|
||||||
|
}),
|
||||||
|
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }),
|
||||||
|
});
|
||||||
|
|
||||||
export default class DamageField extends fields.SchemaField {
|
export default class DamageField extends fields.SchemaField {
|
||||||
/**
|
/**
|
||||||
* Action Workflow order
|
* Action Workflow order
|
||||||
|
|
@ -13,12 +22,13 @@ export default class DamageField extends fields.SchemaField {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
constructor(options, context = {}) {
|
constructor(options, context = {}) {
|
||||||
const damageFields = {
|
const damageFields = {
|
||||||
parts: new IterableTypedObjectField(DHDamageData),
|
...getDamageBaseFields(),
|
||||||
includeBase: new fields.BooleanField({
|
altOutcomes: new fields.SchemaField({
|
||||||
initial: false,
|
successFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
|
||||||
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
|
failureHope: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
|
||||||
|
failureFear: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null }),
|
||||||
|
critical: new fields.EmbeddedDataField(AltDamageOutcome, { nullable: true, initial: null })
|
||||||
}),
|
}),
|
||||||
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }),
|
|
||||||
groupAttack: new fields.StringField({
|
groupAttack: new fields.StringField({
|
||||||
choices: CONFIG.DH.GENERAL.groupAttackRange,
|
choices: CONFIG.DH.GENERAL.groupAttackRange,
|
||||||
blank: true,
|
blank: true,
|
||||||
|
|
@ -28,6 +38,12 @@ export default class DamageField extends fields.SchemaField {
|
||||||
super(damageFields, options, context);
|
super(damageFields, options, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDamageData(outcome) {
|
||||||
|
if (outcome === 'successHope') return this;
|
||||||
|
|
||||||
|
return this.altOutcomes[outcome].data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Roll Damage/Healing Action Workflow part.
|
* Roll Damage/Healing Action Workflow part.
|
||||||
* Must be called within Action context or similar.
|
* Must be called within Action context or similar.
|
||||||
|
|
@ -326,3 +342,17 @@ export class DHDamageData extends DHResourceData {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AltDamageOutcome extends foundry.abstract.DataModel {
|
||||||
|
static defineSchema() {
|
||||||
|
return {
|
||||||
|
copyStandard: new fields.BooleanField({ required: true, initial: true }),
|
||||||
|
...getDamageBaseFields(),
|
||||||
|
/* Stuff */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get data() {
|
||||||
|
return this.copyStandard ? this.parent : {}; // If not copying, return data from the this alternate outcome
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -153,4 +153,23 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inner-tabs {
|
||||||
|
justify-content: left;
|
||||||
|
|
||||||
|
.inner-tab {
|
||||||
|
line-height: 1.5;
|
||||||
|
border: 1px solid light-dark(@beige, @beige);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 0 4px;
|
||||||
|
background: light-dark(@beige, @dark-blue);
|
||||||
|
color: light-dark(@dark-blue, @beige);
|
||||||
|
|
||||||
|
a {
|
||||||
|
&.active {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
data-group="primary"
|
data-group="primary"
|
||||||
data-tab="config"
|
data-tab="config"
|
||||||
>
|
>
|
||||||
|
{{#if fields.roll}}{{> 'systems/daggerheart/templates/actionTypes/roll.hbs' fields=fields.roll.fields source=source.roll}}{{/if}}
|
||||||
|
{{#if fields.save}}{{> 'systems/daggerheart/templates/actionTypes/save.hbs' fields=fields.save.fields source=source.save}}{{/if}}
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/uses.hbs' fields=fields.uses.fields source=source.uses}}
|
{{> 'systems/daggerheart/templates/actionTypes/uses.hbs' fields=fields.uses.fields source=source.uses}}
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/cost.hbs' fields=fields.cost.element.fields source=source.cost costOptions=costOptions}}
|
{{> 'systems/daggerheart/templates/actionTypes/cost.hbs' fields=fields.cost.element.fields source=source.cost costOptions=costOptions}}
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/range-target.hbs' fields=(object range=fields.range target=fields.target.fields) source=(object target=source.target range=source.range)}}
|
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/areas.hbs' fields=fields.areas.element.fields source=source.areas}}
|
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
<section
|
<section
|
||||||
class="tab {{this.tabs.effect.cssClass}}"
|
class="tab {{this.tabs.effect.cssClass}}"
|
||||||
data-group="primary"
|
data-group="primary"
|
||||||
data-tab="effect"
|
data-tab="effect"
|
||||||
>
|
>
|
||||||
{{#if fields.roll}}{{> 'systems/daggerheart/templates/actionTypes/roll.hbs' fields=fields.roll.fields source=source.roll}}{{/if}}
|
<nav class='inner-tabs tabs' data-group='outcomes'>
|
||||||
{{#if fields.save}}{{> 'systems/daggerheart/templates/actionTypes/save.hbs' fields=fields.save.fields source=source.save}}{{/if}}
|
{{#each outcomeTabs as |tab|}}
|
||||||
{{#if fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=fields.damage.fields.parts.element.fields source=source.damage baseFields=fields.damage.fields }}{{/if}}
|
<div class="inner-tab">
|
||||||
|
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
||||||
|
{{localize tab.label}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{{#if fields.damage}}{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=fields.damage.fields.parts.element.fields source=outcomeData baseFields=fields.damage.fields }}{{/if}}
|
||||||
{{#if fields.macro}}{{> 'systems/daggerheart/templates/actionTypes/macro.hbs' fields=fields.macro source=source.macro}}{{/if}}
|
{{#if fields.macro}}{{> 'systems/daggerheart/templates/actionTypes/macro.hbs' fields=fields.macro source=source.macro}}{{/if}}
|
||||||
{{#if fields.effects}}{{> 'systems/daggerheart/templates/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
|
{{#if fields.effects}}{{> 'systems/daggerheart/templates/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
|
||||||
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/actionTypes/beastform.hbs' fields=fields.beastform.fields source=source.beastform}}{{/if}}
|
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/actionTypes/beastform.hbs' fields=fields.beastform.fields source=source.beastform}}{{/if}}
|
||||||
|
|
|
||||||
8
templates/sheets-settings/action-settings/range.hbs
Normal file
8
templates/sheets-settings/action-settings/range.hbs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<section
|
||||||
|
class="tab {{this.tabs.range.cssClass}}"
|
||||||
|
data-group="primary"
|
||||||
|
data-tab="range"
|
||||||
|
>
|
||||||
|
{{> 'systems/daggerheart/templates/actionTypes/range-target.hbs' fields=(object range=fields.range target=fields.target.fields) source=(object target=source.target range=source.range)}}
|
||||||
|
{{> 'systems/daggerheart/templates/actionTypes/areas.hbs' fields=fields.areas.element.fields source=source.areas}}
|
||||||
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue