forked from public/foundryvtt-reve-de-dragon
Fin de gestion encaissement/recul V2
This commit is contained in:
@@ -506,7 +506,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
'system.sante.fatigue.value': 0,
|
||||
'system.compteurs.ethylisme': { value: 1, nb_doses: 0, jet_moral: false }
|
||||
})
|
||||
await this.removeEffects(e => e.id != STATUSES.StatusDemiReve);
|
||||
await this.removeEffects(e => !e.statuses?.has(STATUSES.StatusDemiReve));
|
||||
await this.supprimerBlessures(it => true);
|
||||
await ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
@@ -2513,29 +2513,27 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeArmure(attackerRoll) {
|
||||
let dmg = (attackerRoll.dmg.dmgArme ?? 0) + (attackerRoll.dmg.dmgActor ?? 0);
|
||||
let armeData = attackerRoll.arme;
|
||||
async computeArmure(dmg) {
|
||||
let baseDmg = (dmg.dmgArme ?? 0) + (dmg.dmgActor ?? 0);
|
||||
let protection = 0;
|
||||
const armures = this.items.filter(it => it.type == "armure" && it.system.equipe);
|
||||
for (const armure of armures) {
|
||||
protection += await RdDDice.rollTotal(armure.system.protection.toString());
|
||||
if (dmg > 0 && attackerRoll.dmg.encaisserSpecial != "noarmure") {
|
||||
await armure.deteriorerArmure(dmg)
|
||||
dmg = 0;
|
||||
if (dmg.encaisserSpecial != "noarmure") {
|
||||
const armures = this.items.filter(it => it.type == "armure" && it.system.equipe)
|
||||
|
||||
for (const armure of armures) {
|
||||
protection += await RdDDice.rollTotal(armure.system.protection.toString());
|
||||
if (baseDmg > 0 && dmg.encaisserSpecial != "noarmure") {
|
||||
await armure.deteriorerArmure(baseDmg)
|
||||
baseDmg = 0;
|
||||
}
|
||||
}
|
||||
protection -= Math.min(dmg.penetration, protection)
|
||||
protection += this.getProtectionNaturelle();
|
||||
// Gestion des cas particuliers sur la fenêtre d'encaissement
|
||||
if (dmg.encaisserSpecial == "chute") {
|
||||
protection = Math.min(protection, 2);
|
||||
}
|
||||
}
|
||||
const penetration = Misc.toInt(armeData?.system.penetration ?? 0);
|
||||
protection = Math.max(protection - penetration, 0);
|
||||
protection += this.getProtectionNaturelle();
|
||||
// Gestion des cas particuliers sur la fenêtre d'encaissement
|
||||
if (attackerRoll.dmg.encaisserSpecial == "noarmure") {
|
||||
protection = 0;
|
||||
}
|
||||
if (attackerRoll.dmg.encaisserSpecial == "chute") {
|
||||
protection = Math.min(protection, 2);
|
||||
}
|
||||
console.log("Final protect", protection, attackerRoll);
|
||||
console.log("Final protect", protection, dmg)
|
||||
return protection;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user