Arme à distance
This commit is contained in:
@ -209,6 +209,7 @@ export class TeDeumActor extends Actor {
|
||||
for (let key in combatLoc) {
|
||||
combatLoc[key] = foundry.utils.mergeObject(combatLoc[key], game.system.tedeum.config.LOCALISATION[key])
|
||||
combatLoc[key].armures = []
|
||||
combatLoc[key].blessures = []
|
||||
combatLoc[key].protectionTotal = 0
|
||||
let armures = this.getArmures()
|
||||
for (let armure of armures) {
|
||||
@ -217,6 +218,12 @@ export class TeDeumActor extends Actor {
|
||||
combatLoc[key].protectionTotal += armure.system.protection
|
||||
}
|
||||
}
|
||||
let blessures = this.getBlessures()
|
||||
for (let blessure of blessures) {
|
||||
if (blessure.system.localisation == key) {
|
||||
combatLoc[key].blessures.push(blessure)
|
||||
}
|
||||
}
|
||||
let endurance = this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "endurance")
|
||||
combatLoc[key].endurance = endurance.system.score + game.system.tedeum.config.LOCALISATION[key].locMod
|
||||
combatLoc[key].touche = combatLoc[key].endurance + combatLoc[key].protectionTotal
|
||||
@ -272,24 +279,8 @@ export class TeDeumActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async equipItem(itemId) {
|
||||
let item = this.items.find(item => item.id == itemId)
|
||||
if (item?.system) {
|
||||
if (item.type == "armure") {
|
||||
let armor = this.items.find(item => item.id != itemId && item.type == "armor" && item.system.equipped)
|
||||
if (armor) {
|
||||
ui.notifications.warn("You already have an armor equipped!")
|
||||
return
|
||||
}
|
||||
}
|
||||
if (item.type == "shield") {
|
||||
let shield = this.items.find(item => item.id != itemId && item.type == "shield" && item.system.equipped)
|
||||
if (shield) {
|
||||
ui.notifications.warn("You already have a shield equipped!")
|
||||
return
|
||||
}
|
||||
}
|
||||
let update = { _id: item.id, "system.equipped": !item.system.equipped };
|
||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||
}
|
||||
let update = { _id: item.id, "system.equipe": !item.system.equipe };
|
||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||
}
|
||||
|
||||
/* ------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user