Récupération de chance à chateau dormant
This commit is contained in:
parent
f410615dd4
commit
74b58643c7
@ -207,6 +207,10 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getChance() {
|
||||
return Misc.toInt(this.data.data.carac.chance?.value ?? 10);
|
||||
}
|
||||
getMoralTotal() {
|
||||
return Misc.toInt(this.data.data.compteurs.moral?.value);
|
||||
}
|
||||
@ -315,6 +319,7 @@ export class RdDActor extends Actor {
|
||||
await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste);
|
||||
await this.update({ "data.blessures": blessures });
|
||||
await this._recupererVie(message);
|
||||
await this.chanceActuelleIncDec(1);
|
||||
await this.transformerStress(message);
|
||||
await this.retourSeuilDeReve(message);
|
||||
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
|
||||
@ -2156,7 +2161,7 @@ export class RdDActor extends Actor {
|
||||
async _appelChanceResult(rollData, onSuccess = () => { }, onEchec = () => { }) {
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
|
||||
if (rollData.rolled.isSuccess) {
|
||||
await this.chanceActuelleIncDec(-1)
|
||||
await this.chanceActuelleIncDec(-1);
|
||||
onSuccess();
|
||||
}
|
||||
else {
|
||||
@ -2165,9 +2170,12 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async chanceActuelleIncDec(value) {
|
||||
async chanceActuelleIncDec(value, limit=true) {
|
||||
let chance = duplicate(this.data.data.compteurs.chance);
|
||||
chance.value = Math.max(chance.value + value, 0);
|
||||
if (limit) {
|
||||
chance.value = Math.min(chance.value, this.getChance())
|
||||
}
|
||||
await this.update({ "data.compteurs.chance": chance });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user