Gestion particulières et Echecs totaux

This commit is contained in:
Vincent Vandemeulebrouck
2021-01-07 01:54:38 +01:00
parent afa4b25acb
commit cff1818a37
8 changed files with 205 additions and 131 deletions

View File

@ -1758,7 +1758,7 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
async rollAppelChance( onSuccess = () => {}, onEchec= ()=>{})
async rollAppelChance(onSuccess = () => {}, onEchec = () => {})
{
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' };
const dialog = await RdDRoll.create(this, rollData,
@ -1768,21 +1768,23 @@ export class RdDActor extends Actor {
label: 'Appel à la chance',
callbacks: [
this.createCallbackExperience(),
{ action: r => this._appelChanceResult(r) },
{ condition: r=> r.rolled.isSuccess, action: r => onSuccess() },
{ condition: r=> r.rolled.isEchec, action: r => onEchec() }
{ action: r => this._appelChanceResult(r, onSuccess, onEchec) },
]
}
);
dialog.render(true);
}
/* -------------------------------------------- */
async _appelChanceResult(rollData) {
if (rollData.rolled.isSuccess) {
await this.chanceActuelleIncDec(-1)
);
dialog.render(true);
}
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
/* -------------------------------------------- */
async _appelChanceResult(rollData, onSuccess = () => {}, onEchec= ()=>{}) {
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
if (rollData.rolled.isSuccess) {
await this.chanceActuelleIncDec(-1)
onSuccess();
}
else {
onEchec();
}
}
/* -------------------------------------------- */