réordonner les messages de défense

* jet de défense
* jet de recul
* détérioration d'arme
This commit is contained in:
Vincent Vandemeulebrouck 2020-12-17 01:08:14 +01:00
parent 95708222dc
commit fa225f3df9

View File

@ -141,10 +141,10 @@ export class RdDCombat {
label: 'Attaque: ' + (arme ? arme.name : competence.name), label: 'Attaque: ' + (arme ? arme.name : competence.name),
callbacks: [ callbacks: [
this.attacker.createCallbackExperience(), this.attacker.createCallbackExperience(),
{ condition: RdDCombat.isParticuliere, action: r => this._onAttaqueParticuliere(r) },
{ condition: r => (RdDCombat.isReussite(r) && !RdDCombat.isParticuliere(r)), action: r => this._onAttaqueNormale(r) }, { condition: r => (RdDCombat.isReussite(r) && !RdDCombat.isParticuliere(r)), action: r => this._onAttaqueNormale(r) },
{ condition: RdDCombat.isParticuliere, action: r => this._onAttaqueParticuliere(r) },
{ condition: RdDCombat.isEchec, action: r => this._onAttaqueEchec(r) },
{ condition: RdDCombat.isEchecTotal, action: r => this._onAttaqueEchecTotal(r) }, { condition: RdDCombat.isEchecTotal, action: r => this._onAttaqueEchecTotal(r) },
{ condition: RdDCombat.isEchec, action: r => this._onAttaqueEchec(r) }
] ]
} ); } );
dialog.render(true); dialog.render(true);
@ -186,11 +186,6 @@ export class RdDCombat {
dommagesReels: competence.data.dommages dommagesReels: competence.data.dommages
} }
}; };
// rollData.dmg = {
// dmgArme: competence.data.dommages,
// total: competence.data.dommages
// };
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -217,13 +212,6 @@ export class RdDCombat {
let explications = ""; let explications = "";
// Message spécial pour la rapidité, qui reste difficile à gérer automatiquement
if (rollData.particuliereAttaque == 'rapidite') {
ChatMessage.create({
content: "Vous avez attaqué en Rapidité. Vous pourrez faire une deuxième attaque, ou utiliser votre arme pour vous défendre.",
whisper: ChatMessage.getWhisperRecipients(this.attacker.name)
});
}
rollData.dmg = RdDBonus.dmg(rollData, this.attacker.getBonusDegat(), this.defender.isEntiteCauchemar()); rollData.dmg = RdDBonus.dmg(rollData, this.attacker.getBonusDegat(), this.defender.isEntiteCauchemar());
if (this.target) { if (this.target) {
@ -234,6 +222,11 @@ export class RdDCombat {
// Save rollData for defender // Save rollData for defender
game.system.rdd.rollDataHandler[this.attackerId] = duplicate(rollData); game.system.rdd.rollDataHandler[this.attackerId] = duplicate(rollData);
// Message spécial pour la rapidité, qui reste difficile à gérer automatiquement
if (rollData.particuliereAttaque == 'rapidite') {
explications += "<br>Vous avez attaqué en Rapidité. Vous pourrez faire une deuxième attaque, ou utiliser votre arme pour vous défendre.";
}
// Final chat message // Final chat message
let chatOptions = { let chatOptions = {
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong>" content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong>"
@ -242,6 +235,7 @@ export class RdDCombat {
+ explications + explications
} }
ChatUtility.chatWithRollMode(chatOptions, this.attacker.name) ChatUtility.chatWithRollMode(chatOptions, this.attacker.name)
if (this.target) { if (this.target) {
this._messageDefenseur(rollData); this._messageDefenseur(rollData);
} }
@ -359,10 +353,10 @@ export class RdDCombat {
label: 'Parade: ' + (arme ? arme.name : rollData.competence.name), label: 'Parade: ' + (arme ? arme.name : rollData.competence.name),
callbacks: [ callbacks: [
this.defender.createCallbackExperience(), this.defender.createCallbackExperience(),
{ condition: RdDCombat.isParticuliere, action: r => this._onParadeParticuliere(r) },
{ condition: RdDCombat.isReussite, action: r => this._onParadeNormale(r) }, { condition: RdDCombat.isReussite, action: r => this._onParadeNormale(r) },
{ condition: RdDCombat.isParticuliere, action: r => this._onParadeParticuliere(r) },
{ condition: RdDCombat.isEchec, action: r => this._onParadeEchec(r) },
{ condition: RdDCombat.isEchecTotal, action: r => this._onParadeEchecTotal(r) }, { condition: RdDCombat.isEchecTotal, action: r => this._onParadeEchecTotal(r) },
{ condition: RdDCombat.isEchec, action: r => this._onParadeEchec(r) }
] ]
} ); } );
dialog.render(true); dialog.render(true);
@ -435,8 +429,6 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onParadeNormale(rollData) { async _onParadeNormale(rollData) {
console.log("RdDCombat._onParadeNormale >>>", rollData); console.log("RdDCombat._onParadeNormale >>>", rollData);
await this.computeDeteriorationArme(rollData);
await this.computeRecul(rollData, false);
let chatOptions = { let chatOptions = {
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong>" content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong>"
@ -444,8 +436,9 @@ export class RdDCombat {
+ RdDResolutionTable.explain(rollData.rolled) + RdDResolutionTable.explain(rollData.rolled)
+ "<br><strong>Attaque parée!</strong>" + "<br><strong>Attaque parée!</strong>"
} }
ChatUtility.chatWithRollMode(chatOptions, this.defender.name) ChatUtility.chatWithRollMode(chatOptions, this.defender.name)
await this.computeRecul(rollData, false);
await this.computeDeteriorationArme(rollData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -498,10 +491,10 @@ export class RdDCombat {
label: 'Esquiver', label: 'Esquiver',
callbacks: [ callbacks: [
this.defender.createCallbackExperience(), this.defender.createCallbackExperience(),
{ condition: RdDCombat.isParticuliere, action: r => this._onEsquiveParticuliere(r) },
{ condition: RdDCombat.isReussite, action: r => this._onEsquiveNormale(r) }, { condition: RdDCombat.isReussite, action: r => this._onEsquiveNormale(r) },
{ condition: RdDCombat.isEchecTotal, action: r => this._onEsquiveEchecTotal(r) }, { condition: RdDCombat.isParticuliere, action: r => this._onEsquiveParticuliere(r) },
{ condition: RdDCombat.isEchec, action: r => this._onEsquiveEchec(r) }, { condition: RdDCombat.isEchec, action: r => this._onEsquiveEchec(r) },
{ condition: RdDCombat.isEchecTotal, action: r => this._onEsquiveEchecTotal(r) },
] ]
}); });
dialog.render(true); dialog.render(true);