2021-05-10 19:17:31 +02:00
|
|
|
import { Misc } from "./misc.js";
|
|
|
|
|
|
|
|
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": [Misc.upperFirst(meditation.data.tmr)],
|
|
|
|
"difficulte": RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code),
|
|
|
|
"ephemere": true,
|
|
|
|
"duree": "1 round",
|
|
|
|
"valeur": { "norm": 3, "sign": 5, "part": 10 }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
static getDiffSigneMeditation(code) {
|
|
|
|
switch (code) {
|
|
|
|
case "norm": return -7;
|
|
|
|
case "sign": return -3;
|
|
|
|
case "part": return 0;
|
|
|
|
}
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
static getXpSortSigneDraconique(code, signe) {
|
|
|
|
return Misc.data(signe).data.valeur[code] ?? 0;
|
|
|
|
}
|
|
|
|
|
2021-05-11 00:52:25 +02:00
|
|
|
static calculValeursXpSort(qualite, valeur, avant) {
|
|
|
|
switch (qualite) {
|
|
|
|
case "norm":
|
|
|
|
return {
|
|
|
|
norm: valeur,
|
|
|
|
sign: Math.max(valeur, avant.sign),
|
|
|
|
part: Math.max(valeur, avant.part)
|
|
|
|
}
|
|
|
|
case "sign":
|
|
|
|
return {
|
|
|
|
norm: Math.min(valeur, avant.norm),
|
|
|
|
sign: valeur,
|
|
|
|
part: Math.max(valeur, avant.part)
|
|
|
|
}
|
|
|
|
case "part":
|
|
|
|
return {
|
|
|
|
norm: Math.min(valeur, avant.norm),
|
|
|
|
sign: Math.min(valeur, avant.sign),
|
|
|
|
part: valeur
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-10 19:17:31 +02:00
|
|
|
}
|