fix: dériver lvl des jauges (blessures/destin/spleen) depuis les cases cochées
Les niveaux sont maintenant calculés automatiquement dans prepareDerivedData() plutôt que stockés indépendamment — décocher une case met correctement lvl à jour. Suppression des inputs manuels lvl dans le template (inutiles car dérivés). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -170,6 +170,11 @@ export default class CelestopolCharacter extends foundry.abstract.TypeDataModel
|
|||||||
faction.value = [1,2,3,4,5,6,7,8,9].filter(i => faction[`level${i}`]).length
|
faction.value = [1,2,3,4,5,6,7,8,9].filter(i => faction[`level${i}`]).length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calcul automatique du niveau des jauges depuis les cases cochées
|
||||||
|
this.blessures.lvl = [1,2,3,4,5,6,7,8].filter(i => this.blessures[`b${i}`]?.checked).length
|
||||||
|
this.destin.lvl = [1,2,3,4,5,6,7,8].filter(i => this.destin[`d${i}`]?.checked).length
|
||||||
|
this.spleen.lvl = [1,2,3,4,5,6,7,8].filter(i => this.spleen[`s${i}`]?.checked).length
|
||||||
|
|
||||||
// Initiative PJ : 4 + Mobilité (Corps) + Inspiration (Cœur) [après calcul des domaines]
|
// Initiative PJ : 4 + Mobilité (Corps) + Inspiration (Cœur) [après calcul des domaines]
|
||||||
this.initiative = 4 + (this.stats.corps.mobilite?.value ?? 0) + (this.stats.coeur.inspiration?.value ?? 0)
|
this.initiative = 4 + (this.stats.corps.mobilite?.value ?? 0) + (this.stats.coeur.inspiration?.value ?? 0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="track-level">
|
<div class="track-level">
|
||||||
<label>{{localize "CELESTOPOL.Track.level"}}</label>
|
<label>{{localize "CELESTOPOL.Track.level"}}</label>
|
||||||
{{#if isEditMode}}
|
<span>{{system.blessures.lvl}}</span>
|
||||||
<input type="number" name="system.blessures.lvl" value="{{system.blessures.lvl}}" min="0" max="8">
|
|
||||||
{{else}}
|
|
||||||
<span>{{system.blessures.lvl}}</span>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -49,11 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="track-level">
|
<div class="track-level">
|
||||||
<label>{{localize "CELESTOPOL.Track.level"}}</label>
|
<label>{{localize "CELESTOPOL.Track.level"}}</label>
|
||||||
{{#if isEditMode}}
|
<span>{{system.destin.lvl}}</span>
|
||||||
<input type="number" name="system.destin.lvl" value="{{system.destin.lvl}}" min="0" max="8">
|
|
||||||
{{else}}
|
|
||||||
<span>{{system.destin.lvl}}</span>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -76,11 +68,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="track-level">
|
<div class="track-level">
|
||||||
<label>{{localize "CELESTOPOL.Track.level"}}</label>
|
<label>{{localize "CELESTOPOL.Track.level"}}</label>
|
||||||
{{#if isEditMode}}
|
<span>{{system.spleen.lvl}}</span>
|
||||||
<input type="number" name="system.spleen.lvl" value="{{system.spleen.lvl}}" min="0" max="8">
|
|
||||||
{{else}}
|
|
||||||
<span>{{system.spleen.lvl}}</span>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user