#158 : Gestion de l'armure sur la fenêtre d'encaissement

This commit is contained in:
sladecraven 2021-02-17 14:52:50 +01:00
parent 1cdadbd9d6
commit 155990610a
3 changed files with 28 additions and 11 deletions

View File

@ -2581,14 +2581,21 @@ export class RdDActor extends Actor {
dmg = 0; dmg = 0;
} }
} }
// TODO: max armure sur chutes...
const penetration = arme ? Misc.toInt(arme.data.penetration) : 0; const penetration = arme ? Misc.toInt(arme.data.penetration) : 0;
protection = Math.max(protection - penetration, 0); protection = Math.max(protection - penetration, 0);
protection += this.getProtectionNaturelle(); protection += this.getProtectionNaturelle();
console.log("Final protect", protection); // Gestion des cas particuliers sur la fenêtre d'encaissement
if ( attackerRoll.dmg.encaisserSpecial && attackerRoll.dmg.encaisserSpecial == "noarmure") {
protection = 0;
}
if ( attackerRoll.dmg.encaisserSpecial && attackerRoll.dmg.encaisserSpecial == "chute" && Number(protection) > 2) {
protection = 2;
}
console.log("Final protect", protection, attackerRoll);
return protection; return protection;
} }
/* -------------------------------------------- */
_deteriorerArmure(item, dmg) { _deteriorerArmure(item, dmg) {
if (!ReglesOptionelles.isUsing('deteriorationArmure')) { if (!ReglesOptionelles.isUsing('deteriorationArmure')) {
return; return;

View File

@ -29,6 +29,7 @@ export class RdDEncaisser extends Dialog {
this.actor = actor; this.actor = actor;
this.modifier = 0; this.modifier = 0;
this.encaisserSpecial = "aucun";
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -36,6 +37,7 @@ export class RdDEncaisser extends Dialog {
this.actor.encaisserDommages({ this.actor.encaisserDommages({
dmg:{ dmg:{
total: Number(this.modifier), total: Number(this.modifier),
encaisserSpecial: this.encaisserSpecial,
loc: { result: 0, label: "Corps" }, loc: { result: 0, label: "Corps" },
mortalite: mortalite mortalite: mortalite
} }
@ -54,6 +56,9 @@ export class RdDEncaisser extends Dialog {
html.find('#modificateurDegats').change((event) => { html.find('#modificateurDegats').change((event) => {
this.modifier = event.currentTarget.value; // Update the selected bonus/malus this.modifier = event.currentTarget.value; // Update the selected bonus/malus
}); });
html.find('#encaisserSpecial').change((event) => {
this.encaisserSpecial = event.currentTarget.value; // Update the selected bonus/malus
});
} }
} }

View File

@ -1,16 +1,21 @@
<form class="encaisse-roll-dialog"> <form class="encaisse-roll-dialog">
<h2 class="encaisserdialog" id="encaisserTitle"></h2> <h2 class="encaisserdialog" id="encaisserTitle"></h2>
<div class="form-group"> <div class="form-group">
<label class="competence-label">Modificateurs aux Dommages:</label> <label class="competence-label">Modificateurs aux Dommages:</label>
<select class="competence-value" name="modificateurDegats" id="modificateurDegats" data-dtype="number"> <select class="competence-value" name="modificateurDegats" id="modificateurDegats" data-dtype="number">
{{#select modificateurDegats}} {{#select modificateurDegats}}
{{#each ajustementsEncaissement as |key|}} {{#each ajustementsEncaissement as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option> <option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}
</select> </select>
</div> </div>
<div class="form-group">
<label class="competence-label">Cas particuliers:</label>
<select class="competence-value" name="encaisserSpecial" id="encaisserSpecial" data-dtype="String">
<option value="aucun">Aucun</option>
<option value="noarmure">Ne pas compter les Armures</option>
<option value="chute">Chute : Limiter les armures à 2 PA</option>
</select>
</div>
</form> </form>
<script>
</script>