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() {
let formData = await super.getData();
console.log("Creature : ", formData);
let formData = await super.getData()
//console.log("Creature : ", formData, formData.system)
formData.calc = {
caracTotal: RdDCarac.computeTotal(formData.data.carac),
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() {
const objectData = Misc.data(this.object);
let formData = {
title: this.title,
id: this.object.id,
type: this.object.type,
img: this.object.img,
name: this.object.name,
id: objectData.id,
type: objectData.type,
img: objectData.img,
name: objectData.name,
// actor: this.object,
editable: this.isEditable,
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)),
// items: items,
limited: this.object.limited,
options: this.options,
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;

View File

@ -36,10 +36,9 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */
async getData() {
const objectData = Misc.data(this.object)
//this.actor.checkMonnaiePresence(this.actor.data.items); // Always check
const objectData = this.object.system
console.log("New actor", objectData)
let formData = {
title: this.title,
id: this.object.id,
@ -48,15 +47,14 @@ export class RdDActorSheet extends ActorSheet {
name: this.object.name,
editable: this.isEditable,
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)),
limited: this.object.limited,
options: this.options,
owner: this.document.isOwner,
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)
formData.options.isGM = game.user.isGM;
@ -79,12 +77,11 @@ export class RdDActorSheet extends ActorSheet {
};
formData.competences.forEach(item => {
console.log('Comp', item)
item.isVisible = this.options.cherchercompetence
item.system.visible = this.options.cherchercompetence
? RdDItemCompetence.nomContientTexte(item, this.options.cherchercompetence)
: (!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 => {
RdDCarac.levelUp(c);
@ -92,11 +89,11 @@ export class RdDActorSheet extends ActorSheet {
// toujours avoir une liste d'armes (pour mettre esquive et corps à corps)
formData.combat = duplicate(formData.armes ?? [])
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences)
/* TODO TODO RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac)*/
formData.combat = duplicate(formData.armes ?? []);
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences);
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac);
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;
@ -169,13 +166,14 @@ export class RdDActorSheet extends ActorSheet {
if (!this.options.editable) return;
html.find('.item-split').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor)
RdDSheetUtility.splitItem(item, this.actor)
const item = RdDSheetUtility.getItem(event, this.actor);
RdDSheetUtility.splitItem(item, this.actor);
});
html.find('.item-edit').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor)
console.log("ITEM :", item)
item.sheet.render(true)
});
})
html.find('.display-label a').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor);
item.sheet.render(true);
@ -197,7 +195,7 @@ export class RdDActorSheet extends ActorSheet {
});
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);
});
html.find('.subacteur-delete').click(async event => {
@ -207,8 +205,11 @@ export class RdDActorSheet extends ActorSheet {
html.find('.encaisser-direct').click(async event => {
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 => {
if (game.user.isGM) {
this.actor.remiseANeuf();
@ -254,7 +255,7 @@ export class RdDActorSheet extends ActorSheet {
// Equip Inventory Item
html.find('.item-equip').click(async event => {
this.actor.equiperObjet(RdDSheetUtility.getItemId(event))
this.actor.equiperObjet(RdDSheetUtility.getItemId(event));
});
// Roll Carac
@ -326,8 +327,8 @@ export class RdDActorSheet extends ActorSheet {
// Roll Weapon1
html.find('.arme-label a').click(async event => {
let arme = this._getEventArmeCombat(event)
this.actor.rollArme(duplicate(arme))
let arme = this._getEventArmeCombat(event);
this.actor.rollArme(duplicate(arme));
});
// Initiative pour l'arme
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));
});
html.find('.carac-xp').change(async event => {
let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "")
//console.log("Value changed :", event, caracName)
this.actor.updateCaracXP(caracName, parseInt(event.target.value))
let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", "");
//console.log("Value changed :", event, caracName);
this.actor.updateCaracXP(caracName, parseInt(event.target.value));
});
// On competence change
html.find('.competence-value').change(async event => {
@ -513,17 +514,15 @@ export class RdDActorSheet extends ActorSheet {
});
}
/* -------------------------------------------- */
_getEventArmeCombat(event) {
const li = $(event.currentTarget)?.parents(".item")
let armeName = li.data("arme-name")
let compName = li.data('competence-name')
console.log("Searching for", armeName, compName)
const arme = this.armesList.find(a => a.name == armeName && a.system.competence == compName)
const li = $(event.currentTarget)?.parents(".item");
let armeName = li.data("arme-name");
let compName = li.data('competence-name');
const arme = this.armesList.find(a => a.name == armeName && a.data.competence == compName);
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) {
if (split >= 1 && split < item.system.quantite) {
await item.diminuerQuantite(split)
item.system.quantite = split;
if (split >= 1 && split < Misc.data(item).data.quantite) {
await item.diminuerQuantite(split);
const itemData = duplicate(Misc.data(item));
itemData.data.quantite = split;
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() {
const objectData = Misc.data(this.object);
@ -68,6 +60,9 @@ export class RdDActorVehiculeSheet extends ActorSheet {
return formData;
}
async computeMalusArmure() {
// pas de malus armure
}
/* -------------------------------------------- */
async _onDropItem(event, dragData) {
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) {
if (game.user.id == data.userId) {
switch (data.level) {
@ -47,15 +46,28 @@ export class ChatUtility {
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())
const toDelete = game.messages.filter(it => it.data.content.includes(data.part));
toDelete.forEach(it => it.delete());
}
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) {
if (Misc.isUniqueConnectedGM()) {
ChatUtility.onRemoveMessages(data);
@ -78,7 +90,7 @@ export class ChatUtility {
/* -------------------------------------------- */
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) {
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) {
if (data) {
await chatMessage.setFlag(SYSTEM_RDD, key, JSON.stringify(data));
}
}
/* -------------------------------------------- */
static getMessageData(chatMessage, key) {
const json = chatMessage.getFlag(SYSTEM_RDD, key);
return json ? JSON.parse(json) : undefined;
}
/* -------------------------------------------- */
static getChatMessage(event) {
const chatMessageId = $(event.currentTarget).closest('.chat-message').attr('data-message-id');
return game.messages.get(chatMessageId);

View File

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

View File

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

View File

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

View File

@ -109,7 +109,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
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) {
console.log("Competence", competence)
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 xp = competence.system.xp ?? 0
const xpSort = competence.system.xp_sort ?? 0
return factor * (xpNiveau + xp) + xpSort
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 xp = competence.system.xp ?? 0;
const xpSort = competence.system.xp_sort ?? 0;
return factor * (xpNiveau + xp) + xpSort;
}
/* -------------------------------------------- */
@ -162,11 +161,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static computeCompetenceXPCost(competence) {
const compData = Misc.data(competence);
let xp = RdDItemCompetence.getDeltaXp(compData.data.base, compData.data.niveau ?? compData.data.base);
xp += compData.data.xp ?? 0;
let xp = RdDItemCompetence.getDeltaXp(competence.system.base, competence.system.niveau ?? competence.system.base);
xp += competence.system.xp ?? 0;
if (compData.name.includes('Thanatos')) xp *= 2; /// Thanatos compte double !
xp += compData.data.xp_sort ?? 0;
xp += competence.system.xp_sort ?? 0;
return xp;
}
@ -177,8 +175,8 @@ export class RdDItemCompetence extends Item {
let list = troncList.map(name => RdDItemCompetence.findCompetence(competences, name))
.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.map(c => Misc.templateData(c)).forEach(tplData => {
economie += RdDItemCompetence.getDeltaXp(tplData.base, Math.min(tplData.niveau, 0));
list.map(c => c).forEach(c => {
economie += RdDItemCompetence.getDeltaXp(c.system.base, Math.min(c.system.niveau, 0))
});
}
return economie;
@ -186,13 +184,13 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static levelUp(itemData, stressTransforme) {
itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau);
const xpManquant = itemData.data.xpNext - itemData.data.xp;
itemData.data.isLevelUp = xpManquant <= 0;
itemData.data.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && itemData.data.niveau < itemData.data.niveau_archetype);
itemData.data.stressXpMax = 0;
if (xpManquant > 0 && stressTransforme > 0 && itemData.data.niveau < itemData.data.niveau_archetype) {
itemData.data.stressXpMax = Math.min(xpManquant , stressTransforme);
itemData.system.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.system.niveau);
const xpManquant = itemData.system.xpNext - itemData.system.xp;
itemData.system.isLevelUp = xpManquant <= 0;
itemData.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && itemData.system.niveau < itemData.system.niveau_archetype);
itemData.system.stressXpMax = 0;
if (xpManquant > 0 && stressTransforme > 0 && itemData.system.niveau < itemData.system.niveau_archetype) {
itemData.system.stressXpMax = Math.min(xpManquant , stressTransforme);
}
}
@ -207,7 +205,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
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) {
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 => {
archetype[niveau] = archetype[niveau] ?? { "niveau": niveau, "nombreMax": 0, "nombre": 0 };
archetype[niveau].nombre = (archetype[niveau]?.nombre ?? 0) + 1;

View File

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

View File

@ -3,7 +3,7 @@ export class RdDItemMeditation {
static calculDifficulte(rollData) {
if (rollData.meditation) {
// 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.isVeture) diff -= 2;
if (!rollData.conditionMeditation.isComportement) diff -= 2;

View File

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

View File

@ -32,7 +32,7 @@ export class RdDItemSheet extends ItemSheet {
let buttons = super._getHeaderButtons();
// 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!
if ("cout" in Misc.templateData(this.object) && this.object.isVideOuNonConteneur()) {
if ("cout" in this.object.system && this.object.isVideOuNonConteneur()) {
buttons.unshift({
class: "vendre",
icon: "fas fa-comments-dollar",
@ -60,14 +60,13 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */
async getData() {
const objectData = this.object;
let formData = {
id: this.object.id,
title: objectData.name,
type: objectData.type,
img: objectData.img,
name: objectData.name,
data: objectData.system,
title: this.object.name,
type: this.object.type,
img: this.object.img,
name: this.object.name,
data: this.object.system,
isGM: game.user.isGM,
actorId: this.actor?.id,
owner: this.document.isOwner,
@ -77,7 +76,7 @@ export class RdDItemSheet extends ItemSheet {
}
if (this.actor) {
formData.isOwned = true;
if (objectData.type == 'conteneur') {
if (this.object.type == 'conteneur') {
this.prepareConteneurData(formData);
}
}
@ -85,7 +84,8 @@ export class RdDItemSheet extends ItemSheet {
formData.categorieCompetences = RdDItemCompetence.getCategorieCompetences()
if (formData.type == 'tache' || formData.type == 'livre' || formData.type == 'meditation' || formData.type == 'oeuvre') {
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') {
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;
}
/* -------------------------------------------- */
prepareConteneurData(formData) {
formData.itemsByType = Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i.data)));
RdDUtility.filterEquipementParType(formData);
@ -228,7 +229,7 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */
get template() {
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() {
let formData = {
name: this.object.name,
img: this.object.img,
title: this.object.name,
const formData = duplicate(Misc.data(this.object));
mergeObject(formData, {
title: formData.name,
isGM: game.user.isGM,
owner: this.document.isOwner,
data: this.object.system,
isOwned: this.actor ? true : false,
actorId: this.actor?.id,
editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked",
}
formData.tmrs = TMRUtility.listSelectedTMR(this.object.system.typesTMR ?? [])
console.log("SIG", formData)
return formData
});
formData.tmrs = TMRUtility.listSelectedTMR(formData.data.typesTMR ?? []);
return formData;
}
/* -------------------------------------------- */
@ -75,17 +72,17 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
}
async onSelectTmr(event) {
event.preventDefault()
const selectedTMR = $(".select-tmr").val()
this.object.update({ 'data.typesTMR': selectedTMR })
event.preventDefault();
const selectedTMR = $(".select-tmr").val();
this.object.update({ 'data.typesTMR': selectedTMR });
}
async onValeurXpSort(event) {
const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0;
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);
await this.object.update({ 'data.valeur': newValeur })
await this.object.update({ 'data.valeur': newValeur });
}
/* -------------------------------------------- */

View File

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

View File

@ -18,7 +18,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */
static setCoutReveReel(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 { RdDUtility } from "./rdd-utility.js";
const typesObjetsEquipement = ["objet", "arme", "armure", "gemme", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"];
const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"];
const typesObjetsEquipement = ["objet", "arme", "armure", "gemme", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"]
const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"]
const encBrin = 0.00005;// un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
export const defaultItemImg = {
@ -34,7 +34,8 @@ export const defaultItemImg = {
oeuvre: "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp",
nourritureboisson: "systems/foundryvtt-reve-de-dragon/icons/objets/provision_crue.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() {
return typesObjetsEquipement;
return typesObjetsEquipement
}
static getTypesOeuvres() {
return typesObjetsOeuvres;
return typesObjetsOeuvres
}
isCompetence() {
@ -82,7 +83,7 @@ export class RdDItem extends Item {
return this.type == 'herbe' && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos');
}
isPotion() {
return this.type == 'potion';
return Misc.data(this).type == 'potion';
}
isEquipement() {
@ -94,20 +95,18 @@ export class RdDItem extends Item {
}
isMagique() {
return this.system.magique;
return this.system.magique
}
getEncTotal() {
const itemData = this.system
return Number(itemData.encombrement ?? 0) * Number(itemData.quantite ?? 1);
return Number(this.system.encombrement ?? 0) * Number(this.system.quantite ?? 1)
}
getEnc() {
const itemData = this.system
switch (itemData.type) {
switch (this.type) {
case 'herbe':
return encBrin;
}
return itemData.encombrement ?? 0
return this.system.encombrement ?? 0;
}
prepareDerivedData() {
@ -118,50 +117,47 @@ export class RdDItem extends Item {
if (this.isPotion()) {
this.prepareDataPotion()
}
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
this.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
}
}
prepareDataPotion() {
const tplData = Misc.templateData(this);
const categorie = Grammar.toLowerCaseNoAccent(tplData.categorie);
tplData.magique = categorie.includes('enchante');
if (tplData.magique) {
const categorie = Grammar.toLowerCaseNoAccent(this.system.categorie);
this.system.magique = categorie.includes('enchante');
if (this.system.magique) {
if (categorie.includes('soin') || categorie.includes('repos')) {
tplData.puissance = tplData.herbebonus * tplData.pr;
this.system.puissance = this.system.herbebonus * this.system.pr;
}
}
}
_calculsEquipement() {
const tplData = this.system
const quantite = this.isConteneur() ? 1 : (tplData.quantite ?? 0);
const quantite = this.isConteneur() ? 1 : (this.system.quantite ?? 0);
const enc = this.getEnc();
if (enc != undefined) {
tplData.encTotal = Math.max(enc, 0) * quantite;
this.system.encTotal = Math.max(enc, 0) * quantite;
}
if (tplData.cout != undefined) {
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
if (this.cout != undefined) {
this.system.prixTotal = Math.max(this.cout, 0) * quantite;
}
}
getActionPrincipale(options = { warnIfNot: true }) {
const itemData = this.system
if (!this.isConteneur() && (itemData.quantite ?? 0) <= 0) {
if (!this.isConteneur() && (this.system.quantite ?? 0) <= 0) {
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;
}
switch (itemData.type) {
case 'nourritureboisson': return itemData.boisson ? 'Boire' : 'Manger';
switch (this.type) {
case 'nourritureboisson': return this.boisson ? 'Boire' : 'Manger';
case 'potion': return 'Boire';
case 'livre': return 'Lire';
case 'conteneur': return 'Ouvrir';
}
if (this.isHerbeAPotion()) { return 'Décoction'; }
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;
@ -173,18 +169,17 @@ export class RdDItem extends Item {
}
async quantiteIncDec(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) {
const itemData = this.system
const quantite = Number(itemData.quantite ?? -1);
const quantite = Number(this.system.quantite ?? -1);
if (quantite >= 0) {
const reste = Math.max(quantite + Number(nombre), 0);
if (reste == 0) {
if (options.supprimerSiZero) {
ui.notifications.notify(`${itemData.name} supprimé de votre équipement`);
ui.notifications.notify(`${this.name} supprimé de votre équipement`);
await this.delete();
}
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 });
}
}
@ -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é
isEquipementSimilaire(other) {
const itemData = this.system
const otherData = other.data
const tplData = Misc.templateData(this);
const otherTplData = Misc.templateData(other);
const itemData = Misc.data(this)
const otherData = Misc.data(other)
const tplData = Misc.templateData(this)
const otherTplData = Misc.templateData(other)
if (!this.isEquipement()) return false;
if (itemData.type != otherData.type) return false;
if (itemData.name != otherData.name) return false;
@ -246,7 +241,7 @@ export class RdDItem extends Item {
/* -------------------------------------------- */
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) {
let itemsBy = {};
Misc.classifyInto(itemsBy, items, classifier);
return itemsBy;
let itemsBy = {}
Misc.classifyInto(itemsBy, items, classifier)
return itemsBy
}
static classifyFirst(items, classifier) {
@ -87,13 +87,13 @@ export class Misc {
static classifyInto(itemsBy, items, classifier = it => it.type) {
for (const item of items) {
const classification = classifier(item);
const classification = classifier(item)
let list = itemsBy[classification];
if (!list) {
list = [];
itemsBy[classification] = list;
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);
}
static data(it) {
if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
return it.system
}
return it
/*if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
return it.data;
}*/
return it;
}
static templateData(it) {
return it.system ?? {}
//return Misc.data(it)?.system ?? {}
return Misc.data(it)?.data ?? {}
}
static getEntityTypeLabel(entity) {
const documentName = entity?.documentName;
const type = entity?.data.type;
const documentName = entity?.documentName
const type = entity?.type
if (documentName === 'Actor' || documentName === 'Item') {
const label = CONFIG[documentName]?.typeLabels?.[type] ?? type;
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 = {}) {
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
ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant._id;
@ -89,23 +89,23 @@ export class RdDCombatManager extends Combat {
let rollFormula = formula; // Init per default
if (!rollFormula) {
let armeCombat, competence;
if (combatant.actor.type == 'creature' || combatant.actor.type == 'entite') {
for (const competenceItemData of combatant.actor.items) {
if (competenceItemData.system.iscombat) {
competence = duplicate(competenceItemData)
if (combatant.actor.data.type == 'creature' || combatant.actor.data.type == 'entite') {
for (const competenceItemData of combatant.actor.data.items) {
if (competenceItemData.data.data.iscombat) {
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 {
for (const itemData of combatant.actor.items) {
if (itemData.type == "arme" && itemData.system.equipe) {
armeCombat = duplicate(itemData)
for (const itemData of combatant.actor.data.items) {
if (itemData.type == "arme" && itemData.data.equipe) {
armeCombat = duplicate(itemData);
}
}
let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.system.competence;
competence = RdDItemCompetence.findCompetence(combatant.actor.items, compName);
let bonusEcaille = (armeCombat && armeCombat.system.magique) ? armeCombat.system.ecaille_efficacite : 0;
rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.system.niveau, combatant.actor.system.carac[competence.system.defaut_carac].value, bonusEcaille) + ")/100)";
let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.data.competence;
competence = RdDItemCompetence.findCompetence(combatant.actor.data.items, compName);
let bonusEcaille = (armeCombat && armeCombat.data.magique) ? armeCombat.data.ecaille_efficacite : 0;
rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.data.niveau, Misc.data(combatant.actor).data.carac[competence.data.defaut_carac].value, bonusEcaille) + ")/100)";
}
}
//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 */
static finalizeArmeList(armes, competences, carac) {
// Gestion des armes 1/2 mains
let armesEquipe = []
console.log("ARMES", armes)
let armesEquipe = [];
for (const arme of armes) {
let armeData = duplicate(arme)
if (armeData.system.equipe) {
let compData = competences.map(c => c).find(c => c.name == armeData.system.competence)
let armeData = duplicate(arme.system)
if (armeData.equipe) {
let compData = competences.find(c => c.name.toLowerCase() == armeData.competence.toLowerCase())
console.log("ARME", arme, compData, armeData.competence, competences)
armesEquipe.push(armeData)
armeData.system.dommagesReels = Number(armeData.system.dommages)
console.log("ARME", armeData, compData)
armeData.system.niveau = compData.system.niveau
armeData.system.initiative = RdDCombatManager.calculInitiative(compData.system.niveau, carac[compData.system.defaut_carac].value);
armeData.dommagesReels = Number(armeData.dommages)
armeData.niveau = compData.system.niveau
armeData.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
if (armeData.system.unemain && !armeData.system.deuxmains) {
armeData.system.mainInfo = "(1m)";
} else if (!armeData.system.unemain && armeData.system.deuxmains) {
armeData.system.mainInfo = "(2m)";
} else if (armeData.system.unemain && armeData.system.deuxmains) {
armeData.system.mainInfo = "(1m)";
if (armeData.unemain && !armeData.deuxmains) {
armeData.mainInfo = "(1m)";
} else if (!armeData.unemain && armeData.deuxmains) {
armeData.mainInfo = "(2m)";
} else if (armeData.unemain && armeData.deuxmains) {
armeData.mainInfo = "(1m)";
const comp2m = armeData.system.competence.replace(" 1 main", " 2 mains"); // Replace !
const comp = Misc.data(competences.find(c => c.name == comp2m));
const comp2m = armeData.competence.replace(" 1 main", " 2 mains"); // Replace !
const comp = competences.find(c => c.name == comp2m)
const arme2main = duplicate(armeData);
arme2main.system.mainInfo = "(2m)";
arme2main.system.niveau = comp.system.niveau;
arme2main.system.competence = comp2m;
arme2main.system.initiative = RdDCombatManager.calculInitiative(arme2main.system.niveau, carac[comp.system.defaut_carac].value);
const arme2main = duplicate(armeData)
arme2main.mainInfo = "(2m)";
arme2main.niveau = comp.data.niveau;
arme2main.competence = comp2m;
arme2main.initiative = RdDCombatManager.calculInitiative(arme2main.niveau, carac[comp.system.defaut_carac].value)
armesEquipe.push(arme2main);
const containsSlash = armeData.system.dommages.includes("/");
const containsSlash = armeData.dommages.includes("/");
if (containsSlash) {
const tableauDegats = armeData.system.dommages.split("/");
armeData.system.dommagesReels = Number(tableauDegats[0]);
arme2main.system.dommagesReels = Number(tableauDegats[1]);
const tableauDegats = armeData.dommages.split("/");
armeData.dommagesReels = Number(tableauDegats[0]);
arme2main.dommagesReels = Number(tableauDegats[1]);
}
else{
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 [];
}
const actorData = Misc.data(combatant.actor);
let items = combatant.actor.data.items;
let items = combatant.actor.items
let actions = []
if (combatant.actor.isCreature()) {
actions = actions.concat(items.filter(it => RdDItemCompetenceCreature.isCompetenceAttaque(it))
@ -215,7 +214,7 @@ export class RdDCombatManager extends Combat {
//.concat(RdDItemArme.empoignade())
.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));
if (actorData.data.attributs.hautrevant.value) {
@ -467,15 +466,15 @@ export class RdDCombat {
}
/* -------------------------------------------- */
static onMsgEncaisser(data) {
let defender = canvas.tokens.get(data.defenderTokenId).actor;
static onMsgEncaisser(msg) {
let defender = canvas.tokens.get(msg.defenderTokenId).actor;
if (Misc.isOwnerPlayerOrUniqueConnectedGM()) {
let attackerRoll = data.attackerRoll;
let attacker = data.attackerId ? game.actors.get(data.attackerId) : null;
let attackerRoll = msg.attackerRoll;
let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : null;
defender.encaisserDommages(attackerRoll, attacker);
RdDCombat._deleteDefense(attackerRoll.passeArme);
RdDCombat._deleteAttaque(data.attackerId);
const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
rddCombat?.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
}
}
@ -484,11 +483,8 @@ export class RdDCombat {
let defenderToken = canvas.tokens.get(msg.defenderTokenId);
if (defenderToken && Misc.isUniqueConnectedGM()) {
const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
if (rddCombat) {
const defenderRoll = msg.defenderRoll;
rddCombat.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
rddCombat._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
}
rddCombat?.removeChatMessageActionsPasseArme(msg.defenderRoll.passeArme);
rddCombat?._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
}
}
@ -668,7 +664,6 @@ export class RdDCombat {
if (!await this.accorderEntite('avant-attaque')) {
return;
}
console.log("ATTACK", competence, arme)
if (arme.data.cac == 'empoignade' && this.attacker.isCombatTouche()) {
ChatMessage.create({
alias: this.attacker.name,
@ -678,7 +673,7 @@ export class RdDCombat {
competence: competence
})
});
return
return;
}
let rollData = this._prepareAttaque(competence, arme);
@ -705,7 +700,7 @@ export class RdDCombat {
{ 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.computeDeteriorationArme(defenderRoll);
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
RdDCombat._deleteDefense(defenderRoll.passeArme);
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
}
/* -------------------------------------------- */
@ -1080,7 +1074,7 @@ export class RdDCombat {
async _onEsquiveNormale(defenderRoll) {
console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll);
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);
}

View File

@ -8,11 +8,11 @@ export class RdDHerbes extends Item {
/* -------------------------------------------- */
static isHerbeSoin( botaniqueItem ) {
return Misc.templateData(botaniqueItem).categorie == 'Soin';
return botaniqueItem.categorie == 'Soin';
}
/* -------------------------------------------- */
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, {
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",
"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;
@ -225,7 +225,6 @@ function registerUsageCount( registerKey ) {
name: "Unique world key",
scope: "world",
config: false,
value: "EMPTY",
type: String
});
@ -269,7 +268,7 @@ Hooks.once("ready", async function () {
}
if (Misc.isUniqueConnectedGM()) {
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 { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDRoll } from "./rdd-roll.js";
import { RdDRollTables } from "./rdd-rolltables.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
/* -------------------------------------------- */
@ -32,52 +28,83 @@ export class RdDPossession {
/* -------------------------------------------- */
static updateEtatPossession( possession ) {
possession.ptsConjuration = 0;
possession.ptsPossession = 0;
possession.ptsConjuration = 0
possession.ptsPossession = 0
console.log("Possession", possession)
if ( possession.data.compteur > 0) {
possession.ptsPossession = possession.data.compteur;
possession.ptsPossession = possession.data.compteur
}
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 ) {
// Possede
possession.isPosseder = true
}
if (possession.ptsConjuration <= -2 ) {
// Libere
if (possession.ptsConjuration >= 2 ) {
possession.isConjurer = true
}
console.log("Poss", possession);
}
/* -------------------------------------------- */
static async resultConjuration( rollData) {
console.log("RollData!!!", rollData);
let actor = game.actors.get(rollData.possession.data.possedeid)
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) {
let actor = game.actors.get(actorId);
console.log("onDefensePossession", actor, possessionId);
let possession = duplicate(actor.items.find( item => item.type =='possession' && item.data.data.possessionid == possessionId));
let attacker = game.actors.get(possession.data.possesseurid);
static async onDefensePossession( attackerId, defenderId, possessionId) {
let attacker = game.actors.get(attackerId)
let defender = game.actors.get(defenderId)
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
let rollData = {
possession: possession
}
rollData.actor = actor;
rollData.competence = duplicate(actor.getDraconicOrZero());
rollData.competence.data.defaut_carac = 'reve-actuel';
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: actor.getReveActuel() } }
rollData.mode = "conjuration";
rollData.possesseur = attacker.name;
rollData.actor = defender
if ( defender.type == "personnage") {
rollData.competence = duplicate(defender.getDraconicOrZero())
rollData.competence.data.defaut_carac = 'reve-actuel'
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } }
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',
options: { height: 400 }
@ -90,21 +117,21 @@ export class RdDPossession {
]
}
);
dialog.render(true);
dialog.render(true)
}
/* -------------------------------------------- */
static async _onRollPossession( rollData, isSuccess ) {
let possession = rollData.possession;
possession.isSuccess = isSuccess;
this.updateEtatPossession( possession);
let possession = rollData.possession
possession.isSuccess = isSuccess
this.updateEtatPossession( possession)
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) {
ui.notifications.warn((game.user.targets?.size ?? 0) > 1
? "Vous devez choisir <strong>une seule</strong> cible à posséder!"
@ -112,13 +139,16 @@ export class RdDPossession {
return;
}
const defender = target.actor;
let possession = this.searchPossessionFromEntite( attacker, defender);
const defender = target.actor
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 = {
competence: competence,
possession: possession,
@ -129,9 +159,8 @@ export class RdDPossession {
mode: "possession"
};
if ( attacker.isCreature()) {
RdDItemCompetenceCreature.setRollDataCreature(rollData);
RdDItemCompetenceCreature.setRollDataCreature(rollData)
}
console.log("Creation de possession2", 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) },
]
});
dialog.render(true);
dialog.render(true)
}
/* -------------------------------------------- */
static async createPossession( attacker, defender ) {
let posessionData = {
name: "Possession en cours", type: 'possession',
let possessionData = {
name: "Possession en cours de " + attacker.name, type: 'possession',
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])
let poss = await defender.createEmbeddedDocuments('Item', [posessionData])
return duplicate(poss[0]);
// Creates only the possession on the personnage side
let poss = await defender.createEmbeddedDocuments('Item', [possessionData])
return duplicate(poss[0])
}
}

View File

@ -38,18 +38,19 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */
static _setDefaultOptions(actor, rollData) {
const actorData = actor.system
let defaultRollData = {
alias: actor.name,
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
difficultesLibres: CONFIG.RDD.difficultesLibres,
etat: actor.getEtatGeneral(),
moral: actor.getMoralTotal(), /* La valeur du moral pour les jets de volonté */
carac: actor.system.carac,
carac: actorData.carac,
finalLevel: 0,
diffConditions: 0,
diffLibre: rollData.competence?.system.default_diffLibre ?? 0,
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(),
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. */
@ -63,7 +64,11 @@ export class RdDRoll extends Dialog {
canClose: true,
isGM: game.user.isGM,
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 });
if (rollData.forceCarac) {
@ -73,7 +78,6 @@ export class RdDRoll extends Dialog {
RollDataAjustements.calcul(rollData, actor);
}
/* -------------------------------------------- */
static getDiviseurSignificative(rollData) {
let facteurSign = 1;
@ -166,12 +170,12 @@ export class RdDRoll extends Dialog {
if (rollData.competence) {
const defaut_carac = rollData.competence.system.defaut_carac
// Set the default carac from the competence item
rollData.selectedCarac = rollData.carac[defaut_carac]
$("#carac").val(defaut_carac)
rollData.selectedCarac = rollData.carac[defaut_carac];
$("#carac").val(defaut_carac);
}
if (rollData.selectedSort) {
dialog.setSelectedSort(rollData.selectedSort)
$(".draconic").val(rollData.selectedSort.data.listIndex) // Uniquement a la selection du sort, pour permettre de changer
dialog.setSelectedSort(rollData.selectedSort);
$(".draconic").val(rollData.selectedSort.system.listIndex); // Uniquement a la selection du sort, pour permettre de changer
}
RdDItemSort.setCoutReveReel(rollData.selectedSort);
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
@ -267,21 +271,21 @@ export class RdDRoll extends Dialog {
async setSelectedSort(sort) {
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.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(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}%`);
$(".details-sort").remove();
$(".description-sort").append(htmlSortDescription);
$(".roll-draconic").val(sort.data.listIndex);
$(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.data.difficulte));
$(".div-sort-ptreve-fixe").text(sort.data.ptreve);
$(".roll-draconic").val(sort.system.listIndex);
$(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.system.difficulte));
$(".div-sort-ptreve-fixe").text(sort.system.ptreve);
const diffVariable = RdDItemSort.isDifficulteVariable(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-fixe"), !diffVariable);
HtmlUtility._showControlWhen($(".div-sort-ptreve-var"), coutVariable);
@ -298,8 +302,8 @@ export class RdDRoll extends Dialog {
async updateRollResult() {
let rollData = this.rollData;
rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat());
rollData.caracValue = parseInt(rollData.selectedCarac.value);
rollData.dmg = rollData.attackerRoll?.dmg ?? RdDBonus.dmg(rollData, this.actor.getBonusDegat())
rollData.caracValue = parseInt(rollData.selectedCarac.value)
rollData.mortalite = rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite ?? 'mortel';
rollData.coupsNonMortels = (rollData.attackerRoll?.dmg.mortalite ?? rollData.dmg.mortalite) == 'non-mortel';
rollData.use.appelAuMoral = this.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac);
@ -339,7 +343,7 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */
_computeFinalLevel(rollData) {
return RollDataAjustements.sum(rollData.ajustements)
return RollDataAjustements.sum(rollData.ajustements);
}
/* -------------------------------------------- */
_computeDiffCompetence(rollData) {
@ -375,13 +379,13 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */
_getTitle(rollData) {
const carac = rollData.selectedCarac.label
const carac = rollData.selectedCarac.label;
if (!rollData.competence) {
return carac
return carac;
}
const compName = rollData.competence.name
const compName = rollData.competence.name;
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
const niveau = Misc.toSignedString(rollData.competence.system.niveau)

View File

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

View File

@ -19,9 +19,9 @@ import { ReglesOptionelles } from "./regles-optionelles.js";
*/
export const referenceAjustements = {
competence: {
isUsed: (rollData, actor) => rollData.competence,
getLabel: (rollData, actor) => rollData.competence?.name,
getValue: (rollData, actor) => rollData.competence?.system.niveau,
isUsed: (rollData, actor) => Misc.data(rollData.competence),
getLabel: (rollData, actor) => Misc.data(rollData.competence)?.name,
getValue: (rollData, actor) => Misc.data(rollData.competence)?.system?.niveau,
},
meditation: {
isUsed: (rollData, actor) => rollData.meditation,
@ -33,7 +33,7 @@ export const referenceAjustements = {
getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre',
getValue: (rollData, actor) => rollData.selectedSort
? 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: {
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>` : ''
},
isEcaille: {
isVisible: (rollData, actor) => rollData.arme?.data.magique && Number(rollData.arme?.data.ecaille_efficacite) > 0,
isUsed: (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) => Misc.data(rollData.arme)?.system.magique && Number(Misc.data(rollData.arme)?.system.ecaille_efficacite) > 0,
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: {
isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData),

View File

@ -2,7 +2,6 @@ import { TMRRencontres } from "./tmr-rencontres.js";
import { Misc } from "./misc.js";
import { Grammar } from "./grammar.js";
import { RdDDice } from "./rdd-dice.js";
import { tmrConstants } from "./tmr-constants.js";
/* -------------------------------------------- */
const TMRMapping = {
@ -12,7 +11,7 @@ const TMRMapping = {
D1: { type: "fleuve", label: "Fleuve de l'Oubli" },
E1: { type: "monts", label: "Monts de Kanaï" },
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" },
I1: { type: "plaines", label: "Plaines Grises" },
J1: { type: "monts", label: "Monts Fainéants" },
@ -70,7 +69,7 @@ const TMRMapping = {
F5: { type: "cite", label: "Cité de Panople" },
G5: { type: "pont", label: "Pont dIk" },
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" },
K5: { type: "fleuve", label: "Fleuve de l'Oubli" },
L5: { type: "collines", label: "Collines Suaves" },
@ -86,9 +85,9 @@ const TMRMapping = {
H6: { type: "monts", label: "Monts Gurdes" },
I6: { type: "necropole", label: "Nécropole de Xotar" },
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" },
M6: { type: "desolation", label: "Désolation de Demain" },
M6: { type: "desolation", label: "Désolation de Presque" },
A7: { type: "plaines", label: "Plaines de lArc" },
B7: { type: "marais", label: "Marais Bluants" },
@ -124,7 +123,7 @@ const TMRMapping = {
D9: { type: "pont", label: "Pont dOrx" },
E9: { type: "fleuve", label: "Fleuve de l'Oubli" },
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" },
I9: { type: "fleuve", label: "Fleuve de l'Oubli" },
J9: { type: "marais", label: "Marais Gronchants" },
@ -146,10 +145,10 @@ const TMRMapping = {
L10: { type: "desert", label: "Désert de Nicrop" },
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" },
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" },
F11: { type: "cite", label: "Cité de Noape" },
G11: { type: "fleuve", label: "Fleuve de l'Oubli" },
@ -170,7 +169,7 @@ const TMRMapping = {
H12: { type: "collines", label: "Collines de Tooth" },
I12: { type: "gouffre", label: "Gouffre Abimeux" },
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" },
M12: { type: "collines", label: "Collines Révulsantes" },
@ -181,7 +180,7 @@ const TMRMapping = {
E13: { type: "plaines", label: "Plaines de Xnez" },
F13: { type: "foret", label: "Forêt des Cris" },
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" },
J13: { type: "gouffre", label: "Gouffre de Gromph" },
K13: { type: "foret", label: "Forêt de Kluth" },
@ -200,7 +199,7 @@ const TMRMapping = {
J14: { type: "desert", label: "Désert de Sank" },
K14: { type: "necropole", label: "Nécropole dAntinéar" },
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" },
C15: { type: "plaines", label: "Plaines de Toué" },

View File

@ -16,7 +16,7 @@ import { Conquete } from "./conquete.js";
import { Pelerinage } from "./pelerinage.js";
import { Periple } from "./periple.js";
import { UrgenceDraconique } from "./urgence-draconique.js";
import { Misc } from "../misc.js";
import { Grammar } from "../grammar.js";
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
@ -152,7 +158,7 @@ export class EffetsDraconiques {
}
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)) {
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) => {
onLoad(loader, resources);
for (let onAnimate of this.callbacksOnAnimate) {

View File

@ -55,7 +55,6 @@
{{/each}}
<li class="flexrow">
<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>
</li>
</ol>
@ -103,11 +102,11 @@
<span class="competence-label">{{comp.name}}</span>
</a>
<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}}"
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}}"
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">
<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>
@ -168,7 +167,7 @@
<div class="form-group editor">
<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>
{{>"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}}" />
<span class="competence-label"><a>{{comp.name}}</a></span>
<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}}"
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}}"
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">
<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>
@ -133,7 +133,7 @@
{{!-- Biography Tab --}}
<div class="tab description" data-group="primary" data-tab="description">
<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>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}
</div>

View File

@ -1,11 +1,11 @@
{{#if isVisible}}
<li class="item flexrow list-item {{#if data.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}">
{{#if visible}}
<li class="item flexrow list-item {{#if system.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}">
<a class="competence-label" name="{{name}}">
<img class="sheet-competence-img" src="{{img}}"/>
<span class="competence-label">{{name}}</span>
</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>
<a class="item-control competence-xp-augmenter" compname="{{name}}" title="Augmenter">
<i class="fas fa-arrow-alt-circle-up"></i>
@ -32,8 +32,8 @@
<div class="item-controls">
{{#if system.stressXpMax}}
<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}}">
<i class="fas fa-arrow-alt-circle-up allouer-stress{{#if data.isStressLevelUp}}-level-up{{/if}}"></i>
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 system.isStressLevelUp}}-level-up{{/if}}"></i>
</a>
{{else}}
<i class="far fa-circle"></i>

View File

@ -1,6 +1,6 @@
{{#if options.isGM}}
<h3>Notes du MJ : </h3>
<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>
{{/if}}

View File

@ -286,7 +286,7 @@
</li>
{{#each combat as |arme key|}}
<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">
<a>
{{#if arme.img}}
@ -295,10 +295,10 @@
<span>{{arme.name}}</span>
</a>
</span>
<span class="arme-initiative"><a>{{arme.system.initiative}}</a></span>
<span class="competence-label">{{arme.system.competence}}</span>
<span class="competence-value">{{numberFormat arme.system.niveau decimals=0 sign=true}}</span>
<span class="competence-value">{{numberFormat arme.system.dommagesReels decimals=0 sign=true}}</span>
<span class="arme-initiative"><a>{{arme.data.initiative}}</a></span>
<span class="competence-label">{{arme.data.competence}}</span>
<span class="competence-value">{{numberFormat arme.data.niveau decimals=0 sign=true}}</span>
<span class="competence-value">{{numberFormat arme.data.dommagesReels decimals=0 sign=true}}</span>
</li>
{{/each}}
{{#each esquives as |esq key|}}
@ -307,12 +307,11 @@
<a class="competence-label" name="{{esq.name}}">
<img class="sheet-competence-img" src="{{esq.img}}"/>
<span>{{esq.name}}</span>
{{log esq}}
</a>
</span>
<span class="arme-initiative"></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>
</li>
{{/each}}
@ -334,7 +333,7 @@
{{#each maladiesPoisons as |maladie key|}}
<li class="item flexrow list-item" data-item-id="{{maladie._id}}">
<span class="competence-label">
{{#if (or @root.options.isGM maladie.system.identifie)}}
{{#if (or @root.options.isGM maladie.data.identifie)}}
{{maladie.name}}
{{else}}
Inconnue
@ -342,8 +341,8 @@
</span>
<span class="competence-label">{{maladie.type}}</span>
<span class="competence-label">
{{#if (or @root.options.isGM maladie.system.remedesconnus)}}
{{maladie.system.remedes}}
{{#if (or @root.options.isGM maladie.data.remedesconnus)}}
{{maladie.data.remedes}}
{{else}}
Remèdes Inconnus
{{/if}}
@ -366,7 +365,7 @@
{{#each possessions as |possession key|}}
<li class="item flexrow list-item" data-item-id="{{possession._id}}">
<span class="competence-label">
{{possession.name}}
<a class="sheet-possession-attack">{{possession.name}} (Conjurer)</a>
</span>
<span class="competence-label">{{possession.system.type}}</span>
<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"}}
{{/each}}
{{#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 recettescuisine as |recette id|}}
{{> "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>
</div>
<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 --}}
{{#if queues.length}}
<h3>Queues:</h3>
<ul class="flex-group-left">
{{#each queues as |queue key|}}
@ -579,28 +521,8 @@
</li>
{{/each}}
</ul>
<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>
<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 ombres.length}}
<h3>Ombres de Thanatos:</h3>
<ul class="item-list">
{{#each ombres as |ombre key|}}
@ -612,16 +534,58 @@
</li>
{{/each}}
</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}}
<hr>
{{#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}} - {{rencontre.coord}}</a></span>
<span class="flex-shrink">{{caseTmr-label rencontre.coord}}</span>
<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>Le {{rencontre.date}} à {{rencontre.heure}}</span>
<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>
@ -629,18 +593,69 @@
</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>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>
<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>
{{#if hautreve.casesTmr}}
<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>
<span>{{casetmr.data.coord}} - {{caseTmr-label casetmr.data.coord}}</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}}
<br><br>
{{/if}}
</div>
@ -780,11 +795,11 @@
<article class="flexcol">
<h3>Biographie : </h3>
<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>
<h3>Notes : </h3>
<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>
<h3>Journal d'Experience</h3>
<div class="form-group editor">

View File

@ -92,10 +92,10 @@
<li class="item flexrow list-item" data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<span class="item-name flex-grow">{{item.name}}</span>
<span class="item-quantite">{{item.system.quantite}}</span>
<span class="item-quantite">{{numberFormat item.system.encTotal decimals=2}}</span>
<span class="item-quantite">{{item.data.quantite}}</span>
<span class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</span>
<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-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>

View File

@ -30,4 +30,11 @@
{{/if}}
<br>Points de Possession: {{possession.ptsPossession}}
<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>

View File

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

View File

@ -8,33 +8,33 @@
</h4>
</div>
<div class="form-group">
<label for="signe.system.difficulte">Difficulte</label>
<input type="number" name="data.difficulte" value="{{system.difficulte}}" data-dtype="Number" />
<label for="signe.data.difficulte">Difficulte</label>
<input type="number" name="signe.data.difficulte" value="{{signe.data.difficulte}}" data-dtype="Number" />
</div>
<div class="form-group">
<label for="signe.data.valeur.norm">Expérience en sorts</label>
<div class="flexrow">
<input class="signe-xp-sort" type="number" name="data.valeur.norm" data-typereussite="norm"
value="{{system.valeur.norm}}" min="1" max="100" data-dtype="Number" />
<input class="signe-xp-sort" type="number" name="signe.data.valeur.norm" data-typereussite="norm"
value="{{signe.data.valeur.norm}}" min="1" max="100" data-dtype="Number" />
<span>Sign.</span>
<input class="signe-xp-sort" type="number" name="data.valeur.sign" data-typereussite="sign"
value="{{system.valeur.sign}}" min="1" max="100" data-dtype="Number" />
<input class="signe-xp-sort" type="number" name="signe.data.valeur.sign" data-typereussite="sign"
value="{{signe.data.valeur.sign}}" min="1" max="100" data-dtype="Number" />
<span>Part.</span>
<input class="signe-xp-sort" type="number" name="data.valeur.part" data-typereussite="part"
value="{{system.valeur.part}}" min="1" max="100" data-dtype="Number" />
<input class="signe-xp-sort" type="number" name="signe.data.valeur.part" data-typereussite="part"
value="{{signe.data.valeur.part}}" min="1" max="100" data-dtype="Number" />
</div>
</div>
<div class="form-group flexrow">
<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>
<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>
</div>
<div class="form-group">
<label for="tmrs">Terres médianes</label>
<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>
{{/each}}
</select>

View File

@ -6,7 +6,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="grid grid-2col">
<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>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div>

View File

@ -43,9 +43,9 @@
{{#if arme}}
{{#unless attackerRoll}}
<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>
{{else if (eq arme.system.mortalite 'empoignade')}}
{{else if (eq arme.data.mortalite 'empoignade')}}
<label>D&eacute;gats:</label><label>Empoignade</label>
{{else}}
<label>D&eacute;gats:</label>

View File

@ -6,7 +6,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="grid grid-2col">
<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>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div>

View File

@ -7,8 +7,8 @@
<div class="grid grid-2col">
<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>{{competence.name}}:</label><label class="flex-grow">{{numberFormat competence.system.niveauReel decimals=0 sign=true}}</label></label>
<label>Niveau de base:</label><label class="flex-grow">{{oeuvre.system.base}}</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.data.base}}</label>
</div>
</div>
<div class="flex-group-left">

View File

@ -5,7 +5,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/>
<div class="grid grid-2col">
<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 class="flex-group-left">

View File

@ -4,14 +4,14 @@
<div class="flex-group-left">
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="flexcol">
<label><strong>{{meditation.system.theme}}</strong></label>
<label><strong>{{meditation.data.theme}}</strong></label>
<hr>
<label>Support: <strong>{{upperFirst meditation.system.support}}</strong></label>
<label>Case TMR: <strong>{{typeTmr-name meditation.system.tmr}}</strong></label>
<label>Support: <strong>{{upperFirst meditation.data.support}}</strong></label>
<label>Case TMR: <strong>{{typeTmr-name meditation.data.tmr}}</strong></label>
<label>Durée: 60 minutes</label>
<hr>
<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 class="flex-group-left">
@ -19,19 +19,19 @@
<label><strong>Conditions Optionnelles : </strong></label>
</div>
<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}} />
</div>
<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}} />
</div>
<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}} />
</div>
<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}} />
</div>
<hr>

View File

@ -6,9 +6,9 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}" />
<div class="grid grid-2col">
<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>
{{> "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 class="flex-group-left">
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}

View File

@ -9,10 +9,10 @@
<label>Caractéristique: </label><label>{{selectedCarac.label}}</label>
</div>
<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 class="flexrow">
<label>Exotisme: </label><label>{{oeuvre.system.exotisme}}</label>
<label>Exotisme: </label><label>{{oeuvre.data.exotisme}}</label>
</div>
<div class="flexrow">
<label for="proportions">Proportions: </label>

View File

@ -5,7 +5,7 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/>
<div class="grid grid-2col">
<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 class="flex-group-left">

View File

@ -1,4 +1,3 @@
{{log 'lecture signe draconique' this}}
<form class="dialog-roll-sort">
<h2>Lire le signe draconique
<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 draconic}}
{{#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>
{{/each}}
{{/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"/>
<div class="rdd-hud-list tokenhudext left">
{{#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}}">
<label>C:{{arme.name}} {{arme.system.mainInfo}}</label>
<label>C:{{arme.name}} {{arme.data.mainInfo}}</label>
</div>
{{/unless}}
{{/each}}

View File

@ -3,7 +3,7 @@
<div class="rdd-hud-list tokenhudext right">
{{#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}}">
<label>I:{{arme.name}} {{arme.system.mainInfo}}</label>
<label>I:{{arme.name}} {{arme.data.mainInfo}}</label>
</div>
{{/each}}
{{#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">
<label for="xp">Caractéristique</label>
<select name="data.carac" id="caracselect" data-dtype="String">
{{#select data.carac}}
{{#select system.carac}}
{{#each caracList as |carac key|}}
<option value="{{key}}">{{carac.label}}</option>
{{/each}}
@ -21,7 +21,7 @@
<div class="form-group">
<label for="xp">Compétence</label>
<select name="data.competence" id="competenceselect" data-dtype="String">
{{#select data.competence}}
{{#select system.competence}}
{{#each competences as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option>
{{/each}}
@ -30,24 +30,24 @@
</div>
<div class="form-group">
<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 class="form-group">
<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 class="form-group">
<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>
{{#if isGM}}
<div class="form-group">
<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 class="form-group">
<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>
{{else}}
<div class="form-group">
@ -55,22 +55,22 @@
{{#if data.cacher_points_de_tache}}
<input class="attribute-value" type="text" value="?????" data-dtype="Number" disabled/>
{{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}}
</div>
{{/if}}
<hr>
<div class="form-group">
<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 class="form-group">
<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 class="form-group">
<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>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}

View File

@ -1,10 +1,10 @@
<div class="flex-group-left details-sort">
{{#if sort.system.cible}}<label><strong>Cible</strong>: {{sort.system.cible}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.JR}}<label><strong>JR</strong>: {{sort.system.JR}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.portee}}<label><strong>Portée</strong>: {{sort.system.portée}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.duree}}<label><strong>Durée</strong>: {{sort.system.duree}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.system.coutseuil}}<label><strong>Coût de seuil</strong>: {{sort.system.coutseuil}}</label>{{/if}}
{{#if sort.data.cible}}<label><strong>Cible</strong>: {{sort.data.cible}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.data.JR}}<label><strong>JR</strong>: {{sort.data.JR}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.data.portee}}<label><strong>Portée</strong>: {{sort.data.portée}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.data.duree}}<label><strong>Durée</strong>: {{sort.data.duree}}&nbsp;&nbsp;</label>{{/if}}
{{#if sort.data.coutseuil}}<label><strong>Coût de seuil</strong>: {{sort.data.coutseuil}}</label>{{/if}}
</div>
<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>

View File

@ -1,14 +1,14 @@
<div class="flexcol">
<span><label>Description : </label></span>
<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>
{{#if isGM}}
<div class="flexcol">
<span><label>Description (MJ seulement): </label></span>
<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>
{{/if}}

View File

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