forked from public/foundryvtt-reve-de-dragon
Gestion particulières et Echecs totaux
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user