RC-106 | Add equipped armour display

This commit is contained in:
Oliver-Akins 2025-01-17 19:24:53 -07:00
parent 07f3b24897
commit d1ce144114
5 changed files with 67 additions and 0 deletions

View file

@ -147,4 +147,37 @@ export class HeroData extends foundry.abstract.TypeDataModel {
run: (this.ability.gait + 3) * 2,
};
};
// #region Getters
get equippedArmour() {
const armours = this.parent.itemTypes.armour;
const slots = Object.fromEntries(
gameTerms.Anatomy.map(v => [v, null]),
);
for (const armour of armours) {
if (!armour.system.equipped) { continue };
for (const locationTag of [...armour.system.location.values()]) {
const location = locationTag.toLowerCase();
slots[location] = armour;
};
};
return slots;
};
get equippedShield() {
return null;
};
get defense() {
const defenses = {};
const armour = this.equippedArmour;
for (const slot in armour) {
defenses[slot] = armour[slot]?.system.protection ?? 0;
};
// TODO: add shield defenses
return defenses;
};
// #endregion
};