This commit was merged in pull request #820.
This commit is contained in:
+23
-11
@@ -1883,7 +1883,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
const rollData = {
|
||||
ids: { actorId: this.id },
|
||||
selected: { tache: { key: tache.id, forced: options.forced } },
|
||||
type: { allowed: [ROLL_TYPE_TACHE], current: ROLL_TYPE_TACHE}
|
||||
type: { allowed: [ROLL_TYPE_TACHE], current: ROLL_TYPE_TACHE }
|
||||
}
|
||||
return await RollDialog.create(rollData, options)
|
||||
}
|
||||
@@ -1912,22 +1912,34 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async _tacheResult(rollData, options) {
|
||||
// Mise à jour de la tache
|
||||
rollData.appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue");
|
||||
rollData.tache = foundry.utils.duplicate(rollData.tache);
|
||||
rollData.tache.system.points_de_tache_courant += rollData.rolled.ptTache;
|
||||
rollData.appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue")
|
||||
|
||||
const tacheCommuneId = rollData.tache.system.tacheCommuneId;
|
||||
const tache = tacheCommuneId
|
||||
? game.items.get(tacheCommuneId)
|
||||
: this.items.get(rollData.tache.id)
|
||||
|
||||
const tacheUpdates = {
|
||||
system: {
|
||||
points_de_tache_courant: tache.system.points_de_tache_courant + rollData.rolled.ptTache,
|
||||
tentatives: tache.system.tentatives + 1
|
||||
}
|
||||
}
|
||||
|
||||
if (rollData.rolled.isETotal) {
|
||||
rollData.tache.system.difficulte--;
|
||||
tacheUpdates.system['difficulte'] = tache.system.difficulte - 1
|
||||
}
|
||||
if (rollData.rolled.isSuccess) {
|
||||
rollData.tache.system.nb_jet_succes++;
|
||||
tacheUpdates.system['nb_jet_succes'] = tache.system.nb_jet_succes + 1;
|
||||
} else {
|
||||
rollData.tache.system.nb_jet_echec++;
|
||||
tacheUpdates.system['nb_jet_echec'] = tache.tache.system.nb_jet_echec + 1
|
||||
}
|
||||
rollData.tache.system.tentatives = rollData.tache.system.nb_jet_succes + rollData.tache.system.nb_jet_echec;
|
||||
|
||||
await this.updateEmbeddedDocuments('Item', [rollData.tache]);
|
||||
await tache.update(tacheUpdates)
|
||||
await this.santeIncDec("fatigue", rollData.tache.system.fatigue);
|
||||
|
||||
if (rollData.tache.system.tacheCommuneId != "") {
|
||||
rollData.tache.render()
|
||||
}
|
||||
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-tache.hbs');
|
||||
if (options?.callbacks) {
|
||||
await Promise.all(callbacks.map(callback => callback(rollData)))
|
||||
@@ -2422,7 +2434,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
onRollDone: RollDialog.onRollDoneClose,
|
||||
verb: "applique des soins complets à",
|
||||
title: "Soins complets",
|
||||
forced: true
|
||||
forced: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user