This commit is contained in:
sladecraven 2021-04-03 08:19:30 +02:00
commit 97d53d3f31
29 changed files with 406 additions and 306 deletions

61
dev-notes.md Normal file
View File

@ -0,0 +1,61 @@
# Actor notes
> The Actor#getData default implementation gives you the following for use in sheet rendering:
```
actor -> the Actor instance
data -> a cloned copy of Actor#data
items -> a cloned copy of Actor#data#items
effects -> a cloned copy of Actor#data#effects
```
> if all you need is a safe copy of `Actor#data`, you'll be much better off by simply defining your own function and avoiding all the wasted work that the parent class does which will slow down your sheet
```js
getData(options) {
return {
data: foundry.utils.deepClone(this.object.data)
}
}
```
who knows, maybe you don't even need to copy your actor data, skip the copy and it's even faster:
```js
getData(options) {
return {
data: this.object.data
}
}
```
Atropos19/02/2021
There are two recommended ways to create owned items in 0.8.0:
```js
await Item.create(itemData, {parent: actor});
await actor.createEmbeddedDocuments("Item", itemDataArray);
```
You can update an embedded item in one of two ways:
```js
//Method 1:
const item = actor.items.get(itemId);
item.update(data);
//Method 2:
actor.updateEmbeddedDocuments("Item", [{_id: itemId, ...}]);
```
I noticed adding an ActiveEffect to an actor in code using
```js
this.createEmbeddedDocuments('ActiveEffect', [effet], options);
this.applyActiveEffects();
```
Atropos — Aujourdhui à 14:42
Two notes on this:
1. You don't actually need to call this.applyActiveEffects() because this will happen automatically whenever an effect is created/updated/deleted
2. If you want to suppress the automatic display of the sheet for the newly created document, you can pass options.renderSheet = false as part of your options object

View File

@ -71,7 +71,7 @@ export class RdDActorEntiteSheet extends ActorSheet {
// Update Inventory Item // Update Inventory Item
html.find('.item-edit').click(ev => { html.find('.item-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getEmbeddedDocuments('Item', li.data("itemId")); const item = this.actor.getEmbeddedDocument('Item', li.data("itemId"));
item.sheet.render(true); item.sheet.render(true);
}); });

View File

@ -95,7 +95,7 @@ export class RdDActorSheet extends ActorSheet {
caracTotal: RdDCarac.computeTotal(formData.data.carac, formData.data.beaute), caracTotal: RdDCarac.computeTotal(formData.data.carac, formData.data.beaute),
// Mise à jour de l'encombrement total et du prix de l'équipement // Mise à jour de l'encombrement total et du prix de l'équipement
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
prixTotalEquipement: await this.actor.computePrixTotalEquipement(), prixTotalEquipement: this.actor.computePrixTotalEquipement(),
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr, surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
fatigue: { fatigue: {
malus: RdDUtility.calculMalusFatigue(formData.data.sante.fatigue.value, formData.data.sante.endurance.max), malus: RdDUtility.calculMalusFatigue(formData.data.sante.fatigue.value, formData.data.sante.endurance.max),
@ -173,16 +173,16 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async creerObjet() { async creerObjet() {
let itemType = $("#creer-equipement").val(); let itemType = $(".item-type").val();
await this.createItem('Nouveau ' + itemType, itemType); await this.createItem('Nouveau ' + itemType, itemType);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async selectObjetType() { async selectObjetType() {
let itemType = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "monnaie"]; let typeObjets = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "monnaie"];
let options = '<span class="competence-label">Selectionnez le type d\'équipement</span><select id="creer-equipement">'; let options = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`;
for (let typeName of itemType) { for (let typeName of typeObjets) {
options += '<option value="' + typeName + '">' + typeName + '</option>' options += `<option value="${typeName}">${typeName}</option>`
} }
options += '</select>'; options += '</select>';
let d = new Dialog({ let d = new Dialog({
@ -199,6 +199,27 @@ export class RdDActorSheet extends ActorSheet {
d.render(true); d.render(true);
} }
/* -------------------------------------------- */
async selectTypeOeuvre() {
let typeOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu" ];
let options = `<span class="competence-label">Selectionnez le type d'oeuvre</span><select class="item-type">`;
for (let typeName of typeOeuvres) {
options += `<option value="${typeName}">${typeName}</option>`
}
options += '</select>';
let d = new Dialog({
title: "Créer une oeuvre",
content: options,
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: "Créer l'oeuvre",
callback: () => this.creerObjet()
}
}
});
d.render(true);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
activateListeners(html) { activateListeners(html) {
@ -246,12 +267,15 @@ export class RdDActorSheet extends ActorSheet {
ev.preventDefault(); ev.preventDefault();
} }
}); });
html.find('#creer-tache').click(ev => { html.find('.creer-tache').click(ev => {
this.createEmptyTache(); this.createEmptyTache();
}); });
html.find('#creer-un-objet').click(ev => { html.find('.creer-un-objet').click(ev => {
this.selectObjetType(); this.selectObjetType();
}); });
html.find('.creer-une-oeuvre').click(ev => {
this.selectTypeOeuvre();
});
html.find('#nettoyer-conteneurs').click(ev => { html.find('#nettoyer-conteneurs').click(ev => {
this.actor.nettoyerConteneurs(); this.actor.nettoyerConteneurs();
}); });
@ -407,19 +431,19 @@ export class RdDActorSheet extends ActorSheet {
// Display info about queue // Display info about queue
html.find('.queuesouffle-label a').click((event) => { html.find('.queuesouffle-label a').click((event) => {
let myID = event.currentTarget.attributes['data-item-id'].value; let myID = event.currentTarget.attributes['data-item-id'].value;
const item = this.actor.getEmbeddedDocuments('Item', myID); const item = this.actor.getEmbeddedDocument('Item', myID);
item.sheet.render(true); item.sheet.render(true);
}); });
// Info sort // Info sort
html.find('.sort-label a').click((event) => { html.find('.sort-label a').click((event) => {
let myID = event.currentTarget.attributes['data-id'].value; let myID = event.currentTarget.attributes['data-id'].value;
const item = this.actor.getEmbeddedDocuments('Item', myID); const item = this.actor.getEmbeddedDocument('Item', myID);
item.sheet.render(true); item.sheet.render(true);
}); });
// Info sort // Info sort
html.find('.case-label a').click((event) => { html.find('.case-label a').click((event) => {
let myID = event.currentTarget.attributes['data-id'].value; let myID = event.currentTarget.attributes['data-id'].value;
const item = this.actor.getEmbeddedDocuments('Item', myID); const item = this.actor.getEmbeddedDocument('Item', myID);
item.sheet.render(true); item.sheet.render(true);
}); });

View File

@ -87,7 +87,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
// Update Inventory Item // Update Inventory Item
html.find('.item-edit').click(ev => { html.find('.item-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getEmbeddedDocuments('Item', li.data("itemId")); const item = this.actor.getEmbeddedDocument('Item', li.data("itemId"));
item.sheet.render(true); item.sheet.render(true);
}); });
// Delete Inventory Item // Delete Inventory Item

View File

