Merge branch 'quick-fixes' into 'v1.2'
Quick fixes See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!91
This commit is contained in:
commit
30d8881cb6
@ -1,11 +1,9 @@
|
||||
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDActorEntiteSheet extends ActorSheet {
|
||||
@ -55,7 +53,7 @@ export class RdDActorEntiteSheet extends ActorSheet {
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
|
||||
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
@ -119,7 +117,6 @@ export class RdDActorEntiteSheet extends ActorSheet {
|
||||
this.actor.remiseANeuf();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
*/
|
||||
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* -------------------------------------------- */
|
||||
export class RdDActorHumanoideSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
@ -64,7 +64,9 @@ export class RdDActorHumanoideSheet extends ActorSheet {
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
|
||||
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
@ -147,6 +149,16 @@ export class RdDActorHumanoideSheet extends ActorSheet {
|
||||
this.actor.santeIncDec("endurance", -1);
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,7 +130,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onDrop(event) {
|
||||
await RdDUtility.processItemDropEvent(this, event);
|
||||
|
@ -309,7 +309,11 @@ export class RdDActor extends Actor {
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs( 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){
|
||||
const blessures = duplicate(this.data.data.blessures);
|
||||
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.compteurs.ethylisme.value": 0 });
|
||||
await this.update({ "data.compteurs.ethylisme.value": 1 });
|
||||
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("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
|
||||
if (!this.isEntiteCauchemar()) {
|
||||
await this.santeIncDec("endurance", this.data.data.sante.endurance.max - this.data.data.sante.endurance.value);
|
||||
if (this.data.data.sante.fatigue){
|
||||
let fatigue = duplicate(this.data.data.sante.fatigue)
|
||||
fatigue.value = 0;
|
||||
@ -1760,6 +1762,13 @@ export class RdDActor extends Actor {
|
||||
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 ) {
|
||||
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
||||
|
@ -108,11 +108,9 @@ export class RdDRoll extends Dialog {
|
||||
var dialog = this;
|
||||
|
||||
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.finalLevel = rollLevel;
|
||||
rollData.caracValue = caracValue;
|
||||
rollData.finalLevel = dialog._computeFinalLevel(rollData);
|
||||
rollData.caracValue = parseInt(rollData.selectedCarac.value);
|
||||
rollData.coupsNonMortels = (rollData.attackerRoll ? rollData.attackerRoll.dmg.mortalite : rollData.dmg.mortalite) == 'non-mortel';
|
||||
let dmgText = Misc.toSignedString(rollData.dmg.total);
|
||||
if (rollData.coupsNonMortels) {
|
||||
@ -120,7 +118,9 @@ export class RdDRoll extends Dialog {
|
||||
}
|
||||
|
||||
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
|
||||
if (rollData.selectedSort) {
|
||||
@ -137,9 +137,9 @@ export class RdDRoll extends Dialog {
|
||||
$("#dmg-arme-actor").text(dmgText);
|
||||
$("#defenseur-surprise").text(RdDBonus.description(rollData.surpriseDefenseur));
|
||||
$(".table-resolution").remove();
|
||||
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel));
|
||||
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(rollData.caracValue, rollData.finalLevel));
|
||||
$(".span-valeur").remove();
|
||||
$("#resolutionValeurs").append(RdDResolutionTable.buildHTMLResults(caracValue, rollLevel));
|
||||
$("#resolutionValeurs").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel));
|
||||
}
|
||||
|
||||
// Setup everything onload
|
||||
@ -228,7 +228,7 @@ export class RdDRoll extends Dialog {
|
||||
const malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0;
|
||||
const bonusTactique = RdDBonus.bonusAttaque(rollData.tactique);
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
_isAjustementAstrologique(rollData) {
|
||||
if (rollData.selectedCarac.label.toLowerCase().includes('chance')) {
|
||||
return true;
|
||||
}
|
||||
if (rollData.selectedSort && rollData.selectedSort.data.isrituel) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
_computeDiffCompetence(rollData) {
|
||||
if (rollData.competence) {
|
||||
return Misc.toInt(rollData.competence.data.niveau);
|
||||
|
@ -4,7 +4,15 @@
|
||||
<header class="sheet-header">
|
||||
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" />
|
||||
<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">
|
||||
<span>{{data.blessures.resume}}</span>
|
||||
|
@ -109,9 +109,14 @@
|
||||
{{/if}}
|
||||
{{#if carac.derivee}}
|
||||
<label class="competence-value flexrow">{{carac.value}}</label>
|
||||
<label class="competence-xp flexrow"/>
|
||||
{{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}} />
|
||||
{{#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}} />
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/each}}
|
||||
|
@ -60,8 +60,10 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="form-group">
|
||||
<label for="categorie">Etat général:</label><label>{{numberFormat etat 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 for="categorie">Ajustements</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>
|
||||
|
||||
{{>"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>
|
||||
</div>
|
||||
{{>"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">
|
||||
<label>Ajustement final : </label><label id="roll-param">10 / 0</label> <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> <label name="addon-message" id="addon-message"></label></label>
|
||||
</div>
|
||||
<div id="resolutionTable">
|
||||
</div>
|
||||
|
@ -1,8 +1,6 @@
|
||||
<form class="dialog-roll-sort">
|
||||
<h2 class="compdialog" id="sort-dialog"></h2>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@ -59,11 +57,11 @@
|
||||
</select>
|
||||
</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">
|
||||
<label>Ajustement final : </label><label id="roll-param">10 / 0</label> <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> <label name="addon-message" id="addon-message"></label></label>
|
||||
</div>
|
||||
<div id="resolutionTable">
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user