Fix: boutons de parade

Utiliser la compétence associée à l'arme pour la parade
This commit is contained in:
Vincent Vandemeulebrouck 2021-12-08 23:22:37 +01:00
parent 427613c606
commit d87b1affd0
2 changed files with 11 additions and 7 deletions

View File

@ -631,7 +631,7 @@ export class RdDCombat {
switch (button) {
case '#particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value);
case '#parer-button': return this.parade(attackerRoll, armeParadeId, competence);
case '#parer-button': return this.parade(attackerRoll, armeParadeId);
case '#esquiver-button': return this.esquive(attackerRoll, compId, competence);
case '#encaisser-button': return this.encaisser(attackerRoll, defenderTokenId);
case '#echec-total-attaque': return this._onEchecTotal(attackerRoll);
@ -1016,10 +1016,15 @@ export class RdDCombat {
}
/* -------------------------------------------- */
async parade(attackerRoll, armeParadeId, competence) {
let arme = this.defender.getArmeParade(armeParadeId);
async parade(attackerRoll, armeParadeId) {
const arme = this.defender.getArmeParade(armeParadeId);
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
const competence = Misc.templateData(arme)?.competence;
if (competence == undefined)
{
console.error("Pas de compétence de parade associée à ", arme) ;
return;
}
let rollData = this._prepareParade(attackerRoll, arme, competence);
@ -1052,7 +1057,7 @@ export class RdDCombat {
competence: Misc.data(this.defender.getCompetence(competenceParade)),
arme: armeParade,
surprise: this.defender.getSurprise(true),
needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(armeAttaque, armeParade),
needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade),
needResist: RdDItemArme.needArmeResist(attackerRoll.arme, armeParade),
carac: Misc.templateData(this.defender).carac,
show: {}
@ -1185,7 +1190,6 @@ export class RdDCombat {
const dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor;
let arme = defenderRoll.arme;
let msg = "";
let resistance = Misc.toInt(arme.data.resistance);
if (arme.data.magique) {
defenderRoll.show.deteriorationArme = 'resiste'; // Par défaut

View File

@ -17,7 +17,7 @@
</div>
</span>
{{#if ajustements.facteurSign.used}}
<span>
<br><span>
Significative requise <span class="rdd-diviseur">&times;{{{ajustements.facteurSign.label}}}</span>!
</span>
{{/if}}