feat: jets d'attaque depuis les armes (combat en opposition)

- Bouton ⚔ Attaquer sur chaque arme (onglet Équipement, mode Jeu)
- rollAttack(itemId) dans character.mjs : jet Échauffourée vs Corps PNJ
- Dialog combat : input numérique 'Corps du PNJ' à la place du sélect difficulté
- computeResult() : margin===0 → résultat 'tie' (égalité) en combat
- Mêlée échec → blessure joueur auto-cochée (comme résistance)
- Distance échec → simple raté, pas de blessure joueur
- Chat message : infos arme, bandeau égalité, desc succès/échec combat
- CSS : bandeau 'tie' (brun doré), zone arme dans dialog
- i18n : CELESTOPOL.Combat.* (attack, corpsPnj, tie, successHit, etc.)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-30 00:29:29 +02:00
parent 149d55dfa0
commit 79a68ee9ab
8 changed files with 210 additions and 23 deletions

View File

@@ -16,6 +16,9 @@
<span class="item-tag type">{{#if (eq item.system.type "melee")}}{{localize "CELESTOPOL.Weapon.typeMelee"}}{{else}}{{localize "CELESTOPOL.Weapon.typeDistance"}}{{/if}}</span>
<span class="item-tag dmg">{{localize "CELESTOPOL.Weapon.degats"}} {{item.system.degats}}</span>
<div class="item-controls">
{{#unless ../isEditMode}}
<a data-action="attack" data-item-id="{{item.id}}" title="{{localize 'CELESTOPOL.Combat.attack'}}"><i class="fas fa-khanda"></i></a>
{{/unless}}
<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}}
</div>

View File

@@ -7,6 +7,14 @@
{{/if}}
<div class="roll-info">
<span class="actor-name">{{actorName}}</span>
{{!-- Arme (mode combat) --}}
{{#if isCombat}}
<span class="weapon-info-header">
<span class="weapon-icon-small">⚔</span>
<span class="weapon-name-small">{{weaponName}}</span>
{{#if (gt weaponDegats "0")}}<span class="weapon-degats-small">+{{weaponDegats}}</span>{{/if}}
</span>
{{/if}}
<span class="skill-info">
{{#if statLabel}}<span class="stat-lbl">{{statLabel}}</span><span class="sep"> </span>{{/if}}
<span class="skill-lbl">{{skillLabel}}</span>
@@ -64,7 +72,7 @@
<span class="vs-wrap">
<span class="vs-label">vs</span>
<span class="diff-label">{{difficultyLabel}}</span>
<span class="diff-val">({{difficultyValue}})</span>
{{#unless isCombat}}<span class="diff-val">({{difficultyValue}})</span>{{/unless}}
</span>
{{#if margin}}
<span class="margin-badge {{#if marginAbove}}above{{else}}below{{/if}}">
@@ -107,27 +115,46 @@
{{#if autoSuccess}}
<span class="result-icon">★</span>
<span class="result-label">{{localize "CELESTOPOL.Roll.autoSuccess"}}</span>
{{else if isTie}}
<span class="result-icon">⚖</span>
<span class="result-label">{{localize "CELESTOPOL.Combat.tie"}}</span>
<span class="result-desc">{{localize "CELESTOPOL.Combat.tieDesc"}}</span>
{{else if isCriticalSuccess}}
<span class="result-icon">✦✦</span>
<span class="result-label">{{localize "CELESTOPOL.Roll.criticalSuccess"}}</span>
{{#if isCombat}}
<span class="result-desc">{{localize "CELESTOPOL.Combat.successHit"}}{{#if (gt weaponDegats "0")}} +{{weaponDegats}} {{localize "CELESTOPOL.Combat.weaponDamage"}}{{/if}}</span>
{{else}}
<span class="result-desc">{{localize "CELESTOPOL.Roll.criticalSuccessDesc"}}</span>
{{/if}}
{{else if isSuccess}}
<span class="result-icon">✦</span>
<span class="result-label">{{localize "CELESTOPOL.Roll.success"}}</span>
{{#if isCombat}}
<span class="result-desc">{{localize "CELESTOPOL.Combat.successHit"}}{{#if (gt weaponDegats "0")}} +{{weaponDegats}} {{localize "CELESTOPOL.Combat.weaponDamage"}}{{/if}}</span>
{{/if}}
{{else if isCriticalFailure}}
<span class="result-icon">✖✖</span>
<span class="result-label">{{localize "CELESTOPOL.Roll.criticalFailure"}}</span>
{{#if isCombat}}
<span class="result-desc">{{#if (eq weaponType "melee")}}{{localize "CELESTOPOL.Combat.failureHit"}}{{else}}{{localize "CELESTOPOL.Combat.distanceNoWound"}}{{/if}}</span>
{{else}}
<span class="result-desc">{{localize "CELESTOPOL.Roll.criticalFailureDesc"}}</span>
{{/if}}
{{else if isFailure}}
<span class="result-icon">✖</span>
<span class="result-label">{{localize "CELESTOPOL.Roll.failure"}}</span>
{{#if isCombat}}
<span class="result-desc">{{#if (eq weaponType "melee")}}{{localize "CELESTOPOL.Combat.failureHit"}}{{else}}{{localize "CELESTOPOL.Combat.distanceNoWound"}}{{/if}}</span>
{{/if}}
{{/if}}
</div>
{{!-- Blessure auto-cochée (test de résistance raté) --}}
{{!-- Blessure auto-cochée (résistance ratée ou combat mêlée raté) --}}
{{#if woundTaken}}
<div class="resistance-wound-notice">
<span class="wound-icon">🩹</span>
<span>{{localize "CELESTOPOL.Roll.woundTaken"}}</span>
<span>{{#if isCombat}}{{localize "CELESTOPOL.Combat.playerWounded"}}{{else}}{{localize "CELESTOPOL.Roll.woundTaken"}}{{/if}}</span>
</div>
{{/if}}

View File

@@ -3,6 +3,14 @@
{{!-- En-tête : acteur + domaine + formule de base --}}
<div class="roll-info-block">
<div class="roll-actor">{{actorName}}</div>
{{!-- Arme (mode combat) --}}
{{#if isCombat}}
<div class="roll-weapon-line">
<span class="weapon-icon">⚔</span>
<span class="weapon-name">{{weaponName}}</span>
<span class="weapon-degats">+{{weaponDegats}}</span>
</div>
{{/if}}
<div class="roll-skill-line">
{{#if statLabel}}<span class="stat-label">{{localize statLabel}}</span><span class="sep"> </span>{{/if}}
<span class="skill-label">{{localize skillLabel}}</span>
@@ -24,7 +32,13 @@
<div class="roll-form-rows">
{{!-- Difficulté --}}
{{!-- Difficulté : sélect standard OU input Corps PNJ en combat --}}
{{#if isCombat}}
<div class="form-row-line form-corps-pnj">
<label for="corpsPnj">{{localize "CELESTOPOL.Combat.corpsPnj"}}</label>
<input type="number" id="corpsPnj" name="corpsPnj" value="7" min="1" max="30" class="corps-pnj-input">
</div>
{{else}}
<div class="form-row-line">
<label for="difficulty">{{localize "CELESTOPOL.Roll.difficulty"}}</label>
<select id="difficulty" name="difficulty">
@@ -35,6 +49,7 @@
{{/each}}
</select>
</div>
{{/if}}
{{!-- Options non disponibles en test de résistance --}}
{{#unless isResistance}}