Preparation maîtrise fleuve

This commit is contained in:
Vincent Vandemeulebrouck 2021-02-06 02:29:58 +01:00
parent 0e037b0c34
commit aa1c93ce22
6 changed files with 43 additions and 30 deletions

View File

@ -1731,8 +1731,7 @@ export class RdDActor extends Actor {
sortList: sortList, sortList: sortList,
competence: this.getBestDraconic(), competence: this.getBestDraconic(),
selectedSort: sortList[0], selectedSort: sortList[0],
coord: coord, tmr: TMRUtility.getTMR(coord),
coordLabel: TMRUtility.getTMR(coord).label,
diffLibre: sortList[0].data.difficulte, // Per default at startup diffLibre: sortList[0].data.difficulte, // Per default at startup
coutreve: Array(20).fill().map((item, index) => 1 + index) coutreve: Array(20).fill().map((item, index) => 1 + index)
} }

View File

@ -52,6 +52,7 @@ export class RdDRoll extends Dialog {
encTotal: actor.getEncTotal(), encTotal: actor.getEncTotal(),
ajustementAstrologique: actor.ajustementAstrologique(), ajustementAstrologique: actor.ajustementAstrologique(),
surprise: actor.getSurprise(false), surprise: actor.getSurprise(false),
canClose: true
} }
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false }); mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
if (rollData.forceCarac) { if (rollData.forceCarac) {
@ -82,7 +83,12 @@ export class RdDRoll extends Dialog {
close: close close: close
}; };
for (let action of actions) { for (let action of actions) {
conf.buttons[action.name] = { label: action.label, callback: html => this.onAction(action, html) }; conf.buttons[action.name] = {
label: action.label, callback: html => {
this.rollData.canClose = true;
this.onAction(action, html)
}
};
} }
super(conf, options); super(conf, options);
@ -91,6 +97,14 @@ export class RdDRoll extends Dialog {
this.rollData = rollData; this.rollData = rollData;
} }
close() {
if (this.rollData.canClose) {
return super.close();
}
ui.notifications.info("Vous devez faire ce jet de dés!");
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async onAction(action, html) { async onAction(action, html) {
await RdDResolutionTable.rollData(this.rollData); await RdDResolutionTable.rollData(this.rollData);
@ -154,7 +168,7 @@ export class RdDRoll extends Dialog {
html.find('#sort').change((event) => { html.find('#sort').change((event) => {
let sortKey = Misc.toInt(event.currentTarget.value); let sortKey = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort = this.rollData.sortList[sortKey]; // Update the selectedCarac this.rollData.selectedSort = this.rollData.sortList[sortKey]; // Update the selectedCarac
this.rollData.bonus = RdDItemSort.getCaseBonus(this.rollData.selectedSort, this.rollData.coord); this.rollData.bonus = RdDItemSort.getCaseBonus(this.rollData.selectedSort, this.rollData.tmr.coord);
RdDItemSort.setCoutReveReel(this.rollData.selectedSort); RdDItemSort.setCoutReveReel(this.rollData.selectedSort);
$("#draconic").val(this.rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer $("#draconic").val(this.rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer
this.updateRollResult(); this.updateRollResult();
@ -208,7 +222,9 @@ export class RdDRoll extends Dialog {
dmgText = '(' + dmgText + ')'; dmgText = '(' + dmgText + ')';
} }
if (rollData.selectedSort) { if (rollData.selectedSort) {
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord); rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.tmr.coord);
HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort))
HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort))
} }
RollDataAjustements.calcul(rollData, this.actor); RollDataAjustements.calcul(rollData, this.actor);
@ -218,19 +234,10 @@ export class RdDRoll extends Dialog {
HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence)); HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence));
HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData)); HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData));
// Sort management
if (rollData.selectedSort) {
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord);
//console.log("Toggle show/hide", rollData.selectedSort);
HtmlUtility._showControlWhen($("#div-sort-difficulte"), RdDItemSort.isDifficulteVariable(rollData.selectedSort))
HtmlUtility._showControlWhen($("#div-sort-ptreve"), RdDItemSort.isCoutVariable(rollData.selectedSort))
}
// Mise à jour valeurs // Mise à jour valeurs
$("#compdialogTitle").text(this._getTitle(rollData)); $("#compdialogTitle").text(this._getTitle(rollData));
$('#coupsNonMortels').prop('checked', rollData.coupsNonMortels); $('#coupsNonMortels').prop('checked', rollData.coupsNonMortels);
$("#dmg-arme-actor").text(dmgText); $("#dmg-arme-actor").text(dmgText);
// $("#defenseur-surprise").text(RdDBonus.description(rollData.ajustements.attaqueDefenseurSurpris.descr));
$('.table-ajustement').remove(); $('.table-ajustement').remove();
$(".table-resolution").remove(); $(".table-resolution").remove();
$(".table-proba-reussite").remove(); $(".table-proba-reussite").remove();

