Big WIP...

This commit is contained in:
sladecraven 2022-06-12 08:17:59 +02:00
parent a3fb328b7d
commit 451ee677d2
56 changed files with 990 additions and 921 deletions

View File

@ -27,8 +27,8 @@ export class RdDActorCreatureSheet extends RdDActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
let formData = await super.getData(); let formData = await super.getData()
console.log("Creature : ", formData); //console.log("Creature : ", formData, formData.system)
formData.calc = { formData.calc = {
caracTotal: RdDCarac.computeTotal(formData.data.carac), caracTotal: RdDCarac.computeTotal(formData.data.carac),
resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures), resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures),

View File

@ -22,33 +22,26 @@ export class RdDActorEntiteSheet extends ActorSheet {
}); });
} }
/* -------------------------------------------- */
_checkNull(items) {
if (items && items.length) {
return items;
}
return [];
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = Misc.data(this.object); const objectData = Misc.data(this.object);
let formData = { let formData = {
title: this.title, title: this.title,
id: this.object.id, id: objectData.id,
type: this.object.type, type: objectData.type,
img: this.object.img, img: objectData.img,
name: this.object.name, name: objectData.name,
// actor: this.object, // actor: this.object,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
data: foundry.utils.deepClone(Misc.templateData(this.object)), data: foundry.utils.deepClone(this.actor.system),
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)), effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
// items: items, // items: items,
limited: this.object.limited, limited: this.object.limited,
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.document.isOwner,
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))), itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i.system))),
}; };
formData.options.isGM = game.user.isGM; formData.options.isGM = game.user.isGM;

View File

