Idea sorted. Tweaking Needed.

This commit is contained in:
Nikhil Nagarajan 2025-12-11 15:12:45 -05:00
parent 557033a2c3
commit 8e588b3c47

View file

@ -608,27 +608,21 @@ export default class DhCharacter extends BaseDataActor {
} }
} }
const armor = this.armor;
this.armorScore = armor ? armor.system.armor.max : 0;
this.damageThresholds = {
major: armor
? armor.system.baseThresholds.major + this.levelData.level.current
: this.levelData.level.current,
severe: armor
? armor.system.baseThresholds.severe + this.levelData.level.current
: this.levelData.level.current * 2
};
this.resources.hope.max -= Object.keys(this.scars).length; this.resources.hope.max -= Object.keys(this.scars).length;
this.resources.hitPoints.max += this.class.value?.system?.hitPoints ?? 0; this.resources.hitPoints.max += this.class.value?.system?.hitPoints ?? 0;
} }
//Armor Resource Getter //Armor Resource Getter
prepareArmorResources() { _prepareArmorResources() {
let totalValue=0; let totalValue=0;
let totalMax=0; let totalMax=0;
for(const item of this.parent.items){ for(const item of this.parent.items){
const itemArmor = item.system.armor; //To check if follows schema const itemArmor = item.system.armor; //To check if follows schema
if(!itemArmor) continue; if(!itemArmor){
console.warn(`[FAIL] ${item.name} (${item.type}): No 'system.armor' data detected.`);
continue;
}
let isValid=false; //Flag to see if valid let isValid=false; //Flag to see if valid
if(item.type === 'armor'){ //Armor Type if(item.type === 'armor'){ //Armor Type
if(item.system.equipped) isValid = true; if(item.system.equipped) isValid = true;
@ -672,7 +666,18 @@ export default class DhCharacter extends BaseDataActor {
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max); this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait; this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
this.resources.armor = this.prepareArmorResources(); this.resources.armor = this._prepareArmorResources();
const armor = this.armor;
this.armorScore = this.resources.armor.max;
this.damageThresholds = {
major: armor
? armor.system.baseThresholds.major + this.levelData.level.current
: this.levelData.level.current,
severe: armor
? armor.system.baseThresholds.severe + this.levelData.level.current
: this.levelData.level.current * 2
};
this.attack.damage.parts[0].value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`; this.attack.damage.parts[0].value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
} }