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