Corrections signes draconiques
This commit is contained in:
parent
8fb69b0bc5
commit
a48f76e8eb
@ -2557,16 +2557,17 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollMeditation(id) {
|
||||
let meditation = Misc.data(this.getMeditation(id));
|
||||
const meditation = duplicate(Misc.data(this.getMeditation(id)));
|
||||
const competence = duplicate(Misc.data(this.getCompetence(meditation.data.competence)));
|
||||
competence.data.defaut_carac = "intellect"; // Meditation = toujours avec intellect
|
||||
let meditationData = {
|
||||
competence: duplicate(Misc.data(this.getCompetence(meditation.data.competence))),
|
||||
meditation: duplicate(meditation),
|
||||
competence: competence,
|
||||
meditation: meditation,
|
||||
conditionMeditation: { isHeure: false, isVeture: false, isComportement: false, isPurification: false },
|
||||
diffConditions: 0,
|
||||
use: { libre: false, conditions: true, },
|
||||
carac: { "intellect": Misc.templateData(this).carac.intellect }
|
||||
};
|
||||
meditationData.competence.data.defaut_carac = "intellect"; // Meditation = tjs avec intellect
|
||||
|
||||
const dialog = await RdDRoll.create(this, meditationData,
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ import { TMRType, TMRUtility } from "./tmr-utility.js";
|
||||
export class DialogCreateSigneDraconique extends Dialog {
|
||||
|
||||
static async createSigneForActors() {
|
||||
const signe = await RdDItemSigneDraconique.randomSigneDraconique();
|
||||
const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
|
||||
let dialogData = {
|
||||
signe: signe,
|
||||
tmrs: TMRUtility.listSelectedTMR(signe.data.typesTMR ?? []),
|
||||
@ -76,7 +76,7 @@ export class DialogCreateSigneDraconique extends Dialog {
|
||||
html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event));
|
||||
}
|
||||
async setSigneAleatoire() {
|
||||
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique();
|
||||
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
|
||||
|
||||
$("[name='signe.name']").val(newSigne.name);
|
||||
$("[name='signe.data.valeur.norm']").val(newSigne.data.valeur.norm);
|
||||
|
@ -67,15 +67,6 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
|
||||
|
||||
async setSigneAleatoire() {
|
||||
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique();
|
||||
// $("[name='signe.name']").val(newSigne.name);
|
||||
// $("[name='signe.data.valeur.norm']").val(newSigne.data.valeur.norm);
|
||||
// $("[name='signe.data.valeur.sign']").val(newSigne.data.valeur.sign);
|
||||
// $("[name='signe.data.valeur.part']").val(newSigne.data.valeur.part);
|
||||
// $("[name='signe.data.difficulte']").val(newSigne.data.difficulte);
|
||||
// $("[name='signe.data.duree']").val(newSigne.data.duree);
|
||||
// $("[name='signe.data.ephemere']").prop("checked", newSigne.data.ephemere);
|
||||
// $(".select-tmr").val(newSigne.data.typesTMR);
|
||||
// this.setEphemere(newSigne.data.ephemere);
|
||||
this.object.update(newSigne);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { defaultItemImg } from "./item.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
import { RdDRollTables } from "./rdd-rolltables.js";
|
||||
import { TMRType } from "./tmr-utility.js";
|
||||
import { TMRType, TMRUtility } from "./tmr-utility.js";
|
||||
|
||||
const tableSignesIndicatifs = [
|
||||
{ rarete: "Très facile", difficulte: 0, xp: 6, nbCases: 14 },
|
||||
@ -11,6 +12,7 @@ const tableSignesIndicatifs = [
|
||||
{ rarete: "Ardu", difficulte: -8, xp: 30, nbCases: 1 }
|
||||
|
||||
]
|
||||
|
||||
export class RdDItemSigneDraconique {
|
||||
|
||||
static prepareSigneDraconiqueMeditation(meditation, rolled) {
|
||||
@ -21,11 +23,11 @@ export class RdDItemSigneDraconique {
|
||||
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 }
|
||||
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)],
|
||||
difficulte: RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code),
|
||||
ephemere: true,
|
||||
duree: "1 round",
|
||||
valeur: { "norm": 3, "sign": 5, "part": 10 }
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -68,15 +70,15 @@ export class RdDItemSigneDraconique {
|
||||
}
|
||||
}
|
||||
|
||||
static async randomSigneDraconique() {
|
||||
static async randomSigneDraconique(options = { ephemere: undefined }) {
|
||||
let modele = await RdDDice.rollOneOf(tableSignesIndicatifs);
|
||||
return {
|
||||
name: await RdDItemSigneDraconique.randomSigneDescription(),
|
||||
type: "signedraconique",
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp',
|
||||
img: defaultItemImg.signedraconique,
|
||||
data: {
|
||||
typesTMR: await RdDItemSigneDraconique.randomTmrs(modele.nbCases),
|
||||
ephemere: true,
|
||||
ephemere: options?.ephemere == undefined ? RdDDice.rollTotal("1d2") == 2 : options.ephemere,
|
||||
duree: "1 round",
|
||||
difficulte: modele.difficulte,
|
||||
valeur: { norm: modele.xp, sign: modele.xp, part: Math.floor(modele.xp * 1.5) },
|
||||
@ -85,7 +87,8 @@ export class RdDItemSigneDraconique {
|
||||
}
|
||||
|
||||
static async randomTmrs(nbTmr = undefined) {
|
||||
let tmrs = Object.values(TMRType).map(value => Misc.upperFirst(value.name));
|
||||
let tmrs = Object.values(TMRType)
|
||||
.map(value => TMRUtility.typeTmrName(value.name));
|
||||
let keep = nbTmr ?? (await RdDDice.rollTotal("1d" + TMRType.length) + 1);
|
||||
for (let i = tmrs.length; i > keep; i--) {
|
||||
tmrs.splice(await RdDDice.rollTotal("1d" + i), 1);
|
||||
|
@ -218,6 +218,7 @@ export class RdDUtility {
|
||||
Handlebars.registerHelper('buildConteneur', (objet) => { return RdDUtility.buildConteneur(objet); });
|
||||
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
||||
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
|
||||
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
|
||||
Handlebars.registerHelper('equals', (a, b) => a == b);
|
||||
|
||||
return loadTemplates(templatePaths);
|
||||
|
@ -347,6 +347,9 @@ export class TMRUtility {
|
||||
return Grammar.articleDetermine(tmr.type) + ' ' + tmr.label;
|
||||
}
|
||||
|
||||
static typeTmrName(type){
|
||||
return Misc.upperFirst(TMRType[Grammar.toLowerCaseNoAccent(type)].name);
|
||||
}
|
||||
static listSelectedTMR(typesTMR) {
|
||||
return Object.values(TMRType).map(value => Misc.upperFirst(value.name))
|
||||
.sort()
|
||||
|
@ -6,7 +6,7 @@
|
||||
<hr>
|
||||
<div>
|
||||
{{#if rolled.isSuccess}}
|
||||
Vous apercevez un signe draconique éphémère, qu'il faut aller lire en <strong>{{meditation.data.tmr}}</strong>.
|
||||
Vous apercevez un signe draconique éphémère, qu'il faut aller lire en <strong>{{typeTmr-name meditation.data.tmr}}</strong>.
|
||||
{{else}}
|
||||
Votre méditation ne porte pas ses fruits, vous ne voyez aucun signe Draconique.
|
||||
{{/if}}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<label><strong>{{meditation.data.theme}}</strong></label>
|
||||
<hr>
|
||||
<label>Support: <strong>{{upperFirst meditation.data.support}}</strong></label>
|
||||
<label>Case TMR: <strong>{{upperFirst meditation.data.tmr}}</strong></label>
|
||||
<label>Case TMR: <strong>{{typeTmr-name meditation.data.tmr}}</strong></label>
|
||||
<label>Durée: 60 minutes</label>
|
||||
<hr>
|
||||
<label>Intellect / {{competence.name}}:
|
||||
|
Loading…
Reference in New Issue
Block a user