mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
progress
This commit is contained in:
parent
49163eef54
commit
7036a53c71
7 changed files with 45 additions and 21 deletions
|
|
@ -2,6 +2,7 @@ const { HandlebarsApplicationMixin, DocumentSheetV2 } = foundry.applications.api
|
|||
|
||||
export default class ArmorActiveEffectConfig extends HandlebarsApplicationMixin(DocumentSheetV2) {
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'sheet', 'dh-style', 'active-effect-config', 'armor-effect-config'],
|
||||
form: {
|
||||
handler: this.updateForm,
|
||||
|
|
@ -9,7 +10,8 @@ export default class ArmorActiveEffectConfig extends HandlebarsApplicationMixin(
|
|||
closeOnSubmit: false
|
||||
},
|
||||
actions: {
|
||||
addEffect: ArmorActiveEffectConfig.#addEffect
|
||||
addEffect: ArmorActiveEffectConfig.#addEffect,
|
||||
finish: ArmorActiveEffectConfig.#finish
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -18,7 +20,7 @@ export default class ArmorActiveEffectConfig extends HandlebarsApplicationMixin(
|
|||
tabs: { template: 'templates/generic/tab-navigation.hbs' },
|
||||
details: { template: 'systems/daggerheart/templates/sheets/activeEffect/armor/details.hbs' },
|
||||
settings: { template: 'systems/daggerheart/templates/sheets/activeEffect/armor/settings.hbs' },
|
||||
footer: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-form-footer.hbs' }
|
||||
footer: { template: 'systems/daggerheart/templates/sheets/activeEffect/armor/footer.hbs' }
|
||||
};
|
||||
|
||||
static TABS = {
|
||||
|
|
@ -47,7 +49,7 @@ export default class ArmorActiveEffectConfig extends HandlebarsApplicationMixin(
|
|||
return partContext;
|
||||
}
|
||||
|
||||
async updateForm(_event, _form, formData) {
|
||||
static async updateForm(_event, _form, formData) {
|
||||
await this.document.update(formData.object);
|
||||
this.render();
|
||||
}
|
||||
|
|
@ -56,4 +58,8 @@ export default class ArmorActiveEffectConfig extends HandlebarsApplicationMixin(
|
|||
this.document.update({ 'system.changes': [...this.document.system.changes, {}] });
|
||||
this.render();
|
||||
}
|
||||
|
||||
static #finish() {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ export default class ArmorEffect extends foundry.data.ActiveEffectTypeDataModel
|
|||
|
||||
prepareBaseData() {
|
||||
for (const change of this.changes) {
|
||||
change.key = 'system.armorTest';
|
||||
change.value = Math.max(change.max - change.marked, change.max);
|
||||
change.key = 'system.armorScore.value';
|
||||
change.value = Math.min(change.max - change.marked, change.max);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,20 @@ export default class DhCharacter extends BaseDataActor {
|
|||
label: 'DAGGERHEART.GENERAL.proficiency'
|
||||
}),
|
||||
evasion: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.evasion' }),
|
||||
armorScore: new fields.NumberField({ integer: true, initial: 0, label: 'DAGGERHEART.GENERAL.armorScore' }),
|
||||
armorScore: new fields.SchemaField({
|
||||
value: new fields.NumberField({
|
||||
integer: true,
|
||||
initial: 0,
|
||||
min: 0,
|
||||
label: 'DAGGERHEART.GENERAL.armorScore'
|
||||
}),
|
||||
max: new fields.NumberField({
|
||||
integer: true,
|
||||
initial: 0,
|
||||
min: 0,
|
||||
label: 'DAGGERHEART.GENERAL.armorScore'
|
||||
})
|
||||
}),
|
||||
damageThresholds: new fields.SchemaField({
|
||||
severe: new fields.NumberField({
|
||||
integer: true,
|
||||
|
|
@ -665,14 +678,12 @@ export default class DhCharacter extends BaseDataActor {
|
|||
}
|
||||
}
|
||||
|
||||
const armor = this.armor;
|
||||
this.armorScore = armor ? armor.system.baseScore : 0;
|
||||
this.damageThresholds = {
|
||||
major: armor
|
||||
? armor.system.baseThresholds.major + this.levelData.level.current
|
||||
major: this.armor
|
||||
? this.armor.system.baseThresholds.major + this.levelData.level.current
|
||||
: this.levelData.level.current,
|
||||
severe: armor
|
||||
? armor.system.baseThresholds.severe + this.levelData.level.current
|
||||
severe: this.armor
|
||||
? this.armor.system.baseThresholds.severe + this.levelData.level.current
|
||||
: this.levelData.level.current * 2
|
||||
};
|
||||
|
||||
|
|
@ -705,8 +716,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||
|
||||
this.resources.armor = {
|
||||
value: this.armor?.system?.marks?.value ?? 0,
|
||||
max: this.armorScore,
|
||||
...this.armorScore,
|
||||
isReversed: true
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -139,6 +139,11 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
/* Methods */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
static applyChange(actor, change, options) {
|
||||
super.applyChange(actor, change, options);
|
||||
}
|
||||
|
||||
/**@inheritdoc*/
|
||||
static applyChangeField(model, change, field) {
|
||||
if (this.system?.applyChangeField)
|
||||
|
|
|
|||
3
templates/sheets/activeEffect/armor/footer.hbs
Normal file
3
templates/sheets/activeEffect/armor/footer.hbs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<section class='tab-form-footer padded'>
|
||||
<button type="button" data-action="finish"><i class="fa-solid fa-floppy-disk"></i> {{localize "Save"}}</button>
|
||||
</section>
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
<div class="armor-effects-container">
|
||||
{{#each source.system.changes as |change index|}}
|
||||
<div class="armor-effect-container">
|
||||
{{formGroup @root.systemFields.changes.element.fields.marked value=change.marked localize=true}}
|
||||
{{formGroup @root.systemFields.changes.element.fields.max value=change.max localize=true}}
|
||||
{{formGroup @root.systemFields.changes.element.fields.marked name=(concat 'system.changes.' index '.marked') value=change.marked localize=true}}
|
||||
{{formGroup @root.systemFields.changes.element.fields.max name=(concat 'system.changes.' index '.max') value=change.max localize=true}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{{#if document.system.armor.system.marks}}
|
||||
{{#if document.system.armorScore.max}}
|
||||
<div class="status-bar armor-slots">
|
||||
{{#if useResourcePips}}
|
||||
<div class='slot-value'>
|
||||
|
|
@ -52,14 +52,14 @@
|
|||
</div>
|
||||
{{else}}
|
||||
<div class='status-value'>
|
||||
<input class="bar-input armor-marks-input" value="{{document.system.armor.system.marks.value}}" type="number">
|
||||
<input class="bar-input armor-marks-input" value="{{document.system.armorScore.value}}" type="number">
|
||||
<span>/</span>
|
||||
<span class="bar-label">{{document.system.armorScore}}</span>
|
||||
<span class="bar-label">{{document.system.armorScore.max}}</span>
|
||||
</div>
|
||||
<progress
|
||||
class='progress-bar stress-color'
|
||||
value='{{document.system.armor.system.marks.value}}'
|
||||
max='{{document.system.armorScore}}'
|
||||
value='{{document.system.armorScore.value}}'
|
||||
max='{{document.system.armorScore.max}}'
|
||||
></progress>
|
||||
<div class="status-label">
|
||||
<h4>{{localize "DAGGERHEART.GENERAL.armorSlots"}}</h4>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue