mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +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": {
|
||||
"resultBased": {
|
||||
"label": "Formula based on Hope/Fear result."
|
||||
},
|
||||
"applyTo": {
|
||||
"label": "Targeted Resource"
|
||||
}
|
||||
},
|
||||
"TYPES": {
|
||||
|
|
@ -647,6 +650,10 @@
|
|||
"armorStack": {
|
||||
"name": "Armor Stack",
|
||||
"abbreviation": "AS"
|
||||
},
|
||||
"fear": {
|
||||
"name": "Fear",
|
||||
"abbreviation": "FR"
|
||||
}
|
||||
},
|
||||
"ItemResourceType": {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ export const healingTypes = {
|
|||
id: 'armorStack',
|
||||
label: 'DAGGERHEART.CONFIG.HealingType.armorStack.name',
|
||||
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 */
|
||||
static defineSchema() {
|
||||
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' }),
|
||||
type: new fields.SetField(
|
||||
new fields.StringField({
|
||||
|
|
@ -109,13 +131,7 @@ export class DHDamageData extends foundry.abstract.DataModel {
|
|||
label: 'Type',
|
||||
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 D20RollDialog from '../../applications/dialogs/d20RollDialog.mjs';
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
|||
|
||||
static defineExtraSchema() {
|
||||
const extraFields = {
|
||||
damage: new DHDamageField({isDamage: true}),
|
||||
damage: new DHDamageField(),
|
||||
roll: new fields.EmbeddedDataField(DHActionRollData),
|
||||
save: new fields.SchemaField({
|
||||
trait: new fields.StringField({
|
||||
|
|
@ -96,7 +96,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
|||
onSave: new fields.BooleanField({ initial: false })
|
||||
})
|
||||
),
|
||||
healing: new fields.EmbeddedDataField(DHDamageData),
|
||||
healing: new fields.EmbeddedDataField(DHResourceData),
|
||||
beastform: new fields.SchemaField({
|
||||
tierAccess: new fields.SchemaField({
|
||||
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;
|
||||
|
||||
if (!formula || formula == '') return;
|
||||
let roll = { formula: formula, total: formula },
|
||||
bonusDamage = [];
|
||||
let roll = { formula: formula, total: formula };
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// get modifiers() {
|
||||
// return [];
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
height: 34px;
|
||||
.tags {
|
||||
justify-content: flex-start;
|
||||
margin: 5px;
|
||||
margin: 4px;
|
||||
height: inherit;
|
||||
.tag {
|
||||
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"}}
|
||||
</div>
|
||||
{{/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}}
|
||||
{{else}}
|
||||
{{#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}}
|
||||
</fieldset>
|
||||
{{/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}}">
|
||||
</fieldset>
|
||||
{{#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