Tâches
Créer une nouvelle Tâche --
- {{#each data.taches as |tache id|}}
-
- {{tache.name}} ({{tache.data.points_de_tache_courant}}/{{tache.data.points_de_tache}}) - - - {{/each}} -
-
diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 506278cd..f8836363 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -285,6 +285,31 @@ export class RdDActorSheet extends ActorSheet { let meditationId = li.data('item-id'); this.actor.rollMeditation(meditationId); }); + html.find('.chant-label a').click((event) => { + const li = $(event.currentTarget).parents(".item"); + let chantId = li.data('item-id'); + this.actor.rollChant(chantId); + }); + html.find('.danse-label a').click((event) => { + const li = $(event.currentTarget).parents(".item"); + let danseId = li.data('item-id'); + this.actor.rollDanse(danseId); + }); + html.find('.musique-label a').click((event) => { + const li = $(event.currentTarget).parents(".item"); + let musiqueId = li.data('item-id'); + this.actor.rollMusique(musiqueId); + }); + html.find('.jeu-label a').click((event) => { + const li = $(event.currentTarget).parents(".item"); + let jeuId = li.data('item-id'); + this.actor.rollJeu(jeuId); + }); + html.find('.recettecuisine-label a').click((event) => { + const li = $(event.currentTarget).parents(".item"); + let recetteId = li.data('item-id'); + this.actor.rollRecetteCuisine(recetteId); + }); html.find('.subacteur-label a').click((event) => { const li = $(event.currentTarget).parents(".item"); let actorId = li.data('actor-id'); diff --git a/module/actor.js b/module/actor.js index 63d50001..5ae26497 100644 --- a/module/actor.js +++ b/module/actor.js @@ -247,6 +247,21 @@ export class RdDActor extends Actor { getMeditation(id) { return this.data.items.find(item => item.type == 'meditation' && item._id == id); } + getChant(id) { + return this.data.items.find(item => item.type == 'chant' && item._id == id); + } + getDanse(id) { + return this.data.items.find(item => item.type == 'danse' && item._id == id); + } + getMusique(id) { + return this.data.items.find(item => item.type == 'musique' && item._id == id); + } + getJeu(id) { + return this.data.items.find(item => item.type == 'jeu' && item._id == id); + } + getRecetteCuisine(id) { + return this.data.items.find(item => item.type == 'recettecuisine' && item._id == id); + } /* -------------------------------------------- */ getBestDraconic() { const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau); @@ -1864,6 +1879,203 @@ export class RdDActor extends Actor { this.updateEmbeddedEntity("OwnedItem", rollData.tache); } + /* -------------------------------------------- */ + async rollChant( id ) { + let chant = duplicate(this.getChant(id)); + let competence = duplicate(this.getCompetence("chant")); + competence.data.defaut_carac = "ouie"; + let chantData = { + competence: competence, + chant: chant, + diffLibre: -chant.data.niveau, + diffConditions: 0, + use: { libre: false, conditions: true, }, + carac: {} + }; + chantData.carac["ouie"] = duplicate(this.data.data.carac["ouie"]); + + console.log("rollChant !!!", chantData); + + const dialog = await RdDRoll.create(this, chantData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-chant.html' }, { + name: 'jet-chant', + label: 'Chanter ' + chant.name, + height: 600, + callbacks: [ + this.createCallbackExperience(), + { action: r => this._chantResult(r) } + ] + }); + dialog.render(true); + } + /* -------------------------------------------- */ + async _chantResult(chantData) { + if ( chantData.rolled.isSuccess) { + chantData.qualiteFinale = chantData.danse.data.niveau + chantData.rolled.ptQualite; + } else { + chantData.qualiteFinale = chantData.competence.data.niveau + chantData.rolled.ptQualite; + } + console.log("CHAN", chantData) + RdDResolutionTable.displayRollData(chantData, this.name, 'chat-resultat-chant.html'); + } + + /* -------------------------------------------- */ + async rollDanse( id ) { + let danse = duplicate(this.getDanse(id)); + let competence = duplicate(this.getCompetence("danse")); + let danseData = { + competence: competence, + danse: danse, + diffLibre: -danse.data.niveau, + diffConditions: 0, + use: { libre: false, conditions: true, }, + forceCarac: {} + }; + if ( danse.data.agilite) { + competence.data.defaut_carac = "agilite"; + danseData.selectedCarac = duplicate(this.data.data.carac["agilite"]); + danseData.forceCarac["agilite"] = duplicate(this.data.data.carac["agilite"]); + } + if ( danse.data.apparence) { + competence.data.defaut_carac = "apparence"; + danseData.selectedCarac = duplicate(this.data.data.carac["apparence"]); + danseData.forceCarac["apparence"] = duplicate(this.data.data.carac["apparence"]); + } + + console.log("rollDanse !!!", danseData); + + const dialog = await RdDRoll.create(this, danseData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-danse.html' }, { + name: 'jet-danse', + label: 'Danser ' + danse.name, + height: 600, + callbacks: [ + this.createCallbackExperience(), + { action: r => this._danseResult(r) } + ] + }); + dialog.render(true); + } + /* -------------------------------------------- */ + async _danseResult(danseData) { + if ( danseData.rolled.isSuccess) { + danseData.qualiteFinale = danseData.danse.data.niveau + danseData.rolled.ptQualite; + } else { + danseData.qualiteFinale = danseData.competence.data.niveau + danseData.rolled.ptQualite; + } + console.log("CHAN", danseData) + RdDResolutionTable.displayRollData(danseData, this.name, 'chat-resultat-danse.html'); + } + + /* -------------------------------------------- */ + async rollMusique( id ) { + let musique = duplicate(this.getMusique(id)); + let competence = duplicate(this.getCompetence("musique")); + competence.data.defaut_carac = "ouie"; + let musiqueData = { + competence: competence, + musique: musique, + diffLibre: -musique.data.niveau, + diffConditions: 0, + use: { libre: false, conditions: true, }, + carac: {} + }; + musiqueData.carac["ouie"] = duplicate(this.data.data.carac["ouie"]); + + console.log("rollMusique !!!", musiqueData); + + const dialog = await RdDRoll.create(this, musiqueData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-musique.html' }, { + name: 'jet-musique', + label: 'Jouer ' + musique.name, + height: 600, + callbacks: [ + this.createCallbackExperience(), + { action: r => this._musiqueResult(r) } + ] + }); + dialog.render(true); + } + /* -------------------------------------------- */ + async _musiqueResult(musiqueData) { + if ( musiqueData.rolled.isSuccess) { + musiqueData.qualiteFinale = musiqueData.musique.data.niveau + musiqueData.rolled.ptQualite; + } else { + musiqueData.qualiteFinale = musiqueData.competence.data.niveau + musiqueData.rolled.ptQualite; + } + console.log("MUSIQUE", musiqueData) + RdDResolutionTable.displayRollData(musiqueData, this.name, 'chat-resultat-musique.html'); + } + + /* -------------------------------------------- */ + 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); + + 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 rollRecetteCuisine( id ) { + let cuisine = duplicate(this.getRecetteCuisine(id)); + let competence = duplicate(this.getCompetence("cuisine")); + competence.data.defaut_carac = "odoratgout"; + let cuisineData = { + competence: competence, + cuisine: cuisine, + diffLibre: -cuisine.data.niveau, + diffConditions: 0, + use: { libre: true, conditions: true, }, + carac: {} + }; + cuisineData.carac["odoratgout"] = duplicate(this.data.data.carac["odoratgout"]); + + console.log("rollRecetteCuisine !!!", cuisineData); + + const dialog = await RdDRoll.create(this, cuisineData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-cuisine.html' }, { + name: 'jet-jeu', + label: 'Cuisiner ' + cuisine.name, + height: 600, + callbacks: [ + this.createCallbackExperience(), + { action: r => this._recetteCuisineResult(r) } + ] + }); + dialog.render(true); + } + /* -------------------------------------------- */ + async _recetteCuisineResult(cuisineData) { + if ( cuisineData.rolled.isSuccess) { + cuisineData.qualiteFinale = cuisineData.cuisine.data.niveau + cuisineData.rolled.ptQualite; + } else { + cuisineData.qualiteFinale = cuisineData.competence.data.niveau + cuisineData.rolled.ptQualite; + } + console.log("Cuisine", cuisineData) + RdDResolutionTable.displayRollData(cuisineData, this.name, 'chat-resultat-cuisine.html'); + } + + /* -------------------------------------------- */ async rollMeditation(id) { let meditation = duplicate(this.getMeditation(id)); diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 51c0478a..53033711 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -54,6 +54,9 @@ export class RdDRoll extends Dialog { surprise: actor.getSurprise(false), } mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false }); + if ( rollData.forceCarac) { + rollData.carac = rollData.forceCarac; + } RollDataAjustements.calcul(rollData, actor); } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index f3291c69..20c16708 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -294,6 +294,11 @@ export class RdDUtility { data.data.taches = this.checkNull(data.itemsByType['tache']); data.data.monnaie = this.checkNull(data.itemsByType['monnaie']); data.data.meditations = this.checkNull(data.itemsByType['meditation']); + 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.jeux = this.checkNull(data.itemsByType['jeu']); + data.data.recettescuisine = this.checkNull(data.itemsByType['recettecuisine']); data.data.recettesAlchimiques = this.checkNull(data.itemsByType['recettealchimique']); data.data.objets = data.data.conteneurs.concat(data.data.materiel).concat(data.data.armes).concat(data.data.armures).concat(data.data.munitions).concat(data.data.livres).concat(data.data.potions).concat(data.data.herbes).concat(data.data.ingredients); } diff --git a/styles/simple.css b/styles/simple.css index a5adba31..e047b7ee 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -665,6 +665,13 @@ ul, li { .astrologie-label, .tache-label, .subacteur-label, +.chant-label, +.musique-label, +.chant-label, +.danse-label, +.recette-label, +.jeu-label, +.recettecuisine-label, .description-label { flex-grow: 2; } diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index e6d3a159..22fe0081 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -99,7 +99,7 @@ Carac. Compétences Combat - États + Savoirs&Taches Haut-Rêve Équipement Description @@ -519,10 +519,11 @@ {{!-- Combat Tab --}}