Fix méditation

- augmentation du malus en cas d'échec particulier/total
- le malus affecte négativement la méditation
- en cas d'échec, aucun signe n'est créé
This commit is contained in:
Vincent Vandemeulebrouck 2022-06-06 21:01:38 +02:00
parent 9b8f694dda
commit e22b6c52f1
3 changed files with 22 additions and 24 deletions

View File

@ -2838,20 +2838,19 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
async _meditationResult(meditationData) {
async _meditationResult(meditationRoll) {
this.santeIncDec("fatigue", 2);
const signeData = RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationData.meditation, meditationData.rolled)
if (signeData) {
await this.createEmbeddedDocuments("Item", [signeData]);
if (meditationRoll.rolled.isSuccess) {
await this.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationRoll.meditation, meditationRoll.rolled)]);
}
await RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html');
await RdDResolutionTable.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.html');
}
/* -------------------------------------------- */
_meditationEPart(meditationData) {
this.updateEmbeddedDocuments('Item', [{ _id: meditationData._id, 'data.malus': meditationData.meditation.data.malus - 1 }]);
_meditationEPart(meditationRoll) {
this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'data.malus': meditationRoll.meditation.data.malus - 1 }]);
}

View File

@ -3,7 +3,7 @@ export class RdDItemMeditation {
static calculDifficulte(rollData) {
if (rollData.meditation) {
// Malus permanent éventuel
let diff = -rollData.meditation.data.malus ?? 0;
let diff = rollData.meditation.data.malus ?? 0;
if (!rollData.conditionMeditation.isHeure) diff -= 2;
if (!rollData.conditionMeditation.isVeture) diff -= 2;
if (!rollData.conditionMeditation.isComportement) diff -= 2;

View File

@ -13,25 +13,24 @@ const tableSignesIndicatifs = [
]
const DIFFICULTE_LECTURE_SIGNE_MANQUE = +11;
export class RdDItemSigneDraconique {
static prepareSigneDraconiqueMeditation(meditation, rolled) {
if (rolled.isSuccess != undefined) {
meditation = Misc.data(meditation);
return {
name: "de la " + meditation.name,
type: "signedraconique",
img: meditation.img,
data: {
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)],
difficulte: RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code),
ephemere: true,
duree: "1 round",
valeur: { "norm": 3, "sign": 5, "part": 10 }
}
};
}
return undefined;
meditation = Misc.data(meditation);
return {
name: "de la " + meditation.name,
type: "signedraconique",
img: meditation.img,
data: {
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)],
difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE,
ephemere: true,
duree: "1 round",
valeur: rolled.isSuccess ? { "norm": 3, "sign": 5, "part": 10 } : { "norm": 0, "sign": 0, "part": 0 }
}
};
}
static getDiffSigneMeditation(code) {