Expérience par le stress
- Vue détaillée (regroupe archétype et contrôles) - Ajout d'un bouton pour mettre du stress dans une compétence
This commit is contained in:
parent
863218f03c
commit
b6b6acc4e3
@ -30,8 +30,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
|
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
|
||||||
editCaracComp: false,
|
editCaracComp: false,
|
||||||
showCompNiveauBase: false,
|
showCompNiveauBase: false,
|
||||||
montrerArchetype: false,
|
vueDetaillee: false
|
||||||
hideControls: true
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
|
|
||||||
formData.competences.forEach(item => {
|
formData.competences.forEach(item => {
|
||||||
item.visible = !this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item);
|
item.visible = !this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item);
|
||||||
RdDItemCompetence.levelUp(item);
|
RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.values(formData.data.carac).forEach(c => {
|
Object.values(formData.data.carac).forEach(c => {
|
||||||
@ -414,7 +413,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
html.find('#show-hide-competences').click(async event => {
|
html.find('.show-hide-competences').click(async event => {
|
||||||
this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
|
this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
@ -422,13 +421,9 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
this.options.editCaracComp = !this.options.editCaracComp;
|
this.options.editCaracComp = !this.options.editCaracComp;
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
html.find('#show-hide-archetype').click(async event => {
|
html.find('.vue-detaillee').click(async event => {
|
||||||
this.options.montrerArchetype = !this.options.montrerArchetype;
|
console.log("CONTROLS", this.options.vueDetaillee)
|
||||||
this.render(true);
|
this.options.vueDetaillee = !this.options.vueDetaillee;
|
||||||
});
|
|
||||||
html.find('.lock-unlock-controls').click(async event => {
|
|
||||||
console.log("CONTROLS", this.options.hideControls)
|
|
||||||
this.options.hideControls = !this.options.hideControls;
|
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -922,6 +922,36 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateCompetenceStress(idOrName) {
|
||||||
|
const competence = this.getCompetence(idOrName);
|
||||||
|
if (!competence) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const compData = Misc.data(competence);
|
||||||
|
const niveau = Number(compData.data.niveau);
|
||||||
|
const stressTransforme = Misc.data(this).data.compteurs.experience.value;
|
||||||
|
const xpRequis = RdDItemCompetence.getCompetenceNextXp(niveau) - compData.data.xp;
|
||||||
|
if (stressTransforme <= 0 || niveau >= compData.data.niveau_archetype || xpRequis <=0) {
|
||||||
|
ui.notifications.info(`La compétence ne peut pas augmenter!
|
||||||
|
stress disponible: ${stressTransforme}
|
||||||
|
expérience requise: ${xpRequis}
|
||||||
|
niveau : ${niveau}
|
||||||
|
archétype : ${compData.data.niveau_archetype}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const xpUtilise = Math.min(stressTransforme, xpRequis);
|
||||||
|
const stressTransformeRestant = Math.max(0, stressTransforme - xpUtilise);
|
||||||
|
const gainNiveau = xpUtilise>=xpRequis ? 1 : 0;
|
||||||
|
|
||||||
|
await this.update({ "data.compteurs.experience.value": stressTransformeRestant });
|
||||||
|
const nouveauNiveau = niveau + gainNiveau;
|
||||||
|
await competence.update({
|
||||||
|
"data.xp": Math.max(compData.data.xp - xpRequis, 0),
|
||||||
|
"data.niveau": nouveauNiveau,
|
||||||
|
});
|
||||||
|
this.updateExperienceLog('Dépense stress', xpUtilise, `Stress en ${competence.name} ${gainNiveau? "pour passer à "+nouveauNiveau : ""}`);
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCreatureCompetence(idOrName, fieldName, compValue) {
|
async updateCreatureCompetence(idOrName, fieldName, compValue) {
|
||||||
let competence = this.getCompetence(idOrName);
|
let competence = this.getCompetence(idOrName);
|
||||||
|
@ -160,7 +160,6 @@ export class RdDItemCompetence extends Item {
|
|||||||
return competence_xp_cumul[to] - competence_xp_cumul[from];
|
return competence_xp_cumul[to] - competence_xp_cumul[from];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static computeCompetenceXPCost(competence) {
|
static computeCompetenceXPCost(competence) {
|
||||||
const compData = Misc.data(competence);
|
const compData = Misc.data(competence);
|
||||||
@ -186,9 +185,15 @@ export class RdDItemCompetence extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static levelUp(itemData) {
|
static levelUp(itemData, stressTransforme) {
|
||||||
itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau);
|
itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau);
|
||||||
itemData.data.isLevelUp = itemData.data.xp >= itemData.data.xpNext;
|
const xpManquant = itemData.data.xpNext - itemData.data.xp;
|
||||||
|
itemData.data.isLevelUp = xpManquant <= 0;
|
||||||
|
itemData.data.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && itemData.data.niveau < itemData.data.niveau_archetype);
|
||||||
|
itemData.data.stressXpMax = 0;
|
||||||
|
if (xpManquant > 0 && stressTransforme > 0 && itemData.data.niveau < itemData.data.niveau_archetype) {
|
||||||
|
itemData.data.stressXpMax = Math.min(xpManquant , stressTransforme);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
File diff suppressed because one or more lines are too long
@ -738,6 +738,15 @@ ul, li {
|
|||||||
flex: 1 1 5rem;
|
flex: 1 1 5rem;
|
||||||
background: var(--gradient-gold) !important;
|
background: var(--gradient-gold) !important;
|
||||||
}
|
}
|
||||||
|
.niveau-archetype {
|
||||||
|
background: var(--gradient-silver-light) !important;
|
||||||
|
}
|
||||||
|
.fa-arrow-alt-circle-up.allouer-stress {
|
||||||
|
color: rgba(83, 60, 14, 0.8);
|
||||||
|
}
|
||||||
|
.fa-arrow-alt-circle-up.allouer-stress-level-up {
|
||||||
|
color: rgba(191, 149, 63, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
.blessures-list ul {
|
.blessures-list ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -21,16 +21,22 @@
|
|||||||
value="{{numberFormat data.xp_sort decimals=0 sign=false}}" data-dtype="number"
|
value="{{numberFormat data.xp_sort decimals=0 sign=false}}" data-dtype="number"
|
||||||
{{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
|
{{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if @root.options.montrerArchetype}}
|
{{#if @root.options.vueDetaillee}}
|
||||||
<input class="competence-archetype" type="text" compname="{{name}}" name="comp-archetype-{{name}}"
|
<div class="item-controls">
|
||||||
|
{{#if data.stressXpMax}}
|
||||||
|
<a class="item-control competence-stress-augmenter" compname="{{name}}"
|
||||||
|
title="Dépenser {{data.stressXpMax}} points de stress {{#if data.isStressLevelUp}} pour augmenter d'un niveau {{/if}}">
|
||||||
|
<i class="fas fa-arrow-alt-circle-up allouer-stress{{#if data.isStressLevelUp}}-level-up{{/if}}"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
<input class="competence-archetype niveau-archetype" type="text" compname="{{name}}" name="comp-archetype-{{name}}"
|
||||||
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
|
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
|
||||||
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
||||||
{{/if}}
|
|
||||||
{{#unless @root.options.hideControls}}
|
|
||||||
<div class="item-controls">
|
|
||||||
<a class="item-control item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
|
||||||
|
{{#if @root.options.isGM}}
|
||||||
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
@ -212,15 +212,14 @@
|
|||||||
<span><a class="lock-unlock-sheet"><img class="small-button-container"
|
<span><a class="lock-unlock-sheet"><img class="small-button-container"
|
||||||
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer"
|
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer"
|
||||||
>{{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}}</a></span>
|
>{{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}}</a></span>
|
||||||
<span><a id="show-hide-competences"><img class="small-button-container"
|
<span><a class="show-hide-competences"><img class="small-button-container"
|
||||||
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.showCompNiveauBase}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer tout"
|
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.showCompNiveauBase}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer tout">
|
||||||
>{{#if options.showCompNiveauBase}}Montrer tout{{else}}Filtrer{{/if}}</a></span>
|
{{#if options.showCompNiveauBase}}Montrer tout{{else}}Filtrer{{/if}}</a>
|
||||||
<span><a id="show-hide-archetype"><img class="small-button-container"
|
</span>
|
||||||
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.montrerArchetype}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer l'archétype"
|
<span><a class="vue-detaillee">
|
||||||
>{{#if options.montrerArchetype}}Masquer l'archétype{{else}}Voir l'archétype{{/if}}</a></span>
|
<i class="fas {{#if options.vueDetaillee}}fa-eye-slash{{else}}fa-eye{{/if}}"></i>
|
||||||
<span><a class="lock-unlock-controls"><i class="fas fa-lock{{#if options.hideControls}}-open{{/if}}"></i>
|
{{#if options.vueDetaillee}}Vue simplifiée{{else}}Vue détaillée{{/if}}</a>
|
||||||
{{#if options.hideControls}}Contrôles On{{else}}Contrôles Off{{/if}}
|
</span>
|
||||||
</a></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-2col">
|
<div class="grid grid-2col">
|
||||||
<div class="flex-group-left flexcol competence-column">
|
<div class="flex-group-left flexcol competence-column">
|
||||||
@ -234,7 +233,7 @@
|
|||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.tir) categorie="Compétences de Tir"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.tir) categorie="Compétences de Tir"}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.lancer) categorie="Compétences de Lancer"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.lancer) categorie="Compétences de Lancer"}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.connaissance) categorie="Connaissances"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.connaissance) categorie="Connaissances"}}
|
||||||
{{#if (or data.attributs.hautrevant.value options.montrerArchetype)}}
|
{{#if (or data.attributs.hautrevant.value options.vueDetaillee)}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.draconic) categorie="Draconic"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.draconic) categorie="Draconic"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
@ -249,11 +248,14 @@
|
|||||||
<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 options.montrerArchetype}}
|
{{#if options.vueDetaillee}}
|
||||||
|
<li>Niveaux d'archétype à répartir</li>
|
||||||
{{#each calc.comptageArchetype as |archetype key|}}
|
{{#each calc.comptageArchetype as |archetype key|}}
|
||||||
|
{{#if (lt archetype.nombre archetype.nombreMax)}}
|
||||||
<li class="item flexrow">
|
<li class="item flexrow">
|
||||||
<label class="generic-label">Archetype {{archetype.niveau}} : {{archetype.nombre}} / {{archetype.nombreMax}}</label>
|
<label class="generic-label">Archetype {{archetype.niveau}} : {{archetype.nombre}} / {{archetype.nombreMax}}</label>
|
||||||
</li>
|
</li>
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user