Mode de saisie d'archétype

This commit is contained in:
Vincent Vandemeulebrouck 2023-06-20 02:58:51 +02:00
parent 615a3f1315
commit 3b14e54829
9 changed files with 105 additions and 46 deletions

View File

@ -2,6 +2,7 @@
## v11.0.9 - Les premiers pieds de Werther de Zloth ## v11.0.9 - Les premiers pieds de Werther de Zloth
- réorganisation des règles optionelles - 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 ## v11.0.8 - la poigne de Sémolosse
- lien vers le changelog - lien vers le changelog

View File

@ -33,7 +33,8 @@ export class RdDActorSheet extends RdDBaseActorSheet {
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }],
showCompNiveauBase: false, showCompNiveauBase: false,
vueDetaillee: false vueDetaillee: false,
vueArchetype: false,
}); });
} }
@ -353,6 +354,10 @@ export class RdDActorSheet extends RdDBaseActorSheet {
let compName = event.currentTarget.attributes.compname.value; let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXPSort(compName, parseInt(event.target.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 // On competence archetype change
this.html.find('.competence-archetype').change(async event => { this.html.find('.competence-archetype').change(async event => {
let compName = event.currentTarget.attributes.compname.value; let compName = event.currentTarget.attributes.compname.value;

View File

@ -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 niveau_max = xp_par_niveau.length - 10;
/* -------------------------------------------- */ /* -------------------------------------------- */
const limitesArchetypes = [ const limitesArchetypes = [
{ "niveau": 0, "nombreMax": 100, "reste": 100 }, { niveau: 0, nombreMax: 100 },
{ "niveau": 1, "nombreMax": 10, "reste": 10 }, { niveau: 1, nombreMax: 10 },
{ "niveau": 2, "nombreMax": 9, "reste": 9 }, { niveau: 2, nombreMax: 9 },
{ "niveau": 3, "nombreMax": 8, "reste": 8 }, { niveau: 3, nombreMax: 8 },
{ "niveau": 4, "nombreMax": 7, "reste": 7 }, { niveau: 4, nombreMax: 7 },
{ "niveau": 5, "nombreMax": 6, "reste": 6 }, { niveau: 5, nombreMax: 6 },
{ "niveau": 6, "nombreMax": 5, "reste": 5 }, { niveau: 6, nombreMax: 5 },
{ "niveau": 7, "nombreMax": 4, "reste": 4 }, { niveau: 7, nombreMax: 4 },
{ "niveau": 8, "nombreMax": 3, "reste": 3 }, { niveau: 8, nombreMax: 3 },
{ "niveau": 9, "nombreMax": 2, "reste": 2 }, { niveau: 9, nombreMax: 2 },
{ "niveau": 10, "nombreMax": 1, "reste": 1 }, { niveau: 10, nombreMax: 1 },
{ "niveau": 11, "nombreMax": 1, "reste": 1 } { niveau: 11, nombreMax: 1 },
]; ];
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -259,13 +259,17 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeResumeArchetype(competences) { static computeResumeArchetype(competences) {
const computed = duplicate(limitesArchetypes); const computed = duplicate(limitesArchetypes);
computed.forEach(it => { it.nombre = 0; it.reste = it.nombreMax; });
competences.map(it => Math.max(0, it.system.niveau_archetype)) competences.map(it => Math.max(0, it.system.niveau_archetype))
.filter(n => n > 0) .filter(n => n > 0)
.forEach(n => { .forEach(n => {
computed[n] = computed[n] ?? { niveau: n, nombreMax: 0, reste: 0 }; computed[n] = computed[n] ?? { niveau: n, nombreMax: 0, reste: 0, nombre: 0 };
computed[n].reste = computed[n].reste - 1; computed[n].reste--;
computed[n].nombre++;
}); });
return computed.filter(it => it.reste > 0 && it.niveau > 0); return computed.filter(it => it.niveau > 0);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -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-compteurs-entitee.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.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/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/vue-detaillee.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.html',

View File

@ -287,6 +287,16 @@ table {border: 1px solid #7a7971;}
padding: 0; 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-3col {
grid-column: span 3 / span 3; grid-column: span 3 / span 3;
grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-columns: repeat(3, minmax(0, 1fr));
@ -1898,34 +1908,51 @@ div.calendar-timestamp-edit select.calendar-signe-heure {
opacity: 1; opacity: 1;
} }
.chat-card-button { .chat-card-button, .chat-card-button-pushed {
box-shadow: inset 0px 1px 0px 0px #a6827e; border-radius: 0.2rem;
background: var(--background-custom-button);
background-color: #7d5d3b00;
border-radius: 3px;
border: 2px ridge #846109;
display: inline-block;
cursor: pointer; cursor: pointer;
color: #ffffff;
font-family: CaslonPro; font-family: CaslonPro;
font-size: 0.9rem; font-size: 0.9rem;
padding: 4px 12px 0px 12px; padding: 0.2rem 0.4rem 0rem 0.4rem;
text-decoration: none; text-decoration: none;
text-shadow: 0px 1px 0px #4d3534;
position: relative; 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 { .chat-card-button:hover {
background: var(--background-custom-button-hover); background: var(--background-custom-button-hover);
background-color: red; 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; position:relative;
top:1px; top:1px;
} }
/* Dropdown Content (Hidden by Default) */ /* Dropdown Content (Hidden by Default) */
.button-dropdown-content { .button-dropdown-content {
display: none; display: none;

View File

@ -53,7 +53,9 @@
{{#if options.isObserver}}{{!-- Compétences Tab --}} {{#if options.isObserver}}{{!-- Compétences Tab --}}
<div class="tab competences" data-group="primary" data-tab="competences"> <div class="tab competences" data-group="primary" data-tab="competences">
<div class="flexrow"> <div class="flexrow">
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html"}} <span>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html"}}
</span>
<span class="flexrow"><a class="show-hide-competences"> <span class="flexrow"><a class="show-hide-competences">
{{#if options.showCompNiveauBase}} {{#if options.showCompNiveauBase}}
<i class="fa-regular fa-filter-slash"></i> Montrer tout <i class="fa-regular fa-filter-slash"></i> Montrer tout
@ -65,9 +67,17 @@
<input class="recherche flex-grow" type="text" value="{{options.recherche.text}}" name="recherche" size="8" data-dtype="String" placeholder=""/> <input class="recherche flex-grow" type="text" value="{{options.recherche.text}}" name="recherche" size="8" data-dtype="String" placeholder=""/>
</span> </span>
<span> <span>
{{#if options.vueDetaillee}}
&nbsp;&nbsp;
{{#if @root.options.vueArchetype}}
<a class="competence-archetype toggle-archetype chat-card-button-pushed">Sortie archétype</a>
{{else}}
<a class="competence-archetype toggle-archetype chat-card-button">Edit. archétype</a>
{{/if}}
{{/if}}
</span> </span>
</div> </div>
<div class="grid grid-2col"> <div class="grid {{#if (and options.vueDetaillee options.vueArchetype)}}grid-competence-archetype{{else}}grid-2col{{/if}}">
<div class="competence-column"> <div class="competence-column">
{{> "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.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"}} {{> "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"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.html" competences=(filtreTriCompetences byCateg.draconic) categorie="Draconic"}}
{{/if}} {{/if}}
</div> </div>
{{#if (and options.vueDetaillee options.vueArchetype)}}
<div>
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/archetype.hbs"}}
</div>
{{/if}}
</div> </div>
</div> </div>
{{/if}} {{/if}}

View File

@ -0,0 +1,15 @@
<div>
<ul class="item-list">
<li>Niveaux d'archétype</li>
{{#if calc.comptageArchetype}}
{{#each calc.comptageArchetype as |archetype|}}
<li class="item flexrow">
<label class="generic-label">
Niveaux {{numberFormat archetype.niveau decimals=0 sign=true}} : {{archetype.nombre}} / {{archetype.nombreMax}}
</label>
</li>
{{/each}}
{{/if}}
</ul>
</div>

View File

@ -14,12 +14,13 @@
<input class="competence-value" type="text" compname="{{name}}" name="comp-value-{{name}}" <input class="competence-value" type="text" compname="{{name}}" name="comp-value-{{name}}"
value="{{numberFormat system.niveau decimals=0 sign=true}}" data-dtype="number" value="{{numberFormat system.niveau decimals=0 sign=true}}" data-dtype="number"
{{#unless @root.options.vueDetaillee}}disabled{{/unless}} /> {{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} />
{{#if @root.options.vueDetaillee}} {{#if @root.options.vueDetaillee}}
<span class="competence-xp {{#unless system.isLevelUp}}tooltip{{/unless}}"> <span class="competence-xp {{#unless system.isLevelUp}}tooltip{{/unless}}">
<input class="competence-xp " type="text" compname="{{name}}" name="comp-xp-{{name}}" <input class="competence-xp " type="text" compname="{{name}}" name="comp-xp-{{name}}"
value="{{numberFormat system.xp decimals=0 sign=false}}" data-dtype="number"/> 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}} {{#unless system.isLevelUp}}
<span class="tooltiptext left-competence ttt-xp">Vous devez acquérir {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span> <span class="tooltiptext left-competence ttt-xp">Vous devez acquérir {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
{{/unless}} {{/unless}}
@ -28,7 +29,7 @@
{{#if (eq system.categorie 'draconic')}} {{#if (eq system.categorie 'draconic')}}
<input class="competence-xp-sort" type="text" compname="{{name}}" name="comp-xp-sort-{{name}}" <input class="competence-xp-sort" type="text" compname="{{name}}" name="comp-xp-sort-{{name}}"
value="{{numberFormat system.xp_sort decimals=0 sign=false}}" data-dtype="number" value="{{numberFormat system.xp_sort decimals=0 sign=false}}" data-dtype="number"
{{#unless @root.options.vueDetaillee}}disabled{{/unless}}/> {{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} />
{{/if}} {{/if}}
{{#if @root.options.vueDetaillee}} {{#if @root.options.vueDetaillee}}
<div class="item-controls"> <div class="item-controls">
@ -41,7 +42,8 @@
<i class="far fa-circle"></i> <i class="far fa-circle"></i>
{{/if}} {{/if}}
<input class="competence-archetype niveau-archetype" type="text" compname="{{name}}" name="comp-archetype-{{name}}" <input class="competence-archetype niveau-archetype" type="text" compname="{{name}}" name="comp-archetype-{{name}}"
value="{{numberFormat system.niveau_archetype decimals=0 sign=true}}" data-dtype="number"/> value="{{numberFormat system.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
{{#if (not @root.options.vueArchetype)}}disabled{{/if}} />
<a class="item-edit" title="Modifier"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
{{#if @root.options.isGM}} {{#if @root.options.isGM}}
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>

View File

@ -13,18 +13,7 @@
<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>
{{#if calc.comptageArchetype}} {{/if}}
<li><hr></li>
<li>Niveaux d'archétype à répartir</li>
{{#each calc.comptageArchetype as |archetype key|}}
{{#if (gt archetype.reste 0)}}
<li class="item flexrow">
<label class="generic-label">Reste {{archetype.reste}} niveaux {{numberFormat archetype.niveau decimals=0 sign=true}} sur {{archetype.nombreMax}}</label>
</li>
{{/if}}
{{/each}}
{{/if}}
{{/if}}
<li>&nbsp;</li> <li>&nbsp;</li>
</ul> </ul>
</div> </div>