refacto: harmonisation du système avec les règles Hamalron JDR

Corrections majeures :
- HamalronTirageTarot extends Roll (évaluation des jets fonctionnelle)
- Correction du nom de classe Langue (HamalronFaction -> HamalronLangue)
- Création du template tab-navigation.hbs manquant
- Type acteur 'character' -> 'personnage' dans _preCreate

Types d'items corrigés (anglais -> français) :
- weapon -> arme, armor -> armure, equipment -> equipement
- Suppression des types inexistants (deal, malefica, ritual, perk)

Modèles :
- cost -> cout (armure, equipement)
- Tarot : default -> initial
- Sortilege : LOCALIZATION_PREFIXES corrigé
- Constantes CHOICE_ADVANTAGES_DISADVANTAGES et ATTACK_MODIFIERS ajoutées
- ATTACK_MODIFIERS supprimé (plus utilisé)

Templates alignés sur les modèles réels :
- enemy-trait : suppression champs manquants (trauma, stats, domain...)
- personnage-equipement : champs alignés sur arme/armure/equipement
- personnage-sortileges : suppression domain/level/rituals
- enemy-main : suppression stats et flavorText
- base-actor : suppression mortality, toChat limité aux tarots

Jets de compétence :
- Égalité = réussite (>= au lieu de >, conforme aux règles p.155)
- Comparaison robuste des cartes de succès (via String())

Le Mat :
- Les autres joueurs peuvent renouveler leur main (règle p.151)

findTarotItem : recherche dans game.items puis compendiums
await manquants ajoutés sur saveDeckState()
AGENTS.md créé
This commit is contained in:
2026-07-10 18:52:20 +02:00
parent 4bc381f2e6
commit 68b3079da8
25 changed files with 257 additions and 570 deletions
+55
View File
@@ -0,0 +1,55 @@
# AGENTS.md — fvtt-hamalron
Foundry VTT **game system** (not a module) for Hamalron JDR, a French-language TTRPG.
System ID: `fvtt-hamalron` · Compatible FVTT v13v14 · Language: French only (`lang/fr.json`)
## Architecture
| Layer | Location | Notes |
|-------|----------|-------|
| Entrypoint | `fvtt-hamalron.mjs` | ES module, loaded via `system.json``esmodules` |
| Models | `module/models/*.mjs` | 12 data models (personnage, pnj, arme, armure, competence, equipement, faction, langue, peuple, region, sortilege, tarot) |
| Documents | `module/documents/*.mjs` | Actor, Item, ChatMessage, Roll (tirage-tarot) |
| Sheets | `module/applications/sheets/*.mjs` | App V2 sheets, one per item/actor type + base classes |
| Config | `module/config/system.mjs` | Exposes `globalThis.SYSTEM` with all game constants |
| Styles | `styles/*.less` → compiled to `css/fvtt-hamalron.css` |
| Templates | `templates/*.hbs` | Handlebars partials |
| Tarot deck | `module/applications/tarot-deck-manager.mjs` | Singleton manager, Fisher-Yates shuffle, GM-only |
## Commands
```sh
# Build CSS (LESS → CSS)
npx gulp css # one-shot compile
npx gulp # default: compile + watch
```
## Linting
```sh
npx eslint .
```
Uses ESLint 9 flat config (`eslint.config.mjs`) with Prettier + JSDoc plugins. Rules: `semi: never`, `quotes: double`, `indent: 2`.
## Compendium pack management
Pack data lives in `packs-system/hamalron-items/` (LevelDB format, used by Foundry at runtime).
The repo has `@foundryvtt/foundryvtt-cli` and tools for YAML ↔ LevelDB conversion:
- `tools/packCompendiumsToDist.mjs` — compiles from `packs_src/` (YAML) to `packs/` (.db)
- `tools/unpackCompendiumsFromDist.mjs` — extracts from `packs/` (.db) to `packs_src/` (YAML)
**Note:** `package.json` scripts reference `pushLDBtoYML`/`pullYMLtoLDB` — these files don't exist yet. Use the tool files directly: `node tools/packCompendiumsToDist.mjs` / `node tools/unpackCompendiumsFromDist.mjs` after creating the source directories.
## Gotchas
- **No tests** exist anywhere.
- **No CI/CD** (no `.github/` directory).
- **No typechecking** — plain JS with JSDoc comments.
- The `system.json` `hotReload` config references `lang/en.json` and `acks.css` — these files do **not** exist. Only `lang/fr.json` is shipped.
- All actor/item sheets are App V2 (unregistered core V1 sheets).
- Tarot deck state is persisted in a world-scope setting `tarotDeckState` (not a `Cards` document).
- Socket event handler is a no-op (`module/socket.mjs`).
- Initiative formula: `1d6` (no decimals).