Merge branch 'report-fix-master-v1.3' into 'v1.3'

Report fix master v1.3

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!129
This commit is contained in:
Leratier Bretonnien 2021-01-23 08:03:44 +00:00
commit 5ad31ac02b
4 changed files with 33 additions and 29 deletions

View File

@ -90,16 +90,11 @@ export class RdDActorSheet extends ActorSheet {
data.data.combat = duplicate(RdDUtility.checkNull(data.itemsByType['arme']));
data.data.combat = RdDUtility._finalizeArmeList(data.data.combat, data.itemsByType.competence, data.data.carac);
if (data.competenceByCategory && data.competenceByCategory.melee) {
//Specific case for Esquive and Corps à Corps
for (const melee of data.competenceByCategory.melee) {
if (melee.name == "Esquive")
data.data.combat.push({ name: "Esquive", data: { niveau: melee.data.niveau, description: "", force: 6, initiative: "", competence: "Esquive", dommages: 0 } });
if (melee.name == "Corps à corps") {
let cc_init = RdDUtility.calculInitiative(melee.data.niveau, data.data.carac['melee'].value);
data.data.combat.push(RdDItemArme.mainsNues({ niveau: melee.data.niveau, initiative: cc_init }));
}
}
data.esquive = { name: "Esquive", niveau: data.competenceByCategory?.melee.find(it => it.name == 'Esquive')?.data.niveau ?? -6};
let corpsACorps = data.competenceByCategory?.melee.find(it => it.name == 'Corps à corps');
if (corpsACorps) {
let cc_init = RdDUtility.calculInitiative(corpsACorps.data.niveau, data.data.carac['melee'].value);
data.data.combat.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: cc_init }));
}
this.armesList = duplicate(data.data.combat);

View File

@ -31,8 +31,11 @@ export class RdDCommands {
rddCommands.registerCommand({ path: ["/tmra"], func: (content, msg, params) => TMRUtility.getTMRAleatoire(), descr: "Tire une case aléatoire des Terres médianes" });
rddCommands.registerCommand({
path: ["/tmrr"], func: (content, msg, params) => rddCommands.getRencontreTMR(msg, params),
descr: "Exemple: <strong>/tmrr forêt 47</strong><br>Détermine quelle est la rencontre dans une case 'forêt' pour un jet de dé de 47"
path: ["/tmrr"], func: (content, msg, params) => rddCommands.getRencontreTMR(params),
descr: `
Exemple: <strong>/tmrr foret</strong> lance un d100 et détermine la rencontre correspondante en 'forêt'
Exemple: <strong>/tmrr forêt 47</strong> détermine la rencontre en 'forêt' pour un jet de dé de 47
`
});
rddCommands.registerCommand({
@ -182,8 +185,8 @@ export class RdDCommands {
}
/* -------------------------------------------- */
getRencontreTMR(params) {
if (params.length == 2) {
async getRencontreTMR(params) {
if (params.length == 1 || params.length ==2) {
return TMRUtility.getRencontre(params[0], params[1])
}
else {
@ -215,7 +218,7 @@ export class RdDCommands {
caracValue: carac,
finalLevel: diff,
showDice: true,
diviseur: significative ? 2 : 1,
diviseurSignificative: significative ? 2 : 1,
show: { title: "Table de résolution" }
};
await RdDResolutionTable.rollData(rollData);
@ -226,7 +229,7 @@ export class RdDCommands {
async rollDeDraconique(msg) {
let ddr = new DeDraconique().evaluate();
ddr.showDice = true;
await RdDDice.show(ddr);
await RdDDice.showDiceSoNice(ddr);
RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr.total}`);
}

View File

@ -400,26 +400,25 @@ export class TMRUtility {
/* -------------------------------------------- */
/**
* Retourne une recontre en fonction de la case et du tirage
* @param {*} caseName
* @param {*} terrain
* @param {*} roll
*/
static async getRencontre( caseName, roll ) {
if ( !caseName) {
static async getRencontre( terrain, roll ) {
if ( !terrain) {
ChatMessage.create({ content: "Un nom de case doit être indiqué (ie /tmrr desert ou /tmrr cite)" });
return false;
}
if (roll == undefined) {
roll = new Roll("1d100").evaluate().total;
}
roll = roll ?? new Roll("1d100").evaluate().total;
roll = Math.max(1, Math.min(roll, 100));
let rencontre = await this.rencontreTMRTypeCase(caseName, roll);
let rencontre = await this.rencontreTMRTypeCase(terrain, roll);
if (rencontre) {
let force = await this.evaluerForceRencontre(rencontre);
ChatMessage.create({
user: game.user._id,
whisper: [game.user._id],
content: "Rencontre en " + caseName + "(jet : " + roll + "%)<br>Vous rencontrez un " + rencontre.name + " d'une force de " + force + " Points de Rêve"});
content: `Rencontre en ${terrain} (jet : ${roll}%)<br>Vous rencontrez un ${rencontre.name} de ${force} Points de Rêve`});
}
return false;
}

View File

@ -529,14 +529,21 @@
</li>
{{#each data.combat as |arme key|}}
<li class="item flexrow list-item" data-item-id="{{arme._id}}">
<span class="arme-label" name="data.armes[{{key}}].name"><a data-competence-name="{{arme.data.competence}}">{{arme.name}}</a></span>
<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 data-competence-name="{{arme.data.competence}}">{{arme.name}}</a></span>
<span class="arme-initiative"><a data-arme-name="{{arme.name}}" data-competence-name="{{arme.data.competence}}">{{arme.data.initiative}}</a></span>
<span class="competence-label">{{arme.data.competence}}</span>
<span class="competence-value" name="data.armes[{{key}}].data.niveau">{{numberFormat arme.data.niveau decimals=0 sign=true}}</span>
<span class="competence-value" name="data.armes[{{key}}].data.dommages">{{numberFormat arme.data.dommages 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>
</li>
{{/each}}
</ul>
<li class="item flexrow list-item">
<span class="competence-label"><a data-competence-name="{{esquive.name}}">{{esquive.name}}</a></span>
<span class="arme-initiative"></span>
<span class="competence-label"></span>
<span class="competence-value">{{numberFormat esquive.niveau decimals=0 sign=true}}</span>
<span class="competence-value"></span>
</li>
</ul>
</div>
{{!-- Compteurs/Blessures Tab --}}