Utilisation des ajustements

This commit is contained in:
Vincent Vandemeulebrouck 2021-01-13 03:11:03 +01:00
parent 4133ffeefa
commit 1d56bff61d
7 changed files with 19 additions and 40 deletions

View File

@ -1779,8 +1779,7 @@ export class RdDActor extends Actor {
competence: competence,
tache: tache,
diffConditions: tache.data.difficulte,
editLibre: false,
editConditions: false,
use: { libre: false, conditions: false},
carac: {}
};
rollData.carac[tache.data.carac] = duplicate(this.data.data.carac[tache.data.carac]); // Single carac
@ -1830,8 +1829,7 @@ export class RdDActor extends Actor {
isPurification: false,
},
diffConditions: 0,
editLibre: false,
editConditions: true,
use: { libre: false, conditions: true, },
carac: {}
};
meditationData.carac["intellect"] = duplicate(this.data.data.carac["intellect"]);

View File

@ -36,9 +36,9 @@ export class RdDBonus {
} else {
dmg.dmgArme = RdDBonus._dmgArme(rollData);
dmg.penetration = RdDBonus._peneration(rollData);
dmg.dmgTactique = RdDBonus.dmgBonus(rollData.tactique);
dmg.dmgTactique = RdDBonus.dmgBonus(rollData.ajustements?.tactique);
dmg.dmgParticuliere = RdDBonus._dmgParticuliere(rollData);
dmg.dmgSurprise = RdDBonus.dmgBonus(rollData.surpriseDefenseur);
dmg.dmgSurprise = RdDBonus.dmgBonus(rollData.ajustements?.attaqueDefenseurSurpris);
dmg.dmgActor = rollData.selectedCarac ? RdDBonus._dmgPerso(dmgActor, rollData.selectedCarac.label, dmg.dmgArme) : 0;
dmg.total = dmg.dmgSurprise + dmg.dmgTactique + dmg.dmgArme + dmg.dmgActor + dmg.dmgParticuliere;
dmg.mortalite = RdDBonus._calculMortalite(rollData, isCauchemar)

View File

@ -222,7 +222,7 @@ export class RdDCombat {
ui.notifications.warn("Action automatisée impossible, le jet de l'attaquant a été perdu (suite à un raffraichissement?)")
return;
}
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId'].value;
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId']?.value;
const armeParadeId = event.currentTarget.attributes['data-armeid']?.value;
@ -323,7 +323,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static isEchec(rollData) {
switch (rollData.surprise) {
switch (rollData.ajustements.surprise.used) {
case 'totale': return true;
}
return rollData.rolled.isEchec;
@ -331,7 +331,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static isEchecTotal(rollData) {
if (!rollData.attackerRoll && rollData.surprise) {
if (!rollData.attackerRoll && rollData.ajustements.surprise.used) {
return rollData.rolled.isEchec;
}
return rollData.rolled.isETotal;
@ -339,7 +339,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static isParticuliere(rollData) {
if (!rollData.attackerRoll && rollData.surprise) {
if (!rollData.attackerRoll && rollData.ajustements.surprise.used) {
return false;
}
return rollData.rolled.isPart;
@ -347,7 +347,7 @@ export class RdDCombat {
/* -------------------------------------------- */
static isReussite(rollData) {
switch (rollData.surprise) {
switch (rollData.ajustements.surprise.used) {
case 'totale': return false;
}
return rollData.rolled.isSuccess;
@ -414,7 +414,7 @@ export class RdDCombat {
const isMeleeDiffNegative = rollData.selectedCarac.label == "Mêlée" && rollData.diffLibre < 0;
ChatMessage.create({
whisper: ChatMessage.getWhisperRecipients(this.attacker.name),
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-defense.html', {
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-particuliere.html', {
attackerId: this.attackerId,
defenderTokenId: this.defenderTokenId,
isFinesse: isMeleeDiffNegative,

View File

@ -49,10 +49,7 @@ export class RdDRoll extends Dialog {
surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,
surencMalusValue: actor.getSurenc(),
useMalusSurenc: false,
use: {
surenc: false,
encTotal: false,
},
use: { libre:true, conditions: true, surenc: false, encTotal: false, },
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
useMalusEncTotal: false,
encTotal: actor.getEncTotal(),
@ -245,23 +242,7 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */
_computeFinalLevel(rollData) {
const etat = RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac) ? 0 : rollData.etat;
const diffConditions = Misc.toInt(rollData.diffConditions);
const malusSurenc = (rollData.useMalusSurenc) ? rollData.surencMalusValue : 0;
const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique);
const malusEncTotal = (rollData.useMalusEncTotal) ? -rollData.encTotal : 0;
const ajustementChance = RdDResolutionTable.isAjustementAstrologique(rollData) ? rollData.ajustementAstrologique : 0;
// Gestion malus armure
const malusArmureValue = this._computeMalusArmure(rollData);
const diffMeditation = RdDItemMeditation.calculDifficulte(rollData);
const diffLibre = this._computeDiffLibre(rollData);
const diffCompetence = this._computeDiffCompetence(rollData);
const diffMoral = rollData.selectedCarac == this.actor.data.data.carac.volonte ? rollData.moral : 0;
let ajust = RollDataAjustements.sum(rollData.ajustements);
return ajust;
//return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusSurenc + malusEncTotal + malusArmureValue + diffMeditation + ajustementChance + bonusTactique;
return RollDataAjustements.sum(rollData.ajustements);
}
/* -------------------------------------------- */

View File

@ -83,7 +83,7 @@
<span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span>
<input class="resource-content" type="checkbox" name="data.sante.sonne.value"
value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
<img class="img-sonne" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
<img class="button-effect-img" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
</li>
<li class="competence flexrow list-item" data-attribute="etat">
<span class="competence-label flexrow" name="data.compteurs.etat.label">Etat Général : </span>

View File

@ -83,7 +83,7 @@
<span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span>
<input class="resource-content" type="checkbox" name="data.sante.sonne.value"
value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
<img class="img-sonne" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
<img class="button-effect-img" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
</li>
<li class="competence flexrow list-item" data-attribute="etat">
<span class="competence-label flexrow" name="data.compteurs.etat.label">Etat Général : </span>

View File

@ -17,7 +17,7 @@
<label>{{diffLibre}}</label>
{{else}}
<label for="categorie">Difficulté libre</label>
<select name="diffLibre" id="diffLibre" data-dtype="number" {{#unless editLibre}}disabled{{/unless}}>
<select name="diffLibre" id="diffLibre" data-dtype="number" {{#unless use.libre}}disabled{{/unless}}>
{{#select diffLibre}}
{{#each difficultesLibres as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
@ -26,7 +26,7 @@
</select>
{{/if}}
<label for="categorie">&nbsp;&nbsp;Conditions</label>
<select name="diffConditions" id="diffConditions" data-dtype="number" {{#unless editConditions}}disabled{{/unless}}>
<select name="diffConditions" id="diffConditions" data-dtype="number" {{#unless use.conditions}}disabled{{/unless}}>
{{#select diffConditions}}
{{#each ajustementsConditions as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
@ -45,7 +45,7 @@
<label></label>
{{else}}
<label for="categorie">Tactique:</label>
<select name="tactique-combat" id="tactique-combat" data-dtype="String" {{#unless editConditions}}disabled{{/unless}}>
<select name="tactique-combat" id="tactique-combat" data-dtype="String" {{#unless use.conditions}}disabled{{/unless}}>
<option value="Attaque normale">Attaque normale</option>
<option value="charge">Charge</option>
<option value="feinte">Feinte</option>
@ -54,8 +54,8 @@
<label>Non Mortel</label>
<input class="attribute-value" type="checkbox" id="coupsNonMortels" name="coupsNonMortels" {{#if coupsNonMortels}}checked{{/if}}/>
{{/if}}
{{#if surpriseDefenseur}}
<label for="categorie" id="defenseur-surprise"></label>
{{#if ajustements.attaqueDefenseurSurpris}}
<label for="categorie" id="defenseur-surprise">{{ajustements.attaqueDefenseurSurpris.descr}}</label>
{{/if}}
</div>
{{/if}}