Merge branch 'quick-fixes' into 'v1.2'

Quick fixes

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!91
This commit is contained in:
Leratier Bretonnien 2020-12-28 08:32:24 +00:00
commit 30d8881cb6
10 changed files with 77 additions and 36 deletions

View File

@ -1,11 +1,9 @@
/** /**
* Extend the basic ActorSheet with some very simple modifications * Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet} * @extends {ActorSheet}
*/ */
import { HtmlUtility } from "./html-utility.js"; import { HtmlUtility } from "./html-utility.js";
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDActorEntiteSheet extends ActorSheet { export class RdDActorEntiteSheet extends ActorSheet {
@ -119,7 +117,6 @@ export class RdDActorEntiteSheet extends ActorSheet {
this.actor.remiseANeuf(); this.actor.remiseANeuf();
} }
}); });
} }

View File

@ -1,9 +1,9 @@
/** /**
* Extend the basic ActorSheet with some very simple modifications * Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet} * @extends {ActorSheet}
*/ */
import { HtmlUtility } from "./html-utility.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -65,6 +65,8 @@ export class RdDActorHumanoideSheet extends ActorSheet {
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
// Everything below here is only needed if the sheet is editable // Everything below here is only needed if the sheet is editable
if (!this.options.editable) return; if (!this.options.editable) return;
@ -147,6 +149,16 @@ export class RdDActorHumanoideSheet extends ActorSheet {
this.actor.santeIncDec("endurance", -1); this.actor.santeIncDec("endurance", -1);
this.render(true); this.render(true);
}); });
html.find('#encaisser-direct').click(ev => {
this.actor.encaisser()
});
html.find('#remise-a-neuf').click(ev => {
if (game.user.isGM) {
this.actor.remiseANeuf();
}
});
} }

View File

@ -309,7 +309,11 @@ export class RdDActor extends Actor {
whisper: ChatUtility.getWhisperRecipientsAndGMs( this.name ), whisper: ChatUtility.getWhisperRecipientsAndGMs( this.name ),
content : "Remise à neuf de " + this.name content : "Remise à neuf de " + this.name
}; };
if (!this.isEntiteCauchemar()) { if (this.isEntiteCauchemar()) {
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
}
else {
if (this.data.data.blessures){ if (this.data.data.blessures){
const blessures = duplicate(this.data.data.blessures); const blessures = duplicate(this.data.data.blessures);
for (let listeBlessures of [blessures.legeres.liste, blessures.graves.liste, blessures.critiques.liste]) { for (let listeBlessures of [blessures.legeres.liste, blessures.graves.liste, blessures.critiques.liste]) {
@ -319,12 +323,10 @@ export class RdDActor extends Actor {
} }
await this.update( {"data.blessures": blessures } ); await this.update( {"data.blessures": blessures } );
} }
await this.update({ "data.compteurs.ethylisme.value": 0 }); await this.update({ "data.compteurs.ethylisme.value": 1 });
await this.update({ "data.compteurs.ethylisme.nb_doses": 0 }); await this.update({ "data.compteurs.ethylisme.nb_doses": 0 });
await this.santeIncDec("vie", this.data.data.sante.vie.max - this.data.data.sante.vie.value); await this.santeIncDec("vie", this.data.data.sante.vie.max - this.data.data.sante.vie.value);
} await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
if (!this.isEntiteCauchemar()) {
if (this.data.data.sante.fatigue){ if (this.data.data.sante.fatigue){
let fatigue = duplicate(this.data.data.sante.fatigue) let fatigue = duplicate(this.data.data.sante.fatigue)
fatigue.value = 0; fatigue.value = 0;
@ -1760,6 +1762,13 @@ export class RdDActor extends Actor {
new RdDEncaisser(html, this ).render(true); new RdDEncaisser(html, this ).render(true);
} }
/* -------------------------------------------- */
async encaisser( ) {
let data = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() };
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
new RdDEncaisser(html, this).render(true);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async encaisserDommages( attackerRoll, attacker = undefined ) { async encaisserDommages( attackerRoll, attacker = undefined ) {
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) { if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {

View File

@ -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,9 @@ 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($("#etat-general"), !dialog._isIgnoreEtatGeneral(rollData));
HtmlUtility._showControlWhen($("#ajust-astrologique"), dialog._isAjustementAstrologique(rollData));
// Sort management // Sort management
if (rollData.selectedSort) { if (rollData.selectedSort) {
@ -137,9 +137,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 +228,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 +239,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);

View File

@ -4,7 +4,15 @@
<header class="sheet-header"> <header class="sheet-header">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" /> <img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" />
<div class="header-fields"> <div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1> <div class="flexrow">
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1>
</div>
<div class="flexrow flex-group-center flex-actions-bar">
<div>
<span id="encaisser-direct"><a title="Encaisser des dommages"><img class="button-img" src="icons/svg/bones.svg" alt="Encaisser des dommages"/></a></span>
<span id="remise-a-neuf" class="gm-only"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span>
</div>
</div>
<div class="flexrow"> <div class="flexrow">
<div class="flexrow"> <div class="flexrow">
<span>{{data.blessures.resume}}</span> <span>{{data.blessures.resume}}</span>

View File

@ -109,9 +109,14 @@
{{/if}} {{/if}}
{{#if carac.derivee}} {{#if carac.derivee}}
<label class="competence-value flexrow">{{carac.value}}</label> <label class="competence-value flexrow">{{carac.value}}</label>
<label class="competence-xp flexrow"/>
{{else}} {{else}}
<input class="carac-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.data.editCaracComp}}disabled{{/unless}} /> <input class="carac-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.data.editCaracComp}}disabled{{/unless}} />
{{#if carac.isTaille}}
<label class="competence-xp flexrow"/>
{{else}}
<input class="competence-xp flexrow" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}} /> <input class="competence-xp flexrow" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}} />
{{/if}}
{{/if}} {{/if}}
</li> </li>
{{/each}} {{/each}}

View File

@ -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>&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;&nbsp;<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"}}

View File

@ -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">
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
</div>
<div class="form-group"> <div class="form-group">
<label>Ajustement final : </label><label id="roll-param">10 / 0</label>&nbsp;&nbsp;&nbsp;<label name="addon-message" id="addon-message"></label> <label for="categorie">Ajustements</label>
<label for="categorie" id="etat-general">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>&nbsp;&nbsp;&nbsp;<label name="addon-message" id="addon-message"></label></label>
</div> </div>
<div id="resolutionTable"> <div id="resolutionTable">
</div> </div>

View File

@ -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">
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
</div>
<div class="form-group"> <div class="form-group">
<label>Ajustement final : </label><label id="roll-param">10 / 0</label>&nbsp;&nbsp;&nbsp;<label name="addon-message" id="addon-message"></label> <label for="categorie">Ajustements</label>
<label for="categorie" id="etat-general">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>&nbsp;&nbsp;&nbsp;<label name="addon-message" id="addon-message"></label></label>
</div> </div>
<div id="resolutionTable"> <div id="resolutionTable">
</div> </div>