forked from public/foundryvtt-reve-de-dragon
Merge v1.3 dans appel au moral
This commit is contained in:
@ -46,18 +46,23 @@ export class RdDRoll extends Dialog {
|
||||
surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,
|
||||
surencMalusValue: actor.getSurenc(),
|
||||
useMalusSurenc: false,
|
||||
<<<<<<< HEAD
|
||||
appelAuMoralPossible : false, /* Est-ce que l'appel au moral est possible ? Variable utisé pour l'affichage ou non de la ligne concernant le moral */
|
||||
appelAuMoralDemander :false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
|
||||
jetEchouerMoralDiminuer : false, /* Pour l'affichage dans le chat */
|
||||
use: { libre:true, conditions: true, surenc: false, encTotal: false, appelAuMoral : false /* Le jet se fait ou non en utilisant l'appel au moral */},
|
||||
=======
|
||||
use: { libre: true, conditions: true, surenc: false, encTotal: false, },
|
||||
>>>>>>> v1.3
|
||||
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||
useMalusEncTotal: false,
|
||||
encTotal: actor.getEncTotal(),
|
||||
ajustementAstrologique: actor.ajustementAstrologique(),
|
||||
surprise: actor.getSurprise(false),
|
||||
canClose: true
|
||||
}
|
||||
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
|
||||
if ( rollData.forceCarac) {
|
||||
if (rollData.forceCarac) {
|
||||
rollData.carac = rollData.forceCarac;
|
||||
}
|
||||
RollDataAjustements.calcul(rollData, actor);
|
||||
@ -85,7 +90,12 @@ export class RdDRoll extends Dialog {
|
||||
close: close
|
||||
};
|
||||
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);
|
||||
@ -94,6 +104,14 @@ export class RdDRoll extends Dialog {
|
||||
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) {
|
||||
await RdDResolutionTable.rollData(this.rollData);
|
||||
@ -114,7 +132,7 @@ export class RdDRoll extends Dialog {
|
||||
this.bringToTop();
|
||||
|
||||
var dialog = this;
|
||||
|
||||
|
||||
function onLoad() {
|
||||
let rollData = dialog.rollData;
|
||||
// Update html, according to data
|
||||
@ -124,7 +142,7 @@ export class RdDRoll extends Dialog {
|
||||
$("#carac").val(rollData.competence.data.defaut_carac);
|
||||
}
|
||||
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);
|
||||
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
||||
@ -157,9 +175,9 @@ export class RdDRoll extends Dialog {
|
||||
html.find('#sort').change((event) => {
|
||||
let sortKey = Misc.toInt(event.currentTarget.value);
|
||||
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);
|
||||
$("#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();
|
||||
});
|
||||
html.find('#ptreve-variable').change((event) => {
|
||||
@ -168,12 +186,6 @@ export class RdDRoll extends Dialog {
|
||||
console.log("RdDRollSelectDialog - Cout reve", ptreve);
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#ptreve-variable').change((event) => {
|
||||
let ptreve = Misc.toInt(event.currentTarget.value);
|
||||
this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac
|
||||
console.log("RdDRollSelectDialog - Cout reve", ptreve);
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#coupsNonMortels').change((event) => {
|
||||
this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel";
|
||||
this.updateRollResult();
|
||||
@ -232,7 +244,9 @@ export class RdDRoll extends Dialog {
|
||||
dmgText = '(' + dmgText + ')';
|
||||
}
|
||||
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))
|
||||
}
|
||||
|
||||
if ( ! RdDCarac.isActionPhysique(rollData.selectedCarac || ! actor.isPersonnage() ) ) {
|
||||
@ -244,28 +258,18 @@ export class RdDRoll extends Dialog {
|
||||
|
||||
}
|
||||
|
||||
|
||||
RollDataAjustements.calcul(rollData, this.actor);
|
||||
rollData.finalLevel = this._computeFinalLevel(rollData);
|
||||
|
||||
|
||||
HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used);
|
||||
HtmlUtility._showControlWhen($("#divAppelAuMoral"), rollData.appelAuMoralPossible );
|
||||
HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence));
|
||||
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
|
||||
$("#compdialogTitle").text(this._getTitle(rollData));
|
||||
$('#coupsNonMortels').prop('checked', rollData.coupsNonMortels);
|
||||
$("#dmg-arme-actor").text(dmgText);
|
||||
// $("#defenseur-surprise").text(RdDBonus.description(rollData.ajustements.attaqueDefenseurSurpris.descr));
|
||||
$('.table-ajustement').remove();
|
||||
$(".table-resolution").remove();
|
||||
$(".table-proba-reussite").remove();
|
||||
@ -276,7 +280,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);
|
||||
return html;
|
||||
}
|
||||
|
Reference in New Issue
Block a user