Preparation maîtrise fleuve
This commit is contained in:
parent
0e037b0c34
commit
aa1c93ce22
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -46,15 +46,16 @@ export class RdDRoll extends Dialog {
|
|||||||
surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,
|
surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,
|
||||||
surencMalusValue: actor.getSurenc(),
|
surencMalusValue: actor.getSurenc(),
|
||||||
useMalusSurenc: false,
|
useMalusSurenc: false,
|
||||||
use: { libre:true, conditions: true, surenc: false, encTotal: false, },
|
use: { libre: true, conditions: true, surenc: false, encTotal: false, },
|
||||||
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||||
useMalusEncTotal: false,
|
useMalusEncTotal: false,
|
||||||
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) {
|
||||||
rollData.carac = rollData.forceCarac;
|
rollData.carac = rollData.forceCarac;
|
||||||
}
|
}
|
||||||
RollDataAjustements.calcul(rollData, actor);
|
RollDataAjustements.calcul(rollData, actor);
|
||||||
@ -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);
|
||||||
@ -121,7 +135,7 @@ export class RdDRoll extends Dialog {
|
|||||||
$("#carac").val(rollData.competence.data.defaut_carac);
|
$("#carac").val(rollData.competence.data.defaut_carac);
|
||||||
}
|
}
|
||||||
if (rollData.selectedSort) {
|
if (rollData.selectedSort) {
|
||||||
$("#draconic").val( rollData.selectedSort.data.listIndex ); // Uniquement a la selection du sort, pour permettre de changer
|
$("#draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer
|
||||||
}
|
}
|
||||||
RdDItemSort.setCoutReveReel(rollData.selectedSort);
|
RdDItemSort.setCoutReveReel(rollData.selectedSort);
|
||||||
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
||||||
@ -154,9 +168,9 @@ 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();
|
||||||
});
|
});
|
||||||
html.find('#ptreve-variable').change((event) => {
|
html.find('#ptreve-variable').change((event) => {
|
||||||
@ -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();
|
||||||
@ -241,7 +248,7 @@ export class RdDRoll extends Dialog {
|
|||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async buildAjustements(rollData){
|
async buildAjustements(rollData) {
|
||||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ajustements.html`, rollData);
|
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ajustements.html`, rollData);
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
|
@ -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">
|
||||||
|
Loading…
Reference in New Issue
Block a user