Refonte complète du système Anomalies

- DataModel : renommage value→level (1-4), ajout usesRemaining (0-4), suppression scores/notes
- Config : ajout ANOMALY_DEFINITIONS avec compétences applicables par type (8 anomalies)
- Fiche item anomalie : header avec level/uses visuels (dots), barre de compétences applicables,
  2 onglets Description + Technique/Narratif (suppression onglet Scores)
- Fiche PJ onglet Domaines : bloc anomalie proéminent unique avec:
  - Nom + sous-type + icône
  - Dots niveau (●●○○)
  - Dots usages + bouton Utiliser + bouton Réinitialiser
  - Chips des domaines applicables
- Actions : useAnomaly (décrémente usesRemaining), resetAnomalyUses (reset au niveau)
- Contrainte : max 1 anomalie par personnage (drop + createAnomaly)
- Helpers HBS : lte, gte, lt ajoutés
- i18n : nouvelles clés Anomaly.* (level, usesRemaining, use, resetUses, etc.)
- CSS : .anomaly-block sur fiche PJ, dots animés, .anomaly-uses-row sur fiche item

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-28 18:15:06 +01:00
parent cff700bd3d
commit f9ddcdf9da
11 changed files with 474 additions and 41 deletions

View File

@@ -11,19 +11,51 @@
<option value="{{key}}" {{#if (eq key ../system.subtype)}}selected{{/if}}>{{localize atype.label}}</option>
{{/each}}
</select>
<div class="item-value-field">
<label>{{localize "CELESTOPOL.Item.value"}}</label>
<input type="number" name="system.value" value="{{system.value}}" min="0" max="8"
{{#unless isEditable}}disabled{{/unless}}>
<div class="anomaly-level-field">
<label>{{localize "CELESTOPOL.Anomaly.level"}}</label>
{{#if isEditable}}
<input type="number" name="system.level" value="{{system.level}}" min="1" max="4" class="level-input">
{{else}}
<span class="anomaly-level-value">{{system.level}}</span>
{{/if}}
</div>
</div>
{{!-- Usages restants : dots visuels --}}
<div class="anomaly-uses-row">
<span class="anomaly-uses-label">{{localize "CELESTOPOL.Anomaly.usesRemaining"}} :</span>
<div class="anomaly-uses-dots">
{{#each (array 1 2 3 4) as |n|}}
{{#if (lte n ../system.usesRemaining)}}
<span class="anomaly-dot available"></span>
{{else}}
{{#if (lte n ../system.level)}}
<span class="anomaly-dot spent"></span>
{{else}}
<span class="anomaly-dot inactive"></span>
{{/if}}
{{/if}}
{{/each}}
</div>
{{#if isEditable}}
<input type="number" name="system.usesRemaining" value="{{system.usesRemaining}}" min="0" max="4" class="uses-number-input">
{{/if}}
</div>
</div>
</header>
{{!-- Domaines applicables --}}
{{#if applicableSkillLabels.length}}
<div class="anomaly-skills-bar">
<span class="anomaly-skills-label">{{localize "CELESTOPOL.Anomaly.applicableSkills"}} :</span>
{{#each applicableSkillLabels as |label|}}
<span class="anomaly-skill-chip">{{label}}</span>
{{/each}}
</div>
{{/if}}
<nav class="item-tabs sheet-tabs tabs" data-group="item-tabs">
<a class="item active" data-group="item-tabs" data-tab="description">{{localize "CELESTOPOL.Tab.description"}}</a>
<a class="item" data-group="item-tabs" data-tab="technique">{{localize "CELESTOPOL.Tab.technique"}}</a>
<a class="item" data-group="item-tabs" data-tab="scores">{{localize "CELESTOPOL.Item.scores"}}</a>
</nav>
<section class="tab active" data-group="item-tabs" data-tab="description">
@@ -47,8 +79,4 @@
{{editor system.narratif target="system.narratif" button=true editable=isEditable}}
</div>
</section>
<section class="tab" data-group="item-tabs" data-tab="scores">
{{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills stats=stats system=system}}
</section>
</div>

View File

@@ -58,27 +58,79 @@
{{/each}}
</div>
{{!-- Items : Anomalies, Aspects, Attributs --}}
{{!-- Items : Anomalie (unique), Aspects, Attributs --}}
<div class="items-section">
{{!-- Anomalies --}}
<div class="items-group">
<div class="items-header">
<span>{{localize "CELESTOPOL.Item.anomalies"}}</span>
{{!-- Anomalie : bloc proéminent unique --}}
<div class="anomaly-block">
<div class="anomaly-block-header">
<span class="anomaly-block-title">{{localize "CELESTOPOL.Item.anomaly"}}</span>
{{#if isEditMode}}
<a data-action="createAnomaly" title="{{localize 'CELESTOPOL.Item.newAnomaly'}}"><i class="fas fa-plus"></i></a>
{{#unless anomaly}}
<a data-action="createAnomaly" title="{{localize 'CELESTOPOL.Item.newAnomaly'}}"><i class="fas fa-plus"></i></a>
{{/unless}}
{{/if}}
</div>
{{#each anomalies as |item|}}
<div class="item-row" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true">
<img src="{{item.img}}" class="item-icon" alt="{{item.name}}">
<span class="item-name">{{item.name}}</span>
<span class="item-value">{{item.system.value}}</span>
<div class="item-controls">
<a data-action="edit" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
{{#if ../isEditMode}}<a data-action="delete" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>{{/if}}
{{#if anomaly}}
<div class="anomaly-content" data-item-id="{{anomaly.id}}" data-item-uuid="{{anomaly.uuid}}" data-drag="true">
<div class="anomaly-info-row">
<img src="{{anomaly.img}}" class="anomaly-icon" alt="{{anomaly.name}}">
<div class="anomaly-details">
<div class="anomaly-name">{{anomaly.name}}</div>
<div class="anomaly-subtype">{{localize (lookup (lookup anomalyTypes anomaly.system.subtype) 'label')}}</div>
</div>
<div class="anomaly-controls">
<a data-action="edit" data-item-uuid="{{anomaly.uuid}}"><i class="fas fa-edit"></i></a>
{{#if isEditMode}}<a data-action="delete" data-item-uuid="{{anomaly.uuid}}"><i class="fas fa-trash"></i></a>{{/if}}
</div>
</div>
<div class="anomaly-level-row">
<span class="anomaly-level-label">{{localize "CELESTOPOL.Anomaly.level"}} :</span>
<div class="anomaly-level-dots">
{{#each (array 1 2 3 4) as |n|}}
<span class="anomaly-level-dot {{#if (lte n ../anomaly.system.level)}}active{{else}}inactive{{/if}}"></span>
{{/each}}
</div>
</div>
<div class="anomaly-uses-row">
<span class="anomaly-uses-label">{{localize "CELESTOPOL.Anomaly.usesRemaining"}} :</span>
<div class="anomaly-uses-dots">
{{#each (array 1 2 3 4) as |n|}}
{{#if (lte n ../anomaly.system.usesRemaining)}}
<span class="anomaly-dot available"></span>
{{else}}
{{#if (lte n ../anomaly.system.level)}}
<span class="anomaly-dot spent"></span>
{{else}}
<span class="anomaly-dot inactive"></span>
{{/if}}
{{/if}}
{{/each}}
</div>
<button class="anomaly-use-btn" data-action="useAnomaly" data-item-id="{{anomaly.id}}"
title="{{localize 'CELESTOPOL.Anomaly.use'}}"
{{#unless (gt anomaly.system.usesRemaining 0)}}disabled{{/unless}}>
<i class="fas fa-bolt"></i> {{localize "CELESTOPOL.Anomaly.use"}}
</button>
<a class="anomaly-reset-btn" data-action="resetAnomalyUses" data-item-id="{{anomaly.id}}"
title="{{localize 'CELESTOPOL.Anomaly.resetUses'}}">
<i class="fas fa-rotate-right"></i>
</a>
</div>
{{#if anomalySkillLabels.length}}
<div class="anomaly-skills">
<span class="anomaly-skills-label">{{localize "CELESTOPOL.Anomaly.applicableSkills"}} :</span>
{{#each anomalySkillLabels as |label|}}
<span class="anomaly-skill-chip">{{label}}</span>
{{/each}}
</div>
{{/if}}
</div>
{{/each}}
{{else}}
<div class="anomaly-empty">
<i class="fas fa-ghost"></i>
<span>{{localize "CELESTOPOL.Anomaly.noAnomaly"}}</span>
</div>
{{/if}}
</div>
{{!-- Aspects --}}