Implement most of shield functionality using the armour implementation as a backbone
This commit is contained in:
parent
27d924e336
commit
9d48794b83
9 changed files with 60 additions and 29 deletions
|
|
@ -165,7 +165,8 @@ export class HeroData extends foundry.abstract.TypeDataModel {
|
|||
};
|
||||
|
||||
get equippedShield() {
|
||||
return null;
|
||||
const shields = this.parent.itemTypes.shield;
|
||||
return shields.find(item => item.system.equipped);
|
||||
};
|
||||
|
||||
get defense() {
|
||||
|
|
@ -175,7 +176,13 @@ export class HeroData extends foundry.abstract.TypeDataModel {
|
|||
defenses[slot] = armour[slot]?.system.protection ?? 0;
|
||||
};
|
||||
|
||||
// TODO: add shield defenses
|
||||
const shield = this.equippedShield;
|
||||
if (shield) {
|
||||
for (const location of [...shield.system.location.values()]) {
|
||||
const slot = location.toLowerCase();
|
||||
defenses[slot] += shield.system.protection;
|
||||
};
|
||||
};
|
||||
|
||||
return defenses;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue