Rituels - Ajust. astrologique #81
Ajout de l'ajustement astrologique sur les rituels Affichage de l'ajustement astrologique quand il s'applique
This commit is contained in:
parent
4a46b3709c
commit
b54514a879
@ -108,11 +108,9 @@ export class RdDRoll extends Dialog {
|
|||||||
var dialog = this;
|
var dialog = this;
|
||||||
|
|
||||||
function updateRollResult(rollData) {
|
function updateRollResult(rollData) {
|
||||||
let caracValue = parseInt(rollData.selectedCarac.value)
|
|
||||||
let rollLevel = dialog._computeFinalLevel(rollData);
|
|
||||||
rollData.dmg = rollData.attackerRoll ? rollData.attackerRoll.dmg : RdDBonus.dmg(rollData, actor.getBonusDegat());
|
rollData.dmg = rollData.attackerRoll ? rollData.attackerRoll.dmg : RdDBonus.dmg(rollData, actor.getBonusDegat());
|
||||||
rollData.finalLevel = rollLevel;
|
rollData.finalLevel = dialog._computeFinalLevel(rollData);
|
||||||
rollData.caracValue = caracValue;
|
rollData.caracValue = parseInt(rollData.selectedCarac.value);
|
||||||
rollData.coupsNonMortels = (rollData.attackerRoll ? rollData.attackerRoll.dmg.mortalite : rollData.dmg.mortalite) == 'non-mortel';
|
rollData.coupsNonMortels = (rollData.attackerRoll ? rollData.attackerRoll.dmg.mortalite : rollData.dmg.mortalite) == 'non-mortel';
|
||||||
let dmgText = Misc.toSignedString(rollData.dmg.total);
|
let dmgText = Misc.toSignedString(rollData.dmg.total);
|
||||||
if (rollData.coupsNonMortels) {
|
if (rollData.coupsNonMortels) {
|
||||||
@ -120,7 +118,10 @@ export class RdDRoll extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HtmlUtility._showControlWhen($(".diffMoral"), rollData.selectedCarac == actor.data.data.carac.volonte);
|
HtmlUtility._showControlWhen($(".diffMoral"), rollData.selectedCarac == actor.data.data.carac.volonte);
|
||||||
HtmlUtility._showControlWhen($(".etat-general"), !dialog._isIgnoreEtatGeneral(rollData));
|
|
||||||
|
HtmlUtility._showControlWhen($("#ajustements"), (!dialog._isIgnoreEtatGeneral(rollData)) || dialog._isAjustementAstrologique(rollData));
|
||||||
|
HtmlUtility._showControlWhen($("#etat-general"), !dialog._isIgnoreEtatGeneral(rollData));
|
||||||
|
HtmlUtility._showControlWhen($("#ajust-astrologique"), dialog._isAjustementAstrologique(rollData));
|
||||||
|
|
||||||
// Sort management
|
// Sort management
|
||||||
if (rollData.selectedSort) {
|
if (rollData.selectedSort) {
|
||||||
@ -137,9 +138,9 @@ export class RdDRoll extends Dialog {
|
|||||||
$("#dmg-arme-actor").text(dmgText);
|
$("#dmg-arme-actor").text(dmgText);
|
||||||
$("#defenseur-surprise").text(RdDBonus.description(rollData.surpriseDefenseur));
|
$("#defenseur-surprise").text(RdDBonus.description(rollData.surpriseDefenseur));
|
||||||
$(".table-resolution").remove();
|
$(".table-resolution").remove();
|
||||||
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel));
|
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(rollData.caracValue, rollData.finalLevel));
|
||||||
$(".span-valeur").remove();
|
$(".span-valeur").remove();
|
||||||
$("#resolutionValeurs").append(RdDResolutionTable.buildHTMLResults(caracValue, rollLevel));
|
$("#resolutionValeurs").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup everything onload
|
// Setup everything onload
|
||||||
@ -228,7 +229,7 @@ export class RdDRoll extends Dialog {
|
|||||||
const malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0;
|
const malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0;
|
||||||
const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique);
|
const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique);
|
||||||
const malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0;
|
const malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0;
|
||||||
const ajustementChance = rollData.selectedCarac.label.toLowerCase().includes('chance') ? rollData.ajustementAstrologique : 0;
|
const ajustementChance = this._isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0;
|
||||||
// Gestion malus armure
|
// Gestion malus armure
|
||||||
const malusArmureValue = this._computeMalusArmure(rollData);
|
const malusArmureValue = this._computeMalusArmure(rollData);
|
||||||
|
|
||||||
@ -239,6 +240,16 @@ export class RdDRoll extends Dialog {
|
|||||||
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + ajustementChance + bonusTactique;
|
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + ajustementChance + bonusTactique;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isAjustementAstrologique(rollData) {
|
||||||
|
if (rollData.selectedCarac.label.toLowerCase().includes('chance')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (rollData.selectedSort && rollData.selectedSort.data.isrituel) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
_computeDiffCompetence(rollData) {
|
_computeDiffCompetence(rollData) {
|
||||||
if (rollData.competence) {
|
if (rollData.competence) {
|
||||||
return Misc.toInt(rollData.competence.data.niveau);
|
return Misc.toInt(rollData.competence.data.niveau);
|
||||||
|
@ -60,8 +60,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="categorie">Etat général:</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
|
<label for="categorie">Ajustements</label>
|
||||||
<label>Ajustement final:</label><label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label>
|
<label for="categorie">Etat général: {{numberFormat etat decimals=0 sign=true}}</label>
|
||||||
|
<label for="categorie" id="ajust-astrologique">Astrologique: {{numberFormat ajustementAstrologique decimals=0 sign=true}}</label>
|
||||||
|
<label>Final: <label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}}
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
<label class="diffMoral" for="categorie">Moral: {{#if (gt moral 0)}}+{{/if}}{{moral}}</label>
|
<label class="diffMoral" for="categorie">Moral: {{#if (gt moral 0)}}+{{/if}}{{moral}}</label>
|
||||||
</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 etat-general">
|
<div class="form-group" id="ajustements">
|
||||||
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
|
<label for="categorie">Ajustements</label>
|
||||||
</div>
|
<label for="categorie" id="etat-general">Etat général: {{numberFormat etat decimals=0 sign=true}}</label>
|
||||||
<div class="form-group">
|
<label for="categorie" id="ajust-astrologique">Astrologique: {{numberFormat ajustementAstrologique decimals=0 sign=true}}</label>
|
||||||
<label>Ajustement final : </label><label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label>
|
<label>Final: <label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label></label>
|
||||||
</div>
|
</div>
|
||||||
<div id="resolutionTable">
|
<div id="resolutionTable">
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<form class="dialog-roll-sort">
|
<form class="dialog-roll-sort">
|
||||||
<h2 class="compdialog" id="sort-dialog"></h2>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="categorie">Rêve : {{vieValue}}</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 : {{coord}} - {{coordLabel}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -59,11 +57,11 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group etat-general">
|
<div class="form-group" id="ajustements">
|
||||||
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
|
<label for="categorie">Ajustements</label>
|
||||||
</div>
|
<label for="categorie" id="etat-general">Etat général: {{numberFormat etat decimals=0 sign=true}}</label>
|
||||||
<div class="form-group">
|
<label for="categorie" id="ajust-astrologique">Astrologique: {{numberFormat ajustementAstrologique decimals=0 sign=true}}</label>
|
||||||
<label>Ajustement final : </label><label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label>
|
<label>Final: <label id="roll-param">10 / 0</label> <label name="addon-message" id="addon-message"></label></label>
|
||||||
</div>
|
</div>
|
||||||
<div id="resolutionTable">
|
<div id="resolutionTable">
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user