L'état général ne s'applique pas toujours

- jets de chance
- jets de résistance (Rêve Actuel)
- jets de stress (ne passe pas par la fenêtre de résolution)

RdD Page 93
This commit is contained in:
Vincent Vandemeulebrouck 2020-12-05 01:10:06 +01:00
parent 54825fe756
commit 9e8ebdda0d
4 changed files with 18 additions and 5 deletions

View File

@ -72,6 +72,12 @@ export class RdDRollDialog extends Dialog {
rollData.finalLevel = rollLevel; rollData.finalLevel = rollLevel;
rollData.caracValue = caracValue rollData.caracValue = caracValue
if (RdDRollDialog._isEtatGeneralApplicable(rollData)) {
$(".etat-general").show();
}
else {
$(".etat-general").hide();
}
// Sort management // Sort management
if ( rollData.selectedSort ) { if ( rollData.selectedSort ) {
//console.log("Toggle show/hide", rollData.selectedSort); //console.log("Toggle show/hide", rollData.selectedSort);
@ -167,9 +173,16 @@ export class RdDRollDialog extends Dialog {
}); });
} }
static _isEtatGeneralApplicable(rollData) {
if (rollData.selectedCarac.label == 'Chance') return false;
if (rollData.selectedCarac.label == 'Rêve Actuel') return false;
return true;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static _computeFinalLevel(rollData) { static _computeFinalLevel(rollData) {
const etat = Misc.toInt(rollData.etat); const etat = RdDRollDialog._isEtatGeneralApplicable(rollData) ? Misc.toInt(rollData.etat) : 0;
const diffConditions = Misc.toInt(rollData.diffConditions); const diffConditions = Misc.toInt(rollData.diffConditions);
let malusEnc = (rollData.surencMalusApply ) ? rollData.surencMalusValue : 0; let malusEnc = (rollData.surencMalusApply ) ? rollData.surencMalusValue : 0;
let diffLibre = Misc.toInt(rollData.diffLibre); let diffLibre = Misc.toInt(rollData.diffLibre);

View File

@ -45,7 +45,7 @@
{{/if}} {{/if}}
{{>"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-natation.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-natation.html"}}
<div class="form-group"> <div class="form-group etat-general">
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label> <label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -19,7 +19,7 @@
</select> </select>
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}}
<div class="form-group"> <div class="form-group etat-general">
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label> <label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -59,7 +59,7 @@
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group etat-general">
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label> <label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
</div> </div>
<div class="form-group"> <div class="form-group">