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); this.santeIncDec("fatigue", 2);
const signeData = RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationData.meditation, meditationData.rolled) if (meditationRoll.rolled.isSuccess) {
if (signeData) { await this.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationRoll.meditation, meditationRoll.rolled)]);
await this.createEmbeddedDocuments("Item", [signeData]);
} }
await RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html'); await RdDResolutionTable.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.html');
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_meditationEPart(meditationData) { _meditationEPart(meditationRoll) {
this.updateEmbeddedDocuments('Item', [{ _id: meditationData._id, 'data.malus': meditationData.meditation.data.malus - 1 }]); 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) { static calculDifficulte(rollData) {
if (rollData.meditation) { if (rollData.meditation) {
// Malus permanent éventuel // 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.isHeure) diff -= 2;
if (!rollData.conditionMeditation.isVeture) diff -= 2; if (!rollData.conditionMeditation.isVeture) diff -= 2;
if (!rollData.conditionMeditation.isComportement) 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 { export class RdDItemSigneDraconique {
static prepareSigneDraconiqueMeditation(meditation, rolled) { static prepareSigneDraconiqueMeditation(meditation, rolled) {
if (rolled.isSuccess != undefined) { meditation = Misc.data(meditation);
meditation = Misc.data(meditation); return {
return { name: "de la " + meditation.name,
name: "de la " + meditation.name, type: "signedraconique",
type: "signedraconique", img: meditation.img,
img: meditation.img, data: {
data: { typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)],
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)], difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE,
difficulte: RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code), ephemere: true,
ephemere: true, duree: "1 round",
duree: "1 round", valeur: rolled.isSuccess ? { "norm": 3, "sign": 5, "part": 10 } : { "norm": 0, "sign": 0, "part": 0 }
valeur: { "norm": 3, "sign": 5, "part": 10 } }
} };
};
}
return undefined;
} }
static getDiffSigneMeditation(code) { static getDiffSigneMeditation(code) {