v1.5-fixes #538

Merged
uberwald merged 11 commits from VincentVk/foundryvtt-reve-de-dragon:v1.5-fixes into v1.5 2022-06-06 23:17:23 +02:00
3 changed files with 22 additions and 24 deletions
Showing only changes of commit e22b6c52f1 - Show all commits

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,10 +13,11 @@ 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,
@ -24,15 +25,13 @@ export class RdDItemSigneDraconique {
img: meditation.img, img: meditation.img,
data: { data: {
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)], typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)],
difficulte: RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code), difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE,
ephemere: true, ephemere: true,
duree: "1 round", duree: "1 round",
valeur: { "norm": 3, "sign": 5, "part": 10 } valeur: rolled.isSuccess ? { "norm": 3, "sign": 5, "part": 10 } : { "norm": 0, "sign": 0, "part": 0 }
} }
}; };
} }
return undefined;
}
static getDiffSigneMeditation(code) { static getDiffSigneMeditation(code) {
switch (code) { switch (code) {