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,7 +202,9 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
defenseDestinee(defenderRoll) { defenseDestinee(attackerRoll) {
let defenderRoll = this._getDefense(attackerRoll.passeArme);
if (defenderRoll) {
ui.notifications.info('Défense significative grâce à la destinée') ui.notifications.info('Défense significative grâce à la destinée')
RdDResolutionTable.forceSignificative(defenderRoll.rolled); RdDResolutionTable.forceSignificative(defenderRoll.rolled);
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme); this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
@ -214,6 +215,10 @@ export class RdDCombat {
this._onEsquiveNormale(defenderRoll); this._onEsquiveNormale(defenderRoll);
} }
} }
else {
ui.notifications.warn("Appel à la destinée impossible, la passe d'armes est déjà terminée!")
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
afficherOptionsDefense(attackerRoll, essais) { afficherOptionsDefense(attackerRoll, essais) {

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,7 +19,6 @@
</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}}'
@ -29,6 +27,7 @@
<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 }}'>