#41 : Gestion de l'archetype des PJs

This commit is contained in:
sladecraven 2020-12-02 20:52:37 +01:00
parent 03c23da4a1
commit 62b159ef9d
4 changed files with 61 additions and 3 deletions

View File

@ -44,6 +44,7 @@ export class RdDActorSheet extends ActorSheet {
list.push(item);
}
}
this.competenceByCategory = duplicate(data.competenceByCategory); // Sauvegarde locale
competenceXPTotal += RdDUtility.computeCompetenceTroncXP(data.itemsByType.competence);
data.data.competenceXPTotal = competenceXPTotal;
//console.log("XP competence : ", competenceXPTotal);
@ -156,6 +157,31 @@ export class RdDActorSheet extends ActorSheet {
d.render(true);
}
/* -------------------------------------------- */
afficheResumeArchetype() {
let levelCategory = RdDUtility.getLevelCategory();
let labelCategory = RdDUtility.getLabelCategory();
let contentHTML = "";
for (let compCategory in this.competenceByCategory) {
console.log(">>>>", compCategory);
contentHTML += "<br><b>" + labelCategory[compCategory] + "</b>";
for (let comp of this.competenceByCategory[compCategory]) {
if ( !comp.data.niveau_archetype ) comp.data.niveau_archetype = levelCategory[compCategory];
contentHTML += "<br>" + comp.name + " : " + comp.data.niveau_archetype;
}
}
let dialogData = {
content: contentHTML,
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: "Fermer"
}
}
}
new Dialog( dialogData ).render(true);
}
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
@ -333,6 +359,11 @@ export class RdDActorSheet extends ActorSheet {
this.actor.updateCompteurValue( fieldName, parseInt(event.target.value) );
} );
// Dialog d'archetype
html.find("#affiche-archetype").click((event) => {
this.afficheResumeArchetype()
} );
html.find('#stress-test').click((event) => {
this.actor.stressTest();
this.render(true);

View File

@ -4,16 +4,29 @@ import { TMRUtility } from "./tmr-utility.js";
import { RdDRollTables } from "./rdd-rolltables.js";
import { ChatUtility } from "./chat-utility.js";
/* -------------------------------------------- */
const level_category = {
"generale": "-4",
"particuliere": "-8",
"speciale": "-11",
"specialisee": "-11",
"connaissance": "-11",
"draconic": "-11",
"melee": "-6",
"tir": "-8",
"lancer": "-8"
}
/* -------------------------------------------- */
const label_category = {
"generale": "Générales",
"particuliere": "Particulières",
"specialisee": "Spécialisées",
"connaissance": "Connaissances",
"draconic": "Draconics",
"melee": "Mêlée",
"tir": "Tir",
"lancer": "Lancer"
}
/* -------------------------------------------- */
const competenceTroncs = [ ["Esquive", "Dague", "Corps à corps"],
["Epée à 1 main", "Epée à 2 mains", "Hache à 1 main", "Hache à 2 mains", "Lance", "Masse à 1 main", "Masse à 2 mains"] ];
const competence_xp = {
@ -23,6 +36,7 @@ const competence_xp = {
"-4" : [ 15, 30, 45, 60, 80, 100, 120]
}
/* -------------------------------------------- */
// This table starts at 0 -> niveau -10
const competence_xp_par_niveau = [ 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20, 20, 20, 20, 30, 30, 40, 40, 60, 60, 100, 100, 100, 100, 100, 100, 100, 100, 100];
const carac_array = [ "taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
@ -30,7 +44,7 @@ const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10];
const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10];
const ajustementsEncaissement = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +21, +22, +23, +24, +25];
/* -------------------------------------------- */
function _buildAllSegmentsFatigue(max) {
const cycle = [5, 2, 4, 1, 3, 0];
let fatigue = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
@ -45,6 +59,8 @@ function _buildAllSegmentsFatigue(max) {
}
return fatigue;
}
/* -------------------------------------------- */
function _cumulSegmentsFatigue(matrix) {
let cumulMatrix = [];
for (let line of matrix)
@ -59,6 +75,7 @@ function _cumulSegmentsFatigue(matrix) {
return cumulMatrix;
}
/* -------------------------------------------- */
const fatigueMatrix = _buildAllSegmentsFatigue(30);
const cumulFatigueMatrix = _cumulSegmentsFatigue(fatigueMatrix);
@ -77,12 +94,14 @@ const table2func = { "queues": {descr: "queues : Tire une queue de Dragon", fun
"souffle": { descr: "souffle: Tire un Souffle de Dragon", func: RdDRollTables.getSouffle},
"tarot" : { descr: "tarot: Tire une carte de Tarot Dracnique", func: RdDRollTables.getTarot} };
/* -------------------------------------------- */
const definitionsBlessures = [
{ type: "legere", facteur: 2 },
{ type: "grave", facteur : 4 },
{ type: "critique", facteur : 6 }
]
/* -------------------------------------------- */
const definitionsEncaissement = {
"mortel": [
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", legeres: 0, graves: 0, critiques: 0 },
@ -310,6 +329,10 @@ export class RdDUtility {
{
return level_category;
}
static getLabelCategory( )
{
return label_category;
}
static getCaracArray()
{
return carac_array;

View File

@ -565,6 +565,7 @@ ul, li {
flex-grow: 0;
}
.arme-label,
.generic-label,
.competence-label,
.description-label {
flex-grow: 2;

View File

@ -300,9 +300,12 @@
<div>
<ul class="item-list">
<li class="item flexrow">
<span class="competence-label">Total XP compétences</span>
<span class="generic-label">Total XP compétences</span>
<span class="competence-value">{{data.competenceXPTotal}}</span>
</li>
<li class="item flexrow">
<span class="generic-label"><a id="affiche-archetype">Voir l'Archetype</a></span>
</li>
</ul>
</div>
</div>