Merge branch 'v1.5-tentatives' into 'v1.5'

Gestions des tentatives

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!293
This commit is contained in:
Leratier Bretonnien 2021-10-30 07:46:54 +00:00
commit 3108ac3a19
25 changed files with 77 additions and 109 deletions

View File

@ -2494,7 +2494,7 @@ export class RdDActor extends Actor {
}
console.log("rollCompetence !!!", rollData);
const dialog = await RdDRoll.create(this, rollData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, {
const dialog = await RdDRoll.create(this, rollData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' }, {
name: 'jet-competence',
label: 'Jet ' + Grammar.apostrophe('de', name),
callbacks: [
@ -2556,7 +2556,7 @@ export class RdDActor extends Actor {
console.log("rollTache !!!", rollData);
const dialog = await RdDRoll.create(this, rollData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, {
const dialog = await RdDRoll.create(this, rollData, { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' }, {
name: 'jet-competence',
label: 'Jet de Tâche ' + tacheData.name,
callbacks: [
@ -2574,6 +2574,7 @@ export class RdDActor extends Actor {
rollData.appliquerFatigue = ReglesOptionelles.isUsing("appliquer-fatigue");
rollData.tache = duplicate(rollData.tache);
rollData.tache.data.points_de_tache_courant += rollData.rolled.ptTache;
rollData.tache.data.tentatives++;
if (rollData.rolled.isETotal) {
rollData.tache.data.difficulte--;
}
@ -3622,10 +3623,7 @@ export class RdDActor extends Actor {
return;
}
if (!Misc.isElectedUser()) {
RdDActor.remoteActorCall({
actorId: achat.vendeurId ?? achat.acheteurId,
method: 'achatVente', args: [achat]
});
RdDActor.remoteActorCall({actorId: achat.vendeurId ?? achat.acheteurId, method: 'achatVente', args: [achat]});
return;
}
@ -3683,6 +3681,7 @@ export class RdDActor extends Actor {
const chatAchatItem = duplicate(vente);
chatAchatItem.quantiteTotal = achat.quantiteTotal;
ChatMessage.create({
user: achat.userId,
speaker: {alias: (acheteur ?? vendeur).name} ,
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', chatAchatItem)

View File

@ -747,7 +747,7 @@ export class RdDCombat {
const dialog = await RdDRoll.create(this.attacker, rollData,
{
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html',
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
options: { height: 540 }
}, {
name: 'jet-attaque',
@ -1000,7 +1000,7 @@ export class RdDCombat {
const dialog = await RdDRoll.create(this.defender, rollData,
{
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html',
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
options: { height: 540 }
}, {
name: 'jet-parade',
@ -1088,7 +1088,7 @@ export class RdDCombat {
let rollData = this._prepareEsquive(attackerRoll, esquive);
const dialog = await RdDRoll.create(this.defender, rollData,
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html' }, {
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' }, {
name: 'jet-esquive',
label: 'Esquiver',
callbacks: [

View File

@ -148,7 +148,7 @@ Hooks.once("init", async function () {
game.socket.on("system.foundryvtt-reve-de-dragon", sockmsg => {
console.log(">>>>> MSG RECV", sockmsg);
RdDUtility.onSocketMesssage(sockmsg);
RdDUtility.onSocketMessage(sockmsg);
RdDCombat.onSocketMessage(sockmsg);
ChatUtility.onSocketMessage(sockmsg);
RdDActor.onSocketMessage(sockmsg);

View File

@ -7,40 +7,14 @@ import { ReglesOptionelles } from "./regles-optionelles.js";
* difficultés au delà de -10
*/
const levelDown = [
{ level: -11, score: 1, sign: 0, part: 0, epart: 2, etotal: 90 },
{ level: -12, score: 1, sign: 0, part: 0, epart: 2, etotal: 70 },
{ level: -13, score: 1, sign: 0, part: 0, epart: 2, etotal: 50 },
{ level: -14, score: 1, sign: 0, part: 0, epart: 2, etotal: 30 },
{ level: -15, score: 1, sign: 0, part: 0, epart: 2, etotal: 10 },
{ level: -16, score: 1, sign: 0, part: 0, epart: 0, etotal: 2 }
];
const levelImpossible = { score: 0, sign: 0, part: 0, epart: 0, etotal: 1 };
/**
* Table des résultats spéciaux - inutilisée, conservée si on veut afficher la table
*/
const specialResults = [
{ part: 0, epart: 0, etotal: 0, min: 0, max: 0 },
{ part: 1, epart: 81, etotal: 92, min: 1, max: 5 },
{ part: 2, epart: 82, etotal: 92, min: 6, max: 10 },
{ part: 3, epart: 83, etotal: 93, min: 11, max: 15 },
{ part: 4, epart: 84, etotal: 93, min: 16, max: 20 },
{ part: 5, epart: 85, etotal: 94, min: 21, max: 25 },
{ part: 6, epart: 86, etotal: 94, min: 26, max: 30 },
{ part: 7, epart: 87, etotal: 95, min: 31, max: 35 },
{ part: 8, epart: 88, etotal: 95, min: 36, max: 40 },
{ part: 9, epart: 89, etotal: 96, min: 41, max: 45 },
{ part: 10, epart: 90, etotal: 96, min: 46, max: 50 },
{ part: 11, epart: 91, etotal: 97, min: 51, max: 55 },
{ part: 12, epart: 92, etotal: 97, min: 56, max: 60 },
{ part: 13, epart: 93, etotal: 98, min: 61, max: 65 },
{ part: 14, epart: 94, etotal: 98, min: 65, max: 70 },
{ part: 15, epart: 95, etotal: 99, min: 71, max: 75 },
{ part: 16, epart: 96, etotal: 99, min: 76, max: 80 },
{ part: 17, epart: 97, etotal: 100, min: 81, max: 85 },
{ part: 18, epart: 98, etotal: 100, min: 86, max: 90 },
{ part: 19, epart: 99, etotal: 100, min: 81, max: 95 },
{ part: 20, epart: 100, etotal: 100, min: 96, max: 100 }
{ level: -11, score: 1, norm: 1, sign: 0, part: 0, epart: 2, etotal: 90 },
{ level: -12, score: 1, norm: 1, sign: 0, part: 0, epart: 2, etotal: 70 },
{ level: -13, score: 1, norm: 1, sign: 0, part: 0, epart: 2, etotal: 50 },
{ level: -14, score: 1, norm: 1, sign: 0, part: 0, epart: 2, etotal: 30 },
{ level: -15, score: 1, norm: 1, sign: 0, part: 0, epart: 2, etotal: 10 },
{ level: -16, score: 1, norm: 1, sign: 0, part: 0, epart: 0, etotal: 2 }
];
const levelImpossible = { score: 0, norm:0, sign: 0, part: 0, epart: 0, etotal: 1 };
const reussites = [
{ code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: -4, ptQualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 },
@ -110,7 +84,7 @@ export class RdDResolutionTable {
/* -------------------------------------------- */
static async roll(caracValue, finalLevel, rollData = {}){
let chances = this.computeChances(caracValue, finalLevel);
this._updateChancesWithBonus(chances, rollData.bonus);
this._updateChancesWithBonus(chances, rollData.bonus, finalLevel);
this._updateChancesFactor(chances, rollData.diviseurSignificative);
chances.showDice = rollData.showDice;
chances.rollMode = rollData.rollMode;
@ -147,8 +121,8 @@ export class RdDResolutionTable {
}
/* -------------------------------------------- */
static _updateChancesWithBonus(chances, bonus) {
if (bonus) {
static _updateChancesWithBonus(chances, bonus, finalLevel) {
if (bonus && finalLevel>-11) {
let newScore = Number(chances.score) + bonus;
mergeObject(chances, this._computeCell(null, newScore), { overwrite: true });
}

View File

@ -164,7 +164,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/casetmr-specific-list.html',
// Dialogs
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html',
@ -177,10 +177,12 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html',
// Calendrier
@ -622,7 +624,7 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static onSocketMesssage(sockmsg) {
static onSocketMessage(sockmsg) {
switch (sockmsg.msg) {
case "msg_gm_chat_message":
return ChatUtility.handleGMChatMessage(sockmsg.data);

View File

@ -6,8 +6,11 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
<hr>
<div>
Après {{tache.data.periodicite}} {{alias}} a obtenu {{rolled.ptTache}} point{{~#if (gt rolled.ptTache 1)}}s{{/if}} de tâche,
son avancement est de <span class="rdd-roll-{{#if (gt tache.data.points_de_tache_courant 0)}}norm{{else}}etotal{{/if}}">{{tache.data.points_de_tache_courant}} sur {{tache.data.points_de_tache}}</span> point{{~#if (gt tache.data.points_de_tache_courant 1)}}s{{/if}} de tâche.
{{alias}} a obtenu {{rolled.ptTache}} point{{~#unless (eq rolled.ptTache 1)}}s{{/unless}} de tâche,
son avancement est de
<span class="rdd-roll-{{#if (gt tache.data.points_de_tache_courant 0)}}norm{{else}}etotal{{/if}}">{{tache.data.points_de_tache_courant}} sur {{tache.data.points_de_tache}}</span>
point{{~#unless (eq tache.data.points_de_tache_courant 1)}}s{{/unless}} de tâche
({{~#unless (eq tache.data.tentatives 1)}}{{tache.data.tentatives}} tentatives{{else}}première tentative{{/unless~}}).
{{#if (and tache.data.fatigue appliquerFatigue)}}<br><span>Il s'est fatigué de {{tache.data.fatigue}} case{{~#if (gt tache.data.fatigue 1)}}s{{/if}}.</span>{{/if}}
{{#if rolled.isETotal}}<br><span>Son échec total augmente de 1 la difficulté de la tâche!</span>{{/if~}}
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}}

View File

@ -22,7 +22,7 @@
<span class="prixLot">{{prixLot}}</span> Sols</strong></span><br>
{{/if}}
</p>
{{#if (or (gt quantiteNbLots 0) quantiteIllimite)}}
<span class="chat-card-button-area">
<a class="button-acheter chat-card-button"
data-jsondata='{{jsondata}}'
@ -33,4 +33,5 @@
data-prixLot="{{prixLot}}">
{{#if (eq prixLot 0)}}Prendre{{else}}Acheter{{/if}}</a>
</span>
{{/if}}
</div>

View File

@ -10,10 +10,7 @@
</div>
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{#if alchimie.sansCristal}}
<div class="flexrow">
@ -21,6 +18,7 @@
<label>(-4 sans Cristal Alchimique)</label>
</div>
{{/if}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -10,6 +10,7 @@
<div class="flex-group-left">
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -11,11 +11,9 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -60,25 +60,16 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html"}}
{{#if isGM}}
<div>
<span><label>Forcer le résultat : </label><input name='force-dice--result' id='force-dice-result' value='{{forceDiceResult}}'></span>
</div>
{{/if}}
</div>
<div class="flex-group-left">
{{#if attackerRoll}}
<div class="flexrow">
<label>Difficulté</label>
<label>{{diffLibre}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{else}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}}
{{/if}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -11,12 +11,11 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>
</div>

View File

@ -14,6 +14,7 @@
<div class="flex-group-left">
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -9,11 +9,9 @@
</div>
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>
</div>

View File

@ -36,6 +36,7 @@
</div>
<hr>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements"></div>
</div>
</div>

View File

@ -11,11 +11,9 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -12,11 +12,9 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}}
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -25,11 +25,9 @@
</div>
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>

View File

@ -9,11 +9,9 @@
</div>
</div>
<div class="flex-group-left">
<div class="flexrow">
<label>Difficulté</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>
</div>

View File

@ -31,11 +31,9 @@
{{/select}}
</select>
</div>
<div class="flexrow">
<label>Difficulté</label>
<label class="signe-difficulte">{{diffLibre}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div>
</div>
</div>

View File

@ -59,6 +59,7 @@
<label class="div-sort-difficulte-fixe">{{numberFormat selectedSort.data.difficulte decimals=0 sign=true}}</label>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div class="flexrow">
<label for="bonus-case">Bonus de case </label>
<label name="bonus-case" class="bonus-case">0%</label>

View File

@ -44,6 +44,7 @@
<label for="xp">Points de tâches nécessaires</label>
<input class="attribute-value" type="text" name="data.points_de_tache" value="{{data.points_de_tache}}" data-dtype="Number"/>
</div>
<hr>
<div class="form-group">
<label for="xp">Points de tâches obtenus</label>
<input class="attribute-value" type="text" name="data.points_de_tache_courant" value="{{data.points_de_tache_courant}}" data-dtype="Number"/>

View File

@ -0,0 +1,4 @@
<div class="flexrow">
<label>Difficulté imposée</label>
<label>{{numberFormat diffLibre decimals=0 sign=true}}</label>
</div>

View File

@ -1,5 +1,5 @@
<div class="flexrow">
<label for="diffLibre">Difficulté libre</label>
<label for="diffLibre">Difficulté choisie</label>
<select name="diffLibre" id="diffLibre" data-dtype="number" {{#unless use.libre}}disabled{{/unless}}>
{{#select diffLibre}}
{{#each difficultesLibres as |key|}}

View File

@ -0,0 +1,6 @@
{{#if isGM}}
<div class="flexrow">
<label for="force-dice-result">Résultat du dé</label>
<input name='force-dice-result' id='force-dice-result' value='{{forceDiceResult}}'>
</div>
{{/if}}