View File

@ -292,6 +292,9 @@ export class RdDTMRDialog extends Dialog {
let dialog = new RdDTMRRencontreDialog("", this, this.currentRencontre, postRencontre); let dialog = new RdDTMRRencontreDialog("", this, this.currentRencontre, postRencontre);
dialog.render(true); dialog.render(true);
} }
else {
postRencontre();
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -116,8 +116,8 @@ export const referenceAjustements = {
getDescr: (rollData, actor) => rollData.selectedSort && rollData.coord ? `Bonus de case: ${RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord)}%` : '' getDescr: (rollData, actor) => rollData.selectedSort && rollData.coord ? `Bonus de case: ${RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord)}%` : ''
}, },
rencontreTMR: { rencontreTMR: {
isVisible: (rollData, actor) => rollData.tmr && rollData.rencontre.name, isVisible: (rollData, actor) => rollData.tmr && rollData.rencontre?.name,
isUsed: (rollData, actor) => rollData.tmr && rollData.rencontre.name, isUsed: (rollData, actor) => rollData.tmr && rollData.rencontre?.name,
getLabel: (rollData, actor) => rollData.rencontre?.name, getLabel: (rollData, actor) => rollData.rencontre?.name,
getValue: (rollData, actor) => - (rollData.rencontre?.force ?? 0) getValue: (rollData, actor) => - (rollData.rencontre?.force ?? 0)
} }

View File

@ -4,7 +4,7 @@
le {{#if selectedSort.data.isrituel}}rituel{{else}}sort{{/if}} le {{#if selectedSort.data.isrituel}}rituel{{else}}sort{{/if}}
{{selectedSort.name}} {{selectedSort.name}}
</h4> </h4>
<div>Pour {{selectedSort.data.ptreve_reel}} point{{~#if (gt selectedSort.data.ptreve_reel 1)}}s{{/if}} de rêve en {{coordLabel}} ({{coord}}). <div>Pour {{selectedSort.data.ptreve_reel}} point{{~#if (gt selectedSort.data.ptreve_reel 1)}}s{{/if}} de rêve en {{tmr.label}} ({{tmr.coord}}).
{{#if show.reveInsuffisant}} {{#if show.reveInsuffisant}}
<span>Pas assez de rêve!</span> <span>Pas assez de rêve!</span>
{{/if}} {{/if}}
@ -23,3 +23,7 @@
{{~/if}}. {{~/if}}.
</span> </span>
</div> </div>
<hr>
<span class="poesie-extrait">
{{{selectedSort.data.description}}}
</span>

View File

@ -1,7 +1,7 @@
<form class="dialog-roll-sort"> <form class="dialog-roll-sort">
<div class="form-group"> <div class="form-group">
<label for="categorie">Rêve : <label>{{numberFormat selectedCarac.value decimals=0 sign=false}}</label></label> <label for="categorie">Rêve : <label>{{numberFormat selectedCarac.value decimals=0 sign=false}}</label></label>
<label for="categorie">TMR : {{coord}} - {{coordLabel}}</label> <label for="categorie">TMR : {{tmr.label}} ({{tmr.coord}})</label>
</div> </div>
<div class="form-group"> <div class="form-group">