@ -57,39 +57,38 @@ export class RdDActor extends Actor {
* This overrided create() function adds initial items * This overrided create() function adds initial items
* Namely: Basic skills, money, * Namely: Basic skills, money,
* *
* @param {Object} data Barebones actor data which this function adds onto. * @param {Object} actorData Barebones actor data which this function adds onto.
* @param {Object} options (Unused) Additional options which customize the creation workflow. * @param {Object} options (Unused) Additional options which customize the creation workflow.
* *
*/ */
static async create(data, options) { static async create(actorData, options) {
// Case of compendium global import // Case of compendium global import
if (data instanceof Array) { if (actorData instanceof Array) {
return super.create(data, options); return super.create(actorData, options);
} }
const isPersonnage = data.type == "personnage"; const isPersonnage = actorData.type == "personnage";
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic // If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
if (data.items) { if (actorData.items) {
let actor = super.create(data, options); let actor = super.create(actorData, options);
if (isPersonnage) { if (isPersonnage) {
await actor.checkMonnaiePresence(data.items); await actor.checkMonnaiePresence(actorData.items);
} }
return actor; return actor;
} }
const competences = await RdDUtility.loadCompendium(RdDItemCompetence.actorCompendium(data.type)); const competences = await RdDUtility.loadCompendium(RdDItemCompetence.actorCompendium(actorData.type));
data.items = competences.map(it => Misc.data(it)); actorData.items = competences.map(it => Misc.data(it));
if (isPersonnage) { if (isPersonnage) {
data.items = data.items.concat(Monnaie.monnaiesData()); actorData.items = actorData.items.concat(Monnaie.monnaiesData());
} }
return super.create(data, options); return super.create(actorData, options);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
prepareData() { prepareData() {
super.prepareData(); super.prepareData();
const actorData = this.data; const actorData = this.data;
// Dynamic computing fields // Dynamic computing fields
@ -138,6 +137,7 @@ export class RdDActor extends Actor {
async _prepareCharacterData(actorData) { async _prepareCharacterData(actorData) {
// Initialize empty items // Initialize empty items
RdDCarac.computeCarac(actorData.data); RdDCarac.computeCarac(actorData.data);
this.computeIsHautRevant();
this.computeEncombrementTotalEtMalusArmure(); this.computeEncombrementTotalEtMalusArmure();
this.computePrixTotalEquipement(); this.computePrixTotalEquipement();
this.computeEtatGeneral(); this.computeEtatGeneral();
@ -232,7 +232,7 @@ export class RdDActor extends Actor {
return Math.floor(this.encTotal ?? 0); return Math.floor(this.encTotal ?? 0);
} }
getPrixTotalEquipement() { getPrixTotalEquipement() {
return Math.floor(this.prixTotalEquipement ?? 0); return Math.floor(Misc.templateData(this).prixTotalEquipement ?? 0);
} }
getSurenc() { getSurenc() {
return Misc.toInt(Misc.templateData(this).compteurs.surenc?.value); return Misc.toInt(Misc.templateData(this).compteurs.surenc?.value);
@ -245,8 +245,14 @@ export class RdDActor extends Actor {
getObjet(id) { getObjet(id) {
return id ? this.data.items.find(it => it.id == id) : undefined; return id ? this.data.items.find(it => it.id == id) : undefined;
} }
listItemsData(type) {
return this.filterItemsData(it => it.type == type);
}
filterItemsData(filter) {
return this.data.items.map(it => Misc.data(it)).filter(filter);
}
getItemOfType(id, type) { getItemOfType(id, type) {
return id ? this.data.items.find(it => it.id == id && it.type == type) : undefined; return id ? this.data.items.find(it => it.id == id && Misc.data(it).type == type) : undefined;
} }
getMonnaie(id) { getMonnaie(id) {
return this.getItemOfType(id, 'monnaie'); return this.getItemOfType(id, 'monnaie');
@ -343,13 +349,11 @@ export class RdDActor extends Actor {
async _recupereChance() { async _recupereChance() {
// On ne récupère un point de chance que si aucun appel à la chance dans la journée // On ne récupère un point de chance que si aucun appel à la chance dans la journée
if (this.getFlag('foundryvtt-reve-de-dragon', 'utilisationChance')) { if (this.getChanceActuel() < this.getChance() && !this.getFlag('foundryvtt-reve-de-dragon', 'utilisationChance')) {
// Nouveau jour, suppression du flag
await this.unsetFlag('foundryvtt-reve-de-dragon', 'utilisationChance');
}
else {
await this.chanceActuelleIncDec(1); await this.chanceActuelleIncDec(1);
} }
// Nouveau jour, suppression du flag
await this.unsetFlag('foundryvtt-reve-de-dragon', 'utilisationChance');
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -651,14 +655,14 @@ export class RdDActor extends Actor {
return; return;
} }
} }
const actorData = Misc.data(this); const tplData = Misc.templateData(this);
if (caracName == "reve") { if (caracName == "reve") {
if (caracValue > Misc.toInt(actorData.data.reve.seuil.value)) { if (caracValue > Misc.toInt(tplData.reve.seuil.value)) {
this.setPointsDeSeuil(caracValue); this.setPointsDeSeuil(caracValue);
} }
} }
if (caracName == "chance") { if (caracName == "chance") {
if (caracValue > Misc.toInt(actorData.data.compteurs.chance.value)) { if (caracValue > Misc.toInt(tplData.compteurs.chance.value)) {
this.setPointsDeChance(caracValue); this.setPointsDeChance(caracValue);
} }
} }
@ -927,7 +931,7 @@ export class RdDActor extends Actor {
// gestion conteneur/contenu // gestion conteneur/contenu
if (item.conteneurId) { // l'Objet était dans un conteneur if (item.conteneurId) { // l'Objet était dans un conteneur
let newConteneurId = itemMap[item.conteneurId]; // Get conteneur let newConteneurId = itemMap[item.conteneurId]; // Get conteneur
let newConteneur = this.data.items.find(subItem => subItem._id == newConteneurId); let newConteneur = this.getObjet(newConteneurId);
let newItemId = itemMap[item.id]; // Get newItem let newItemId = itemMap[item.id]; // Get newItem
@ -944,62 +948,67 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
detectSurEncombrement() { detectSurEncombrement() {
let maxEnc = 0; return Math.max(0, Math.ceil(Number(this.data.encTotal) - this.getEncombrementMax()));
if (this.data.type == 'vehicule') }
maxEnc = Misc.templateData(this).capacite_encombrement; getEncombrementMax() {
else return (this.data.type == 'vehicule')
maxEnc = Misc.templateData(this).attributs.encombrement.value; ? Misc.templateData(this).capacite_encombrement
let diffEnc = Number(this.data.encTotal) - Number(maxEnc); : Misc.templateData(this).attributs.encombrement.value;
return Math.max(0, Math.ceil(diffEnc)); }
/* -------------------------------------------- */
async computeIsHautRevant() {
const tplData = Misc.templateData(this);
tplData.attributs.hautrevant.value = this.listItemsData('tete').find(it => Grammar.toLowerCaseNoAccent(it.name) == 'don de haut-reve')
? "Haut rêvant"
: "";
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async computeEncombrementTotalEtMalusArmure() { async computeEncombrementTotalEtMalusArmure() {
let encTotal = 0; await this.computeMalusArmure();
let newMalusArmure = 0; return this.computeEncombrement();
for (const item of this.data.items.filter(it => Misc.templateData(it).encombrement != undefined)) { }
let itemData = item.data; // v0.8 normalization
if (itemData.type == 'armure' && itemData.data.equipe) { // Armure équipée, intégration du malus armure total
newMalusArmure += itemData.data.malus;
}
// Calcul encombrement
if (itemData.data && itemData.data.encombrement != undefined) {
if (!Number(itemData.data.encombrement)) itemData.data.encombrement = 0; // Auto-fix
if (itemData.data.quantite == undefined) itemData.data.quantite = 1; // Auto-fix
if (itemData.data.quantite < 0) itemData.data.quantite = 0; // Auto-fix
itemData.data.encTotal = Number(itemData.data.encombrement) * Number(itemData.data.quantite);
encTotal += itemData.data.encTotal;
} else {
itemData.data.encTotal = 0; // Force default enc
}
}
// Mise à jour valeur totale et états
this.data.encTotal = encTotal;
this.detectSurEncombrement();
/* -------------------------------------------- */
computeEncombrement() {
Misc.templateData(this).encTotal = this.filterItemsData(it => it.data.encombrement)
.map(it => this._calcEncItem(it))
.reduce(Misc.sum(), 0);
return Misc.templateData(this).encTotal;
}
_calcEncItem(it) {
it.data.encombrement = Number(it.data.encombrement ?? 0);
it.data.quantite = Math.min(1, Number(it.data.quantite ?? 1));
it.data.encTotal = it.data.encombrement * it.data.quantite;
return it.data.encTotal;
}
/* -------------------------------------------- */
async computeMalusArmure() {
const newMalusArmure = this.filterItemsData(it => it.type == 'armure' && it.data.equipe)
.map(it => it.data.malus ?? 0)
.reduce(Misc.sum(), 0);
// Mise à jour éventuelle du malus armure // Mise à jour éventuelle du malus armure
if (newMalusArmure && Misc.templateData(this).attributs?.malusarmure?.value != newMalusArmure) { if (newMalusArmure && Misc.templateData(this).attributs?.malusarmure?.value != newMalusArmure) {
await this.updateAttributeValue("malusarmure", newMalusArmure); await this.updateAttributeValue("malusarmure", newMalusArmure);
} }
return encTotal; return newMalusArmure;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async computePrixTotalEquipement() { computePrixTotalEquipement() {
let prixTotalEquipement = 0; let prixTotalEquipement = 0;
// prix total de l'équipement est la somme du cout de chaque équipement multiplié par sa quantité. // prix total de l'équipement est la somme du cout de chaque équipement multiplié par sa quantité.
for (const item of this.data.items) { for (const itemData of this.filterItemsData(it => it?.data.cout)) {
let itemData = item.data; // v0.8 normalization const cout = Math.min(Number(itemData.data.cout ?? 0), 0);
if (itemData.data && itemData.data.cout != undefined) { const quantite = Math.min(Number(itemData.data?.quantite ?? 1), 1);
if (!Number(itemData.data.cout)) itemData.data.cout = 0; // Auto-fix prixTotalEquipement += cout * quantite;
if (itemData.data.quantite == undefined) itemData.data.quantite = 1; // Auto-fix
if (itemData.data.cout < 0) itemData.data.cout = 0; // Auto-fix
prixTotalEquipement += Number(itemData.data.cout) * Number(itemData.data.quantite);
}
} }
// Mise à jour valeur totale de l'équipement // Mise à jour valeur totale de l'équipement
this.prixTotalEquipement = prixTotalEquipement; Misc.templateData(this).prixTotalEquipement = prixTotalEquipement;
return prixTotalEquipement; return prixTotalEquipement;
} }
@ -1115,7 +1124,7 @@ export class RdDActor extends Actor {
} }
buildTMRInnaccessible() { buildTMRInnaccessible() {
const tmrInnaccessibles = this.data.items.filter(it => Draconique.isCaseTMR(it) && const tmrInnaccessibles = this.filterItemsData(it => Draconique.isCaseTMR(it) &&
EffetsDraconiques.isInnaccessible(it)); EffetsDraconiques.isInnaccessible(it));
return tmrInnaccessibles.map(it => it.data.coord); return tmrInnaccessibles.map(it => it.data.coord);
} }
@ -1435,22 +1444,21 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async moralIncDec(ajustementMoral) { async moralIncDec(ajustementMoral) {
let actorData let tplData = Misc.templateData(this);
if (ajustementMoral != 0) { if (ajustementMoral != 0) {
actorData = Misc.data(this); let moral = Misc.toInt(tplData.compteurs.moral.value) + ajustementMoral
let moral = Misc.toInt(actorData.data.compteurs.moral.value) + ajustementMoral
if (moral > 3) { // exaltation if (moral > 3) { // exaltation
const exaltation = Misc.toInt(actorData.data.compteurs.exaltation.value) + moral - 3; const exaltation = Misc.toInt(tplData.compteurs.exaltation.value) + moral - 3;
await this.updateCompteurValue('exaltation', exaltation); await this.updateCompteurValue('exaltation', exaltation);
} }
if (moral < -3) { // dissolution if (moral < -3) { // dissolution
const dissolution = Misc.toInt(actorData.data.compteurs.dissolution.value) + 3 - moral; const dissolution = Misc.toInt(tplData.compteurs.dissolution.value) + 3 - moral;
await this.updateCompteurValue('dissolution', dissolution); await this.updateCompteurValue('dissolution', dissolution);
} }
moral = Math.max(-3, Math.min(moral, 3)); moral = Math.max(-3, Math.min(moral, 3));
await this.updateCompteurValue('moral', moral); await this.updateCompteurValue('moral', moral);
} }
return actorData.data.compteurs.moral.value; return tplData.compteurs.moral.value;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1667,7 +1675,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async checkCompetenceXP(compName, newXP = undefined) { async checkCompetenceXP(compName, newXP = undefined) {
let competence = RdDItemCompetence.findCompetence(this.data.items, compName); let competence = this.getCompetence(compName);
if (competence && newXP && newXP == competence.data.xp) { // Si édition, mais sans changement XP if (competence && newXP && newXP == competence.data.xp) { // Si édition, mais sans changement XP
return; return;
} }
@ -1834,7 +1842,7 @@ export class RdDActor extends Actor {
let addMsg = ""; let addMsg = "";
let rencSpecial = this.data.items.find(item => EffetsDraconiques.isMauvaiseRencontre(item)); let rencSpecial = this.data.items.find(item => EffetsDraconiques.isMauvaiseRencontre(item));
if (rencSpecial) { if (rencSpecial) {
rencSpecial = duplicate(rencSpecial); // To keep it rencSpecial = Misc.data(rencSpecial); // To keep it
if (rencSpecial.type != 'souffle') { if (rencSpecial.type != 'souffle') {
this.deleteEmbeddedDocuments('Item', [rencSpecial._id]); // Suppression dans la liste des queues this.deleteEmbeddedDocuments('Item', [rencSpecial._id]); // Suppression dans la liste des queues
addMsg = " La queue a été supprimée de votre fiche automatiquement"; addMsg = " La queue a été supprimée de votre fiche automatiquement";
@ -2261,9 +2269,6 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollAppelChance(onSuccess = () => { }, onEchec = () => { }) { async rollAppelChance(onSuccess = () => { }, onEchec = () => { }) {
// Stocke si utilisation de la chance // Stocke si utilisation de la chance
await this.unsetFlag('foundryvtt-reve-de-dragon', 'utilisationChance');
await this.setFlag('foundryvtt-reve-de-dragon', 'utilisationChance', true);
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' }; let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' };
const dialog = await RdDRoll.create(this, rollData, const dialog = await RdDRoll.create(this, rollData,
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' }, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' },
@ -2283,6 +2288,7 @@ export class RdDActor extends Actor {
async _appelChanceResult(rollData, onSuccess = () => { }, onEchec = () => { }) { async _appelChanceResult(rollData, onSuccess = () => { }, onEchec = () => { }) {
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html') await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
if (rollData.rolled.isSuccess) { if (rollData.rolled.isSuccess) {
await this.setFlag('foundryvtt-reve-de-dragon', 'utilisationChance', true);
await this.chanceActuelleIncDec(-1); await this.chanceActuelleIncDec(-1);
onSuccess(); onSuccess();
} }
@ -2292,11 +2298,8 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async chanceActuelleIncDec(value, limit = true) { async chanceActuelleIncDec(value) {
chance = Math.max(Misc.templateData(this).compteurs.chance.value + value, 0); const chance = Math.min(this.getChance(), Math.max(this.getChanceActuel() + value, 0));
if (limit) {
chance = Math.min(chance.value, this.getChance())
}
await this.updateCompteurValue("chance", chance); await this.updateCompteurValue("chance", chance);
} }
@ -2326,7 +2329,8 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
checkDesirLancinant() { checkDesirLancinant() {
let queue = this.data.items.filter((item) => item.name.toLowerCase().includes('lancinant')); let queue = this.filterItemsData(it => it.type == 'queue' || it.type == 'ombre')
.filter(it => Grammar.toLowerCaseNoAccent(it.name).includes('desir lancinant'));
return (queue.length > 0); return (queue.length > 0);
} }
@ -2376,7 +2380,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async ajouteNombreAstral(data) { async ajouteNombreAstral(data) {
// Gestion expérience (si existante) // Gestion expérience (si existante)
data.competence = RdDItemCompetence.findCompetence(this.data.items, "astrologie"); data.competence = this.getCompetence("astrologie");
data.selectedCarac = Misc.templateData(this).carac["vue"]; data.selectedCarac = Misc.templateData(this).carac["vue"];
this._appliquerAjoutExperience(data); this._appliquerAjoutExperience(data);
@ -2388,7 +2392,7 @@ export class RdDActor extends Actor {
await this.createEmbeddedDocuments("Item", [item]); await this.createEmbeddedDocuments("Item", [item]);
// Suppression des anciens nombres astraux // Suppression des anciens nombres astraux
let toDelete = this.data.items.filter(it => it.data.jourindex < game.system.rdd.calendrier.getCurrentDayIndex()); let toDelete = this.listItemsData('nombreastral').filter(it => it.data.jourindex < game.system.rdd.calendrier.getCurrentDayIndex());
const deletions = toDelete.map(it => it._id); const deletions = toDelete.map(it => it._id);
await this.deleteEmbeddedDocuments("Item", deletions); await this.deleteEmbeddedDocuments("Item", deletions);
@ -2451,12 +2455,12 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
getSortList() { getSortList() {
return this.data.items.filter(it => it.data.type == "sort"); return this.listItemsData("sort");
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
countMonteeLaborieuse() { // Return +1 par queue/ombre/souffle Montée Laborieuse présente countMonteeLaborieuse() { // Return +1 par queue/ombre/souffle Montée Laborieuse présente
let countMonteeLaborieuse = this.data.items.filter(it => EffetsDraconiques.isMonteeLaborieuse(it)).length; let countMonteeLaborieuse = this.filterItemsData(it => EffetsDraconiques.isMonteeLaborieuse(it)).length;
if (countMonteeLaborieuse > 0) { if (countMonteeLaborieuse > 0) {
ChatMessage.create({ ChatMessage.create({
content: `Vous êtes sous le coup d'une Montée Laborieuse : vos montées en TMR coûtent ${countMonteeLaborieuse} Point de Rêve de plus.`, content: `Vous êtes sous le coup d'une Montée Laborieuse : vos montées en TMR coûtent ${countMonteeLaborieuse} Point de Rêve de plus.`,
@ -2510,7 +2514,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
rollArme(compName, armeName = undefined) { rollArme(compName, armeName = undefined) {
let arme = armeName ? this.data.items.find(it => it.name == armeName && RdDItemArme.isArme(it)) : undefined; let arme = armeName ? this.data.items.find(it => Misc.data(it).name == armeName && RdDItemArme.isArme(it)) : undefined;
let competence = this.getCompetence(compName); let competence = this.getCompetence(compName);
if (arme || armeName || (competence.type == 'competencecreature' && competence.data.iscombat)) { if (arme || armeName || (competence.type == 'competencecreature' && competence.data.iscombat)) {
@ -2532,7 +2536,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
getArmeParade(armeParadeId) { getArmeParade(armeParadeId) {
const item = armeParadeId ? this.getEmbeddedDocuments('Item', armeParadeId) : undefined; const item = armeParadeId ? this.getEmbeddedDocument('Item', armeParadeId) : undefined;
return RdDItemArme.getArmeData(item); return RdDItemArme.getArmeData(item);
} }
@ -2549,9 +2553,9 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async equiperObjet(itemID) { async equiperObjet(itemID) {
let item = this.getEmbeddedDocuments('Item', itemID); let item = this.getEmbeddedDocument('Item', itemID);
if (item?.data?.data) { let itemData = Misc.data(item);
let itemData = Misc.itemData(item); if (itemData?.data) {
const isEquipe = !itemData.data.equipe; const isEquipe = !itemData.data.equipe;
let update = { _id: item._id, "data.equipe": isEquipe }; let update = { _id: item._id, "data.equipe": isEquipe };
await this.updateEmbeddedDocuments('Item', [update]); await this.updateEmbeddedDocuments('Item', [update]);
@ -2567,7 +2571,8 @@ export class RdDActor extends Actor {
let dmg = (attackerRoll.dmg.dmgArme ?? 0) + (attackerRoll.dmg.dmgActor ?? 0); let dmg = (attackerRoll.dmg.dmgArme ?? 0) + (attackerRoll.dmg.dmgActor ?? 0);
let armeData = attackerRoll.arme; let armeData = attackerRoll.arme;
let protection = 0; let protection = 0;
const armures = this.data.items.filter(it => it.type == "armure" && it.data.equipe); const armures = this.items.map(it => Misc.data(it))
.filter(it => it.type == "armure" && it.data.equipe);
for (const itemData of armures) { for (const itemData of armures) {
protection += new Roll(itemData.data.protection.toString()).roll().total; protection += new Roll(itemData.data.protection.toString()).roll().total;
if (dmg > 0) { if (dmg > 0) {
@ -2575,7 +2580,7 @@ export class RdDActor extends Actor {
dmg = 0; dmg = 0;
} }
} }
const penetration = armeData ? Misc.toInt(armeData.data.penetration) : 0; const penetration = Misc.toInt(armeData?.data.penetration ?? 0);
protection = Math.max(protection - penetration, 0); protection = Math.max(protection - penetration, 0);
protection += this.getProtectionNaturelle(); protection += this.getProtectionNaturelle();
// Gestion des cas particuliers sur la fenêtre d'encaissement // Gestion des cas particuliers sur la fenêtre d'encaissement
@ -2865,7 +2870,7 @@ export class RdDActor extends Actor {
} }
let updates = [] let updates = []
for (const [valeur, nombre] of Object.entries(fortune)) { for (const [valeur, nombre] of Object.entries(fortune)) {
updates.push( { _id: parValeur[valeur]._id, 'data.quantite': nombre }); updates.push({ _id: parValeur[valeur]._id, 'data.quantite': nombre });
} }
await this.updateEmbeddedDocuments('Item', updates); await this.updateEmbeddedDocuments('Item', updates);
} }
@ -2922,10 +2927,10 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async effectuerTacheAlchimie(recetteId, alchimieName, alchimieData) { async effectuerTacheAlchimie(recetteId, alchimieName, alchimieData) {
let recette = this.data.items.find(item => item.type == 'recettealchimique' && item.id == recetteId); let recette = this.getItemOfType(recetteId, 'recettealchimique');
const actorData = Misc.data(this); const actorData = Misc.data(this);
if (recette) { if (recette) {
let competence = this.data.items.find(item => item.type == 'competence' && item.name.toLowerCase() == "alchimie"); let competence = this.getCompetence("alchimie");
let diffAlchimie = RdDAlchimie.getDifficulte(alchimieData); let diffAlchimie = RdDAlchimie.getDifficulte(alchimieData);
let rollData = { let rollData = {
recette: recette, recette: recette,
@ -3149,7 +3154,7 @@ export class RdDActor extends Actor {
} }
} }
async onPreUpdateItem(item, change, options, id) { async onPreUpdateItem(item, change, options, id) {
const itemData = Misc.data(item); const itemData = Misc.data(item);
if (itemData.type == 'competence' && itemData.data.defaut_carac && itemData.data.xp) { if (itemData.type == 'competence' && itemData.data.defaut_carac && itemData.data.xp) {
await this.checkCompetenceXP(itemData.name, itemData.data.xp); await this.checkCompetenceXP(itemData.name, itemData.data.xp);

View File

@ -5,8 +5,8 @@ export class RdDItemCompetenceCreature extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static setRollDataCreature(rollData) { static setRollDataCreature(rollData) {
rollData.competence = Misc.data(rollData.competence);
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } }; rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } };
rollData.competence = duplicate(rollData.competence);
rollData.competence.data.defaut_carac = "carac_creature"; rollData.competence.data.defaut_carac = "carac_creature";
rollData.competence.data.categorie = "creature"; rollData.competence.data.categorie = "creature";
rollData.selectedCarac = rollData.carac.carac_creature; rollData.selectedCarac = rollData.carac.carac_creature;

View File

@ -30,7 +30,7 @@ export class Monnaie {
} }
static filtrerMonnaies(items) { static filtrerMonnaies(items) {
return items.filter(it => it.type == 'monnaie'); return items.filter(it => Misc.data(it).type == 'monnaie');
} }
static monnaiesManquantes(items) { static monnaiesManquantes(items) {

View File

@ -73,7 +73,7 @@ export class RdDItemSheet extends ItemSheet {
console.log(formData.competences); console.log(formData.competences);
} }
if ( formData.type == 'recettealchimique' ) { if ( formData.type == 'recettealchimique' ) {
RdDAlchimie.processManipulation(formData.item, this.actor && this.actor.id ); RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id );
} }
if ( this.actor ) { if ( this.actor ) {
formData.isOwned = true; formData.isOwned = true;

View File

@ -97,19 +97,8 @@ export class Misc {
return [...new Set(array)]; return [...new Set(array)];
} }
static actorData(actor) {
return Misc.data(actor);
}
static itemData(item) {
return Misc.data(item);
}
static data(it) { static data(it) {
if (it instanceof Item) { if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
return it.data;
}
if (it instanceof Actor) {
return it.data; return it.data;
} }
return it; return it;

View File

@ -1,68 +1,56 @@
/* -------------------------------------------- */ /* -------------------------------------------- */
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
const matchOperations = new RegExp(/@(\w*){([\w\-]+)}/ig);
const matchOperationTerms = new RegExp(/@(\w*){([\w\-]+)}/i);
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDAlchimie { export class RdDAlchimie {
/* -------------------------------------------- */ /* -------------------------------------------- */
static processManipulation( recette, actorId = undefined ) { static processManipulation(recetteData, actorId = undefined) {
//console.log("CALLED", recette, recette.isOwned, actorId ); //console.log("CALLED", recette, recette.isOwned, actorId );
let manip = duplicate(recette.data.manipulation); let manip = recetteData.data.manipulation;
let reg1 = new RegExp(/@(\w*){([\w\-]+)}/ig); let matchArray = manip.match(matchOperations);
let matchArray = manip.match( reg1 ); if (matchArray) {
if ( matchArray ) { for (let matchStr of matchArray) {
for( let matchStr of matchArray) { let result = matchStr.match(matchOperationTerms);
let reg2 = new RegExp(/@(\w*){([\w\-]+)}/i);
let result = matchStr.match(reg2);
//console.log("RESULT ", result); //console.log("RESULT ", result);
if ( result[1] && result[2]) { if (result[1] && result[2]) {
let commande = Misc.upperFirst( result[1] ); let commande = Misc.upperFirst(result[1]);
let replacement = this[`_alchimie${commande}`](recette, result[2], actorId); let replacement = this[`_alchimie${commande}`](recetteData, result[2], actorId);
manip = manip.replace( result[0], replacement); manip = manip.replace(result[0], replacement);
} }
} }
} }
recette.data.manipulation_update = manip; recetteData.data.manipulation_update = manip;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static _alchimieCouleur( recette, couleurs, actorId ) { static _alchimieCouleur(recette, couleurs, actorId) {
let replacement if (actorId) {
if ( actorId ) { return `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="couleur" data-alchimie-data="${couleurs}">couleur ${couleurs}</a></span>`;
replacement = `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="couleur" data-alchimie-data="${couleurs}">couleur ${couleurs}</a></span>`;
} else { } else {
replacement = `<span class="alchimie-tache">couleur ${couleurs} </span>`; return `<span class="alchimie-tache">couleur ${couleurs} </span>`;
} }
return replacement;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static _alchimieConsistance( recette, consistances, actorId ) { static _alchimieConsistance(recette, consistances, actorId) {
let replacement if (actorId) {
if ( actorId ) { return `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="consistance" data-alchimie-data="${consistances}">consistance ${consistances}</a></span>`;
replacement = `<span class="alchimie-tache"><a data-recette-id="${recette._id}" data-actor-id="${actorId}" data-alchimie-tache="consistance" data-alchimie-data="${consistances}">consistance ${consistances}</a></span>`;
} else { } else {
replacement = `<span class="alchimie-tache">consistance ${consistances} </span>`; return `<span class="alchimie-tache">consistance ${consistances} </span>`;
} }
return replacement;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getDifficulte( aspects ) { static getDifficulte(aspects) {
let aspectsArray = aspects.split('-'); let elements = aspects.split('-');
let diff = 0; let composantes = elements.length;
let nbDifferent = 0; let distincts = Object.keys(Misc.classifyFirst(elements, it => it)).length;
let aspectsHash = {} if (distincts == 1) {
for (let colconst of aspectsArray) { composantes--;
if ( aspectsHash[colconst] ){ // Deja present, augmente difficulté de 1
diff -= 1;
} else {
nbDifferent++;
aspectsHash[colconst] = colconst; // Keep track
}
} }
diff = diff - ((nbDifferent>1) ? nbDifferent : 0); // Ca doit marcher .... return Math.min(0, -composantes);
return Math.min(0, diff); // Pour être sur
} }
} }

View File

@ -8,34 +8,35 @@ import { Misc } from "./misc.js";
*/ */
export class RdDAstrologieJoueur extends Dialog { export class RdDAstrologieJoueur extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async create(actor, dialogConfig) { static async create(actor, dialogConfig) {
let data = { nombres: this.organizeNombres( actor), let data = {
dates: game.system.rdd.calendrier.getJoursSuivants( 10 ), nombres: this.organizeNombres(actor),
etat: actor.getEtatGeneral(), dates: game.system.rdd.calendrier.getJoursSuivants(10),
ajustementsConditions: CONFIG.RDD.ajustementsConditions, etat: actor.getEtatGeneral(),
astrologie: RdDItemCompetence.findCompetence( actor.data.items, 'Astrologie') ajustementsConditions: CONFIG.RDD.ajustementsConditions,
} astrologie: RdDItemCompetence.findCompetence(actor.data.items, 'Astrologie')
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', data);
let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 };
if (dialogConfig.options) {
mergeObject(options, dialogConfig.options, { overwrite: true });
}
return new RdDAstrologieJoueur(html, actor, data);
} }
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', data);
let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 };
if (dialogConfig.options) {
mergeObject(options, dialogConfig.options, { overwrite: true });
}
return new RdDAstrologieJoueur(html, actor, data);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
constructor(html, actor, data ) { constructor(html, actor, data) {
let myButtons = { let myButtons = {
saveButton: { label: "Fermer", callback: html => this.quitDialog() } saveButton: { label: "Fermer", callback: html => this.quitDialog() }
}; };
// Get all n // Get all n
// Common conf // Common conf
let dialogConf = { content: html, title: "Nombres Astraux", buttons: myButtons, default: "saveButton" }; let dialogConf = { content: html, title: "Nombres Astraux", buttons: myButtons, default: "saveButton" };
let dialogOptions = { classes: ["rdddialog"], width: 600, height: 300, 'z-index': 99999 } ; let dialogOptions = { classes: ["rdddialog"], width: 600, height: 300, 'z-index': 99999 };
super(dialogConf, dialogOptions); super(dialogConf, dialogOptions);
this.actor = actor; this.actor = actor;
@ -44,14 +45,14 @@ export class RdDAstrologieJoueur extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static organizeNombres(actor) { static organizeNombres(actor) {
let itemNombres = actor.data.items.filter( (item) => item.type == 'nombreastral'); let itemNombres = actor.listItemsData('nombreastral');
let itemFiltered = {}; let itemFiltered = {};
for ( let item of itemNombres) { for (let item of itemNombres) {
if ( itemFiltered[item.data.jourindex] ) { if (itemFiltered[item.data.jourindex]) {
itemFiltered[item.data.jourindex].listValues.push(item.data.value); itemFiltered[item.data.jourindex].listValues.push(item.data.value);
} else { } else {
itemFiltered[item.data.jourindex] = { itemFiltered[item.data.jourindex] = {
listValues: [ item.data.value ], listValues: [item.data.value],
jourlabel: item.data.jourlabel jourlabel: item.data.jourlabel
} }
} }
@ -60,21 +61,22 @@ export class RdDAstrologieJoueur extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
requestJetAstrologie( ) { requestJetAstrologie() {
let data = { id: this.actor.data._id, let data = {
carac_vue: Misc.data(this.actor).data.carac['vue'].value, id: this.actor.data._id,
etat: this.dataNombreAstral.etat, carac_vue: Misc.data(this.actor).data.carac['vue'].value,
astrologie: this.dataNombreAstral.astrologie, etat: this.dataNombreAstral.etat,
conditions: $("#diffConditions").val(), astrologie: this.dataNombreAstral.astrologie,
date: $("#joursAstrologie").val() conditions: $("#diffConditions").val(),
} date: $("#joursAstrologie").val()
if ( game.user.isGM) { }
game.system.rdd.calendrier.requestNombreAstral( data ); if (game.user.isGM) {
game.system.rdd.calendrier.requestNombreAstral(data);
} else { } else {
game.socket.emit("system.foundryvtt-reve-de-dragon", { game.socket.emit("system.foundryvtt-reve-de-dragon", {
msg: "msg_request_nombre_astral", msg: "msg_request_nombre_astral",
data: data data: data
} ); });
} }
this.close(); this.close();
} }

View File

@ -199,7 +199,7 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */ /* -------------------------------------------- */
syncPlayerTime(calendrier) { syncPlayerTime(calendrier) {
this.calendrier = duplicate(calendrier); // Local copy update this.calendrier = duplicate(calendrier); // Local copy update
this.updateDisplay(); // Then update this.updateDisplay();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -247,21 +247,19 @@ export class RdDCalendrier extends Application {
console.log(request); console.log(request);
let jourDiff = this.getLectureAstrologieDifficulte(request.date); let jourDiff = this.getLectureAstrologieDifficulte(request.date);
let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat); let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat);
let rolled = await RdDResolutionTable.rollData({ let rollData= {
caracValue: request.carac_vue, caracValue: request.carac_vue,
finalLevel: niveau, finalLevel: niveau,
showDice: false showDice: false
}); };
await RdDResolutionTable.rollData(rollData);
let nbAstral = this.getNombreAstral(request.date); let nbAstral = this.getNombreAstral(request.date);
let nbAstralFaux = nbAstral; request.rolled = rollData.rolled;
request.isValid = true; request.isValid = true;
request.rolled = rolled; if (!request.rolled.isSuccess) {
if (!rolled.isSuccess) {
request.isValid = false; request.isValid = false;
while (nbAstralFaux == nbAstral) { let nbAstralFaux = new Roll("1d11").evaluate( { async: false} ).total;
nbAstralFaux = new Roll("1d12").evaluate( { async: false} ).total; nbAstral = nbAstral==nbAstralFaux ? 12 : nbAstralFaux;
}
nbAstral = nbAstralFaux;
// Mise à jour des nombres astraux du joueur // Mise à jour des nombres astraux du joueur
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date); let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstralFaux }); astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstralFaux });
@ -338,7 +336,7 @@ export class RdDCalendrier extends Application {
if (game.user.isGM) { if (game.user.isGM) {
dateHTML = dateHTML + " - NA: " + this.getCurrentNombreAstral(); dateHTML = dateHTML + " - NA: " + this.getCurrentNombreAstral();
} }
for (let handle of document.getElementsByClassName("calendar-move-handle")) { for (let handle of document.getElementsByClassName("calendar-date-rdd")) {
handle.innerHTML = dateHTML; handle.innerHTML = dateHTML;
} }
for (let heure of document.getElementsByClassName("calendar-heure-texte")) { for (let heure of document.getElementsByClassName("calendar-heure-texte")) {

View File

@ -143,18 +143,20 @@ export class RdDCombatManager extends Combat {
// Gestion des armes 1/2 mains // Gestion des armes 1/2 mains
let armesEquipe = []; let armesEquipe = [];
for (const arme of armes) { for (const arme of armes) {
if (arme.data.equipe) { let armeData = Misc.data(arme);
armesEquipe.push(arme); if (armeData.data.equipe) {
let comp = competences.find(c => c.name == arme.data.competence); let compData = competences.map(c => Misc.data(c)).find(c => c.name == armeData.data.competence);
arme.data.initiative = RdDCombatManager.calculInitiative(arme.data.niveau, carac[comp.data.defaut_carac].value);
armesEquipe.push(armeData);
armeData.data.initiative = RdDCombatManager.calculInitiative(armeData.data.niveau, carac[compData.data.defaut_carac].value);
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence // Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
if (arme.data.unemain && !arme.data.deuxmains) { if (armeData.data.unemain && !armeData.data.deuxmains) {
arme.data.mainInfo = "(1m)"; armeData.data.mainInfo = "(1m)";
} else if (!arme.data.unemain && arme.data.deuxmains) { } else if (!armeData.data.unemain && armeData.data.deuxmains) {
arme.data.mainInfo = "(2m)"; armeData.data.mainInfo = "(2m)";
} else if (arme.data.unemain && arme.data.deuxmains) { } else if (armeData.data.unemain && armeData.data.deuxmains) {
arme.data.mainInfo = "(1m)"; armeData.data.mainInfo = "(1m)";
let arme2main = duplicate(arme); let arme2main = duplicate(armeData);
arme2main.data.mainInfo = "(2m)"; arme2main.data.mainInfo = "(2m)";
arme2main.data.dommages = arme2main.data.dommages.split("/")[1]; // Existence temporaire uniquement dans la liste des armes, donc OK arme2main.data.dommages = arme2main.data.dommages.split("/")[1]; // Existence temporaire uniquement dans la liste des armes, donc OK
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace ! arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
@ -174,6 +176,7 @@ export class RdDCombatManager extends Combat {
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`) ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
return []; return [];
} }
const actorData = Misc.data(combatant.actor);
let items = combatant.actor.data.items; let items = combatant.actor.data.items;
let actions = [] let actions = []
if (combatant.actor.isCreature()) { if (combatant.actor.isCreature()) {
@ -182,13 +185,14 @@ export class RdDCombatManager extends Combat {
} else { } else {
// Recupération des items 'arme' // Recupération des items 'arme'
let armes = items.filter(it => RdDItemArme.isArmeUtilisable(it)) let armes = items.filter(it => RdDItemArme.isArmeUtilisable(it))
.map(arme => duplicate(arme)) /* pas de changements aux armes d'origine */
.concat(RdDItemArme.mainsNues()); .concat(RdDItemArme.mainsNues());
let competences = items.filter(it => it.type == 'competence'); let competences = items.filter(it => it.type == 'competence');
actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, Misc.data(combatant.actor).data.carac)); actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac));
actions.push({ name: "Draconic", data: { initOnly: true, competence: "Draconic" } }); if (actorData.data.attributs.hautrevant.value){
actions.push({ name: "Draconic", data: { initOnly: true, competence: "Draconic" } });
}
} }
actions.push({ name: "Autre action", data: { initOnly: true, competence: "Autre action" } }); actions.push({ name: "Autre action", data: { initOnly: true, competence: "Autre action" } });

View File

@ -7,17 +7,23 @@ export class RdDEncaisser extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
constructor(html, actor) { constructor(html, actor) {
// Common conf // Common conf
const buttonsCreatures = {
"mortel": { label: "mortel", callback: html => this.performEncaisser("mortel") },
"non-mortel": { label: "non-mortel", callback: html => this.performEncaisser("non-mortel") },
};
const buttonsEntitesCauchemar = {
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser("cauchemar") }
};
const buttons = actor.isEntiteCauchemar() ? buttonsEntitesCauchemar : buttonsCreatures;
let dialogConf = { let dialogConf = {
title: "Jet d'Encaissement", title: "Jet d'Encaissement",
content: html, content: html,
buttons: { buttons: buttons,
"mortel": { label: "mortel", callback: html => this.performEncaisser(html, "mortel") },
"non-mortel": { label: "non-mortel", callback: html => this.performEncaisser(html, "non-mortel") },
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser(html, "cauchemar") }
},
default: "coupMortel" default: "coupMortel"
} }
let dialogOptions = { let dialogOptions = {
classes: ["rdddialog"], classes: ["rdddialog"],
width: 320, width: 320,
@ -32,13 +38,15 @@ export class RdDEncaisser extends Dialog {
this.encaisserSpecial = "aucun"; this.encaisserSpecial = "aucun";
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
performEncaisser(html, mortalite = "mortel") { performEncaisser(mortalite) {
this.actor.encaisserDommages({ this.actor.encaisserDommages({
dmg:{ dmg: {
total: Number(this.modifier), total: Number(this.modifier),
encaisserSpecial: this.encaisserSpecial, encaisserSpecial: this.encaisserSpecial,
loc: { result: 0, label: "Corps" }, loc: { result: 0, label: "" },
mortalite: mortalite mortalite: mortalite
} }
}); });

View File

@ -1,5 +1,6 @@
/* -------------------------------------------- */ /* -------------------------------------------- */
import { HtmlUtility } from "./html-utility.js"; import { HtmlUtility } from "./html-utility.js";
import { Misc } from "./misc.js";
import { RdDCombatManager } from "./rdd-combat.js"; import { RdDCombatManager } from "./rdd-combat.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
@ -24,7 +25,7 @@ export class RdDTokenHud {
let token = canvas.tokens.get(tokenId); let token = canvas.tokens.get(tokenId);
let actor = token.actor; let actor = token.actor;
let combatant = game.combat.data.combatants.find(c => c.tokenId == token.data._id); let combatant = game.combat.combatants.find(c => Misc.data(c).tokenId == tokenId);
app.hasExtension = true; app.hasExtension = true;
let armesList = RdDCombatManager.buildListeActionsCombat(combatant) ; let armesList = RdDCombatManager.buildListeActionsCombat(combatant) ;

File diff suppressed because one or more lines are too long

View File

@ -1093,12 +1093,7 @@ ul, li {
.calendar-date-rdd { .calendar-date-rdd {
font-family: "GoudyAcc"; font-family: "GoudyAcc";
color: #CCC; color: #CCC;
font-weight: bold;
font-size: 1.10rem;
opacity: 90; opacity: 90;
}
#calendar-move-handle {
font-family: "GoudyAcc";
font-size: 13px; font-size: 13px;
line-height: 1; line-height: 1;
text-align: center; text-align: center;

View File

@ -6,7 +6,7 @@
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9",
"templateVersion": 96, "templateVersion": 97,
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
"authors": [ "authors": [
{ {

View File

@ -430,6 +430,12 @@
"value": 0, "value": 0,
"label": "Protection naturelle", "label": "Protection naturelle",
"derivee": false "derivee": false
},
"hautrevant": {
"type": "string",
"value": "",
"label": "Haut rêvant",
"derivee": true
} }
}, },
"reve": { "reve": {

View File

@ -197,7 +197,7 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> - <span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span> <span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}} {{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span> <span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}} {{/if}}

View File

@ -1,3 +1,5 @@
{{log 'calc' calc}}
<form class="{{cssClass}}" autocomplete="off"> <form class="{{cssClass}}" autocomplete="off">
{{!-- Sheet Header --}} {{!-- Sheet Header --}}
@ -59,9 +61,11 @@
<span class="gm-only remise-a-neuf"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span> <span class="gm-only remise-a-neuf"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span>
<span id="dormir-une-heure"><a title="Dormir une heure"><img class="button-img" src="icons/svg/sleep.svg" alt="Dormir une heure"/></a></span> <span id="dormir-une-heure"><a title="Dormir une heure"><img class="button-img" src="icons/svg/sleep.svg" alt="Dormir une heure"/></a></span>
<span id="dormir-chateau-dormant"><a title="Chateau Dormant"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg" alt="Chateau Dormant"/></a></span> <span id="dormir-chateau-dormant"><a title="Chateau Dormant"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg" alt="Chateau Dormant"/></a></span>
{{#if data.attributs.hautrevant.value}}
<span id="monte-tmr"><a title="Montée dans les Terres M&eacute;dianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres M&eacute;dianes !"/></a></span> <span id="monte-tmr"><a title="Montée dans les Terres M&eacute;dianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres M&eacute;dianes !"/></a></span>
<span id="monte-tmr-rapide"><a title="Montée accélérée dans les Terres M&eacute;dianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres M&eacute;dianes !"/></a></span> <span id="monte-tmr-rapide"><a title="Montée accélérée dans les Terres M&eacute;dianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres M&eacute;dianes !"/></a></span>
<span id="visu-tmr"><a title="Regarder les Terres M&eacute;dianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres M&eacute;dianes"/></a></span> <span id="visu-tmr"><a title="Regarder les Terres M&eacute;dianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres M&eacute;dianes"/></a></span>
{{/if}}
</div> </div>
<div class="flexrow"> <div class="flexrow">
<span class="tooltip">Malus de fatigue : {{calc.fatigue.malus}} <span class="tooltip">Malus de fatigue : {{calc.fatigue.malus}}
@ -160,15 +164,17 @@
</span> </span>
</li> </li>
{{#each data.attributs as |attr key|}} {{#each data.attributs as |attr key|}}
{{#unless (eq key 'hautrevant')}}
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="competence flexrow list-item" data-attribute="{{key}}">
<span class="competence-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} : <span class="competence-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} :
{{#if (eq key 'protection')}} {{#if (eq key 'protection')}}
<input id="attribut-protection-edit" type="text" name="{{key}}" value="{{attr.value}}" data-dtype="number"/><span/> <input id="attribut-protection-edit" type="text" name="{{key}}" value="{{attr.value}}" data-dtype="number"/><span/>
{{else}} {{else}}
{{attr.value}} {{attr.value}}
{{/if}} {{/if}}
</span> </span>
</li> </li>
{{/unless}}
{{/each}} {{/each}}
</ul> </ul>
<ul class="carac-list alterne-list"> <ul class="carac-list alterne-list">
@ -295,14 +301,17 @@
{{/each}} {{/each}}
</ul> </ul>
{{#if data.attributs.hautrevant.value}}
<header class="competence-header flexrow"> <header class="competence-header flexrow">
<span class="competence-title">Draconic</span> <span class="competence-title">Draconic</span>
</header> </header>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each competenceByCategory.draconic as |comp key|}} {{#each competenceByCategory.draconic as |comp key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}}
{{/each}} {{/each}}
</ul> </ul>
{{/if}}
<div> <div>
<ul class="item-list"> <ul class="item-list">
<li class="item flexrow"> <li class="item flexrow">
@ -461,7 +470,19 @@
{{!-- Connaissances Tab --}} {{!-- Connaissances Tab --}}
<div class="tab connaissances" data-group="primary" data-tab="connaissances"> <div class="tab connaissances" data-group="primary" data-tab="connaissances">
<h3>Oeuvres diverses :</h3> <h3>Tâches</h3><a class='creer-tache'>Créer une nouvelle Tâche</a>
<ul class="item-list alterne-list">
{{#each taches as |tache id|}}
<li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}} ({{tache.data.points_de_tache_courant}}/{{tache.data.points_de_tache}})</a></span>
<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>
</div>
</li>
{{/each}}
</ul>
<hr>
<h3>Oeuvres diverses :</h3><a class="creer-une-oeuvre">Créer une oeuvre</a>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each chants as |chant id|}} {{#each chants as |chant id|}}
<li class="item flexrow list-item" data-item-id="{{chant._id}}"><span>Chant</span><span class="competence-title chant-label"><a>{{chant.name}} (niveau {{chant.data.niveau}})</a></span> <li class="item flexrow list-item" data-item-id="{{chant._id}}"><span>Chant</span><span class="competence-title chant-label"><a>{{chant.name}} (niveau {{chant.data.niveau}})</a></span>
@ -516,7 +537,7 @@
{{/each}} {{/each}}
</ul> </ul>
<h3>Recettes Alchimiques</h3> <h3>Recettes Alchimiques</h3>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each recettesAlchimiques as |recette id|}} {{#each recettesAlchimiques as |recette id|}}
<li class="item flexrow list-item" data-item-id="{{recette._id}}"><span class="competence-title recette-label item-edit"><a>{{recette.name}}</a></span> <li class="item flexrow list-item" data-item-id="{{recette._id}}"><span class="competence-title recette-label item-edit"><a>{{recette.name}}</a></span>
<div class="item-controls"> <div class="item-controls">
@ -525,26 +546,20 @@
</div> </div>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
<h3>Tâches</h3><a id='creer-tache'>Créer une nouvelle Tâche</a> <hr>
<ul class="item-list alterne-list"> <h3>Astrologie</h3>
{{#each taches as |tache id|}} <span class="astrologie-label"><a id="jet-astrologie">Astrologie : Nombres Astraux</a></span>
<li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}} ({{tache.data.points_de_tache_courant}}/{{tache.data.points_de_tache}})</a></span>
<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>
</div>
</li>
{{/each}}
</ul>
<hr>
</div> </div>
{{!-- hautreve Tab --}} {{!-- hautreve Tab --}}
<div class="tab hautreve " data-group="primary" data-tab="hautreve" style="height:200px"> <div class="tab hautreve " data-group="primary" data-tab="hautreve" style="height:200px">
<div> <div>
<h3>Haut rêve:</h3> {{#if data.attributs.hautrevant.value}}
<h3>Haut rêvant</h3>
{{/if}}
<ul class="item-list"> <ul class="item-list">
{{#if data.attributs.hautrevant.value}}
<li class="item flexrow"> <li class="item flexrow">
<span class="competence-label">Position en TMR :</span> <span class="competence-label">Position en TMR :</span>
<span> <span>
@ -555,6 +570,7 @@
{{/if}} {{/if}}
</span> </span>
</li> </li>
{{/if}}
<li class="item flexrow"> <li class="item flexrow">
<span class="competence-label">Seuil de Rêve :</span> <span class="competence-label">Seuil de Rêve :</span>
<span> <span>
@ -575,12 +591,10 @@
{{/if}} {{/if}}
</span> </span>
</li> </li>
<li class="item flexrow" >
<span class="astrologie-label"><a id="jet-astrologie">Astrologie : Nombres Astraux</a></span>
</li>
</ul> </ul>
</div> </div>
<hr> <hr>
{{#if data.attributs.hautrevant.value}}
<div> <div>
<h3>Sorts:</h3> <h3>Sorts:</h3>
<ul class="item-list"> <ul class="item-list">
@ -649,9 +663,10 @@
{{/each}} {{/each}}
</ul> </ul>
</div> </div>
<hr>
{{/if}}
{{!-- Queues, Souffles, Tetes, Ombre --}} {{!-- Queues, Souffles, Tetes, Ombre --}}
<hr>
<h3>Queues:</h3> <h3>Queues:</h3>
<ul class="flex-group-left"> <ul class="flex-group-left">
{{#each queues as |queue key|}} {{#each queues as |queue key|}}
@ -723,7 +738,7 @@
<span class="item-name">Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols</span> <span class="item-name">Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols</span>
</div> </div>
<div> <div>
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span> <span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}} {{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span> <span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}} {{/if}}

View File

@ -69,7 +69,7 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} <b>{{calc.surEncombrementMessage}}</b></span> - <span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name"><a id="creer-un-objet">Créer un objet</a></span> <span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}} {{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span> <span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}} {{/if}}

View File

@ -17,6 +17,6 @@
{{/if}} {{/if}}
<a class='chat-card-button' id='echec-total-attaque' data-attackerId='{{attackerId}}' <a class='chat-card-button' id='echec-total-attaque' data-attackerId='{{attackerId}}'
data-defenderTokenId='{{defenderTokenId}}'> data-defenderTokenId='{{defenderTokenId}}'>
Tirer l'échec total ! Tirer la maladresse !
</a> </a>
</div> </div>

View File

@ -1,6 +1,6 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.data.competence}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.data.competence}}" />
<h4> <h4>
{{alias}} tente de chanter la chanson : {{oeuvre.name}} (niveau {{oeuvre.data.niveau}}) {{alias}} tente de chanter : {{oeuvre.name}} (niveau {{oeuvre.data.niveau}})
</h4> </h4>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
<hr> <hr>

View File

@ -17,9 +17,9 @@
</h4> </h4>
<div> <div>
Je d'encaissement de {{roll.total}} Je d'encaissement de {{roll.total}}
{{#unless (eq armure 0)}}, l'armure a protègé de {{armure}} {{#unless (eq penetration 0)}}(pénétration de {{penetration}}) {{#unless (eq armure 0)}}, l'armure a protègé de {{armure}}
{{/unless}} {{~#unless (eq penetration 0)}} (pénétration de {{penetration}}){{/unless}}
{{/unless}}, total: <span class="rdd-roll-echec">{{total}}</span> {{~/unless}}, total: <span class="rdd-roll-echec">{{total}}</span>
<br> <br>
{{alias}} {{alias}}
{{#if (eq dmg.mortalite 'cauchemar')}}subit le coup {{#if (eq dmg.mortalite 'cauchemar')}}subit le coup
@ -29,10 +29,14 @@
{{else if critiques}}subit une blessure critique {{else if critiques}}subit une blessure critique
{{else if mort}}vient de mourir {{else if mort}}vient de mourir
{{else}}s'en sort sans une égratignure {{else}}s'en sort sans une égratignure
{{/if}} {{~/if~}}
({{dmg.loc.label}}) {{~#unless (eq dmg.mortalite 'cauchemar')}}
{{#if (gt endurance 0)}} {{#if dmg.loc.label}}
{{#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance {{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}}
{{/if}}
{{/unless~}}
{{~#if (gt endurance 0)}}
{{~#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
{{#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}} {{#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
{{/if}} {{/if}}
{{#if (ne dmg.mortalite 'cauchemar')}} {{#if (ne dmg.mortalite 'cauchemar')}}

View File

@ -3,7 +3,7 @@
<div class="rdd-hud-list tokenhudext left"> <div class="rdd-hud-list tokenhudext left">
{{#each armes as |arme key|}} {{#each armes as |arme key|}}
{{#unless arme.data.initOnly}} {{#unless arme.data.initOnly}}
<div class="control-icon tokenhudicon rdd-hud-menu rdd-attaque" data-combatant-id="{{../combatant._id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}"> <div class="control-icon tokenhudicon rdd-hud-menu rdd-attaque" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
<label>C:{{arme.name}} {{arme.data.mainInfo}}</label> <label>C:{{arme.name}} {{arme.data.mainInfo}}</label>
</div> </div>
{{/unless}} {{/unless}}

View File

@ -2,12 +2,12 @@
<img class="rdd-hud-togglebutton" src="icons/svg/sword.svg" width="36" height="36" title="Initiative" /> <img class="rdd-hud-togglebutton" src="icons/svg/sword.svg" width="36" height="36" title="Initiative" />
<div class="rdd-hud-list tokenhudext right"> <div class="rdd-hud-list tokenhudext right">
{{#each armes as |arme key|}} {{#each armes as |arme key|}}
<div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{arme.command}}" data-combatant-id="{{../combatant._id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}"> <div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{arme.command}}" data-combatant-id="{{../combatant.id}}" data-arme-id="{{arme.index}}" title="{{arme.name}}">
<label>I:{{arme.name}} {{arme.data.mainInfo}}</label> <label>I:{{arme.name}} {{arme.data.mainInfo}}</label>
</div> </div>
{{/each}} {{/each}}
{{#each commandes as |commande key|}} {{#each commandes as |commande key|}}
<div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{commande.command}}" data-combatant-id="{{../combatant._id}}" data-arme-id="{{commande.index}}" title="{{commande.name}}"> <div class="control-icon tokenhudicon rdd-hud-menu" data-command="{{commande.command}}" data-combatant-id="{{../combatant.id}}" data-arme-id="{{commande.index}}" title="{{commande.name}}">
<label>I:{{commande.name}}</label> <label>I:{{commande.name}}</label>
</div> </div>
{{/each}} {{/each}}

View File

@ -24,16 +24,16 @@
<label>Exotisme</label> <label>Exotisme</label>
<input class="attribute-value" type="text" name="data.exotisme" value="{{data.exotisme}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.exotisme" value="{{data.exotisme}}" data-dtype="Number"/>
</div> </div>
<div class="form-group">
<label>Référence / Auteur</label>
<input class="attribute-value" type="text" name="data.reference" value="{{data.reference}}" data-dtype="String"/>
</div>
<div class="flexcol"> <div class="flexcol">
<span><label>Ingrédients : </label></span> <span><label>Ingrédients : </label></span>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.ingredients target="data.ingredients" button=true owner=owner editable=editable}} {{editor content=data.ingredients target="data.ingredients" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>
<div class="form-group">
<label>Référence / Auteur</label>
<input class="attribute-value" type="text" name="data.reference" value="{{data.reference}}" data-dtype="String"/>
</div>
<div class="flexcol"> <div class="flexcol">
<span><label>Description : </label></span> <span><label>Description : </label></span>
<div class="form-group editor"> <div class="form-group editor">