Merge branch 'encaisser-remiseaneuf' into 'v1.2'
Encaisser remiseaneuf See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!89
This commit is contained in:
commit
97a6ef408d
@ -4,6 +4,7 @@
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -64,7 +65,9 @@ export class RdDActorCreatureSheet 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,7 +150,17 @@ export class RdDActorCreatureSheet 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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -4,6 +4,7 @@
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -55,6 +56,8 @@ export class RdDActorEntiteSheet extends ActorSheet {
|
||||
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;
|
||||
|
||||
@ -106,6 +109,17 @@ export class RdDActorEntiteSheet 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();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { RdDEncaisser } from "./rdd-roll-encaisser.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -132,13 +131,6 @@ export class RdDActorSheet extends ActorSheet {
|
||||
return data;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async displayDialogEncaisser( ) {
|
||||
let data = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() };
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data );
|
||||
new RdDEncaisser(html, this.actor ).render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onDrop(event) {
|
||||
await RdDUtility.processItemDropEvent(this, event);
|
||||
@ -253,7 +245,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
});
|
||||
|
||||
html.find('#encaisser-direct').click(ev => {
|
||||
this.displayDialogEncaisser()
|
||||
this.actor.encaisser();
|
||||
});
|
||||
|
||||
html.find('#remise-a-neuf').click(ev => {
|
||||
|
@ -11,7 +11,7 @@ import { RdDRollTables } from "./rdd-rolltables.js";
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { RdDItemSort } from "./item-sort.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RdDEncaisser } from "./rdd-roll-encaisser.js";
|
||||
import { RdDCombat } from "./rdd-combat.js";
|
||||
|
||||
/**
|
||||
@ -210,7 +210,7 @@ export class RdDActor extends Actor {
|
||||
console.log("dormirChateauDormant", blessures)
|
||||
await this._recupererBlessures(message, "legere", blessures.legeres.liste.filter(b => b.active), []);
|
||||
await this._recupererBlessures(message, "grave", blessures.graves.liste.filter(b => b.active), blessures.legeres.liste);
|
||||
await this._recupererBlessures(message,"legere", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste);
|
||||
await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste);
|
||||
await this.update( {"data.blessures": blessures } );
|
||||
await this._recupererVie(message);
|
||||
await this.transformerStress(message);
|
||||
@ -309,23 +309,27 @@ export class RdDActor extends Actor {
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs( this.name ),
|
||||
content : "Remise à neuf de " + this.name
|
||||
};
|
||||
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]) {
|
||||
for (let blessure of listeBlessures) {
|
||||
this._supprimerBlessure(blessure);
|
||||
if (!this.isEntiteCauchemar()) {
|
||||
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]) {
|
||||
for (let blessure of listeBlessures) {
|
||||
this._supprimerBlessure(blessure);
|
||||
}
|
||||
}
|
||||
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.nb_doses": 0 });
|
||||
await this.santeIncDec("vie", this.data.data.sante.vie.max - this.data.data.sante.vie.value);
|
||||
}
|
||||
await this.update({ "data.compteurs.ethylisme.value": 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("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;
|
||||
await this.update( {"data.sante.fatigue": fatigue } );
|
||||
if (!this.isEntiteCauchemar()) {
|
||||
if (this.data.data.sante.fatigue){
|
||||
let fatigue = duplicate(this.data.data.sante.fatigue)
|
||||
fatigue.value = 0;
|
||||
await this.update( {"data.sante.fatigue": fatigue } );
|
||||
}
|
||||
}
|
||||
ChatMessage.create( message );
|
||||
}
|
||||
@ -1572,7 +1576,7 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async ajouteNombreAstral( data ) {
|
||||
// Gestion expérience (si existante)
|
||||
this.appliquerExperience( request.rolled, "vue", "astrologie");
|
||||
this.appliquerExperience( data.rolled, "vue", "astrologie");
|
||||
|
||||
// Ajout du nombre astral
|
||||
const item = {name: "Nombre Astral", type: "nombreastral", data:
|
||||
@ -1749,6 +1753,13 @@ export class RdDActor extends Actor {
|
||||
return protection;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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')) {
|
||||
|
@ -205,6 +205,7 @@ export class RdDCombat {
|
||||
return rollData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_modifieRollDataCreature(rollData, competence) {
|
||||
competence = duplicate(competence);
|
||||
competence.data.defaut_carac = "carac_creature";
|
||||
@ -283,6 +284,7 @@ export class RdDCombat {
|
||||
RdDCombat._sendRollMessage(this.attacker, this.defender, this.defenderTokenId, "msg_defense", message, rollData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_buildMessageDefense(rollData) {
|
||||
let message = "<strong>" + this.defender.name + "</strong> doit se défendre :<span class='chat-card-button-area'>";
|
||||
|
||||
@ -303,6 +305,7 @@ export class RdDCombat {
|
||||
return message;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_buildMessageEncaisser(rollData) {
|
||||
return "<br><a class='chat-card-button' id='encaisser-button' data-attackerId='" + this.attackerId + "' data-defenderTokenId='" + this.defenderTokenId + "'>Encaisser à " + Misc.toSignedString(rollData.dmg.total) + " !</a>";
|
||||
}
|
||||
@ -521,6 +524,7 @@ export class RdDCombat {
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_prepareEsquive(attackerRoll, competence) {
|
||||
let rollData = {
|
||||
forceValue: this.defender.getForceValue(),
|
||||
|
@ -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>
|
||||
|
@ -4,9 +4,17 @@
|
||||
<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>
|
||||
</header>
|
||||
</header>
|
||||
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
|
Loading…
Reference in New Issue
Block a user