Simplification des feuilles de créatures
* Homogénisation des fiches de créatures / entités * Regroupement d'onglets (peu de compétences/caracs) * ajout du bouton vue détaillée/simplifiée pour toutes les feuilles * la santé des créatures est dans l'en-tête * bouton pour boire pour els personnages * agrandissement des caractéristiques dérivées
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { RdDActorSheet } from "./actor-sheet.js";
|
||||
import { RdDCarac } from "./rdd-carac.js";
|
||||
@ -24,34 +23,11 @@ export class RdDActorCreatureSheet extends RdDActorSheet {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
let formData = await super.getData()
|
||||
//console.log("Creature : ", formData, formData.system)
|
||||
formData.calc = {
|
||||
caracTotal: RdDCarac.computeTotal(formData.system.carac),
|
||||
resumeBlessures: this.actor.computeResumeBlessure(formData.system.blessures),
|
||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||
surEncombrementMessage: this.actor.getMessageSurEncombrement()
|
||||
}
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
|
||||
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
|
||||
|
||||
console.log("Creature : ", this.objetVersConteneur, formData);
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @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;
|
||||
|
||||
|
@ -1,14 +1,8 @@
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { RdDActorSheet } from "./actor-sheet.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDActorEntiteSheet extends ActorSheet {
|
||||
export class RdDActorEntiteSheet extends RdDActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
@ -22,64 +16,14 @@ export class RdDActorEntiteSheet extends ActorSheet {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.actor.id,
|
||||
type: this.actor.type,
|
||||
img: this.actor.img,
|
||||
name: this.actor.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
system: foundry.utils.deepClone(this.actor.system),
|
||||
effects: this.actor.effects.map(e => foundry.utils.deepClone(e)),
|
||||
// items: items,
|
||||
limited: this.actor.limited,
|
||||
options: this.options,
|
||||
owner: this.actor.isOwner,
|
||||
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
|
||||
notesmj: await TextEditor.enrichHTML(this.object.system.notesmj, {async: true}),
|
||||
};
|
||||
|
||||
formData.options.isGM = game.user.isGM;
|
||||
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @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;
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
const item = this.actor.getEmbeddedDocument('Item', li.data("itemId"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
this.actor.deleteEmbeddedDocuments('Item', [li.data("itemId")]);
|
||||
li.slideUp(200, () => this.render(false));
|
||||
});
|
||||
|
||||
// Roll Carac
|
||||
html.find('.carac-label a').click(async event => {
|
||||
let caracName = event.currentTarget.attributes.name.value;
|
||||
this.actor.rollCarac( caracName.toLowerCase() );
|
||||
});
|
||||
|
||||
// On competence change
|
||||
html.find('.creature-carac').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
@ -93,53 +37,6 @@ export class RdDActorEntiteSheet extends ActorSheet {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
this.actor.updateCreatureCompetence( compName, "dommages", parseInt(event.target.value) );
|
||||
} );
|
||||
|
||||
// Roll Skill
|
||||
html.find('.competence-label a').click(async event => {
|
||||
let compName = event.currentTarget.text;
|
||||
this.actor.rollCompetence( compName );
|
||||
});
|
||||
|
||||
html.find('.endurance-plus').click(event => {
|
||||
this.actor.santeIncDec("endurance", 1);
|
||||
this.render(true);
|
||||
});
|
||||
html.find('.endurance-moins').click(event => {
|
||||
this.actor.santeIncDec("endurance", -1);
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
html.find('.encaisser-direct').click(event => {
|
||||
this.actor.encaisser();
|
||||
});
|
||||
|
||||
html.find('.remise-a-neuf').click(event => {
|
||||
if (game.user.isGM) {
|
||||
this.actor.remiseANeuf();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
setPosition(options = {}) {
|
||||
const position = super.setPosition(options);
|
||||
const sheetHeader = this.element.find(".sheet-header");
|
||||
const sheetTabs = this.element.find(".sheet-tabs");
|
||||
const sheetBody = this.element.find(".sheet-body");
|
||||
const bodyHeight = position.height - sheetHeader[0].clientHeight - sheetTabs[0].clientHeight;
|
||||
sheetBody.css("height", bodyHeight);
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
_updateObject(event, formData) {
|
||||
// Update the Actor
|
||||
return this.actor.update(formData);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
this.timerRecherche = undefined;
|
||||
|
||||
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.actor.id,
|
||||
@ -51,72 +51,70 @@ export class RdDActorSheet extends ActorSheet {
|
||||
limited: this.actor.limited,
|
||||
options: this.options,
|
||||
owner: this.actor.isOwner,
|
||||
biographie: await TextEditor.enrichHTML(this.object.system.biographie, {async: true}),
|
||||
notes: await TextEditor.enrichHTML(this.object.system.notes, {async: true}),
|
||||
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
|
||||
biographie: await TextEditor.enrichHTML(this.object.system.biographie, {async: true}),
|
||||
notes: await TextEditor.enrichHTML(this.object.system.notes, {async: true}),
|
||||
notesmj: await TextEditor.enrichHTML(this.object.system.notesmj, {async: true}),
|
||||
calc: {
|
||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
||||
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
|
||||
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
|
||||
caracTotal: RdDCarac.computeTotal(this.actor.system.carac, this.actor.system.beaute),
|
||||
surEncombrementMessage: this.actor.getMessageSurEncombrement(),
|
||||
},
|
||||
}
|
||||
formData.options.isGM = game.user.isGM;
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
|
||||
formData.options.isGM = game.user.isGM;
|
||||
|
||||
if (formData.type == 'creature') return formData; // Shortcut
|
||||
|
||||
formData.byCateg = Misc.classify(formData.competences, it => it.system.categorie)
|
||||
|
||||
formData.calc = {
|
||||
comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.competences),
|
||||
competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.competences),
|
||||
caracTotal: RdDCarac.computeTotal(formData.system.carac, formData.system.beaute),
|
||||
// Mise à jour de l'encombrement total et du prix de l'équipement
|
||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
||||
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
|
||||
fatigue: RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max),
|
||||
resumeBlessures: this.actor.computeResumeBlessure(formData.system.blessures),
|
||||
surEncombrementMessage: this.actor.getMessageSurEncombrement()
|
||||
};
|
||||
|
||||
formData.competences.forEach(item => {
|
||||
item.system.isVisible = this.options.recherche
|
||||
? RdDItemCompetence.nomContientTexte(item, this.options.recherche.text)
|
||||
: (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
|
||||
RdDItemCompetence.levelUp(item, formData.system.compteurs.experience.value);
|
||||
});
|
||||
Object.values(formData.system.carac).forEach(c => {
|
||||
RdDCarac.levelUp(c);
|
||||
});
|
||||
|
||||
|
||||
// toujours avoir une liste d'armes (pour mettre esquive et corps à corps)
|
||||
formData.combat = duplicate(formData.armes ?? []);
|
||||
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences);
|
||||
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.system.carac);
|
||||
formData.esquives = this.actor.getCompetences("Esquive");
|
||||
formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac);
|
||||
|
||||
this.armesList = formData.combat;
|
||||
|
||||
// Common data
|
||||
formData.ajustementsConditions = CONFIG.RDD.ajustementsConditions;
|
||||
formData.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
||||
|
||||
formData.hautreve = {
|
||||
isDemiReve: this.actor.getEffect(STATUSES.StatusDemiReve),
|
||||
rencontres: duplicate(formData.system.reve.rencontre.list),
|
||||
cacheTMR: this.actor.isTMRCache()
|
||||
}
|
||||
|
||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
|
||||
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
|
||||
|
||||
formData.subacteurs = {
|
||||
vehicules: this.actor.listeVehicules(),
|
||||
montures: this.actor.listeMontures(),
|
||||
suivants: this.actor.listeSuivants()
|
||||
}
|
||||
if (this.actor.getBestDraconic().system.niveau > -11 && !this.actor.isHautRevant()) {
|
||||
ui.notifications.error(`${this.actor.name} a des compétences draconiques, mais pas le don de Haut-Rêve!
|
||||
<br>Ajoutez-lui la tête "Don de Haut-Rêve" pour lui permettre d'utiliser ses compétences et d'accéder aux terres médianes du rêve`);
|
||||
if (formData.type == 'personnage') {
|
||||
formData.byCateg = Misc.classify(formData.competences, it => it.system.categorie)
|
||||
formData.calc.comptageArchetype = RdDItemCompetence.computeResumeArchetype(formData.competences);
|
||||
formData.calc.competenceXPTotal= RdDItemCompetence.computeTotalXP(formData.competences);
|
||||
formData.calc.fatigue= RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max);
|
||||
|
||||
formData.competences.forEach(item => {
|
||||
item.system.isVisible = this.options.recherche
|
||||
? RdDItemCompetence.nomContientTexte(item, this.options.recherche.text)
|
||||
: (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
|
||||
RdDItemCompetence.levelUp(item, formData.system.compteurs.experience.value);
|
||||
});
|
||||
|
||||
Object.values(formData.system.carac).forEach(c => {
|
||||
RdDCarac.levelUp(c);
|
||||
});
|
||||
|
||||
// toujours avoir une liste d'armes (pour mettre esquive et corps à corps)
|
||||
formData.combat = duplicate(formData.armes ?? []);
|
||||
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences);
|
||||
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.system.carac);
|
||||
formData.esquives = this.actor.getCompetences("Esquive");
|
||||
formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac);
|
||||
|
||||
this.armesList = formData.combat;
|
||||
|
||||
// Common data
|
||||
formData.ajustementsConditions = CONFIG.RDD.ajustementsConditions;
|
||||
formData.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
||||
|
||||
formData.hautreve = {
|
||||
isDemiReve: this.actor.getEffect(STATUSES.StatusDemiReve),
|
||||
rencontres: duplicate(formData.system.reve.rencontre.list),
|
||||
cacheTMR: this.actor.isTMRCache()
|
||||
}
|
||||
|
||||
formData.subacteurs = {
|
||||
vehicules: this.actor.listeVehicules(),
|
||||
montures: this.actor.listeMontures(),
|
||||
suivants: this.actor.listeSuivants()
|
||||
}
|
||||
if (this.actor.getBestDraconic().system.niveau > -11 && !this.actor.isHautRevant()) {
|
||||
ui.notifications.error(`${this.actor.name} a des compétences draconiques, mais pas le don de Haut-Rêve!
|
||||
<br>Ajoutez-lui la tête "Don de Haut-Rêve" pour lui permettre d'utiliser ses compétences et d'accéder aux terres médianes du rêve`);
|
||||
}
|
||||
}
|
||||
return formData;
|
||||
}
|
||||
@ -156,7 +154,6 @@ export class RdDActorSheet extends ActorSheet {
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
|
||||
HtmlUtility._showControlWhen($(".appliquerFatigue"), ReglesOptionelles.isUsing("appliquer-fatigue"));
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
@ -168,7 +165,6 @@ export class RdDActorSheet extends ActorSheet {
|
||||
});
|
||||
html.find('.item-edit').click(async event => {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor)
|
||||
console.log("ITEM :", item)
|
||||
item.sheet.render(true)
|
||||
})
|
||||
html.find('.display-label a').click(async event => {
|
||||
@ -497,7 +493,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
html.find('.moral-heureux').click(async event => {
|
||||
this.actor.jetDeMoral('heureuse');
|
||||
});
|
||||
html.find('#ethylisme-test').click(async event => {
|
||||
html.find('.ethylisme-test').click(async event => {
|
||||
this.actor.jetEthylisme();
|
||||
});
|
||||
|
||||
@ -570,7 +566,10 @@ export class RdDActorSheet extends ActorSheet {
|
||||
const sheetHeader = this.element.find(".sheet-header");
|
||||
const sheetTabs = this.element.find(".sheet-tabs");
|
||||
const sheetBody = this.element.find(".sheet-body");
|
||||
const bodyHeight = position.height - sheetHeader[0].clientHeight - sheetTabs[0].clientHeight;
|
||||
let bodyHeight = position.height - sheetHeader[0].clientHeight;
|
||||
if (sheetTabs.length>0) {
|
||||
bodyHeight -= sheetTabs[0].clientHeight;
|
||||
}
|
||||
sheetBody.css("height", bodyHeight);
|
||||
return position;
|
||||
}
|
||||
|
@ -1,15 +1,9 @@
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDSheetUtility } from "./rdd-sheet-utility.js";
|
||||
import { RdDActorSheet } from "./actor-sheet.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDActorVehiculeSheet extends ActorSheet {
|
||||
export class RdDActorVehiculeSheet extends RdDActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
@ -25,142 +19,5 @@ export class RdDActorVehiculeSheet extends ActorSheet {
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.actor.id,
|
||||
type: this.actor.type,
|
||||
img: this.actor.img,
|
||||
name: this.actor.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
system: foundry.utils.deepClone(this.actor.system),
|
||||
effects: this.actor.effects.map(e => foundry.utils.deepClone(e)),
|
||||
limited: this.actor.limited,
|
||||
options: this.options,
|
||||
owner: this.actor.isOwner,
|
||||
description: await TextEditor.enrichHTML(this.object.system.biographie, {async: true}),
|
||||
notesmj: await TextEditor.enrichHTML(this.object.system.notesmj, {async: true}),
|
||||
};
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
|
||||
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
|
||||
|
||||
formData.options.isGM = game.user.isGM;
|
||||
|
||||
formData.calc = {
|
||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||
surEncombrementMessage: this.actor.getMessageSurEncombrement()
|
||||
}
|
||||
|
||||
console.log("DATA", formData);
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
async computeMalusArmure() {
|
||||
// pas de malus armure
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async _onDropItem(event, dragData) {
|
||||
const destItemId = $(event.target)?.closest('.item').attr('data-item-id');
|
||||
const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor.id, dragData, this.objetVersConteneur);
|
||||
const callSuper = await this.actor.processDropItem(dropParams);
|
||||
if (callSuper) {
|
||||
await super._onDropItem(event, dragData)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async createItem(name, type) {
|
||||
await this.actor.createEmbeddedDocuments('Item', [{ name: name, type: type }], { renderSheet: true });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async monnaieIncDec(id, value) {
|
||||
let monnaie = this.getMonnaie(id);
|
||||
if (monnaie) {
|
||||
const quantite = Math.max(0, monnaie.system.quantite + value);
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'data.quantite': quantite }]);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @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;
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(async event => {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor);
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(async event => {
|
||||
const li = RdDSheetUtility.getEventElement(event);
|
||||
const item = this.actor.getObjet(li.data("item-id"));
|
||||
RdDUtility.confirmerSuppressionItem(this, item, li);
|
||||
});
|
||||
html.find('.item-vendre').click(async event => {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor);
|
||||
item?.proposerVente();
|
||||
});
|
||||
html.find('.item-montrer').click(async event => {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor);
|
||||
item?.postItem();
|
||||
});
|
||||
|
||||
html.find('.item-action').click(async event => {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor);
|
||||
this.actor.actionItem(item);
|
||||
});
|
||||
|
||||
html.find('.creer-un-objet').click(async event => {
|
||||
RdDUtility.selectObjetType(this);
|
||||
});
|
||||
html.find('.nettoyer-conteneurs').click(async event => {
|
||||
this.actor.nettoyerConteneurs();
|
||||
});
|
||||
|
||||
html.find('.monnaie-plus').click(async event => {
|
||||
this.actor.monnaieIncDec(RdDSheetUtility.getItemId(event), 1);
|
||||
});
|
||||
html.find('.monnaie-moins').click(async event => {
|
||||
this.actor.monnaieIncDec(RdDSheetUtility.getItemId(event), -1);
|
||||
});
|
||||
|
||||
// Display info about queue
|
||||
html.find('.conteneur-name a').click((event) => {
|
||||
RdDUtility.toggleAfficheContenu(RdDSheetUtility.getItemId(event));
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
setPosition(options = {}) {
|
||||
const position = super.setPosition(options);
|
||||
const sheetHeader = this.element.find(".sheet-header");
|
||||
const sheetTabs = this.element.find(".sheet-tabs");
|
||||
const sheetBody = this.element.find(".sheet-body");
|
||||
const bodyHeight = position.height - sheetHeader[0].clientHeight - sheetTabs[0].clientHeight;
|
||||
sheetBody.css("height", bodyHeight);
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
_updateObject(event, formData) {
|
||||
// Update the Actor
|
||||
return this.actor.update(formData);
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,6 @@ export class RdDActor extends Actor {
|
||||
this.computeIsHautRevant();
|
||||
await this.cleanupConteneurs();
|
||||
await this.computeEncombrementTotalEtMalusArmure();
|
||||
this.computePrixTotalEquipement();
|
||||
this.computeEtatGeneral();
|
||||
// Sanity check
|
||||
await this.checkMonnaiePresence();
|
||||
@ -1359,14 +1358,15 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async computeMalusArmure() {
|
||||
const newMalusArmure = this.filterItems(it => it.type == 'armure' && it.system.equipe)
|
||||
if (this.isPersonnage()) {
|
||||
const malusArmure = this.filterItems(it => it.type == 'armure' && it.system.equipe)
|
||||
.map(it => it.system.malus ?? 0)
|
||||
.reduce(Misc.sum(), 0);
|
||||
// Mise à jour éventuelle du malus armure
|
||||
if (this.system.attributs?.malusarmure?.value != newMalusArmure) {
|
||||
await this.updateAttributeValue("malusarmure", newMalusArmure);
|
||||
// Mise à jour éventuelle du malus armure
|
||||
if (this.system.attributs?.malusarmure?.value != malusArmure) {
|
||||
await this.updateAttributeValue("malusarmure", malusArmure);
|
||||
}
|
||||
}
|
||||
return newMalusArmure;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2557,11 +2557,13 @@ export class RdDActor extends Actor {
|
||||
if (rollData.competence.system.iscombat) {
|
||||
if (rollData.competence.system.ispossession) {
|
||||
RdDPossession.onAttaquePossession(this, rollData.competence)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
else if (RdDCombat.getTarget()) {
|
||||
const arme = RdDItemCompetenceCreature.toActionArme(rollData.competence)
|
||||
RdDCombat.createUsingTarget(this)?.attaque(competence, arme)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
// Fake competence pour créature
|
||||
RdDItemCompetenceCreature.setRollDataCreature(rollData)
|
||||
@ -3270,7 +3272,6 @@ export class RdDActor extends Actor {
|
||||
let update = { _id: item.id, "system.equipe": isEquipe };
|
||||
await this.updateEmbeddedDocuments('Item', [update]);
|
||||
this.computeEncombrementTotalEtMalusArmure(); // Mise à jour encombrement
|
||||
this.computePrixTotalEquipement(); // Mis à jour du prix total de l'équipement
|
||||
if (isEquipe)
|
||||
this.verifierForceMin(item);
|
||||
}
|
||||
|
@ -534,9 +534,7 @@ export class RdDCalendrier extends Application {
|
||||
async activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
|
||||
|
||||
await this.updateDisplay();
|
||||
this.updateDisplay();
|
||||
|
||||
html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
|
||||
|
||||
|
@ -62,7 +62,7 @@ export class RdDCarac {
|
||||
|
||||
|
||||
static computeTotal(carac, beaute = undefined) {
|
||||
const total = Object.values(carac).filter(c => !c.derivee)
|
||||
const total = Object.values(carac ?? {}).filter(c => !c.derivee)
|
||||
.map(it => parseInt(it.value))
|
||||
.reduce(Misc.sum(), 0);
|
||||
const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0);
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { DialogSplitItem } from "./dialog-split-item.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
export class RdDSheetUtility {
|
||||
|
||||
|
@ -112,14 +112,28 @@ export class RdDUtility {
|
||||
static async preloadHandlebarsTemplates() {
|
||||
const templatePaths = [
|
||||
//Character Sheets
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-creation-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html',
|
||||
// sous-parties de feuilles de personnages
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/header-buttons.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/header-etat.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-creature.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-entitee.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/carac-creature.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/carac-entitee.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/carac-total.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/competence.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/categorie-competences.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/effects.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/xp-competences.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/combat.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html',
|
||||
|
Reference in New Issue
Block a user