Destinée et Appel à la chance exclusifs

This commit is contained in:
Vincent Vandemeulebrouck 2021-01-08 22:55:00 +01:00
parent 02beb4ee37
commit c9cc1de16e
2 changed files with 20 additions and 16 deletions

View File

@ -136,7 +136,6 @@ export class RdDCombat {
} }
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId'].value; const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId'].value;
let defenderRoll = this._getDefense(attackerRoll.passeArme);
const armeParadeId = event.currentTarget.attributes['data-armeid']?.value; const armeParadeId = event.currentTarget.attributes['data-armeid']?.value;
switch (button) { switch (button) {
@ -150,13 +149,13 @@ export class RdDCombat {
() => this.attaqueChanceuse(attackerRoll), () => this.attaqueChanceuse(attackerRoll),
() => this._onEchecTotal(attackerRoll)); () => this._onEchecTotal(attackerRoll));
case '#appel-chance-defense': return this.defender.rollAppelChance( case '#appel-chance-defense': return this.defender.rollAppelChance(
() => this.defenseChanceuse(attackerRoll, defenderRoll), () => this.defenseChanceuse(attackerRoll),
() => this.afficherOptionsDefense(attackerRoll, { defenseChance: true })); () => this.afficherOptionsDefense(attackerRoll, { defenseChance: true }));
case '#appel-destinee-attaque': return this.attacker.appelDestinee( case '#appel-destinee-attaque': return this.attacker.appelDestinee(
() => this.attaqueSignificative(attackerRoll), () => this.attaqueSignificative(attackerRoll),
() => { }); () => { });
case '#appel-destinee-defense': return this.defender.appelDestinee( case '#appel-destinee-defense': return this.defender.appelDestinee(
() => this.defenseDestinee(defenderRoll), () => this.defenseDestinee(attackerRoll),
() => { }); () => { });
} }
} }
@ -194,7 +193,7 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
defenseChanceuse(attackerRoll, defenderRoll) { defenseChanceuse(attackerRoll) {
ui.notifications.info("La défense est rejouée grâce à la chance") ui.notifications.info("La défense est rejouée grâce à la chance")
attackerRoll.essais.defenseChance = true; attackerRoll.essais.defenseChance = true;
attackerRoll.essais.defense = false; attackerRoll.essais.defense = false;
@ -203,15 +202,21 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
defenseDestinee(defenderRoll) { defenseDestinee(attackerRoll) {
ui.notifications.info('Défense significative grâce à la destinée') let defenderRoll = this._getDefense(attackerRoll.passeArme);
RdDResolutionTable.forceSignificative(defenderRoll.rolled); if (defenderRoll) {
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme); ui.notifications.info('Défense significative grâce à la destinée')
if (defenderRoll.arme) { RdDResolutionTable.forceSignificative(defenderRoll.rolled);
this._onParadeNormale(defenderRoll); this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
if (defenderRoll.arme) {
this._onParadeNormale(defenderRoll);
}
else {
this._onEsquiveNormale(defenderRoll);
}
} }
else { else {
this._onEsquiveNormale(defenderRoll); ui.notifications.warn("Appel à la destinée impossible, la passe d'armes est déjà terminée!")
} }
} }

View File

@ -2,7 +2,7 @@
{{#if (eq surprise 'totale')}} {{#if (eq surprise 'totale')}}
<span><strong>{{defender.name}}</strong> est totalement surpris</span> <span><strong>{{defender.name}}</strong> est totalement surpris</span>
{{else if essais.defense}} {{else if essais.defense}}
<span><strong>{{defender.name}}</strong> doit</span> <span><strong>{{defender.name}}</strong> doit :</span>
{{else}} {{else}}
<span><strong>{{defender.name}}</strong> doit se défendre <span><strong>{{defender.name}}</strong> doit se défendre
{{#if (eq surprise 'demi')}} avec une significative {{/if}} : {{#if (eq surprise 'demi')}} avec une significative {{/if}} :
@ -12,7 +12,6 @@
<br> <br>
{{#unless (eq surprise 'totale')}} {{#unless (eq surprise 'totale')}}
{{#if essais.defense}} {{#if essais.defense}}
<br>
{{#unless essais.defenseChance}} {{#unless essais.defenseChance}}
{{#if (eq defender.data.type 'personnage')}} {{#if (eq defender.data.type 'personnage')}}
<a class='chat-card-button' id='appel-chance-defense' data-attackerId='{{attackerId}}' <a class='chat-card-button' id='appel-chance-defense' data-attackerId='{{attackerId}}'
@ -20,15 +19,15 @@
</a> </a>
<br> <br>
{{/if}} {{/if}}
{{/unless}} {{#if (eq defender.data.type 'personnage')}}
{{#if (eq defender.data.type 'personnage')}}
{{#if (gt defender.data.data.compteurs.destinee.value 0)}} {{#if (gt defender.data.data.compteurs.destinee.value 0)}}
<a class='chat-card-button' id='appel-destinee-defense' data-attackerId='{{attackerId}}' <a class='chat-card-button' id='appel-destinee-defense' data-attackerId='{{attackerId}}'
data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a> data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a>
</a> </a>
<br> <br>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/unless}}
{{else}} {{else}}
{{#each armes as |arme key|}} {{#each armes as |arme key|}}
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme._id }}'> <a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme._id }}'>