@ -36,10 +36,9 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = Misc.data(this.object) const objectData = this.object.system
//this.actor.checkMonnaiePresence(this.actor.data.items); // Always check
console.log("New actor", objectData)
let formData = { let formData = {
title: this.title, title: this.title,
id: this.object.id, id: this.object.id,
@ -48,15 +47,14 @@ export class RdDActorSheet extends ActorSheet {
name: this.object.name, name: this.object.name,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
data: foundry.utils.deepClone(this.object.system), data: foundry.utils.deepClone(this.actor.system),
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)), effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
limited: this.object.limited, limited: this.object.limited,
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.document.isOwner,
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))), itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))),
}; }
console.log("ACTOR DATA:", formData) console.log("BUILD",formData.itemsByType, this.object.items )
RdDUtility.filterItemsPerTypeForSheet(formData) RdDUtility.filterItemsPerTypeForSheet(formData)
formData.options.isGM = game.user.isGM; formData.options.isGM = game.user.isGM;
@ -79,12 +77,11 @@ export class RdDActorSheet extends ActorSheet {
}; };
formData.competences.forEach(item => { formData.competences.forEach(item => {
console.log('Comp', item) item.system.visible = this.options.cherchercompetence
item.isVisible = this.options.cherchercompetence
? RdDItemCompetence.nomContientTexte(item, this.options.cherchercompetence) ? RdDItemCompetence.nomContientTexte(item, this.options.cherchercompetence)
: (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item)); : (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value) RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value);
}) });
Object.values(formData.data.carac).forEach(c => { Object.values(formData.data.carac).forEach(c => {
RdDCarac.levelUp(c); RdDCarac.levelUp(c);
@ -92,11 +89,11 @@ export class RdDActorSheet extends ActorSheet {
// toujours avoir une liste d'armes (pour mettre esquive et corps à corps) // toujours avoir une liste d'armes (pour mettre esquive et corps à corps)
formData.combat = duplicate(formData.armes ?? []) formData.combat = duplicate(formData.armes ?? []);
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences) RdDItemArme.computeNiveauArmes(formData.combat, formData.competences);
/* TODO TODO RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac)*/ RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac);
formData.esquives = this.actor.getCompetences("Esquive").map(i => foundry.utils.deepClone(i.system)) formData.esquives = this.actor.getCompetences("Esquive").map(i => foundry.utils.deepClone(i.system))
formData.combat = RdDCombatManager.finalizeArmeList(formData.combat, formData.competences, formData.data.carac) formData.combat = RdDCombatManager.finalizeArmeList(formData.combat, formData.competences, formData.data.carac);
this.armesList = formData.combat; this.armesList = formData.combat;
@ -169,13 +166,14 @@ export class RdDActorSheet extends ActorSheet {
if (!this.options.editable) return; if (!this.options.editable) return;
html.find('.item-split').click(async event => { html.find('.item-split').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor) const item = RdDSheetUtility.getItem(event, this.actor);
RdDSheetUtility.splitItem(item, this.actor) RdDSheetUtility.splitItem(item, this.actor);
}); });
html.find('.item-edit').click(async event => { html.find('.item-edit').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor) const item = RdDSheetUtility.getItem(event, this.actor)
console.log("ITEM :", item)
item.sheet.render(true) item.sheet.render(true)
}); })
html.find('.display-label a').click(async event => { html.find('.display-label a').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor); const item = RdDSheetUtility.getItem(event, this.actor);
item.sheet.render(true); item.sheet.render(true);
@ -197,7 +195,7 @@ export class RdDActorSheet extends ActorSheet {
}); });
html.find('.item-action').click(async event => { html.find('.item-action').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor); const item = RdDSheetUtility.getItem(event, this.actor)
this.actor.actionItem(item); this.actor.actionItem(item);
}); });
html.find('.subacteur-delete').click(async event => { html.find('.subacteur-delete').click(async event => {
@ -207,8 +205,11 @@ export class RdDActorSheet extends ActorSheet {
html.find('.encaisser-direct').click(async event => { html.find('.encaisser-direct').click(async event => {
this.actor.encaisser(); this.actor.encaisser();
}); })
html.find('.sheet-possession-attack').click(async event => {
const poss = RdDSheetUtility.getItem(event, this.actor)
this.actor.conjurerPossession(poss)
})
html.find('.remise-a-neuf').click(async event => { html.find('.remise-a-neuf').click(async event => {
if (game.user.isGM) { if (game.user.isGM) {
this.actor.remiseANeuf(); this.actor.remiseANeuf();
@ -254,7 +255,7 @@ export class RdDActorSheet extends ActorSheet {
// Equip Inventory Item // Equip Inventory Item
html.find('.item-equip').click(async event => { html.find('.item-equip').click(async event => {
this.actor.equiperObjet(RdDSheetUtility.getItemId(event)) this.actor.equiperObjet(RdDSheetUtility.getItemId(event));
}); });
// Roll Carac // Roll Carac
@ -326,8 +327,8 @@ export class RdDActorSheet extends ActorSheet {
// Roll Weapon1 // Roll Weapon1
html.find('.arme-label a').click(async event => { html.find('.arme-label a').click(async event => {
let arme = this._getEventArmeCombat(event) let arme = this._getEventArmeCombat(event);
this.actor.rollArme(duplicate(arme)) this.actor.rollArme(duplicate(arme));
}); });
// Initiative pour l'arme // Initiative pour l'arme
html.find('.arme-initiative a').click(async event => { html.find('.arme-initiative a').click(async event => {
@ -387,9 +388,9 @@ export class RdDActorSheet extends ActorSheet {
this.actor.updateCarac(caracName, parseInt(event.target.value)); this.actor.updateCarac(caracName, parseInt(event.target.value));
}); });
html.find('.carac-xp').change(async event => { html.find('.carac-xp').change(async event => {
let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "") let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", "");
//console.log("Value changed :", event, caracName) //console.log("Value changed :", event, caracName);
this.actor.updateCaracXP(caracName, parseInt(event.target.value)) this.actor.updateCaracXP(caracName, parseInt(event.target.value));
}); });
// On competence change // On competence change
html.find('.competence-value').change(async event => { html.find('.competence-value').change(async event => {
@ -513,17 +514,15 @@ export class RdDActorSheet extends ActorSheet {
}); });
} }
/* -------------------------------------------- */
_getEventArmeCombat(event) { _getEventArmeCombat(event) {
const li = $(event.currentTarget)?.parents(".item") const li = $(event.currentTarget)?.parents(".item");
let armeName = li.data("arme-name") let armeName = li.data("arme-name");
let compName = li.data('competence-name') let compName = li.data('competence-name');
console.log("Searching for", armeName, compName) const arme = this.armesList.find(a => a.name == armeName && a.data.competence == compName);
const arme = this.armesList.find(a => a.name == armeName && a.system.competence == compName)
if (!arme) { if (!arme) {
return { name: armeName, data: { competence: compName } } return { name: armeName, data: { competence: compName } };
} }
return arme return arme;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -552,9 +551,10 @@ export class RdDActorSheet extends ActorSheet {
} }
async _onSplitItem(item, split) { async _onSplitItem(item, split) {
if (split >= 1 && split < item.system.quantite) { if (split >= 1 && split < Misc.data(item).data.quantite) {
await item.diminuerQuantite(split) await item.diminuerQuantite(split);
item.system.quantite = split; const itemData = duplicate(Misc.data(item));
itemData.data.quantite = split;
await this.actor.createEmbeddedDocuments('Item', [itemData]) await this.actor.createEmbeddedDocuments('Item', [itemData])
} }
} }

View File

@ -25,14 +25,6 @@ export class RdDActorVehiculeSheet extends ActorSheet {
}); });
} }
/* -------------------------------------------- */
_checkNull(items) {
if (items && items.length) {
return items;
}
return [];
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = Misc.data(this.object); const objectData = Misc.data(this.object);
@ -68,6 +60,9 @@ export class RdDActorVehiculeSheet extends ActorSheet {
return formData; return formData;
} }
async computeMalusArmure() {
// pas de malus armure
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDropItem(event, dragData) { async _onDropItem(event, dragData) {
const destItemId = $(event.target)?.closest('.item').attr('data-item-id'); const destItemId = $(event.target)?.closest('.item').attr('data-item-id');

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,6 @@ export class ChatUtility {
} }
} }
/* -------------------------------------------- */
static onNotifyUser(data) { static onNotifyUser(data) {
if (game.user.id == data.userId) { if (game.user.id == data.userId) {
switch (data.level) { switch (data.level) {
@ -47,15 +46,28 @@ export class ChatUtility {
static onRemoveMessages(data) { static onRemoveMessages(data) {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
if (data.part) { if (data.part) {
const toDelete = game.messages.filter(it => it.content.includes(data.part)) const toDelete = game.messages.filter(it => it.data.content.includes(data.part));
toDelete.forEach(it => it.delete()) toDelete.forEach(it => it.delete());
} }
if (data.messageId) { if (data.messageId) {
game.messages.get(data.messageId)?.delete() game.messages.get(data.messageId)?.delete();
}
}
}
static onRemoveMessages(data) {
if (Misc.isUniqueConnectedGM()) {
if (data.part) {
const toDelete = game.messages.filter(it => it.content.includes(data.part));
toDelete.forEach(it => it.delete());
}
if (data.messageId) {
game.messages.get(data.messageId)?.delete();
} }
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static removeMessages(data) { static removeMessages(data) {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
ChatUtility.onRemoveMessages(data); ChatUtility.onRemoveMessages(data);
@ -78,7 +90,7 @@ export class ChatUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async createChatWithRollMode(name, chatOptions) { static async createChatWithRollMode(name, chatOptions) {
return await ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions) return await ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -129,7 +141,7 @@ export class ChatUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getUsers(filter) { static getUsers(filter) {
return Misc.getUsers().filter(filter).map(user => user.id) return Misc.getUsers().filter(filter).map(user => user.data._id);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -150,20 +162,17 @@ export class ChatUtility {
} }
} }
/* -------------------------------------------- */
static async setMessageData(chatMessage, key, data) { static async setMessageData(chatMessage, key, data) {
if (data) { if (data) {
await chatMessage.setFlag(SYSTEM_RDD, key, JSON.stringify(data)); await chatMessage.setFlag(SYSTEM_RDD, key, JSON.stringify(data));
} }
} }
/* -------------------------------------------- */
static getMessageData(chatMessage, key) { static getMessageData(chatMessage, key) {
const json = chatMessage.getFlag(SYSTEM_RDD, key); const json = chatMessage.getFlag(SYSTEM_RDD, key);
return json ? JSON.parse(json) : undefined; return json ? JSON.parse(json) : undefined;
} }
/* -------------------------------------------- */
static getChatMessage(event) { static getChatMessage(event) {
const chatMessageId = $(event.currentTarget).closest('.chat-message').attr('data-message-id'); const chatMessageId = $(event.currentTarget).closest('.chat-message').attr('data-message-id');
return game.messages.get(chatMessageId); return game.messages.get(chatMessageId);

View File

@ -10,7 +10,7 @@ export class DialogCreateSigneDraconique extends Dialog {
const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
let dialogData = { let dialogData = {
signe: signe, signe: signe,
tmrs: TMRUtility.listSelectedTMR(signe.system.typesTMR ?? []), tmrs: TMRUtility.listSelectedTMR(signe.data.typesTMR ?? []),
actors: game.actors.filter(actor => actor.isHautRevant()).map(actor => { actors: game.actors.filter(actor => actor.isHautRevant()).map(actor => {
let actorData = duplicate(Misc.data(actor)); let actorData = duplicate(Misc.data(actor));
actorData.selected = actor.hasPlayerOwner; actorData.selected = actor.hasPlayerOwner;
@ -51,26 +51,26 @@ export class DialogCreateSigneDraconique extends Dialog {
whisper: ChatUtility.getWhisperRecipientsAndGMs(Misc.data(actor).name), whisper: ChatUtility.getWhisperRecipientsAndGMs(Misc.data(actor).name),
content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html", { content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html", {
signe: signe, signe: signe,
alias: actor.name alias: Misc.data(actor).name
}) })
}); });
} }
validerSigne() { validerSigne() {
this.dialogData.signe.name = $("[name='signe.name']").val(); this.dialogData.signe.name = $("[name='signe.name']").val();
this.dialogData.signe.system.valeur.norm = $("[name='signe.data.valeur.norm']").val(); this.dialogData.signe.data.valeur.norm = $("[name='signe.data.valeur.norm']").val();
this.dialogData.signe.system.valeur.sign = $("[name='signe.data.valeur.sign']").val(); this.dialogData.signe.data.valeur.sign = $("[name='signe.data.valeur.sign']").val();
this.dialogData.signe.system.valeur.part = $("[name='signe.data.valeur.part']").val(); this.dialogData.signe.data.valeur.part = $("[name='signe.data.valeur.part']").val();
this.dialogData.signe.system.difficulte = $("[name='signe.data.difficulte']").val(); this.dialogData.signe.data.difficulte = $("[name='signe.data.difficulte']").val();
this.dialogData.signe.system.ephemere = $("[name='signe.data.ephemere']").prop("checked"); this.dialogData.signe.data.ephemere = $("[name='signe.data.ephemere']").prop("checked");
this.dialogData.signe.system.duree = $("[name='signe.data.duree']").val(); this.dialogData.signe.data.duree = $("[name='signe.data.duree']").val();
this.dialogData.signe.system.typesTMR = $(".select-tmr").val(); this.dialogData.signe.data.typesTMR = $(".select-tmr").val();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
this.setEphemere(this.dialogData.signe.system.ephemere); this.setEphemere(this.dialogData.signe.data.ephemere);
html.find(".signe-aleatoire").click(event => this.setSigneAleatoire()); html.find(".signe-aleatoire").click(event => this.setSigneAleatoire());
html.find("[name='signe.data.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked)); html.find("[name='signe.data.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked));
html.find(".select-actor").change((event) => this.onSelectActor(event)); html.find(".select-actor").change((event) => this.onSelectActor(event));
@ -81,14 +81,14 @@ export class DialogCreateSigneDraconique extends Dialog {
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
$("[name='signe.name']").val(newSigne.name); $("[name='signe.name']").val(newSigne.name);
$("[name='signe.data.valeur.norm']").val(newSigne.system.valeur.norm); $("[name='signe.data.valeur.norm']").val(newSigne.data.valeur.norm);
$("[name='signe.data.valeur.sign']").val(newSigne.system.valeur.sign); $("[name='signe.data.valeur.sign']").val(newSigne.data.valeur.sign);
$("[name='signe.data.valeur.part']").val(newSigne.system.valeur.part); $("[name='signe.data.valeur.part']").val(newSigne.data.valeur.part);
$("[name='signe.data.difficulte']").val(newSigne.system.difficulte); $("[name='signe.data.difficulte']").val(newSigne.data.difficulte);
$("[name='signe.data.duree']").val(newSigne.system.duree); $("[name='signe.data.duree']").val(newSigne.data.duree);
$("[name='signe.data.ephemere']").prop("checked", newSigne.system.ephemere); $("[name='signe.data.ephemere']").prop("checked", newSigne.data.ephemere);
$(".select-tmr").val(newSigne.system.typesTMR); $(".select-tmr").val(newSigne.data.typesTMR);
this.setEphemere(newSigne.system.ephemere); this.setEphemere(newSigne.data.ephemere);
} }
async setEphemere(ephemere) { async setEphemere(ephemere) {
@ -111,8 +111,8 @@ export class DialogCreateSigneDraconique extends Dialog {
onValeurXpSort(event) { onValeurXpSort(event) {
const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0; const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0;
const xp = Number(event.currentTarget.value); const xp = Number(event.currentTarget.value);
const oldValeur = this.dialogData.signe.system.valeur; const oldValeur = this.dialogData.signe.data.valeur;
this.dialogData.signe.system.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); this.dialogData.signe.data.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur);
} }
} }

View File

@ -19,6 +19,10 @@ export class Grammar {
return word.match(/^[aeiouy]/i) return word.match(/^[aeiouy]/i)
} }
static includesLowerCaseNoAccent(value, content) {
return Grammar.toLowerCaseNoAccent(value).includes(Grammar.toLowerCaseNoAccent(content));
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static toLowerCaseNoAccent(words) { static toLowerCaseNoAccent(words) {
return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words; return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words;

View File

@ -20,8 +20,7 @@ const nomCategorieParade = {
export class RdDItemArme extends Item { export class RdDItemArme extends Item {
static isArme(itemData) { static isArme(itemData) {
console.log("ARM", itemData) itemData = Misc.data(itemData);
//itemData = Misc.data(itemData)
return (itemData.type == 'competencecreature' && itemData.system.iscombat) || itemData.type == 'arme'; return (itemData.type == 'competencecreature' && itemData.system.iscombat) || itemData.type == 'arme';
} }
@ -36,14 +35,12 @@ export class RdDItemArme extends Item {
return RdDItemArme.mainsNues(); return RdDItemArme.mainsNues();
} }
/* -------------------------------------------- */
static computeNiveauArmes(armes, competences) { static computeNiveauArmes(armes, competences) {
for (const arme of armes) { for (const arme of armes) {
arme.system.niveau = RdDItemArme.niveauCompetenceArme(arme, competences) arme.system.niveau = RdDItemArme.niveauCompetenceArme(arme, competences);
} }
} }
/* -------------------------------------------- */
static niveauCompetenceArme(arme, competences) { static niveauCompetenceArme(arme, competences) {
const compArme = competences.find(it => it.name == arme.system.competence); const compArme = competences.find(it => it.name == arme.system.competence);
return compArme?.system.niveau ?? -8; return compArme?.system.niveau ?? -8;
@ -51,7 +48,7 @@ export class RdDItemArme extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getNomCategorieParade(arme) { static getNomCategorieParade(arme) {
const categorie = arme?.data ? RdDItemArme.getCategorieParade(arme) : arme; const categorie = arme?.system ? RdDItemArme.getCategorieParade(arme) : arme;
return nomCategorieParade[categorie]; return nomCategorieParade[categorie];
} }
@ -69,21 +66,20 @@ export class RdDItemArme extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getCategorieParade(armeData) { static getCategorieParade(armeData) {
armeData = Misc.data(armeData); if (armeData.system.categorie_parade) {
if (armeData.data.categorie_parade) { return armeData.system.categorie_parade;
return armeData.data.categorie_parade;
} }
// pour compatibilité avec des personnages existants // pour compatibilité avec des personnages existants
if (armeData.type == 'competencecreature' || armeData.data.categorie == 'creature') { if (armeData.type == 'competencecreature' || armeData.system.categorie == 'creature') {
return armeData.data.categorie_parade || (armeData.data.isparade ? 'armes-naturelles' : ''); return armeData.system.categorie_parade || (armeData.system.isparade ? 'armes-naturelles' : '');
} }
if (!armeData.type.match(/arme|competencecreature/)) { if (!armeData.type.match(/arme|competencecreature/)) {
return ''; return '';
} }
if (armeData.data.competence == undefined) { if (armeData.system.competence == undefined) {
return 'competencecreature'; return 'competencecreature';
} }
let compname = armeData.data.competence.toLowerCase(); let compname = armeData.system.competence.toLowerCase();
if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) return ''; if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) return '';
if (compname.match('hache')) return 'haches'; if (compname.match('hache')) return 'haches';
@ -140,22 +136,21 @@ export class RdDItemArme extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static armeUneOuDeuxMains(armeData, aUneMain) { static armeUneOuDeuxMains(armeData, aUneMain) {
armeData = Misc.data(armeData); if (armeData && !armeData.system.cac) {
if (armeData && !armeData.data.cac) { armeData.system.unemain = armeData.system.unemain || !armeData.system.deuxmains;
armeData.data.unemain = armeData.data.unemain || !armeData.data.deuxmains; const uneOuDeuxMains = armeData.system.unemain && armeData.system.deuxmains;
const uneOuDeuxMains = armeData.data.unemain && armeData.data.deuxmains; const containsSlash = !Number.isInteger(armeData.system.dommages) && armeData.system.dommages.includes("/");
const containsSlash = !Number.isInteger(armeData.data.dommages) && armeData.data.dommages.includes("/");
if (containsSlash) { // Sanity check if (containsSlash) { // Sanity check
armeData = duplicate(armeData); armeData = duplicate(armeData);
const tableauDegats = armeData.data.dommages.split("/"); const tableauDegats = armeData.system.dommages.split("/");
if (aUneMain) if (aUneMain)
armeData.data.dommagesReels = Number(tableauDegats[0]); armeData.system.dommagesReels = Number(tableauDegats[0]);
else // 2 mains else // 2 mains
armeData.data.dommagesReels = Number(tableauDegats[1]); armeData.system.dommagesReels = Number(tableauDegats[1]);
} }
else { else {
armeData.data.dommagesReels = Number(armeData.data.dommages); armeData.system.dommagesReels = Number(armeData.system.dommages);
} }
if (uneOuDeuxMains != containsSlash) { if (uneOuDeuxMains != containsSlash) {
@ -166,14 +161,13 @@ export class RdDItemArme extends Item {
} }
static isArmeUtilisable(itemData) { static isArmeUtilisable(itemData) {
itemData = Misc.data(itemData); return itemData.type == 'arme' && itemData.system.equipe && (itemData.system.resistance > 0 || itemData.system.portee_courte > 0);
return itemData.type == 'arme' && itemData.data.equipe && (itemData.data.resistance > 0 || itemData.data.portee_courte > 0);
} }
static ajoutCorpsACorps(armes, competences, carac) { static ajoutCorpsACorps(armes, competences, carac) {
let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { data: { niveau: -6 } } let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { system: { niveau: -6 } };
let init = RdDCombatManager.calculInitiative(corpsACorps.system.niveau, carac['melee'].value) let init = RdDCombatManager.calculInitiative(corpsACorps.system.niveau, carac['melee'].value);
armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.system.niveau, initiative: init })) armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.system.niveau, initiative: init }));
//armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init })); //armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init }));
} }
@ -197,19 +191,19 @@ export class RdDItemArme extends Item {
} }
static mainsNues(actorData) { static mainsNues(actorData) {
const mainsNues = RdDItemArme.corpsACorps(actorData); const mainsNues = RdDItemArme.corpsACorps(actorData)
mainsNues.name = 'Mains nues'; mainsNues.name = 'Mains nues'
mainsNues.system.cac = 'pugilat'; mainsNues.system.cac = 'pugilat'
mainsNues.system.baseInit = 4; mainsNues.system.baseInit = 4
return mainsNues; return mainsNues;
} }
static empoignade(actorData) { static empoignade(actorData) {
const empoignade = RdDItemArme.corpsACorps(actorData); const empoignade = RdDItemArme.corpsACorps(actorData)
empoignade.name = 'Empoignade'; empoignade.name = 'Empoignade'
empoignade.system.cac = 'empoignade'; empoignade.system.cac = 'empoignade'
empoignade.system.baseInit = 3; empoignade.system.baseInit = 3
empoignade.system.mortalite = 'empoignade'; empoignade.system.mortalite = 'empoignade'
return empoignade; return empoignade
} }
} }

View File

@ -109,7 +109,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isMalusEncombrementTotal(competence) { static isMalusEncombrementTotal(competence) {
return competence?.name.toLowerCase().match(/(natation|acrobatie)/) return competence.name.toLowerCase().match(/(natation|acrobatie)/);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -133,12 +133,11 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeXP(competence) { static computeXP(competence) {
console.log("Competence", competence) const factor = competence.name.includes('Thanatos') ? 2 : 1; // Thanatos compte double !
const factor = competence.name.includes('Thanatos') ? 2 : 1 // Thanatos compte double ! const xpNiveau = RdDItemCompetence.computeDeltaXP(competence.system.base, competence.system.niveau ?? competence.system.base);
const xpNiveau = RdDItemCompetence.computeDeltaXP(competence.system.base, competence.system.niveau ?? competence.system.base) const xp = competence.system.xp ?? 0;
const xp = competence.system.xp ?? 0 const xpSort = competence.system.xp_sort ?? 0;
const xpSort = competence.system.xp_sort ?? 0 return factor * (xpNiveau + xp) + xpSort;
return factor * (xpNiveau + xp) + xpSort
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -162,11 +161,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeCompetenceXPCost(competence) { static computeCompetenceXPCost(competence) {
const compData = Misc.data(competence); let xp = RdDItemCompetence.getDeltaXp(competence.system.base, competence.system.niveau ?? competence.system.base);
let xp = RdDItemCompetence.getDeltaXp(compData.data.base, compData.data.niveau ?? compData.data.base); xp += competence.system.xp ?? 0;
xp += compData.data.xp ?? 0;
if (compData.name.includes('Thanatos')) xp *= 2; /// Thanatos compte double ! if (compData.name.includes('Thanatos')) xp *= 2; /// Thanatos compte double !
xp += compData.data.xp_sort ?? 0; xp += competence.system.xp_sort ?? 0;
return xp; return xp;
} }
@ -177,8 +175,8 @@ export class RdDItemCompetence extends Item {
let list = troncList.map(name => RdDItemCompetence.findCompetence(competences, name)) let list = troncList.map(name => RdDItemCompetence.findCompetence(competences, name))
.sort(Misc.descending(c => Misc.templateData(c).niveau)); // tri du plus haut au plus bas .sort(Misc.descending(c => Misc.templateData(c).niveau)); // tri du plus haut au plus bas
list.splice(0, 1); // ignorer la plus élevée list.splice(0, 1); // ignorer la plus élevée
list.map(c => Misc.templateData(c)).forEach(tplData => { list.map(c => c).forEach(c => {
economie += RdDItemCompetence.getDeltaXp(tplData.base, Math.min(tplData.niveau, 0)); economie += RdDItemCompetence.getDeltaXp(c.system.base, Math.min(c.system.niveau, 0))
}); });
} }
return economie; return economie;
@ -186,13 +184,13 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static levelUp(itemData, stressTransforme) { static levelUp(itemData, stressTransforme) {
itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau); itemData.system.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.system.niveau);
const xpManquant = itemData.data.xpNext - itemData.data.xp; const xpManquant = itemData.system.xpNext - itemData.system.xp;
itemData.data.isLevelUp = xpManquant <= 0; itemData.system.isLevelUp = xpManquant <= 0;
itemData.data.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && itemData.data.niveau < itemData.data.niveau_archetype); itemData.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && itemData.system.niveau < itemData.system.niveau_archetype);
itemData.data.stressXpMax = 0; itemData.system.stressXpMax = 0;
if (xpManquant > 0 && stressTransforme > 0 && itemData.data.niveau < itemData.data.niveau_archetype) { if (xpManquant > 0 && stressTransforme > 0 && itemData.system.niveau < itemData.system.niveau_archetype) {
itemData.data.stressXpMax = Math.min(xpManquant , stressTransforme); itemData.system.stressXpMax = Math.min(xpManquant , stressTransforme);
} }
} }
@ -207,7 +205,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isNiveauBase(itemData) { static isNiveauBase(itemData) {
return Number(itemData.data.niveau) == RdDItemCompetence.getNiveauBase(itemData.data.categorie); return Number(itemData.system.niveau) == RdDItemCompetence.getNiveauBase(itemData.system.categorie);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -257,7 +255,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeResumeArchetype(competences) { static computeResumeArchetype(competences) {
const archetype = RdDItemCompetence.getLimitesArchetypes(); const archetype = RdDItemCompetence.getLimitesArchetypes();
competences.map(it => Math.max(0, Misc.templateData(it).niveau_archetype)) competences.map(it => Math.max(0, it.system.niveau_archetype))
.forEach(niveau => { .forEach(niveau => {
archetype[niveau] = archetype[niveau] ?? { "niveau": niveau, "nombreMax": 0, "nombre": 0 }; archetype[niveau] = archetype[niveau] ?? { "niveau": niveau, "nombreMax": 0, "nombre": 0 };
archetype[niveau].nombre = (archetype[niveau]?.nombre ?? 0) + 1; archetype[niveau].nombre = (archetype[niveau]?.nombre ?? 0) + 1;

View File

@ -7,9 +7,9 @@ export class RdDItemCompetenceCreature extends Item {
static setRollDataCreature(rollData) { static setRollDataCreature(rollData) {
rollData.competence = Misc.data(rollData.competence); rollData.competence = Misc.data(rollData.competence);
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } }; rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } };
rollData.competence.data.defaut_carac = "carac_creature"; rollData.competence.data.defaut_carac = "carac_creature"
rollData.competence.data.categorie = "creature"; rollData.competence.data.categorie = "creature"
rollData.selectedCarac = rollData.carac.carac_creature; rollData.selectedCarac = rollData.carac.carac_creature
if (rollData.competence.data.iscombat) { if (rollData.competence.data.iscombat) {
rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence); rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence);
} }

View File

@ -3,7 +3,7 @@ export class RdDItemMeditation {
static calculDifficulte(rollData) { static calculDifficulte(rollData) {
if (rollData.meditation) { if (rollData.meditation) {
// Malus permanent éventuel // Malus permanent éventuel
let diff = -rollData.meditation.data.malus ?? 0; let diff = rollData.meditation.data.malus ?? 0;
if (!rollData.conditionMeditation.isHeure) diff -= 2; if (!rollData.conditionMeditation.isHeure) diff -= 2;
if (!rollData.conditionMeditation.isVeture) diff -= 2; if (!rollData.conditionMeditation.isVeture) diff -= 2;
if (!rollData.conditionMeditation.isComportement) diff -= 2; if (!rollData.conditionMeditation.isComportement) diff -= 2;

View File

@ -26,7 +26,7 @@ const monnaiesData = [
export class Monnaie { export class Monnaie {
static isSystemMonnaie(item) { static isSystemMonnaie(item) {
let present = monnaiesData.find(monnaie => monnaie.system.valeur_deniers == item.system?.valeur_deniers); let present = monnaiesData.find(monnaie => monnaie.system.valeur_deniers == item?.system?.valeur_deniers);
return present; return present;
} }
@ -40,8 +40,8 @@ export class Monnaie {
static monnaiesManquantes(items) { static monnaiesManquantes(items) {
const valeurs = Monnaie.filtrerMonnaies(items) const valeurs = Monnaie.filtrerMonnaies(items)
.map(it => Misc.templateData(it).valeur_deniers); .map(it => it.system.valeur_deniers);
const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != monnaie.system.valeur_deniers)); const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != monnaie.system?.valeur_deniers))
//const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != Misc.templateData(monnaie).valeur_deniers) ); //const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != Misc.templateData(monnaie).valeur_deniers) );
//console.log("Valeurs : ", valeurs, manquantes); //console.log("Valeurs : ", valeurs, manquantes);
return []; //manquantes; return []; //manquantes;

View File

@ -32,7 +32,7 @@ export class RdDItemSheet extends ItemSheet {
let buttons = super._getHeaderButtons(); let buttons = super._getHeaderButtons();
// Add "Post to chat" button // Add "Post to chat" button
// We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry! // We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry!
if ("cout" in Misc.templateData(this.object) && this.object.isVideOuNonConteneur()) { if ("cout" in this.object.system && this.object.isVideOuNonConteneur()) {
buttons.unshift({ buttons.unshift({
class: "vendre", class: "vendre",
icon: "fas fa-comments-dollar", icon: "fas fa-comments-dollar",
@ -60,14 +60,13 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = this.object;
let formData = { let formData = {
id: this.object.id, id: this.object.id,
title: objectData.name, title: this.object.name,
type: objectData.type, type: this.object.type,
img: objectData.img, img: this.object.img,
name: objectData.name, name: this.object.name,
data: objectData.system, data: this.object.system,
isGM: game.user.isGM, isGM: game.user.isGM,
actorId: this.actor?.id, actorId: this.actor?.id,
owner: this.document.isOwner, owner: this.document.isOwner,
@ -77,7 +76,7 @@ export class RdDItemSheet extends ItemSheet {
} }
if (this.actor) { if (this.actor) {
formData.isOwned = true; formData.isOwned = true;
if (objectData.type == 'conteneur') { if (this.object.type == 'conteneur') {
this.prepareConteneurData(formData); this.prepareConteneurData(formData);
} }
} }
@ -85,7 +84,8 @@ export class RdDItemSheet extends ItemSheet {
formData.categorieCompetences = RdDItemCompetence.getCategorieCompetences() formData.categorieCompetences = RdDItemCompetence.getCategorieCompetences()
if (formData.type == 'tache' || formData.type == 'livre' || formData.type == 'meditation' || formData.type == 'oeuvre') { if (formData.type == 'tache' || formData.type == 'livre' || formData.type == 'meditation' || formData.type == 'oeuvre') {
formData.caracList = duplicate(game.system.model.Actor.personnage.carac) formData.caracList = duplicate(game.system.model.Actor.personnage.carac)
formData.competences = await RdDUtility.loadCompendium('foundryvtt-reve-de-dragon.competences'); formData.caracList["reve-actuel"] = duplicate(game.system.model.Actor.personnage.reve.reve)
formData.competences = await RdDUtility.loadCompendium('foundryvtt-reve-de-dragon.competences')
} }
if (formData.type == 'arme') { if (formData.type == 'arme') {
formData.competences = await RdDUtility.loadCompendium('foundryvtt-reve-de-dragon.competences', it => RdDItemCompetence.isCompetenceArme(it)); formData.competences = await RdDUtility.loadCompendium('foundryvtt-reve-de-dragon.competences', it => RdDItemCompetence.isCompetenceArme(it));
@ -113,6 +113,7 @@ export class RdDItemSheet extends ItemSheet {
return formData; return formData;
} }
/* -------------------------------------------- */
prepareConteneurData(formData) { prepareConteneurData(formData) {
formData.itemsByType = Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i.data))); formData.itemsByType = Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i.data)));
RdDUtility.filterEquipementParType(formData); RdDUtility.filterEquipementParType(formData);
@ -228,7 +229,7 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
get template() { get template() {
let type = this.object.type let type = this.object.type
return `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html` return `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html`;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -40,21 +40,18 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
let formData = { const formData = duplicate(Misc.data(this.object));
name: this.object.name, mergeObject(formData, {
img: this.object.img, title: formData.name,
title: this.object.name,
isGM: game.user.isGM, isGM: game.user.isGM,
owner: this.document.isOwner, owner: this.document.isOwner,
data: this.object.system,
isOwned: this.actor ? true : false, isOwned: this.actor ? true : false,
actorId: this.actor?.id, actorId: this.actor?.id,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
} });
formData.tmrs = TMRUtility.listSelectedTMR(this.object.system.typesTMR ?? []) formData.tmrs = TMRUtility.listSelectedTMR(formData.data.typesTMR ?? []);
console.log("SIG", formData) return formData;
return formData
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -75,17 +72,17 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
} }
async onSelectTmr(event) { async onSelectTmr(event) {
event.preventDefault() event.preventDefault();
const selectedTMR = $(".select-tmr").val() const selectedTMR = $(".select-tmr").val();
this.object.update({ 'data.typesTMR': selectedTMR }) this.object.update({ 'data.typesTMR': selectedTMR });
} }
async onValeurXpSort(event) { async onValeurXpSort(event) {
const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0; const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0;
const xp = Number(event.currentTarget.value); const xp = Number(event.currentTarget.value);
const oldValeur = this.object.system.valeur const oldValeur = Misc.templateData(this.object).valeur;
const newValeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); const newValeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur);
await this.object.update({ 'data.valeur': newValeur }) await this.object.update({ 'data.valeur': newValeur });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -13,25 +13,24 @@ const tableSignesIndicatifs = [
] ]
const DIFFICULTE_LECTURE_SIGNE_MANQUE = +11;
export class RdDItemSigneDraconique { export class RdDItemSigneDraconique {
static prepareSigneDraconiqueMeditation(meditation, rolled) { static prepareSigneDraconiqueMeditation(meditation, rolled) {
if (rolled.isSuccess != undefined) { meditation = Misc.data(meditation);
meditation = Misc.data(meditation); return {
return { name: "de la " + meditation.name,
name: "de la " + meditation.name, type: "signedraconique",
type: "signedraconique", img: meditation.img,
img: meditation.img, data: {
data: { typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)],
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)], difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE,
difficulte: RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code), ephemere: true,
ephemere: true, duree: "1 round",
duree: "1 round", valeur: rolled.isSuccess ? { "norm": 3, "sign": 5, "part": 10 } : { "norm": 0, "sign": 0, "part": 0 }
valeur: { "norm": 3, "sign": 5, "part": 10 } }
} };
};
}
return undefined;
} }
static getDiffSigneMeditation(code) { static getDiffSigneMeditation(code) {
@ -44,7 +43,7 @@ export class RdDItemSigneDraconique {
} }
static getXpSortSigneDraconique(code, signe) { static getXpSortSigneDraconique(code, signe) {
return Misc.data(signe).data.valeur[code] ?? 0; return Misc.toInt(Misc.data(signe).data.valeur[code] ?? 0);
} }
static calculValeursXpSort(qualite, valeur, avant) { static calculValeursXpSort(qualite, valeur, avant) {

View File

@ -18,7 +18,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static setCoutReveReel(sort){ static setCoutReveReel(sort){
if (sort) { if (sort) {
sort.data.ptreve_reel = this.isCoutVariable(sort) ? 1 : sort.data.ptreve; sort.system.ptreve_reel = this.isCoutVariable(sort) ? 1 : sort.system.ptreve;
} }
} }

View File

@ -3,8 +3,8 @@ import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
const typesObjetsEquipement = ["objet", "arme", "armure", "gemme", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"]; const typesObjetsEquipement = ["objet", "arme", "armure", "gemme", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"]
const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"]; const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"]
const encBrin = 0.00005;// un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc const encBrin = 0.00005;// un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
export const defaultItemImg = { export const defaultItemImg = {
@ -34,7 +34,8 @@ export const defaultItemImg = {
oeuvre: "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp", oeuvre: "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp",
nourritureboisson: "systems/foundryvtt-reve-de-dragon/icons/objets/provision_crue.webp", nourritureboisson: "systems/foundryvtt-reve-de-dragon/icons/objets/provision_crue.webp",
signedraconique: "systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp", signedraconique: "systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp",
gemme: "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp" gemme: "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp",
possession: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp"
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -48,11 +49,11 @@ export class RdDItem extends Item {
} }
static getTypeObjetsEquipement() { static getTypeObjetsEquipement() {
return typesObjetsEquipement; return typesObjetsEquipement
} }
static getTypesOeuvres() { static getTypesOeuvres() {
return typesObjetsOeuvres; return typesObjetsOeuvres
} }
isCompetence() { isCompetence() {
@ -82,7 +83,7 @@ export class RdDItem extends Item {
return this.type == 'herbe' && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos'); return this.type == 'herbe' && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos');
} }
isPotion() { isPotion() {
return this.type == 'potion'; return Misc.data(this).type == 'potion';
} }
isEquipement() { isEquipement() {
@ -94,20 +95,18 @@ export class RdDItem extends Item {
} }
isMagique() { isMagique() {
return this.system.magique; return this.system.magique
} }
getEncTotal() { getEncTotal() {
const itemData = this.system return Number(this.system.encombrement ?? 0) * Number(this.system.quantite ?? 1)
return Number(itemData.encombrement ?? 0) * Number(itemData.quantite ?? 1);
} }
getEnc() { getEnc() {
const itemData = this.system switch (this.type) {
switch (itemData.type) {
case 'herbe': case 'herbe':
return encBrin; return encBrin;
} }
return itemData.encombrement ?? 0 return this.system.encombrement ?? 0;
} }
prepareDerivedData() { prepareDerivedData() {
@ -118,50 +117,47 @@ export class RdDItem extends Item {
if (this.isPotion()) { if (this.isPotion()) {
this.prepareDataPotion() this.prepareDataPotion()
} }
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false }); this.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
} }
} }
prepareDataPotion() { prepareDataPotion() {
const tplData = Misc.templateData(this); const categorie = Grammar.toLowerCaseNoAccent(this.system.categorie);
const categorie = Grammar.toLowerCaseNoAccent(tplData.categorie); this.system.magique = categorie.includes('enchante');
tplData.magique = categorie.includes('enchante'); if (this.system.magique) {
if (tplData.magique) {
if (categorie.includes('soin') || categorie.includes('repos')) { if (categorie.includes('soin') || categorie.includes('repos')) {
tplData.puissance = tplData.herbebonus * tplData.pr; this.system.puissance = this.system.herbebonus * this.system.pr;
} }
} }
} }
_calculsEquipement() { _calculsEquipement() {
const tplData = this.system const quantite = this.isConteneur() ? 1 : (this.system.quantite ?? 0);
const quantite = this.isConteneur() ? 1 : (tplData.quantite ?? 0);
const enc = this.getEnc(); const enc = this.getEnc();
if (enc != undefined) { if (enc != undefined) {
tplData.encTotal = Math.max(enc, 0) * quantite; this.system.encTotal = Math.max(enc, 0) * quantite;
} }
if (tplData.cout != undefined) { if (this.cout != undefined) {
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite; this.system.prixTotal = Math.max(this.cout, 0) * quantite;
} }
} }
getActionPrincipale(options = { warnIfNot: true }) { getActionPrincipale(options = { warnIfNot: true }) {
const itemData = this.system if (!this.isConteneur() && (this.system.quantite ?? 0) <= 0) {
if (!this.isConteneur() && (itemData.quantite ?? 0) <= 0) {
if (options.warnIfNot) { if (options.warnIfNot) {
ui.notifications.warn(`Vous n'avez plus de ${itemData.name}.`); ui.notifications.warn(`Vous n'avez plus de ${this.name}.`);
} }
return undefined; return undefined;
} }
switch (itemData.type) { switch (this.type) {
case 'nourritureboisson': return itemData.boisson ? 'Boire' : 'Manger'; case 'nourritureboisson': return this.boisson ? 'Boire' : 'Manger';
case 'potion': return 'Boire'; case 'potion': return 'Boire';
case 'livre': return 'Lire'; case 'livre': return 'Lire';
case 'conteneur': return 'Ouvrir'; case 'conteneur': return 'Ouvrir';
} }
if (this.isHerbeAPotion()) { return 'Décoction'; } if (this.isHerbeAPotion()) { return 'Décoction'; }
if (options.warnIfNot) { if (options.warnIfNot) {
ui.notifications.warn(`Impossible d'utiliser un ${itemData.name}, aucune action associée définie.`); ui.notifications.warn(`Impossible d'utiliser un ${this.name}, aucune action associée définie.`);
} }
return undefined; return undefined;
@ -173,18 +169,17 @@ export class RdDItem extends Item {
} }
async quantiteIncDec(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) { async quantiteIncDec(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) {
const itemData = this.system const quantite = Number(this.system.quantite ?? -1);
const quantite = Number(itemData.quantite ?? -1);
if (quantite >= 0) { if (quantite >= 0) {
const reste = Math.max(quantite + Number(nombre), 0); const reste = Math.max(quantite + Number(nombre), 0);
if (reste == 0) { if (reste == 0) {
if (options.supprimerSiZero) { if (options.supprimerSiZero) {
ui.notifications.notify(`${itemData.name} supprimé de votre équipement`); ui.notifications.notify(`${this.name} supprimé de votre équipement`);
await this.delete(); await this.delete();
} }
else { else {
ui.notifications.notify(`Il ne vous reste plus de ${itemData.name}, vous pouvez le supprimer de votre équipement, ou trouver un moyen de vous en procurer.`); ui.notifications.notify(`Il ne vous reste plus de ${this.name}, vous pouvez le supprimer de votre équipement, ou trouver un moyen de vous en procurer.`);
await this.update({ "data.quantite": 0 }); await this.update({ "data.quantite": 0 });
} }
} }
@ -197,10 +192,10 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
// détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité // détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité
isEquipementSimilaire(other) { isEquipementSimilaire(other) {
const itemData = this.system const itemData = Misc.data(this)
const otherData = other.data const otherData = Misc.data(other)
const tplData = Misc.templateData(this); const tplData = Misc.templateData(this)
const otherTplData = Misc.templateData(other); const otherTplData = Misc.templateData(other)
if (!this.isEquipement()) return false; if (!this.isEquipement()) return false;
if (itemData.type != otherData.type) return false; if (itemData.type != otherData.type) return false;
if (itemData.name != otherData.name) return false; if (itemData.name != otherData.name) return false;
@ -246,7 +241,7 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
getProprietes() { getProprietes() {
return this[`_${this.type}ChatData`](); return this[`_${Misc.data(this).type}ChatData`]();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -69,9 +69,9 @@ export class Misc {
} }
static classify(items, classifier = it => it.type) { static classify(items, classifier = it => it.type) {
let itemsBy = {}; let itemsBy = {}
Misc.classifyInto(itemsBy, items, classifier); Misc.classifyInto(itemsBy, items, classifier)
return itemsBy; return itemsBy
} }
static classifyFirst(items, classifier) { static classifyFirst(items, classifier) {
@ -87,13 +87,13 @@ export class Misc {
static classifyInto(itemsBy, items, classifier = it => it.type) { static classifyInto(itemsBy, items, classifier = it => it.type) {
for (const item of items) { for (const item of items) {
const classification = classifier(item); const classification = classifier(item)
let list = itemsBy[classification]; let list = itemsBy[classification];
if (!list) { if (!list) {
list = []; list = []
itemsBy[classification] = list; itemsBy[classification] = list
} }
list.push(item); list.push(item)
} }
} }
@ -105,21 +105,21 @@ export class Misc {
return params.reduce((a, b) => a + separator + b); return params.reduce((a, b) => a + separator + b);
} }
static data(it) { static data(it) {
if (it instanceof Actor || it instanceof Item || it instanceof Combatant) { /*if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
return it.system return it.data;
} }*/
return it return it;
} }
static templateData(it) { static templateData(it) {
return it.system ?? {} return Misc.data(it)?.data ?? {}
//return Misc.data(it)?.system ?? {}
} }
static getEntityTypeLabel(entity) { static getEntityTypeLabel(entity) {
const documentName = entity?.documentName; const documentName = entity?.documentName
const type = entity?.data.type; const type = entity?.type
if (documentName === 'Actor' || documentName === 'Item') { if (documentName === 'Actor' || documentName === 'Item') {
const label = CONFIG[documentName]?.typeLabels?.[type] ?? type; const label = CONFIG[documentName]?.typeLabels?.[type] ?? type;
return game.i18n.has(label) ? game.i18n.localize(label) : t; return game.i18n.has(label) ? game.i18n.localize(label) : t;

View File

@ -77,7 +77,7 @@ export class RdDCombatManager extends Combat {
/************************************************************************************/ /************************************************************************************/
async rollInitiative(ids, formula = undefined, messageOptions = {}) { async rollInitiative(ids, formula = undefined, messageOptions = {}) {
console.log(`${game.data.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions); console.log(`${game.data.system.data.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
// Structure input data // Structure input data
ids = typeof ids === "string" ? [ids] : ids; ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant._id; const currentId = this.combatant._id;
@ -89,23 +89,23 @@ export class RdDCombatManager extends Combat {
let rollFormula = formula; // Init per default let rollFormula = formula; // Init per default
if (!rollFormula) { if (!rollFormula) {
let armeCombat, competence; let armeCombat, competence;
if (combatant.actor.type == 'creature' || combatant.actor.type == 'entite') { if (combatant.actor.data.type == 'creature' || combatant.actor.data.type == 'entite') {
for (const competenceItemData of combatant.actor.items) { for (const competenceItemData of combatant.actor.data.items) {
if (competenceItemData.system.iscombat) { if (competenceItemData.data.data.iscombat) {
competence = duplicate(competenceItemData) competence = duplicate(competenceItemData);
} }
} }
rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.system.niveau, competence.system.carac_value) + ")/100)"; rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.data.niveau, competence.data.carac_value) + ")/100)";
} else { } else {
for (const itemData of combatant.actor.items) { for (const itemData of combatant.actor.data.items) {
if (itemData.type == "arme" && itemData.system.equipe) { if (itemData.type == "arme" && itemData.data.equipe) {
armeCombat = duplicate(itemData) armeCombat = duplicate(itemData);
} }
} }
let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.system.competence; let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.data.competence;
competence = RdDItemCompetence.findCompetence(combatant.actor.items, compName); competence = RdDItemCompetence.findCompetence(combatant.actor.data.items, compName);
let bonusEcaille = (armeCombat && armeCombat.system.magique) ? armeCombat.system.ecaille_efficacite : 0; let bonusEcaille = (armeCombat && armeCombat.data.magique) ? armeCombat.data.ecaille_efficacite : 0;
rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.system.niveau, combatant.actor.system.carac[competence.system.defaut_carac].value, bonusEcaille) + ")/100)"; rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.data.niveau, Misc.data(combatant.actor).data.carac[competence.data.defaut_carac].value, bonusEcaille) + ")/100)";
} }
} }
//console.log("Combatat", c); //console.log("Combatat", c);
@ -153,40 +153,39 @@ export class RdDCombatManager extends Combat {
/** Retourne une liste triée d'armes avec le split arme1 main / arme 2 main */ /** Retourne une liste triée d'armes avec le split arme1 main / arme 2 main */
static finalizeArmeList(armes, competences, carac) { static finalizeArmeList(armes, competences, carac) {
// Gestion des armes 1/2 mains // Gestion des armes 1/2 mains
let armesEquipe = [] let armesEquipe = [];
console.log("ARMES", armes)
for (const arme of armes) { for (const arme of armes) {
let armeData = duplicate(arme) let armeData = duplicate(arme.system)
if (armeData.system.equipe) { if (armeData.equipe) {
let compData = competences.map(c => c).find(c => c.name == armeData.system.competence) let compData = competences.find(c => c.name.toLowerCase() == armeData.competence.toLowerCase())
console.log("ARME", arme, compData, armeData.competence, competences)
armesEquipe.push(armeData) armesEquipe.push(armeData)
armeData.system.dommagesReels = Number(armeData.system.dommages) armeData.dommagesReels = Number(armeData.dommages)
console.log("ARME", armeData, compData) armeData.niveau = compData.system.niveau
armeData.system.niveau = compData.system.niveau armeData.initiative = RdDCombatManager.calculInitiative(compData.system.niveau, carac[compData.system.defaut_carac].value);
armeData.system.initiative = RdDCombatManager.calculInitiative(compData.system.niveau, carac[compData.system.defaut_carac].value);
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence // Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
if (armeData.system.unemain && !armeData.system.deuxmains) { if (armeData.unemain && !armeData.deuxmains) {
armeData.system.mainInfo = "(1m)"; armeData.mainInfo = "(1m)";
} else if (!armeData.system.unemain && armeData.system.deuxmains) { } else if (!armeData.unemain && armeData.deuxmains) {
armeData.system.mainInfo = "(2m)"; armeData.mainInfo = "(2m)";
} else if (armeData.system.unemain && armeData.system.deuxmains) { } else if (armeData.unemain && armeData.deuxmains) {
armeData.system.mainInfo = "(1m)"; armeData.mainInfo = "(1m)";
const comp2m = armeData.system.competence.replace(" 1 main", " 2 mains"); // Replace ! const comp2m = armeData.competence.replace(" 1 main", " 2 mains"); // Replace !
const comp = Misc.data(competences.find(c => c.name == comp2m)); const comp = competences.find(c => c.name == comp2m)
const arme2main = duplicate(armeData); const arme2main = duplicate(armeData)
arme2main.system.mainInfo = "(2m)"; arme2main.mainInfo = "(2m)";
arme2main.system.niveau = comp.system.niveau; arme2main.niveau = comp.data.niveau;
arme2main.system.competence = comp2m; arme2main.competence = comp2m;
arme2main.system.initiative = RdDCombatManager.calculInitiative(arme2main.system.niveau, carac[comp.system.defaut_carac].value); arme2main.initiative = RdDCombatManager.calculInitiative(arme2main.niveau, carac[comp.system.defaut_carac].value)
armesEquipe.push(arme2main); armesEquipe.push(arme2main);
const containsSlash = armeData.system.dommages.includes("/"); const containsSlash = armeData.dommages.includes("/");
if (containsSlash) { if (containsSlash) {
const tableauDegats = armeData.system.dommages.split("/"); const tableauDegats = armeData.dommages.split("/");
armeData.system.dommagesReels = Number(tableauDegats[0]); armeData.dommagesReels = Number(tableauDegats[0]);
arme2main.system.dommagesReels = Number(tableauDegats[1]); arme2main.dommagesReels = Number(tableauDegats[1]);
} }
else{ else{
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + armeData.name + " ne sont pas corrects (ie sous la forme X/Y)"); ui.notifications.info("Les dommages de l'arme à 1/2 mains " + armeData.name + " ne sont pas corrects (ie sous la forme X/Y)");
@ -194,7 +193,7 @@ export class RdDCombatManager extends Combat {
} }
} }
} }
return armesEquipe.sort(Misc.ascending(armeData => armeData.name + (armeData.system.mainInfo ?? ''))); return armesEquipe.sort(Misc.ascending(armeData => armeData.name + (armeData.mainInfo ?? '')))
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -204,7 +203,7 @@ export class RdDCombatManager extends Combat {
return []; return [];
} }
const actorData = Misc.data(combatant.actor); const actorData = Misc.data(combatant.actor);
let items = combatant.actor.data.items; let items = combatant.actor.items
let actions = [] let actions = []
if (combatant.actor.isCreature()) { if (combatant.actor.isCreature()) {
actions = actions.concat(items.filter(it => RdDItemCompetenceCreature.isCompetenceAttaque(it)) actions = actions.concat(items.filter(it => RdDItemCompetenceCreature.isCompetenceAttaque(it))
@ -215,7 +214,7 @@ export class RdDCombatManager extends Combat {
//.concat(RdDItemArme.empoignade()) //.concat(RdDItemArme.empoignade())
.concat(RdDItemArme.mainsNues()); .concat(RdDItemArme.mainsNues());
let competences = items.filter(it => it.type == 'competence'); let competences = items.filter(it => it.type == 'competence')
actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac)); actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac));
if (actorData.data.attributs.hautrevant.value) { if (actorData.data.attributs.hautrevant.value) {
@ -467,15 +466,15 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static onMsgEncaisser(data) { static onMsgEncaisser(msg) {
let defender = canvas.tokens.get(data.defenderTokenId).actor; let defender = canvas.tokens.get(msg.defenderTokenId).actor;
if (Misc.isOwnerPlayerOrUniqueConnectedGM()) { if (Misc.isOwnerPlayerOrUniqueConnectedGM()) {
let attackerRoll = data.attackerRoll; let attackerRoll = msg.attackerRoll;
let attacker = data.attackerId ? game.actors.get(data.attackerId) : null; let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : null;
defender.encaisserDommages(attackerRoll, attacker); defender.encaisserDommages(attackerRoll, attacker);
RdDCombat._deleteDefense(attackerRoll.passeArme); const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
RdDCombat._deleteAttaque(data.attackerId); rddCombat?.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
} }
} }
@ -484,11 +483,8 @@ export class RdDCombat {
let defenderToken = canvas.tokens.get(msg.defenderTokenId); let defenderToken = canvas.tokens.get(msg.defenderTokenId);
if (defenderToken && Misc.isUniqueConnectedGM()) { if (defenderToken && Misc.isUniqueConnectedGM()) {
const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId); const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
if (rddCombat) { rddCombat?.removeChatMessageActionsPasseArme(msg.defenderRoll.passeArme);
const defenderRoll = msg.defenderRoll; rddCombat?._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
rddCombat.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
rddCombat._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
}
} }
} }
@ -668,7 +664,6 @@ export class RdDCombat {
if (!await this.accorderEntite('avant-attaque')) { if (!await this.accorderEntite('avant-attaque')) {
return; return;
} }
console.log("ATTACK", competence, arme)
if (arme.data.cac == 'empoignade' && this.attacker.isCombatTouche()) { if (arme.data.cac == 'empoignade' && this.attacker.isCombatTouche()) {
ChatMessage.create({ ChatMessage.create({
alias: this.attacker.name, alias: this.attacker.name,
@ -678,7 +673,7 @@ export class RdDCombat {
competence: competence competence: competence
}) })
}); });
return return;
} }
let rollData = this._prepareAttaque(competence, arme); let rollData = this._prepareAttaque(competence, arme);
@ -705,7 +700,7 @@ export class RdDCombat {
{ condition: RdDCombat.isEchecTotal, action: r => this._onAttaqueEchecTotal(r) }, { condition: RdDCombat.isEchecTotal, action: r => this._onAttaqueEchecTotal(r) },
] ]
}); });
dialog.render(true) dialog.render(true);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1008,8 +1003,7 @@ export class RdDCombat {
await this.computeRecul(defenderRoll); await this.computeRecul(defenderRoll);
await this.computeDeteriorationArme(defenderRoll); await this.computeDeteriorationArme(defenderRoll);
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html'); await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
RdDCombat._deleteDefense(defenderRoll.passeArme);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1080,7 +1074,7 @@ export class RdDCombat {
async _onEsquiveNormale(defenderRoll) { async _onEsquiveNormale(defenderRoll) {
console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll); console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll);
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html'); await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html');
RdDCombat._deleteDefense(defenderRoll.passeArme); this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1220,7 +1214,6 @@ export class RdDCombat {
} }
}); });
} }
RdDCombat._deleteDefense(attackerRoll.passeArme);
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme); this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
} }

View File

@ -8,11 +8,11 @@ export class RdDHerbes extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isHerbeSoin( botaniqueItem ) { static isHerbeSoin( botaniqueItem ) {
return Misc.templateData(botaniqueItem).categorie == 'Soin'; return botaniqueItem.categorie == 'Soin';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isHerbeRepos( botaniqueItem ) { static isHerbeRepos( botaniqueItem ) {
return Misc.templateData(botaniqueItem).categorie == 'Repos'; return botaniqueItem.categorie == 'Repos';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -183,7 +183,7 @@ Hooks.once("init", async function () {
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, { Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
types: ["arme", "armure", "objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", types: ["arme", "armure", "objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle",
"tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation", "casetmr", "recettealchimique", "gemme", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation", "casetmr", "recettealchimique", "gemme",
"musique", "chant", "danse", "jeu", "recettecuisine", "maladie", "poison", "oeuvre", "nourritureboisson"], makeDefault: true "musique", "chant", "danse", "jeu", "recettecuisine", "maladie", "poison", "oeuvre", "nourritureboisson", "possession"], makeDefault: true
}); });
CONFIG.Combat.documentClass = RdDCombatManager; CONFIG.Combat.documentClass = RdDCombatManager;
@ -225,7 +225,6 @@ function registerUsageCount( registerKey ) {
name: "Unique world key", name: "Unique world key",
scope: "world", scope: "world",
config: false, config: false,
value: "EMPTY",
type: String type: String
}); });
@ -269,7 +268,7 @@ Hooks.once("ready", async function () {
} }
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
messageDeBienvenue(); messageDeBienvenue();
registerUsageCount( SYSTEM_RDD ) registerUsageCount( SYSTEM_RDD );
} }
}); });

View File

@ -1,11 +1,7 @@
/* -------------------------------------------- */ /* -------------------------------------------- */
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";
import { RdDUtility } from "./rdd-utility.js";
import { RdDCombat } from "./rdd-combat.js"; import { RdDCombat } from "./rdd-combat.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDRoll } from "./rdd-roll.js"; import { RdDRoll } from "./rdd-roll.js";
import { RdDRollTables } from "./rdd-rolltables.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -32,52 +28,83 @@ export class RdDPossession {
/* -------------------------------------------- */ /* -------------------------------------------- */
static updateEtatPossession( possession ) { static updateEtatPossession( possession ) {
possession.ptsConjuration = 0; possession.ptsConjuration = 0
possession.ptsPossession = 0; possession.ptsPossession = 0
console.log("Possession", possession)
if ( possession.data.compteur > 0) { if ( possession.data.compteur > 0) {
possession.ptsPossession = possession.data.compteur; possession.ptsPossession = possession.data.compteur
} }
if ( possession.data.compteur < 0) { if ( possession.data.compteur < 0) {
possession.ptsConjuration = Math.abs(possession.data.compteur); possession.ptsConjuration = Math.abs(possession.data.compteur)
} }
possession.isPosseder = false
possession.isConjurer = false
if (possession.ptsPossession >= 2 ) { if (possession.ptsPossession >= 2 ) {
// Possede possession.isPosseder = true
} }
if (possession.ptsConjuration <= -2 ) { if (possession.ptsConjuration >= 2 ) {
// Libere possession.isConjurer = true
} }
console.log("Poss", possession);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async resultConjuration( rollData) { static async resultConjuration( rollData) {
console.log("RollData!!!", rollData); let actor = game.actors.get(rollData.possession.data.possedeid)
if ( !rollData.rolled.isSuccess ) { if ( !rollData.rolled.isSuccess ) {
rollData.possession.data.compteur++; if( rollData.isECNIDefender) {
rollData.possession.data.compteur--
} else {
rollData.possession.data.compteur++
}
let update = { _id: rollData.possession._id, "data.compteur": rollData.possession.data.compteur }
await actor.updateEmbeddedDocuments('Item', [update])
}
this.updateEtatPossession(rollData.possession)
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html')
if ( rollData.possession.isPosseder || rollData.possession.isConjurer) {
actor.deleteEmbeddedDocuments("Item", [rollData.possession._id])
} }
this.updateEtatPossession(rollData.possession);
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async onDefensePossession( actorId, possessionId) { static async onDefensePossession( attackerId, defenderId, possessionId) {
let actor = game.actors.get(actorId); let attacker = game.actors.get(attackerId)
console.log("onDefensePossession", actor, possessionId); let defender = game.actors.get(defenderId)
let possession = duplicate(actor.items.find( item => item.type =='possession' && item.data.data.possessionid == possessionId));
let attacker = game.actors.get(possession.data.possesseurid); let possession = attacker.items.find( item => item.type =='possession' && item.data.data.possessionid == possessionId)
if ( !possession ) {
possession = defender.items.find( item => item.type =='possession' && item.data.data.possessionid == possessionId)
if ( !possession) {
ui.notifications.warn("Une erreur s'est produite : Aucune possession trouvée !!")
return
}
}
possession = duplicate(possession)
// Update for draconic roll // Update for draconic roll
let rollData = { let rollData = {
possession: possession possession: possession
} }
rollData.actor = actor; rollData.actor = defender
rollData.competence = duplicate(actor.getDraconicOrZero()); if ( defender.type == "personnage") {
rollData.competence.data.defaut_carac = 'reve-actuel'; rollData.competence = duplicate(defender.getDraconicOrZero())
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: actor.getReveActuel() } } rollData.competence.data.defaut_carac = 'reve-actuel'
rollData.mode = "conjuration"; rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } }
rollData.possesseur = attacker.name; rollData.selectedCarac = defender.data.data.carac.reve
rollData.isECNIDefender = false
} else {
rollData.competence = duplicate(defender.getCompetence("Possession"))
rollData.competence.data.defaut_carac = "reve"
rollData.forceCarac = { 'reve': { label: "Rêve", value: defender.data.data.carac.reve.value } }
rollData.selectedCarac = defender.data.data.carac.reve
rollData.isECNIDefender = true
//RdDItemCompetenceCreature.setRollDataCreature( rollData )
}
rollData.mode = "conjuration"
rollData.possesseur = attacker.name
const dialog = await RdDRoll.create(actor, rollData, const dialog = await RdDRoll.create(defender, rollData,
{ {
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-possession.html', html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-possession.html',
options: { height: 400 } options: { height: 400 }
@ -90,21 +117,21 @@ export class RdDPossession {
] ]
} }
); );
dialog.render(true); dialog.render(true)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async _onRollPossession( rollData, isSuccess ) { static async _onRollPossession( rollData, isSuccess ) {
let possession = rollData.possession; let possession = rollData.possession
possession.isSuccess = isSuccess; possession.isSuccess = isSuccess
this.updateEtatPossession( possession); this.updateEtatPossession( possession)
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html'); await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async managePosession(attacker, competence ) { static async managePossession(attacker, competence, possession=undefined) {
const target = RdDCombat.getTarget(); const target = RdDCombat.getTarget()
if (target == undefined) { if (target == undefined) {
ui.notifications.warn((game.user.targets?.size ?? 0) > 1 ui.notifications.warn((game.user.targets?.size ?? 0) > 1
? "Vous devez choisir <strong>une seule</strong> cible à posséder!" ? "Vous devez choisir <strong>une seule</strong> cible à posséder!"
@ -112,13 +139,16 @@ export class RdDPossession {
return; return;
} }
const defender = target.actor; const defender = target.actor
let possession = this.searchPossessionFromEntite( attacker, defender);
if ( !possession) { if ( !possession) {
possession = this.createPossession(attacker, defender); possession = this.searchPossessionFromEntite( attacker, defender)
if ( !possession) {
possession = await this.createPossession(attacker, defender)
}
} }
possession = duplicate(possession)
this.updateEtatPossession(possession); this.updateEtatPossession(possession)
let rollData = { let rollData = {
competence: competence, competence: competence,
possession: possession, possession: possession,
@ -129,9 +159,8 @@ export class RdDPossession {
mode: "possession" mode: "possession"
}; };
if ( attacker.isCreature()) { if ( attacker.isCreature()) {
RdDItemCompetenceCreature.setRollDataCreature(rollData); RdDItemCompetenceCreature.setRollDataCreature(rollData)
} }
console.log("Creation de possession2", attacker, rollData);
const dialog = await RdDRoll.create( attacker, rollData, const dialog = await RdDRoll.create( attacker, rollData,
{ {
@ -145,19 +174,19 @@ export class RdDPossession {
{ condition: r => (r.rolled.isEchec), action: async r => await this._onRollPossession(r, false) }, { condition: r => (r.rolled.isEchec), action: async r => await this._onRollPossession(r, false) },
] ]
}); });
dialog.render(true); dialog.render(true)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async createPossession( attacker, defender ) { static async createPossession( attacker, defender ) {
let posessionData = { let possessionData = {
name: "Possession en cours", type: 'possession', name: "Possession en cours de " + attacker.name, type: 'possession',
img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp", img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp",
data: { description: "", possede: false, possessionid: randomID(16), possesseurid: attacker.data._id, possedeid: defender.data._id, date: 0 } data: { description: "", typepossession: attacker.name, possede: false, possessionid: randomID(16), possesseurid: attacker.data._id, possedeid: defender.data._id, date: 0, compteur: 0 }
} }
await attacker.createEmbeddedDocuments('Item', [posessionData]) // Creates only the possession on the personnage side
let poss = await defender.createEmbeddedDocuments('Item', [posessionData]) let poss = await defender.createEmbeddedDocuments('Item', [possessionData])
return duplicate(poss[0]); return duplicate(poss[0])
} }
} }

View File

@ -38,18 +38,19 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static _setDefaultOptions(actor, rollData) { static _setDefaultOptions(actor, rollData) {
const actorData = actor.system
let defaultRollData = { let defaultRollData = {
alias: actor.name, alias: actor.name,
ajustementsConditions: CONFIG.RDD.ajustementsConditions, ajustementsConditions: CONFIG.RDD.ajustementsConditions,
difficultesLibres: CONFIG.RDD.difficultesLibres, difficultesLibres: CONFIG.RDD.difficultesLibres,
etat: actor.getEtatGeneral(), etat: actor.getEtatGeneral(),
moral: actor.getMoralTotal(), /* La valeur du moral pour les jets de volonté */ moral: actor.getMoralTotal(), /* La valeur du moral pour les jets de volonté */
carac: actor.system.carac, carac: actorData.carac,
finalLevel: 0, finalLevel: 0,
diffConditions: 0, diffConditions: 0,
diffLibre: rollData.competence?.system.default_diffLibre ?? 0, diffLibre: rollData.competence?.system.default_diffLibre ?? 0,
malusArmureValue: actor.getMalusArmure(), malusArmureValue: actor.getMalusArmure(),
surencMalusFlag: actor.isPersonnage() ? (actor.system.compteurs.surenc.value < 0) : false, surencMalusFlag: actor.isPersonnage() ? (actorData.compteurs.surenc.value < 0) : false,
surencMalusValue: actor.computeMalusSurEncombrement(), surencMalusValue: actor.computeMalusSurEncombrement(),
useMalusSurenc: false, useMalusSurenc: false,
useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */ useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
@ -63,7 +64,11 @@ export class RdDRoll extends Dialog {
canClose: true, canClose: true,
isGM: game.user.isGM, isGM: game.user.isGM,
forceDiceResult: -1 forceDiceResult: -1
}; }
// Mini patch :Ajout du rêve actuel
if ( actorData.type == "personnage") {
defaultRollData.carac["reve-actuel"] = actorData.reve.reve
}
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false }); mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
if (rollData.forceCarac) { if (rollData.forceCarac) {
@ -73,7 +78,6 @@ export class RdDRoll extends Dialog {
RollDataAjustements.calcul(rollData, actor); RollDataAjustements.calcul(rollData, actor);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getDiviseurSignificative(rollData) { static getDiviseurSignificative(rollData) {
let facteurSign = 1; let facteurSign = 1;
@ -166,12 +170,12 @@ export class RdDRoll extends Dialog {
if (rollData.competence) { if (rollData.competence) {
const defaut_carac = rollData.competence.system.defaut_carac const defaut_carac = rollData.competence.system.defaut_carac
// Set the default carac from the competence item // Set the default carac from the competence item
rollData.selectedCarac = rollData.carac[defaut_carac] rollData.selectedCarac = rollData.carac[defaut_carac];
$("#carac").val(defaut_carac) $("#carac").val(defaut_carac);
} }
if (rollData.selectedSort) { if (rollData.selectedSort) {
dialog.setSelectedSort(rollData.selectedSort) dialog.setSelectedSort(rollData.selectedSort);
$(".draconic").val(rollData.selectedSort.data.listIndex) // Uniquement a la selection du sort, pour permettre de changer $(".draconic").val(rollData.selectedSort.system.listIndex); // Uniquement a la selection du sort, pour permettre de changer
} }
RdDItemSort.setCoutReveReel(rollData.selectedSort); RdDItemSort.setCoutReveReel(rollData.selectedSort);
$("#diffLibre").val(Misc.toInt(rollData.diffLibre)); $("#diffLibre").val(Misc.toInt(rollData.diffLibre));
@ -267,47 +271,47 @@ export class RdDRoll extends Dialog {
async setSelectedSort(sort) { async setSelectedSort(sort) {
this.rollData.selectedSort = sort; // Update the selectedCarac this.rollData.selectedSort = sort; // Update the selectedCarac
this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.data.draconic); this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic);
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord); this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7); this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(sort); RdDItemSort.setCoutReveReel(sort);
const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html", { sort: sort }); const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html", { sort: sort });
$(".sort-ou-rituel").text(sort.data.isrituel ? "rituel" : "sort"); $(".sort-ou-rituel").text(sort.system.isrituel ? "rituel" : "sort");
$(".bonus-case").text(`${this.rollData.bonus}%`); $(".bonus-case").text(`${this.rollData.bonus}%`);
$(".details-sort").remove(); $(".details-sort").remove();
$(".description-sort").append(htmlSortDescription); $(".description-sort").append(htmlSortDescription);
$(".roll-draconic").val(sort.data.listIndex); $(".roll-draconic").val(sort.system.listIndex);
$(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.data.difficulte)); $(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.system.difficulte));
$(".div-sort-ptreve-fixe").text(sort.data.ptreve); $(".div-sort-ptreve-fixe").text(sort.system.ptreve);
const diffVariable = RdDItemSort.isDifficulteVariable(sort); const diffVariable = RdDItemSort.isDifficulteVariable(sort);
const coutVariable = RdDItemSort.isCoutVariable(sort); const coutVariable = RdDItemSort.isCoutVariable(sort);
HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.data.isrituel); HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.system.isrituel);
HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable); HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable);
HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable); HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable);
HtmlUtility._showControlWhen($(".div-sort-ptreve-var"), coutVariable); HtmlUtility._showControlWhen($(".div-sort-ptreve-var"), coutVariable);
HtmlUtility._showControlWhen($(".div-sort-ptreve-fixe"), !coutVariable); HtmlUtility._showControlWhen($(".div-sort-ptreve-fixe"), !coutVariable);
} }
async setSelectedSigneDraconique(signe) { async setSelectedSigneDraconique(signe){
this.rollData.signe = signe; this.rollData.signe = signe;
this.rollData.diffLibre = Misc.data(signe).data.difficulte, this.rollData.diffLibre = Misc.data(signe).data.difficulte,
$(".signe-difficulte").text(Misc.toSignedString(this.rollData.diffLibre)); $(".signe-difficulte").text(Misc.toSignedString(this.rollData.diffLibre));
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async updateRollResult() { async updateRollResult() {
let rollData = this.rollData; let rollData = this.rollData;
rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat()); rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat())
rollData.caracValue = parseInt(rollData.selectedCarac.value); rollData.caracValue = parseInt(rollData.selectedCarac.value)
rollData.mortalite = rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite ?? 'mortel'; rollData.mortalite = rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite ?? 'mortel';
rollData.coupsNonMortels = (rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite) == 'non-mortel'; rollData.coupsNonMortels = (rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite) == 'non-mortel';
rollData.use.appelAuMoral = this.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac); rollData.use.appelAuMoral = this.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac);
let dmgText = Misc.toSignedString(rollData.dmg.total); let dmgText = Misc.toSignedString(rollData.dmg.total);
switch (rollData.mortalite) { switch (rollData.mortalite){
case 'non-mortel': dmgText = `(${dmgText}) non-mortel`; break; case 'non-mortel': dmgText = `(${dmgText}) non-mortel`; break;
case 'empoignade': dmgText = `empoignade`; break; case 'empoignade': dmgText = `empoignade`; break;
} }
RollDataAjustements.calcul(rollData, this.actor); RollDataAjustements.calcul(rollData, this.actor);
@ -339,7 +343,7 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
_computeFinalLevel(rollData) { _computeFinalLevel(rollData) {
return RollDataAjustements.sum(rollData.ajustements) return RollDataAjustements.sum(rollData.ajustements);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_computeDiffCompetence(rollData) { _computeDiffCompetence(rollData) {
@ -375,13 +379,13 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
_getTitle(rollData) { _getTitle(rollData) {
const carac = rollData.selectedCarac.label const carac = rollData.selectedCarac.label;
if (!rollData.competence) { if (!rollData.competence) {
return carac return carac;
} }
const compName = rollData.competence.name const compName = rollData.competence.name;
if (rollData.draconicList && rollData.selectedSort) { if (rollData.draconicList && rollData.selectedSort) {
return compName + " - " + rollData.selectedSort.name return compName + " - " + rollData.selectedSort.name;
} }
// If a weapon is there, add it in the title // If a weapon is there, add it in the title
const niveau = Misc.toSignedString(rollData.competence.system.niveau) const niveau = Misc.toSignedString(rollData.competence.system.niveau)

View File

@ -4,7 +4,7 @@ import { Misc } from "./misc.js";
export class RdDSheetUtility { export class RdDSheetUtility {
static getItem(event, actor) { static getItem(event, actor) {
return actor.items.get(RdDSheetUtility.getItemId(event)); return actor.items.get(RdDSheetUtility.getItemId(event))
} }
static getItemId(event) { static getItemId(event) {
@ -21,7 +21,7 @@ export class RdDSheetUtility {
} }
static prepareItemDropParameters(destItemId, actorId, dragData, objetVersConteneur) { static prepareItemDropParameters(destItemId, actorId, dragData, objetVersConteneur) {
const itemId = dragData.id || dragData._id const itemId = dragData.id || dragData.data._id
return { return {
destId: destItemId, destId: destItemId,
targetActorId: actorId, targetActorId: actorId,

View File

@ -147,6 +147,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/item-meditation-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-meditation-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-nourritureboisson-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-nourritureboisson-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-signedraconique-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-signedraconique-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-possession-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html',
'systems/foundryvtt-reve-de-dragon/templates/competence-base.html', 'systems/foundryvtt-reve-de-dragon/templates/competence-base.html',
'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.html',
@ -325,8 +326,8 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static checkNull(items) { static arrayOrEmpty(items) {
if (items && items.length) { if (items?.length) {
return items; return items;
} }
return []; return [];
@ -359,44 +360,44 @@ export class RdDUtility {
RdDUtility.filterEquipementParType(formData); RdDUtility.filterEquipementParType(formData);
formData.sorts = this.checkNull(formData.itemsByType['sort']); formData.sorts = this.arrayOrEmpty(formData.itemsByType['sort']);
formData.signesdraconiques = this.checkNull(formData.itemsByType['signedraconique']); formData.signesdraconiques = this.arrayOrEmpty(formData.itemsByType['signedraconique']);
formData.queues = this.checkNull(formData.itemsByType['queue']); formData.queues = this.arrayOrEmpty(formData.itemsByType['queue']);
formData.souffles = this.checkNull(formData.itemsByType['souffle']); formData.souffles = this.arrayOrEmpty(formData.itemsByType['souffle']);
formData.ombres = this.checkNull(formData.itemsByType['ombre']); formData.ombres = this.arrayOrEmpty(formData.itemsByType['ombre']);
formData.tetes = this.checkNull(formData.itemsByType['tete']); formData.tetes = this.arrayOrEmpty(formData.itemsByType['tete']);
formData.taches = this.checkNull(formData.itemsByType['tache']); formData.taches = this.arrayOrEmpty(formData.itemsByType['tache']);
formData.meditations = this.checkNull(formData.itemsByType['meditation']); formData.meditations = this.arrayOrEmpty(formData.itemsByType['meditation']);
formData.chants = this.checkNull(formData.itemsByType['chant']); formData.chants = this.arrayOrEmpty(formData.itemsByType['chant']);
formData.danses = this.checkNull(formData.itemsByType['danse']); formData.danses = this.arrayOrEmpty(formData.itemsByType['danse']);
formData.musiques = this.checkNull(formData.itemsByType['musique']); formData.musiques = this.arrayOrEmpty(formData.itemsByType['musique']);
formData.oeuvres = this.checkNull(formData.itemsByType['oeuvre']); formData.oeuvres = this.arrayOrEmpty(formData.itemsByType['oeuvre']);
formData.jeux = this.checkNull(formData.itemsByType['jeu']); formData.jeux = this.arrayOrEmpty(formData.itemsByType['jeu']);
formData.recettescuisine = this.checkNull(formData.itemsByType['recettecuisine']); formData.recettescuisine = this.arrayOrEmpty(formData.itemsByType['recettecuisine']);
formData.recettesAlchimiques = this.checkNull(formData.itemsByType['recettealchimique']); formData.recettesAlchimiques = this.arrayOrEmpty(formData.itemsByType['recettealchimique']);
formData.maladies = this.checkNull(formData.itemsByType['maladie']); formData.maladies = this.arrayOrEmpty(formData.itemsByType['maladie']);
formData.poisons = this.checkNull(formData.itemsByType['poison']); formData.poisons = this.arrayOrEmpty(formData.itemsByType['poison']);
formData.possessions = this.checkNull(formData.itemsByType['possession']); formData.possessions = this.arrayOrEmpty(formData.itemsByType['possession']);
formData.maladiesPoisons = formData.maladies.concat(formData.poisons); formData.maladiesPoisons = formData.maladies.concat(formData.poisons);
formData.competences = (formData.itemsByType.competence ?? []).concat(formData.itemsByType.competencecreature ?? []); formData.competences = (formData.itemsByType.competence ?? []).concat(formData.itemsByType.competencecreature ?? []);
} }
static filterEquipementParType(formData) { static filterEquipementParType(formData) {
formData.conteneurs = this.checkNull(formData.itemsByType['conteneur']); formData.conteneurs = this.arrayOrEmpty(formData.itemsByType['conteneur']);
formData.materiel = this.checkNull(formData.itemsByType['objet']); formData.materiel = this.arrayOrEmpty(formData.itemsByType['objet']);
formData.armes = this.checkNull(formData.itemsByType['arme']); formData.armes = this.arrayOrEmpty(formData.itemsByType['arme']);
formData.armures = this.checkNull(formData.itemsByType['armure']); formData.armures = this.arrayOrEmpty(formData.itemsByType['armure']);
formData.munitions = this.checkNull(formData.itemsByType['munition']); formData.munitions = this.arrayOrEmpty(formData.itemsByType['munition']);
formData.livres = this.checkNull(formData.itemsByType['livre']); formData.livres = this.arrayOrEmpty(formData.itemsByType['livre']);
formData.potions = this.checkNull(formData.itemsByType['potion']); formData.potions = this.arrayOrEmpty(formData.itemsByType['potion']);
formData.ingredients = this.checkNull(formData.itemsByType['ingredient']); formData.ingredients = this.arrayOrEmpty(formData.itemsByType['ingredient']);
formData.herbes = this.checkNull(formData.itemsByType['herbe']); formData.herbes = this.arrayOrEmpty(formData.itemsByType['herbe']);
formData.monnaie = this.checkNull(formData.itemsByType['monnaie']); formData.monnaie = this.arrayOrEmpty(formData.itemsByType['monnaie']);
formData.monnaie.sort(Monnaie.triValeurDenier()); formData.monnaie.sort(Monnaie.triValeurDenier());
formData.nourritureboissons = this.checkNull(formData.itemsByType['nourritureboisson']); formData.nourritureboissons = this.arrayOrEmpty(formData.itemsByType['nourritureboisson']);
formData.gemmes = this.checkNull(formData.itemsByType['gemme']); formData.gemmes = this.arrayOrEmpty(formData.itemsByType['gemme']);
formData.objets = formData.conteneurs formData.objets = formData.conteneurs
.concat(formData.materiel) .concat(formData.materiel)
@ -414,40 +415,40 @@ export class RdDUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static buildArbreDeConteneurs(conteneurs, objets) { static buildArbreDeConteneurs(conteneurs, objets) {
let objetVersConteneur = {} let objetVersConteneur = {};
// Attribution des objets aux conteneurs // Attribution des objets aux conteneurs
for (let conteneur of conteneurs) { for (let conteneur of conteneurs) {
conteneur.subItems = [] conteneur.subItems = [];
for (let id of conteneur.system.contenu ?? []) { for (let id of conteneur.system.contenu ?? []) {
let objet = objets.find(objet => (id == objet._id)) let objet = objets.find(objet => (id == objet._id));
if (objet) { if (objet) {
objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template
objetVersConteneur[id] = conteneur._id objetVersConteneur[id] = conteneur._id;
conteneur.subItems.push(objet) conteneur.subItems.push(objet);
} }
} }
} }
for (let conteneur of conteneurs) { for (let conteneur of conteneurs) {
conteneur.system.encTotal = RdDUtility.calculEncContenu(conteneur, objets) conteneur.system.encTotal = RdDUtility.calculEncContenu(conteneur, objets);
} }
return objetVersConteneur return objetVersConteneur;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static calculEncContenu(conteneur, objets) { static calculEncContenu(conteneur, objets) {
const contenuDatas = (conteneur.system.contenu ?? []).filter(id => id != undefined) const contenuDatas = (conteneur.system.contenu ?? []).filter(id => id != undefined)
.map(id => objets.find(it => (id == it._id)) ) .map(id => Misc.data(objets.find(it => (id == it._id))))
.filter(it => it) .filter(it => it);
let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1) let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1);
for (let subContenu of contenuDatas) { for (let itemData of contenuDatas) {
if (subContenu.type == 'conteneur') { if (itemData.type == 'conteneur') {
enc += RdDUtility.calculEncContenu(subContenu, objets) enc += RdDUtility.calculEncContenu(itemData, objets);
} }
else { else {
enc += Number(subContenu.system.encombrement ?? 0) * Number(subContenu.system.quantite ?? 1) enc += Number(itemData.system.encombrement ?? 0) * Number(itemData.system.quantite ?? 1)
} }
} }
return enc; return enc
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -472,6 +473,7 @@ export class RdDUtility {
return str; return str;
} }
/* -------------------------------------------- */
static buildContenu(objet, niveau, afficherContenu) { static buildContenu(objet, niveau, afficherContenu) {
if (!niveau) niveau = 1; if (!niveau) niveau = 1;
objet.niveau = niveau; objet.niveau = niveau;
@ -691,9 +693,10 @@ export class RdDUtility {
// gestion bouton tchat Acheter // gestion bouton tchat Acheter
html.on("click", '.defense-possession', event => { html.on("click", '.defense-possession', event => {
let actorId = event.currentTarget.attributes['data-defenderId'].value; let attackerId = event.currentTarget.attributes['data-attackerId'].value
let possessionId = event.currentTarget.attributes['data-possessionId'].value; let defenderId = event.currentTarget.attributes['data-defenderId'].value
RdDPossession.onDefensePossession(actorId, possessionId); let possessionId = event.currentTarget.attributes['data-possessionId'].value
RdDPossession.onDefensePossession(attackerId, defenderId, possessionId)
}); });
// gestion bouton tchat Acheter // gestion bouton tchat Acheter

View File

@ -19,9 +19,9 @@ import { ReglesOptionelles } from "./regles-optionelles.js";
*/ */
export const referenceAjustements = { export const referenceAjustements = {
competence: { competence: {
isUsed: (rollData, actor) => rollData.competence, isUsed: (rollData, actor) => Misc.data(rollData.competence),
getLabel: (rollData, actor) => rollData.competence?.name, getLabel: (rollData, actor) => Misc.data(rollData.competence)?.name,
getValue: (rollData, actor) => rollData.competence?.system.niveau, getValue: (rollData, actor) => Misc.data(rollData.competence)?.system?.niveau,
}, },
meditation: { meditation: {
isUsed: (rollData, actor) => rollData.meditation, isUsed: (rollData, actor) => rollData.meditation,
@ -33,7 +33,7 @@ export const referenceAjustements = {
getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre', getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre',
getValue: (rollData, actor) => rollData.selectedSort getValue: (rollData, actor) => rollData.selectedSort
? RdDItemSort.getDifficulte(rollData.selectedSort, rollData.diffLibre) ? RdDItemSort.getDifficulte(rollData.selectedSort, rollData.diffLibre)
: rollData.diffLibre ?? rollData.competence?.system.default_diffLibre ?? 0 : rollData.diffLibre ?? Misc.data(rollData.competence)?.data.default_diffLibre ?? 0
}, },
diffConditions: { diffConditions: {
isUsed: (rollData, actor) => rollData.diffConditions != undefined, isUsed: (rollData, actor) => rollData.diffConditions != undefined,
@ -95,10 +95,10 @@ export const referenceAjustements = {
getDescr: (rollData, actor) => rollData.diviseurSignificative > 1 ? `Facteur significative <span class="rdd-diviseur">&times;${Misc.getFractionHtml(rollData.diviseurSignificative)}</span>` : '' getDescr: (rollData, actor) => rollData.diviseurSignificative > 1 ? `Facteur significative <span class="rdd-diviseur">&times;${Misc.getFractionHtml(rollData.diviseurSignificative)}</span>` : ''
}, },
isEcaille: { isEcaille: {
isVisible: (rollData, actor) => rollData.arme?.data.magique && Number(rollData.arme?.data.ecaille_efficacite) > 0, isVisible: (rollData, actor) => Misc.data(rollData.arme)?.system.magique && Number(Misc.data(rollData.arme)?.system.ecaille_efficacite) > 0,
isUsed: (rollData, actor) => rollData.arme?.data.magique && Number(rollData.arme?.data.ecaille_efficacite) > 0, isUsed: (rollData, actor) => Misc.data(rollData.arme)?.system.magique && Number(Misc.data(rollData.arme)?.system.ecaille_efficacite) > 0,
getLabel: (rollData, actor) => "Ecaille d'Efficacité: ", getLabel: (rollData, actor) => "Ecaille d'Efficacité: ",
getValue: (rollData, actor) => Math.max(Number(rollData.arme?.data.ecaille_efficacite), 0), getValue: (rollData, actor) => Math.max(Number(Misc.data(rollData.arme)?.system.ecaille_efficacite), 0),
}, },
finesse: { finesse: {
isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData), isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData),

View File

@ -2,7 +2,6 @@ import { TMRRencontres } from "./tmr-rencontres.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
import { tmrConstants } from "./tmr-constants.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
const TMRMapping = { const TMRMapping = {
@ -12,7 +11,7 @@ const TMRMapping = {
D1: { type: "fleuve", label: "Fleuve de l'Oubli" }, D1: { type: "fleuve", label: "Fleuve de l'Oubli" },
E1: { type: "monts", label: "Monts de Kanaï" }, E1: { type: "monts", label: "Monts de Kanaï" },
F1: { type: "cite", label: "Cité Glauque" }, F1: { type: "cite", label: "Cité Glauque" },
G1: { type: "desolation", label: "Désolation de Demain" }, G1: { type: "desolation", label: "Désolation de Jamais" },
H1: { type: "lac", label: "Lac dAnticalme" }, H1: { type: "lac", label: "Lac dAnticalme" },
I1: { type: "plaines", label: "Plaines Grises" }, I1: { type: "plaines", label: "Plaines Grises" },
J1: { type: "monts", label: "Monts Fainéants" }, J1: { type: "monts", label: "Monts Fainéants" },
@ -70,7 +69,7 @@ const TMRMapping = {
F5: { type: "cite", label: "Cité de Panople" }, F5: { type: "cite", label: "Cité de Panople" },
G5: { type: "pont", label: "Pont dIk" }, G5: { type: "pont", label: "Pont dIk" },
H5: { type: "desert", label: "Désert de Krane" }, H5: { type: "desert", label: "Désert de Krane" },
I5: { type: "desolation", label: "Désolation de Demain" }, I5: { type: "desolation", label: "Désolation de Toujours" },
J5: { type: "marais", label: "Marais de Jab" }, J5: { type: "marais", label: "Marais de Jab" },
K5: { type: "fleuve", label: "Fleuve de l'Oubli" }, K5: { type: "fleuve", label: "Fleuve de l'Oubli" },
L5: { type: "collines", label: "Collines Suaves" }, L5: { type: "collines", label: "Collines Suaves" },
@ -86,9 +85,9 @@ const TMRMapping = {
H6: { type: "monts", label: "Monts Gurdes" }, H6: { type: "monts", label: "Monts Gurdes" },
I6: { type: "necropole", label: "Nécropole de Xotar" }, I6: { type: "necropole", label: "Nécropole de Xotar" },
J6: { type: "lac", label: "Lac dIaupe" }, J6: { type: "lac", label: "Lac dIaupe" },
K6: { type: "desolation", label: "Désolation de Demain" }, K6: { type: "desolation", label: "Désolation de Poor" },
L6: { type: "foret", label: "Forêt Gueuse" }, L6: { type: "foret", label: "Forêt Gueuse" },
M6: { type: "desolation", label: "Désolation de Demain" }, M6: { type: "desolation", label: "Désolation de Presque" },
A7: { type: "plaines", label: "Plaines de lArc" }, A7: { type: "plaines", label: "Plaines de lArc" },
B7: { type: "marais", label: "Marais Bluants" }, B7: { type: "marais", label: "Marais Bluants" },
@ -124,7 +123,7 @@ const TMRMapping = {
D9: { type: "pont", label: "Pont dOrx" }, D9: { type: "pont", label: "Pont dOrx" },
E9: { type: "fleuve", label: "Fleuve de l'Oubli" }, E9: { type: "fleuve", label: "Fleuve de l'Oubli" },
F9: { type: "plaines", label: "Plaines de Foe" }, F9: { type: "plaines", label: "Plaines de Foe" },
G9: { type: "desolation", label: "Désolation de Demain" }, G9: { type: "desolation", label: "Désolation de Sel" },
H9: { type: "collines", label: "Collines de Noirseul" }, H9: { type: "collines", label: "Collines de Noirseul" },
I9: { type: "fleuve", label: "Fleuve de l'Oubli" }, I9: { type: "fleuve", label: "Fleuve de l'Oubli" },
J9: { type: "marais", label: "Marais Gronchants" }, J9: { type: "marais", label: "Marais Gronchants" },
@ -146,10 +145,10 @@ const TMRMapping = {
L10: { type: "desert", label: "Désert de Nicrop" }, L10: { type: "desert", label: "Désert de Nicrop" },
M10: { type: "foret", label: "Forêt de Jajou" }, M10: { type: "foret", label: "Forêt de Jajou" },
A11: { type: "desolation", label: "Désolation de Demain" }, A11: { type: "desolation", label: "Désolation dHier" },
B11: { type: "cite", label: "Cité de Brilz" }, B11: { type: "cite", label: "Cité de Brilz" },
C11: { type: "pont", label: "Pont de Roï" }, C11: { type: "pont", label: "Pont de Roï" },
D11: { type: "desolation", label: "Désolation de Demain" }, D11: { type: "desolation", label: "Désolation de Partout" },
E11: { type: "lac", label: "Lac de Glinster" }, E11: { type: "lac", label: "Lac de Glinster" },
F11: { type: "cite", label: "Cité de Noape" }, F11: { type: "cite", label: "Cité de Noape" },
G11: { type: "fleuve", label: "Fleuve de l'Oubli" }, G11: { type: "fleuve", label: "Fleuve de l'Oubli" },
@ -170,7 +169,7 @@ const TMRMapping = {
H12: { type: "collines", label: "Collines de Tooth" }, H12: { type: "collines", label: "Collines de Tooth" },
I12: { type: "gouffre", label: "Gouffre Abimeux" }, I12: { type: "gouffre", label: "Gouffre Abimeux" },
J12: { type: "cite", label: "Cité Folle" }, J12: { type: "cite", label: "Cité Folle" },
K12: { type: "desolation", label: "Désolation de Demain" }, K12: { type: "desolation", label: "Désolation dAmour" },
L12: { type: "plaines", label: "Plaines Venteuses" }, L12: { type: "plaines", label: "Plaines Venteuses" },
M12: { type: "collines", label: "Collines Révulsantes" }, M12: { type: "collines", label: "Collines Révulsantes" },
@ -181,7 +180,7 @@ const TMRMapping = {
E13: { type: "plaines", label: "Plaines de Xnez" }, E13: { type: "plaines", label: "Plaines de Xnez" },
F13: { type: "foret", label: "Forêt des Cris" }, F13: { type: "foret", label: "Forêt des Cris" },
G13: { type: "plaines", label: "Plaines Calcaires" }, G13: { type: "plaines", label: "Plaines Calcaires" },
H13: { type: "desolation", label: "Désolation de Demain" }, H13: { type: "desolation", label: "Désolation de Rien" },
I13: { type: "monts", label: "Monts Bigleux" }, I13: { type: "monts", label: "Monts Bigleux" },
J13: { type: "gouffre", label: "Gouffre de Gromph" }, J13: { type: "gouffre", label: "Gouffre de Gromph" },
K13: { type: "foret", label: "Forêt de Kluth" }, K13: { type: "foret", label: "Forêt de Kluth" },
@ -200,7 +199,7 @@ const TMRMapping = {
J14: { type: "desert", label: "Désert de Sank" }, J14: { type: "desert", label: "Désert de Sank" },
K14: { type: "necropole", label: "Nécropole dAntinéar" }, K14: { type: "necropole", label: "Nécropole dAntinéar" },
L14: { type: "plaines", label: "Plaines de Jislith" }, L14: { type: "plaines", label: "Plaines de Jislith" },
M14: { type: "desolation", label: "Désolation de Demain" }, M14: { type: "desolation", label: "Désolation dAprès" },
A15: { type: "cite", label: "Cité de Mielh" }, A15: { type: "cite", label: "Cité de Mielh" },
C15: { type: "plaines", label: "Plaines de Toué" }, C15: { type: "plaines", label: "Plaines de Toué" },

View File

@ -16,7 +16,7 @@ import { Conquete } from "./conquete.js";
import { Pelerinage } from "./pelerinage.js"; import { Pelerinage } from "./pelerinage.js";
import { Periple } from "./periple.js"; import { Periple } from "./periple.js";
import { UrgenceDraconique } from "./urgence-draconique.js"; import { UrgenceDraconique } from "./urgence-draconique.js";
import { Misc } from "../misc.js"; import { Grammar } from "../grammar.js";
export class EffetsDraconiques { export class EffetsDraconiques {
@ -111,36 +111,42 @@ export class EffetsDraconiques {
); );
} }
static filterItems(actor, filter, name) {
return actor.data.items.filter(filter)
.filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
}
static isDonDoubleReve(actor) { static isDonDoubleReve(actor) {
return actor.data.items.find(it => Draconique.isTeteDragon(it) && it.name == 'Don de double-rêve'); return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'Don de double-rêve').length>0;
} }
static isConnaissanceFleuve(actor) { static isConnaissanceFleuve(actor) {
return actor.data.items.find(it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes('connaissance du fleuve')); return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'connaissance du fleuve').length>0;
} }
static isReserveEnSecurite(actor) { static isReserveEnSecurite(actor) {
return actor.data.items.find(it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes(' en sécurité')); return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, 'réserve en sécurité').length>0;
} }
static isDeplacementAccelere(actor) { static isDeplacementAccelere(actor) {
return actor.data.items.find(it => Draconique.isTeteDragon(it) && it.name.toLowerCase().includes(' déplacement accéléré')); return EffetsDraconiques.filterItems(actor, Draconique.isTeteDragon, ' déplacement accéléré').length>0;
} }
static isDoubleResistanceFleuve(actor) { static isDoubleResistanceFleuve(actor) {
return actor.data.items.find(it => Draconique.isSouffleDragon(it) && it.name.toLowerCase().includes('résistance du fleuve')); return EffetsDraconiques.filterItems(actor, Draconique.isSouffleDragon, 'résistance du fleuve').length>0;
} }
static countInertieDraconique(actor) { static countInertieDraconique(actor) {
return actor.data.items.filter(it => Draconique.isQueueDragon(it) && it.name.toLowerCase().includes('inertie draconique')).length; return EffetsDraconiques.filterItems(actor, Draconique.isQueueDragon, 'inertie draconique').length;
} }
static countMonteeLaborieuse(actor) { static countMonteeLaborieuse(actor) {
return actor.data.items.filter(it => Draconique.isQueueSouffle(it) && it.name.toLowerCase().includes('montée laborieuse')).length; return EffetsDraconiques.filterItems(actor, Draconique.isQueueSouffle, 'montée laborieuse').length;
} }
static mauvaiseRencontre(actor) { static mauvaiseRencontre(actor) {
return actor.data.items.find(it => Draconique.isQueueSouffle(it) && it.name.toLowerCase().includes('mauvaise rencontre')); const mauvaisesRencontres = EffetsDraconiques.filterItems(actor, Draconique.isQueueSouffle, 'mauvaise rencontre');
return mauvaisesRencontres.length>0 ? mauvaisesRencontres[0] : undefined;
} }
static isPontImpraticable(actor) { static isPontImpraticable(actor) {
@ -152,7 +158,7 @@ export class EffetsDraconiques {
} }
static isPeage(actor) { static isPeage(actor) {
return actor.data.items.find(it => Draconique.isSouffleDragon(it) && it.name.toLowerCase().includes('péage')); return EffetsDraconiques.filterItems(actor, Draconique.isSouffleDragon, 'péage').length > 0;
} }

View File

@ -25,7 +25,7 @@ export class PixiTMR {
for (const [name, img] of Object.entries(PixiTMR.textures)) { for (const [name, img] of Object.entries(PixiTMR.textures)) {
loader = loader.add(name, img); loader = loader.add(name, img);
} }
loader.onLoad.add((error, resaon) => { console.log("ERROR", error, resaon) }); loader.onLoad.add((error, reason) => { console.log("ERROR", error, reason) });
loader.load( (loader, resources) => { loader.load( (loader, resources) => {
onLoad(loader, resources); onLoad(loader, resources);
for (let onAnimate of this.callbacksOnAnimate) { for (let onAnimate of this.callbacksOnAnimate) {

View File

@ -55,7 +55,6 @@
{{/each}} {{/each}}
<li class="flexrow"> <li class="flexrow">
<span class="carac-label" name="carac-total">Total Caractéristiques</span> <span class="carac-label" name="carac-total">Total Caractéristiques</span>
{{log 'data-actor-creature' this}}
<span class="competence-value" name="carac-total-value">{{calc.caracTotal}}</span> <span class="competence-value" name="carac-total-value">{{calc.caracTotal}}</span>
</li> </li>
</ol> </ol>
@ -103,11 +102,11 @@
<span class="competence-label">{{comp.name}}</span> <span class="competence-label">{{comp.name}}</span>
</a> </a>
<input class="competence-value creature-carac" type="text" compname="{{comp.name}}" <input class="competence-value creature-carac" type="text" compname="{{comp.name}}"
value="{{comp.system.carac_value}}" data-dtype="number" /> value="{{comp.data.carac_value}}" data-dtype="number" />
<input class="competence-value creature-niveau" type="text" compname="{{comp.name}}" <input class="competence-value creature-niveau" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.system.niveau decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" />
<input class="competence-value creature-dommages" type="text" compname="{{comp.name}}" <input class="competence-value creature-dommages" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.system.dommages decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.data.dommages decimals=0 sign=true}}" data-dtype="number" />
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
@ -168,7 +167,7 @@
<div class="form-group editor"> <div class="form-group editor">
<span class="item-name"><h4>Description</h4> <span class="item-name"><h4>Description</h4>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}} {{editor data.description target="system.description" button=true owner=owner editable=true}}
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}

View File

@ -99,11 +99,11 @@
<img class="sheet-competence-img" src="{{comp.img}}" /> <img class="sheet-competence-img" src="{{comp.img}}" />
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value creature-carac" type="text" compname="{{comp.name}}" <input class="competence-value creature-carac" type="text" compname="{{comp.name}}"
value="{{comp.system.carac_value}}" data-dtype="number" /> value="{{comp.data.carac_value}}" data-dtype="number" />
<input class="competence-value creature-niveau" type="text" compname="{{comp.name}}" <input class="competence-value creature-niveau" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.system.niveau decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" />
<input class="competence-value creature-dommages" type="text" compname="{{comp.name}}" <input class="competence-value creature-dommages" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.system.dommages decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.data.dommages decimals=0 sign=true}}" data-dtype="number" />
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
@ -133,7 +133,7 @@
{{!-- Biography Tab --}} {{!-- Biography Tab --}}
<div class="tab description" data-group="primary" data-tab="description"> <div class="tab description" data-group="primary" data-tab="description">
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}} {{editor data.description target="system.description" button=true owner=owner editable=true}}
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}
</div> </div>

View File

@ -1,11 +1,11 @@
{{#if isVisible}} {{#if visible}}
<li class="item flexrow list-item {{#if data.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}"> <li class="item flexrow list-item {{#if system.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}">
<a class="competence-label" name="{{name}}"> <a class="competence-label" name="{{name}}">
<img class="sheet-competence-img" src="{{img}}"/> <img class="sheet-competence-img" src="{{img}}"/>
<span class="competence-label">{{name}}</span> <span class="competence-label">{{name}}</span>
</a> </a>
{{#if data.isLevelUp}} {{#if system.isLevelUp}}
<span class="tooltiptext ttt-xp">Vous pouvez dépenser {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span> <span class="tooltiptext ttt-xp">Vous pouvez dépenser {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
<a class="item-control competence-xp-augmenter" compname="{{name}}" title="Augmenter"> <a class="item-control competence-xp-augmenter" compname="{{name}}" title="Augmenter">
<i class="fas fa-arrow-alt-circle-up"></i> <i class="fas fa-arrow-alt-circle-up"></i>
@ -32,8 +32,8 @@
<div class="item-controls"> <div class="item-controls">
{{#if system.stressXpMax}} {{#if system.stressXpMax}}
<a class="item-control competence-stress-augmenter" compname="{{name}}" <a class="item-control competence-stress-augmenter" compname="{{name}}"
title="Dépenser {{data.stressXpMax}} points de stress {{#if data.isStressLevelUp}} pour augmenter d'un niveau {{/if}}"> title="Dépenser {{system.stressXpMax}} points de stress {{#if system.isStressLevelUp}} pour augmenter d'un niveau {{/if}}">
<i class="fas fa-arrow-alt-circle-up allouer-stress{{#if data.isStressLevelUp}}-level-up{{/if}}"></i> <i class="fas fa-arrow-alt-circle-up allouer-stress{{#if system.isStressLevelUp}}-level-up{{/if}}"></i>
</a> </a>
{{else}} {{else}}
<i class="far fa-circle"></i> <i class="far fa-circle"></i>

View File

@ -1,6 +1,6 @@
{{#if options.isGM}} {{#if options.isGM}}
<h3>Notes du MJ : </h3> <h3>Notes du MJ : </h3>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.notesmj target="data.notesmj" button=true owner=owner editable=editable}} {{editor system.notesmj target="system.notesmj" button=true owner=owner editable=editable}}
</div> </div>
{{/if}} {{/if}}

View File

@ -286,7 +286,7 @@
</li> </li>
{{#each combat as |arme key|}} {{#each combat as |arme key|}}
<li class="item flexrow list-item" data-item-id="{{arme._id}}" <li class="item flexrow list-item" data-item-id="{{arme._id}}"
data-arme-name="{{arme.name}}" data-competence-name="{{arme.system.competence}}" > data-arme-name="{{arme.name}}" data-competence-name="{{arme.data.competence}}" >
<span class="arme-label"> <span class="arme-label">
<a> <a>
{{#if arme.img}} {{#if arme.img}}
@ -295,10 +295,10 @@
<span>{{arme.name}}</span> <span>{{arme.name}}</span>
</a> </a>
</span> </span>
<span class="arme-initiative"><a>{{arme.system.initiative}}</a></span> <span class="arme-initiative"><a>{{arme.data.initiative}}</a></span>
<span class="competence-label">{{arme.system.competence}}</span> <span class="competence-label">{{arme.data.competence}}</span>
<span class="competence-value">{{numberFormat arme.system.niveau decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat arme.data.niveau decimals=0 sign=true}}</span>
<span class="competence-value">{{numberFormat arme.system.dommagesReels decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat arme.data.dommagesReels decimals=0 sign=true}}</span>
</li> </li>
{{/each}} {{/each}}
{{#each esquives as |esq key|}} {{#each esquives as |esq key|}}
@ -307,12 +307,11 @@
<a class="competence-label" name="{{esq.name}}"> <a class="competence-label" name="{{esq.name}}">
<img class="sheet-competence-img" src="{{esq.img}}"/> <img class="sheet-competence-img" src="{{esq.img}}"/>
<span>{{esq.name}}</span> <span>{{esq.name}}</span>
{{log esq}}
</a> </a>
</span> </span>
<span class="arme-initiative"></span> <span class="arme-initiative"></span>
<span class="competence-label"></span> <span class="competence-label"></span>
<span class="competence-value">{{numberFormat esq.system.niveau decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat esq.data.niveau decimals=0 sign=true}}</span>
<span class="competence-value"></span> <span class="competence-value"></span>
</li> </li>
{{/each}} {{/each}}
@ -334,7 +333,7 @@
{{#each maladiesPoisons as |maladie key|}} {{#each maladiesPoisons as |maladie key|}}
<li class="item flexrow list-item" data-item-id="{{maladie._id}}"> <li class="item flexrow list-item" data-item-id="{{maladie._id}}">
<span class="competence-label"> <span class="competence-label">
{{#if (or @root.options.isGM maladie.system.identifie)}} {{#if (or @root.options.isGM maladie.data.identifie)}}
{{maladie.name}} {{maladie.name}}
{{else}} {{else}}
Inconnue Inconnue
@ -342,8 +341,8 @@
</span> </span>
<span class="competence-label">{{maladie.type}}</span> <span class="competence-label">{{maladie.type}}</span>
<span class="competence-label"> <span class="competence-label">
{{#if (or @root.options.isGM maladie.system.remedesconnus)}} {{#if (or @root.options.isGM maladie.data.remedesconnus)}}
{{maladie.system.remedes}} {{maladie.data.remedes}}
{{else}} {{else}}
Remèdes Inconnus Remèdes Inconnus
{{/if}} {{/if}}
@ -366,7 +365,7 @@
{{#each possessions as |possession key|}} {{#each possessions as |possession key|}}
<li class="item flexrow list-item" data-item-id="{{possession._id}}"> <li class="item flexrow list-item" data-item-id="{{possession._id}}">
<span class="competence-label"> <span class="competence-label">
{{possession.name}} <a class="sheet-possession-attack">{{possession.name}} (Conjurer)</a>
</span> </span>
<span class="competence-label">{{possession.system.type}}</span> <span class="competence-label">{{possession.system.type}}</span>
<div class="item-controls"> <div class="item-controls">
@ -408,7 +407,7 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=danse typeOeuvre="Danse" classOeuvre="danse-label"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=danse typeOeuvre="Danse" classOeuvre="danse-label"}}
{{/each}} {{/each}}
{{#each oeuvres as |oeuvre id|}} {{#each oeuvres as |oeuvre id|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=oeuvre typeOeuvre=oeuvre.data.competence classOeuvre="oeuvre-label"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=oeuvre typeOeuvre=oeuvre.system.competence classOeuvre="oeuvre-label"}}
{{/each}} {{/each}}
{{#each recettescuisine as |recette id|}} {{#each recettescuisine as |recette id|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}}
@ -509,65 +508,8 @@
</ul> </ul>
</div> </div>
<hr> <hr>
{{#if data.attributs.hautrevant.value}}
{{#if options.isGM}}
<h3>Signes draconiques</h3>
<ul class="item-list alterne-list">
{{#each signesdraconiques as |signe key|}}
<li class="item list-item flexrow" data-item-id="{{signe._id}}" data-attribute="{{key}}">
<span class="display-label flex-grow"> <a data-item-id="{{signe._id}}">{{signe.name}}</a></span>
<span class="flex-shrink">{{signe.system.difficulte}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
<h3>Sorts:</h3>
<ul class="item-list alterne-list">
{{#each sorts as |sort key|}}
<li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}">
<span class="display-label flex-grow"> <a data-item-id="{{sort._id}}">{{sort.name}}</a></span>
<span>{{sort.system.draconic}} / {{sort.system.difficulte}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Sorts en Réserve:</h3>
<ul class="item-list alterne-list">
{{#each hautreve.sortsReserve as |reserve key|}}
<li class="item list-item flexrow" data-item-id="{{reserve._id}}" data-attribute="{{key}}">
<img class="sheet-competence-img" src="{{reserve.sort.img}}" />
<span class="display-label flex-grow">{{reserve.sort.name}}</span>
<span class="flex-shrink">r{{reserve.sort.data.ptreve_reel}}</span>
<span class="flex-shrink">{{reserve.coord}}</span>
<span>{{caseTmr-label reserve.coord}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete flex-shrink" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Méditations:</h3>
<ul class="item-list">
{{#each meditations as |meditation key|}}
<li class="item flexrow" data-item-id="{{meditation._id}}" data-attribute="{{key}}">
<span class="meditation-label flex-grow"><a data-item-id="{{meditation._id}}">{{meditation.name}} - {{meditation.system.competence}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<hr>
{{/if}}
{{!-- Queues, Souffles, Tetes, Ombre --}} {{!-- Queues, Souffles, Tetes, Ombre --}}
{{#if queues.length}}
<h3>Queues:</h3> <h3>Queues:</h3>
<ul class="flex-group-left"> <ul class="flex-group-left">
{{#each queues as |queue key|}} {{#each queues as |queue key|}}
@ -579,28 +521,8 @@
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
<h3>Souffles:</h3> {{/if}}
<ul class="item-list"> {{#if ombres.length}}
{{#each souffles as |souffle key|}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{souffle._id}}">
<span class="display-label flex-grow"><a data-item-id="{{souffle._id}}">{{souffle.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Tetes:</h3>
<ul class="item-list">
{{#each tetes as |tete key|}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{tete._id}}">
<span class="display-label flex-grow"><a data-item-id="{{tete._id}}">{{tete.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Ombres de Thanatos:</h3> <h3>Ombres de Thanatos:</h3>
<ul class="item-list"> <ul class="item-list">
{{#each ombres as |ombre key|}} {{#each ombres as |ombre key|}}
@ -612,35 +534,128 @@
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
{{/if}}
{{#if souffles.length}}
<h3>Souffles:</h3>
<ul class="item-list">
{{#each souffles as |souffle key|}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{souffle._id}}">
<span class="display-label flex-grow"><a data-item-id="{{souffle._id}}">{{souffle.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
{{#if tetes.length}}
<h3>Tetes:</h3>
<ul class="item-list">
{{#each tetes as |tete key|}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{tete._id}}">
<span class="display-label flex-grow"><a data-item-id="{{tete._id}}">{{tete.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
{{#if data.attributs.hautrevant.value}} {{#if data.attributs.hautrevant.value}}
{{#if (and options.isGM signesdraconiques.length)}}
<h3>Signes draconiques</h3>
<ul class="item-list alterne-list">
{{#each signesdraconiques as |signe key|}}
<li class="item list-item flexrow" data-item-id="{{signe._id}}" data-attribute="{{key}}">
<span class="display-label flex-grow"> <a data-item-id="{{signe._id}}">{{signe.name}}</a></span>
<span class="flex-shrink">{{signe.data.difficulte}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
{{#if hautreve.rencontres.length}}
<h3>Rencontres présentes:</h3>
<ul class="item-list">
{{#each hautreve.rencontres as |rencontre key|}}
<li class="item flexrow" data-item-id="{{key}}" data-attribute="{{key}}">
<span class="display-label"><a data-item-id="{{key}}">{{rencontre.name}} r{{rencontre.force}}</a></span>
<span class="flex-shrink">{{rencontre.coord}} - {{caseTmr-label rencontre.coord}}</span>
{{#if rencontre.date}}
<span>{{upperFirst rencontre.heure}}, le {{rencontre.date}}</span>
{{/if}}
<div class="item-controls flex-shrink">
<a class="item-control rencontre-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
{{#if hautreve.sortsReserve.length}}
<h3>Sorts en Réserve:</h3>
<ul class="item-list alterne-list">
{{#each hautreve.sortsReserve as |reserve key|}}
<li class="item list-item flexrow" data-item-id="{{reserve._id}}" data-attribute="{{key}}">
<img class="sheet-competence-img" src="{{reserve.sort.img}}" />
<span class="display-label">{{reserve.sort.name}} r{{reserve.sort.data.ptreve_reel}}</span>
<span>{{reserve.coord}} - {{caseTmr-label reserve.coord}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete flex-shrink" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
<hr>
<h3>Sorts:</h3>
<ul class="item-list alterne-list">
{{#each sorts as |sort key|}}
<li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}">
<span class="display-label flex-grow">
<a data-item-id="{{sort._id}}">{{sort.name}}
- {{#if sort.data.caseTMRspeciale}}{{sort.data.caseTMRspeciale}}{{else}}{{upperFirst sort.data.caseTMR}}{{/if}}
</a>
</span>
<span>{{sort.data.draconic}} / {{sort.data.difficulte}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Méditations:</h3>
<ul class="item-list">
{{#each meditations as |meditation key|}}
<li class="item flexrow" data-item-id="{{meditation._id}}" data-attribute="{{key}}">
<span class="meditation-label flex-grow"><a data-item-id="{{meditation._id}}">{{meditation.name}} - {{meditation.data.competence}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<hr> <hr>
<h3>Rencontres présentes:</h3> {{#if hautreve.casesTmr}}
<ul class="item-list"> <h3>Cases Spéciales:</h3>
{{#each hautreve.rencontres as |rencontre key|}} <ul class="item-list">
<li class="item flexrow" data-item-id="{{key}}" data-attribute="{{key}}"> {{#each hautreve.casesTmr as |casetmr key|}}
<span class="display-label"><a data-item-id="{{key}}">{{rencontre.name}} - {{rencontre.coord}}</a></span> <li class="item flexrow" data-item-id="{{casetmr._id}}" data-attribute="{{key}}">
<span class="flex-shrink">{{caseTmr-label rencontre.coord}}</span> <span class="display-label"><a data-item-id="{{casetmr._id}}">{{casetmr.name}}</a></span>
{{#if rencontre.date}} <span>{{casetmr.data.coord}} - {{caseTmr-label casetmr.data.coord}}</span>
<span>Le {{rencontre.date}} à {{rencontre.heure}}</span> <div class="item-controls flex-shrink">
{{/if}} <a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
<div class="item-controls flex-shrink"> </div>
<a class="item-control rencontre-delete" title="Supprimer"><i class="fas fa-trash"></i></a> </li>
</div> {{/each}}
</li> </ul>
{{/each}} {{/if}}
</ul>
<hr>
<h3>Cases Spéciales:</h3>
<ul class="item-list">
{{#each hautreve.casesTmr as |casetmr key|}}
<li class="item flexrow" data-item-id="{{casetmr._id}}" data-attribute="{{key}}">
<span class="display-label"><a data-item-id="{{casetmr._id}}">{{casetmr.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<br><br> <br><br>
{{/if}} {{/if}}
</div> </div>
@ -780,11 +795,11 @@
<article class="flexcol"> <article class="flexcol">
<h3>Biographie : </h3> <h3>Biographie : </h3>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.biographie target="data.biographie" button=true owner=owner editable=editable}} {{editor data.biographie target="system.biographie" button=true owner=owner editable=editable}}
</div> </div>
<h3>Notes : </h3> <h3>Notes : </h3>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}} {{editor data.notes target="system.notes" button=true owner=owner editable=editable}}
</div> </div>
<h3>Journal d'Experience</h3> <h3>Journal d'Experience</h3>
<div class="form-group editor"> <div class="form-group editor">

View File

@ -92,10 +92,10 @@
<li class="item flexrow list-item" data-item-id="{{item._id}}"> <li class="item flexrow list-item" data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/> <img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<span class="item-name flex-grow">{{item.name}}</span> <span class="item-name flex-grow">{{item.name}}</span>
<span class="item-quantite">{{item.system.quantite}}</span> <span class="item-quantite">{{item.data.quantite}}</span>
<span class="item-quantite">{{numberFormat item.system.encTotal decimals=2}}</span> <span class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</span>
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-equip" title="Equiper">{{#if item.system.equipe}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a> <a class="item-control item-equip" title="Equiper">{{#if item.data.equipe}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a> <a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a> <a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div> </div>

View File

@ -30,4 +30,11 @@
{{/if}} {{/if}}
<br>Points de Possession: {{possession.ptsPossession}} <br>Points de Possession: {{possession.ptsPossession}}
<br>Points de Conjuration: {{possession.ptsConjuration}} <br>Points de Conjuration: {{possession.ptsConjuration}}
{{#if possession.isPosseder}}
<br><strong>Vous êtes été possédé par {{possession.data.typepossession}} ! La possession en cours a été supprimée.</strong>
{{/if}}
{{#if possession.isConjurer}}
<br><strong>Vous avez conjuré {{possession.data.typepossession}} ! La possession en cours a été supprimée.</strong>
{{/if}}
</div> </div>

View File

@ -15,3 +15,4 @@
<option value="tir">Tir</option> <option value="tir">Tir</option>
<option value="lancer">Lancer</option> <option value="lancer">Lancer</option>
<option value="derobee">Dérobée</option> <option value="derobee">Dérobée</option>
<option value="reve-actuel">Rêve Actuel</option>

View File

@ -8,33 +8,33 @@
</h4> </h4>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="signe.system.difficulte">Difficulte</label> <label for="signe.data.difficulte">Difficulte</label>
<input type="number" name="data.difficulte" value="{{system.difficulte}}" data-dtype="Number" /> <input type="number" name="signe.data.difficulte" value="{{signe.data.difficulte}}" data-dtype="Number" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="signe.data.valeur.norm">Expérience en sorts</label> <label for="signe.data.valeur.norm">Expérience en sorts</label>
<div class="flexrow"> <div class="flexrow">
<input class="signe-xp-sort" type="number" name="data.valeur.norm" data-typereussite="norm" <input class="signe-xp-sort" type="number" name="signe.data.valeur.norm" data-typereussite="norm"
value="{{system.valeur.norm}}" min="1" max="100" data-dtype="Number" /> value="{{signe.data.valeur.norm}}" min="1" max="100" data-dtype="Number" />
<span>Sign.</span> <span>Sign.</span>
<input class="signe-xp-sort" type="number" name="data.valeur.sign" data-typereussite="sign" <input class="signe-xp-sort" type="number" name="signe.data.valeur.sign" data-typereussite="sign"
value="{{system.valeur.sign}}" min="1" max="100" data-dtype="Number" /> value="{{signe.data.valeur.sign}}" min="1" max="100" data-dtype="Number" />
<span>Part.</span> <span>Part.</span>
<input class="signe-xp-sort" type="number" name="data.valeur.part" data-typereussite="part" <input class="signe-xp-sort" type="number" name="signe.data.valeur.part" data-typereussite="part"
value="{{system.valeur.part}}" min="1" max="100" data-dtype="Number" /> value="{{signe.data.valeur.part}}" min="1" max="100" data-dtype="Number" />
</div> </div>
</div> </div>
<div class="form-group flexrow"> <div class="form-group flexrow">
<label for="signe.data.ephemere">Ephémère</label> <label for="signe.data.ephemere">Ephémère</label>
<input class="flex-shrink" type="checkbox" name="data.ephemere" {{#if system.ephemere}}checked{{/if}} /> <input class="flex-shrink" type="checkbox" name="signe.data.ephemere" {{#if signe.data.ephemere}}checked{{/if}} />
<span> <span>
<input type="text" name="data.duree" value="{{system.duree}}" data-dtype="String" /> <input type="text" name="signe.data.duree" value="{{signe.data.duree}}" data-dtype="String" />
</span> </span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="tmrs">Terres médianes</label> <label for="tmrs">Terres médianes</label>
<select class="select-tmr" name="tmrs" id="tmrs" size="{{tmrs.length}}" multiple> <select class="select-tmr" name="tmrs" id="tmrs" size="{{tmrs.length}}" multiple>
{{#each @root.tmrs as |tmr key|}} {{#each tmrs as |tmr key|}}
<option value="{{tmr.name}}" {{#if tmr.selected}}selected{{/if}}>{{tmr.name}}</option> <option value="{{tmr.name}}" {{#if tmr.selected}}selected{{/if}}>{{tmr.name}}</option>
{{/each}} {{/each}}
</select> </select>

View File

@ -6,7 +6,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="grid grid-2col"> <div class="grid grid-2col">
<label>Caractéristique: </label><label class="flex-grow">{{selectedCarac.label}}</label> <label>Caractéristique: </label><label class="flex-grow">{{selectedCarac.label}}</label>
<label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.system.niveau decimals=0 sign=true}}</label></label> <label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.data.niveau decimals=0 sign=true}}</label></label>
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}} {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div> </div>

View File

@ -43,9 +43,9 @@
{{#if arme}} {{#if arme}}
{{#unless attackerRoll}} {{#unless attackerRoll}}
<div class="flexrow"> <div class="flexrow">
{{#if (eq arme.system.mortalite 'non-mortel')}} {{#if (eq arme.data.mortalite 'non-mortel')}}
<label>D&eacute;gats:</label><label class="dmg-arme-actor"></label> <label>D&eacute;gats:</label><label class="dmg-arme-actor"></label>
{{else if (eq arme.system.mortalite 'empoignade')}} {{else if (eq arme.data.mortalite 'empoignade')}}
<label>D&eacute;gats:</label><label>Empoignade</label> <label>D&eacute;gats:</label><label>Empoignade</label>
{{else}} {{else}}
<label>D&eacute;gats:</label> <label>D&eacute;gats:</label>

View File

@ -6,7 +6,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="grid grid-2col"> <div class="grid grid-2col">
<label for="carac">Caractéristique:</label>{{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}} <label for="carac">Caractéristique:</label>{{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}}
<label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.system.niveau decimals=0 sign=true}}</label></label> <label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.data.niveau decimals=0 sign=true}}</label></label>
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}} {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div> </div>

View File

@ -7,8 +7,8 @@
<div class="grid grid-2col"> <div class="grid grid-2col">
<label>Type:</label><label class="flex-grow">{{oeuvre.data.type}}</label> <label>Type:</label><label class="flex-grow">{{oeuvre.data.type}}</label>
<label for="carac">Caractéristique:</label>{{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}} <label for="carac">Caractéristique:</label>{{>"systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html"}}
<label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.system.niveauReel decimals=0 sign=true}}</label></label> <label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.data.niveauReel decimals=0 sign=true}}</label></label>
<label>Niveau de base:</label><label class="flex-grow">{{oeuvre.system.base}}</label> <label>Niveau de base:</label><label class="flex-grow">{{oeuvre.data.base}}</label>
</div> </div>
</div> </div>
<div class="flex-group-left"> <div class="flex-group-left">

View File

@ -5,7 +5,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/> <img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/>
<div class="grid grid-2col"> <div class="grid grid-2col">
<label for="carac">Rêve actuel:</label><label class="flex-grow" name="carac">{{selectedCarac.value}}</label> <label for="carac">Rêve actuel:</label><label class="flex-grow" name="carac">{{selectedCarac.value}}</label>
<label for="draconic">{{competence.name}}:</label><label class="flex-grow" name="draconic">{{numberFormat competence.system.niveau decimals=0 sign=true}}</label> <label for="draconic">{{competence.name}}:</label><label class="flex-grow" name="draconic">{{numberFormat competence.data.niveau decimals=0 sign=true}}</label>
</div> </div>
</div> </div>
<div class="flex-group-left"> <div class="flex-group-left">

View File

@ -4,14 +4,14 @@
<div class="flex-group-left"> <div class="flex-group-left">
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="flexcol"> <div class="flexcol">
<label><strong>{{meditation.system.theme}}</strong></label> <label><strong>{{meditation.data.theme}}</strong></label>
<hr> <hr>
<label>Support: <strong>{{upperFirst meditation.system.support}}</strong></label> <label>Support: <strong>{{upperFirst meditation.data.support}}</strong></label>
<label>Case TMR: <strong>{{typeTmr-name meditation.system.tmr}}</strong></label> <label>Case TMR: <strong>{{typeTmr-name meditation.data.tmr}}</strong></label>
<label>Durée: 60 minutes</label> <label>Durée: 60 minutes</label>
<hr> <hr>
<label>Intellect / {{competence.name}}: <label>Intellect / {{competence.name}}:
{{numberFormat carac.intellect.value decimals=0 sign=false}} / {{numberFormat competence.system.niveau decimals=0 sign=true}}</label> {{numberFormat carac.intellect.value decimals=0 sign=false}} / {{numberFormat competence.data.niveau decimals=0 sign=true}}</label>
</div> </div>
</div> </div>
<div class="flex-group-left"> <div class="flex-group-left">
@ -19,19 +19,19 @@
<label><strong>Conditions Optionnelles : </strong></label> <label><strong>Conditions Optionnelles : </strong></label>
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Comportement antérieur : {{upperFirst meditation.system.comportement}}</label> <label>Comportement antérieur : {{upperFirst meditation.data.comportement}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isComportement" {{#if conditionMeditation.isComportement}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" id="isComportement" {{#if conditionMeditation.isComportement}}checked{{/if}} />
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Heure : {{upperFirst meditation.system.heure}}</label> <label>Heure : {{upperFirst meditation.data.heure}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isHeure" {{#if conditionMeditation.isHeure}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" id="isHeure" {{#if conditionMeditation.isHeure}}checked{{/if}} />
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Purification : {{upperFirst meditation.system.purification}}</label> <label>Purification : {{upperFirst meditation.data.purification}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isPurification" {{#if conditionMeditation.isPurification}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" id="isPurification" {{#if conditionMeditation.isPurification}}checked{{/if}} />
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Vêture : {{upperFirst meditation.system.veture}}</label> <label>Vêture : {{upperFirst meditation.data.veture}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isVeture" {{#if conditionMeditation.isVeture}}checked{{/if}} /> <input class="attribute-value conditionMeditation" type="checkbox" id="isVeture" {{#if conditionMeditation.isVeture}}checked{{/if}} />
</div> </div>
<hr> <hr>

View File

@ -6,9 +6,9 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="grid grid-2col"> <div class="grid grid-2col">
<label>Caractéristique: </label><label class="flex-grow">{{selectedCarac.label}}</label> <label>Caractéristique: </label><label class="flex-grow">{{selectedCarac.label}}</label>
<label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.system.niveau decimals=0 sign=true}}</label></label> <label>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.data.niveau decimals=0 sign=true}}</label></label>
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}} {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div> </div>
<div class="flex-group-left"> <div class="flex-group-left">
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}

View File

@ -9,10 +9,10 @@
<label>Caractéristique: </label><label>{{selectedCarac.label}}</label> <label>Caractéristique: </label><label>{{selectedCarac.label}}</label>
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>{{competence.name}}: </label><label>{{numberFormat competence.system.niveau decimals=0 sign=true}}</label></label> <label>{{competence.name}}: </label><label>{{numberFormat competence.data.niveau decimals=0 sign=true}}</label></label>
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label>Exotisme: </label><label>{{oeuvre.system.exotisme}}</label> <label>Exotisme: </label><label>{{oeuvre.data.exotisme}}</label>
</div> </div>
<div class="flexrow"> <div class="flexrow">
<label for="proportions">Proportions: </label> <label for="proportions">Proportions: </label>

View File

@ -5,7 +5,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/> <img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/>
<div class="grid grid-2col"> <div class="grid grid-2col">
<label for="carac">Rêve actuel:</label><label class="flex-grow" name="carac">{{selectedCarac.value}}</label> <label for="carac">Rêve actuel:</label><label class="flex-grow" name="carac">{{selectedCarac.value}}</label>
<label for="competence">{{competence.name}}:</label><label class="flex-grow" name="competence">{{numberFormat competence.system.niveau decimals=0 sign=true}}</label> <label for="competence">{{competence.name}}:</label><label class="flex-grow" name="competence">{{numberFormat competence.data.niveau decimals=0 sign=true}}</label>
</div> </div>
</div> </div>
<div class="flex-group-left"> <div class="flex-group-left">

View File

@ -1,4 +1,3 @@
{{log 'lecture signe draconique' this}}
<form class="dialog-roll-sort"> <form class="dialog-roll-sort">
<h2>Lire le signe draconique <h2>Lire le signe draconique
<select name="signe-draconique" class="roll-signedraconique flex-grow" data-dtype="String"> <select name="signe-draconique" class="roll-signedraconique flex-grow" data-dtype="String">
@ -25,7 +24,7 @@
<select name="competence" class="roll-draconic" data-dtype="String"> <select name="competence" class="roll-draconic" data-dtype="String">
{{#select draconic}} {{#select draconic}}
{{#each draconicList as |draconic key|}} {{#each draconicList as |draconic key|}}
<option value={{key}}>{{draconic.name}} : {{numberFormat draconic.system.niveau decimals=0 sign=true}} <option value={{key}}>{{draconic.name}} : {{numberFormat draconic.data.niveau decimals=0 sign=true}}
</option> </option>
{{/each}} {{/each}}
{{/select}} {{/select}}

View File

@ -2,9 +2,9 @@
<img class="rdd-hud-togglebutton" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd06.svg" width="36" height="36" title="Attaque"/> <img class="rdd-hud-togglebutton" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd06.svg" width="36" height="36" title="Attaque"/>
<div class="rdd-hud-list tokenhudext left"> <div class="rdd-hud-list tokenhudext left">
{{#each armes as |arme key|}} {{#each armes as |arme key|}}
{{#unless arme.system.initOnly}} {{#unless arme.data.initOnly}}
<div class="control-icon tokenhudicon rdd-hud-menu rdd-attaque" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}"> <div class="control-icon tokenhudicon rdd-hud-menu rdd-attaque" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
<label>C:{{arme.name}} {{arme.system.mainInfo}}</label> <label>C:{{arme.name}} {{arme.data.mainInfo}}</label>
</div> </div>
{{/unless}} {{/unless}}
{{/each}} {{/each}}

View File

@ -3,7 +3,7 @@
<div class="rdd-hud-list tokenhudext right"> <div class="rdd-hud-list tokenhudext right">
{{#each armes as |arme key|}} {{#each armes as |arme key|}}
<div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{arme.command}}" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}"> <div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{arme.command}}" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
<label>I:{{arme.name}} {{arme.system.mainInfo}}</label> <label>I:{{arme.name}} {{arme.data.mainInfo}}</label>
</div> </div>
{{/each}} {{/each}}
{{#each commandes as |commande key|}} {{#each commandes as |commande key|}}

View File

@ -0,0 +1,29 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
<label for="xp">Type de possession </label>
<input class="attribute-value" type="text" name="data.typepossession" value="{{data.typepossession}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="xp">Possédé ? </label>
<input class="attribute-value" type="checkbox" name="data.istrue" {{#if data.istrue}}checked{{/if}}/>
</div>
<div class="form-group">
<label for="xp">Compteur </label>
<input class="attribute-value" type="text" name="data.compteur" value="{{data.compteur}}" data-dtype="Number"/>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</section>
</form>

View File

@ -11,7 +11,7 @@
<div class="form-group"> <div class="form-group">
<label for="xp">Caractéristique</label> <label for="xp">Caractéristique</label>
<select name="data.carac" id="caracselect" data-dtype="String"> <select name="data.carac" id="caracselect" data-dtype="String">
{{#select data.carac}} {{#select system.carac}}
{{#each caracList as |carac key|}} {{#each caracList as |carac key|}}
<option value="{{key}}">{{carac.label}}</option> <option value="{{key}}">{{carac.label}}</option>
{{/each}} {{/each}}
@ -21,7 +21,7 @@
<div class="form-group"> <div class="form-group">
<label for="xp">Compétence</label> <label for="xp">Compétence</label>
<select name="data.competence" id="competenceselect" data-dtype="String"> <select name="data.competence" id="competenceselect" data-dtype="String">
{{#select data.competence}} {{#select system.competence}}
{{#each competences as |competence key|}} {{#each competences as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option> <option value="{{competence.name}}">{{competence.name}}</option>
{{/each}} {{/each}}
@ -30,24 +30,24 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xp">Difficulté</label> <label for="xp">Difficulté</label>
<input class="attribute-value" type="text" name="data.difficulte" value="{{data.difficulte}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="system.difficulte" value="{{data.difficulte}}" data-dtype="Number"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xp">Périodicité</label> <label for="xp">Périodicité</label>
<input class="attribute-value" type="text" name="data.periodicite" value="{{data.periodicite}}" data-dtype="String"/> <input class="attribute-value" type="text" name="system.periodicite" value="{{data.periodicite}}" data-dtype="String"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xp">Fatigue</label> <label for="xp">Fatigue</label>
<input class="attribute-value" type="text" name="data.fatigue" value="{{data.fatigue}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="system.fatigue" value="{{data.fatigue}}" data-dtype="Number"/>
</div> </div>
{{#if isGM}} {{#if isGM}}
<div class="form-group"> <div class="form-group">
<label for="xp">Cacher les Points de Tâches nécessaires au joueur</label> <label for="xp">Cacher les Points de Tâches nécessaires au joueur</label>
<input class="attribute-value" type="checkbox" name="data.cacher_points_de_tache" value="{{data.cacher_points_de_tache}}" {{checked data.cacher_points_de_tache}}/> <input class="attribute-value" type="checkbox" name="system.cacher_points_de_tache" value="{{data.cacher_points_de_tache}}" {{checked data.cacher_points_de_tache}}/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xp">Points de tâches nécessaires</label> <label for="xp">Points de tâches nécessaires</label>
<input class="attribute-value" type="text" name="data.points_de_tache" value="{{data.points_de_tache}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="system.points_de_tache" value="{{data.points_de_tache}}" data-dtype="Number"/>
</div> </div>
{{else}} {{else}}
<div class="form-group"> <div class="form-group">
@ -55,22 +55,22 @@
{{#if data.cacher_points_de_tache}} {{#if data.cacher_points_de_tache}}
<input class="attribute-value" type="text" value="?????" data-dtype="Number" disabled/> <input class="attribute-value" type="text" value="?????" data-dtype="Number" disabled/>
{{else}} {{else}}
<input class="attribute-value" type="text" name="data.points_de_tache" value="{{data.points_de_tache}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="system.points_de_tache" value="{{data.points_de_tache}}" data-dtype="Number"/>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}
<hr> <hr>
<div class="form-group"> <div class="form-group">
<label for="xp">Points de tâches obtenus</label> <label for="xp">Points de tâches obtenus</label>
<input class="attribute-value" type="text" name="data.points_de_tache_courant" value="{{data.points_de_tache_courant}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="system.points_de_tache_courant" value="{{data.points_de_tache_courant}}" data-dtype="Number"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xp">Nombre de Succès</label> <label for="xp">Nombre de Succès</label>
<input class="attribute-value" type="text" name="data.nb_jet_succes" value="{{data.nb_jet_succes}}" data-dtype="Number" {{#if isGM}}{{else}}disabled{{/if}}/> <input class="attribute-value" type="text" name="system.nb_jet_succes" value="{{data.nb_jet_succes}}" data-dtype="Number" {{#if isGM}}{{else}}disabled{{/if}}/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="xp">Nombre d'Echecs</label> <label for="xp">Nombre d'Echecs</label>
<input class="attribute-value" type="text" name="data.nb_jet_echec" value="{{data.nb_jet_echec}}" data-dtype="Number" {{#if isGM}}{{else}}disabled{{/if}}/> <input class="attribute-value" type="text" name="system.nb_jet_echec" value="{{data.nb_jet_echec}}" data-dtype="Number" {{#if isGM}}{{else}}disabled{{/if}}/>
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}

View File

@ -1,10 +1,10 @@
<div class="flex-group-left details-sort"> <div class="flex-group-left details-sort">
{{#if sort.system.cible}}<label><strong>Cible</strong>: {{sort.system.cible}}&nbsp;&nbsp;</label>{{/if}} {{#if sort.data.cible}}<label><strong>Cible</strong>: {{sort.data.cible}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.JR}}<label><strong>JR</strong>: {{sort.system.JR}}&nbsp;&nbsp;</label>{{/if}} {{#if sort.data.JR}}<label><strong>JR</strong>: {{sort.data.JR}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.portee}}<label><strong>Portée</strong>: {{sort.system.portée}}&nbsp;&nbsp;</label>{{/if}} {{#if sort.data.portee}}<label><strong>Portée</strong>: {{sort.data.portée}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.duree}}<label><strong>Durée</strong>: {{sort.system.duree}}&nbsp;&nbsp;</label>{{/if}} {{#if sort.data.duree}}<label><strong>Durée</strong>: {{sort.data.duree}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.coutseuil}}<label><strong>Coût de seuil</strong>: {{sort.system.coutseuil}}</label>{{/if}} {{#if sort.data.coutseuil}}<label><strong>Coût de seuil</strong>: {{sort.data.coutseuil}}</label>{{/if}}
</div> </div>
<div class="details-sort"> <div class="details-sort">
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" sort.system}} {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" sort.data}}
</div> </div>

View File

@ -1,14 +1,14 @@
<div class="flexcol"> <div class="flexcol">
<span><label>Description : </label></span> <span><label>Description : </label></span>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=system.description target="system.description" button=true owner=owner editable=editable}} {{editor data.description target="system.description" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>
{{#if isGM}} {{#if isGM}}
<div class="flexcol"> <div class="flexcol">
<span><label>Description (MJ seulement): </label></span> <span><label>Description (MJ seulement): </label></span>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=system.descriptionmj target="system.descriptionmj" button=true owner=owner editable=editable}} {{editor data.descriptionmj target="system.descriptionmj" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>
{{/if}} {{/if}}

View File

@ -4,7 +4,7 @@
<img class="chat-icon" src="{{img}}" title="{{name}}" /> <img class="chat-icon" src="{{img}}" title="{{name}}" />
{{/if}} {{/if}}
<p class="card-content">{{{system.description}}}</p> <p class="card-content">{{{data.description}}}</p>
<p> <p>
{{#each properties as |property p|}} {{#each properties as |property p|}}
<span>{{{property}}}</span><br> <span>{{{property}}}</span><br>