This commit is contained in:
sladecraven 2021-11-21 12:04:45 +01:00
commit b227c1095f
8 changed files with 164 additions and 96 deletions

View File

@ -11,7 +11,6 @@ import { RdDBonus } from "./rdd-bonus.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDCombatManager } from "./rdd-combat.js"; import { RdDCombatManager } from "./rdd-combat.js";
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
import { RdDItem } from "./item.js";
import { DialogSplitItem } from "./dialog-split-item.js"; import { DialogSplitItem } from "./dialog-split-item.js";
import { ReglesOptionelles } from "./regles-optionelles.js"; import { ReglesOptionelles } from "./regles-optionelles.js";
import { DialogRepos } from "./dialog-repos.js"; import { DialogRepos } from "./dialog-repos.js";
@ -93,7 +92,7 @@ export class RdDActorSheet extends ActorSheet {
formData.combat = duplicate(formData.armes ?? []); formData.combat = duplicate(formData.armes ?? []);
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences); RdDItemArme.computeNiveauArmes(formData.combat, formData.competences);
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac); RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac);
formData.esquive = RdDItemCompetence.getEsquive(formData.competences); formData.esquives = this.actor.getCompetences("Esquive").map(i => foundry.utils.deepClone(i.data));
formData.combat = RdDCombatManager.finalizeArmeList(formData.combat, formData.competences, formData.data.carac); formData.combat = RdDCombatManager.finalizeArmeList(formData.combat, formData.competences, formData.data.carac);
this.armesList = formData.combat; this.armesList = formData.combat;
@ -345,24 +344,16 @@ export class RdDActorSheet extends ActorSheet {
// Roll Weapon1 // Roll Weapon1
html.find('.arme-label a').click(async event => { html.find('.arme-label a').click(async event => {
let armeName = event.currentTarget.text; const li = $(event.currentTarget).parents(".item");
let compName = event.currentTarget.attributes['data-competence-name'].value; let arme = this._getArmeCombat(li);
let arme = this.actor.data.items.find(it =>
it.name == armeName &&
RdDItemArme.isArme(it) &&
((compName || it.data.data.competence) == it.data.data.competence)
);
if (!arme) {
arme = { name: armeName, data: { competence: compName } };
}
this.actor.rollArme( duplicate(arme) ); this.actor.rollArme( duplicate(arme) );
}); });
// Initiative pour l'arme // Initiative pour l'arme
html.find('.arme-initiative a').click(async event => { html.find('.arme-initiative a').click(async event => {
let combatant = game.combat.data.combatants.find(c => c.actor.data._id == this.actor.data._id); let combatant = game.combat.data.combatants.find(c => c.actor.data._id == this.actor.data._id);
if (combatant) { if (combatant) {
let armeName = event.currentTarget.attributes['data-arme-name'].value; const li = $(event.currentTarget).parents(".item");
let arme = this.armesList.find(a => a.name == armeName); let arme = this._getArmeCombat(li);
RdDCombatManager.rollInitiativeCompetence(combatant._id, arme); RdDCombatManager.rollInitiativeCompetence(combatant._id, arme);
} else { } else {
ui.notifications.info("Impossible de lancer l'initiative sans être dans un combat."); ui.notifications.info("Impossible de lancer l'initiative sans être dans un combat.");
@ -544,6 +535,16 @@ export class RdDActorSheet extends ActorSheet {
} }
_getArmeCombat(li) {
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 arme;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
setPosition(options = {}) { setPosition(options = {}) {

View File

@ -313,13 +313,19 @@ export class RdDActor extends Actor {
return Misc.templateData(this).compteurs.surenc?.value ?? 0; return Misc.templateData(this).compteurs.surenc?.value ?? 0;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getCompetence(name) { getCompetence(idOrName, options={}) {
return RdDItemCompetence.findCompetence(this.data.items, name); return RdDItemCompetence.findCompetence(this.data.items, idOrName, options);
} }
getCompetences(name) {
return RdDItemCompetence.findCompetences(this.data.items, name);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
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) { listItemsData(type) {
return this.filterItemsData(it => it.type == type); return this.filterItemsData(it => it.type == type);
} }
@ -329,16 +335,12 @@ export class RdDActor extends Actor {
filterItems(filter) { filterItems(filter) {
return this.data.items.filter(it => filter(Misc.data(it))); return this.data.items.filter(it => filter(Misc.data(it)));
} }
getItemOfType(id, type) {
if (id && type) { getItemOfType(idOrName, type) {
let itemById = this.data.items.find(it => it.id == id); return this.data.items.find(it => it.id == idOrName && it.type == type)
const itemData = Misc.data(itemById); ?? Misc.findFirstLike(idOrName, this.data.items,{filter: it => it.type == type, description: type});
if (itemData.type == type) {
return itemById;
}
}
return undefined;
} }
getMonnaie(id) { getMonnaie(id) {
return this.getItemOfType(id, 'monnaie'); return this.getItemOfType(id, 'monnaie');
} }
@ -3077,7 +3079,7 @@ export class RdDActor extends Actor {
case 'chance-actuelle': case 'chance actuelle': case 'chance-actuelle': case 'chance actuelle':
return carac.chance; return carac.chance;
} }
let entry = Misc.findFirstLike(name, Object.entries(carac), it => it[1].label, 'caractéristiques'); let entry = Misc.findFirstLike(name, Object.entries(carac), {mapper:it => it[1].label, description: 'caractéristique'});
return entry.length>0 ? carac[entry[0]] : undefined; return entry.length>0 ? carac[entry[0]] : undefined;
} }

View File

@ -171,12 +171,13 @@ export class RdDItemArme extends Item {
let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { data: { niveau: -6 } }; let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { data: { niveau: -6 } };
let init = RdDCombatManager.calculInitiative(corpsACorps.data.niveau, carac['melee'].value); let init = RdDCombatManager.calculInitiative(corpsACorps.data.niveau, carac['melee'].value);
armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: init })); armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: init }));
armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init })); //armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init }));
} }
static corpsACorps(actorData) { static corpsACorps(actorData) {
const corpsACorps = { const corpsACorps = {
name: 'Corps à corps', name: 'Corps à corps',
img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp',
data: { data: {
equipe: true, equipe: true,
rapide: true, rapide: true,

View File

@ -79,18 +79,12 @@ export class RdDItemCompetence extends Item {
return Misc.data(competence)?.data.categorie; return Misc.data(competence)?.data.categorie;
} }
static isDraconic(competence) { static isDraconic(competence) {
return Misc.data(competence).data.categorie == 'draconic'; return Misc.data(competence)?.data.categorie == 'draconic';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getVoieDraconic(competences, voie) { static getVoieDraconic(competences, voie) {
voie = Grammar.toLowerCaseNoAccent(voie); return RdDItemCompetence.findCompetence(competences.filter(it => RdDItemCompetence.isDraconic(it) ), voie);
return competences.find(it => RdDItemCompetence.isDraconic(it) && Grammar.toLowerCaseNoAccent(Misc.data(it).name).includes(voie));
}
/* -------------------------------------------- */
static getEsquive(competences) {
return { name: 'Esquive', niveau: RdDItemCompetence.findCompetence(competences, 'Esquive')?.data.niveau ?? -6 };
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -208,8 +202,22 @@ export class RdDItemCompetence extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static findCompetence(list, name) { static findCompetence(list, idOrName, options = {}) {
return Misc.findFirstLike(name, list, it => it.name, 'compétences'); options = mergeObject(options, {
filter: it => RdDItemCompetence.isCompetence(it),
description: 'compétence',
});
return list.find(it => it.id == idOrName && RdDItemCompetence.isCompetence(it))
?? Misc.findFirstLike(idOrName, list, options);
}
/* -------------------------------------------- */
static findCompetences(list, name) {
return Misc.findAllLike(name, list, { filter: it => RdDItemCompetence.isCompetence(it), description: 'compétence' });
}
static isCompetence(item) {
return item.type == 'competence' || item.type == 'competencecreature';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -134,33 +134,57 @@ export class Misc {
/* -------------------------------------------- */ /* -------------------------------------------- */
static findPlayer(name) { static findPlayer(name) {
return Misc.findFirstLike(name, game.users, it=>it.name,'joueurs'); return Misc.findFirstLike(name, game.users, { description: 'joueur' });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static findActor(name, actors = game.actors, description= 'acteurs') { static findActor(name, actors = game.actors) {
return Misc.findFirstLike(name, actors, it=>it.name, description); return Misc.findFirstLike(name, actors, { description: 'acteur' });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static findFirstLike(value, elements, mapper = it=>it.name, description = 'valeurs') { static findFirstLike(value, elements, options = {}) {
if (!value) { options = mergeObject({
return undefined; mapper: it => it.name,
} preFilter: it => true,
value = Grammar.toLowerCaseNoAccent(value); description: 'valeur',
const subset = elements.filter(it => Grammar.toLowerCaseNoAccent(mapper(it)).includes(value)); onMessage: m => ui.notifications.info(m)
}, options);
const subset = this.findAllLike(value, elements, options);
if (subset.length == 0) { if (subset.length == 0) {
ui.notifications.info(`Pas de ${description} correspondant à ${value}`); return undefined
return undefined;
} }
let single = subset.find(it => Grammar.toLowerCaseNoAccent(mapper(it)) == value); if (subset.length == 1) {
return subset[0]
}
let single = subset.find(it => Grammar.toLowerCaseNoAccent(options.mapper(it)) == Grammar.toLowerCaseNoAccent(value));
if (!single) { if (!single) {
single = subset[0]; single = subset[0];
if (subset.length > 1) { const choices = subset.map(it => options.mapper(it)).reduce((a, b) => `${a}<br>${b}`);
const choices = subset.map(it => mapper(it)).reduce((a, b) => `${a}<br>${b}`); options.info(`Plusieurs choix de ${options.description}s possibles:<br>${choices}<br>Le premier sera choisi: ${mapToValue(single)}`);
ui.notifications.info(`Plusieurs choix de ${description} possibles:<br>${choices}<br>Le premier sera choisi: ${mapper(single)}`);
}
} }
return single; return single;
} }
static findAllLike(value, elements, options = {}) {
options = mergeObject({
mapper: it => it.name,
preFilter: it => true,
description: 'valeur',
onMessage: m => ui.notifications.info(m)
}, options);
if (!value) {
options.onMessage(`Pas de ${options.description} correspondant à une valeur vide`);
return [];
}
value = Grammar.toLowerCaseNoAccent(value);
const subset = elements.filter(options.preFilter)
.filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it)).includes(value));
if (subset.length == 0) {
options.onMessage(`Pas de ${options.description} correspondant à ${value}`);
}
return subset;
}
} }

View File

@ -151,11 +151,12 @@ 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) {
let armeData = Misc.data(arme); let armeData = duplicate(Misc.data(arme));
if (armeData.data.equipe) { if (armeData.data.equipe) {
let compData = competences.map(c => Misc.data(c)).find(c => c.name == armeData.data.competence); let compData = competences.map(c => Misc.data(c)).find(c => c.name == armeData.data.competence);
armesEquipe.push(armeData); armesEquipe.push(armeData);
armeData.data.dommagesReels = Number(armeData.data.dommages);
armeData.data.niveau = compData.data.niveau; armeData.data.niveau = compData.data.niveau;
armeData.data.initiative = RdDCombatManager.calculInitiative(compData.data.niveau, carac[compData.data.defaut_carac].value); armeData.data.initiative = RdDCombatManager.calculInitiative(compData.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
@ -165,14 +166,25 @@ export class RdDCombatManager extends Combat {
armeData.data.mainInfo = "(2m)"; armeData.data.mainInfo = "(2m)";
} else if (armeData.data.unemain && armeData.data.deuxmains) { } else if (armeData.data.unemain && armeData.data.deuxmains) {
armeData.data.mainInfo = "(1m)"; armeData.data.mainInfo = "(1m)";
let arme2main = duplicate(armeData);
const comp2m = armeData.data.competence.replace(" 1 main", " 2 mains"); // Replace !
const comp = Misc.data(competences.find(c => c.name == comp2m));
const 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.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
let comp = Misc.data(competences.find(c => c.name == arme2main.data.competence));
arme2main.data.niveau = comp.data.niveau; arme2main.data.niveau = comp.data.niveau;
arme2main.data.competence = comp2m;
arme2main.data.initiative = RdDCombatManager.calculInitiative(arme2main.data.niveau, carac[comp.data.defaut_carac].value); arme2main.data.initiative = RdDCombatManager.calculInitiative(arme2main.data.niveau, carac[comp.data.defaut_carac].value);
armesEquipe.push(arme2main); armesEquipe.push(arme2main);
const containsSlash = armeData.data.dommages.includes("/");
if (containsSlash) {
const tableauDegats = armeData.data.dommages.split("/");
armeData.data.dommagesReels = Number(tableauDegats[0]);
arme2main.data.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,8 +206,8 @@ 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))
.concat(RdDItemArme.mainsNues()) //.concat(RdDItemArme.empoignade())
.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)); actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac));
@ -614,11 +626,13 @@ export class RdDCombat {
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId']?.value; const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId']?.value;
const armeParadeId = event.currentTarget.attributes['data-armeid']?.value; const armeParadeId = event.currentTarget.attributes['data-armeid']?.value;
const competence = event.currentTarget.attributes['data-competence']?.value;
const compId = event.currentTarget.attributes['data-compid']?.value;
switch (button) { switch (button) {
case '#particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value); case '#particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value);
case '#parer-button': return this.parade(attackerRoll, armeParadeId); case '#parer-button': return this.parade(attackerRoll, armeParadeId, competence);
case '#esquiver-button': return this.esquive(attackerRoll); case '#esquiver-button': return this.esquive(attackerRoll, compId, competence);
case '#encaisser-button': return this.encaisser(attackerRoll, defenderTokenId); case '#encaisser-button': return this.encaisser(attackerRoll, defenderTokenId);
case '#echec-total-attaque': return this._onEchecTotal(attackerRoll); case '#echec-total-attaque': return this._onEchecTotal(attackerRoll);
@ -876,9 +890,9 @@ export class RdDCombat {
} }
// # utilisation esquive // # utilisation esquive
const esquive = Misc.data(this.defender.getCompetence("esquive")); const corpsACorps = Misc.data(this.defender.getCompetence("Corps à corps", { onMessage: it => console.info(it, this.defender) }));
const corpsACorps = Misc.data(this.defender.getCompetence("Corps à corps")); const esquives = duplicate(this.defender.getCompetences("esquive", { onMessage: it => console.info(it, this.defender) }).map(c => Misc.data(c)));
const esquiveUsage = esquive ? this.defender.getItemUse(esquive._id) : 0; esquives.forEach(e => e.usages = e?.id ? this.defender.getItemUse(e.id) : 0);
const paramChatDefense = { const paramChatDefense = {
passeArme: attackerRoll.passeArme, passeArme: attackerRoll.passeArme,
@ -887,7 +901,7 @@ export class RdDCombat {
defender: Misc.data(this.defender), defender: Misc.data(this.defender),
attacker: Misc.data(this.attacker), attacker: Misc.data(this.attacker),
attackerId: this.attackerId, attackerId: this.attackerId,
esquiveUsage: esquiveUsage, esquives: esquives,
defenderTokenId: this.defenderTokenId, defenderTokenId: this.defenderTokenId,
mainsNues: attackerRoll.dmg.mortalite != 'mortel' && corpsACorps, mainsNues: attackerRoll.dmg.mortalite != 'mortel' && corpsACorps,
armes: this._filterArmesParade(this.defender, attackerRoll.competence, attackerRoll.arme), armes: this._filterArmesParade(this.defender, attackerRoll.competence, attackerRoll.arme),
@ -1002,12 +1016,12 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async parade(attackerRoll, armeParadeId) { async parade(attackerRoll, armeParadeId, competence) {
let arme = this.defender.getArmeParade(armeParadeId); let arme = this.defender.getArmeParade(armeParadeId);
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme); console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
let rollData = this._prepareParade(attackerRoll, arme); let rollData = this._prepareParade(attackerRoll, arme, competence);
const dialog = await RdDRoll.create(this.defender, rollData, const dialog = await RdDRoll.create(this.defender, rollData,
{ {
@ -1030,20 +1044,16 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_prepareParade(attackerRoll, armeParade) { _prepareParade(attackerRoll, armeParade, competenceParade) {
const compName = armeParade.data.competence;
const armeAttaque = attackerRoll.arme;
const parade = Misc.data(this.defender.getCompetence(compName));
let defenderRoll = { let defenderRoll = {
passeArme: attackerRoll.passeArme, passeArme: attackerRoll.passeArme,
diffLibre: attackerRoll.diffLibre, diffLibre: attackerRoll.diffLibre,
attackerRoll: attackerRoll, attackerRoll: attackerRoll,
competence: parade, competence: Misc.data(this.defender.getCompetence(competenceParade)),
arme: armeParade, arme: armeParade,
surprise: this.defender.getSurprise(true), surprise: this.defender.getSurprise(true),
needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(armeAttaque, armeParade), needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(armeAttaque, armeParade),
needResist: RdDItemArme.needArmeResist(armeAttaque, armeParade), needResist: RdDItemArme.needArmeResist(attackerRoll.arme, armeParade),
carac: Misc.templateData(this.defender).carac, carac: Misc.templateData(this.defender).carac,
show: {} show: {}
}; };
@ -1089,10 +1099,10 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async esquive(attackerRoll) { async esquive(attackerRoll, compId, compName) {
const esquive = Misc.data(this.defender.getCompetence("esquive")); const esquive = Misc.data(this.defender.getCompetence(compId) ?? this.defender.getCompetence(compName));
if (esquive == undefined) { if (esquive == undefined) {
ui.notifications.error(this.defender.name + " n'a pas de compétence 'esquive'"); ui.notifications.error(this.defender.name + " n'a pas de compétence " + compName);
return; return;
} }
console.log("RdDCombat.esquive >>>", attackerRoll, esquive); console.log("RdDCombat.esquive >>>", attackerRoll, esquive);

View File

@ -274,21 +274,38 @@
<span class="competence-title competence-value">+dom</span> <span class="competence-title competence-value">+dom</span>
</li> </li>
{{#each combat as |arme key|}} {{#each combat as |arme key|}}
<li class="item flexrow list-item" data-item-id="{{arme._id}}"> <li class="item flexrow list-item" data-item-id="{{arme._id}}"
<span class="arme-label"><a data-competence-name="{{arme.data.competence}}">{{arme.name}}</a></span> data-arme-name="{{arme.name}}" data-competence-name="{{arme.data.competence}}" >
<span class="arme-initiative"><a data-arme-name="{{arme.name}}" data-competence-name="{{arme.data.competence}}">{{arme.data.initiative}}</a></span> <span class="arme-label">
<a>
{{#if arme.img}}
<img class="sheet-competence-img" src="{{arme.img}}"/>
{{/if}}
<span>{{arme.name}}</span>
</a>
</span>
<span class="arme-initiative"><a>{{arme.data.initiative}}</a></span>
<span class="competence-label">{{arme.data.competence}}</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.niveau decimals=0 sign=true}}</span>
<span class="competence-value">{{numberFormat arme.data.dommages decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat arme.data.dommagesReels decimals=0 sign=true}}</span>
</li> </li>
{{/each}} {{/each}}
{{#each esquives as |esq key|}}
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<span class="competence-label"><a data-competence-name="{{esquive.name}}">{{esquive.name}}</a></span> <span class="competence-label">
<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="arme-initiative"></span>
<span class="competence-label"></span> <span class="competence-label"></span>
<span class="competence-value">{{numberFormat esquive.niveau decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat esq.data.niveau decimals=0 sign=true}}</span>
<span class="competence-value"></span> <span class="competence-value"></span>
</li> </li>
{{/each}}
</ul> </ul>
<hr> <hr>
{{!-- Liste de blessures --}} {{!-- Liste de blessures --}}
@ -650,7 +667,7 @@
{{/each}} {{/each}}
</ul> </ul>
<span class="item-name"><h4>Montures</h4></span> <span class="item-name"><h4>Compagnons animaux</h4></span>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each subacteurs.montures as |monture id|}} {{#each subacteurs.montures as |monture id|}}
<li class="item flexrow list-item" data-actor-id="{{monture.id}}"> <li class="item flexrow list-item" data-actor-id="{{monture.id}}">

View File

@ -36,22 +36,27 @@
{{/unless}} {{/unless}}
{{else}} {{else}}
{{#each armes as |arme key|}} {{#each armes as |arme key|}}
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme.id }}'> <a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}'
data-armeid='{{arme._id}}'>
Parer avec {{arme.name}} à {{../diffLibre }}{{#if arme.data.nbUsage}} (Utilisations : {{arme.data.nbUsage}}){{/if}} Parer avec {{arme.name}} à {{../diffLibre }}{{#if arme.data.nbUsage}} (Utilisations : {{arme.data.nbUsage}}){{/if}}
</a> </a>
<br> <br>
{{/each}} {{/each}}
{{#if mainsNues}} {{#if mainsNues}}
<a class='chat-card-button' id='parer-button' data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderTokenId}}'> <a class='chat-card-button' id='parer-button' data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderTokenId}}'
data-armeid='{{arme._id}}' data-competence='{{arme.data.competence}}'>
Parer à mains nues à {{diffLibre}}{{#if arme.data.nbUsage}} (Utilisations : {{arme.data.nbUsage}}){{/if}} Parer à mains nues à {{diffLibre}}{{#if arme.data.nbUsage}} (Utilisations : {{arme.data.nbUsage}}){{/if}}
</a> </a>
<br> <br>
{{/if}} {{/if}}
{{#if (ne attaqueCategorie 'tir')}} {{#if (ne attaqueCategorie 'tir')}}
<a class='chat-card-button' id='esquiver-button' data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderTokenId}}'> {{#each esquives as |esq key|}}
Esquiver à {{diffLibre}} {{#if esquiveUsage}} (Utilisations : {{esquiveUsage}}){{/if}} <a class='chat-card-button' id='esquiver-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}'
data-compid='{{esq._id}}' data-competence='{{esq.name}}'>
{{esq.name}} à {{../diffLibre}} {{#if esq.usage}} (Utilisations : {{esq.usage}}){{/if}}
</a> </a>
<br> <br>
{{/each}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/unless}} {{/unless}}