# Copilot Instructions — fvtt-celestopol

## Project Overview

This is a **Foundry VTT system** for **Célestopol 1922**, a French tabletop RPG set in an art-deco 1922 universe. The project targets FoundryVTT v13+ and is developed in French.

The reference rulebooks are in `__regles/` (gitignored):
- *Célestopol 1922 Livre de base* — core rulebook
- *Célestopol 1922 Fiches de prêts à jouer* — pre-generated character sheets

## Architecture

This system uses **FoundryVTT v13 DataModels + ApplicationV2** — NOT the legacy template.json / AppV1 approach.

```
fvtt-celestopol.mjs          # Main entry point (Hooks.once("init"))
module/
  config/system.mjs          # All game constants (SYSTEM export)
  models/                    # TypeDataModel subclasses (character, npc, items)
  documents/                 # Actor, Item, ChatMessage, Roll wrappers
  applications/sheets/       # AppV2 sheets (HandlebarsApplicationMixin)
lang/fr.json                 # French i18n (key prefix: CELESTOPOL.*)
styles/                      # LESS source files
css/                         # Compiled CSS (via gulp)
templates/                   # Handlebars (.hbs) templates
assets/fonts/                # CopaseticNF art-deco font
assets/ui/                   # Background images
assets/icons/                # Item icons
packs-system/                # Source files for compendium packs
```

## DataModels (no template.json)

- Extend `foundry.abstract.TypeDataModel`
- Schema in `static defineSchema()` using `foundry.data.fields.*`
- `prepareDerivedData()` for computed values
- Files: `module/models/character.mjs`, `npc.mjs`, `items.mjs`

## ApplicationV2 / Sheets

- Actor sheets: `HandlebarsApplicationMixin(foundry.applications.sheets.ActorSheetV2)`
- Item sheets: `HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2)`
- `static DEFAULT_OPTIONS` for config; `static PARTS` for templates
- `_prepareContext()` for base context; `_preparePartContext(partId, context)` for per-tab
- Edit/Play mode toggle via `_sheetMode` + `isPlayMode`/`isEditMode` getters
- Actions: `static #onXxx(event, target)` private static methods in `DEFAULT_OPTIONS.actions`
- `form: { submitOnChange: true }` enables live saving

## Roll Mechanics

- Pool of d6 dice: `nbDice = max(1, skillValue + woundMalus)`
- Formula: `{n}d6 [+ moonBonus + modifier]`
- Moon phase bonus: Nouvelle Lune=0, Croissants=+1, Gibbeuse=+2, Pleine Lune=+3
- Compare total vs difficulty threshold (normal=7)
- Wound malus: levels 1-2=0, 3-4=-1, 5-6=-2, 7=-3, 8=-999 (out)
- DialogV2 for roll configuration: `foundry.applications.api.DialogV2.wait(...)`

## Game Data (4 stats × 4 skills)

- **Âme**: Artifice, Attraction, Coercition, Faveur
- **Corps**: Échauffourée, Effacement, Mobilité, Prouesse
- **Cœur**: Appréciation, Arts, Inspiration, Traque
- **Esprit**: Instruction, Merveilleux technologique, Raisonnement, Traitement

**Tracks**: Blessures (8 niveaux), Destin (8), Spleen (8)  
**Anomalies**: 9 types (none + 8)  
**Factions**: 8 standard + 2 custom

## Build

```bash
npm install          # Install dev deps
npx gulp css         # Compile LESS → css/fvtt-celestopol.css (once)
npx gulp             # Compile + watch
```

## Visual Style

- Font: **CopaseticNF** (Regular + Bold, in `assets/fonts/`) — art-deco style
- Header bg color: `rgb(12, 76, 12)` (dark green) with orange text (`#e07b00`)
- Sheet header texture: `assets/ui/fond_cadrille.jpg`
- CSS variables: `--cel-green`, `--cel-orange`, `--cel-font-title`, etc.

## Language

All in-game text, labels, and code comments should be in **French**. Code identifiers may be English. All i18n keys use the `CELESTOPOL.*` prefix (see `lang/fr.json`).

