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

@@ -239,18 +239,39 @@ export default class CelestopolCharacter extends foundry.abstract.TypeDataModel
const statData = this.stats[statId]
if (!statData) return null
/**
* Lance une attaque avec une arme (test Échauffourée vs Corps PNJ).
* Mêlée : échec → blessure joueur auto-cochée.
* Distance : échec → simple raté, pas de blessure joueur.
* Égalité (marge=0) → personne n'est blessé.
* @param {string} itemId - Id de l'item arme
*/
async rollAttack(itemId) {
const { CelestopolRoll } = await import("../documents/roll.mjs")
const item = this.parent.items.get(itemId)
if (!item || item.type !== "weapon") return null
const echauffouree = this.stats.corps.echauffouree
if (!echauffouree) return null
return CelestopolRoll.prompt({
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
statId,
statLabel: SYSTEM.STATS[statId]?.label,
skillLabel: "CELESTOPOL.Roll.resistanceTest",
skillValue: statData.res ?? 0,
woundMalus: this.getWoundMalus(),
woundLevel: this.blessures.lvl,
difficulty: this.prefs.difficulty,
isResistance: true,
actorId: this.parent.id,
actorName: this.parent.name,
actorImage: this.parent.img,
statId: "corps",
skillId: "echauffouree",
statLabel: SYSTEM.STATS.corps.label,
skillLabel: SYSTEM.SKILLS.corps.echauffouree.label,
skillValue: echauffouree.value,
woundMalus: this.getWoundMalus(),
woundLevel: this.blessures.lvl,
rollMoonDie: this.prefs.rollMoonDie ?? false,
destGaugeFull: this.destin.lvl > 0,
fortuneValue: this.attributs.fortune.value,
isCombat: true,
weaponType: item.system.type,
weaponName: item.name,
weaponDegats: item.system.degats,
})
}
}