Ajout des Oeuvres génériques
Ajout de la description au tchat, ajout de la référence/auteur à tous les types d'oeuvres Ajout de l'exotisme à la cuisine Jet de chant (qui ne marchait pas)
This commit is contained in:
@@ -304,6 +304,11 @@ export class RdDActorSheet extends ActorSheet {
|
||||
let musiqueId = li.data('item-id');
|
||||
this.actor.rollMusique(musiqueId);
|
||||
});
|
||||
html.find('.oeuvre-label a').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let oeuvreId = li.data('item-id');
|
||||
this.actor.rollOeuvre(oeuvreId);
|
||||
});
|
||||
html.find('.jeu-label a').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let jeuId = li.data('item-id');
|
||||
|
@@ -278,6 +278,9 @@ export class RdDActor extends Actor {
|
||||
getMusique(id) {
|
||||
return this.data.items.find(item => item.type == 'musique' && item._id == id);
|
||||
}
|
||||
getOeuvre(id, type = 'oeuvre') {
|
||||
return this.data.items.find(item => item.type == type && item._id == id);
|
||||
}
|
||||
getJeu(id) {
|
||||
return this.data.items.find(item => item.type == 'jeu' && item._id == id);
|
||||
}
|
||||
@@ -2041,20 +2044,21 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _rollArt(artData, selectedCarac, competence, oeuvre) {
|
||||
async _rollArt(artData, selectedCarac, oeuvre, callBackResult = r =>this._resultArt(r)) {
|
||||
mergeObject(artData, {
|
||||
oeuvre: oeuvre,
|
||||
competence: duplicate(competence),
|
||||
diffLibre: -oeuvre.data.niveau,
|
||||
art: oeuvre.type,
|
||||
competence: duplicate(this.getCompetence(oeuvre.data.competence ?? artData.art)),
|
||||
diffLibre: - (oeuvre.data.niveau ??0),
|
||||
diffConditions: 0,
|
||||
use: { libre: false, conditions: true, },
|
||||
use: { libre: false, conditions: true },
|
||||
selectedCarac: duplicate(this.data.data.carac[selectedCarac]),
|
||||
forceCarac: {}
|
||||
});
|
||||
artData.competence.data.defaut_carac = selectedCarac;
|
||||
artData.forceCarac[selectedCarac] = duplicate(this.data.data.carac[selectedCarac]);
|
||||
|
||||
console.log("rollArtiste !!!", artData);
|
||||
console.log("rollArt !!!", artData);
|
||||
|
||||
const dialog = await RdDRoll.create(this, artData, { html: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${artData.art}.html` }, {
|
||||
name: `jet-${artData.art}`,
|
||||
@@ -2077,85 +2081,66 @@ export class RdDActor extends Actor {
|
||||
RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollChant(id) {
|
||||
const artData = { art: 'chant', verbe: 'Chanter' };
|
||||
const oeuvre = duplicate(this.getChant(id));
|
||||
await this._rollArt(artData, "ouie", oeuvre);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async rollDanse(id) {
|
||||
const oeuvre = duplicate(this.getDanse(id));
|
||||
const competence = this.getCompetence("danse");
|
||||
const selectedCarac = this._getCaracDanse(oeuvre, competence);
|
||||
const artData = { art: 'danse', verbe: 'Danser' };
|
||||
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
||||
const oeuvre = duplicate(this.getOeuvre(id, artData.art));
|
||||
const selectedCarac = this._getCaracDanse(oeuvre,);
|
||||
await this._rollArt(artData, selectedCarac, oeuvre);
|
||||
}
|
||||
|
||||
_getCaracDanse(oeuvre, competence) {
|
||||
_getCaracDanse(oeuvre) {
|
||||
if (oeuvre.data.agilite) { return "agilite"; }
|
||||
else if (oeuvre.data.apparence) { return "apparence"; }
|
||||
const competence = this.getCompetence(oeuvre.data.competence);
|
||||
return competence.data.defaut_carac;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollMusique(id) {
|
||||
const oeuvre = duplicate(this.getMusique(id));
|
||||
const competence = this.getCompetence("musique");
|
||||
const selectedCarac = "ouie";
|
||||
const artData = { art: 'musique', verbe: 'Jouer' };
|
||||
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
||||
const oeuvre = duplicate(this.getOeuvre(id, artData.art));
|
||||
await this._rollArt(artData, "ouie", oeuvre);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollRecetteCuisine(id) {
|
||||
const oeuvre = duplicate(this.getRecetteCuisine(id));
|
||||
const competence = this.getCompetence("cuisine");
|
||||
const selectedCarac = 'odoratgout';
|
||||
const artData = { art: 'cuisine', verbe: 'Cuisiner' };
|
||||
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
||||
const oeuvre = duplicate(this.getRecetteCuisine(id));
|
||||
await this._rollArt(artData, 'odoratgout', oeuvre, r => this._resultRecetteCuisine(r) );
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _resultRecetteCuisine(artData) {
|
||||
const baseQualite = (artData.rolled.isSuccess ? artData.oeuvre.data.niveau : artData.competence.data.niveau);
|
||||
artData.qualiteFinale = Math.min(baseQualite, artData.oeuvre.data.niveau) + artData.rolled.ptQualite;
|
||||
artData.exotismeFinal = Math.min(Math.min(artData.qualiteFinale, -Math.abs(artData.oeuvre.data.exotisme??0)), 0);
|
||||
console.log("OEUVRE", artData.art, artData)
|
||||
RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollJeu(id) {
|
||||
const oeuvre = duplicate(this.getJeu(id));
|
||||
const competence = this.getCompetence("jeu");
|
||||
const selectedCarac = competence.data.defaut_carac;
|
||||
const artData = {
|
||||
art: 'jeu', verbe: 'Jeu',
|
||||
use: { libre: true, conditions: true, },
|
||||
};
|
||||
await this._rollArt(artData, selectedCarac, competence, oeuvre);
|
||||
const oeuvre = duplicate(this.getJeu(id));
|
||||
await this._rollArt(artData, oeuvre.data?.caraccomp.toLowerCase() ?? 'chance', oeuvre);
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollJeu( id ) {
|
||||
let jeu = duplicate(this.getJeu(id));
|
||||
let competence = duplicate(this.getCompetence("jeu"));
|
||||
let jeuData = {
|
||||
competence: competence,
|
||||
jeu: jeu,
|
||||
diffLibre: 0,
|
||||
diffConditions: 0,
|
||||
use: { libre: true, conditions: true, },
|
||||
carac: {}
|
||||
};
|
||||
|
||||
console.log("rollJeu !!!", jeuData);
|
||||
async rollOeuvre(id) {
|
||||
const artData = { art: 'oeuvre', verbe: 'Interpréter' };
|
||||
const oeuvre = duplicate(this.getOeuvre(id));
|
||||
await this._rollArt(artData, oeuvre.data.default_carac, oeuvre);
|
||||
}
|
||||
|
||||
const dialog = await RdDRoll.create(this, jeuData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-jeu.html' }, {
|
||||
name: 'jet-jeu',
|
||||
label: 'Jeu ' + jeu.name,
|
||||
height: 600,
|
||||
callbacks: [
|
||||
this.createCallbackExperience(),
|
||||
{ action: r => this._jeuResult(r) }
|
||||
]
|
||||
});
|
||||
dialog.render(true);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async _jeuResult(jeudData) {
|
||||
console.log("JEU", jeudData)
|
||||
RdDResolutionTable.displayRollData(jeudData, this.name, 'chat-resultat-jeu.html');
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollMeditation(id) {
|
||||
let meditation = duplicate(this.getMeditation(id));
|
||||
|
@@ -49,7 +49,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
async getData() {
|
||||
let data = super.getData();
|
||||
data.categorieCompetences = RdDUtility.getCategorieCompetences();
|
||||
if ( data.item.type == 'tache' || data.item.type == 'livre' || data.item.type == 'meditation') {
|
||||
if ( data.item.type == 'tache' || data.item.type == 'livre' || data.item.type == 'meditation' || data.item.type == 'oeuvre') {
|
||||
data.caracList = duplicate(game.system.model.Actor.personnage.carac);
|
||||
data.competences = await RdDUtility.loadCompendiumNames( 'foundryvtt-reve-de-dragon.competences' );
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const categorieCompetences = {
|
||||
@@ -128,18 +129,6 @@ const fatigueMarche = {
|
||||
"tresdifficile": { "4": 4, "6": 6 }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Static tables for commands /table */
|
||||
const table2func = {
|
||||
"rdd": { descr: "rdd: Ouvre la table de résolution", func: RdDRollResolutionTable.open },
|
||||
"queues": { descr: "queues: Tire une queue de Dragon", func: RdDRollTables.getQueue },
|
||||
"ombre": { descr: "ombre: Tire une Ombre de Dragon", func: RdDRollTables.getOmbre },
|
||||
"tetehr": { descr: "tetehr: Tire une Tête de Dragon pour Hauts Revants", fund: RdDRollTables.getTeteHR },
|
||||
"tete": { descr: "tete: Tire une Tête de Dragon", func: RdDRollTables.getTete },
|
||||
"souffle": { descr: "souffle: Tire un Souffle de Dragon", func: RdDRollTables.getSouffle },
|
||||
"tarot": { descr: "tarot: Tire une carte de Tarot Dracnique", func: RdDRollTables.getTarot }
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const definitionsBlessures = [
|
||||
{ type: "legere", facteur: 2 },
|
||||
@@ -264,6 +253,14 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html'
|
||||
];
|
||||
|
||||
Handlebars.registerHelper('upperFirst', function (str) {
|
||||
return Misc.upperFirst(str ?? 'null')
|
||||
})
|
||||
|
||||
Handlebars.registerHelper('upper', function (str) {
|
||||
return str?.toUpperCase() ?? 'NULL'
|
||||
})
|
||||
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
|
||||
@@ -319,6 +316,7 @@ export class RdDUtility {
|
||||
data.data.chants = this.checkNull(data.itemsByType['chant']);
|
||||
data.data.danses = this.checkNull(data.itemsByType['danse']);
|
||||
data.data.musiques = this.checkNull(data.itemsByType['musique']);
|
||||
data.data.oeuvres = this.checkNull(data.itemsByType['oeuvre']);
|
||||
data.data.jeux = this.checkNull(data.itemsByType['jeu']);
|
||||
data.data.recettescuisine = this.checkNull(data.itemsByType['recettecuisine']);
|
||||
data.data.recettesAlchimiques = this.checkNull(data.itemsByType['recettealchimique']);
|
||||
|
Reference in New Issue
Block a user