mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
feat(armorItem): add base thresholds to armor (#21)
Co-authored-by: JimCanE <6275508-jimcane@users.noreply.gitlab.com>
This commit is contained in:
parent
30a3b5fa55
commit
820c2df1f4
3 changed files with 55 additions and 36 deletions
|
|
@ -910,7 +910,12 @@
|
||||||
"Armor": {
|
"Armor": {
|
||||||
"BaseScore": "Base Score",
|
"BaseScore": "Base Score",
|
||||||
"Feature": "Feature",
|
"Feature": "Feature",
|
||||||
"Description": "Description"
|
"Description": "Description",
|
||||||
|
"BaseThresholds": {
|
||||||
|
"Base": "Base Thresholds",
|
||||||
|
"Major": "Major Threshold",
|
||||||
|
"Severe": "Severe Threshold"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Class": {
|
"Class": {
|
||||||
"Tabs": {
|
"Tabs": {
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,49 @@
|
||||||
export default class DhpArmor extends foundry.abstract.TypeDataModel {
|
export default class DhpArmor extends foundry.abstract.TypeDataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
baseScore: new fields.NumberField({ initial: 1, integer: true }),
|
baseScore: new fields.NumberField({ initial: 1, integer: true }),
|
||||||
feature: new fields.StringField({ choices: SYSTEM.ITEM.armorFeatures, integer: false, blank:true}),
|
feature: new fields.StringField({
|
||||||
marks: new fields.SchemaField({
|
choices: SYSTEM.ITEM.armorFeatures,
|
||||||
max: new fields.NumberField({ initial: 6, integer: true }),
|
integer: false,
|
||||||
value: new fields.NumberField({ initial: 0, integer: true }),
|
blank: true,
|
||||||
}),
|
}),
|
||||||
description: new fields.HTMLField({}),
|
marks: new fields.SchemaField({
|
||||||
}
|
max: new fields.NumberField({ initial: 6, integer: true }),
|
||||||
}
|
value: new fields.NumberField({ initial: 0, integer: true }),
|
||||||
|
}),
|
||||||
|
baseThresholds: new fields.SchemaField({
|
||||||
|
major: new fields.NumberField({ initial: 0, integer: true }),
|
||||||
|
severe: new fields.NumberField({ initial: 0, integer: true }),
|
||||||
|
}),
|
||||||
|
description: new fields.HTMLField({}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
get featureInfo() {
|
get featureInfo() {
|
||||||
return this.feature ? CONFIG.daggerheart.ITEM.armorFeatures[this.feature] : null;
|
return this.feature
|
||||||
}
|
? CONFIG.daggerheart.ITEM.armorFeatures[this.feature]
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
prepareDerivedData(){
|
prepareDerivedData() {
|
||||||
if(this.parent.parent){
|
if (this.parent.parent) {
|
||||||
this.applyLevels();
|
this.applyLevels();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Currently bugged as it double triggers. Should get fixed in an updated foundry version.
|
// Currently bugged as it double triggers. Should get fixed in an updated foundry version.
|
||||||
applyLevels(){
|
applyLevels() {
|
||||||
// let armorBonus = 0;
|
// let armorBonus = 0;
|
||||||
// for(var level in this.parent.parent.system.levelData.levelups){
|
// for(var level in this.parent.parent.system.levelData.levelups){
|
||||||
// var levelData = this.parent.parent.system.levelData.levelups[level];
|
// var levelData = this.parent.parent.system.levelData.levelups[level];
|
||||||
// for(var tier in levelData){
|
// for(var tier in levelData){
|
||||||
// var tierData = levelData[tier];
|
// var tierData = levelData[tier];
|
||||||
// if(tierData){
|
// if(tierData){
|
||||||
// armorBonus += Object.keys(tierData.armorOrEvasionSlot).filter(x => tierData.armorOrEvasionSlot[x] === 'armor').length;
|
// armorBonus += Object.keys(tierData.armorOrEvasionSlot).filter(x => tierData.armorOrEvasionSlot[x] === 'armor').length;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
// this.marks.max += armorBonus;
|
||||||
// this.marks.max += armorBonus;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@
|
||||||
<section class="sheet-body">
|
<section class="sheet-body">
|
||||||
{{formField systemFields.baseScore value=source.system.baseScore label=(localize "DAGGERHEART.Sheets.Armor.BaseScore") }}
|
{{formField systemFields.baseScore value=source.system.baseScore label=(localize "DAGGERHEART.Sheets.Armor.BaseScore") }}
|
||||||
{{formField systemFields.feature value=source.system.feature label=(localize "DAGGERHEART.Sheets.Armor.Feature") localize=true blank=""}}
|
{{formField systemFields.feature value=source.system.feature label=(localize "DAGGERHEART.Sheets.Armor.Feature") localize=true blank=""}}
|
||||||
|
<div class="armor-thresholds">
|
||||||
|
<h2>{{localize "DAGGERHEART.Sheets.Armor.BaseThresholds.Base"}}</h2>
|
||||||
|
{{ formField systemFields.baseThresholds.fields.major value=source.system.baseThresholds.major label=(localize "DAGGERHEART.Sheets.Armor.BaseThresholds.Major") }}/
|
||||||
|
{{ formField systemFields.baseThresholds.fields.severe value=source.system.baseThresholds.severe label=(localize "DAGGERHEART.Sheets.Armor.BaseThresholds.Severe") }}
|
||||||
|
</div>
|
||||||
<div class="feature-description">
|
<div class="feature-description">
|
||||||
<h2>{{localize "DAGGERHEART.Sheets.Armor.Description"}}</h2>
|
<h2>{{localize "DAGGERHEART.Sheets.Armor.Description"}}</h2>
|
||||||
{{formInput systemFields.description value=source.system.description enriched=source.system.description localize=true toggled=true}}
|
{{formInput systemFields.description value=source.system.description enriched=source.system.description localize=true toggled=true}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue