Ajout de commentaire et suppression des logs

This commit is contained in:
LeFelis 2021-02-11 20:31:04 +01:00
parent 771622564a
commit 5ff3859974
5 changed files with 48 additions and 56 deletions

View File

@ -1595,7 +1595,7 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
createCallbackAppelAuMoral() { createCallbackAppelAuMoral() { /* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */
return { return {
condition: r => r.use.appelAuMoral && game.settings.get("core", "rollMode") != 'selfroll', condition: r => r.use.appelAuMoral && game.settings.get("core", "rollMode") != 'selfroll',
action: r => { console.log("createCallbackAppelAuMoral"); this.displayAppelAuMoral ; console.log(r.rolled.isEchec); this._appliquerAppelMoral(r, game.settings.get("core", "rollMode") != 'blindroll') } action: r => { console.log("createCallbackAppelAuMoral"); this.displayAppelAuMoral ; console.log(r.rolled.isEchec); this._appliquerAppelMoral(r, game.settings.get("core", "rollMode") != 'blindroll') }
@ -1675,23 +1675,10 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _appliquerAppelMoral(rollData, display = true) { async _appliquerAppelMoral(rollData, display = true) {
console.log("_appliquerAppelMoral");
console.log("_appliquerAppelMoral");
console.log("_appliquerAppelMoral");
console.log("_appliquerAppelMoral");
console.log(rollData);
console.log(this.name);
console.log(this);
if (!this.isPersonnage()) return; if (!this.isPersonnage()) return;
if (!rollData.rolled.isEchec) return; if (!rollData.rolled.isEchec) return;
const waitUpdate = this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */ const waitUpdate = this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */
console.log("_appliquerAppelMoral : moral diminuer"); rollData.jetEchouerMoralDiminuer = true;
rollData.moralDiminuer = true;
rollData.moralActualiser = 7;
await waitUpdate;
rollData.moralActualiser = this.getMoralTotal();
console.log("rollData.moralDiminuer: "+rollData.moralDiminuer);
console.log("rollData.moralActualiser: "+rollData.moralActualiser);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -46,17 +46,17 @@ 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,
appelAuMoralDemander :false, appelAuMoralPossible : false, /* Est-ce que l'appel au moral est possible ? Variable utisé pour l'affichage ou non de la ligne concernant le moral */
use: { libre:true, conditions: true, surenc: false, encTotal: false, appelAuMoral : false }, 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 */},
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),
} }
console.log("defaultRollData.appelAuMoralFlag : "+defaultRollData.appelAuMoralFlag);
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false }); mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
console.log("rollData.appelAuMoralFlag : "+rollData.appelAuMoralFlag);
if ( rollData.forceCarac) { if ( rollData.forceCarac) {
rollData.carac = rollData.forceCarac; rollData.carac = rollData.forceCarac;
} }
@ -190,21 +190,25 @@ export class RdDRoll extends Dialog {
this.rollData.useMalusEncTotal = event.currentTarget.checked; this.rollData.useMalusEncTotal = event.currentTarget.checked;
this.updateRollResult(); this.updateRollResult();
}); });
html.find('#iconeSmile').change((event) => {
console.log("iconeSmile");
console.log(html.find('.iconeSmile'));
this.updateRollResult();
});
html.find('#useAppelAuMoralCheckbox').change((event) => { /* l'appel au moral, qui donne un bonus de +1 */ html.find('#useAppelAuMoralCheckbox').change((event) => { /* l'appel au moral, qui donne un bonus de +1 */
console.log("#useAppelAuMoralCheckbox");
//console.log("surencMalusFlag : "+surencMalusFlag);
console.log("this.appelAuMoralFlag : "+this.appelAuMoralFlag);
console.log("this.rollData.moral : "+this.rollData.moral);
console.log("this.rollData.ajustements : "+this.rollData.ajustements);
console.log("this.rollData.ajustements.moral : "+this.rollData.ajustements.moral);
console.log("this.rollData.ajustements.moral.isVisible : "+this.rollData.ajustements.moral.isVisible);
console.log("event.currentTarget.checked : "+event.currentTarget.checked);
console.log("this.rollData.use.appelAuMoral : "+this.rollData.use.appelAuMoral);
this.rollData.appelAuMoralDemander = event.currentTarget.checked this.rollData.appelAuMoralDemander = event.currentTarget.checked
// this.rollData.use.appelAuMoral = event.currentTarget.checked if ( this.rollData.appelAuMoralDemander ) {
console.log("this.rollData.moral : "+this.rollData.moral); if ( this.rollData.moral > 0 ) {
console.log("this.rollData.use.appelAuMoral : "+this.rollData.use.appelAuMoral); html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-heureux.svg";
html.find('#textSmile')[0].innerHTML = "Appel au moral";
} else {
html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-malheureux.svg";
html.find('#textSmile')[0].innerHTML = "Appel à l'énergie du désespoir";
}
} else {
html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg";
html.find('#textSmile')[0].innerHTML = "Sans appel au moral";
}
this.updateRollResult(); this.updateRollResult();
}); });
// Section Méditation // Section Méditation
@ -231,28 +235,21 @@ export class RdDRoll extends Dialog {
rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord); rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord);
} }
/* ! actor.isPersonnage() || */ if ( ! RdDCarac.isActionPhysique(rollData.selectedCarac || ! actor.isPersonnage() ) ) {
if ( ! RdDCarac.isActionPhysique(rollData.selectedCarac) ) { rollData.appelAuMoralPossible = false;
rollData.use.appelAuMoral = false; rollData.use.appelAuMoral = false;
} else { } else {
rollData.appelAuMoralPossible = true;
rollData.use.appelAuMoral = rollData.appelAuMoralDemander; rollData.use.appelAuMoral = rollData.appelAuMoralDemander;
} }
RollDataAjustements.calcul(rollData, this.actor); RollDataAjustements.calcul(rollData, this.actor);
rollData.finalLevel = this._computeFinalLevel(rollData); rollData.finalLevel = this._computeFinalLevel(rollData);
console.log("updateRollResult");
console.log("rollData.ajustements.moralTotal.used: "+rollData.ajustements.moralTotal.used);
console.log("rollData.ajustements.moral.used: "+rollData.ajustements.moral.used);
console.log("rollData.use.appelAuMoral: "+rollData.use.appelAuMoral);
console.log("rollData.selectedCarac: ");
console.log(rollData.selectedCarac);
console.log("RdDCarac.isActionPhysique(rollData.selectedCarac): "+RdDCarac.isActionPhysique(rollData.selectedCarac));
HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used); HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used);
HtmlUtility._showControlWhen($(".diffAppelAuMoral"), RdDCarac.isActionPhysique(rollData.selectedCarac) ); HtmlUtility._showControlWhen($("#divAppelAuMoral"), rollData.appelAuMoralPossible );
HtmlUtility._showControlWhen($(".diffAppelAuMoral-checker"), RdDCarac.isActionPhysique(rollData.selectedCarac) );
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));

