mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
create DHResourceData
This commit is contained in:
parent
31647d71ee
commit
82a7a99b65
7 changed files with 45 additions and 20 deletions
|
|
@ -35,6 +35,9 @@
|
||||||
"Settings": {
|
"Settings": {
|
||||||
"resultBased": {
|
"resultBased": {
|
||||||
"label": "Formula based on Hope/Fear result."
|
"label": "Formula based on Hope/Fear result."
|
||||||
|
},
|
||||||
|
"applyTo": {
|
||||||
|
"label": "Targeted Resource"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TYPES": {
|
"TYPES": {
|
||||||
|
|
@ -647,6 +650,10 @@
|
||||||
"armorStack": {
|
"armorStack": {
|
||||||
"name": "Armor Stack",
|
"name": "Armor Stack",
|
||||||
"abbreviation": "AS"
|
"abbreviation": "AS"
|
||||||
|
},
|
||||||
|
"fear": {
|
||||||
|
"name": "Fear",
|
||||||
|
"abbreviation": "FR"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ItemResourceType": {
|
"ItemResourceType": {
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,11 @@ export const healingTypes = {
|
||||||
id: 'armorStack',
|
id: 'armorStack',
|
||||||
label: 'DAGGERHEART.CONFIG.HealingType.armorStack.name',
|
label: 'DAGGERHEART.CONFIG.HealingType.armorStack.name',
|
||||||
abbreviation: 'DAGGERHEART.CONFIG.HealingType.armorStack.abbreviation'
|
abbreviation: 'DAGGERHEART.CONFIG.HealingType.armorStack.abbreviation'
|
||||||
|
},
|
||||||
|
fear: {
|
||||||
|
id: 'fear',
|
||||||
|
label: 'DAGGERHEART.CONFIG.HealingType.fear.name',
|
||||||
|
abbreviation: 'DAGGERHEART.CONFIG.HealingType.fear.abbreviation'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,32 @@ export class DHDamageField extends fields.SchemaField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DHDamageData extends foundry.abstract.DataModel {
|
export class DHResourceData extends foundry.abstract.DataModel {
|
||||||
/** @override */
|
/** @override */
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
return {
|
return {
|
||||||
|
applyTo: new fields.StringField({
|
||||||
|
choices: CONFIG.DH.GENERAL.healingTypes,
|
||||||
|
required: true,
|
||||||
|
blank: false,
|
||||||
|
initial: CONFIG.DH.GENERAL.healingTypes.hitPoints.id,
|
||||||
|
label: 'DAGGERHEART.ACTIONS.Settings.applyTo.label'
|
||||||
|
}),
|
||||||
|
resultBased: new fields.BooleanField({
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.ACTIONS.Settings.resultBased.label'
|
||||||
|
}),
|
||||||
|
value: new fields.EmbeddedDataField(DHActionDiceData),
|
||||||
|
valueAlt: new fields.EmbeddedDataField(DHActionDiceData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DHDamageData extends DHResourceData {
|
||||||
|
/** @override */
|
||||||
|
static defineSchema() {
|
||||||
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
base: new fields.BooleanField({ initial: false, readonly: true, label: 'Base' }),
|
||||||
type: new fields.SetField(
|
type: new fields.SetField(
|
||||||
new fields.StringField({
|
new fields.StringField({
|
||||||
|
|
@ -109,13 +131,7 @@ export class DHDamageData extends foundry.abstract.DataModel {
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
initial: 'physical'
|
initial: 'physical'
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
resultBased: new fields.BooleanField({
|
}
|
||||||
initial: false,
|
|
||||||
label: 'DAGGERHEART.ACTIONS.Settings.resultBased.label'
|
|
||||||
}),
|
|
||||||
value: new fields.EmbeddedDataField(DHActionDiceData),
|
|
||||||
valueAlt: new fields.EmbeddedDataField(DHActionDiceData)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { DHActionDiceData, DHActionRollData, DHDamageData, DHDamageField } from './actionDice.mjs';
|
import { DHActionDiceData, DHActionRollData, DHDamageData, DHDamageField, DHResourceData } from './actionDice.mjs';
|
||||||
import DhpActor from '../../documents/actor.mjs';
|
import DhpActor from '../../documents/actor.mjs';
|
||||||
import D20RollDialog from '../../applications/dialogs/d20RollDialog.mjs';
|
import D20RollDialog from '../../applications/dialogs/d20RollDialog.mjs';
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
|
|
||||||
static defineExtraSchema() {
|
static defineExtraSchema() {
|
||||||
const extraFields = {
|
const extraFields = {
|
||||||
damage: new DHDamageField({isDamage: true}),
|
damage: new DHDamageField(),
|
||||||
roll: new fields.EmbeddedDataField(DHActionRollData),
|
roll: new fields.EmbeddedDataField(DHActionRollData),
|
||||||
save: new fields.SchemaField({
|
save: new fields.SchemaField({
|
||||||
trait: new fields.StringField({
|
trait: new fields.StringField({
|
||||||
|
|
@ -96,7 +96,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
onSave: new fields.BooleanField({ initial: false })
|
onSave: new fields.BooleanField({ initial: false })
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
healing: new fields.EmbeddedDataField(DHDamageData),
|
healing: new fields.EmbeddedDataField(DHResourceData),
|
||||||
beastform: new fields.SchemaField({
|
beastform: new fields.SchemaField({
|
||||||
tierAccess: new fields.SchemaField({
|
tierAccess: new fields.SchemaField({
|
||||||
exact: new fields.NumberField({ integer: true, nullable: true, initial: null })
|
exact: new fields.NumberField({ integer: true, nullable: true, initial: null })
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@ export default class DHDamageAction extends DHBaseAction {
|
||||||
damageTypes = !damageTypes.length ? ['physical'] : damageTypes;
|
damageTypes = !damageTypes.length ? ['physical'] : damageTypes;
|
||||||
|
|
||||||
if (!formula || formula == '') return;
|
if (!formula || formula == '') return;
|
||||||
let roll = { formula: formula, total: formula },
|
let roll = { formula: formula, total: formula };
|
||||||
bonusDamage = [];
|
|
||||||
|
|
||||||
if (isNaN(formula)) formula = Roll.replaceFormulaData(formula, this.getRollData(systemData));
|
if (isNaN(formula)) formula = Roll.replaceFormulaData(formula, this.getRollData(systemData));
|
||||||
|
|
||||||
|
|
@ -43,8 +42,4 @@ export default class DHDamageAction extends DHBaseAction {
|
||||||
|
|
||||||
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
|
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get modifiers() {
|
|
||||||
// return [];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
height: 34px;
|
height: 34px;
|
||||||
.tags {
|
.tags {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
margin: 5px;
|
margin: 4px;
|
||||||
height: inherit;
|
height: inherit;
|
||||||
.tag {
|
.tag {
|
||||||
padding: 0.3rem 0.5rem;
|
padding: 0.3rem 0.5rem;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
{{formField ../fields.value.fields.bonus value=dmg.value.bonus name=(concat ../path "damage.parts." index ".value.bonus") localize=true classes="inline-child"}}
|
{{formField ../fields.value.fields.bonus value=dmg.value.bonus name=(concat ../path "damage.parts." index ".value.bonus") localize=true classes="inline-child"}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{formField ../fields.applyTo value=dmg.applyTo name=(concat ../path "damage.parts." realIndex ".applyTo") localize=true}}
|
||||||
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." index ".type") localize=true}}
|
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." index ".type") localize=true}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#with (@root.getRealIndex index) as | realIndex |}}
|
{{#with (@root.getRealIndex index) as | realIndex |}}
|
||||||
|
|
@ -46,7 +47,8 @@
|
||||||
{{> formula fields=../../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" realIndex=realIndex}}
|
{{> formula fields=../../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" realIndex=realIndex}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{formField ../../fields.type value=dmg.type name=(concat "damage.parts." realIndex ".type") localize=true}}
|
{{formField ../../fields.applyTo value=dmg.applyTo name=(concat "damage.parts." realIndex ".applyTo") localize=true}}
|
||||||
|
{{formField ../../fields.type value=dmg.type name=(concat "damage.parts." realIndex ".type") localize=true}}
|
||||||
<input type="hidden" name="damage.parts.{{realIndex}}.base" value="{{dmg.base}}">
|
<input type="hidden" name="damage.parts.{{realIndex}}.base" value="{{dmg.base}}">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{#unless dmg.base}}<div class="fas fa-trash" data-action="removeDamage" data-index="{{realIndex}}"></div>{{/unless}}
|
{{#unless dmg.base}}<div class="fas fa-trash" data-action="removeDamage" data-index="{{realIndex}}"></div>{{/unless}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue