Merge branch 'v1.4-cuisine' into 'v1.4'
Créer des plats cuisinés See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!193
This commit is contained in:
commit
f25ae66de1
@ -29,6 +29,7 @@ import { RdDCarac } from "./rdd-carac.js";
|
||||
import { Monnaie } from "./item-monnaie.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { DialogConsommer } from "./dialog-consommer.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2264,7 +2265,12 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollRecetteCuisine(id) {
|
||||
const artData = { art: 'cuisine', verbe: 'Cuisiner' };
|
||||
const artData = {
|
||||
art: 'cuisine',
|
||||
verbe: 'Cuisiner',
|
||||
proportions: 1,
|
||||
ajouterEquipement: false
|
||||
};
|
||||
const oeuvre = duplicate(this.getRecetteCuisine(id));
|
||||
await this._rollArt(artData, 'odoratgout', oeuvre, r => this._resultRecetteCuisine(r));
|
||||
}
|
||||
@ -2272,9 +2278,28 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async _resultRecetteCuisine(artData) {
|
||||
const baseQualite = (artData.rolled.isSuccess ? artData.oeuvre.data.niveau : artData.competence.data.niveau);
|
||||
const sust = artData.oeuvre.data.sust * artData.proportions;
|
||||
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)
|
||||
const platCuisine = {
|
||||
name: artData.oeuvre.name,
|
||||
type: 'nourritureboisson',
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/objets/provision_cuite.webp',
|
||||
data: {
|
||||
"description": artData.oeuvre.data.description,
|
||||
"sust": Math.min(sust, 1),
|
||||
"qualite": artData.exotismeFinal < 0 ? artData.exotismeFinal : artData.qualiteFinale,
|
||||
"encombrement": 0.1,
|
||||
"quantite": Math.max(1, Math.floor(sust)),
|
||||
"cout": artData.exotismeFinal < 0 ? 0 : artData.qualiteFinale * 0.01
|
||||
}
|
||||
};
|
||||
if (artData.ajouterEquipement){
|
||||
await this.createEmbeddedDocuments('Item', [platCuisine]);
|
||||
ui.notifications.info(`${platCuisine.data.quantite} rations de ${platCuisine.name} ont été ajoutés à votre équipement`);
|
||||
}
|
||||
artData.platCuisine = platCuisine;
|
||||
RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
const typesObjetsEquipement = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson"];
|
||||
const typesObjetsEquipement = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"];
|
||||
const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"];
|
||||
/* -------------------------------------------- */
|
||||
export class RdDItem extends Item {
|
||||
@ -15,15 +15,19 @@ export class RdDItem extends Item {
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
const itemData = this.data;
|
||||
const tplData = itemData.data;
|
||||
if (RdDItem.getTypeObjetsEquipement().includes(itemData.type)) {
|
||||
const quantite = itemData.type == 'conteneur' ? 1 : (tplData.quantite ?? 0);
|
||||
if (tplData.encombrement != undefined) {
|
||||
tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite;
|
||||
}
|
||||
if (tplData.cout != undefined) {
|
||||
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
|
||||
}
|
||||
this._calculsEquipement(itemData);
|
||||
}
|
||||
}
|
||||
|
||||
_calculsEquipement(itemData) {
|
||||
const tplData = itemData.data;
|
||||
const quantite = itemData.type == 'conteneur' ? 1 : (tplData.quantite ?? 0);
|
||||
if (tplData.encombrement != undefined) {
|
||||
tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite;
|
||||
}
|
||||
if (tplData.cout != undefined) {
|
||||
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,12 +223,13 @@ export class RdDRoll extends Dialog {
|
||||
this.rollData.tactique = event.currentTarget.value;
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#useMalusSurenc').change((event) => {
|
||||
this.rollData.useMalusSurenc = event.currentTarget.checked;
|
||||
html.find('.cuisine-proportions').change((event) => {
|
||||
this.rollData.proportions = Number(event.currentTarget.value);
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#useMalusEncTotal').change((event) => {
|
||||
this.rollData.useMalusEncTotal = event.currentTarget.checked;
|
||||
html.find('.checkbox-by-name').change((event) => {
|
||||
const attribute = event.currentTarget.attributes['name'].value;
|
||||
this.rollData[attribute] = event.currentTarget.checked;
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('.imgAppelAuMoral').click((event) => { /* l'appel au moral, qui donne un bonus de +1 */
|
||||
|
@ -745,7 +745,7 @@
|
||||
</div>
|
||||
<ul class="item-list alterne-list">
|
||||
<li class="competence-header flexrow">
|
||||
<img class="sheet-competence-img" src="systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp" title="Equipement"/>
|
||||
<img class="sheet-competence-img" src="{{img}}" title="Equipement"/>
|
||||
<span class="competence-title flex-grow">Nom</span>
|
||||
<span class="competence-title">Q.</span>
|
||||
<span class="competence-title">Enc.</span>
|
||||
|
@ -75,18 +75,18 @@
|
||||
{{/if}}
|
||||
<ul class="item-list alterne-list">
|
||||
<li class="competence-header flexrow">
|
||||
<span class="competence-title competence-label">Nom</span>
|
||||
<img class="sheet-competence-img" src="{{img}}" title="Equipement"/>
|
||||
<span class="competence-title competence-label flex-grow">Nom</span>
|
||||
<span class="competence-title competence-label">Q.</span>
|
||||
<span class="competence-title competence-value">Enc.</span>
|
||||
<span class="competence-title competence-value">Equiper</span>
|
||||
<span class="competence-title competence-value">Editer/Suppr.</span>
|
||||
<span class="competence-title competence-value">Equiper/Editer/Suppr.</span>
|
||||
</li>
|
||||
{{#each data.objets as |item id|}}
|
||||
{{#each objets as |item id|}}
|
||||
{{#unless item.estContenu}}
|
||||
{{#if (ne item.type 'conteneur')}}
|
||||
<li class="item flexrow list-item" data-item-id="{{item._id}}">
|
||||
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
|
||||
<span class="item-name">{{item.name}}</span>
|
||||
<span class="item-name flex-grow">{{item.name}}</span>
|
||||
<span class="item-quantite">{{item.data.quantite}}</span>
|
||||
<span class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</span>
|
||||
<div class="item-controls">
|
||||
@ -98,7 +98,7 @@
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
{{#each data.conteneurs as |conteneur id|}}
|
||||
{{#each conteneurs as |conteneur id|}}
|
||||
{{buildConteneur this}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
@ -5,16 +5,18 @@
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
|
||||
<hr>
|
||||
<span>
|
||||
<img class="chat-icon" src="{{platCuisine.img}}" alt="{{platCuisine.name}}" />
|
||||
<br>Vous avez préparé {{platCuisine.data.quantite}} portions de {{platCuisine.name}}
|
||||
{{~#if ajouterEquipement}}, qui ont été ajoutées à votre équipement{{/if}}.
|
||||
{{#if rolled.isSuccess}}
|
||||
{{alias}} réussit sa recette, avec un plat de qualité {{qualiteFinale}} pour {{oeuvre.data.sust}} Points de Sustentation.
|
||||
Vous avez réussi la recette, pour un plat de qualité {{qualiteFinale}}.
|
||||
{{else}}
|
||||
{{alias}} fait un piètre cuisinier(e), et obtient {{#if (lt qualiteFinale 0)}}un plat à l'exotisme certain{{else}}un plat de qualité {{qualiteFinale}}{{/if}}.
|
||||
Selon la décision du MJ, le plat peut fournir {{oeuvre.data.sust}} Points de Sustentation
|
||||
Vous faites un piètre cuisinier, et obtenez un plat {{#if (lt exotismeFinal 0)}}à l'exotisme certain{{else}}de qualité {{qualiteFinale}}{{/if}}.
|
||||
{{/if}}
|
||||
|
||||
Pensez à faire goûter vos compagnons!
|
||||
{{#if (lt exotismeFinal 0)}}
|
||||
<br>Au vu de l'exotisme du plat, les convives devront réussir un jet de Volonté / Cuisine à {{exotismeFinal}}.
|
||||
En cas d'échec, ils peuvent se forcer pour faire plaisir au Maître Queux, mais devront faire un jet de moral Malheureux.
|
||||
En cas d'échec, ils peuvent se forcer pour vous faire plaisir, mais devront faire un jet de moral Malheureux.
|
||||
{{/if}}
|
||||
</span>
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{{#if ajustements.encTotal.visible}}
|
||||
<div class="form-group">
|
||||
<label>Appliquer l'encombrement total comme malus ({{encTotal}}) ? </label>
|
||||
<input class="attribute-value" type="checkbox" id="ajustements-encTotal-apply"
|
||||
name="ajustements.encTotal.apply" {{#if ajustements.encTotal.apply}}checked{{/if}}/>
|
||||
<input class="attribute-value checkbox-by-name" type="checkbox" name="useMalusEncTotal" {{#if useMalusEncTotal}}checked{{/if}}/>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
@ -1,42 +1,58 @@
|
||||
<form class="rdddialog">
|
||||
<div class="grid grid-2col">
|
||||
<div class="flex-group-left">
|
||||
<ul>
|
||||
<li><label>Cuisiner : {{oeuvre.name}}</label></li>
|
||||
<li><label>Jet : ODORAT-GOUT / {{competence.name}}</label></li>
|
||||
<li><label>Exotisme : {{oeuvre.data.exotisme}}</label></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="flex-group-left">
|
||||
<div class="flexrow">
|
||||
<label class="competence-label">Multiplier les proportions</label>
|
||||
<input class="competence-value cuisine-proportions" type="number" size="4" name="proportions" value="{{proportions}}" data-dtype="Number" />
|
||||
|
||||
<div class="form-group">
|
||||
<ul>
|
||||
<li><label>Cuisiner : {{oeuvre.name}}</label></li>
|
||||
<li><label>Jet : ODORAT-GOUT / {{competence.name}}</label></li>
|
||||
<li><label>Exotisme : {{oeuvre.data.exotisme}}</label></li>
|
||||
</ul>
|
||||
<div class="tooltipAppelAuMoral divAppelAuMoral">
|
||||
<img class="imgAppelAuMoral small-button-container" src="/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg">
|
||||
<span class="tooltipAppelAuMoralText">Sans appel au moral</span>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<label class="competence-label">Ajouter à l'équipement</label>
|
||||
<input class="checkbox-by-name" type="checkbox" name="ajouterEquipement" {{#if ajouterEquipement}}checked{{/if}} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-3col">
|
||||
<div class="flex-group-left">
|
||||
<label>Conditions</label>
|
||||
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||
{{#select diffConditions}}
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex-group-left">
|
||||
<label>Difficulté</label>
|
||||
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||
{{#select diffLibre}}
|
||||
{{#each difficultesLibres as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex-group-right flexrow">
|
||||
<div class="tooltipAppelAuMoral divAppelAuMoral">
|
||||
<img class="imgAppelAuMoral small-button-container" src="/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg">
|
||||
<span class="tooltipAppelAuMoralText">Sans appel au moral</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tableAjustements">
|
||||
</div>
|
||||
<div id="tableResolution">
|
||||
</div>
|
||||
<div id="tableProbaReussite">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>conditions</label>
|
||||
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||
{{#select diffConditions}}
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<label>Difficulté </label>
|
||||
<select name="diffLibre" id="diffLibre" data-dtype="number">
|
||||
{{#select diffLibre}}
|
||||
{{#each difficultesLibres as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="tableAjustements">
|
||||
</div>
|
||||
<div id="tableResolution">
|
||||
</div>
|
||||
<div id="tableProbaReussite">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#if surencMalusFlag}}
|
||||
<div class="form-group">
|
||||
<label for="xp">Appliquer le malus de sur-encombrement ? </label>
|
||||
<input class="attribute-value" type="checkbox" id="useMalusSurenc" name="useMalusSurenc" {{#if useMalusSurenc}}checked{{/if}}/>
|
||||
<input class="attribute-value checkbox-by-name" type="checkbox" name="useMalusSurenc" {{#if useMalusSurenc}}checked{{/if}}/>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
Loading…
Reference in New Issue
Block a user