feat: système de magie complet avec dialogue de lancement
- Modèle sortilege enrichi (type, niveau, portée, durée, conditions, effets) - Personnage: champ rangMagie (ensorceleur/initié/thaumaturge) - Constantes: SORTILEGE_MODIFICATEURS (table 3x3), RANG_MAGICIEN - Dialogue de lancement: tirage MJ, sélection atouts + Coupe, total temps réel - Calcul difficulté: carte MJ + modificateur selon type × niveau - Table des échecs magiques (normal/critique selon rang) - Pioche automatique après succès, défausse après échec - Template chat avec résultat localisé Corrections post-review: - Boucle de défausse sur échec corrigée (itérait toujours sur [0]) - Clé de localisation HAMALRON.Roll.cast -> HAMALRON.Sortilege.cast - Ajout de la clé manquante noCoupe - Labels localisés dans le chat (categorieLabel, niveauLabel)
This commit is contained in:
@@ -21,6 +21,7 @@ export default class HamalronPersonnageSheet extends HamalronActorSheet {
|
||||
modifyResistance: HamalronPersonnageSheet.#onModifyResistance,
|
||||
discardCard: HamalronPersonnageSheet.#onDiscardCard,
|
||||
rollCompetence: HamalronPersonnageSheet.#onRollCompetence,
|
||||
castSortilege: HamalronPersonnageSheet.#onCastSortilege,
|
||||
drawCard: HamalronPersonnageSheet.#onDrawCard,
|
||||
selectCard: HamalronPersonnageSheet.#onSelectCard,
|
||||
discardAndDraw: HamalronPersonnageSheet.#onDiscardAndDraw,
|
||||
@@ -345,6 +346,17 @@ export default class HamalronPersonnageSheet extends HamalronActorSheet {
|
||||
}
|
||||
}
|
||||
|
||||
static async #onCastSortilege(event, target) {
|
||||
const itemId = $(target).data("item-id")
|
||||
const item = this.document.items.get(itemId)
|
||||
if (!item || item.type !== "sortilege") {
|
||||
console.warn(`HamalronPersonnageSheet: Sortilege with ID ${itemId} not found`)
|
||||
return
|
||||
}
|
||||
const { default: HamalronSortilegeCasting } = await import("../sortilege-casting.mjs")
|
||||
await HamalronSortilegeCasting.prompt(item, this.document)
|
||||
}
|
||||
|
||||
static async #onRollCompetence(event, target) {
|
||||
const itemId = $(target).data("item-id")
|
||||
const item = this.document.items.get(itemId)
|
||||
|
||||
@@ -23,7 +23,9 @@ export default class HamalronSortilegeSheet extends HamalronItemSheet {
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description, { async: true })
|
||||
|
||||
context.enrichedEffetAmateur = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.effetAmateur, { async: true })
|
||||
context.enrichedEffetCompetent = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.effetCompetent, { async: true })
|
||||
context.enrichedEffetExpert = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.effetExpert, { async: true })
|
||||
return context
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user