From 3b14e54829b072ebdfb60bf02209ea6bf4bf121e Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 20 Jun 2023 02:58:51 +0200 Subject: [PATCH] =?UTF-8?q?Mode=20de=20saisie=20d'arch=C3=A9type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + module/actor-sheet.js | 7 +++- module/item-competence.js | 34 ++++++++++--------- module/rdd-utility.js | 1 + styles/simple.css | 51 ++++++++++++++++++++++------- templates/actor-sheet.html | 19 +++++++++-- templates/actor/archetype.hbs | 15 +++++++++ templates/actor/competence.html | 10 +++--- templates/actor/xp-competences.html | 13 +------- 9 files changed, 105 insertions(+), 46 deletions(-) create mode 100644 templates/actor/archetype.hbs diff --git a/changelog.md b/changelog.md index 4079e3fe..e4bc761e 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## v11.0.9 - Les premiers pieds de Werther de Zloth - réorganisation des règles optionelles +- bouton pour accéder au mode de saisie de l'archétype en vue détaillée ## v11.0.8 - la poigne de Sémolosse - lien vers le changelog diff --git a/module/actor-sheet.js b/module/actor-sheet.js index ef9ad208..ef235610 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -33,7 +33,8 @@ export class RdDActorSheet extends RdDBaseActorSheet { tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }], showCompNiveauBase: false, - vueDetaillee: false + vueDetaillee: false, + vueArchetype: false, }); } @@ -353,6 +354,10 @@ export class RdDActorSheet extends RdDBaseActorSheet { let compName = event.currentTarget.attributes.compname.value; this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value)); }); + this.html.find('.toggle-archetype').click(async event => { + this.options.vueArchetype = !this.options.vueArchetype; + this.render(true); + }); // On competence archetype change this.html.find('.competence-archetype').change(async event => { let compName = event.currentTarget.attributes.compname.value; diff --git a/module/item-competence.js b/module/item-competence.js index 98a2e8eb..665e7d0f 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -8,18 +8,18 @@ const xp_par_niveau = [5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20, 20, 20, 20, const niveau_max = xp_par_niveau.length - 10; /* -------------------------------------------- */ const limitesArchetypes = [ - { "niveau": 0, "nombreMax": 100, "reste": 100 }, - { "niveau": 1, "nombreMax": 10, "reste": 10 }, - { "niveau": 2, "nombreMax": 9, "reste": 9 }, - { "niveau": 3, "nombreMax": 8, "reste": 8 }, - { "niveau": 4, "nombreMax": 7, "reste": 7 }, - { "niveau": 5, "nombreMax": 6, "reste": 6 }, - { "niveau": 6, "nombreMax": 5, "reste": 5 }, - { "niveau": 7, "nombreMax": 4, "reste": 4 }, - { "niveau": 8, "nombreMax": 3, "reste": 3 }, - { "niveau": 9, "nombreMax": 2, "reste": 2 }, - { "niveau": 10, "nombreMax": 1, "reste": 1 }, - { "niveau": 11, "nombreMax": 1, "reste": 1 } + { niveau: 0, nombreMax: 100 }, + { niveau: 1, nombreMax: 10 }, + { niveau: 2, nombreMax: 9 }, + { niveau: 3, nombreMax: 8 }, + { niveau: 4, nombreMax: 7 }, + { niveau: 5, nombreMax: 6 }, + { niveau: 6, nombreMax: 5 }, + { niveau: 7, nombreMax: 4 }, + { niveau: 8, nombreMax: 3 }, + { niveau: 9, nombreMax: 2 }, + { niveau: 10, nombreMax: 1 }, + { niveau: 11, nombreMax: 1 }, ]; /* -------------------------------------------- */ @@ -259,13 +259,17 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static computeResumeArchetype(competences) { const computed = duplicate(limitesArchetypes); + computed.forEach(it => { it.nombre = 0; it.reste = it.nombreMax; }); + competences.map(it => Math.max(0, it.system.niveau_archetype)) .filter(n => n > 0) .forEach(n => { - computed[n] = computed[n] ?? { niveau: n, nombreMax: 0, reste: 0 }; - computed[n].reste = computed[n].reste - 1; + computed[n] = computed[n] ?? { niveau: n, nombreMax: 0, reste: 0, nombre: 0 }; + computed[n].reste--; + computed[n].nombre++; + }); - return computed.filter(it => it.reste > 0 && it.niveau > 0); + return computed.filter(it => it.niveau > 0); } /* -------------------------------------------- */ diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 59a5f8be..df44ac7f 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -121,6 +121,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-entitee.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/header-hautreve.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/archetype.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.html', diff --git a/styles/simple.css b/styles/simple.css index 2dc2e31e..03760217 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -287,6 +287,16 @@ table {border: 1px solid #7a7971;} padding: 0; } + +.grid-competence-archetype { + display: grid; + grid-column: span 3 / span 3; + grid-template-columns: 2fr 2fr 1fr; + gap: 0.5rem; + margin: 0.5rem 0; + padding: 0; +} + .grid-3col { grid-column: span 3 / span 3; grid-template-columns: repeat(3, minmax(0, 1fr)); @@ -1898,34 +1908,51 @@ div.calendar-timestamp-edit select.calendar-signe-heure { opacity: 1; } -.chat-card-button { - box-shadow: inset 0px 1px 0px 0px #a6827e; - background: var(--background-custom-button); - background-color: #7d5d3b00; - border-radius: 3px; - border: 2px ridge #846109; - display: inline-block; +.chat-card-button, .chat-card-button-pushed { + border-radius: 0.2rem; cursor: pointer; - color: #ffffff; font-family: CaslonPro; font-size: 0.9rem; - padding: 4px 12px 0px 12px; + padding: 0.2rem 0.4rem 0rem 0.4rem; text-decoration: none; - text-shadow: 0px 1px 0px #4d3534; position: relative; - margin:5px; + margin: 0.3rem; + + border: 2px ridge #846109; + display: inline-block; } +.chat-card-button{ + text-shadow: 1px 1px #4d3534; + box-shadow: inset 1x 1px #a6827e; + color: var(--major-button-color); + background: var(--background-custom-button); + background-color: #7d5d3b00; +} + +.chat-card-button-pushed { + text-shadow: 1px 1px hsla(202, 30%, 70%, 0.5); + box-shadow: inset -1px -1px #a6827e; + color: hsla(202, 42%, 14%, 0.7); + background: var(--major-button-color); + background-color: #7d5d3b00; +} .chat-card-button:hover { background: var(--background-custom-button-hover); background-color: red; } -.chat-card-button:active { +.chat-card-button-pushed:hover { + background: var(--background-custom-button-hover); + background-color: red; +} + +.chat-card-button:active, .chat-card-button-pushed:active { position:relative; top:1px; } + /* Dropdown Content (Hidden by Default) */ .button-dropdown-content { display: none; diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index ad98f9f2..bac05512 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -53,7 +53,9 @@ {{#if options.isObserver}}{{!-- Compétences Tab --}}
- {{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html"}} + + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html"}} + {{#if options.showCompNiveauBase}} Montrer tout @@ -65,9 +67,17 @@ + {{#if options.vueDetaillee}} +    + {{#if @root.options.vueArchetype}} + Sortie archétype + {{else}} + Edit. archétype + {{/if}} + {{/if}}
-
+
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.html" competences=(filtreTriCompetences byCateg.generale) categorie="Compétences générales"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.html" competences=(filtreTriCompetences byCateg.particuliere) categorie="Compétences Particulières"}} @@ -83,6 +93,11 @@ {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.html" competences=(filtreTriCompetences byCateg.draconic) categorie="Draconic"}} {{/if}}
+ {{#if (and options.vueDetaillee options.vueArchetype)}} +
+ {{> "systems/foundryvtt-reve-de-dragon/templates/actor/archetype.hbs"}} +
+ {{/if}}
{{/if}} diff --git a/templates/actor/archetype.hbs b/templates/actor/archetype.hbs new file mode 100644 index 00000000..5be754ad --- /dev/null +++ b/templates/actor/archetype.hbs @@ -0,0 +1,15 @@ +
+
    +
  • Niveaux d'archétype
  • + {{#if calc.comptageArchetype}} + {{#each calc.comptageArchetype as |archetype|}} + +
  • + +
  • + {{/each}} + {{/if}} +
+
diff --git a/templates/actor/competence.html b/templates/actor/competence.html index d954ea9c..38996591 100644 --- a/templates/actor/competence.html +++ b/templates/actor/competence.html @@ -14,12 +14,13 @@ + {{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} /> {{#if @root.options.vueDetaillee}} + value="{{numberFormat system.xp decimals=0 sign=false}}" data-dtype="number" + {{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} /> {{#unless system.isLevelUp}} Vous devez acquérir {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}} {{/unless}} @@ -28,7 +29,7 @@ {{#if (eq system.categorie 'draconic')}} + {{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} /> {{/if}} {{#if @root.options.vueDetaillee}}
@@ -41,7 +42,8 @@ {{/if}} + value="{{numberFormat system.niveau_archetype decimals=0 sign=true}}" data-dtype="number" + {{#if (not @root.options.vueArchetype)}}disabled{{/if}} /> {{#if @root.options.isGM}} diff --git a/templates/actor/xp-competences.html b/templates/actor/xp-competences.html index c70d6b62..13d924ff 100644 --- a/templates/actor/xp-competences.html +++ b/templates/actor/xp-competences.html @@ -13,18 +13,7 @@ Total XP compétences {{calc.competenceXPTotal}} - {{#if calc.comptageArchetype}} -

  • -
  • Niveaux d'archétype à répartir
  • - {{#each calc.comptageArchetype as |archetype key|}} - {{#if (gt archetype.reste 0)}} -
  • - -
  • - {{/if}} - {{/each}} - {{/if}} - {{/if}} + {{/if}}
  •