Affichage de l'XP des sorts et caractéristiques
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
- gestion des attaques avec jets V2 depuis l'onglet de combat
|
- gestion des attaques avec jets V2 depuis l'onglet de combat
|
||||||
- les jets de résistance en mode V2 fonctionnent sans sélection de compétence
|
- les jets de résistance en mode V2 fonctionnent sans sélection de compétence
|
||||||
|
- affichage de l'expérience correspondant aux sorts pour aider à la création
|
||||||
|
- affichage de l'équivallent d'expérience des caractéristiques
|
||||||
|
|
||||||
## 13.0.28 - La quadrature d'Illysis
|
## 13.0.28 - La quadrature d'Illysis
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
|||||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
|
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
|
||||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||||
import { MORAL } from "./moral/apprecier.mjs";
|
import { MORAL } from "./moral/apprecier.mjs";
|
||||||
|
import { RdDItemSort } from "./item-sort.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +53,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
|||||||
surprise: RdDBonus.find(this.actor.getSurprise(false)).label,
|
surprise: RdDBonus.find(this.actor.getSurprise(false)).label,
|
||||||
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
|
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
|
||||||
caracTotal: RdDCarac.computeTotal(this.actor.system.carac, this.actor.system.beaute),
|
caracTotal: RdDCarac.computeTotal(this.actor.system.carac, this.actor.system.beaute),
|
||||||
|
caracTotalXp: RdDCarac.computeTotalXp(this.actor.system.carac, this.actor.system.beaute),
|
||||||
surEncombrementMessage: this.actor.isSurenc() ? "Sur-Encombrement!" : "",
|
surEncombrementMessage: this.actor.isSurenc() ? "Sur-Encombrement!" : "",
|
||||||
malusArmure: this.actor.getMalusArmure()
|
malusArmure: this.actor.getMalusArmure()
|
||||||
})
|
})
|
||||||
@@ -61,9 +63,13 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
|||||||
if (formData.type == ACTOR_TYPES.personnage) {
|
if (formData.type == ACTOR_TYPES.personnage) {
|
||||||
formData.options.mainsDirectrices = MAINS_DIRECTRICES;
|
formData.options.mainsDirectrices = MAINS_DIRECTRICES;
|
||||||
formData.byCateg = Misc.classify(formData.competences, it => it.system.categorie)
|
formData.byCateg = Misc.classify(formData.competences, it => it.system.categorie)
|
||||||
formData.calc.comptageArchetype = RdDItemCompetence.computeResumeArchetype(formData.competences);
|
foundry.utils.mergeObject(formData.calc, {
|
||||||
formData.calc.competenceXPTotal = RdDItemCompetence.computeTotalXP(formData.competences);
|
comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.competences),
|
||||||
formData.calc.fatigue = RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max);
|
competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.competences),
|
||||||
|
sortsXPTotal: RdDItemSort.computeTotalXP(this.actor.itemTypes[ITEM_TYPES.sort]),
|
||||||
|
fatigue: RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
formData.competences.forEach(item => {
|
formData.competences.forEach(item => {
|
||||||
item.system.isHidden = this.options.recherche
|
item.system.isHidden = this.options.recherche
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export class RdDItemCompetence extends RdDItem {
|
|||||||
return troncList;
|
return troncList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [];
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ export class RdDItemSort extends RdDItem {
|
|||||||
return value ? value.replace('variable', 'var') : ''
|
return value ? value.replace('variable', 'var') : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static computeTotalXP(sorts) {
|
||||||
|
return sorts.map(sort => RdDItemSort.isDifficulteVariable(sort) ? 70 : -10 * Misc.toInt(sort.system.difficulte))
|
||||||
|
.reduce(Misc.sum(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
static isSortOnCoord(sort, coord) {
|
static isSortOnCoord(sort, coord) {
|
||||||
let tmr = TMRUtility.getTMR(coord)
|
let tmr = TMRUtility.getTMR(coord)
|
||||||
const caseTMR = sort.system.caseTMR.toLowerCase();
|
const caseTMR = sort.system.caseTMR.toLowerCase();
|
||||||
|
|||||||
+17
-5
@@ -168,10 +168,18 @@ export class RdDCarac {
|
|||||||
const total = Object.values(carac ?? {}).filter(c => !c.derivee)
|
const total = Object.values(carac ?? {}).filter(c => !c.derivee)
|
||||||
.map(it => parseInt(it.value))
|
.map(it => parseInt(it.value))
|
||||||
.reduce(Misc.sum(), 0);
|
.reduce(Misc.sum(), 0);
|
||||||
const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0);
|
const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0)
|
||||||
return total + beauteSuperieur10;
|
return total + beauteSuperieur10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static computeTotalXp(carac, beaute = undefined) {
|
||||||
|
const totalXp = Object.values(carac ?? {}).filter(c => !c.derivee)
|
||||||
|
.map(it => RdDCarac.getCaracXp(0, Misc.toInt(it.value)) + Misc.toInt(it.xp))
|
||||||
|
.reduce(Misc.sum(), 0);
|
||||||
|
const beauteXp = beaute > 10 ? RdDCarac.getCaracXp(10, beaute) : 0
|
||||||
|
return totalXp + beauteXp;
|
||||||
|
}
|
||||||
|
|
||||||
static levelUp(it) {
|
static levelUp(it) {
|
||||||
it.xpNext = RdDCarac.getCaracNextXp(it.value);
|
it.xpNext = RdDCarac.getCaracNextXp(it.value);
|
||||||
it.isLevelUp = (it.xp >= it.xpNext);
|
it.isLevelUp = (it.xp >= it.xpNext);
|
||||||
@@ -184,12 +192,16 @@ export class RdDCarac {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getCaracNextXp(value) {
|
static getCaracNextXp(value) {
|
||||||
const nextValue = Number(value) + 1;
|
value = Number(value);
|
||||||
|
const nextValue = value + 1;
|
||||||
// xp est le coût pour atteindre cette valeur, on regarde donc le coût de la valeur+1
|
// xp est le coût pour atteindre cette valeur, on regarde donc le coût de la valeur+1
|
||||||
return RdDCarac.getCaracXp(nextValue);
|
return RdDCarac.getCaracXp(value, nextValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getCaracXp(targetValue) {
|
static getCaracXp(from, to) {
|
||||||
return RdDCarac.getCaracDerivee(targetValue)?.xp ?? 200;
|
return Array.from({ length: to - from },
|
||||||
|
(_, i) => from + i + 1)
|
||||||
|
.map(it => RdDCarac.getCaracDerivee(it)?.xp ?? 200)
|
||||||
|
.reduce(Misc.sum(), 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-6
@@ -116,6 +116,7 @@ export class RdDCommands {
|
|||||||
this.registerCommand({
|
this.registerCommand({
|
||||||
path: ["/xp", "carac"], func: (content, msg, params) => this.getCoutXpCarac(msg, params),
|
path: ["/xp", "carac"], func: (content, msg, params) => this.getCoutXpCarac(msg, params),
|
||||||
descr: `Détermine le coût d'expérience pour augmenter une caractéristique. Exemples:
|
descr: `Détermine le coût d'expérience pour augmenter une caractéristique. Exemples:
|
||||||
|
<br>/xp carac 12 15: coût pour passer de 12 15
|
||||||
<br>/xp carac 15: coût pour atteindre 15 (depuis 14)`
|
<br>/xp carac 15: coût pour atteindre 15 (depuis 14)`
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -440,13 +441,18 @@ export class RdDCommands {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCoutXpCarac(msg, params) {
|
getCoutXpCarac(msg, params) {
|
||||||
if (params && params.length == 1) {
|
if (params) {
|
||||||
let to = Number(params[0]);
|
if (params.length == 1) {
|
||||||
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to)}`);
|
const to = Number(params[0])
|
||||||
}
|
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to - 1, to)}`);
|
||||||
else {
|
}
|
||||||
return false;
|
if (params.length == 2) {
|
||||||
|
const from = Number(params[0]);
|
||||||
|
const to = Number(params[1]);
|
||||||
|
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${from} à ${to}: ${RdDCarac.getCaracXp(from, to)}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
async creerSignesDraconiques() {
|
async creerSignesDraconiques() {
|
||||||
|
|||||||
@@ -3,4 +3,10 @@
|
|||||||
<span class="carac-label" name="carac-total">Total Caractéristiques</span>
|
<span class="carac-label" name="carac-total">Total Caractéristiques</span>
|
||||||
<span class="competence-value" name="carac-total-value">{{calc.caracTotal}} </span>
|
<span class="competence-value" name="carac-total-value">{{calc.caracTotal}} </span>
|
||||||
</li>
|
</li>
|
||||||
|
{{#if @root.options.isGM}}
|
||||||
|
<li class="caracteristique flexrow">
|
||||||
|
<span class="carac-label" name="carac-total">Total XP Caractéristiques</span>
|
||||||
|
<span class="competence-value" name="carac-total-xp">{{calc.caracTotalXp}} </span>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
<span class="generic-label">Total XP compétences</span>
|
<span class="generic-label">Total XP compétences</span>
|
||||||
<span class="competence-value">{{calc.competenceXPTotal}}</span>
|
<span class="competence-value">{{calc.competenceXPTotal}}</span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="flexrow">
|
||||||
|
<span class="generic-label">Total XP sorts</span>
|
||||||
|
<span class="competence-value">{{calc.sortsXPTotal}}</span>
|
||||||
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<li> </li>
|
<li> </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user