View File

@ -811,22 +811,26 @@ ul, li {
left: 0px; left: 0px;
text-align: center; text-align: center;
} }
.diffAppelAuMoral { .diffAppelAuMoral {
display: none !important; display: none !important;
} }
.diffAppelAuMoral-checker{ .diffAppelAuMoral-checker {
display: inline-block;
background-image: url('../icons/moral-neutre.svg');
width: 20px;
height: 20px; height: 20px;
background-image: url('../icons/moral-neutre.svg');
background-size: cover; background-size: cover;
} }
.diffAppelAuMoral:checked + .diffAppelAuMoral-checker { .diffAppelAuMoral:checked + .diffAppelAuMoral-checker {
background-image: url('../icons/moral-heureux.svg'); background-image: url('../icons/moral-heureux.svg');
} }
.iconeSmile {
height: 20px;
width: 20px;
border:none;
outline: none;
background-size: cover;
}
.textSmile {
}
/* ======================================== */ /* ======================================== */
/* Fatigue CSS */ /* Fatigue CSS */

View File

@ -1,4 +1,4 @@
{{#if use.appelAuMoral}}<div> {{#if use.appelAuMoral}}<div>
{{alias}} fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}} {{#if moralDiminuer}}et échoue, diminuant son moral.{{else}} et réussit.{{/if}} {{alias}} fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}} {{#if moralDiminuer}}et échoue, diminuant son moral.{{else}} et réussit.{{/if}}
{{^moralDiminuer}} Son moral reste inchangé à {{moral}}.{{/moralDiminuer}} {{^jetEchouerMoralDiminuer}} Son moral reste inchangé à {{moral}}.{{/jetEchouerMoralDiminuer}}
<div>{{/if}} <div>{{/if}}

View File

@ -11,8 +11,6 @@
</select> </select>
<label></label> <label></label>
</div> </div>
<input class="diffAppelAuMoral" id="useAppelAuMoralCheckbox" type="checkbox" name="appelAuMoralDemander" />
<label for="useAppelAuMoralCheckbox" class="diffAppelAuMoral-checker" id="diffAppelAuMoral-checker"></label>
<div class="form-group"> <div class="form-group">
{{#if attackerRoll}} {{#if attackerRoll}}
<label for="categorie">Difficulté</label> <label for="categorie">Difficulté</label>
@ -61,6 +59,12 @@
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}
<div class="form-group" id="divAppelAuMoral" >
<input class="diffAppelAuMoral" id="useAppelAuMoralCheckbox" type="checkbox" name="appelAuMoralDemander" />
<label for="useAppelAuMoralCheckbox" class="diffAppelAuMoral-checker" id="diffAppelAuMoral-checker"></label>
<label for="useAppelAuMoralCheckbox" class="textSmile" id="textSmile" >Sans appel au moral</label>
<img for="useAppelAuMoralCheckbox" class="iconeSmile" id="iconeSmile" src="/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg">
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-enctotal.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-enctotal.html"}}