mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Armor breached. Order 66
This commit is contained in:
parent
5e8c462477
commit
557033a2c3
1 changed files with 34 additions and 6 deletions
|
|
@ -609,7 +609,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
}
|
||||
|
||||
const armor = this.armor;
|
||||
this.armorScore = armor ? armor.system.baseScore : 0;
|
||||
this.armorScore = armor ? armor.system.armor.max : 0;
|
||||
this.damageThresholds = {
|
||||
major: armor
|
||||
? armor.system.baseThresholds.major + this.levelData.level.current
|
||||
|
|
@ -621,6 +621,38 @@ export default class DhCharacter extends BaseDataActor {
|
|||
this.resources.hope.max -= Object.keys(this.scars).length;
|
||||
this.resources.hitPoints.max += this.class.value?.system?.hitPoints ?? 0;
|
||||
}
|
||||
//Armor Resource Getter
|
||||
prepareArmorResources() {
|
||||
let totalValue=0;
|
||||
let totalMax=0;
|
||||
|
||||
for(const item of this.parent.items){
|
||||
const itemArmor = item.system.armor; //To check if follows schema
|
||||
if(!itemArmor) continue;
|
||||
let isValid=false; //Flag to see if valid
|
||||
if(item.type === 'armor'){ //Armor Type
|
||||
if(item.system.equipped) isValid = true;
|
||||
}
|
||||
else if (itemArmor.armorResourceToggle){
|
||||
if(item.type === 'weapon'){ //Weapon Type
|
||||
if(item.system.equipped) isValid = true;
|
||||
}
|
||||
else{
|
||||
isValid=true; //Other items like Loot,Consumables(will need to tweak consumable to activate after consume)
|
||||
}
|
||||
}
|
||||
|
||||
if(isValid){
|
||||
totalMax += (itemArmor.max);
|
||||
totalValue += (itemArmor.value);
|
||||
}
|
||||
}
|
||||
return {
|
||||
value: totalValue,
|
||||
max: totalMax,
|
||||
isReversed: true
|
||||
}
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
let baseHope = this.resources.hope.value;
|
||||
|
|
@ -640,11 +672,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
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.resources.armor = {
|
||||
value: this.armor?.system?.marks?.value ?? 0,
|
||||
max: this.armorScore,
|
||||
isReversed: true
|
||||
};
|
||||
this.resources.armor = this.prepareArmorResources();
|
||||
|
||||
this.attack.damage.parts[0].value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue