Compare commits

..
1 Commits
Author SHA1 Message Date
ietm64 c2f162d823 Mentor d'écriture (M1-M3) : coach dans les champs, relecture d'éditeur, méthode guidée « Donjon en 5 salles »
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 13m48s
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 13m16s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 3m3s
Build & Push Images / build (core) (push) Successful in 4m50s
Build & Push Images / build (web) (push) Successful in 3m26s
Build & Push Images / build-switcher (push) Successful in 26s
Build & Push Images / build (brain) (push) Canceled after 1m5s
- M1 coach : bouton ampoule sur 17 champs narratifs (scène, chapitre, arc),
  panneau de conseils (à quoi ça sert, questions, exemple, piège classique).
  Contenu statique i18n fr/en, sans IA ; ampoule aussi dans l'en-tête des
  sections repliables (input coachTopic d'expandable-section).
- M2 relecture d'éditeur : WritingReviewService + GET
  /api/campaigns/{id}/writing-review, 10 règles déterministes WRITE-001 à 010
  (couloir, faux choix, révélation à chemin unique, rythme monotone, enjeux
  absents, narration trop longue ou qui décide à la place des PJ, combat sans
  but, fin unique, scènes non typées). Le back renvoie ruleId + params, les
  textes fr/en sont dans l'i18n. Panneau sur le hub, encart dans les éditeurs,
  liens « Voir » avec ?focus= (nouveaux focus : narration, choices, stakes).
- M3 méthode guidée : POST /api/campaigns/{id}/guided-skeleton (arc existant
  ou nouveau, chapitre, scènes typées, chaînage optionnel, transactionnel)
  + assistant pas à pas générique /campaigns/:id/guided/:method, première
  méthode « Donjon en 5 salles ». Entrées sur le hub de campagne.
- Garde-fous vitest : complétude des textes fr/en du coach, de la relecture
  (règles lues dans le Java) et des méthodes guidées.

Vérifié : core clean verify (1182 tests), web build + 299 tests vitest, lint
sans erreur, parcours testés dans l'appli (back Postgres de dev).
À redéployer : core (2 endpoints, aucune migration) + web.
2026-10-17 11:58:26 +02:00
59 changed files with 5533 additions and 40 deletions
@@ -0,0 +1,44 @@
package com.loremind.application.campaigncontext;
import com.loremind.domain.campaigncontext.structure.SceneType;
import java.util.List;
/**
* Squelette d'aventure produit par une méthode guidée (Mentor d'écriture, phase M3 —
* voir docs/conception-mentor-ecriture.md) : un chapitre et ses scènes, rédigés par le MJ
* question par question. Générique : chaque méthode (Donjon en 5 salles, puis M5) construit
* ce même squelette côté front ; le Core se contente de le persister d'un bloc.
*
* <p>Placement : soit {@code arcId} (arc LINÉAIRE existant de la campagne, le chapitre
* est ajouté à la suite), soit {@code newArcName} (nouvel arc linéaire créé à la suite).
* Exactement l'un des deux.</p>
*
* @param arcId arc existant où ajouter le chapitre, ou {@code null}
* @param newArcName nom du nouvel arc à créer, ou {@code null}
* @param chapter le chapitre (nom obligatoire)
* @param scenes les scènes, dans l'ordre (au moins une avec un nom)
* @param linkSequentially relier chaque scène à la suivante par une sortie
* @param linkLabel libellé de ces sorties (rédigé dans la langue du MJ par le front)
*/
public record GuidedSkeleton(
String arcId,
String newArcName,
ChapterSpec chapter,
List<SceneSpec> scenes,
boolean linkSequentially,
String linkLabel
) {
public record ChapterSpec(String name, String description, String playerObjectives, String narrativeStakes) {
}
public record SceneSpec(
String name, String description, SceneType type, String location,
String choicesConsequences, String gmSecretNotes, String enemies) {
}
/** Ce qui a été créé, pour que le front ouvre directement le chapitre. */
public record Result(String arcId, String chapterId, List<String> sceneIds) {
}
}
@@ -0,0 +1,157 @@
package com.loremind.application.campaigncontext;
import com.loremind.domain.campaigncontext.ports.ArcRepository;
import com.loremind.domain.campaigncontext.ports.ChapterRepository;
import com.loremind.domain.campaigncontext.ports.SceneRepository;
import com.loremind.domain.campaigncontext.structure.Arc;
import com.loremind.domain.campaigncontext.structure.ArcType;
import com.loremind.domain.campaigncontext.structure.Chapter;
import com.loremind.domain.campaigncontext.structure.LinkType;
import com.loremind.domain.campaigncontext.structure.Scene;
import com.loremind.domain.campaigncontext.structure.SceneBranch;
import com.loremind.domain.campaigncontext.structure.SceneType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Persiste d'un bloc le squelette d'une méthode guidée (Mentor d'écriture, phase M3) :
* arc (existant ou nouveau) → chapitre → scènes typées, éventuellement reliées en chaîne.
*
* <p>Ne fait qu'ajouter : rien d'existant n'est modifié, à part l'ordre naturel (le nouvel
* arc et le nouveau chapitre se placent à la suite). Transactionnel : tout ou rien.</p>
*/
@Service
public class GuidedSkeletonService {
private final ArcRepository arcRepository;
private final ChapterRepository chapterRepository;
private final SceneRepository sceneRepository;
private final ArcService arcService;
private final ChapterService chapterService;
private final SceneService sceneService;
public GuidedSkeletonService(ArcRepository arcRepository,
ChapterRepository chapterRepository,
SceneRepository sceneRepository,
ArcService arcService,
ChapterService chapterService,
SceneService sceneService) {
this.arcRepository = arcRepository;
this.chapterRepository = chapterRepository;
this.sceneRepository = sceneRepository;
this.arcService = arcService;
this.chapterService = chapterService;
this.sceneService = sceneService;
}
/**
* @throws IllegalArgumentException squelette invalide (placement ambigu, chapitre ou scènes sans nom,
* arc d'une autre campagne ou non linéaire)
*/
@Transactional
public GuidedSkeleton.Result create(String campaignId, GuidedSkeleton skeleton) {
validate(skeleton);
List<GuidedSkeleton.SceneSpec> specs = skeleton.scenes().stream()
.filter(s -> s != null && !isBlank(s.name()))
.toList();
String arcId = resolveArc(campaignId, skeleton);
Chapter chapter = createChapter(arcId, skeleton.chapter());
List<Scene> scenes = new ArrayList<>();
int order = 0;
for (GuidedSkeleton.SceneSpec spec : specs) {
scenes.add(sceneService.createScene(Scene.builder()
.name(spec.name().trim())
.description(blankToNull(spec.description()))
.type(Objects.requireNonNullElse(spec.type(), SceneType.GENERIC))
.location(blankToNull(spec.location()))
.choicesConsequences(blankToNull(spec.choicesConsequences()))
.gmSecretNotes(blankToNull(spec.gmSecretNotes()))
.enemies(blankToNull(spec.enemies()))
.chapterId(chapter.getId())
.order(order++)
.build()));
}
if (skeleton.linkSequentially()) {
linkInChain(scenes, isBlank(skeleton.linkLabel()) ? "→" : skeleton.linkLabel().trim());
}
return new GuidedSkeleton.Result(arcId, chapter.getId(), scenes.stream().map(Scene::getId).toList());
}
private static void validate(GuidedSkeleton skeleton) {
if (skeleton == null) {
throw new IllegalArgumentException("Squelette manquant.");
}
boolean hasArc = !isBlank(skeleton.arcId());
boolean hasNewArc = !isBlank(skeleton.newArcName());
if (hasArc == hasNewArc) {
throw new IllegalArgumentException("Indiquer soit un arc existant, soit le nom d'un nouvel arc.");
}
if (skeleton.chapter() == null || isBlank(skeleton.chapter().name())) {
throw new IllegalArgumentException("Le chapitre doit avoir un nom.");
}
if (skeleton.scenes() == null || skeleton.scenes().stream().noneMatch(s -> s != null && !isBlank(s.name()))) {
throw new IllegalArgumentException("Il faut au moins une scène nommée.");
}
}
/** Arc existant (vérifié : même campagne, linéaire) ou nouvel arc linéaire placé à la suite. */
private String resolveArc(String campaignId, GuidedSkeleton skeleton) {
List<Arc> arcs = arcRepository.findByCampaignId(campaignId);
if (!isBlank(skeleton.arcId())) {
Arc arc = arcs.stream().filter(a -> skeleton.arcId().equals(a.getId())).findFirst()
.orElseThrow(() -> new IllegalArgumentException("Arc introuvable dans cette campagne."));
if (arc.getType() != ArcType.LINEAR) {
throw new IllegalArgumentException("Une méthode guidée s'ajoute à un arc linéaire.");
}
return arc.getId();
}
// L'arc SYSTEM (« Quêtes libres », ordre 9999) reste en dernier : on ne le compte pas.
int nextOrder = arcs.stream().filter(a -> a.getType() != ArcType.SYSTEM)
.mapToInt(Arc::getOrder).max().orElse(-1) + 1;
return arcService.createArc(Arc.builder()
.name(skeleton.newArcName().trim())
.campaignId(campaignId)
.type(ArcType.LINEAR)
.order(nextOrder)
.build()).getId();
}
private Chapter createChapter(String arcId, GuidedSkeleton.ChapterSpec spec) {
int nextOrder = chapterRepository.findByArcId(arcId).stream()
.mapToInt(Chapter::getOrder).max().orElse(-1) + 1;
return chapterService.createChapter(Chapter.builder()
.name(spec.name().trim())
.description(blankToNull(spec.description()))
.playerObjectives(blankToNull(spec.playerObjectives()))
.narrativeStakes(blankToNull(spec.narrativeStakes()))
.arcId(arcId)
.order(nextOrder)
.build());
}
/** Chaque scène reçoit une sortie vers la suivante (la dernière n'en a pas). */
private void linkInChain(List<Scene> scenes, String label) {
for (int i = 0; i < scenes.size() - 1; i++) {
Scene scene = scenes.get(i);
scene.setBranches(new ArrayList<>(List.of(
new SceneBranch(label, scenes.get(i + 1).getId(), null, LinkType.EXIT))));
sceneRepository.save(scene);
}
}
private static boolean isBlank(String s) {
return s == null || s.isBlank();
}
private static String blankToNull(String s) {
return isBlank(s) ? null : s.trim();
}
}
@@ -0,0 +1,35 @@
package com.loremind.application.campaigncontext;
import com.loremind.domain.campaigncontext.readiness.ReadinessEntityType;
import com.loremind.domain.campaigncontext.writingreview.WritingRemarkCategory;
import java.util.Map;
/**
* Une remarque de relecture d'éditeur (Mentor d'écriture, phase M2) : un conseil
* d'auteur sur la QUALITÉ de l'écriture, pas sur la complétude (ça, c'est le readiness).
*
* <p>Contrairement à {@link ReadinessGap}, le back ne rédige pas le texte : il
* renvoie la règle et ses paramètres, et le front compose observation / pourquoi /
* question depuis l'i18n ({@code writingReview.rules.<ruleId>}), en fr comme en en.</p>
*
* @param entityType type de l'entité concernée (réutilise celui du readiness pour les liens profonds)
* @param entityId id de l'entité concernée
* @param entityName libellé lisible de l'entité
* @param ruleId identifiant stable de la règle (ex. {@code WRITE-002-FAKE-CHOICE})
* @param category famille de la remarque (regroupement à l'affichage)
* @param params valeurs à injecter dans le texte i18n (ex. {@code count}, {@code phrase})
* @param arcId arc parent (navigation), ou {@code null}
* @param chapterId chapitre parent (navigation), ou {@code null}
*/
public record WritingRemark(
ReadinessEntityType entityType,
String entityId,
String entityName,
String ruleId,
WritingRemarkCategory category,
Map<String, String> params,
String arcId,
String chapterId
) {
}
@@ -0,0 +1,12 @@
package com.loremind.application.campaigncontext;
import java.util.List;
/**
* Relecture d'éditeur d'une campagne (Mentor d'écriture, phase M2).
*
* @param campaignId campagne relue
* @param remarks remarques dans l'ordre de l'arbre (campagne, puis arc par arc)
*/
public record WritingReviewReport(String campaignId, List<WritingRemark> remarks) {
}
@@ -0,0 +1,333 @@
package com.loremind.application.campaigncontext;
import com.loremind.domain.campaigncontext.Campaign;
import com.loremind.domain.campaigncontext.ports.ArcRepository;
import com.loremind.domain.campaigncontext.ports.CampaignRepository;
import com.loremind.domain.campaigncontext.ports.ChapterRepository;
import com.loremind.domain.campaigncontext.ports.QuestRepository;
import com.loremind.domain.campaigncontext.ports.SceneRepository;
import com.loremind.domain.campaigncontext.quest.Quest;
import com.loremind.domain.campaigncontext.readiness.ReadinessEntityType;
import com.loremind.domain.campaigncontext.structure.Arc;
import com.loremind.domain.campaigncontext.structure.ArcType;
import com.loremind.domain.campaigncontext.structure.Chapter;
import com.loremind.domain.campaigncontext.structure.Scene;
import com.loremind.domain.campaigncontext.structure.SceneBranch;
import com.loremind.domain.campaigncontext.structure.SceneType;
import com.loremind.domain.campaigncontext.writingreview.WritingRemarkCategory;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* Relecture d'éditeur (Mentor d'écriture, phase M2 — voir docs/conception-mentor-ecriture.md) :
* conseils d'auteur sur la QUALITÉ de l'écriture (vrais choix, rythme, enjeux, narration),
* là où le readiness ({@link CampaignReadinessService}) ne juge que la complétude.
*
* <p><b>Déterministe, sans IA, sans persistance</b> ; même chargement en une passe que le
* readiness (arcs → chapitres → scènes). Purement indicatif : une remarque est un conseil,
* jamais un blocage. Le texte est composé côté front à partir de {@code ruleId} + {@code params}.</p>
*
* <p>L'arc SYSTEM (« Quêtes libres ») est de la plomberie invisible : ses chapitres-conteneurs
* ne reçoivent pas de remarque de niveau chapitre, mais leurs scènes sont relues comme les autres.</p>
*/
@Service
public class WritingReviewService {
/** WRITE-001 : à partir de combien de scènes un chapitre sans aucun choix devient un couloir. */
static final int CORRIDOR_MIN_SCENES = 3;
/** WRITE-003 : nombre minimal de chemins menant à une révélation (en deçà : un seul chemin). */
static final int REVELATION_MIN_INCOMING = 2;
/** WRITE-004 : longueur d'une suite de scènes du même genre jugée monotone. */
static final int MONOTONOUS_RUN = 3;
/** WRITE-006 : au-delà, la narration dépasse ~1 min de lecture à voix haute (~900 car./min). */
static final int LONG_NARRATION_CHARS = 1200;
/** WRITE-010 : nombre minimal de scènes pour juger la part de scènes non typées. */
static final int UNTYPED_MIN_SCENES = 5;
/** WRITE-010 : part de scènes « génériques » au-delà de laquelle on conseille de typer. */
static final double UNTYPED_RATIO = 0.7;
/** Genre « combat » pour WRITE-004 (les autres genres = nom du {@link SceneType}). */
static final String KIND_COMBAT = "COMBAT";
/**
* WRITE-007 : la narration décide à la place des personnages (action ou émotion imposée).
* Volontairement restreint aux tournures sans ambiguïté, pour éviter les faux positifs.
*/
private static final Pattern NARRATION_DECIDES = Pattern.compile(
"\\b(vous (?:décidez|choisissez|ressentez|avez (?:très |si )?peur"
+ "|êtes (?:terrifié|effrayé|terrorisé|paniqué|soulagé|ému)e?s?"
+ "|entrez|vous précipitez|dégainez|attaquez|fuyez)"
+ "|you (?:decide|choose|feel (?:afraid|scared|uneasy|relieved|guilty)"
+ "|are (?:afraid|scared|terrified|relieved|panicking)"
+ "|enter|rush|draw your|attack|flee))\\b",
Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.UNICODE_CHARACTER_CLASS);
private final CampaignRepository campaignRepository;
private final ArcRepository arcRepository;
private final ChapterRepository chapterRepository;
private final SceneRepository sceneRepository;
private final QuestRepository questRepository;
public WritingReviewService(CampaignRepository campaignRepository,
ArcRepository arcRepository,
ChapterRepository chapterRepository,
SceneRepository sceneRepository,
QuestRepository questRepository) {
this.campaignRepository = campaignRepository;
this.arcRepository = arcRepository;
this.chapterRepository = chapterRepository;
this.sceneRepository = sceneRepository;
this.questRepository = questRepository;
}
/** Relit toute la campagne et renvoie les remarques dans l'ordre de l'arbre. */
public WritingReviewReport review(String campaignId) {
List<WritingRemark> campaignRemarks = new ArrayList<>();
List<WritingRemark> treeRemarks = new ArrayList<>();
Set<String> arcsWithQuests = questRepository.findByCampaignId(campaignId).stream()
.map(Quest::getArcId).filter(id -> !isBlank(id)).collect(Collectors.toSet());
List<Arc> arcs = new ArrayList<>(arcRepository.findByCampaignId(campaignId));
arcs.sort(Comparator.comparingInt(Arc::getOrder));
int totalScenes = 0;
int genericScenes = 0;
for (Arc arc : arcs) {
List<Chapter> chapters = new ArrayList<>(chapterRepository.findByArcId(arc.getId()));
chapters.sort(Comparator.comparingInt(Chapter::getOrder));
boolean visibleArc = arc.getType() != ArcType.SYSTEM;
// WRITE-005 (arc) : seulement sur un arc qui a déjà du contenu.
if (visibleArc && isBlank(arc.getStakes())
&& (!chapters.isEmpty() || arcsWithQuests.contains(arc.getId()))) {
treeRemarks.add(arcRemark(arc, "WRITE-005-NO-STAKES", WritingRemarkCategory.STAKES, Map.of()));
}
List<Scene> lastChapterScenes = List.of();
for (Chapter chapter : chapters) {
List<Scene> scenes = new ArrayList<>(sceneRepository.findByChapterId(chapter.getId()));
scenes.sort(Comparator.comparingInt(Scene::getOrder));
totalScenes += scenes.size();
genericScenes += (int) scenes.stream().filter(s -> typeOf(s) == SceneType.GENERIC).count();
if (visibleArc) {
reviewChapter(arc, chapter, scenes, treeRemarks);
}
for (Scene scene : scenes) {
reviewScene(arc, chapter, scene, scenes, treeRemarks);
}
if (!scenes.isEmpty()) {
lastChapterScenes = scenes;
}
}
if (arc.getType() == ArcType.LINEAR && !lastChapterScenes.isEmpty()) {
checkSingleEnding(arc, lastChapterScenes, treeRemarks);
}
}
// WRITE-010 — trop de scènes non typées pour juger le rythme.
if (totalScenes >= UNTYPED_MIN_SCENES && (double) genericScenes / totalScenes > UNTYPED_RATIO) {
String campaignName = campaignRepository.findById(campaignId).map(Campaign::getName).orElse(null);
int pct = (int) Math.round(100.0 * genericScenes / totalScenes);
campaignRemarks.add(new WritingRemark(ReadinessEntityType.CAMPAIGN, campaignId, campaignName,
"WRITE-010-UNTYPED-SCENES", WritingRemarkCategory.PACING,
Map.of("percent", String.valueOf(pct), "count", String.valueOf(genericScenes)),
null, null));
}
List<WritingRemark> remarks = new ArrayList<>(campaignRemarks);
remarks.addAll(treeRemarks);
return new WritingReviewReport(campaignId, remarks);
}
// --- Niveau chapitre ---------------------------------------------------------------
private void reviewChapter(Arc arc, Chapter chapter, List<Scene> scenes, List<WritingRemark> out) {
if (scenes.isEmpty()) return; // Chapitre vide : c'est l'affaire du readiness (CHAP-001).
// WRITE-001 — couloir : plusieurs scènes, aucune sortie ni aucun choix décrit.
boolean anyBranch = scenes.stream().anyMatch(WritingReviewService::hasBranches);
boolean anyChoice = scenes.stream().anyMatch(s -> !isBlank(s.getChoicesConsequences()));
if (scenes.size() >= CORRIDOR_MIN_SCENES && !anyBranch && !anyChoice) {
out.add(chapterRemark(arc, chapter, "WRITE-001-CORRIDOR", WritingRemarkCategory.AGENCY,
Map.of("count", String.valueOf(scenes.size()))));
}
// WRITE-004 — rythme monotone : N scènes d'affilée du même genre.
MonotonousRun run = findMonotonousRun(scenes);
if (run != null) {
out.add(chapterRemark(arc, chapter, "WRITE-004-MONOTONOUS-PACING", WritingRemarkCategory.PACING,
Map.of("count", String.valueOf(run.length()), "kind", run.kind())));
}
// WRITE-005 (chapitre) — aucun enjeu narratif écrit.
if (isBlank(chapter.getNarrativeStakes())) {
out.add(chapterRemark(arc, chapter, "WRITE-005-NO-STAKES", WritingRemarkCategory.STAKES, Map.of()));
}
}
private record MonotonousRun(String kind, int length) {}
/** Première suite d'au moins {@link #MONOTONOUS_RUN} scènes consécutives du même genre, sinon null. */
private static MonotonousRun findMonotonousRun(List<Scene> scenes) {
String currentKind = null;
int length = 0;
MonotonousRun found = null;
for (Scene scene : scenes) {
String kind = pacingKind(scene);
if (kind != null && kind.equals(currentKind)) {
length++;
} else {
if (found != null) return found;
currentKind = kind;
length = kind == null ? 0 : 1;
}
if (length >= MONOTONOUS_RUN) {
found = new MonotonousRun(currentKind, length);
}
}
return found;
}
/** Genre d'une scène pour le rythme : COMBAT, sinon son type s'il est renseigné, sinon null. */
private static String pacingKind(Scene scene) {
if (isCombat(scene)) return KIND_COMBAT;
SceneType type = typeOf(scene);
return type == SceneType.GENERIC ? null : type.name();
}
// --- Niveau scène -------------------------------------------------------------------
private void reviewScene(Arc arc, Chapter chapter, Scene scene, List<Scene> chapterScenes,
List<WritingRemark> out) {
checkFakeChoice(arc, chapter, scene, chapterScenes, out);
checkSingleClue(arc, chapter, scene, chapterScenes, out);
checkNarration(arc, chapter, scene, out);
checkCombatPurpose(arc, chapter, scene, out);
}
/** WRITE-002 — faux carrefour : plusieurs sorties qui mènent toutes au même endroit. */
private void checkFakeChoice(Arc arc, Chapter chapter, Scene scene, List<Scene> chapterScenes,
List<WritingRemark> out) {
List<SceneBranch> branches = scene.getBranches();
if (branches == null || branches.size() < 2) return;
Set<String> targets = branches.stream().map(SceneBranch::targetSceneId).collect(Collectors.toSet());
if (targets.size() != 1) return;
String target = targets.iterator().next();
if (isBlank(target)) return; // Branche cassée : c'est l'affaire du readiness (SCENE-010).
String targetName = chapterScenes.stream()
.filter(s -> target.equals(s.getId())).map(Scene::getName)
.filter(n -> !isBlank(n)).findFirst().orElse("?");
out.add(sceneRemark(arc, chapter, scene, "WRITE-002-FAKE-CHOICE", WritingRemarkCategory.AGENCY,
Map.of("count", String.valueOf(branches.size()), "target", targetName)));
}
/**
* WRITE-003 — révélation à chemin unique (règle des 3 indices). Seulement dans un
* chapitre qui utilise des liens : sans aucun lien, c'est WRITE-001 qui parle.
*/
private void checkSingleClue(Arc arc, Chapter chapter, Scene scene, List<Scene> chapterScenes,
List<WritingRemark> out) {
if (typeOf(scene) != SceneType.REVELATION || isBlank(scene.getId())) return;
if (chapterScenes.stream().noneMatch(WritingReviewService::hasBranches)) return;
long incoming = chapterScenes.stream()
.filter(s -> !scene.getId().equals(s.getId()) && s.getBranches() != null)
.flatMap(s -> s.getBranches().stream().map(SceneBranch::targetSceneId).distinct())
.filter(scene.getId()::equals)
.count();
if (incoming < REVELATION_MIN_INCOMING) {
out.add(sceneRemark(arc, chapter, scene, "WRITE-003-SINGLE-CLUE", WritingRemarkCategory.AGENCY,
Map.of("incoming", String.valueOf(incoming))));
}
}
/** WRITE-006 — narration trop longue ; WRITE-007 — narration qui décide à la place des PJ. */
private void checkNarration(Arc arc, Chapter chapter, Scene scene, List<WritingRemark> out) {
String narration = scene.getPlayerNarration();
if (isBlank(narration)) return;
int length = narration.strip().length();
if (length > LONG_NARRATION_CHARS) {
out.add(sceneRemark(arc, chapter, scene, "WRITE-006-LONG-NARRATION", WritingRemarkCategory.NARRATION,
Map.of("chars", String.valueOf(length))));
}
Matcher m = NARRATION_DECIDES.matcher(narration);
if (m.find()) {
out.add(sceneRemark(arc, chapter, scene, "WRITE-007-NARRATION-DECIDES", WritingRemarkCategory.NARRATION,
Map.of("phrase", m.group(1))));
}
}
/** WRITE-008 — combat sans but : ni choix décrits, ni notes sur les motivations des ennemis. */
private void checkCombatPurpose(Arc arc, Chapter chapter, Scene scene, List<WritingRemark> out) {
if (isCombat(scene) && isBlank(scene.getChoicesConsequences()) && isBlank(scene.getGmSecretNotes())) {
out.add(sceneRemark(arc, chapter, scene, "WRITE-008-COMBAT-NO-PURPOSE", WritingRemarkCategory.STAKES,
Map.of()));
}
}
// --- Niveau arc -----------------------------------------------------------------------
/** WRITE-009 — fin unique : la dernière scène de l'arc ne prévoit ni sortie ni alternative. */
private void checkSingleEnding(Arc arc, List<Scene> lastChapterScenes, List<WritingRemark> out) {
Scene finale = lastChapterScenes.get(lastChapterScenes.size() - 1);
if (!hasBranches(finale) && isBlank(finale.getChoicesConsequences())) {
out.add(new WritingRemark(ReadinessEntityType.SCENE, finale.getId(), labelOr(finale.getName(), "Scène"),
"WRITE-009-SINGLE-ENDING", WritingRemarkCategory.AGENCY,
Map.of("arc", labelOr(arc.getName(), "Arc")), arc.getId(), finale.getChapterId()));
}
}
// --- Helpers ----------------------------------------------------------------------------
private static boolean isCombat(Scene scene) {
return typeOf(scene) == SceneType.ENCOUNTER
|| !isBlank(scene.getCombatDifficulty())
|| !isBlank(scene.getEnemies())
|| (scene.getEnemyIds() != null && scene.getEnemyIds().stream().anyMatch(id -> !isBlank(id)));
}
private static boolean hasBranches(Scene scene) {
return scene.getBranches() != null && !scene.getBranches().isEmpty();
}
private static SceneType typeOf(Scene scene) {
return Objects.requireNonNullElse(scene.getType(), SceneType.GENERIC);
}
private static WritingRemark sceneRemark(Arc arc, Chapter chapter, Scene scene, String ruleId,
WritingRemarkCategory category, Map<String, String> params) {
return new WritingRemark(ReadinessEntityType.SCENE, scene.getId(), labelOr(scene.getName(), "Scène"),
ruleId, category, params, arc.getId(), chapter.getId());
}
private static WritingRemark chapterRemark(Arc arc, Chapter chapter, String ruleId,
WritingRemarkCategory category, Map<String, String> params) {
return new WritingRemark(ReadinessEntityType.CHAPTER, chapter.getId(), labelOr(chapter.getName(), "Chapitre"),
ruleId, category, params, arc.getId(), chapter.getId());
}
private static WritingRemark arcRemark(Arc arc, String ruleId, WritingRemarkCategory category,
Map<String, String> params) {
return new WritingRemark(ReadinessEntityType.ARC, arc.getId(), labelOr(arc.getName(), "Arc"),
ruleId, category, params, arc.getId(), null);
}
private static boolean isBlank(String s) {
return s == null || s.isBlank();
}
private static String labelOr(String value, String fallback) {
return isBlank(value) ? fallback : value;
}
}
@@ -0,0 +1,17 @@
package com.loremind.domain.campaigncontext.writingreview;
/**
* Famille d'une remarque de relecture (Mentor d'écriture, phase M2). Sert à
* regrouper les conseils côté front ; n'implique aucune gravité : une remarque de
* relecture est un conseil d'auteur, jamais un blocage.
*/
public enum WritingRemarkCategory {
/** Pouvoir des joueurs : vrais choix, chemins multiples, issues alternatives. */
AGENCY,
/** Rythme : variété des scènes, lisibilité de la structure. */
PACING,
/** Enjeux : ce que les joueurs risquent, pourquoi l'adversité agit. */
STAKES,
/** Narration : textes lus aux joueurs. */
NARRATION
}
@@ -0,0 +1,43 @@
package com.loremind.infrastructure.web.controller;
import com.loremind.application.campaigncontext.GuidedSkeleton;
import com.loremind.application.campaigncontext.GuidedSkeletonService;
import com.loremind.domain.campaigncontext.ports.CampaignRepository;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* REST Controller des méthodes guidées (Mentor d'écriture, phase M3) : persiste le
* squelette (arc → chapitre → scènes) construit question par question par le MJ.
*
* <p>201 + ids créés ; 400 si le squelette est invalide ({@code GlobalExceptionHandler}) ;
* 404 si la campagne est inconnue.</p>
*/
@RestController
@RequestMapping("/api/campaigns/{campaignId}/guided-skeleton")
public class GuidedSkeletonController {
private final GuidedSkeletonService guidedSkeletonService;
private final CampaignRepository campaignRepository;
public GuidedSkeletonController(GuidedSkeletonService guidedSkeletonService,
CampaignRepository campaignRepository) {
this.guidedSkeletonService = guidedSkeletonService;
this.campaignRepository = campaignRepository;
}
@PostMapping
public ResponseEntity<GuidedSkeleton.Result> create(@PathVariable String campaignId,
@RequestBody GuidedSkeleton skeleton) {
if (!campaignRepository.existsById(campaignId)) {
return ResponseEntity.notFound().build();
}
// Squelette invalide : IllegalArgumentException → 400 via GlobalExceptionHandler.
return ResponseEntity.status(HttpStatus.CREATED).body(guidedSkeletonService.create(campaignId, skeleton));
}
}
@@ -0,0 +1,39 @@
package com.loremind.infrastructure.web.controller;
import com.loremind.application.campaigncontext.WritingReviewReport;
import com.loremind.application.campaigncontext.WritingReviewService;
import com.loremind.domain.campaigncontext.ports.CampaignRepository;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* REST Controller de la relecture d'éditeur (Mentor d'écriture, phase M2) : conseils
* d'auteur sur la qualité de l'écriture d'une campagne.
*
* <p>Read-model pur, toujours 200 quand la campagne existe (les remarques conseillent,
* elles ne bloquent rien). 404 si la campagne est inconnue.</p>
*/
@RestController
@RequestMapping("/api/campaigns/{campaignId}/writing-review")
public class WritingReviewController {
private final WritingReviewService writingReviewService;
private final CampaignRepository campaignRepository;
public WritingReviewController(WritingReviewService writingReviewService,
CampaignRepository campaignRepository) {
this.writingReviewService = writingReviewService;
this.campaignRepository = campaignRepository;
}
@GetMapping
public ResponseEntity<WritingReviewReport> getWritingReview(@PathVariable String campaignId) {
if (!campaignRepository.existsById(campaignId)) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.ok(writingReviewService.review(campaignId));
}
}
@@ -0,0 +1,199 @@
package com.loremind.application.campaigncontext;
import com.loremind.domain.campaigncontext.ports.ArcRepository;
import com.loremind.domain.campaigncontext.ports.ChapterRepository;
import com.loremind.domain.campaigncontext.ports.SceneRepository;
import com.loremind.domain.campaigncontext.structure.Arc;
import com.loremind.domain.campaigncontext.structure.ArcType;
import com.loremind.domain.campaigncontext.structure.Chapter;
import com.loremind.domain.campaigncontext.structure.Scene;
import com.loremind.domain.campaigncontext.structure.SceneType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* Test unitaire pour {@link GuidedSkeletonService} (Mentor d'écriture, phase M3) :
* placement (nouvel arc / arc existant), champs reportés, chaînage des scènes, validations.
*/
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
class GuidedSkeletonServiceTest {
private static final String CAMP = "camp";
@Mock private ArcRepository arcRepository;
@Mock private ChapterRepository chapterRepository;
@Mock private SceneRepository sceneRepository;
@Mock private ArcService arcService;
@Mock private ChapterService chapterService;
@Mock private SceneService sceneService;
@InjectMocks private GuidedSkeletonService service;
private final List<Scene> createdScenes = new ArrayList<>();
@BeforeEach
void stubCreations() {
AtomicInteger ids = new AtomicInteger();
when(arcService.createArc(any(Arc.class))).thenAnswer(inv -> {
Arc a = inv.getArgument(0);
a.setId("new-arc");
return a;
});
when(chapterService.createChapter(any(Chapter.class))).thenAnswer(inv -> {
Chapter c = inv.getArgument(0);
c.setId("new-chap");
return c;
});
when(sceneService.createScene(any(Scene.class))).thenAnswer(inv -> {
Scene s = inv.getArgument(0);
s.setId("scene-" + ids.incrementAndGet());
createdScenes.add(s);
return s;
});
}
private static GuidedSkeleton.SceneSpec room(String name, SceneType type) {
return new GuidedSkeleton.SceneSpec(name, "Ce qui s'y passe", type, "La crypte",
"Combattre ou négocier", "Le gardien protège son frère", null);
}
private static GuidedSkeleton skeleton(String arcId, String newArcName, boolean link) {
return new GuidedSkeleton(arcId, newArcName,
new GuidedSkeleton.ChapterSpec("La crypte oubliée", "Une accroche", "Retrouver le reliquaire", "Le village sera maudit"),
List.of(room("Salle 1", SceneType.ENCOUNTER), room("Salle 2", SceneType.LOCATION), room("Salle 3", SceneType.REVELATION)),
link, "Vers la salle suivante");
}
@Test
void newArc_isLinear_andPlacedAfterVisibleArcs_beforeSystemArc() {
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of(
Arc.builder().id("a1").type(ArcType.LINEAR).order(0).build(),
Arc.builder().id("a2").type(ArcType.HUB).order(1).build(),
Arc.builder().id("sys").type(ArcType.SYSTEM).order(9999).build()));
GuidedSkeleton.Result result = service.create(CAMP, skeleton(null, "Les terres brûlées", false));
ArgumentCaptor<Arc> arc = ArgumentCaptor.forClass(Arc.class);
verify(arcService).createArc(arc.capture());
assertEquals(ArcType.LINEAR, arc.getValue().getType());
assertEquals(2, arc.getValue().getOrder());
assertEquals(CAMP, arc.getValue().getCampaignId());
assertEquals("new-arc", result.arcId());
assertEquals("new-chap", result.chapterId());
assertEquals(List.of("scene-1", "scene-2", "scene-3"), result.sceneIds());
}
@Test
void existingArc_chapterAppendedAfterExistingChapters_withItsFields() {
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of(
Arc.builder().id("a1").type(ArcType.LINEAR).order(0).build()));
when(chapterRepository.findByArcId("a1")).thenReturn(List.of(
Chapter.builder().id("c1").arcId("a1").order(0).build(),
Chapter.builder().id("c2").arcId("a1").order(3).build()));
service.create(CAMP, skeleton("a1", null, false));
verify(arcService, never()).createArc(any(Arc.class));
ArgumentCaptor<Chapter> chapter = ArgumentCaptor.forClass(Chapter.class);
verify(chapterService).createChapter(chapter.capture());
assertEquals("a1", chapter.getValue().getArcId());
assertEquals(4, chapter.getValue().getOrder());
assertEquals("Retrouver le reliquaire", chapter.getValue().getPlayerObjectives());
assertEquals("Le village sera maudit", chapter.getValue().getNarrativeStakes());
}
@Test
void scenes_keepOrderTypeAndFields() {
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of());
service.create(CAMP, skeleton(null, "Arc", false));
assertEquals(3, createdScenes.size());
Scene first = createdScenes.get(0);
assertEquals(0, first.getOrder());
assertEquals("new-chap", first.getChapterId());
assertEquals(SceneType.ENCOUNTER, first.getType());
assertEquals("La crypte", first.getLocation());
assertEquals("Combattre ou négocier", first.getChoicesConsequences());
assertEquals("Le gardien protège son frère", first.getGmSecretNotes());
assertEquals(SceneType.REVELATION, createdScenes.get(2).getType());
assertEquals(2, createdScenes.get(2).getOrder());
}
@Test
void linkSequentially_chainsEachSceneToTheNext_lastHasNoExit() {
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of());
service.create(CAMP, skeleton(null, "Arc", true));
verify(sceneRepository, times(2)).save(any(Scene.class));
assertEquals("scene-2", createdScenes.get(0).getBranches().get(0).targetSceneId());
assertEquals("Vers la salle suivante", createdScenes.get(0).getBranches().get(0).label());
assertEquals("scene-3", createdScenes.get(1).getBranches().get(0).targetSceneId());
assertTrue(createdScenes.get(2).getBranches() == null || createdScenes.get(2).getBranches().isEmpty());
}
@Test
void unnamedScenes_areSkipped_andBlankFieldsStoredAsNull() {
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of());
GuidedSkeleton s = new GuidedSkeleton(null, "Arc",
new GuidedSkeleton.ChapterSpec("Chap", " ", null, null),
List.of(new GuidedSkeleton.SceneSpec("Salle", " ", null, "", null, null, null),
new GuidedSkeleton.SceneSpec(" ", "ignorée", SceneType.EVENT, null, null, null, null)),
false, null);
service.create(CAMP, s);
assertEquals(1, createdScenes.size());
assertNull(createdScenes.get(0).getDescription());
assertNull(createdScenes.get(0).getLocation());
assertEquals(SceneType.GENERIC, createdScenes.get(0).getType());
}
@Test
void rejects_ambiguousPlacement() {
assertThrows(IllegalArgumentException.class, () -> service.create(CAMP, skeleton("a1", "Arc", false)));
assertThrows(IllegalArgumentException.class, () -> service.create(CAMP, skeleton(null, " ", false)));
}
@Test
void rejects_arcOfAnotherCampaign_orNonLinearArc() {
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of(
Arc.builder().id("hub").type(ArcType.HUB).order(0).build()));
assertThrows(IllegalArgumentException.class, () -> service.create(CAMP, skeleton("ailleurs", null, false)));
assertThrows(IllegalArgumentException.class, () -> service.create(CAMP, skeleton("hub", null, false)));
verify(chapterService, never()).createChapter(any(Chapter.class));
}
@Test
void rejects_missingChapterName_orNoNamedScene() {
GuidedSkeleton noChapterName = new GuidedSkeleton(null, "Arc",
new GuidedSkeleton.ChapterSpec(" ", null, null, null), List.of(room("S", null)), false, null);
GuidedSkeleton noScene = new GuidedSkeleton(null, "Arc",
new GuidedSkeleton.ChapterSpec("Chap", null, null, null),
List.of(new GuidedSkeleton.SceneSpec("", null, null, null, null, null, null)), false, null);
assertThrows(IllegalArgumentException.class, () -> service.create(CAMP, noChapterName));
assertThrows(IllegalArgumentException.class, () -> service.create(CAMP, noScene));
}
}
@@ -0,0 +1,322 @@
package com.loremind.application.campaigncontext;
import com.loremind.domain.campaigncontext.Campaign;
import com.loremind.domain.campaigncontext.ports.ArcRepository;
import com.loremind.domain.campaigncontext.ports.CampaignRepository;
import com.loremind.domain.campaigncontext.ports.ChapterRepository;
import com.loremind.domain.campaigncontext.ports.QuestRepository;
import com.loremind.domain.campaigncontext.ports.SceneRepository;
import com.loremind.domain.campaigncontext.quest.Quest;
import com.loremind.domain.campaigncontext.readiness.ReadinessEntityType;
import com.loremind.domain.campaigncontext.structure.Arc;
import com.loremind.domain.campaigncontext.structure.ArcType;
import com.loremind.domain.campaigncontext.structure.Chapter;
import com.loremind.domain.campaigncontext.structure.Scene;
import com.loremind.domain.campaigncontext.structure.SceneBranch;
import com.loremind.domain.campaigncontext.structure.SceneType;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.when;
/**
* Test unitaire pour {@link WritingReviewService} (Mentor d'écriture, phase M2).
* Chaque règle WRITE-xxx a son cas positif ET un cas qui ne doit PAS la déclencher
* (le mentor doit rester sobre : un faux positif décourage le débutant).
*/
@ExtendWith(MockitoExtension.class)
class WritingReviewServiceTest {
private static final String CAMP = "camp";
@Mock private CampaignRepository campaignRepository;
@Mock private ArcRepository arcRepository;
@Mock private ChapterRepository chapterRepository;
@Mock private SceneRepository sceneRepository;
@Mock private QuestRepository questRepository;
@InjectMocks private WritingReviewService service;
// --- helpers ---
private static Arc arc(String id, ArcType type) {
return Arc.builder().id(id).name(id).campaignId(CAMP).type(type).order(0).stakes("Le village brûle").build();
}
private static Chapter chapter(String id, String arcId) {
return Chapter.builder().id(id).name(id).arcId(arcId).order(0).narrativeStakes("Un allié en danger").build();
}
/** Scène « propre » : typée, avec un choix décrit (ne déclenche aucune règle seule). */
private static Scene.SceneBuilder scene(String id, int order) {
return Scene.builder().id(id).name(id).chapterId("chap").order(order)
.type(SceneType.NPC).choicesConsequences("Convaincre ou menacer");
}
private void tree(Arc arc, Chapter chapter, List<Scene> scenes) {
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of(arc));
when(chapterRepository.findByArcId(arc.getId())).thenReturn(List.of(chapter));
when(sceneRepository.findByChapterId(chapter.getId())).thenReturn(scenes);
}
private void tree(List<Scene> scenes) {
tree(arc("arc", ArcType.HUB), chapter("chap", "arc"), scenes);
}
private Set<String> ruleIds() {
return service.review(CAMP).remarks().stream().map(WritingRemark::ruleId).collect(Collectors.toSet());
}
private WritingRemark remark(String ruleId) {
return service.review(CAMP).remarks().stream().filter(r -> r.ruleId().equals(ruleId))
.findFirst().orElseThrow(() -> new AssertionError("Règle absente : " + ruleId));
}
@Test
void emptyCampaign_hasNoRemark() {
assertTrue(service.review(CAMP).remarks().isEmpty());
}
@Test
void wellWrittenChapter_hasNoRemark() {
tree(List.of(scene("s1", 0).build(), scene("s2", 1).type(SceneType.LOCATION).build()));
assertTrue(service.review(CAMP).remarks().isEmpty());
}
// --- WRITE-001 : couloir ---
@Test
void corridor_threeScenesWithoutChoiceNorBranch() {
tree(List.of(
scene("s1", 0).choicesConsequences(null).build(),
scene("s2", 1).choicesConsequences(null).type(SceneType.LOCATION).build(),
scene("s3", 2).choicesConsequences(null).build()));
WritingRemark r = remark("WRITE-001-CORRIDOR");
assertEquals(ReadinessEntityType.CHAPTER, r.entityType());
assertEquals("3", r.params().get("count"));
}
@Test
void corridor_notRaised_whenOneSceneOffersAChoice() {
tree(List.of(
scene("s1", 0).choicesConsequences(null).build(),
scene("s2", 1).type(SceneType.LOCATION).build(),
scene("s3", 2).choicesConsequences(null).build()));
assertFalse(ruleIds().contains("WRITE-001-CORRIDOR"));
}
// --- WRITE-002 : faux carrefour ---
@Test
void fakeChoice_allBranchesLeadToSameScene() {
Scene target = scene("s2", 1).name("La crypte").type(SceneType.LOCATION).build();
tree(List.of(
scene("s1", 0).branches(List.of(SceneBranch.of("A", "s2"), SceneBranch.of("B", "s2"))).build(),
target));
WritingRemark r = remark("WRITE-002-FAKE-CHOICE");
assertEquals("s1", r.entityId());
assertEquals("La crypte", r.params().get("target"));
assertEquals("2", r.params().get("count"));
}
@Test
void fakeChoice_notRaised_whenBranchesDiverge() {
tree(List.of(
scene("s1", 0).branches(List.of(SceneBranch.of("A", "s2"), SceneBranch.of("B", "s3"))).build(),
scene("s2", 1).type(SceneType.LOCATION).build(),
scene("s3", 2).build()));
assertFalse(ruleIds().contains("WRITE-002-FAKE-CHOICE"));
}
// --- WRITE-003 : révélation à chemin unique ---
@Test
void singleClue_revelationReachableByOnePath() {
tree(List.of(
scene("s1", 0).branches(List.of(SceneBranch.of("A", "rev"))).build(),
scene("rev", 1).type(SceneType.REVELATION).build()));
assertEquals("1", remark("WRITE-003-SINGLE-CLUE").params().get("incoming"));
}
@Test
void singleClue_notRaised_withTwoPaths_orInChapterWithoutLinks() {
tree(List.of(
scene("s1", 0).branches(List.of(SceneBranch.of("A", "rev"))).build(),
scene("s2", 1).type(SceneType.LOCATION).branches(List.of(SceneBranch.of("B", "rev"))).build(),
scene("rev", 2).type(SceneType.REVELATION).build()));
assertFalse(ruleIds().contains("WRITE-003-SINGLE-CLUE"));
}
@Test
void singleClue_notRaised_inChapterWithoutAnyLink() {
tree(List.of(scene("s1", 0).build(), scene("rev", 1).type(SceneType.REVELATION).build()));
assertFalse(ruleIds().contains("WRITE-003-SINGLE-CLUE"));
}
// --- WRITE-004 : rythme monotone ---
@Test
void monotonousPacing_threeFightsInARow() {
tree(List.of(
scene("s1", 0).type(SceneType.ENCOUNTER).build(),
scene("s2", 1).enemies("Deux gobelins").build(),
scene("s3", 2).combatDifficulty("Difficile").build(),
scene("s4", 3).type(SceneType.LOCATION).build()));
WritingRemark r = remark("WRITE-004-MONOTONOUS-PACING");
assertEquals("COMBAT", r.params().get("kind"));
assertEquals("3", r.params().get("count"));
}
@Test
void monotonousPacing_notRaised_whenVaried_orUntyped() {
tree(List.of(
scene("s1", 0).type(SceneType.ENCOUNTER).build(),
scene("s2", 1).type(SceneType.NPC).build(),
scene("s3", 2).type(SceneType.ENCOUNTER).build(),
scene("s4", 3).type(SceneType.GENERIC).build(),
scene("s5", 4).type(SceneType.GENERIC).build(),
scene("s6", 5).type(SceneType.GENERIC).build()));
assertFalse(ruleIds().contains("WRITE-004-MONOTONOUS-PACING"));
}
// --- WRITE-005 : sans enjeu ---
@Test
void noStakes_onChapterAndArc() {
Arc a = Arc.builder().id("arc").name("Arc").campaignId(CAMP).type(ArcType.LINEAR).order(0).build();
Chapter c = Chapter.builder().id("chap").name("Chap").arcId("arc").order(0).build();
tree(a, c, List.of(scene("s1", 0).branches(List.of(SceneBranch.of("A", "s1"))).build()));
List<WritingRemark> remarks = service.review(CAMP).remarks().stream()
.filter(r -> r.ruleId().equals("WRITE-005-NO-STAKES")).toList();
assertEquals(Set.of(ReadinessEntityType.ARC, ReadinessEntityType.CHAPTER),
remarks.stream().map(WritingRemark::entityType).collect(Collectors.toSet()));
}
@Test
void noStakes_notRaised_onEmptyArc_norOnSystemArc() {
Arc empty = Arc.builder().id("empty").name("Vide").campaignId(CAMP).type(ArcType.LINEAR).order(0).build();
Arc system = Arc.builder().id("sys").name("Quêtes libres").campaignId(CAMP).type(ArcType.SYSTEM).order(9999).build();
Chapter container = Chapter.builder().id("box").name("Q").arcId("sys").order(0).build();
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of(empty, system));
when(chapterRepository.findByArcId("empty")).thenReturn(List.of());
when(chapterRepository.findByArcId("sys")).thenReturn(List.of(container));
when(sceneRepository.findByChapterId("box")).thenReturn(List.of(scene("s1", 0).build()));
assertFalse(ruleIds().contains("WRITE-005-NO-STAKES"));
}
@Test
void noStakes_raisedOnHubArcCarriedByQuests() {
Arc hub = Arc.builder().id("hub").name("Hub").campaignId(CAMP).type(ArcType.HUB).order(0).build();
when(arcRepository.findByCampaignId(CAMP)).thenReturn(List.of(hub));
when(questRepository.findByCampaignId(CAMP))
.thenReturn(List.of(Quest.builder().id("q").campaignId(CAMP).arcId("hub").build()));
assertEquals(ReadinessEntityType.ARC, remark("WRITE-005-NO-STAKES").entityType());
}
// --- WRITE-006 / WRITE-007 : narration ---
@Test
void longNarration_overThreshold() {
String text = "a".repeat(WritingReviewService.LONG_NARRATION_CHARS + 1);
tree(List.of(scene("s1", 0).playerNarration(text).build()));
assertEquals(String.valueOf(text.length()), remark("WRITE-006-LONG-NARRATION").params().get("chars"));
}
@Test
void narrationDecides_capturesThePhrase_inFrenchAndEnglish() {
tree(List.of(scene("s1", 0).playerNarration("La porte grince. Vous avez peur et reculez.").build()));
assertEquals("Vous avez peur", remark("WRITE-007-NARRATION-DECIDES").params().get("phrase"));
}
@Test
void narrationDecides_english() {
tree(List.of(scene("s1", 0).playerNarration("The door creaks open. You enter the hall.").build()));
assertEquals("You enter", remark("WRITE-007-NARRATION-DECIDES").params().get("phrase"));
}
@Test
void narration_notRaised_whenDescriptiveAndShort() {
tree(List.of(scene("s1", 0)
.playerNarration("La porte grince. Une odeur de cire flotte dans l'air. Que faites-vous ?").build()));
Set<String> ids = ruleIds();
assertFalse(ids.contains("WRITE-006-LONG-NARRATION"));
assertFalse(ids.contains("WRITE-007-NARRATION-DECIDES"));
}
// --- WRITE-008 : combat sans but ---
@Test
void combatWithoutPurpose() {
tree(List.of(scene("s1", 0).type(SceneType.ENCOUNTER).choicesConsequences(null).build()));
assertEquals("s1", remark("WRITE-008-COMBAT-NO-PURPOSE").entityId());
}
@Test
void combatWithoutPurpose_notRaised_whenGmNotesExplainMotives() {
tree(List.of(scene("s1", 0).type(SceneType.ENCOUNTER).choicesConsequences(null)
.gmSecretNotes("Ils veulent couler la barque").build()));
assertFalse(ruleIds().contains("WRITE-008-COMBAT-NO-PURPOSE"));
}
// --- WRITE-009 : fin unique ---
@Test
void singleEnding_onLastSceneOfLinearArc() {
tree(arc("arc", ArcType.LINEAR), chapter("chap", "arc"), List.of(
scene("s1", 0).build(),
scene("final", 1).type(SceneType.LOCATION).choicesConsequences(null).build()));
WritingRemark r = remark("WRITE-009-SINGLE-ENDING");
assertEquals("final", r.entityId());
assertEquals("arc", r.params().get("arc"));
}
@Test
void singleEnding_notRaised_onHubArc_orWhenFinaleHasChoices() {
tree(arc("arc", ArcType.HUB), chapter("chap", "arc"),
List.of(scene("final", 0).choicesConsequences(null).build()));
assertFalse(ruleIds().contains("WRITE-009-SINGLE-ENDING"));
}
// --- WRITE-010 : scènes non typées ---
@Test
void untypedScenes_whenMostScenesAreGeneric() {
List<Scene> scenes = new ArrayList<>(IntStream.range(0, 5)
.mapToObj(i -> scene("s" + i, i).type(SceneType.GENERIC).build()).toList());
tree(scenes);
when(campaignRepository.findById(CAMP))
.thenReturn(Optional.of(Campaign.builder().id(CAMP).name("Ma campagne").build()));
WritingRemark r = remark("WRITE-010-UNTYPED-SCENES");
assertEquals(ReadinessEntityType.CAMPAIGN, r.entityType());
assertEquals("100", r.params().get("percent"));
// Remarque de campagne en tête de liste.
assertEquals("WRITE-010-UNTYPED-SCENES", service.review(CAMP).remarks().get(0).ruleId());
}
@Test
void untypedScenes_notRaised_belowMinimumSceneCount() {
tree(List.of(scene("s1", 0).type(SceneType.GENERIC).build()));
assertFalse(ruleIds().contains("WRITE-010-UNTYPED-SCENES"));
}
}
+25 -2
View File
@@ -18,7 +18,9 @@
Le code source de ce script est public et auditable a l'adresse indiquee dans .LINK. Le code source de ce script est public et auditable a l'adresse indiquee dans .LINK.
.PARAMETER InstallDir .PARAMETER InstallDir
Dossier d'installation. Defaut : %LOCALAPPDATA%\DM Loremind Dossier d'installation. Defaut : %LOCALAPPDATA%\DM Loremind Docker
(PAS "%LOCALAPPDATA%\DM Loremind" : ce dossier est celui de l'application
bureau .msi — les deux produits ne doivent jamais partager un dossier).
.PARAMETER ComposeUrl .PARAMETER ComposeUrl
URL du fichier docker-compose.yml a recuperer. Defaut : version officielle du depot. URL du fichier docker-compose.yml a recuperer. Defaut : version officielle du depot.
@@ -48,7 +50,7 @@
[CmdletBinding()] [CmdletBinding()]
param( param(
[string]$InstallDir = "$env:LOCALAPPDATA\DM Loremind", [string]$InstallDir = "$env:LOCALAPPDATA\DM Loremind Docker",
[string]$ComposeUrl = "https://raw.githubusercontent.com/IGMLcreation/LoreMind/main/docker-compose.yml", [string]$ComposeUrl = "https://raw.githubusercontent.com/IGMLcreation/LoreMind/main/docker-compose.yml",
[int]$WebPort = 8081, [int]$WebPort = 8081,
[switch]$NonInteractive [switch]$NonInteractive
@@ -204,6 +206,27 @@ if (Test-Docker) {
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# 3. Dossier d'installation + docker-compose.yml # 3. Dossier d'installation + docker-compose.yml
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Compat : les stacks historiques vivaient dans "%LOCALAPPDATA%\DM Loremind",
# desormais reserve a l'application bureau (.msi jpackage, meme nom produit —
# une maj du .msi pouvait ecraser compose/.env). Si un stack y est deja
# installe (compose present, pas d'exe bureau), on le reutilise plutot que
# d'en creer un second qui entrerait en conflit (memes noms de conteneurs).
$legacyDir = "$env:LOCALAPPDATA\DM Loremind"
if ($InstallDir -eq "$env:LOCALAPPDATA\DM Loremind Docker" -and
(Test-Path (Join-Path $legacyDir 'docker-compose.yml')) -and
-not (Test-Path (Join-Path $legacyDir 'DM Loremind.exe'))) {
Write-Warn2 "Stack Docker existant detecte dans $legacyDir - reutilise (pas de duplication)."
$InstallDir = $legacyDir
}
# Garde-fou : jamais d'installation du stack Docker dans le dossier de
# l'application bureau (le .msi et le stack s'ecraseraient mutuellement).
if (Test-Path (Join-Path $InstallDir 'DM Loremind.exe')) {
Write-Err "Le dossier $InstallDir contient l'application bureau DM Loremind (.msi)."
Write-Err "La version Docker doit vivre ailleurs : relancez avec -InstallDir <autre dossier>."
exit 1
}
Write-Step "Preparation du dossier $InstallDir" Write-Step "Preparation du dossier $InstallDir"
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
Set-Location $InstallDir Set-Location $InstallDir
+1
View File
@@ -23,3 +23,4 @@
<app-global-search></app-global-search> <app-global-search></app-global-search>
<app-confirm-dialog-host></app-confirm-dialog-host> <app-confirm-dialog-host></app-confirm-dialog-host>
<app-writing-coach-panel></app-writing-coach-panel>
+2
View File
@@ -6,6 +6,7 @@ import { SecondarySidebarComponent } from './shared/secondary-sidebar/secondary-
import { GlobalSearchComponent } from './shared/global-search/global-search.component'; import { GlobalSearchComponent } from './shared/global-search/global-search.component';
import { UpdateBannerComponent } from './shared/update-banner/update-banner.component'; import { UpdateBannerComponent } from './shared/update-banner/update-banner.component';
import { ConfirmDialogHostComponent } from './shared/confirm-dialog/confirm-dialog-host.component'; import { ConfirmDialogHostComponent } from './shared/confirm-dialog/confirm-dialog-host.component';
import { WritingCoachPanelComponent } from './shared/writing-coach/writing-coach-panel.component';
import { LayoutService } from './services/layout.service'; import { LayoutService } from './services/layout.service';
import { GlobalSearchService } from './services/global-search.service'; import { GlobalSearchService } from './services/global-search.service';
import { VersionCheckerService } from './services/version-checker.service'; import { VersionCheckerService } from './services/version-checker.service';
@@ -19,6 +20,7 @@ import { VersionCheckerService } from './services/version-checker.service';
GlobalSearchComponent, GlobalSearchComponent,
UpdateBannerComponent, UpdateBannerComponent,
ConfirmDialogHostComponent, ConfirmDialogHostComponent,
WritingCoachPanelComponent,
AsyncPipe AsyncPipe
], ],
templateUrl: './app.component.html', templateUrl: './app.component.html',
+1
View File
@@ -45,6 +45,7 @@ export const routes: Routes = [
{ path: 'campaigns/:campaignId/random-tables/:tableId/edit', loadComponent: () => import('./campaigns/random-table/random-table-edit/random-table-edit.component').then(m => m.RandomTableEditComponent) }, { path: 'campaigns/:campaignId/random-tables/:tableId/edit', loadComponent: () => import('./campaigns/random-table/random-table-edit/random-table-edit.component').then(m => m.RandomTableEditComponent) },
{ path: 'campaigns/:campaignId/random-tables/:tableId', loadComponent: () => import('./campaigns/random-table/random-table-view/random-table-view.component').then(m => m.RandomTableViewComponent) }, { path: 'campaigns/:campaignId/random-tables/:tableId', loadComponent: () => import('./campaigns/random-table/random-table-view/random-table-view.component').then(m => m.RandomTableViewComponent) },
{ path: 'campaigns/:campaignId/arcs/create', loadComponent: () => import('./campaigns/arc/arc-create/arc-create.component').then(m => m.ArcCreateComponent) }, { path: 'campaigns/:campaignId/arcs/create', loadComponent: () => import('./campaigns/arc/arc-create/arc-create.component').then(m => m.ArcCreateComponent) },
{ path: 'campaigns/:campaignId/guided/:method', loadComponent: () => import('./campaigns/guided/guided-wizard/guided-wizard.component').then(m => m.GuidedWizardComponent) },
{ path: 'campaigns/:campaignId/arcs/:arcId', loadComponent: () => import('./campaigns/arc/arc-view/arc-view.component').then(m => m.ArcViewComponent) }, { path: 'campaigns/:campaignId/arcs/:arcId', loadComponent: () => import('./campaigns/arc/arc-view/arc-view.component').then(m => m.ArcViewComponent) },
{ path: 'campaigns/:campaignId/arcs/:arcId/edit', loadComponent: () => import('./campaigns/arc/arc-edit/arc-edit.component').then(m => m.ArcEditComponent) }, { path: 'campaigns/:campaignId/arcs/:arcId/edit', loadComponent: () => import('./campaigns/arc/arc-edit/arc-edit.component').then(m => m.ArcEditComponent) },
{ path: 'campaigns/:campaignId/arcs/:arcId/chapters/create', loadComponent: () => import('./campaigns/chapter/chapter-create/chapter-create.component').then(m => m.ChapterCreateComponent) }, { path: 'campaigns/:campaignId/arcs/:arcId/chapters/create', loadComponent: () => import('./campaigns/chapter/chapter-create/chapter-create.component').then(m => m.ChapterCreateComponent) },
@@ -29,6 +29,9 @@
<!-- Tout est optionnel sauf le titre : identité visible, le reste replié. --> <!-- Tout est optionnel sauf le titre : identité visible, le reste replié. -->
<p class="optional-hint">{{ 'arcEdit.optionalHint' | translate }}</p> <p class="optional-hint">{{ 'arcEdit.optionalHint' | translate }}</p>
<!-- Mentor d'écriture (M2) : conseils de relecture qui concernent cette entité. -->
<app-writing-review-hints [campaignId]="campaignId" entityType="ARC" [entityId]="arcId"></app-writing-review-hints>
<!-- Co-création (Pilier A) : le co-MJ propose, validation champ par champ → remplit le formulaire. --> <!-- Co-création (Pilier A) : le co-MJ propose, validation champ par champ → remplit le formulaire. -->
<app-entity-assist-panel <app-entity-assist-panel
[entityType]="'arc'" [entityId]="arcId" [campaignId]="campaignId" [entityType]="'arc'" [entityId]="arcId" [campaignId]="campaignId"
@@ -47,7 +50,10 @@
</div> </div>
<div class="field"> <div class="field">
<label for="arc-edit-description">{{ 'arcEdit.synopsisLabel' | translate }}</label> <div class="field-label-row">
<label for="arc-edit-description">{{ 'arcEdit.synopsisLabel' | translate }}</label>
<app-writing-coach-trigger topic="arc.synopsis"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="arc-edit-description" id="arc-edit-description"
formControlName="description" formControlName="description"
@@ -89,10 +95,13 @@
</app-expandable-section> </app-expandable-section>
<!-- Thèmes et enjeux --> <!-- Thèmes et enjeux -->
<app-expandable-section [title]="'arcEdit.themesStakesSectionTitle' | translate" icon="🎭" [filled]="themesStakesFilled"> <app-expandable-section [title]="'arcEdit.themesStakesSectionTitle' | translate" icon="🎭" [initiallyOpen]="focusSection === 'stakes'" [filled]="themesStakesFilled">
<div class="field-row"> <div class="field-row">
<div class="field"> <div class="field">
<label for="arc-edit-themes">{{ 'arcEdit.themesLabel' | translate }}</label> <div class="field-label-row">
<label for="arc-edit-themes">{{ 'arcEdit.themesLabel' | translate }}</label>
<app-writing-coach-trigger topic="arc.themes"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="arc-edit-themes" id="arc-edit-themes"
formControlName="themes" formControlName="themes"
@@ -101,7 +110,10 @@
</textarea> </textarea>
</div> </div>
<div class="field"> <div class="field">
<label for="arc-edit-stakes">{{ 'arcEdit.stakesLabel' | translate }}</label> <div class="field-label-row">
<label for="arc-edit-stakes">{{ 'arcEdit.stakesLabel' | translate }}</label>
<app-writing-coach-trigger topic="arc.stakes"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="arc-edit-stakes" id="arc-edit-stakes"
formControlName="stakes" formControlName="stakes"
@@ -129,7 +141,10 @@
<!-- Récompenses et dénouement --> <!-- Récompenses et dénouement -->
<app-expandable-section [title]="'arcEdit.rewardsResolutionSectionTitle' | translate" icon="🎁" [filled]="rewardsResolutionFilled"> <app-expandable-section [title]="'arcEdit.rewardsResolutionSectionTitle' | translate" icon="🎁" [filled]="rewardsResolutionFilled">
<div class="field"> <div class="field">
<label for="arc-edit-rewards">{{ 'arcEdit.rewardsLabel' | translate }}</label> <div class="field-label-row">
<label for="arc-edit-rewards">{{ 'arcEdit.rewardsLabel' | translate }}</label>
<app-writing-coach-trigger topic="arc.rewards"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="arc-edit-rewards" id="arc-edit-rewards"
formControlName="rewards" formControlName="rewards"
@@ -138,7 +153,10 @@
</textarea> </textarea>
</div> </div>
<div class="field"> <div class="field">
<label for="arc-edit-resolution">{{ 'arcEdit.resolutionLabel' | translate }}</label> <div class="field-label-row">
<label for="arc-edit-resolution">{{ 'arcEdit.resolutionLabel' | translate }}</label>
<app-writing-coach-trigger topic="arc.resolution"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="arc-edit-resolution" id="arc-edit-resolution"
formControlName="resolution" formControlName="resolution"
@@ -26,6 +26,8 @@ import { CAMPAIGN_ICON_OPTIONS } from '../../campaign-icons';
import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service'; import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service';
import { EntityAssistPanelComponent } from '../../../shared/entity-assist-panel/entity-assist-panel.component'; import { EntityAssistPanelComponent } from '../../../shared/entity-assist-panel/entity-assist-panel.component';
import { FieldProposal } from '../../../services/entity-assist.model'; import { FieldProposal } from '../../../services/entity-assist.model';
import { WritingCoachTriggerComponent } from '../../../shared/writing-coach/writing-coach-trigger.component';
import { WritingReviewHintsComponent } from '../../../shared/writing-review/writing-review-hints.component';
/** /**
* Écran de détail/modification d'un Arc. * Écran de détail/modification d'un Arc.
@@ -38,7 +40,7 @@ import { FieldProposal } from '../../../services/entity-assist.model';
*/ */
@Component({ @Component({
selector: 'app-arc-edit', selector: 'app-arc-edit',
imports: [ReactiveFormsModule, LucideAngularModule, LoreLinkPickerComponent, AiChatDrawerComponent, ImageGalleryComponent, IconPickerComponent, ExpandableSectionComponent, EntityAssistPanelComponent, TranslatePipe], imports: [ReactiveFormsModule, LucideAngularModule, LoreLinkPickerComponent, AiChatDrawerComponent, ImageGalleryComponent, IconPickerComponent, ExpandableSectionComponent, EntityAssistPanelComponent, TranslatePipe, WritingCoachTriggerComponent, WritingReviewHintsComponent],
templateUrl: './arc-edit.component.html', templateUrl: './arc-edit.component.html',
styleUrls: ['./arc-edit.component.scss'] styleUrls: ['./arc-edit.component.scss']
}) })
@@ -74,6 +76,9 @@ export class ArcEditComponent implements OnInit {
arcId = ''; arcId = '';
arc: Arc | null = null; arc: Arc | null = null;
/** `?focus=stakes` (lien « Voir » de la relecture d'éditeur) → section dépliée d'office. */
focusSection: string | null = null;
/** Pages disponibles pour le picker (vide si la campagne n'a pas de loreId). */ /** Pages disponibles pour le picker (vide si la campagne n'a pas de loreId). */
availablePages: Page[] = []; availablePages: Page[] = [];
/** ID du Lore associé à la campagne (null si campagne sans univers). */ /** ID du Lore associé à la campagne (null si campagne sans univers). */
@@ -135,6 +140,7 @@ export class ArcEditComponent implements OnInit {
if (newArcId !== this.arcId || newCampaignId !== this.campaignId) { if (newArcId !== this.arcId || newCampaignId !== this.campaignId) {
this.campaignId = newCampaignId; this.campaignId = newCampaignId;
this.arcId = newArcId; this.arcId = newArcId;
this.focusSection = this.route.snapshot.queryParamMap.get('focus');
this.loadAll(); this.loadAll();
} }
}); });
@@ -62,6 +62,8 @@
<!-- ============ Guidage co-MJ : « Prochaines étapes » (Pilier B) ============ --> <!-- ============ Guidage co-MJ : « Prochaines étapes » (Pilier B) ============ -->
@if (!editing && campaign.id) { @if (!editing && campaign.id) {
<app-readiness-panel [campaignId]="campaign.id" [assessment]="readiness"></app-readiness-panel> <app-readiness-panel [campaignId]="campaign.id" [assessment]="readiness"></app-readiness-panel>
<!-- Mentor d'écriture (M2) : conseils d'auteur sur la qualité, à côté de la complétude. -->
<app-writing-review-panel [campaignId]="campaign.id"></app-writing-review-panel>
} }
<!-- ============ Header : mode édition inline ============ --> <!-- ============ Header : mode édition inline ============ -->
@if (editing) { @if (editing) {
@@ -206,6 +208,11 @@
<lucide-icon [img]="Plus" [size]="14"></lucide-icon> <lucide-icon [img]="Plus" [size]="14"></lucide-icon>
{{ 'campaignDetail.newArc' | translate }} {{ 'campaignDetail.newArc' | translate }}
</button> </button>
<!-- Mentor d'écriture (M3) : écrire une aventure question par question. -->
<a class="btn-add btn-guided" [routerLink]="['/campaigns', campaign.id, 'guided', 'five-room']">
<lucide-icon [img]="Sparkles" [size]="14"></lucide-icon>
{{ 'guided.entry' | translate }}
</a>
</div> </div>
</div> </div>
@if (arcs.length > 0 && !showQuickAddScene) { @if (arcs.length > 0 && !showQuickAddScene) {
@@ -235,6 +242,10 @@
<lucide-icon [img]="Plus" [size]="14"></lucide-icon> <lucide-icon [img]="Plus" [size]="14"></lucide-icon>
{{ 'campaignDetail.quickSceneFirst' | translate }} {{ 'campaignDetail.quickSceneFirst' | translate }}
</button> </button>
<a class="btn-add-first btn-guided" [routerLink]="['/campaigns', campaign.id, 'guided', 'five-room']">
<lucide-icon [img]="Sparkles" [size]="14"></lucide-icon>
{{ 'guided.entryFirst' | translate }}
</a>
<button type="button" class="empty-alt-action" (click)="createArc()"> <button type="button" class="empty-alt-action" (click)="createArc()">
{{ 'campaignDetail.organizeInArcs' | translate }} {{ 'campaignDetail.organizeInArcs' | translate }}
</button> </button>
@@ -486,6 +486,18 @@
&:hover { background: #5b52e0; } &:hover { background: #5b52e0; }
} }
// Entrée « Méthode guidée » (Mentor d'écriture, M3) : un lien stylé en bouton,
// accent ambré du mentor pour le distinguer des créations « à la main ».
.btn-guided {
text-decoration: none;
background: rgba(251, 191, 36, 0.12);
color: #fde68a;
border: 1px solid rgba(251, 191, 36, 0.35);
&:hover { background: rgba(251, 191, 36, 0.2); }
&:focus-visible { outline: 2px solid #6c63ff; outline-offset: 2px; }
}
// Action secondaire de l'état vide (« ou créer un arc ») — bouton texte discret. // Action secondaire de l'état vide (« ou créer un arc ») — bouton texte discret.
.empty-alt-action { .empty-alt-action {
background: none; background: none;
@@ -32,11 +32,12 @@ import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dia
import { FolderGroup, groupByFolder, byOrder } from '../../../shared/folder-grouping.util'; import { FolderGroup, groupByFolder, byOrder } from '../../../shared/folder-grouping.util';
import { CampaignReadinessAssessment } from '../../../services/readiness.model'; import { CampaignReadinessAssessment } from '../../../services/readiness.model';
import { ReadinessPanelComponent } from '../../../shared/readiness-panel/readiness-panel.component'; import { ReadinessPanelComponent } from '../../../shared/readiness-panel/readiness-panel.component';
import { WritingReviewPanelComponent } from '../../../shared/writing-review/writing-review-panel.component';
import { FoundryExportDialogComponent } from '../foundry-export-dialog/foundry-export-dialog.component'; import { FoundryExportDialogComponent } from '../foundry-export-dialog/foundry-export-dialog.component';
@Component({ @Component({
selector: 'app-campaign-detail', selector: 'app-campaign-detail',
imports: [FormsModule, LucideAngularModule, RouterLink, TranslatePipe, CdkDropList, CdkDrag, ReadinessPanelComponent, FoundryExportDialogComponent], imports: [FormsModule, LucideAngularModule, RouterLink, TranslatePipe, CdkDropList, CdkDrag, ReadinessPanelComponent, WritingReviewPanelComponent, FoundryExportDialogComponent],
templateUrl: './campaign-detail.component.html', templateUrl: './campaign-detail.component.html',
styleUrls: ['./campaign-detail.component.scss'] styleUrls: ['./campaign-detail.component.scss']
}) })
@@ -29,6 +29,9 @@
<!-- Tout est optionnel sauf le titre : identité visible, le reste replié. --> <!-- Tout est optionnel sauf le titre : identité visible, le reste replié. -->
<p class="optional-hint">{{ 'chapterEdit.optionalHint' | translate }}</p> <p class="optional-hint">{{ 'chapterEdit.optionalHint' | translate }}</p>
<!-- Mentor d'écriture (M2) : conseils de relecture qui concernent cette entité. -->
<app-writing-review-hints [campaignId]="campaignId" entityType="CHAPTER" [entityId]="chapterId"></app-writing-review-hints>
<!-- Co-création (Pilier A) : le co-MJ propose, validation champ par champ → remplit le formulaire. --> <!-- Co-création (Pilier A) : le co-MJ propose, validation champ par champ → remplit le formulaire. -->
<app-entity-assist-panel <app-entity-assist-panel
[entityType]="'chapter'" [entityId]="chapterId" [campaignId]="campaignId" [entityType]="'chapter'" [entityId]="chapterId" [campaignId]="campaignId"
@@ -53,7 +56,10 @@
</div> </div>
<div class="field"> <div class="field">
<label for="chapter-edit-description">{{ 'chapterEdit.synopsisLabel' | translate }}</label> <div class="field-label-row">
<label for="chapter-edit-description">{{ 'chapterEdit.synopsisLabel' | translate }}</label>
<app-writing-coach-trigger topic="chapter.synopsis"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="chapter-edit-description" id="chapter-edit-description"
formControlName="description" formControlName="description"
@@ -93,10 +99,13 @@
</app-expandable-section> </app-expandable-section>
<!-- Objectifs et enjeux --> <!-- Objectifs et enjeux -->
<app-expandable-section [title]="'chapterEdit.objectivesStakesSectionTitle' | translate" icon="🎯" [filled]="objectivesStakesFilled"> <app-expandable-section [title]="'chapterEdit.objectivesStakesSectionTitle' | translate" icon="🎯" [initiallyOpen]="focusSection === 'stakes'" [filled]="objectivesStakesFilled">
<div class="field-row"> <div class="field-row">
<div class="field"> <div class="field">
<label for="chapter-edit-player-objectives">{{ 'chapterEdit.playerObjectivesLabel' | translate }}</label> <div class="field-label-row">
<label for="chapter-edit-player-objectives">{{ 'chapterEdit.playerObjectivesLabel' | translate }}</label>
<app-writing-coach-trigger topic="chapter.objectives"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="chapter-edit-player-objectives" id="chapter-edit-player-objectives"
formControlName="playerObjectives" formControlName="playerObjectives"
@@ -105,7 +114,10 @@
</textarea> </textarea>
</div> </div>
<div class="field"> <div class="field">
<label for="chapter-edit-narrative-stakes">{{ 'chapterEdit.narrativeStakesLabel' | translate }}</label> <div class="field-label-row">
<label for="chapter-edit-narrative-stakes">{{ 'chapterEdit.narrativeStakesLabel' | translate }}</label>
<app-writing-coach-trigger topic="chapter.stakes"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="chapter-edit-narrative-stakes" id="chapter-edit-narrative-stakes"
formControlName="narrativeStakes" formControlName="narrativeStakes"
@@ -27,6 +27,8 @@ import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dia
import { EntityAssistPanelComponent } from '../../../shared/entity-assist-panel/entity-assist-panel.component'; import { EntityAssistPanelComponent } from '../../../shared/entity-assist-panel/entity-assist-panel.component';
import { FieldProposal } from '../../../services/entity-assist.model'; import { FieldProposal } from '../../../services/entity-assist.model';
import { SceneDraftPanelComponent } from '../../../shared/scene-draft-panel/scene-draft-panel.component'; import { SceneDraftPanelComponent } from '../../../shared/scene-draft-panel/scene-draft-panel.component';
import { WritingCoachTriggerComponent } from '../../../shared/writing-coach/writing-coach-trigger.component';
import { WritingReviewHintsComponent } from '../../../shared/writing-review/writing-review-hints.component';
/** /**
* Écran d'édition d'un Chapitre. Donnée de SCÉNARIO uniquement. * Écran d'édition d'un Chapitre. Donnée de SCÉNARIO uniquement.
@@ -47,7 +49,8 @@ import { SceneDraftPanelComponent } from '../../../shared/scene-draft-panel/scen
ExpandableSectionComponent, ExpandableSectionComponent,
EntityAssistPanelComponent, EntityAssistPanelComponent,
SceneDraftPanelComponent, SceneDraftPanelComponent,
TranslatePipe TranslatePipe,
WritingCoachTriggerComponent, WritingReviewHintsComponent
], ],
templateUrl: './chapter-edit.component.html', templateUrl: './chapter-edit.component.html',
styleUrls: ['./chapter-edit.component.scss'] styleUrls: ['./chapter-edit.component.scss']
@@ -88,6 +91,9 @@ export class ChapterEditComponent implements OnInit {
/** `?assist=draft-scenes` (bouton « Corriger » du guidage) → panneau IA déployé d'office. */ /** `?assist=draft-scenes` (bouton « Corriger » du guidage) → panneau IA déployé d'office. */
assistParam: string | null = null; assistParam: string | null = null;
/** `?focus=stakes` (lien « Voir » de la relecture d'éditeur) → section dépliée d'office. */
focusSection: string | null = null;
availablePages: Page[] = []; availablePages: Page[] = [];
loreId: string | null = null; loreId: string | null = null;
relatedPageIds: string[] = []; relatedPageIds: string[] = [];
@@ -144,6 +150,7 @@ export class ChapterEditComponent implements OnInit {
this.arcId = newArcId; this.arcId = newArcId;
this.chapterId = newChapterId; this.chapterId = newChapterId;
this.assistParam = this.route.snapshot.queryParamMap.get('assist'); this.assistParam = this.route.snapshot.queryParamMap.get('assist');
this.focusSection = this.route.snapshot.queryParamMap.get('focus');
this.loadAll(); this.loadAll();
} }
}); });
@@ -0,0 +1,58 @@
import { GuidedChapterSpec, GuidedSceneSpec } from '../../services/guided-skeleton.model';
/**
* Définition d'une méthode guidée (Mentor d'écriture, phases M3/M5). L'assistant
* `guided-wizard` est générique : il affiche les étapes d'une méthode et lui délègue
* la construction du squelette. Ajouter une méthode = un fichier de définition + ses
* textes i18n (`guided.<i18nKey>.*`) + son entrée dans `GUIDED_METHODS`.
*
* Conventions i18n (préfixe `guided.<i18nKey>.`) :
* - `name`, `tagline` : présentation de la méthode ;
* - `steps.<stepId>.title|why|example` : chaque étape (pourquoi + exemple, posture mentor) ;
* - `fields.<fieldKey>.label|placeholder` : chaque champ (`fieldKey` peut contenir des points) ;
* - `options.<fieldKey>.<option>` : libellés des choix ;
* - `defaults.<fieldKey>` : valeur proposée d'office (ex. nom d'une salle).
*/
/** Réponses du MJ, par clé de champ. */
export type GuidedAnswers = Record<string, string>;
export interface GuidedField {
key: string;
kind: 'text' | 'textarea' | 'choice';
required?: boolean;
/** Valeurs possibles d'un champ `choice` (la 1re est sélectionnée par défaut). */
options?: string[];
/** Pré-remplir avec `defaults.<key>` (traduit) à la première visite. */
prefilled?: boolean;
/** Sujet du coach d'écriture (💡) associé, ex. `scene.choices`. */
coachTopic?: string;
}
export interface GuidedStep {
id: string;
/** `placement` : où ranger l'aventure ; `form` : questions ; `review` : récapitulatif. */
kind: 'placement' | 'form' | 'review';
fields?: GuidedField[];
}
/** Ce que la méthode produit à partir des réponses (le placement est ajouté par l'assistant). */
export interface GuidedDraft {
chapter: GuidedChapterSpec;
scenes: GuidedSceneSpec[];
}
export interface GuidedMethod {
/** Identifiant d'URL (`/campaigns/:id/guided/:method`). */
id: string;
/** Préfixe i18n sous `guided.`. */
i18nKey: string;
steps: GuidedStep[];
toDraft(answers: GuidedAnswers): GuidedDraft;
}
/** Valeur nettoyée d'une réponse (chaîne vide → null). */
export function answer(answers: GuidedAnswers, key: string): string | null {
const value = answers[key]?.trim();
return value ? value : null;
}
@@ -0,0 +1,104 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { GuidedField, GuidedStep } from './guided-method.model';
import { GUIDED_METHODS } from './guided-methods';
import { FIVE_ROOM_METHOD } from './methods/five-room.method';
/**
* Garde-fous des méthodes guidées : chaque étape / champ / option / valeur par défaut
* a son texte en fr ET en en (sinon l'assistant afficherait des clés brutes), et la
* méthode « 5 salles » produit le bon squelette.
*/
const FRAGMENTS_DIR = join(process.cwd(), 'src/assets/i18n/fragments');
function i18n(lang: 'fr' | 'en'): Record<string, unknown> {
return JSON.parse(readFileSync(join(FRAGMENTS_DIR, `guided.${lang}.json`), 'utf-8')).guided;
}
function lookup(root: Record<string, unknown>, path: string): unknown {
return path.split('.').reduce<unknown>((node, part) =>
node && typeof node === 'object' ? (node as Record<string, unknown>)[part] : undefined, root);
}
function fieldKeys(p: string, f: GuidedField): string[] {
return [
`${p}.fields.${f.key}.label`,
...(f.kind === 'choice' ? [] : [`${p}.fields.${f.key}.placeholder`]),
...(f.options ?? []).map(o => `${p}.options.${f.key}.${o}`),
...(f.prefilled ? [`${p}.defaults.${f.key}`] : [])
];
}
function stepKeys(p: string, step: GuidedStep): string[] {
return [
`${p}.steps.${step.id}.title`,
`${p}.steps.${step.id}.why`,
...(step.kind === 'review' ? [] : [`${p}.steps.${step.id}.example`]),
...(step.fields ?? []).flatMap(f => fieldKeys(p, f))
];
}
function requiredKeys(): string[] {
return GUIDED_METHODS.flatMap(m => [`${m.i18nKey}.name`, ...m.steps.flatMap(s => stepKeys(m.i18nKey, s))]);
}
describe('guided methods content', () => {
const keys = requiredKeys();
for (const lang of ['fr', 'en'] as const) {
it.each(keys)(`${lang}: guided.%s is a non-empty text`, key => {
const value = lookup(i18n(lang), key);
expect(typeof value === 'string' && value.trim().length > 0, `guided.${key} (${lang})`).toBe(true);
});
}
it('has unique method ids and step ids', () => {
expect(new Set(GUIDED_METHODS.map(m => m.id)).size).toBe(GUIDED_METHODS.length);
for (const m of GUIDED_METHODS) {
expect(new Set(m.steps.map(s => s.id)).size).toBe(m.steps.length);
}
});
});
describe('five-room method', () => {
const answers = {
title: ' Le reliquaire volé ',
location: 'La crypte',
hook: 'Le prêtre a disparu',
objectives: 'Ramener la relique',
stakes: '',
'room1.name': "L'entrée gardée",
'room1.nature': 'social',
'room1.choices': 'Convaincre ou ruser',
'room2.name': "L'épreuve",
'room2.nature': 'puzzle',
'room3.name': 'Le revers',
'room4.name': 'Le climax',
'room4.enemies': "L'envoûteuse",
'room5.name': 'La récompense',
'room5.secret': 'Le symbole de la confrérie'
};
it('builds the chapter from the frame and stakes answers', () => {
expect(FIVE_ROOM_METHOD.toDraft(answers).chapter).toEqual({
name: 'Le reliquaire volé',
description: 'Le prêtre a disparu',
playerObjectives: 'Ramener la relique',
narrativeStakes: null
});
});
it('builds five typed scenes in the same place', () => {
const scenes = FIVE_ROOM_METHOD.toDraft(answers).scenes;
expect(scenes.map(s => s.type)).toEqual(['NPC', 'LOCATION', 'EVENT', 'ENCOUNTER', 'REVELATION']);
expect(scenes.every(s => s.location === 'La crypte')).toBe(true);
expect(scenes[0].choicesConsequences).toBe('Convaincre ou ruser');
expect(scenes[3].enemies).toBe("L'envoûteuse");
expect(scenes[4].gmSecretNotes).toBe('Le symbole de la confrérie');
});
it('defaults room 1 to a fight when no nature was chosen', () => {
expect(FIVE_ROOM_METHOD.toDraft({}).scenes[0].type).toBe('ENCOUNTER');
});
});
@@ -0,0 +1,9 @@
import { GuidedMethod } from './guided-method.model';
import { FIVE_ROOM_METHOD } from './methods/five-room.method';
/** Méthodes guidées disponibles (M5 : préparation minimale, enquête, casse, bac à sable…). */
export const GUIDED_METHODS: GuidedMethod[] = [FIVE_ROOM_METHOD];
export function findGuidedMethod(id: string | null): GuidedMethod | undefined {
return GUIDED_METHODS.find(m => m.id === id);
}
@@ -0,0 +1,171 @@
@if (method && step) {
<div class="wizard">
<header class="wizard-top">
<a class="wizard-back" [routerLink]="['/campaigns', campaignId]">
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon>
{{ 'guided.backToCampaign' | translate }}
</a>
<div class="wizard-method">
<lucide-icon [img]="Sparkles" [size]="14"></lucide-icon>
{{ k('name') | translate }}
</div>
<div class="wizard-progress" role="progressbar"
[attr.aria-valuenow]="stepIndex + 1" aria-valuemin="1" [attr.aria-valuemax]="total"
[attr.aria-label]="'guided.progress' | translate: { n: stepIndex + 1, total: total }">
<span class="progress-text">{{ 'guided.progress' | translate: { n: stepIndex + 1, total: total } }}</span>
<span class="progress-track"><span class="progress-fill" [style.width.%]="progress"></span></span>
</div>
</header>
<main class="wizard-step">
<h1 #stepTitle tabindex="-1">{{ k('steps.' + step.id + '.title') | translate }}</h1>
<p class="step-why">{{ k('steps.' + step.id + '.why') | translate }}</p>
@if (step.kind !== 'review') {
<aside class="step-example">
<span class="example-label">{{ 'guided.exampleLabel' | translate }}</span>
<p>{{ k('steps.' + step.id + '.example') | translate }}</p>
</aside>
}
<!-- Où ranger l'aventure -->
@if (step.kind === 'placement') {
<fieldset class="placement">
<legend class="sr-only">{{ k('steps.placement.title') | translate }}</legend>
@if (linearArcs.length > 0) {
<label class="option-card" [class.selected]="answers['placement.mode'] === 'existing'">
<input type="radio" name="placement-mode" value="existing"
[ngModel]="answers['placement.mode']" (ngModelChange)="setAnswer('placement.mode', $event)" />
<span>{{ 'guided.placementExisting' | translate }}</span>
</label>
@if (answers['placement.mode'] === 'existing') {
<div class="field nested">
<label for="guided-arc">{{ 'guided.placementArcLabel' | translate }}</label>
<select id="guided-arc" [ngModel]="answers['placement.arcId']"
(ngModelChange)="setAnswer('placement.arcId', $event)">
@for (arc of linearArcs; track arc.id) {
<option [value]="arc.id">{{ arc.name }}</option>
}
</select>
</div>
}
}
<label class="option-card" [class.selected]="answers['placement.mode'] === 'new'">
<input type="radio" name="placement-mode" value="new"
[ngModel]="answers['placement.mode']" (ngModelChange)="setAnswer('placement.mode', $event)" />
<span>{{ 'guided.placementNew' | translate }}</span>
</label>
@if (answers['placement.mode'] === 'new') {
<div class="field nested">
<label for="guided-new-arc">{{ 'guided.placementNewArcLabel' | translate }} *</label>
<input id="guided-new-arc" type="text" [ngModel]="answers['placement.newArcName']"
(ngModelChange)="setAnswer('placement.newArcName', $event)"
[placeholder]="'guided.placementNewArcPlaceholder' | translate" />
</div>
}
</fieldset>
}
<!-- Questions de l'étape -->
@if (step.kind === 'form') {
<div class="step-fields">
@for (field of step.fields; track field.key) {
@if (field.kind === 'choice') {
<fieldset class="field choice-field">
<legend>{{ k('fields.' + field.key + '.label') | translate }}</legend>
<div class="choice-row">
@for (option of field.options; track option) {
<label class="choice-chip" [class.selected]="answers[field.key] === option">
<!-- attr.* : name/value doivent exister dans le DOM (groupe radio natif,
navigation clavier) ; [value] seul est consommé par le ControlValueAccessor. -->
<input type="radio" [attr.name]="fieldId(field)" [attr.value]="option" [value]="option"
[ngModel]="answers[field.key]" (ngModelChange)="setAnswer(field.key, $event)" />
{{ k('options.' + field.key + '.' + option) | translate }}
</label>
}
</div>
</fieldset>
} @else {
<div class="field">
<div class="field-label-row">
<label [for]="fieldId(field)">
{{ k('fields.' + field.key + '.label') | translate }}@if (field.required) { * }
</label>
@if (field.coachTopic) {
<app-writing-coach-trigger [topic]="field.coachTopic"></app-writing-coach-trigger>
}
</div>
@if (field.kind === 'textarea') {
<textarea [id]="fieldId(field)" rows="3"
[ngModel]="answers[field.key]" (ngModelChange)="setAnswer(field.key, $event)"
[placeholder]="k('fields.' + field.key + '.placeholder') | translate"></textarea>
} @else {
<input [id]="fieldId(field)" type="text"
[ngModel]="answers[field.key]" (ngModelChange)="setAnswer(field.key, $event)"
[placeholder]="k('fields.' + field.key + '.placeholder') | translate" />
}
</div>
}
}
</div>
}
<!-- Récapitulatif -->
@if (step.kind === 'review' && draft; as d) {
<div class="review">
<dl class="review-meta">
<dt>{{ 'guided.reviewArc' | translate }}</dt>
<dd>{{ placementLabel }}</dd>
<dt>{{ 'guided.reviewChapter' | translate }}</dt>
<dd>{{ d.chapter.name }}</dd>
</dl>
<ol class="review-scenes">
@for (scene of d.scenes; track $index) {
<li>
<span class="scene-name">{{ scene.name }}</span>
<span class="scene-type">{{ ('sceneType.' + scene.type) | translate }}</span>
</li>
}
</ol>
<label class="link-toggle">
<input type="checkbox" [(ngModel)]="linkScenes" />
{{ 'guided.linkScenes' | translate }}
</label>
<p class="review-after">{{ 'guided.reviewAfter' | translate }}</p>
</div>
}
@if (error) {
<p class="wizard-error" role="alert">{{ error }}</p>
}
</main>
<footer class="wizard-nav">
<button type="button" class="btn-secondary" (click)="previous()" [disabled]="stepIndex === 0">
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon>
{{ 'guided.previous' | translate }}
</button>
<button type="button" class="btn-ghost" (click)="restart()">
<lucide-icon [img]="RotateCcw" [size]="14"></lucide-icon>
{{ 'guided.restart' | translate }}
</button>
@if (isLast) {
<button type="button" class="btn-primary" (click)="create()" [disabled]="submitting">
<lucide-icon [img]="Check" [size]="14"></lucide-icon>
{{ (submitting ? 'guided.creating' : 'guided.create') | translate }}
</button>
} @else {
<button type="button" class="btn-primary" (click)="next()" [disabled]="!canProceed()">
{{ 'guided.next' | translate }}
<lucide-icon [img]="ArrowRight" [size]="14"></lucide-icon>
</button>
}
</footer>
</div>
} @else {
<div class="wizard">
<p class="wizard-error">{{ 'guided.unknownMethod' | translate }}</p>
<a [routerLink]="['/campaigns', campaignId]">{{ 'guided.backToCampaign' | translate }}</a>
</div>
}
@@ -0,0 +1,352 @@
// Une étape par écran, colonne unique et étroite : lisible sur ordinateur comme
// sur téléphone (la barre de navigation reste collée en bas de l'écran).
.wizard {
max-width: 680px;
margin: 0 auto;
padding: 1.5rem 0 0;
display: flex;
flex-direction: column;
gap: 1.25rem;
min-height: 100%;
}
.wizard-top {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.6rem 1rem;
}
.wizard-back {
display: inline-flex;
align-items: center;
gap: 0.35rem;
color: #9ca3af;
font-size: 0.85rem;
text-decoration: none;
&:hover { color: #e5e7eb; }
&:focus-visible { outline: 2px solid #6c63ff; outline-offset: 2px; border-radius: 4px; }
}
.wizard-method {
display: inline-flex;
align-items: center;
gap: 0.35rem;
color: #fbbf24;
font-size: 0.78rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.wizard-progress {
flex-basis: 100%;
display: flex;
align-items: center;
gap: 0.75rem;
}
.progress-text {
flex-shrink: 0;
font-size: 0.8rem;
color: #9ca3af;
font-variant-numeric: tabular-nums;
}
.progress-track {
flex: 1;
height: 6px;
border-radius: 999px;
background: #1f2937;
overflow: hidden;
}
.progress-fill {
display: block;
height: 100%;
background: #6c63ff;
border-radius: 999px;
transition: width 0.25s ease;
}
.wizard-step {
display: flex;
flex-direction: column;
gap: 1.1rem;
h1 {
margin: 0;
font-size: 1.5rem;
font-weight: 700;
line-height: 1.25;
color: white;
text-wrap: balance;
&:focus { outline: none; }
}
}
.step-why {
margin: 0;
font-size: 0.95rem;
line-height: 1.6;
color: #d1d5db;
}
.step-example {
padding: 0.85rem 1rem;
border-radius: 8px;
background: rgba(108, 99, 255, 0.08);
border: 1px solid rgba(108, 99, 255, 0.25);
p {
margin: 0.3rem 0 0;
font-size: 0.9rem;
line-height: 1.55;
font-style: italic;
color: #d1d5db;
}
}
.example-label {
font-size: 0.72rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: #a5b4fc;
}
.step-fields {
display: flex;
flex-direction: column;
gap: 1.1rem;
}
// --- Placement & choix ---------------------------------------------------------------
.placement {
margin: 0;
padding: 0;
border: none;
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.option-card {
display: flex;
align-items: center;
gap: 0.7rem;
padding: 0.9rem 1rem;
border-radius: 8px;
border: 1px solid #374151;
background: #111827;
color: #e5e7eb;
font-size: 0.92rem;
cursor: pointer;
&.selected { border-color: #6c63ff; background: rgba(108, 99, 255, 0.1); }
input { accent-color: #6c63ff; width: 18px; height: 18px; margin: 0; }
}
.nested {
margin: 0 0 0.4rem 1.6rem;
}
.choice-field {
margin: 0;
padding: 0;
border: none;
legend {
margin-bottom: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
color: #d1d5db;
}
}
.choice-row {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.choice-chip {
display: inline-flex;
align-items: center;
gap: 0.45rem;
min-height: 44px;
padding: 0 1rem;
border-radius: 999px;
border: 1px solid #374151;
background: #111827;
color: #d1d5db;
font-size: 0.88rem;
cursor: pointer;
&.selected { border-color: #6c63ff; color: white; background: rgba(108, 99, 255, 0.15); }
input { accent-color: #6c63ff; margin: 0; }
&:focus-within { outline: 2px solid #6c63ff; outline-offset: 2px; }
}
// --- Récapitulatif --------------------------------------------------------------------
.review {
display: flex;
flex-direction: column;
gap: 1rem;
}
.review-meta {
display: grid;
grid-template-columns: auto 1fr;
gap: 0.4rem 1rem;
margin: 0;
dt { color: #9ca3af; font-size: 0.85rem; }
dd { margin: 0; color: #f3f4f6; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
}
.review-scenes {
margin: 0;
padding: 0;
list-style: none;
counter-reset: scene;
display: flex;
flex-direction: column;
gap: 0.45rem;
li {
counter-increment: scene;
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.7rem 0.9rem;
border-radius: 8px;
background: #111827;
border: 1px solid #1f2937;
&::before {
content: counter(scene);
flex-shrink: 0;
width: 1.6rem;
height: 1.6rem;
border-radius: 50%;
display: grid;
place-items: center;
background: #1f2937;
color: #a5b4fc;
font-size: 0.8rem;
font-weight: 600;
}
}
}
.scene-name {
flex: 1;
min-width: 0;
color: #f3f4f6;
font-size: 0.9rem;
overflow-wrap: anywhere;
}
.scene-type {
flex-shrink: 0;
padding: 0.1rem 0.55rem;
border-radius: 999px;
background: #1f2937;
color: #9ca3af;
font-size: 0.75rem;
}
.link-toggle {
display: flex;
align-items: center;
gap: 0.6rem;
color: #d1d5db;
font-size: 0.9rem;
cursor: pointer;
input { accent-color: #6c63ff; width: 18px; height: 18px; margin: 0; }
}
.review-after {
margin: 0;
color: #9ca3af;
font-size: 0.85rem;
line-height: 1.55;
}
.wizard-error {
margin: 0;
color: #fca5a5;
font-size: 0.88rem;
}
// --- Navigation -------------------------------------------------------------------------
.wizard-nav {
position: sticky;
bottom: 0;
margin-top: auto;
display: flex;
align-items: center;
gap: 0.75rem;
padding: 1rem 0;
background: #0a0a14;
border-top: 1px solid #1f2937;
.btn-primary { margin-left: auto; }
button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.4rem;
min-height: 44px;
}
}
.btn-ghost {
padding: 0.6rem 0.8rem;
border: none;
border-radius: 8px;
background: transparent;
color: #9ca3af;
font-size: 0.85rem;
cursor: pointer;
&:hover { color: #e5e7eb; background: #111827; }
&:focus-visible { outline: 2px solid #6c63ff; }
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
@media (max-width: 600px) {
.wizard { padding-top: 1rem; }
.wizard-step h1 { font-size: 1.3rem; }
.wizard-nav {
flex-wrap: wrap;
gap: 0.5rem;
.btn-secondary,
.btn-primary { flex: 1; padding-left: 0.75rem; padding-right: 0.75rem; }
.btn-ghost { order: -1; flex-basis: 100%; justify-content: flex-start; padding-left: 0; }
}
}
@media (prefers-reduced-motion: reduce) {
.progress-fill { transition: none; }
}
@@ -0,0 +1,255 @@
import { Component, DestroyRef, ElementRef, OnInit, ViewChild, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FormsModule } from '@angular/forms';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { LucideAngularModule, ArrowLeft, ArrowRight, Check, RotateCcw, Sparkles } from 'lucide-angular';
import { Arc } from '../../../services/campaign.model';
import { CampaignService } from '../../../services/campaign.service';
import { GuidedSkeletonService } from '../../../services/guided-skeleton.service';
import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service';
import { WritingCoachTriggerComponent } from '../../../shared/writing-coach/writing-coach-trigger.component';
import { GuidedAnswers, GuidedDraft, GuidedField, GuidedMethod, GuidedStep, answer } from '../guided-method.model';
import { findGuidedMethod } from '../guided-methods';
/** Clés de réponse réservées à l'assistant (placement + chaînage), communes à toutes les méthodes. */
const PLACEMENT_MODE = 'placement.mode';
const PLACEMENT_ARC = 'placement.arcId';
const PLACEMENT_NEW_ARC = 'placement.newArcName';
const LINK_SCENES = 'link';
/**
* Assistant pas à pas d'une méthode guidée (Mentor d'écriture, phase M3) :
* une étape par écran (lisible sur téléphone), chacune expliquée (pourquoi + exemple),
* avec le coach 💡 sur les champs. Les réponses sont celles du MJ : rien n'est généré.
* Le brouillon est gardé dans le navigateur pour pouvoir quitter et revenir.
*/
@Component({
selector: 'app-guided-wizard',
imports: [FormsModule, RouterLink, TranslatePipe, LucideAngularModule, WritingCoachTriggerComponent],
templateUrl: './guided-wizard.component.html',
styleUrls: ['./guided-wizard.component.scss']
})
export class GuidedWizardComponent implements OnInit {
readonly ArrowLeft = ArrowLeft;
readonly ArrowRight = ArrowRight;
readonly Check = Check;
readonly RotateCcw = RotateCcw;
readonly Sparkles = Sparkles;
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly translate = inject(TranslateService);
private readonly campaignService = inject(CampaignService);
private readonly skeletonService = inject(GuidedSkeletonService);
private readonly confirmDialog = inject(ConfirmDialogService);
private readonly destroyRef = inject(DestroyRef);
@ViewChild('stepTitle') stepTitle?: ElementRef<HTMLHeadingElement>;
campaignId = '';
method: GuidedMethod | null = null;
answers: GuidedAnswers = {};
stepIndex = 0;
/** Arcs linéaires de la campagne : seuls candidats pour y ranger l'aventure. */
linearArcs: Arc[] = [];
/** Le placement par défaut dépend des arcs : on attend leur chargement pour le choisir. */
private arcsLoaded = false;
submitting = false;
error: string | null = null;
ngOnInit(): void {
this.route.paramMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(pm => {
this.campaignId = pm.get('campaignId') ?? '';
this.method = findGuidedMethod(pm.get('method')) ?? null;
if (!this.method) return;
this.restoreDraft();
this.arcsLoaded = false;
this.campaignService.getArcs(this.campaignId).subscribe(arcs => {
this.linearArcs = arcs
.filter(a => (a.type ?? 'LINEAR') === 'LINEAR')
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
this.arcsLoaded = true;
this.applyDefaults();
});
this.applyDefaults();
});
}
// --- Navigation ------------------------------------------------------------------
get step(): GuidedStep | null {
return this.method?.steps[this.stepIndex] ?? null;
}
get total(): number {
return this.method?.steps.length ?? 0;
}
get progress(): number {
return this.total ? Math.round(((this.stepIndex + 1) / this.total) * 100) : 0;
}
get isLast(): boolean {
return this.stepIndex === this.total - 1;
}
next(): void {
if (!this.canProceed() || this.isLast) return;
this.goTo(this.stepIndex + 1);
}
previous(): void {
if (this.stepIndex > 0) this.goTo(this.stepIndex - 1);
}
private goTo(index: number): void {
this.stepIndex = index;
this.error = null;
this.applyDefaults();
this.saveDraft();
// Nouvelle étape = nouvel écran : on remonte et on place le focus sur son titre.
setTimeout(() => {
this.stepTitle?.nativeElement.focus();
this.stepTitle?.nativeElement.scrollIntoView({ block: 'start' });
});
}
canProceed(): boolean {
const step = this.step;
if (!step) return false;
if (step.kind === 'placement') {
return this.answers[PLACEMENT_MODE] === 'existing'
? !!this.answers[PLACEMENT_ARC]
: !!answer(this.answers, PLACEMENT_NEW_ARC);
}
return (step.fields ?? []).every(f => !f.required || !!answer(this.answers, f.key));
}
// --- Réponses ----------------------------------------------------------------------
/** Clé i18n de la méthode courante. */
k(path: string): string {
return `guided.${this.method?.i18nKey}.${path}`;
}
fieldId(field: GuidedField): string {
return `guided-${field.key.replace(/\./g, '-')}`;
}
setAnswer(key: string, value: string): void {
this.answers = { ...this.answers, [key]: value };
this.saveDraft();
}
/** Placement par défaut + valeurs pré-remplies + premier choix des champs `choice`. */
private applyDefaults(): void {
const a = { ...this.answers };
if (this.arcsLoaded) this.applyPlacementDefaults(a);
a[LINK_SCENES] ??= 'true';
for (const field of this.step?.fields ?? []) {
if (a[field.key] !== undefined) continue;
if (field.kind === 'choice' && field.options?.length) a[field.key] = field.options[0];
else if (field.prefilled) a[field.key] = this.translate.instant(this.k(`defaults.${field.key}`));
}
this.answers = a;
}
/** Arc existant par défaut s'il y en a ; sinon (ou arc disparu) nouvel arc. */
private applyPlacementDefaults(a: GuidedAnswers): void {
a[PLACEMENT_MODE] ??= this.linearArcs.length > 0 ? 'existing' : 'new';
if (a[PLACEMENT_MODE] === 'existing' && !this.linearArcs.some(arc => arc.id === a[PLACEMENT_ARC])) {
a[PLACEMENT_ARC] = this.linearArcs[0]?.id ?? '';
if (!a[PLACEMENT_ARC]) a[PLACEMENT_MODE] = 'new';
}
}
// --- Récapitulatif & création --------------------------------------------------------
get draft(): GuidedDraft | null {
return this.method ? this.method.toDraft(this.answers) : null;
}
get placementLabel(): string {
if (this.answers[PLACEMENT_MODE] === 'existing') {
return this.linearArcs.find(a => a.id === this.answers[PLACEMENT_ARC])?.name ?? '';
}
return answer(this.answers, PLACEMENT_NEW_ARC) ?? '';
}
get linkScenes(): boolean {
return this.answers[LINK_SCENES] !== 'false';
}
set linkScenes(value: boolean) {
this.setAnswer(LINK_SCENES, String(value));
}
create(): void {
const draft = this.draft;
if (!draft || this.submitting) return;
const existing = this.answers[PLACEMENT_MODE] === 'existing';
this.submitting = true;
this.error = null;
this.skeletonService.create(this.campaignId, {
arcId: existing ? this.answers[PLACEMENT_ARC] : null,
newArcName: existing ? null : answer(this.answers, PLACEMENT_NEW_ARC),
chapter: draft.chapter,
scenes: draft.scenes,
linkSequentially: this.linkScenes,
linkLabel: this.translate.instant('guided.linkLabel')
}).subscribe({
next: result => {
this.clearDraft();
this.router.navigate(['/campaigns', this.campaignId, 'arcs', result.arcId, 'chapters', result.chapterId]);
},
error: () => {
this.submitting = false;
this.error = this.translate.instant('guided.createError');
}
});
}
async restart(): Promise<void> {
const ok = await this.confirmDialog.confirm({
title: this.translate.instant('guided.restartTitle'),
message: this.translate.instant('guided.restartMessage'),
confirmLabel: this.translate.instant('guided.restart')
});
if (!ok) return;
this.clearDraft();
this.answers = {};
this.goTo(0);
}
// --- Brouillon (confort par navigateur : jamais indispensable) -------------------------
private get storageKey(): string {
return `loremind.guided.${this.campaignId}.${this.method?.id}`;
}
private restoreDraft(): void {
this.answers = {};
this.stepIndex = 0;
try {
const raw = localStorage.getItem(this.storageKey);
if (!raw) return;
const saved = JSON.parse(raw) as { answers?: GuidedAnswers; step?: number };
this.answers = saved.answers ?? {};
this.stepIndex = Math.min(Math.max(saved.step ?? 0, 0), this.total - 1);
} catch { /* brouillon illisible ou stockage bloqué : on repart de zéro */ }
}
private saveDraft(): void {
try {
localStorage.setItem(this.storageKey, JSON.stringify({ answers: this.answers, step: this.stepIndex }));
} catch { /* stockage indisponible : le brouillon n'est simplement pas gardé */ }
}
private clearDraft(): void {
try {
localStorage.removeItem(this.storageKey);
} catch { /* rien à nettoyer */ }
}
}
@@ -0,0 +1,101 @@
import { SceneType } from '../../../services/campaign.model';
import { GuidedSceneSpec } from '../../../services/guided-skeleton.model';
import { GuidedAnswers, GuidedField, GuidedMethod, answer } from '../guided-method.model';
/**
* « Donjon en 5 salles » (méthode popularisée par Johnn Four ; textes écrits pour
* LoreMind). Une aventure courte en cinq temps : un gardien à l'entrée, une épreuve
* qui ne se règle pas à l'épée, un revers, le climax, puis la récompense ou la
* révélation. Le « donjon » peut être n'importe quel lieu : manoir, navire, forêt…
*
* Produit 1 chapitre (accroche, objectifs, enjeux) + 5 scènes typées dans le même lieu.
*/
/** Champs communs à chaque salle : nom (pré-rempli), ce qui s'y passe, choix, secret du MJ. */
function roomFields(room: number, extra: GuidedField[] = []): GuidedField[] {
return [
{ key: `room${room}.name`, kind: 'text', required: true, prefilled: true },
...extra.filter(f => f.kind === 'choice'),
{ key: `room${room}.description`, kind: 'textarea', coachTopic: 'scene.description' },
...extra.filter(f => f.kind !== 'choice'),
{ key: `room${room}.choices`, kind: 'textarea', coachTopic: 'scene.choices' },
{ key: `room${room}.secret`, kind: 'textarea', coachTopic: 'scene.gmNotes' }
];
}
/** Nature de la salle (choix du MJ) → type de scène, pour que la relecture juge le rythme. */
const NATURE_TO_TYPE: Record<string, SceneType> = {
combat: 'ENCOUNTER',
social: 'NPC',
obstacle: 'LOCATION',
puzzle: 'LOCATION',
exploration: 'LOCATION'
};
export const FIVE_ROOM_METHOD: GuidedMethod = {
id: 'five-room',
i18nKey: 'fiveRoom',
steps: [
{ id: 'placement', kind: 'placement' },
{
id: 'frame', kind: 'form', fields: [
{ key: 'title', kind: 'text', required: true },
{ key: 'location', kind: 'text', coachTopic: 'scene.setting' },
{ key: 'hook', kind: 'textarea', coachTopic: 'chapter.synopsis' }
]
},
{
id: 'stakes', kind: 'form', fields: [
{ key: 'objectives', kind: 'textarea', coachTopic: 'chapter.objectives' },
{ key: 'stakes', kind: 'textarea', coachTopic: 'chapter.stakes' }
]
},
{
id: 'room1', kind: 'form', fields: roomFields(1, [
{ key: 'room1.nature', kind: 'choice', options: ['combat', 'social', 'obstacle'] },
{ key: 'room1.enemies', kind: 'text' }
])
},
{
id: 'room2', kind: 'form', fields: roomFields(2, [
{ key: 'room2.nature', kind: 'choice', options: ['puzzle', 'social', 'exploration'] }
])
},
{ id: 'room3', kind: 'form', fields: roomFields(3) },
{
id: 'room4', kind: 'form', fields: roomFields(4, [
{ key: 'room4.enemies', kind: 'text', coachTopic: 'scene.combat' }
])
},
{ id: 'room5', kind: 'form', fields: roomFields(5) },
{ id: 'review', kind: 'review' }
],
toDraft(answers: GuidedAnswers) {
const location = answer(answers, 'location');
const room = (n: number, type: SceneType): GuidedSceneSpec => ({
name: answer(answers, `room${n}.name`) ?? '',
description: answer(answers, `room${n}.description`),
type,
location,
choicesConsequences: answer(answers, `room${n}.choices`),
gmSecretNotes: answer(answers, `room${n}.secret`),
enemies: answer(answers, `room${n}.enemies`)
});
return {
chapter: {
name: answer(answers, 'title') ?? '',
description: answer(answers, 'hook'),
playerObjectives: answer(answers, 'objectives'),
narrativeStakes: answer(answers, 'stakes')
},
scenes: [
room(1, NATURE_TO_TYPE[answers['room1.nature']] ?? 'ENCOUNTER'),
room(2, NATURE_TO_TYPE[answers['room2.nature']] ?? 'LOCATION'),
room(3, 'EVENT'),
room(4, 'ENCOUNTER'),
room(5, 'REVELATION')
]
};
}
};
@@ -30,6 +30,9 @@
est dans des sections repliables avec pastille « rempli ». --> est dans des sections repliables avec pastille « rempli ». -->
<p class="optional-hint">{{ 'sceneEdit.optionalHint' | translate }}</p> <p class="optional-hint">{{ 'sceneEdit.optionalHint' | translate }}</p>
<!-- Mentor d'écriture (M2) : conseils de relecture qui concernent cette entité. -->
<app-writing-review-hints [campaignId]="campaignId" entityType="SCENE" [entityId]="sceneId"></app-writing-review-hints>
<!-- Co-création (Pilier A) : le co-MJ propose, l'utilisateur valide champ par champ. <!-- Co-création (Pilier A) : le co-MJ propose, l'utilisateur valide champ par champ.
Les champs retenus remplissent le formulaire ; rien n'est enregistré avant la sauvegarde. --> Les champs retenus remplissent le formulaire ; rien n'est enregistré avant la sauvegarde. -->
<app-entity-assist-panel <app-entity-assist-panel
@@ -49,7 +52,10 @@
</div> </div>
<div class="field"> <div class="field">
<label for="scene-edit-description">{{ 'sceneEdit.descriptionLabel' | translate }}</label> <div class="field-label-row">
<label for="scene-edit-description">{{ 'sceneEdit.descriptionLabel' | translate }}</label>
<app-writing-coach-trigger topic="scene.description"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="scene-edit-description" id="scene-edit-description"
formControlName="description" formControlName="description"
@@ -65,7 +71,10 @@
<!-- Type narratif du nœud (Niveau 2 — graphe de nœuds typés) --> <!-- Type narratif du nœud (Niveau 2 — graphe de nœuds typés) -->
<div class="field"> <div class="field">
<label for="scene-edit-type">{{ 'sceneEdit.nodeTypeLabel' | translate }}</label> <div class="field-label-row">
<label for="scene-edit-type">{{ 'sceneEdit.nodeTypeLabel' | translate }}</label>
<app-writing-coach-trigger topic="scene.nodeType"></app-writing-coach-trigger>
</div>
<select id="scene-edit-type" formControlName="type"> <select id="scene-edit-type" formControlName="type">
@for (opt of sceneTypeOptions; track opt) { @for (opt of sceneTypeOptions; track opt) {
<option [value]="opt">{{ 'sceneType.' + opt | translate }}</option> <option [value]="opt">{{ 'sceneType.' + opt | translate }}</option>
@@ -181,7 +190,10 @@
<app-expandable-section [title]="'sceneEdit.contextSectionTitle' | translate" icon="📍" [initiallyOpen]="true" [filled]="contextFilled"> <app-expandable-section [title]="'sceneEdit.contextSectionTitle' | translate" icon="📍" [initiallyOpen]="true" [filled]="contextFilled">
<div class="field-row"> <div class="field-row">
<div class="field"> <div class="field">
<label for="scene-edit-location">{{ 'sceneEdit.locationLabel' | translate }}</label> <div class="field-label-row">
<label for="scene-edit-location">{{ 'sceneEdit.locationLabel' | translate }}</label>
<app-writing-coach-trigger topic="scene.setting"></app-writing-coach-trigger>
</div>
<input id="scene-edit-location" type="text" formControlName="location" [placeholder]="'sceneEdit.locationPlaceholder' | translate" /> <input id="scene-edit-location" type="text" formControlName="location" [placeholder]="'sceneEdit.locationPlaceholder' | translate" />
</div> </div>
<div class="field"> <div class="field">
@@ -190,7 +202,10 @@
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label for="scene-edit-atmosphere">{{ 'sceneEdit.atmosphereLabel' | translate }}</label> <div class="field-label-row">
<label for="scene-edit-atmosphere">{{ 'sceneEdit.atmosphereLabel' | translate }}</label>
<app-writing-coach-trigger topic="scene.atmosphere"></app-writing-coach-trigger>
</div>
<textarea <textarea
id="scene-edit-atmosphere" id="scene-edit-atmosphere"
formControlName="atmosphere" formControlName="atmosphere"
@@ -201,7 +216,7 @@
</app-expandable-section> </app-expandable-section>
<!-- Section : Narration pour les joueurs --> <!-- Section : Narration pour les joueurs -->
<app-expandable-section [title]="'sceneEdit.narrationSectionTitle' | translate" icon="📖" [filled]="narrationFilled"> <app-expandable-section [title]="'sceneEdit.narrationSectionTitle' | translate" coachTopic="scene.narration" icon="📖" [initiallyOpen]="focusSection === 'narration'" [filled]="narrationFilled">
<div class="field"> <div class="field">
<textarea <textarea
formControlName="playerNarration" formControlName="playerNarration"
@@ -213,7 +228,7 @@
</app-expandable-section> </app-expandable-section>
<!-- Section : Notes et secrets du MJ (privé) --> <!-- Section : Notes et secrets du MJ (privé) -->
<app-expandable-section [title]="'sceneEdit.gmNotesSectionTitle' | translate" icon="🔒" variant="private" [filled]="gmNotesFilled"> <app-expandable-section [title]="'sceneEdit.gmNotesSectionTitle' | translate" coachTopic="scene.gmNotes" icon="🔒" variant="private" [filled]="gmNotesFilled">
<div class="field"> <div class="field">
<textarea <textarea
formControlName="gmSecretNotes" formControlName="gmSecretNotes"
@@ -225,7 +240,7 @@
</app-expandable-section> </app-expandable-section>
<!-- Section : Choix et conséquences --> <!-- Section : Choix et conséquences -->
<app-expandable-section [title]="'sceneEdit.choicesSectionTitle' | translate" icon="🔀" [filled]="choicesFilled"> <app-expandable-section [title]="'sceneEdit.choicesSectionTitle' | translate" coachTopic="scene.choices" icon="🔀" [initiallyOpen]="focusSection === 'choices'" [filled]="choicesFilled">
<div class="field"> <div class="field">
<textarea <textarea
formControlName="choicesConsequences" formControlName="choicesConsequences"
@@ -236,7 +251,7 @@
</app-expandable-section> </app-expandable-section>
<!-- Section : Branches narratives (graphe intra-chapitre) --> <!-- Section : Branches narratives (graphe intra-chapitre) -->
<app-expandable-section [title]="'sceneEdit.branchesSectionTitle' | translate" icon="🌿" [initiallyOpen]="focusSection === 'branches'" [filled]="branchesFilled"> <app-expandable-section [title]="'sceneEdit.branchesSectionTitle' | translate" coachTopic="scene.branches" icon="🌿" [initiallyOpen]="focusSection === 'branches'" [filled]="branchesFilled">
@if (siblingScenes.length === 0) { @if (siblingScenes.length === 0) {
<div class="branches-hint"> <div class="branches-hint">
<small class="field-hint"> <small class="field-hint">
@@ -307,7 +322,7 @@
</app-expandable-section> </app-expandable-section>
<!-- Section : Combat ou rencontre --> <!-- Section : Combat ou rencontre -->
<app-expandable-section [title]="'sceneEdit.combatSectionTitle' | translate" icon="⚔️" [initiallyOpen]="focusSection === 'combat'" [filled]="combatFilled"> <app-expandable-section [title]="'sceneEdit.combatSectionTitle' | translate" coachTopic="scene.combat" icon="⚔️" [initiallyOpen]="focusSection === 'combat'" [filled]="combatFilled">
<div class="field"> <div class="field">
<label for="scene-edit-combat-difficulty">{{ 'sceneEdit.combatDifficultyLabel' | translate }}</label> <label for="scene-edit-combat-difficulty">{{ 'sceneEdit.combatDifficultyLabel' | translate }}</label>
<input id="scene-edit-combat-difficulty" type="text" formControlName="combatDifficulty" [placeholder]="'sceneEdit.combatDifficultyPlaceholder' | translate" /> <input id="scene-edit-combat-difficulty" type="text" formControlName="combatDifficulty" [placeholder]="'sceneEdit.combatDifficultyPlaceholder' | translate" />
@@ -31,6 +31,8 @@ import { FieldProposal } from '../../../services/entity-assist.model';
import { FileDropDirective } from '../../../shared/file-drop.directive'; import { FileDropDirective } from '../../../shared/file-drop.directive';
import { CAMPAIGN_ICON_OPTIONS } from '../../campaign-icons'; import { CAMPAIGN_ICON_OPTIONS } from '../../campaign-icons';
import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service'; import { ConfirmDialogService } from '../../../shared/confirm-dialog/confirm-dialog.service';
import { WritingCoachTriggerComponent } from '../../../shared/writing-coach/writing-coach-trigger.component';
import { WritingReviewHintsComponent } from '../../../shared/writing-review/writing-review-hints.component';
/** /**
* État d'édition d'UNE battlemap de la scène (une carte par variante : Jour, Nuit, * État d'édition d'UNE battlemap de la scène (une carte par variante : Jour, Nuit,
@@ -63,7 +65,7 @@ interface BattlemapEdit {
*/ */
@Component({ @Component({
selector: 'app-scene-edit', selector: 'app-scene-edit',
imports: [ReactiveFormsModule, LucideAngularModule, ExpandableSectionComponent, LoreLinkPickerComponent, EnemyLinkPickerComponent, AiChatDrawerComponent, ImageGalleryComponent, IconPickerComponent, RoomsEditorComponent, EntityAssistPanelComponent, FileDropDirective, TranslatePipe], imports: [ReactiveFormsModule, LucideAngularModule, ExpandableSectionComponent, LoreLinkPickerComponent, EnemyLinkPickerComponent, AiChatDrawerComponent, ImageGalleryComponent, IconPickerComponent, RoomsEditorComponent, EntityAssistPanelComponent, FileDropDirective, TranslatePipe, WritingCoachTriggerComponent, WritingReviewHintsComponent],
templateUrl: './scene-edit.component.html', templateUrl: './scene-edit.component.html',
styleUrls: ['./scene-edit.component.scss'] styleUrls: ['./scene-edit.component.scss']
}) })
@@ -95,7 +97,7 @@ export class SceneEditComponent implements OnInit {
scene: Scene | null = null; scene: Scene | null = null;
/** /**
* Section à déplier d'office (query param `?focus=combat|branches|rooms`) — posé par * Section à déplier d'office (query param `?focus=combat|branches|rooms|narration|choices`) — posé par
* le bouton « Corriger » du guidage pour atterrir directement sur l'outil fautif. * le bouton « Corriger » du guidage pour atterrir directement sur l'outil fautif.
*/ */
focusSection: string | null = null; focusSection: string | null = null;
@@ -0,0 +1,38 @@
import { WritingRemark } from '../services/writing-review.model';
import { GapAction } from './gap-action.helper';
/**
* Lien « Voir » d'une remarque de relecture : ouvre l'éditeur concerné avec la
* section en cause dépliée (`?focus=…`), comme le « Corriger » du readiness.
*/
export function remarkAction(remark: WritingRemark, campaignId: string): GapAction {
const base = ['/campaigns', campaignId];
const focus = FOCUS_BY_RULE[remark.ruleId];
const queryParams = focus ? { focus } : undefined;
switch (remark.entityType) {
case 'SCENE':
return {
link: [...base, 'arcs', remark.arcId ?? '', 'chapters', remark.chapterId ?? '', 'scenes', remark.entityId, 'edit'],
queryParams
};
case 'CHAPTER':
// Couloir / rythme : c'est l'enchaînement des scènes qu'il faut voir (vue du chapitre).
if (!focus) return { link: [...base, 'arcs', remark.arcId ?? '', 'chapters', remark.entityId] };
return { link: [...base, 'arcs', remark.arcId ?? '', 'chapters', remark.entityId, 'edit'], queryParams };
case 'ARC':
return { link: [...base, 'arcs', remark.entityId, 'edit'], queryParams };
default:
return { link: base };
}
}
/** Section de l'éditeur à déplier selon la règle (clé = ruleId complet). */
const FOCUS_BY_RULE: Record<string, string> = {
'WRITE-002-FAKE-CHOICE': 'branches',
'WRITE-003-SINGLE-CLUE': 'branches',
'WRITE-005-NO-STAKES': 'stakes',
'WRITE-006-LONG-NARRATION': 'narration',
'WRITE-007-NARRATION-DECIDES': 'narration',
'WRITE-008-COMBAT-NO-PURPOSE': 'combat',
'WRITE-009-SINGLE-ENDING': 'choices'
};
@@ -0,0 +1,39 @@
import { SceneType } from './campaign.model';
/**
* Squelette d'aventure produit par une méthode guidée (Mentor d'écriture, phase M3),
* envoyé à POST /api/campaigns/{id}/guided-skeleton. Miroir du record Java `GuidedSkeleton`.
*/
export interface GuidedChapterSpec {
name: string;
description?: string | null;
playerObjectives?: string | null;
narrativeStakes?: string | null;
}
export interface GuidedSceneSpec {
name: string;
description?: string | null;
type: SceneType;
location?: string | null;
choicesConsequences?: string | null;
gmSecretNotes?: string | null;
enemies?: string | null;
}
export interface GuidedSkeleton {
/** Arc linéaire existant… */
arcId?: string | null;
/** …ou nom du nouvel arc (exactement l'un des deux). */
newArcName?: string | null;
chapter: GuidedChapterSpec;
scenes: GuidedSceneSpec[];
linkSequentially: boolean;
linkLabel?: string | null;
}
export interface GuidedSkeletonResult {
arcId: string;
chapterId: string;
sceneIds: string[];
}
@@ -0,0 +1,15 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { GuidedSkeleton, GuidedSkeletonResult } from './guided-skeleton.model';
/** Service HTTP des méthodes guidées (Mentor d'écriture, phase M3). */
@Injectable({ providedIn: 'root' })
export class GuidedSkeletonService {
constructor(private http: HttpClient) {}
create(campaignId: string, skeleton: GuidedSkeleton): Observable<GuidedSkeletonResult> {
return this.http.post<GuidedSkeletonResult>(`/api/campaigns/${campaignId}/guided-skeleton`, skeleton);
}
}
@@ -0,0 +1,29 @@
import { ReadinessEntityType } from './readiness.model';
/**
* Modèles de la relecture d'éditeur (Mentor d'écriture, phase M2) renvoyés par
* GET /api/campaigns/{id}/writing-review. Le back renvoie la règle et ses paramètres ;
* le texte (observation / pourquoi / question) vient de l'i18n `writingReview.rules.<ruleId>`.
*/
export type WritingRemarkCategory = 'AGENCY' | 'PACING' | 'STAKES' | 'NARRATION';
export interface WritingRemark {
entityType: ReadinessEntityType;
entityId: string;
entityName?: string | null;
ruleId: string;
category: WritingRemarkCategory;
/** Valeurs injectées dans le texte i18n (count, phrase, target…). */
params: Record<string, string>;
arcId?: string | null;
chapterId?: string | null;
}
export interface WritingReviewReport {
campaignId: string;
remarks: WritingRemark[];
}
/** Ordre d'affichage des familles de remarques. */
export const WRITING_REMARK_CATEGORIES: WritingRemarkCategory[] = ['AGENCY', 'STAKES', 'PACING', 'NARRATION'];
@@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { WritingReviewReport } from './writing-review.model';
/**
* Service HTTP de la relecture d'éditeur (Mentor d'écriture, phase M2).
* Read-model pur, déterministe, sans effet de bord.
*/
@Injectable({ providedIn: 'root' })
export class WritingReviewService {
constructor(private http: HttpClient) {}
getReview(campaignId: string): Observable<WritingReviewReport> {
return this.http.get<WritingReviewReport>(`/api/campaigns/${campaignId}/writing-review`);
}
}
@@ -1,17 +1,22 @@
<div class="expandable-section" [class.private]="variant === 'private'"> <div class="expandable-section" [class.private]="variant === 'private'">
<button type="button" class="section-header" (click)="toggle()"> <div class="section-header-row">
<span class="section-title"> <button type="button" class="section-header" (click)="toggle()">
@if (icon) { <span class="section-title">
<span class="section-icon">{{ icon }}</span> @if (icon) {
} <span class="section-icon">{{ icon }}</span>
{{ title }} }
@if (filled) { {{ title }}
<span class="section-dot" aria-hidden="true"></span> @if (filled) {
} <span class="section-dot" aria-hidden="true"></span>
</span> }
<lucide-icon [img]="isOpen ? ChevronUp : ChevronDown" [size]="16"></lucide-icon> </span>
</button> <lucide-icon [img]="isOpen ? ChevronUp : ChevronDown" [size]="16"></lucide-icon>
</button>
@if (coachTopic) {
<app-writing-coach-trigger class="section-coach" [topic]="coachTopic"></app-writing-coach-trigger>
}
</div>
@if (isOpen) { @if (isOpen) {
<div class="section-content"> <div class="section-content">
@@ -9,12 +9,25 @@
&.private { &.private {
border-color: #7f1d1d; border-color: #7f1d1d;
.section-header { background: rgba(127, 29, 29, 0.12); } .section-header-row { background: rgba(127, 29, 29, 0.12); }
.section-title { color: #fca5a5; } .section-title { color: #fca5a5; }
} }
} }
// En-tête = bouton de repli + éventuel 💡 du coach d'écriture (bouton frère :
// pas de bouton imbriqué dans un bouton).
.section-header-row {
display: flex;
align-items: center;
}
.section-coach {
margin-right: 0.6rem;
}
.section-header { .section-header {
flex: 1;
min-width: 0;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1,6 +1,7 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { LucideAngularModule, ChevronDown, ChevronUp } from 'lucide-angular'; import { LucideAngularModule, ChevronDown, ChevronUp } from 'lucide-angular';
import { WritingCoachTriggerComponent } from '../writing-coach/writing-coach-trigger.component';
/** /**
* Section repliable avec titre (icône + texte) et contenu projeté via ng-content. * Section repliable avec titre (icône + texte) et contenu projeté via ng-content.
@@ -13,7 +14,7 @@ import { LucideAngularModule, ChevronDown, ChevronUp } from 'lucide-angular';
*/ */
@Component({ @Component({
selector: 'app-expandable-section', selector: 'app-expandable-section',
imports: [LucideAngularModule], imports: [LucideAngularModule, WritingCoachTriggerComponent],
templateUrl: './expandable-section.component.html', templateUrl: './expandable-section.component.html',
styleUrls: ['./expandable-section.component.scss'] styleUrls: ['./expandable-section.component.scss']
}) })
@@ -31,6 +32,11 @@ export class ExpandableSectionComponent implements OnInit {
* sans avoir à les ouvrir une à une. Le parent calcule l'état. * sans avoir à les ouvrir une à une. Le parent calcule l'état.
*/ */
@Input() filled = false; @Input() filled = false;
/**
* Sujet du coach d'écriture (ex. `scene.choices`) : affiche un 💡 dans l'en-tête
* qui ouvre les conseils. Pour les sections qui n'ont pas de libellé par champ.
*/
@Input() coachTopic: string | null = null;
isOpen = false; isOpen = false;
@@ -0,0 +1,65 @@
import { readFileSync, readdirSync, statSync } from 'node:fs';
import { join } from 'node:path';
/**
* Garde-fou du contenu du coach d'écriture : chaque sujet référencé dans un
* template (`topic="…"` ou `coachTopic="…"`) doit exister en fr ET en en, avec
* ses 4 rubriques renseignées. Sinon le 💡 ouvrirait un panneau vide.
*/
const APP_DIR = join(process.cwd(), 'src/app');
const FRAGMENTS_DIR = join(process.cwd(), 'src/assets/i18n/fragments');
function htmlFiles(dir: string): string[] {
return readdirSync(dir).flatMap(name => {
const path = join(dir, name);
if (statSync(path).isDirectory()) return htmlFiles(path);
return name.endsWith('.html') ? [path] : [];
});
}
function referencedTopics(): string[] {
const topics = new Set<string>();
for (const file of htmlFiles(APP_DIR)) {
const html = readFileSync(file, 'utf-8');
for (const m of html.matchAll(/<app-writing-coach-trigger[^>]*\stopic="([^"]+)"/g)) topics.add(m[1]);
for (const m of html.matchAll(/\scoachTopic="([^"]+)"/g)) topics.add(m[1]);
}
return [...topics].sort();
}
function topicsOf(lang: 'fr' | 'en'): Record<string, Record<string, Record<string, unknown>>> {
const json = JSON.parse(readFileSync(join(FRAGMENTS_DIR, `writing-coach.${lang}.json`), 'utf-8'));
return json.writingCoach.topics;
}
function lookup(lang: 'fr' | 'en', key: string): Record<string, unknown> | undefined {
const [entity, field] = key.split('.');
return topicsOf(lang)[entity]?.[field];
}
describe('writing coach content', () => {
const topics = referencedTopics();
it('is referenced by the editors', () => {
expect(topics.length).toBeGreaterThan(0);
});
for (const lang of ['fr', 'en'] as const) {
it.each(topics)(`${lang}: topic %s is complete`, key => {
const topic = lookup(lang, key);
expect(topic, `writingCoach.topics.${key} manquant (${lang})`).toBeDefined();
for (const field of ['title', 'purpose', 'example', 'pitfall']) {
expect(typeof topic![field] === 'string' && (topic![field] as string).trim().length > 0,
`${key}.${field} vide (${lang})`).toBe(true);
}
const questions = topic!['questions'];
expect(Array.isArray(questions) && questions.length >= 2, `${key}.questions < 2 (${lang})`).toBe(true);
});
}
it('has the same topics in fr and en', () => {
const keys = (lang: 'fr' | 'en') => Object.entries(topicsOf(lang))
.flatMap(([entity, fields]) => Object.keys(fields).map(f => `${entity}.${f}`)).sort();
expect(keys('en')).toEqual(keys('fr'));
});
});
@@ -0,0 +1,57 @@
<aside class="coach-panel" [class.open]="!!topic()"
role="complementary"
[attr.aria-hidden]="!topic()"
[attr.aria-label]="'writingCoach.panelLabel' | translate">
@if (content(); as c) {
<header class="coach-header">
<div class="coach-heading">
<span class="coach-kicker">
<lucide-icon [img]="Lightbulb" [size]="14"></lucide-icon>
{{ 'writingCoach.kicker' | translate }}
</span>
<h2>{{ c.title }}</h2>
</div>
<button type="button" class="coach-close" (click)="close()"
[title]="'common.close' | translate" [attr.aria-label]="'common.close' | translate">
<lucide-icon [img]="X" [size]="16"></lucide-icon>
</button>
</header>
<div class="coach-body">
<section class="coach-block">
<h3>{{ 'writingCoach.purposeTitle' | translate }}</h3>
<p>{{ c.purpose }}</p>
</section>
@if (c.questions.length) {
<section class="coach-block">
<h3>{{ 'writingCoach.questionsTitle' | translate }}</h3>
<ul class="coach-questions">
@for (q of c.questions; track q) {
<li>{{ q }}</li>
}
</ul>
</section>
}
@if (c.example) {
<section class="coach-block coach-example">
<h3>{{ 'writingCoach.exampleTitle' | translate }}</h3>
<p>{{ c.example }}</p>
</section>
}
@if (c.pitfall) {
<section class="coach-block coach-pitfall">
<h3>{{ 'writingCoach.pitfallTitle' | translate }}</h3>
<p>{{ c.pitfall }}</p>
</section>
}
</div>
<footer class="coach-footer">
<p>{{ 'writingCoach.footer' | translate }}</p>
</footer>
}
</aside>
@@ -0,0 +1,154 @@
:host {
// Le panneau gère lui-même son positionnement fixed.
display: contents;
}
.coach-panel {
position: fixed;
top: 0;
right: 0;
width: min(380px, 100vw);
height: 100vh;
background: #0f0f1a;
border-left: 1px solid #1e1e3a;
box-shadow: -12px 0 32px rgba(0, 0, 0, 0.35);
display: flex;
flex-direction: column;
transform: translateX(100%);
visibility: hidden;
transition: transform 0.25s ease, visibility 0s linear 0.25s;
// Au-dessus du drawer de chat IA (1000) : c'est le dernier ouvert qui compte.
z-index: 1001;
&.open {
transform: translateX(0);
visibility: visible;
transition: transform 0.25s ease;
}
}
.coach-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 0.75rem;
padding: 1.1rem 1.25rem 1rem;
border-bottom: 1px solid #1e1e3a;
flex-shrink: 0;
h2 {
margin: 0.35rem 0 0;
font-size: 1.05rem;
font-weight: 600;
color: white;
}
}
.coach-kicker {
display: inline-flex;
align-items: center;
gap: 0.35rem;
font-size: 0.72rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: #fbbf24;
}
.coach-close {
display: inline-flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
flex-shrink: 0;
border-radius: 6px;
border: none;
background: transparent;
color: #9ca3af;
cursor: pointer;
&:hover { background: #1f2937; color: white; }
&:focus-visible { outline: 2px solid #6c63ff; }
}
.coach-body {
flex: 1;
overflow-y: auto;
padding: 1.1rem 1.25rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.coach-block {
h3 {
margin: 0 0 0.45rem;
font-size: 0.78rem;
font-weight: 600;
letter-spacing: 0.03em;
text-transform: uppercase;
color: #9ca3af;
}
p {
margin: 0;
font-size: 0.9rem;
line-height: 1.55;
color: #e5e7eb;
// Les exemples peuvent contenir des retours à la ligne (puces).
white-space: pre-line;
}
}
.coach-questions {
margin: 0;
padding-left: 1.1rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
li {
font-size: 0.9rem;
line-height: 1.5;
color: #e5e7eb;
&::marker { color: #6c63ff; }
}
}
.coach-example {
padding: 0.85rem 1rem;
border-radius: 8px;
background: rgba(108, 99, 255, 0.08);
border: 1px solid rgba(108, 99, 255, 0.25);
p { font-style: italic; color: #d1d5db; }
}
.coach-pitfall {
padding: 0.85rem 1rem;
border-radius: 8px;
background: rgba(251, 191, 36, 0.06);
border: 1px solid rgba(251, 191, 36, 0.25);
h3 { color: #fbbf24; }
}
.coach-footer {
flex-shrink: 0;
padding: 0.85rem 1.25rem;
border-top: 1px solid #1e1e3a;
p {
margin: 0;
font-size: 0.78rem;
line-height: 1.5;
color: #6b7280;
}
}
@media (prefers-reduced-motion: reduce) {
.coach-panel,
.coach-panel.open { transition: none; }
}
@@ -0,0 +1,80 @@
import { Component, DestroyRef, HostListener, inject } from '@angular/core';
import { takeUntilDestroyed, toObservable, toSignal } from '@angular/core/rxjs-interop';
import { NavigationStart, Router } from '@angular/router';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { filter, map, of, switchMap } from 'rxjs';
import { LucideAngularModule, Lightbulb, X } from 'lucide-angular';
import { WritingCoachService } from './writing-coach.service';
/** Fiche de conseils d'un champ, telle que rangée dans `writingCoach.topics.<clé>`. */
export interface WritingCoachTopic {
title: string;
purpose: string;
questions: string[];
example: string;
pitfall: string;
}
/**
* Panneau latéral du coach d'écriture, monté une seule fois dans le shell
* (comme `app-confirm-dialog-host`). Non modal : on peut continuer à écrire
* dans le formulaire pendant qu'il est ouvert.
*
* Posture « mentor d'abord » : il explique et questionne, il n'écrit jamais
* à la place du MJ (l'IA qui écrit reste le bouton « Étoffer avec l'IA »).
*/
@Component({
selector: 'app-writing-coach-panel',
imports: [LucideAngularModule, TranslatePipe],
templateUrl: './writing-coach-panel.component.html',
styleUrls: ['./writing-coach-panel.component.scss']
})
export class WritingCoachPanelComponent {
readonly Lightbulb = Lightbulb;
readonly X = X;
private readonly coach = inject(WritingCoachService);
private readonly translate = inject(TranslateService);
readonly topic = this.coach.topic;
/** Contenu du sujet ouvert, re-résolu au changement de langue. */
readonly content = toSignal(
toObservable(this.coach.topic).pipe(
switchMap(key => key
? this.translate.stream(`writingCoach.topics.${key}`).pipe(map(value => toTopic(value)))
: of(null))
),
{ initialValue: null }
);
constructor() {
// Changer d'écran ferme le panneau : ses conseils concernaient l'ancien formulaire.
inject(Router).events
.pipe(filter(e => e instanceof NavigationStart), takeUntilDestroyed(inject(DestroyRef)))
.subscribe(() => this.coach.close());
}
@HostListener('document:keydown.escape')
onEscape(): void {
if (this.coach.topic()) this.coach.close();
}
close(): void {
this.coach.close();
}
}
/** Clé absente → ngx-translate renvoie la clé elle-même (string) : on n'affiche rien. */
function toTopic(value: unknown): WritingCoachTopic | null {
if (!value || typeof value !== 'object') return null;
const t = value as Partial<WritingCoachTopic>;
return {
title: t.title ?? '',
purpose: t.purpose ?? '',
questions: Array.isArray(t.questions) ? t.questions : [],
example: t.example ?? '',
pitfall: t.pitfall ?? ''
};
}
@@ -0,0 +1,69 @@
import { Component, Input, computed, inject, signal } from '@angular/core';
import { TranslatePipe } from '@ngx-translate/core';
import { LucideAngularModule, Lightbulb } from 'lucide-angular';
import { WritingCoachService } from './writing-coach.service';
/**
* Petit bouton 💡 posé à côté d'un libellé de champ : ouvre le panneau de
* conseils d'écriture sur le sujet donné.
*
* Usage :
* <div class="field-label-row">
* <label for="x">Enjeux</label>
* <app-writing-coach-trigger topic="chapter.stakes"></app-writing-coach-trigger>
* </div>
*/
@Component({
selector: 'app-writing-coach-trigger',
imports: [LucideAngularModule, TranslatePipe],
template: `
<button type="button" class="coach-trigger"
[class.active]="active()"
[attr.aria-pressed]="active()"
[title]="'writingCoach.triggerTitle' | translate"
[attr.aria-label]="'writingCoach.triggerTitle' | translate"
(click)="onClick($event)">
<lucide-icon [img]="Lightbulb" [size]="14"></lucide-icon>
</button>
`,
styles: [`
:host { display: inline-flex; }
.coach-trigger {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
padding: 0;
border-radius: 6px;
border: 1px solid transparent;
background: transparent;
color: #6b7280;
cursor: pointer;
transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.coach-trigger:hover { color: #fbbf24; background: rgba(251, 191, 36, 0.08); }
.coach-trigger:focus-visible { outline: 2px solid #6c63ff; outline-offset: 1px; }
.coach-trigger.active {
color: #fbbf24;
background: rgba(251, 191, 36, 0.12);
border-color: rgba(251, 191, 36, 0.4);
}
`]
})
export class WritingCoachTriggerComponent {
readonly Lightbulb = Lightbulb;
private readonly coach = inject(WritingCoachService);
private readonly topicKey = signal('');
@Input({ required: true }) set topic(value: string) { this.topicKey.set(value); }
readonly active = computed(() => this.coach.topic() === this.topicKey());
onClick(event: MouseEvent): void {
// Peut vivre dans l'en-tête d'une section repliable : ne pas la replier/déplier.
event.stopPropagation();
this.coach.toggle(this.topicKey());
}
}
@@ -0,0 +1,30 @@
import { Injectable, signal } from '@angular/core';
/**
* Coach d'écriture (Mentor d'écriture, phase M1 — voir docs/conception-mentor-ecriture.md).
*
* État global du panneau de conseils : un seul sujet ouvert à la fois, identifié
* par une clé « entité.champ » (ex. `scene.choices`) qui pointe vers
* `writingCoach.topics.<clé>` dans les fichiers i18n. Contenu 100 % statique :
* pas d'IA, pas d'appel réseau.
*/
@Injectable({ providedIn: 'root' })
export class WritingCoachService {
private readonly current = signal<string | null>(null);
/** Sujet actuellement affiché, ou null si le panneau est fermé. */
readonly topic = this.current.asReadonly();
open(topic: string): void {
this.current.set(topic);
}
close(): void {
this.current.set(null);
}
/** Re-cliquer sur le 💡 du sujet ouvert referme le panneau. */
toggle(topic: string): void {
this.current.set(this.current() === topic ? null : topic);
}
}
@@ -0,0 +1,87 @@
import { Component, Input, inject } from '@angular/core';
import { RouterLink } from '@angular/router';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { LucideAngularModule, ArrowRight } from 'lucide-angular';
import { WritingRemark } from '../../services/writing-review.model';
import { remarkAction } from '../../campaigns/writing-remark-action.helper';
import { GapAction } from '../../campaigns/gap-action.helper';
/**
* Une remarque de relecture, en posture « mentor » : ce que j'observe, pourquoi
* ça compte, puis une question pour faire réfléchir (jamais de réécriture).
* Le texte vient de l'i18n `writingReview.rules.<ruleId>` ; le back fournit les paramètres.
*/
@Component({
selector: 'app-writing-remark-card',
imports: [RouterLink, TranslatePipe, LucideAngularModule],
template: `
<article class="remark">
<p class="remark-observation">{{ key('observation') | translate: textParams }}</p>
<p class="remark-why">{{ key('why') | translate: textParams }}</p>
<p class="remark-question">{{ key('question') | translate: textParams }}</p>
@if (showLink) {
<a class="remark-link" [routerLink]="action.link" [queryParams]="action.queryParams ?? null">
{{ 'writingReview.see' | translate }}
<lucide-icon [img]="ArrowRight" [size]="13"></lucide-icon>
</a>
}
</article>
`,
styles: [`
.remark {
display: flex;
flex-direction: column;
gap: 0.35rem;
padding: 0.8rem 0.95rem;
border-radius: 8px;
background: #111827;
border: 1px solid #1f2937;
border-left: 3px solid #fbbf24;
}
p { margin: 0; line-height: 1.5; }
.remark-observation { font-size: 0.88rem; font-weight: 600; color: #f3f4f6; }
.remark-why { font-size: 0.84rem; color: #9ca3af; }
.remark-question { font-size: 0.86rem; font-style: italic; color: #fcd34d; }
.remark-link {
align-self: flex-start;
display: inline-flex;
align-items: center;
gap: 0.3rem;
margin-top: 0.2rem;
font-size: 0.8rem;
font-weight: 600;
color: #a5b4fc;
text-decoration: none;
}
.remark-link:hover { color: #c7d2fe; text-decoration: underline; }
.remark-link:focus-visible { outline: 2px solid #6c63ff; outline-offset: 2px; border-radius: 4px; }
`]
})
export class WritingRemarkCardComponent {
readonly ArrowRight = ArrowRight;
private readonly translate = inject(TranslateService);
@Input({ required: true }) remark!: WritingRemark;
@Input() campaignId = '';
/** Lien vers l'éditeur concerné (inutile quand on est déjà dans cet éditeur). */
@Input() showLink = true;
key(part: 'observation' | 'why' | 'question'): string {
return `writingReview.rules.${this.remark.ruleId}.${part}`;
}
get action(): GapAction {
return remarkAction(this.remark, this.campaignId);
}
/** Paramètres du texte : ceux du back + le nom de l'entité + le genre de scène traduit. */
get textParams(): Record<string, string> {
const params: Record<string, string> = { ...this.remark.params, entity: this.remark.entityName ?? '' };
const kind = this.remark.params['kind'];
if (kind) {
params['kind'] = this.translate.instant(kind === 'COMBAT' ? 'writingReview.kindCombat' : `sceneType.${kind}`);
}
return params;
}
}
@@ -0,0 +1,74 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { remarkAction } from '../../campaigns/writing-remark-action.helper';
import { WritingRemark } from '../../services/writing-review.model';
/**
* Garde-fou de la relecture d'éditeur : chaque règle émise par le Core
* (WritingReviewService.java) doit avoir ses 3 textes en fr ET en en, sinon la
* carte afficherait des clés brutes.
*/
const SERVICE = join(process.cwd(), '../core/src/main/java/com/loremind/application/campaigncontext/WritingReviewService.java');
const FRAGMENTS_DIR = join(process.cwd(), 'src/assets/i18n/fragments');
function emittedRules(): string[] {
const java = readFileSync(SERVICE, 'utf-8');
return [...new Set([...java.matchAll(/"(WRITE-\d{3}-[A-Z-]+)"/g)].map(m => m[1]))].sort();
}
function rulesOf(lang: 'fr' | 'en'): Record<string, Record<string, string>> {
return JSON.parse(readFileSync(join(FRAGMENTS_DIR, `writing-review.${lang}.json`), 'utf-8')).writingReview.rules;
}
describe('writing review content', () => {
const rules = emittedRules();
it('finds the rules emitted by the core', () => {
expect(rules).toHaveLength(10);
});
for (const lang of ['fr', 'en'] as const) {
it.each(rules)(`${lang}: rule %s has its three texts`, ruleId => {
const texts = rulesOf(lang)[ruleId];
expect(texts, `${ruleId} manquant (${lang})`).toBeDefined();
for (const part of ['observation', 'why', 'question']) {
expect(texts[part]?.trim().length ?? 0, `${ruleId}.${part} vide (${lang})`).toBeGreaterThan(0);
}
});
}
it('has no orphan rule text', () => {
expect(Object.keys(rulesOf('fr')).sort()).toEqual(rules);
expect(Object.keys(rulesOf('en')).sort()).toEqual(rules);
});
});
describe('remarkAction', () => {
const base: WritingRemark = {
entityType: 'SCENE', entityId: 's1', ruleId: 'WRITE-007-NARRATION-DECIDES',
category: 'NARRATION', params: {}, arcId: 'a1', chapterId: 'c1'
};
it('opens the scene editor on the faulty section', () => {
expect(remarkAction(base, 'camp')).toEqual({
link: ['/campaigns', 'camp', 'arcs', 'a1', 'chapters', 'c1', 'scenes', 's1', 'edit'],
queryParams: { focus: 'narration' }
});
});
it('opens the chapter view for a corridor, the chapter editor for missing stakes', () => {
const chapter = { ...base, entityType: 'CHAPTER' as const, entityId: 'c1' };
expect(remarkAction({ ...chapter, ruleId: 'WRITE-001-CORRIDOR' }, 'camp').link)
.toEqual(['/campaigns', 'camp', 'arcs', 'a1', 'chapters', 'c1']);
expect(remarkAction({ ...chapter, ruleId: 'WRITE-005-NO-STAKES' }, 'camp')).toEqual({
link: ['/campaigns', 'camp', 'arcs', 'a1', 'chapters', 'c1', 'edit'],
queryParams: { focus: 'stakes' }
});
});
it('falls back to the campaign hub for campaign-wide remarks', () => {
const r = { ...base, entityType: 'CAMPAIGN' as const, entityId: 'camp', ruleId: 'WRITE-010-UNTYPED-SCENES' };
expect(remarkAction(r, 'camp').link).toEqual(['/campaigns', 'camp']);
});
});
@@ -0,0 +1,98 @@
import { Component, Input, OnChanges, SimpleChanges, inject } from '@angular/core';
import { TranslatePipe } from '@ngx-translate/core';
import { LucideAngularModule, ChevronDown, ChevronRight, Lightbulb } from 'lucide-angular';
import { ReadinessEntityType } from '../../services/readiness.model';
import { WritingRemark } from '../../services/writing-review.model';
import { WritingReviewService } from '../../services/writing-review.service';
import { WritingRemarkCardComponent } from './writing-remark-card.component';
/**
* Encart « Conseils de relecture » d'un éditeur (scène / chapitre / arc) : les remarques
* de la relecture d'éditeur qui concernent l'entité ouverte. Invisible s'il n'y en a pas.
*
* La relecture porte sur la version ENREGISTRÉE : après une sauvegarde, l'encart se met
* à jour au prochain chargement de l'éditeur.
*/
@Component({
selector: 'app-writing-review-hints',
imports: [TranslatePipe, LucideAngularModule, WritingRemarkCardComponent],
template: `
@if (remarks.length > 0) {
<section class="hints">
<button type="button" class="hints-header" (click)="open = !open" [attr.aria-expanded]="open">
<lucide-icon [img]="open ? ChevronDown : ChevronRight" [size]="15"></lucide-icon>
<lucide-icon [img]="Lightbulb" [size]="15" class="hints-icon"></lucide-icon>
<span>{{ 'writingReview.hintsTitle' | translate: { n: remarks.length } }}</span>
</button>
@if (open) {
<div class="hints-list">
@for (remark of remarks; track remark.ruleId) {
<app-writing-remark-card [remark]="remark" [campaignId]="campaignId" [showLink]="false">
</app-writing-remark-card>
}
</div>
}
</section>
}
`,
styles: [`
.hints {
background: rgba(251, 191, 36, 0.04);
border: 1px solid rgba(251, 191, 36, 0.25);
border-radius: 8px;
}
.hints-header {
display: flex;
align-items: center;
gap: 0.5rem;
width: 100%;
padding: 0.7rem 0.95rem;
background: transparent;
border: none;
border-radius: 8px;
color: #fde68a;
font-size: 0.88rem;
font-weight: 600;
cursor: pointer;
text-align: left;
}
.hints-header:hover { background: rgba(251, 191, 36, 0.06); }
.hints-header:focus-visible { outline: 2px solid #6c63ff; outline-offset: -2px; }
.hints-icon { color: #fbbf24; }
.hints-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0 0.95rem 0.95rem;
}
`]
})
export class WritingReviewHintsComponent implements OnChanges {
readonly ChevronDown = ChevronDown;
readonly ChevronRight = ChevronRight;
readonly Lightbulb = Lightbulb;
private readonly reviewService = inject(WritingReviewService);
@Input({ required: true }) campaignId = '';
@Input({ required: true }) entityType: ReadinessEntityType = 'SCENE';
@Input({ required: true }) entityId = '';
remarks: WritingRemark[] = [];
open = true;
ngOnChanges(changes: SimpleChanges): void {
if (!this.campaignId || !this.entityId) return;
if (changes['campaignId'] || changes['entityId'] || changes['entityType']) {
this.remarks = [];
const { entityType, entityId } = this;
this.reviewService.getReview(this.campaignId).subscribe({
next: report => {
this.remarks = report.remarks.filter(r => r.entityType === entityType && r.entityId === entityId);
},
error: () => { this.remarks = []; }
});
}
}
}
@@ -0,0 +1,37 @@
@if (report) {
<section class="review-panel">
<button type="button" class="review-header" (click)="toggle()" [attr.aria-expanded]="!collapsed">
<lucide-icon [img]="collapsed ? ChevronRight : ChevronDown" [size]="16"></lucide-icon>
<lucide-icon [img]="Lightbulb" [size]="16" class="review-icon"></lucide-icon>
<span class="review-title">{{ 'writingReview.title' | translate }}</span>
@if (total > 0) {
<span class="review-count">{{ 'writingReview.countN' | translate: { n: total } }}</span>
}
</button>
@if (!collapsed) {
<div class="review-body">
@if (total === 0) {
<p class="review-empty">{{ 'writingReview.allGood' | translate }}</p>
} @else {
<p class="review-intro">{{ 'writingReview.intro' | translate }}</p>
@for (group of groups; track group.category) {
<div class="review-group">
<h3>{{ ('writingReview.categories.' + group.category) | translate }}</h3>
<div class="review-list">
@for (remark of visible(group); track remark.ruleId + remark.entityId) {
<app-writing-remark-card [remark]="remark" [campaignId]="campaignId"></app-writing-remark-card>
}
</div>
@if (group.remarks.length > perGroup && !expanded.has(group.category)) {
<button type="button" class="review-more" (click)="showAll(group.category)">
{{ 'writingReview.showMore' | translate: { n: group.remarks.length - perGroup } }}
</button>
}
</div>
}
}
</div>
}
</section>
}
@@ -0,0 +1,92 @@
// Même gabarit que « Prochaines étapes » (readiness-panel), accent ambré du mentor.
.review-panel {
margin: 0 0 1.25rem;
background: #0d1117;
border: 1px solid #1f2937;
border-radius: 10px;
overflow: hidden;
}
.review-header {
display: flex;
align-items: center;
gap: 0.55rem;
width: 100%;
padding: 0.7rem 0.9rem;
background: transparent;
border: none;
color: #e5e7eb;
cursor: pointer;
text-align: left;
&:hover { background: #111827; }
&:focus-visible { outline: 2px solid #6c63ff; outline-offset: -2px; }
.review-icon { color: #fbbf24; }
}
.review-title {
font-weight: 600;
font-size: 0.92rem;
}
.review-count {
margin-left: auto;
padding: 0.1rem 0.5rem;
border-radius: 999px;
font-size: 0.72rem;
font-weight: 500;
background: #3a2e1a;
color: #fcd34d;
}
.review-body {
padding: 0 0.9rem 0.9rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
.review-intro,
.review-empty {
margin: 0;
font-size: 0.85rem;
line-height: 1.5;
color: #9ca3af;
}
.review-empty { color: #86efac; }
.review-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
h3 {
margin: 0;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: #6b7280;
}
}
.review-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.review-more {
align-self: flex-start;
padding: 0.2rem 0;
border: none;
background: none;
color: #a5b4fc;
font-size: 0.8rem;
cursor: pointer;
&:hover { text-decoration: underline; }
&:focus-visible { outline: 2px solid #6c63ff; border-radius: 4px; }
}
@@ -0,0 +1,86 @@
import { Component, Input, OnChanges, SimpleChanges, inject } from '@angular/core';
import { TranslatePipe } from '@ngx-translate/core';
import { LucideAngularModule, ChevronDown, ChevronRight, Lightbulb } from 'lucide-angular';
import { WritingReviewService } from '../../services/writing-review.service';
import {
WRITING_REMARK_CATEGORIES, WritingRemark, WritingRemarkCategory, WritingReviewReport
} from '../../services/writing-review.model';
import { WritingRemarkCardComponent } from './writing-remark-card.component';
interface RemarkGroup {
category: WritingRemarkCategory;
remarks: WritingRemark[];
}
/**
* Panneau « Relecture d'éditeur » du hub campagne (Mentor d'écriture, phase M2) :
* le pendant « qualité » de « Prochaines étapes ». Conseils regroupés par famille,
* chacun avec son lien vers l'éditeur concerné. Purement indicatif.
*/
@Component({
selector: 'app-writing-review-panel',
imports: [TranslatePipe, LucideAngularModule, WritingRemarkCardComponent],
templateUrl: './writing-review-panel.component.html',
styleUrls: ['./writing-review-panel.component.scss']
})
export class WritingReviewPanelComponent implements OnChanges {
readonly ChevronDown = ChevronDown;
readonly ChevronRight = ChevronRight;
readonly Lightbulb = Lightbulb;
/** Remarques visibles par famille avant « voir les autres ». */
readonly perGroup = 3;
private static readonly STORAGE_KEY = 'loremind.writingReview.collapsed';
private readonly reviewService = inject(WritingReviewService);
@Input({ required: true }) campaignId = '';
report: WritingReviewReport | null = null;
groups: RemarkGroup[] = [];
expanded = new Set<WritingRemarkCategory>();
collapsed = readCollapsed();
ngOnChanges(changes: SimpleChanges): void {
if (changes['campaignId'] && this.campaignId) {
this.reviewService.getReview(this.campaignId).subscribe({
next: report => {
this.report = report;
this.groups = WRITING_REMARK_CATEGORIES
.map(category => ({ category, remarks: report.remarks.filter(r => r.category === category) }))
.filter(g => g.remarks.length > 0);
},
// Conseil facultatif : en cas d'erreur, le panneau ne s'affiche simplement pas.
error: () => { this.report = null; }
});
}
}
get total(): number {
return this.report?.remarks.length ?? 0;
}
toggle(): void {
this.collapsed = !this.collapsed;
try {
localStorage.setItem(WritingReviewPanelComponent.STORAGE_KEY, this.collapsed ? '1' : '0');
} catch { /* stockage indisponible : préférence non mémorisée */ }
}
visible(group: RemarkGroup): WritingRemark[] {
return this.expanded.has(group.category) ? group.remarks : group.remarks.slice(0, this.perGroup);
}
showAll(category: WritingRemarkCategory): void {
this.expanded.add(category);
}
}
function readCollapsed(): boolean {
try {
return localStorage.getItem('loremind.writingReview.collapsed') === '1';
} catch {
return false;
}
}
+504
View File
@@ -1881,5 +1881,509 @@
"optTables": "Random tables", "optTables": "Random tables",
"optTablesHint": "Your encounter and event tables as Foundry RollTables.", "optTablesHint": "Your encounter and event tables as Foundry RollTables.",
"confirm": "Export" "confirm": "Export"
},
"writingCoach": {
"triggerTitle": "Writing tips",
"panelLabel": "Writing tips",
"kicker": "Writing tips",
"purposeTitle": "What it's for",
"questionsTitle": "Questions to help you",
"exampleTitle": "Example",
"pitfallTitle": "Common pitfall",
"footer": "These are guidelines, not rules: your adventure, your choices. Need concrete ideas? \"Flesh out with AI\" suggests options you accept one by one.",
"topics": {
"scene": {
"description": {
"title": "Short description",
"purpose": "Reminds you, in one sentence, what is at play here when you prep the session or need to improvise.",
"questions": [
"If you had to sum up this scene for another GM in ten seconds, what would you say?",
"What changes between the start and the end of the scene?",
"What do the characters come here looking for?"
],
"example": "The PCs must convince the ferrywoman to take them across the river before dawn, even though she has already been paid to turn them in.",
"pitfall": "Describing the set instead of the situation: \"a tavern\" says nothing about what is at play. A good description holds a goal or a tension."
},
"nodeType": {
"title": "Node type",
"purpose": "Tells you, and the tool, what kind of scene this is: a location to explore, an encounter, an NPC, an event or a revelation.",
"questions": [
"What will the players mostly do here: explore, fight, talk, endure or discover?",
"Does this scene deliver key information for what comes next? (then it's a revelation)"
],
"example": "An interrogation in the watch-house cellar is an \"NPC\" scene; finding the forged ledger hidden there is a \"revelation\".",
"pitfall": "Leaving everything as \"generic\": you lose sight of your adventure's pacing (three fights in a row then go unnoticed)."
},
"setting": {
"title": "Location and time",
"purpose": "Anchors the scene in a specific place and moment, so players can picture themselves there.",
"questions": [
"Why this place and not another? What opportunities or obstacles does it offer?",
"Does the timing add a constraint: night, a crowd, a storm, a bell about to ring?",
"What can be used here: a staircase, a chandelier, a crowd to hide in?"
],
"example": "The fish market, an hour before opening: the stalls are empty, but the merchants arrive soon and word will spread.",
"pitfall": "A neutral place that brings nothing. A good location gives the players ideas and the GM complications."
},
"atmosphere": {
"title": "Mood and atmosphere",
"purpose": "Gives you sensory details to pick from during play, bringing the scene to life without over-preparing.",
"questions": [
"What can be heard? Smelled? How warm or cold is it?",
"Which detail would a player remember after the session?",
"What emotion do you want to trigger: unease, wonder, urgency?"
],
"example": "Smell of warm wax and stale incense. A steady drip somewhere in the dark. The cold of the stone seeps through the boots.",
"pitfall": "Only describing what can be seen. Two senses other than sight do more than a long descriptive paragraph."
},
"narration": {
"title": "Narration for players",
"purpose": "The text you read aloud to open the scene. It sets the stage and puts the players in a position to act.",
"questions": [
"Can it be read in under a minute?",
"Does it end on a situation that calls for a reaction?",
"What must the players know, and what can they discover by asking questions?"
],
"example": "The mill door bangs in the wind. Inside, the millstone still turns, grinding nothing. On the floury floor, footprints lead to the trapdoor… and none come back. What do you do?",
"pitfall": "Deciding for the characters (\"you are scared\", \"you step in carefully\") or revealing everything at once. Describe what they perceive; let them choose what they feel and do."
},
"gmNotes": {
"title": "GM notes and secrets",
"purpose": "What the players don't know: hidden truths, NPC motives, what happens behind the scenes.",
"questions": [
"What happens if the players do nothing?",
"What is the scene's main NPC hiding, and why?",
"Which piece of information must you be able to find in three seconds during play?"
],
"example": "• The ferrywoman was paid by the watch.\n• Offered more, she hesitates, then betrays the watch.\n• If the PCs dawdle: the patrol arrives at the third bell.",
"pitfall": "Writing the whole scene as prose: in play, you won't find the information. Prefer short bullet points."
},
"choices": {
"title": "Choices and consequences",
"purpose": "What gives players agency: their decisions truly change what happens next.",
"questions": [
"What are at least two ways to approach the scene?",
"What does each option cost, or put at risk?",
"What happens on a failure? Does the scene still move forward?"
],
"example": "Bribe the ferrywoman: quick, but she will sell them out later. Threaten her: she gives in, but secretly warns the watch. Swim across: discreet, but the gear is lost or damaged.",
"pitfall": "\"Fake choices\": every option leads to the same result. And forgetting failure: a bad roll shouldn't stop the game, it should complicate it."
},
"branches": {
"title": "Story branches",
"purpose": "Link the scene to the next ones based on what the players do, so no choice leads to a dead end.",
"questions": [
"Where do the players go if they succeed? And if they fail?",
"What if they do something unexpected: flee, side with the enemy, ignore the lead?",
"Is a key piece of information reachable through a single path only?"
],
"example": "Success → \"The smugglers' passage\". Failure → \"Arrested by the watch\" (which also leads to the passage, but in chains). The ferrywoman's betrayal → \"Ambush on the riverbank\".",
"pitfall": "A single exit that depends on one successful roll. If the dice turn, the game stops: always keep a path open, even a costlier one."
},
"combat": {
"title": "Combat or encounter",
"purpose": "Prepare an encounter that is easy to read, and interesting beyond trading blows.",
"questions": [
"Why are these enemies fighting? What do they really want: flee, protect, steal, buy time?",
"Does the terrain change anything: high ground, water, darkness, things to knock over?",
"Can this fight be avoided, won another way, or lost without dying?"
],
"example": "Three smugglers aren't trying to kill anyone: they want to sink the boat holding the evidence. If they succeed, the fight is lost, even with every PC still standing.",
"pitfall": "The \"bag of hit points\" fight: with no goal other than taking the enemy down, it quickly becomes repetitive. Give each side a purpose."
}
},
"chapter": {
"synopsis": {
"title": "Synopsis",
"purpose": "Your overview: the starting situation, what happens, and how it might end.",
"questions": [
"How are the characters involved?",
"What pushes them to act now rather than later?",
"What are two or three possible outcomes?"
],
"example": "The Vaulx bridge collapsed overnight and the village is cut off from the market. The bailiff blames the miners; the miners blame the bailiff. The PCs, stuck on the wrong bank, are the only ones nobody suspects.",
"pitfall": "Telling the story like a novel, including what the characters will do. Describe the situation and the forces at play, not the players' path."
},
"objectives": {
"title": "Player objectives",
"purpose": "What the characters are trying to achieve, from their own point of view.",
"questions": [
"Do the players clearly know what they have to do?",
"How and when will they find out?",
"Can the objective shift along the way, after a revelation?"
],
"example": "Find out who sabotaged the bridge, and prove it before the spring fair.",
"pitfall": "An objective only the GM knows: the players wander without knowing what to do. If they can't put it into words, they don't have it."
},
"stakes": {
"title": "Narrative stakes",
"purpose": "What is at stake: what can be gained and, above all, what can be lost.",
"questions": [
"What happens if the characters fail? Who suffers?",
"Does it affect a character personally?",
"Can the players lose something even when they succeed?"
],
"example": "If the culprit isn't found, the bailiff will hang the brother of the blacksmith, the PCs' ally, as an example.",
"pitfall": "Abstract stakes (\"save the kingdom\") with no face. An NPC the players like, in danger, matters more than an entire kingdom."
}
},
"arc": {
"synopsis": {
"title": "Arc synopsis",
"purpose": "The arc's main thread: the central problem and what drives it forward.",
"questions": [
"What is the central problem of this arc?",
"Who is responsible for it, and what do they want?",
"What happens if the characters don't step in?"
],
"example": "A guild of cartographers is slowly erasing villages from the official maps, to sell the \"empty\" land to the crown. Unchecked, three villages will vanish by winter.",
"pitfall": "A synopsis with no antagonist or opposing force: nothing drives the story, and the players wait for something to happen."
},
"themes": {
"title": "Themes",
"purpose": "The story's colour, what it is really about beyond the plot.",
"questions": [
"What moral question will the players face?",
"What hard choice will the arc force on them?"
],
"example": "Official truth versus lived truth. How far should one obey an unjust law?",
"pitfall": "Listing genres (\"horror, mystery\") instead of themes. A genre says how the story is told; a theme says what it is about."
},
"stakes": {
"title": "Stakes",
"purpose": "What changes, for the world and for the characters, depending on how the arc ends.",
"questions": [
"What becomes of the world if the antagonist wins?",
"What do the characters gain by getting involved?",
"What do they personally risk?"
],
"example": "If the guild wins, entire families lose their land, including one PC's home village.",
"pitfall": "Stakes that don't concern the characters. Always tie the world's problem to something they care about."
},
"rewards": {
"title": "Rewards and progression",
"purpose": "What motivates the characters and marks their progress.",
"questions": [
"Beyond gold, what can they gain: allies, reputation, knowledge, a place of their own?",
"How does the world react to their success?"
],
"example": "The gratitude of the saved villages (a safe haven), a true map nobody else owns, and a sworn enemy within the guild.",
"pitfall": "Only planning gold and items. The most memorable rewards change the characters' place in the world."
},
"resolution": {
"title": "Planned resolution",
"purpose": "The arc's possible endings, not a fixed one.",
"questions": [
"What are two or three possible outcomes?",
"What happens if the characters fail?",
"What stays open for what comes next?"
],
"example": "The guild is publicly exposed; or the PCs buy it out themselves; or the villages are lost and the next arc opens with the exodus.",
"pitfall": "A single ending written in advance: the players' choices no longer matter. Prepare outcomes, not a script."
}
}
}
},
"writingReview": {
"title": "Editor's review",
"countN": "{{n}} tip(s)",
"intro": "Writing tips to bring your adventure to life. Nothing mandatory: keep what serves your story.",
"allGood": "Nothing to report: your campaign avoids the classic pitfalls the review can spot.",
"showMore": "Show {{n}} more",
"see": "View",
"hintsTitle": "Review tips ({{n}})",
"kindCombat": "Combat",
"categories": {
"AGENCY": "Player agency",
"STAKES": "Stakes",
"PACING": "Pacing",
"NARRATION": "Narration"
},
"rules": {
"WRITE-001-CORRIDOR": {
"observation": "\"{{entity}}\" chains {{count}} scenes without any choice or branch.",
"why": "The players follow a path drawn in advance: they may feel like spectators of the story.",
"question": "At what point could they decide something that changes what happens next?"
},
"WRITE-002-FAKE-CHOICE": {
"observation": "The {{count}} exits of \"{{entity}}\" all lead to \"{{target}}\".",
"why": "When every option ends up in the same place, it's a fake choice, and players eventually notice.",
"question": "What could differ depending on the option chosen: a place, an ally, a price to pay?"
},
"WRITE-003-SINGLE-CLUE": {
"observation": "The revelation \"{{entity}}\" is linked from only {{incoming}} scene(s).",
"why": "If the players miss that path, they lose the information and the story stalls. The three clue rule suggests three ways to discover every essential piece of information.",
"question": "In which other scenes could the players find a clue leading there?"
},
"WRITE-004-MONOTONOUS-PACING": {
"observation": "\"{{entity}}\" chains {{count}} \"{{kind}}\" scenes in a row.",
"why": "Repetition wears the table out: three fights in a row, or three conversations, end up feeling the same.",
"question": "Could a scene of another kind (exploration, conversation, revelation) fit in between?"
},
"WRITE-005-NO-STAKES": {
"observation": "\"{{entity}}\" has no written stakes yet.",
"why": "Without stakes, the players don't know why they should act or what they risk: tension drops.",
"question": "What happens if the characters fail, and who suffers?"
},
"WRITE-006-LONG-NARRATION": {
"observation": "The narration of \"{{entity}}\" is {{chars}} characters long, more than a minute when read aloud.",
"why": "Past one minute, the players' attention drifts and important details get lost.",
"question": "What is essential to open the scene, and what can be discovered in play?"
},
"WRITE-007-NARRATION-DECIDES": {
"observation": "The narration of \"{{entity}}\" contains \"{{phrase}}\".",
"why": "The text decides what the characters do or feel. Players like to stay in charge of their reactions.",
"question": "How could you describe the situation so that they want to react that way on their own?"
},
"WRITE-008-COMBAT-NO-PURPOSE": {
"observation": "The fight in \"{{entity}}\" has no described choices and no notes on the enemies' motives.",
"why": "A fight with no goal other than taking the enemy down quickly becomes repetitive.",
"question": "What do these enemies really want: flee, protect, steal, buy time?"
},
"WRITE-009-SINGLE-ENDING": {
"observation": "\"{{entity}}\", the last scene of the arc \"{{arc}}\", offers no choice and no exit.",
"why": "A single ending written in advance takes the weight out of the players' decisions.",
"question": "What happens if the characters fail, or switch sides?"
},
"WRITE-010-UNTYPED-SCENES": {
"observation": "{{percent}}% of the campaign's scenes have no type ({{count}} scenes).",
"why": "Without types, you can't see the adventure's pacing at a glance, and the review can't help you with it.",
"question": "For each scene: will the players mostly explore, fight, talk, go through an event or discover something?"
}
}
},
"guided": {
"entry": "Guided method",
"entryFirst": "Write an adventure step by step",
"backToCampaign": "Back to the campaign",
"progress": "Step {{n}} of {{total}}",
"exampleLabel": "Example",
"previous": "Previous",
"next": "Next",
"create": "Create the adventure",
"creating": "Creating…",
"restart": "Start over",
"restartTitle": "Start the method over?",
"restartMessage": "All your answers will be erased.",
"createError": "Creation failed. Your answers are kept: try again in a moment.",
"unknownMethod": "This guided method doesn't exist.",
"placementExisting": "Add it to an existing arc",
"placementArcLabel": "Arc",
"placementNew": "Create a new arc",
"placementNewArcLabel": "New arc name",
"placementNewArcPlaceholder": "E.g.: The Northern Lands",
"reviewArc": "Arc",
"reviewChapter": "Chapter",
"linkScenes": "Link the rooms in order (\"To the next room\" exits)",
"linkLabel": "To the next room",
"reviewAfter": "Everything stays editable afterwards. Have a look at the \"Editor's review\" on the campaign page: it will tell you what can still be strengthened.",
"fiveRoom": {
"name": "Five-room dungeon",
"steps": {
"placement": {
"title": "The five-room dungeon",
"why": "A simple method to write a short, complete adventure, ideal for one session. It chains five key moments: a guardian at the entrance, a challenge that can't be solved with a sword, a setback, the climax, then the reward. The \"dungeon\" can be any place: a manor, a ship, a forest, a masked ball… Start by choosing where to file the adventure in your campaign.",
"example": "A crypt under a village chapel, where a relic was stolen. Or a smuggler's ship, on the night it sets sail."
},
"frame": {
"title": "The setting",
"why": "Before the rooms, lay down the essentials: a name, a place, and above all a hook. The hook is why the characters go there now. If it concerns them personally, they will commit on their own.",
"example": "\"The stolen reliquary\": the village priest, a friend of one PC, vanished with the relic. He was seen going down into the crypt, and the pilgrimage arrives in three days."
},
"stakes": {
"title": "What the players want, and what they risk",
"why": "The players must know what they came to do, or they will wander. And failure must cost something: that's what creates tension.",
"example": "Goal: bring the relic back before the pilgrimage. Stakes: without it, the village loses its protection, and the priest will be blamed for the theft."
},
"room1": {
"title": "Room 1: the entrance and its guardian",
"why": "Something stops anyone from getting in. It starts the adventure right away, and explains why nobody has conquered this place yet. The guardian doesn't have to be a monster: a guard to convince or a dangerous passage work too.",
"example": "An old spectral guardian blocks the crypt stairs. He lets through anyone who proves they came to protect the relic, not steal it."
},
"room2": {
"title": "Room 2: the challenge",
"why": "Here, a sword isn't enough: a puzzle, a negotiation, a place to explore carefully. It lets non-fighters shine, and changes the pace after the entrance.",
"example": "A hall of identical tombs: only the founder's opens, and the clues are in the epitaphs."
},
"room3": {
"title": "Room 3: the setback",
"why": "A trap, a red herring or a nasty surprise: things get complicated right before the climax. The characters' resources run low, tension rises.",
"example": "The priest is found… but he is the thief. He was bewitched, and he just triggered the collapse of the gallery."
},
"room4": {
"title": "Room 4: the climax",
"why": "The big confrontation, the most intense moment of the adventure. To make it memorable, give the opponent a goal other than fighting, and terrain that changes the game.",
"example": "The enchantress wants to finish the ritual before dawn. She fights while protecting the circle of candles: putting it out weakens her, but reaching it means crossing icy water."
},
"room5": {
"title": "Room 5: the reward or the revelation",
"why": "The ending rewards the effort: a treasure, an ally, knowledge. It's also the right time for a twist that opens what comes next in your campaign.",
"example": "The relic is saved, and the freed priest becomes an ally. But the circle bore a symbol: that of a brotherhood the PCs have already met elsewhere."
},
"review": {
"title": "Your adventure is ready to be created",
"why": "Here is what will be created: a chapter and its five scenes, already typed so the review can help you with pacing."
}
},
"fields": {
"title": {
"label": "Adventure name",
"placeholder": "E.g.: The stolen reliquary"
},
"location": {
"label": "The place",
"placeholder": "E.g.: The crypt under the chapel"
},
"hook": {
"label": "The hook: why do the characters go there now?",
"placeholder": "Who sends them, what's urgent, how does it concern them?"
},
"objectives": {
"label": "What the players want to achieve",
"placeholder": "Phrased the way the players would say it"
},
"stakes": {
"label": "What happens if they fail",
"placeholder": "Who suffers? What is lost?"
},
"room1": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The guarded entrance"
},
"nature": {
"label": "How does the encounter play out?"
},
"description": {
"label": "What blocks the entrance",
"placeholder": "Who or what guards the entrance, and why?"
},
"enemies": {
"label": "Possible opponents",
"placeholder": "E.g.: a spectral guardian"
},
"choices": {
"label": "How to get through? And if it goes wrong?",
"placeholder": "At least two ways through, and what happens on a failure"
},
"secret": {
"label": "What the GM knows (secret, guardian's motive)",
"placeholder": "What the players don't know"
}
},
"room2": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The challenge"
},
"nature": {
"label": "What kind of challenge?"
},
"description": {
"label": "The challenge",
"placeholder": "What must be solved, convinced or discovered?"
},
"choices": {
"label": "How to succeed? And on a failure?",
"placeholder": "The possible approaches, and what a failure costs"
},
"secret": {
"label": "The solution and clues (for the GM)",
"placeholder": "Where the clues are, what the answer is"
}
},
"room3": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The setback"
},
"description": {
"label": "The setback",
"placeholder": "Which trap, which nasty surprise?"
},
"choices": {
"label": "How can the players react?",
"placeholder": "The options, and what they cost"
},
"secret": {
"label": "What hides behind it (for the GM)",
"placeholder": "The truth behind the red herring or the trap"
}
},
"room4": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The climax"
},
"description": {
"label": "The confrontation",
"placeholder": "Who do they face, and in what setting?"
},
"enemies": {
"label": "Opponents",
"placeholder": "E.g.: the enchantress and two followers"
},
"choices": {
"label": "How to win other than by striking?",
"placeholder": "Goals, terrain features, outcome if the PCs lose"
},
"secret": {
"label": "What the opponent really wants (for the GM)",
"placeholder": "Their goal, what they'll do when in trouble"
}
},
"room5": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The reward"
},
"description": {
"label": "The reward",
"placeholder": "What do the characters gain?"
},
"choices": {
"label": "Consequences for what comes next",
"placeholder": "What changes in the world depending on what they did"
},
"secret": {
"label": "The revelation or twist (for the GM)",
"placeholder": "What opens the rest of your campaign"
}
}
},
"options": {
"room1": {
"nature": {
"combat": "A fight",
"social": "A conversation",
"obstacle": "An obstacle"
}
},
"room2": {
"nature": {
"puzzle": "A puzzle",
"social": "A negotiation",
"exploration": "An exploration"
}
}
},
"defaults": {
"room1": {
"name": "The guarded entrance"
},
"room2": {
"name": "The challenge"
},
"room3": {
"name": "The setback"
},
"room4": {
"name": "The climax"
},
"room5": {
"name": "The reward"
}
}
}
} }
} }
+504
View File
@@ -1881,5 +1881,509 @@
"optTables": "Tables aléatoires", "optTables": "Tables aléatoires",
"optTablesHint": "Vos tables de rencontres et d'événements en RollTables Foundry.", "optTablesHint": "Vos tables de rencontres et d'événements en RollTables Foundry.",
"confirm": "Exporter" "confirm": "Exporter"
},
"writingCoach": {
"triggerTitle": "Conseils d'écriture",
"panelLabel": "Conseils d'écriture",
"kicker": "Conseils d'écriture",
"purposeTitle": "À quoi ça sert",
"questionsTitle": "Questions pour t'aider",
"exampleTitle": "Exemple",
"pitfallTitle": "Piège classique",
"footer": "Ce sont des repères, pas des règles : ton aventure, tes choix. Besoin d'idées concrètes ? « Étoffer avec l'IA » propose des pistes que tu valides une à une.",
"topics": {
"scene": {
"description": {
"title": "Description courte",
"purpose": "Te rappeler en une phrase ce qui se joue ici, quand tu prépares la séance ou que tu dois improviser.",
"questions": [
"Si tu devais résumer la scène à un autre MJ en dix secondes, que dirais-tu ?",
"Qu'est-ce qui change entre le début et la fin de la scène ?",
"Qu'est-ce que les personnages viennent chercher ici ?"
],
"example": "Les PJ doivent convaincre la passeuse de leur faire traverser le fleuve avant l'aube, alors qu'elle a déjà été payée pour les dénoncer.",
"pitfall": "Décrire le décor au lieu de la situation : « une taverne » ne dit pas ce qui s'y joue. Une bonne description contient un objectif ou une tension."
},
"nodeType": {
"title": "Type de nœud",
"purpose": "Dire, à toi comme à l'outil, la nature de la scène : lieu à explorer, rencontre, PNJ, événement ou révélation.",
"questions": [
"Qu'est-ce que les joueurs vont surtout faire ici : explorer, combattre, parler, subir ou découvrir ?",
"Cette scène apporte-t-elle une information clé pour la suite ? (c'est alors une révélation)"
],
"example": "Un interrogatoire dans la cave du guet est une scène « PNJ » ; la découverte du registre falsifié qui s'y cache est une « révélation ».",
"pitfall": "Tout laisser en « générique » : tu perds la vue d'ensemble du rythme de ton aventure (trois combats d'affilée passent alors inaperçus)."
},
"setting": {
"title": "Lieu et moment",
"purpose": "Ancrer la scène quelque part et à un moment précis, pour que les joueurs puissent s'y projeter.",
"questions": [
"Pourquoi ce lieu-là plutôt qu'un autre ? Qu'offre-t-il comme opportunités ou obstacles ?",
"Le moment ajoute-t-il une contrainte : la nuit, la foule, la tempête, une cloche qui va sonner ?",
"Que peut-on y utiliser : un escalier, un lustre, une foule où se cacher ?"
],
"example": "Le marché aux poissons, une heure avant l'ouverture : les étals sont vides, mais les marchands arrivent bientôt et tout se saura.",
"pitfall": "Un lieu neutre qui n'apporte rien. Un bon lieu donne des idées aux joueurs et des complications au MJ."
},
"atmosphere": {
"title": "Ambiance et atmosphère",
"purpose": "Te donner des détails sensoriels à piocher en jeu, pour rendre la scène vivante sans tout préparer.",
"questions": [
"Qu'entend-on ? Que sent-on ? Quelle est la température ?",
"Quel détail un joueur retiendrait-il en sortant de la partie ?",
"Quelle émotion veux-tu provoquer : malaise, émerveillement, urgence ?"
],
"example": "Odeur de cire chaude et d'encens rance. Un goutte-à-goutte régulier quelque part dans le noir. Le froid de la pierre traverse les bottes.",
"pitfall": "Ne parler que de ce qu'on voit. Deux sens autres que la vue font plus d'effet qu'un long paragraphe descriptif."
},
"narration": {
"title": "Narration pour les joueurs",
"purpose": "Le texte que tu lis tel quel pour lancer la scène. Il plante le décor et met les joueurs en situation d'agir.",
"questions": [
"Peut-on le lire en moins d'une minute ?",
"Se termine-t-il sur une situation qui appelle une réaction ?",
"Qu'est-ce que les joueurs doivent absolument savoir, et que peuvent-ils découvrir en posant des questions ?"
],
"example": "La porte du moulin bat au vent. À l'intérieur, la meule tourne encore, à vide. Sur le sol fariné, des traces de pas mènent vers la trappe… et aucune n'en revient. Que faites-vous ?",
"pitfall": "Décider à la place des personnages (« vous avez peur », « vous entrez prudemment ») ou tout révéler d'un coup. Décris ce qu'ils perçoivent, laisse-les choisir ce qu'ils ressentent et font."
},
"gmNotes": {
"title": "Notes et secrets du MJ",
"purpose": "Ce que les joueurs ignorent : vérités cachées, motivations des PNJ, ce qui se passe en coulisse.",
"questions": [
"Que se passe-t-il si les joueurs ne font rien ?",
"Que cache le PNJ principal de la scène, et pourquoi ?",
"Quelle information dois-tu absolument retrouver en trois secondes pendant la partie ?"
],
"example": "• La passeuse a été payée par le guet.\n• Si on lui propose plus, elle hésite, puis trahit le guet.\n• Si les PJ tardent : la patrouille arrive au troisième son de cloche.",
"pitfall": "Rédiger la scène entière en prose : en jeu, tu ne retrouveras pas l'info. Préfère des puces courtes."
},
"choices": {
"title": "Choix et conséquences",
"purpose": "Ce qui donne du pouvoir aux joueurs : leurs décisions changent vraiment la suite.",
"questions": [
"Quelles sont au moins deux façons d'aborder la scène ?",
"Qu'est-ce que chaque option coûte, ou fait perdre ?",
"Que se passe-t-il en cas d'échec ? La scène avance-t-elle quand même ?"
],
"example": "Soudoyer la passeuse : rapide, mais elle les vendra plus tard. La menacer : elle cède, mais prévient le guet en cachette. Traverser à la nage : discret, mais l'équipement est perdu ou abîmé.",
"pitfall": "Les « faux choix » : toutes les options mènent au même résultat. Et oublier l'échec : un jet de dés raté ne doit pas bloquer la partie, il doit la compliquer."
},
"branches": {
"title": "Branches narratives",
"purpose": "Relier la scène aux suivantes selon ce que font les joueurs, pour qu'aucun choix ne mène à une impasse.",
"questions": [
"Où vont les joueurs s'ils réussissent ? Et s'ils échouent ?",
"Et s'ils font quelque chose d'inattendu : fuir, s'allier à l'ennemi, ignorer la piste ?",
"Une information essentielle n'est-elle accessible que par un seul chemin ?"
],
"example": "Succès → « Le passage clandestin ». Échec → « Arrêtés par le guet » (qui mène aussi au passage, mais menottés). Trahison de la passeuse → « Embuscade sur la rive ».",
"pitfall": "Une seule sortie qui dépend d'un seul jet réussi. Si les dés trahissent, la partie s'arrête : prévois toujours un chemin, même plus coûteux."
},
"combat": {
"title": "Combat ou rencontre",
"purpose": "Préparer une rencontre lisible, et intéressante au-delà de l'échange de coups.",
"questions": [
"Pourquoi ces ennemis se battent-ils ? Que veulent-ils vraiment : fuir, protéger, voler, gagner du temps ?",
"Le terrain change-t-il quelque chose : hauteur, eau, obscurité, objets à renverser ?",
"Peut-on éviter ce combat, le gagner autrement, ou le perdre sans mourir ?"
],
"example": "Trois contrebandiers ne cherchent pas à tuer : ils veulent couler la barque qui contient les preuves. S'ils y parviennent, le combat est perdu, même si tous les PJ sont debout.",
"pitfall": "Le combat « sac de points de vie » : sans autre objectif que d'abattre l'adversaire, il devient vite répétitif. Donne un but à chaque camp."
}
},
"chapter": {
"synopsis": {
"title": "Synopsis",
"purpose": "Ta vue d'ensemble : la situation de départ, ce qui se passe, et comment ça peut se terminer.",
"questions": [
"Comment les personnages sont-ils impliqués ?",
"Qu'est-ce qui les pousse à agir maintenant, et pas plus tard ?",
"Quelles sont deux ou trois issues possibles ?"
],
"example": "Le pont de Vaulx s'est effondré pendant la nuit et le village est coupé du marché. Le bailli accuse les mineurs ; les mineurs accusent le bailli. Les PJ, coincés sur la mauvaise rive, sont les seuls que personne ne soupçonne.",
"pitfall": "Raconter l'histoire comme un roman, avec ce que feront les personnages. Décris la situation et les forces en présence, pas le parcours des joueurs."
},
"objectives": {
"title": "Objectifs des joueurs",
"purpose": "Ce que les personnages cherchent à accomplir, de leur point de vue à eux.",
"questions": [
"Les joueurs savent-ils clairement ce qu'ils doivent faire ?",
"Comment et quand vont-ils l'apprendre ?",
"L'objectif peut-il évoluer en cours de route, à la suite d'une révélation ?"
],
"example": "Trouver qui a saboté le pont, et le prouver avant la foire de printemps.",
"pitfall": "Un objectif que seul le MJ connaît : les joueurs errent sans savoir quoi faire. S'ils ne peuvent pas le formuler, ils ne l'ont pas."
},
"stakes": {
"title": "Enjeux narratifs",
"purpose": "Ce qui est en jeu : ce qu'on peut gagner, et surtout ce qu'on peut perdre.",
"questions": [
"Que se passe-t-il si les personnages échouent ? Qui en souffre ?",
"Est-ce que ça touche un personnage personnellement ?",
"Les joueurs peuvent-ils perdre quelque chose même en réussissant ?"
],
"example": "Si le coupable n'est pas trouvé, le bailli fera pendre le frère de la forgeronne, l'alliée des PJ, pour l'exemple.",
"pitfall": "Des enjeux abstraits (« sauver le royaume ») sans visage. Un PNJ que les joueurs apprécient, en danger, compte plus qu'un royaume entier."
}
},
"arc": {
"synopsis": {
"title": "Synopsis de l'arc",
"purpose": "Le fil rouge de l'arc : le problème central et ce qui le fait avancer.",
"questions": [
"Quel est le problème central de cet arc ?",
"Qui en est responsable, et que veut-il ?",
"Que se passe-t-il si les personnages n'interviennent pas ?"
],
"example": "Une guilde de cartographes efface peu à peu des villages des cartes officielles, pour revendre les terres « vides » à la couronne. Sans intervention, trois villages disparaîtront d'ici l'hiver.",
"pitfall": "Un synopsis sans antagoniste ni force opposée : rien ne pousse l'histoire, et les joueurs attendent qu'il se passe quelque chose."
},
"themes": {
"title": "Thèmes",
"purpose": "La couleur de l'histoire, ce dont elle parle vraiment, au-delà de l'intrigue.",
"questions": [
"Quelle question morale les joueurs vont-ils rencontrer ?",
"Quel choix difficile l'arc va-t-il leur imposer ?"
],
"example": "La vérité officielle contre la vérité vécue. Jusqu'où obéir à une loi injuste ?",
"pitfall": "Lister des genres (« horreur, mystère ») au lieu de thèmes. Un genre dit comment l'histoire se raconte, un thème dit ce qu'elle raconte."
},
"stakes": {
"title": "Enjeux",
"purpose": "Ce qui change, pour le monde et pour les personnages, selon l'issue de l'arc.",
"questions": [
"Que devient le monde si l'antagoniste gagne ?",
"Qu'est-ce que les personnages gagnent à s'en mêler ?",
"Qu'est-ce qu'ils risquent personnellement ?"
],
"example": "Si la guilde gagne, des familles entières perdent leurs terres, dont le village natal d'un des PJ.",
"pitfall": "Des enjeux qui ne concernent pas les personnages. Relie toujours le problème du monde à quelque chose qui leur tient à cœur."
},
"rewards": {
"title": "Récompenses et progression",
"purpose": "Ce qui motive les personnages et marque leur progression.",
"questions": [
"Au-delà de l'or, que peuvent-ils gagner : des alliés, une réputation, un savoir, un lieu à eux ?",
"Comment le monde réagit-il à leur réussite ?"
],
"example": "La gratitude des villages sauvés (un refuge sûr), une vraie carte que personne d'autre ne possède, et un ennemi juré au sein de la guilde.",
"pitfall": "Ne prévoir que de l'or et des objets. Les récompenses les plus mémorables changent la place des personnages dans le monde."
},
"resolution": {
"title": "Dénouement prévu",
"purpose": "Les fins possibles de l'arc, pas une fin imposée.",
"questions": [
"Quelles sont deux ou trois issues possibles ?",
"Que se passe-t-il si les personnages échouent ?",
"Qu'est-ce qui reste ouvert pour la suite ?"
],
"example": "La guilde est démasquée publiquement ; ou bien elle est rachetée par les PJ eux-mêmes ; ou bien les villages sont perdus et l'arc suivant commence par l'exode.",
"pitfall": "Une seule fin écrite d'avance : les choix des joueurs ne comptent plus. Prépare des issues, pas un scénario."
}
}
}
},
"writingReview": {
"title": "Relecture d'éditeur",
"countN": "{{n}} conseil(s)",
"intro": "Des conseils d'auteur pour rendre ton aventure plus vivante. Rien d'obligatoire : à toi de voir ce qui sert ton histoire.",
"allGood": "Rien à signaler : ta campagne évite les pièges classiques que la relecture sait repérer.",
"showMore": "Voir les {{n}} autre(s)",
"see": "Voir",
"hintsTitle": "Conseils de relecture ({{n}})",
"kindCombat": "Combat",
"categories": {
"AGENCY": "Pouvoir des joueurs",
"STAKES": "Enjeux",
"PACING": "Rythme",
"NARRATION": "Narration"
},
"rules": {
"WRITE-001-CORRIDOR": {
"observation": "« {{entity}} » enchaîne {{count}} scènes sans aucun choix ni embranchement.",
"why": "Les joueurs suivent un chemin tracé d'avance : ils risquent de se sentir spectateurs de l'histoire.",
"question": "À quel moment pourraient-ils décider de quelque chose qui change la suite ?"
},
"WRITE-002-FAKE-CHOICE": {
"observation": "Les {{count}} sorties de « {{entity}} » mènent toutes à « {{target}} ».",
"why": "Quand toutes les options aboutissent au même endroit, c'est un faux choix, et les joueurs finissent par le sentir.",
"question": "Qu'est-ce qui pourrait différer selon l'option choisie : un lieu, un allié, un prix à payer ?"
},
"WRITE-003-SINGLE-CLUE": {
"observation": "La révélation « {{entity}} » n'est reliée qu'à {{incoming}} scène(s) qui y mène(nt).",
"why": "Si les joueurs ratent ce chemin, ils perdent l'information et l'histoire se bloque. La règle des 3 indices conseille de prévoir trois façons de découvrir chaque information essentielle.",
"question": "Dans quelles autres scènes les joueurs pourraient-ils trouver un indice qui y mène ?"
},
"WRITE-004-MONOTONOUS-PACING": {
"observation": "« {{entity}} » enchaîne {{count}} scènes de type « {{kind}} » d'affilée.",
"why": "La répétition fatigue la table : trois combats de suite, ou trois discussions, finissent par se ressembler.",
"question": "Une scène d'un autre genre (exploration, discussion, révélation) pourrait-elle s'intercaler ?"
},
"WRITE-005-NO-STAKES": {
"observation": "« {{entity}} » n'a pas encore d'enjeux écrits.",
"why": "Sans enjeu, les joueurs ne savent pas pourquoi agir ni ce qu'ils risquent : la tension retombe.",
"question": "Que se passe-t-il si les personnages échouent, et qui en souffre ?"
},
"WRITE-006-LONG-NARRATION": {
"observation": "La narration de « {{entity}} » fait {{chars}} caractères, soit plus d'une minute de lecture à voix haute.",
"why": "Au-delà d'une minute, l'attention des joueurs décroche et les détails importants se perdent.",
"question": "Que garder d'essentiel pour lancer la scène, et que laisser découvrir en jeu ?"
},
"WRITE-007-NARRATION-DECIDES": {
"observation": "La narration de « {{entity}} » contient « {{phrase}} ».",
"why": "Le texte décide à la place des personnages de ce qu'ils font ou ressentent. Les joueurs aiment rester maîtres de leurs réactions.",
"question": "Comment décrire la situation pour qu'ils aient envie de réagir ainsi d'eux-mêmes ?"
},
"WRITE-008-COMBAT-NO-PURPOSE": {
"observation": "Le combat de « {{entity}} » n'a ni choix décrits, ni notes sur les motivations des adversaires.",
"why": "Un combat sans autre but que d'abattre l'adversaire devient vite répétitif.",
"question": "Que veulent vraiment ces ennemis : fuir, protéger, voler, gagner du temps ?"
},
"WRITE-009-SINGLE-ENDING": {
"observation": "« {{entity}} », dernière scène de l'arc « {{arc}} », ne prévoit ni choix ni sortie.",
"why": "Une fin unique écrite d'avance enlève leur poids aux décisions des joueurs.",
"question": "Que se passe-t-il si les personnages échouent, ou s'ils changent de camp ?"
},
"WRITE-010-UNTYPED-SCENES": {
"observation": "{{percent}} % des scènes de la campagne n'ont pas de type ({{count}} scènes).",
"why": "Sans type, impossible de voir d'un coup d'œil le rythme de l'aventure, et la relecture ne peut pas t'aider sur ce point.",
"question": "Pour chaque scène : les joueurs vont-ils surtout explorer, combattre, parler, subir un événement ou découvrir quelque chose ?"
}
}
},
"guided": {
"entry": "Méthode guidée",
"entryFirst": "Écrire une aventure pas à pas",
"backToCampaign": "Retour à la campagne",
"progress": "Étape {{n}} sur {{total}}",
"exampleLabel": "Exemple",
"previous": "Précédent",
"next": "Suivant",
"create": "Créer l'aventure",
"creating": "Création…",
"restart": "Recommencer",
"restartTitle": "Recommencer la méthode ?",
"restartMessage": "Toutes tes réponses seront effacées.",
"createError": "La création a échoué. Tes réponses sont conservées : réessaie dans un instant.",
"unknownMethod": "Cette méthode guidée n'existe pas.",
"placementExisting": "L'ajouter à un arc existant",
"placementArcLabel": "Arc",
"placementNew": "Créer un nouvel arc",
"placementNewArcLabel": "Nom du nouvel arc",
"placementNewArcPlaceholder": "Ex. : Les terres du Nord",
"reviewArc": "Arc",
"reviewChapter": "Chapitre",
"linkScenes": "Relier les salles dans l'ordre (sorties « Vers la salle suivante »)",
"linkLabel": "Vers la salle suivante",
"reviewAfter": "Tout reste modifiable ensuite. Pense à jeter un œil à la « Relecture d'éditeur » sur la page de la campagne : elle te dira ce qui peut encore être renforcé.",
"fiveRoom": {
"name": "Donjon en 5 salles",
"steps": {
"placement": {
"title": "Le donjon en 5 salles",
"why": "Une méthode simple pour écrire une aventure courte et complète, idéale pour une séance. Elle enchaîne cinq temps forts : un gardien à l'entrée, une épreuve qui ne se règle pas à l'épée, un revers, le climax, puis la récompense. Le « donjon » peut être n'importe quel lieu : un manoir, un navire, une forêt, un bal masqué… Commence par choisir où ranger l'aventure dans ta campagne.",
"example": "Une crypte sous la chapelle d'un village, où une relique a été volée. Ou le bateau d'un contrebandier, la nuit de son départ."
},
"frame": {
"title": "Le cadre",
"why": "Avant les salles, pose l'essentiel : un nom, un lieu, et surtout une accroche. L'accroche, c'est la raison pour laquelle les personnages y vont maintenant. Si elle les concerne personnellement, ils s'engageront d'eux-mêmes.",
"example": "« Le reliquaire volé » : le prêtre du village, ami d'un des PJ, a disparu avec la relique. On l'a vu descendre dans la crypte, et le pèlerinage arrive dans trois jours."
},
"stakes": {
"title": "Ce que les joueurs cherchent, et ce qu'ils risquent",
"why": "Les joueurs doivent savoir ce qu'ils viennent faire, sinon ils errent. Et il faut que l'échec coûte quelque chose : c'est ce qui crée la tension.",
"example": "Objectif : ramener la relique avant le pèlerinage. Enjeu : sans elle, le village perd sa protection, et le prêtre sera accusé du vol."
},
"room1": {
"title": "Salle 1 : l'entrée et son gardien",
"why": "Quelque chose empêche d'entrer. Ça lance l'aventure tout de suite, et ça explique pourquoi personne n'est encore venu à bout de ce lieu. Le gardien n'est pas forcément un monstre : un garde à convaincre ou un passage dangereux fonctionnent aussi.",
"example": "Un vieux gardien spectral bloque l'escalier de la crypte. Il laisse passer quiconque prouve qu'il vient protéger la relique, pas la voler."
},
"room2": {
"title": "Salle 2 : l'épreuve",
"why": "Ici, l'épée ne suffit pas : une énigme, une négociation, un lieu à explorer avec soin. Ça laisse briller les joueurs qui ne sont pas des combattants, et ça change le rythme après l'entrée.",
"example": "Une salle de tombeaux identiques : seul celui du fondateur s'ouvre, et les indices sont dans les épitaphes."
},
"room3": {
"title": "Salle 3 : le revers",
"why": "Un piège, une fausse piste ou une mauvaise surprise : les choses se compliquent juste avant le climax. Les ressources des personnages s'épuisent, la tension monte.",
"example": "Le prêtre est retrouvé… mais c'est lui le voleur. Il a été envoûté, et il vient de déclencher l'effondrement de la galerie."
},
"room4": {
"title": "Salle 4 : le climax",
"why": "La grande confrontation, le moment le plus intense de l'aventure. Pour qu'il soit mémorable, donne un but à l'adversaire autre que se battre, et un terrain qui change la donne.",
"example": "L'envoûteuse veut finir le rituel avant l'aube. Elle se bat en protégeant le cercle de bougies : l'éteindre l'affaiblit, mais il faut traverser l'eau glacée pour y arriver."
},
"room5": {
"title": "Salle 5 : la récompense ou la révélation",
"why": "La fin récompense les efforts : un trésor, un allié, un savoir. C'est aussi le bon moment pour un retournement qui ouvre la suite de ta campagne.",
"example": "La relique est sauvée, et le prêtre libéré devient un allié. Mais le cercle portait un symbole : celui d'une confrérie que les PJ croisent déjà ailleurs."
},
"review": {
"title": "Ton aventure est prête à être créée",
"why": "Voici ce qui va être créé : un chapitre et ses cinq scènes, déjà typées pour que la relecture puisse t'aider sur le rythme."
}
},
"fields": {
"title": {
"label": "Nom de l'aventure",
"placeholder": "Ex. : Le reliquaire volé"
},
"location": {
"label": "Le lieu",
"placeholder": "Ex. : La crypte sous la chapelle"
},
"hook": {
"label": "L'accroche : pourquoi les personnages y vont-ils maintenant ?",
"placeholder": "Qui les envoie, qu'est-ce qui presse, en quoi ça les concerne ?"
},
"objectives": {
"label": "Ce que les joueurs veulent accomplir",
"placeholder": "Formulé comme les joueurs le diraient"
},
"stakes": {
"label": "Ce qui se passe s'ils échouent",
"placeholder": "Qui en souffre ? Qu'est-ce qui est perdu ?"
},
"room1": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : L'entrée gardée"
},
"nature": {
"label": "Comment se passe la rencontre ?"
},
"description": {
"label": "Ce qui bloque l'entrée",
"placeholder": "Qui ou quoi garde l'entrée, et pourquoi ?"
},
"enemies": {
"label": "Adversaires éventuels",
"placeholder": "Ex. : un gardien spectral"
},
"choices": {
"label": "Comment passer ? Et si ça tourne mal ?",
"placeholder": "Au moins deux façons de passer, et ce qui arrive en cas d'échec"
},
"secret": {
"label": "Ce que le MJ sait (secret, motivation du gardien)",
"placeholder": "Ce que les joueurs ignorent"
}
},
"room2": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : L'épreuve"
},
"nature": {
"label": "Quel genre d'épreuve ?"
},
"description": {
"label": "L'épreuve",
"placeholder": "Que faut-il résoudre, convaincre ou découvrir ?"
},
"choices": {
"label": "Comment la réussir ? Et en cas d'échec ?",
"placeholder": "Les approches possibles, et ce que coûte un échec"
},
"secret": {
"label": "La solution et les indices (pour le MJ)",
"placeholder": "Où sont les indices, quelle est la réponse"
}
},
"room3": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : Le revers"
},
"description": {
"label": "Le revers",
"placeholder": "Quel piège, quelle mauvaise surprise ?"
},
"choices": {
"label": "Comment les joueurs peuvent-ils réagir ?",
"placeholder": "Les options, et ce qu'elles coûtent"
},
"secret": {
"label": "Ce qui se cache derrière (pour le MJ)",
"placeholder": "La vérité derrière la fausse piste ou le piège"
}
},
"room4": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : Le climax"
},
"description": {
"label": "La confrontation",
"placeholder": "Qui affrontent-ils, et dans quel décor ?"
},
"enemies": {
"label": "Adversaires",
"placeholder": "Ex. : l'envoûteuse et deux fidèles"
},
"choices": {
"label": "Comment gagner autrement qu'en frappant ?",
"placeholder": "Objectifs, éléments du terrain, issue si les PJ perdent"
},
"secret": {
"label": "Ce que veut vraiment l'adversaire (pour le MJ)",
"placeholder": "Son but, ce qu'il fera s'il est en difficulté"
}
},
"room5": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : La récompense"
},
"description": {
"label": "La récompense",
"placeholder": "Qu'est-ce que les personnages gagnent ?"
},
"choices": {
"label": "Les conséquences pour la suite",
"placeholder": "Ce qui change dans le monde selon ce qu'ils ont fait"
},
"secret": {
"label": "La révélation ou le retournement (pour le MJ)",
"placeholder": "Ce qui ouvre la suite de ta campagne"
}
}
},
"options": {
"room1": {
"nature": {
"combat": "Un combat",
"social": "Une discussion",
"obstacle": "Un obstacle"
}
},
"room2": {
"nature": {
"puzzle": "Une énigme",
"social": "Une négociation",
"exploration": "Une exploration"
}
}
},
"defaults": {
"room1": {
"name": "L'entrée gardée"
},
"room2": {
"name": "L'épreuve"
},
"room3": {
"name": "Le revers"
},
"room4": {
"name": "Le climax"
},
"room5": {
"name": "La récompense"
}
}
}
} }
} }
@@ -0,0 +1,236 @@
{
"guided": {
"entry": "Guided method",
"entryFirst": "Write an adventure step by step",
"backToCampaign": "Back to the campaign",
"progress": "Step {{n}} of {{total}}",
"exampleLabel": "Example",
"previous": "Previous",
"next": "Next",
"create": "Create the adventure",
"creating": "Creating…",
"restart": "Start over",
"restartTitle": "Start the method over?",
"restartMessage": "All your answers will be erased.",
"createError": "Creation failed. Your answers are kept: try again in a moment.",
"unknownMethod": "This guided method doesn't exist.",
"placementExisting": "Add it to an existing arc",
"placementArcLabel": "Arc",
"placementNew": "Create a new arc",
"placementNewArcLabel": "New arc name",
"placementNewArcPlaceholder": "E.g.: The Northern Lands",
"reviewArc": "Arc",
"reviewChapter": "Chapter",
"linkScenes": "Link the rooms in order (\"To the next room\" exits)",
"linkLabel": "To the next room",
"reviewAfter": "Everything stays editable afterwards. Have a look at the \"Editor's review\" on the campaign page: it will tell you what can still be strengthened.",
"fiveRoom": {
"name": "Five-room dungeon",
"steps": {
"placement": {
"title": "The five-room dungeon",
"why": "A simple method to write a short, complete adventure, ideal for one session. It chains five key moments: a guardian at the entrance, a challenge that can't be solved with a sword, a setback, the climax, then the reward. The \"dungeon\" can be any place: a manor, a ship, a forest, a masked ball… Start by choosing where to file the adventure in your campaign.",
"example": "A crypt under a village chapel, where a relic was stolen. Or a smuggler's ship, on the night it sets sail."
},
"frame": {
"title": "The setting",
"why": "Before the rooms, lay down the essentials: a name, a place, and above all a hook. The hook is why the characters go there now. If it concerns them personally, they will commit on their own.",
"example": "\"The stolen reliquary\": the village priest, a friend of one PC, vanished with the relic. He was seen going down into the crypt, and the pilgrimage arrives in three days."
},
"stakes": {
"title": "What the players want, and what they risk",
"why": "The players must know what they came to do, or they will wander. And failure must cost something: that's what creates tension.",
"example": "Goal: bring the relic back before the pilgrimage. Stakes: without it, the village loses its protection, and the priest will be blamed for the theft."
},
"room1": {
"title": "Room 1: the entrance and its guardian",
"why": "Something stops anyone from getting in. It starts the adventure right away, and explains why nobody has conquered this place yet. The guardian doesn't have to be a monster: a guard to convince or a dangerous passage work too.",
"example": "An old spectral guardian blocks the crypt stairs. He lets through anyone who proves they came to protect the relic, not steal it."
},
"room2": {
"title": "Room 2: the challenge",
"why": "Here, a sword isn't enough: a puzzle, a negotiation, a place to explore carefully. It lets non-fighters shine, and changes the pace after the entrance.",
"example": "A hall of identical tombs: only the founder's opens, and the clues are in the epitaphs."
},
"room3": {
"title": "Room 3: the setback",
"why": "A trap, a red herring or a nasty surprise: things get complicated right before the climax. The characters' resources run low, tension rises.",
"example": "The priest is found… but he is the thief. He was bewitched, and he just triggered the collapse of the gallery."
},
"room4": {
"title": "Room 4: the climax",
"why": "The big confrontation, the most intense moment of the adventure. To make it memorable, give the opponent a goal other than fighting, and terrain that changes the game.",
"example": "The enchantress wants to finish the ritual before dawn. She fights while protecting the circle of candles: putting it out weakens her, but reaching it means crossing icy water."
},
"room5": {
"title": "Room 5: the reward or the revelation",
"why": "The ending rewards the effort: a treasure, an ally, knowledge. It's also the right time for a twist that opens what comes next in your campaign.",
"example": "The relic is saved, and the freed priest becomes an ally. But the circle bore a symbol: that of a brotherhood the PCs have already met elsewhere."
},
"review": {
"title": "Your adventure is ready to be created",
"why": "Here is what will be created: a chapter and its five scenes, already typed so the review can help you with pacing."
}
},
"fields": {
"title": {
"label": "Adventure name",
"placeholder": "E.g.: The stolen reliquary"
},
"location": {
"label": "The place",
"placeholder": "E.g.: The crypt under the chapel"
},
"hook": {
"label": "The hook: why do the characters go there now?",
"placeholder": "Who sends them, what's urgent, how does it concern them?"
},
"objectives": {
"label": "What the players want to achieve",
"placeholder": "Phrased the way the players would say it"
},
"stakes": {
"label": "What happens if they fail",
"placeholder": "Who suffers? What is lost?"
},
"room1": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The guarded entrance"
},
"nature": {
"label": "How does the encounter play out?"
},
"description": {
"label": "What blocks the entrance",
"placeholder": "Who or what guards the entrance, and why?"
},
"enemies": {
"label": "Possible opponents",
"placeholder": "E.g.: a spectral guardian"
},
"choices": {
"label": "How to get through? And if it goes wrong?",
"placeholder": "At least two ways through, and what happens on a failure"
},
"secret": {
"label": "What the GM knows (secret, guardian's motive)",
"placeholder": "What the players don't know"
}
},
"room2": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The challenge"
},
"nature": {
"label": "What kind of challenge?"
},
"description": {
"label": "The challenge",
"placeholder": "What must be solved, convinced or discovered?"
},
"choices": {
"label": "How to succeed? And on a failure?",
"placeholder": "The possible approaches, and what a failure costs"
},
"secret": {
"label": "The solution and clues (for the GM)",
"placeholder": "Where the clues are, what the answer is"
}
},
"room3": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The setback"
},
"description": {
"label": "The setback",
"placeholder": "Which trap, which nasty surprise?"
},
"choices": {
"label": "How can the players react?",
"placeholder": "The options, and what they cost"
},
"secret": {
"label": "What hides behind it (for the GM)",
"placeholder": "The truth behind the red herring or the trap"
}
},
"room4": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The climax"
},
"description": {
"label": "The confrontation",
"placeholder": "Who do they face, and in what setting?"
},
"enemies": {
"label": "Opponents",
"placeholder": "E.g.: the enchantress and two followers"
},
"choices": {
"label": "How to win other than by striking?",
"placeholder": "Goals, terrain features, outcome if the PCs lose"
},
"secret": {
"label": "What the opponent really wants (for the GM)",
"placeholder": "Their goal, what they'll do when in trouble"
}
},
"room5": {
"name": {
"label": "Room name",
"placeholder": "E.g.: The reward"
},
"description": {
"label": "The reward",
"placeholder": "What do the characters gain?"
},
"choices": {
"label": "Consequences for what comes next",
"placeholder": "What changes in the world depending on what they did"
},
"secret": {
"label": "The revelation or twist (for the GM)",
"placeholder": "What opens the rest of your campaign"
}
}
},
"options": {
"room1": {
"nature": {
"combat": "A fight",
"social": "A conversation",
"obstacle": "An obstacle"
}
},
"room2": {
"nature": {
"puzzle": "A puzzle",
"social": "A negotiation",
"exploration": "An exploration"
}
}
},
"defaults": {
"room1": {
"name": "The guarded entrance"
},
"room2": {
"name": "The challenge"
},
"room3": {
"name": "The setback"
},
"room4": {
"name": "The climax"
},
"room5": {
"name": "The reward"
}
}
}
}
}
@@ -0,0 +1,236 @@
{
"guided": {
"entry": "Méthode guidée",
"entryFirst": "Écrire une aventure pas à pas",
"backToCampaign": "Retour à la campagne",
"progress": "Étape {{n}} sur {{total}}",
"exampleLabel": "Exemple",
"previous": "Précédent",
"next": "Suivant",
"create": "Créer l'aventure",
"creating": "Création…",
"restart": "Recommencer",
"restartTitle": "Recommencer la méthode ?",
"restartMessage": "Toutes tes réponses seront effacées.",
"createError": "La création a échoué. Tes réponses sont conservées : réessaie dans un instant.",
"unknownMethod": "Cette méthode guidée n'existe pas.",
"placementExisting": "L'ajouter à un arc existant",
"placementArcLabel": "Arc",
"placementNew": "Créer un nouvel arc",
"placementNewArcLabel": "Nom du nouvel arc",
"placementNewArcPlaceholder": "Ex. : Les terres du Nord",
"reviewArc": "Arc",
"reviewChapter": "Chapitre",
"linkScenes": "Relier les salles dans l'ordre (sorties « Vers la salle suivante »)",
"linkLabel": "Vers la salle suivante",
"reviewAfter": "Tout reste modifiable ensuite. Pense à jeter un œil à la « Relecture d'éditeur » sur la page de la campagne : elle te dira ce qui peut encore être renforcé.",
"fiveRoom": {
"name": "Donjon en 5 salles",
"steps": {
"placement": {
"title": "Le donjon en 5 salles",
"why": "Une méthode simple pour écrire une aventure courte et complète, idéale pour une séance. Elle enchaîne cinq temps forts : un gardien à l'entrée, une épreuve qui ne se règle pas à l'épée, un revers, le climax, puis la récompense. Le « donjon » peut être n'importe quel lieu : un manoir, un navire, une forêt, un bal masqué… Commence par choisir où ranger l'aventure dans ta campagne.",
"example": "Une crypte sous la chapelle d'un village, où une relique a été volée. Ou le bateau d'un contrebandier, la nuit de son départ."
},
"frame": {
"title": "Le cadre",
"why": "Avant les salles, pose l'essentiel : un nom, un lieu, et surtout une accroche. L'accroche, c'est la raison pour laquelle les personnages y vont maintenant. Si elle les concerne personnellement, ils s'engageront d'eux-mêmes.",
"example": "« Le reliquaire volé » : le prêtre du village, ami d'un des PJ, a disparu avec la relique. On l'a vu descendre dans la crypte, et le pèlerinage arrive dans trois jours."
},
"stakes": {
"title": "Ce que les joueurs cherchent, et ce qu'ils risquent",
"why": "Les joueurs doivent savoir ce qu'ils viennent faire, sinon ils errent. Et il faut que l'échec coûte quelque chose : c'est ce qui crée la tension.",
"example": "Objectif : ramener la relique avant le pèlerinage. Enjeu : sans elle, le village perd sa protection, et le prêtre sera accusé du vol."
},
"room1": {
"title": "Salle 1 : l'entrée et son gardien",
"why": "Quelque chose empêche d'entrer. Ça lance l'aventure tout de suite, et ça explique pourquoi personne n'est encore venu à bout de ce lieu. Le gardien n'est pas forcément un monstre : un garde à convaincre ou un passage dangereux fonctionnent aussi.",
"example": "Un vieux gardien spectral bloque l'escalier de la crypte. Il laisse passer quiconque prouve qu'il vient protéger la relique, pas la voler."
},
"room2": {
"title": "Salle 2 : l'épreuve",
"why": "Ici, l'épée ne suffit pas : une énigme, une négociation, un lieu à explorer avec soin. Ça laisse briller les joueurs qui ne sont pas des combattants, et ça change le rythme après l'entrée.",
"example": "Une salle de tombeaux identiques : seul celui du fondateur s'ouvre, et les indices sont dans les épitaphes."
},
"room3": {
"title": "Salle 3 : le revers",
"why": "Un piège, une fausse piste ou une mauvaise surprise : les choses se compliquent juste avant le climax. Les ressources des personnages s'épuisent, la tension monte.",
"example": "Le prêtre est retrouvé… mais c'est lui le voleur. Il a été envoûté, et il vient de déclencher l'effondrement de la galerie."
},
"room4": {
"title": "Salle 4 : le climax",
"why": "La grande confrontation, le moment le plus intense de l'aventure. Pour qu'il soit mémorable, donne un but à l'adversaire autre que se battre, et un terrain qui change la donne.",
"example": "L'envoûteuse veut finir le rituel avant l'aube. Elle se bat en protégeant le cercle de bougies : l'éteindre l'affaiblit, mais il faut traverser l'eau glacée pour y arriver."
},
"room5": {
"title": "Salle 5 : la récompense ou la révélation",
"why": "La fin récompense les efforts : un trésor, un allié, un savoir. C'est aussi le bon moment pour un retournement qui ouvre la suite de ta campagne.",
"example": "La relique est sauvée, et le prêtre libéré devient un allié. Mais le cercle portait un symbole : celui d'une confrérie que les PJ croisent déjà ailleurs."
},
"review": {
"title": "Ton aventure est prête à être créée",
"why": "Voici ce qui va être créé : un chapitre et ses cinq scènes, déjà typées pour que la relecture puisse t'aider sur le rythme."
}
},
"fields": {
"title": {
"label": "Nom de l'aventure",
"placeholder": "Ex. : Le reliquaire volé"
},
"location": {
"label": "Le lieu",
"placeholder": "Ex. : La crypte sous la chapelle"
},
"hook": {
"label": "L'accroche : pourquoi les personnages y vont-ils maintenant ?",
"placeholder": "Qui les envoie, qu'est-ce qui presse, en quoi ça les concerne ?"
},
"objectives": {
"label": "Ce que les joueurs veulent accomplir",
"placeholder": "Formulé comme les joueurs le diraient"
},
"stakes": {
"label": "Ce qui se passe s'ils échouent",
"placeholder": "Qui en souffre ? Qu'est-ce qui est perdu ?"
},
"room1": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : L'entrée gardée"
},
"nature": {
"label": "Comment se passe la rencontre ?"
},
"description": {
"label": "Ce qui bloque l'entrée",
"placeholder": "Qui ou quoi garde l'entrée, et pourquoi ?"
},
"enemies": {
"label": "Adversaires éventuels",
"placeholder": "Ex. : un gardien spectral"
},
"choices": {
"label": "Comment passer ? Et si ça tourne mal ?",
"placeholder": "Au moins deux façons de passer, et ce qui arrive en cas d'échec"
},
"secret": {
"label": "Ce que le MJ sait (secret, motivation du gardien)",
"placeholder": "Ce que les joueurs ignorent"
}
},
"room2": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : L'épreuve"
},
"nature": {
"label": "Quel genre d'épreuve ?"
},
"description": {
"label": "L'épreuve",
"placeholder": "Que faut-il résoudre, convaincre ou découvrir ?"
},
"choices": {
"label": "Comment la réussir ? Et en cas d'échec ?",
"placeholder": "Les approches possibles, et ce que coûte un échec"
},
"secret": {
"label": "La solution et les indices (pour le MJ)",
"placeholder": "Où sont les indices, quelle est la réponse"
}
},
"room3": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : Le revers"
},
"description": {
"label": "Le revers",
"placeholder": "Quel piège, quelle mauvaise surprise ?"
},
"choices": {
"label": "Comment les joueurs peuvent-ils réagir ?",
"placeholder": "Les options, et ce qu'elles coûtent"
},
"secret": {
"label": "Ce qui se cache derrière (pour le MJ)",
"placeholder": "La vérité derrière la fausse piste ou le piège"
}
},
"room4": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : Le climax"
},
"description": {
"label": "La confrontation",
"placeholder": "Qui affrontent-ils, et dans quel décor ?"
},
"enemies": {
"label": "Adversaires",
"placeholder": "Ex. : l'envoûteuse et deux fidèles"
},
"choices": {
"label": "Comment gagner autrement qu'en frappant ?",
"placeholder": "Objectifs, éléments du terrain, issue si les PJ perdent"
},
"secret": {
"label": "Ce que veut vraiment l'adversaire (pour le MJ)",
"placeholder": "Son but, ce qu'il fera s'il est en difficulté"
}
},
"room5": {
"name": {
"label": "Nom de la salle",
"placeholder": "Ex. : La récompense"
},
"description": {
"label": "La récompense",
"placeholder": "Qu'est-ce que les personnages gagnent ?"
},
"choices": {
"label": "Les conséquences pour la suite",
"placeholder": "Ce qui change dans le monde selon ce qu'ils ont fait"
},
"secret": {
"label": "La révélation ou le retournement (pour le MJ)",
"placeholder": "Ce qui ouvre la suite de ta campagne"
}
}
},
"options": {
"room1": {
"nature": {
"combat": "Un combat",
"social": "Une discussion",
"obstacle": "Un obstacle"
}
},
"room2": {
"nature": {
"puzzle": "Une énigme",
"social": "Une négociation",
"exploration": "Une exploration"
}
}
},
"defaults": {
"room1": {
"name": "L'entrée gardée"
},
"room2": {
"name": "L'épreuve"
},
"room3": {
"name": "Le revers"
},
"room4": {
"name": "Le climax"
},
"room5": {
"name": "La récompense"
}
}
}
}
}
@@ -0,0 +1,204 @@
{
"writingCoach": {
"triggerTitle": "Writing tips",
"panelLabel": "Writing tips",
"kicker": "Writing tips",
"purposeTitle": "What it's for",
"questionsTitle": "Questions to help you",
"exampleTitle": "Example",
"pitfallTitle": "Common pitfall",
"footer": "These are guidelines, not rules: your adventure, your choices. Need concrete ideas? \"Flesh out with AI\" suggests options you accept one by one.",
"topics": {
"scene": {
"description": {
"title": "Short description",
"purpose": "Reminds you, in one sentence, what is at play here when you prep the session or need to improvise.",
"questions": [
"If you had to sum up this scene for another GM in ten seconds, what would you say?",
"What changes between the start and the end of the scene?",
"What do the characters come here looking for?"
],
"example": "The PCs must convince the ferrywoman to take them across the river before dawn, even though she has already been paid to turn them in.",
"pitfall": "Describing the set instead of the situation: \"a tavern\" says nothing about what is at play. A good description holds a goal or a tension."
},
"nodeType": {
"title": "Node type",
"purpose": "Tells you, and the tool, what kind of scene this is: a location to explore, an encounter, an NPC, an event or a revelation.",
"questions": [
"What will the players mostly do here: explore, fight, talk, endure or discover?",
"Does this scene deliver key information for what comes next? (then it's a revelation)"
],
"example": "An interrogation in the watch-house cellar is an \"NPC\" scene; finding the forged ledger hidden there is a \"revelation\".",
"pitfall": "Leaving everything as \"generic\": you lose sight of your adventure's pacing (three fights in a row then go unnoticed)."
},
"setting": {
"title": "Location and time",
"purpose": "Anchors the scene in a specific place and moment, so players can picture themselves there.",
"questions": [
"Why this place and not another? What opportunities or obstacles does it offer?",
"Does the timing add a constraint: night, a crowd, a storm, a bell about to ring?",
"What can be used here: a staircase, a chandelier, a crowd to hide in?"
],
"example": "The fish market, an hour before opening: the stalls are empty, but the merchants arrive soon and word will spread.",
"pitfall": "A neutral place that brings nothing. A good location gives the players ideas and the GM complications."
},
"atmosphere": {
"title": "Mood and atmosphere",
"purpose": "Gives you sensory details to pick from during play, bringing the scene to life without over-preparing.",
"questions": [
"What can be heard? Smelled? How warm or cold is it?",
"Which detail would a player remember after the session?",
"What emotion do you want to trigger: unease, wonder, urgency?"
],
"example": "Smell of warm wax and stale incense. A steady drip somewhere in the dark. The cold of the stone seeps through the boots.",
"pitfall": "Only describing what can be seen. Two senses other than sight do more than a long descriptive paragraph."
},
"narration": {
"title": "Narration for players",
"purpose": "The text you read aloud to open the scene. It sets the stage and puts the players in a position to act.",
"questions": [
"Can it be read in under a minute?",
"Does it end on a situation that calls for a reaction?",
"What must the players know, and what can they discover by asking questions?"
],
"example": "The mill door bangs in the wind. Inside, the millstone still turns, grinding nothing. On the floury floor, footprints lead to the trapdoor… and none come back. What do you do?",
"pitfall": "Deciding for the characters (\"you are scared\", \"you step in carefully\") or revealing everything at once. Describe what they perceive; let them choose what they feel and do."
},
"gmNotes": {
"title": "GM notes and secrets",
"purpose": "What the players don't know: hidden truths, NPC motives, what happens behind the scenes.",
"questions": [
"What happens if the players do nothing?",
"What is the scene's main NPC hiding, and why?",
"Which piece of information must you be able to find in three seconds during play?"
],
"example": "• The ferrywoman was paid by the watch.\n• Offered more, she hesitates, then betrays the watch.\n• If the PCs dawdle: the patrol arrives at the third bell.",
"pitfall": "Writing the whole scene as prose: in play, you won't find the information. Prefer short bullet points."
},
"choices": {
"title": "Choices and consequences",
"purpose": "What gives players agency: their decisions truly change what happens next.",
"questions": [
"What are at least two ways to approach the scene?",
"What does each option cost, or put at risk?",
"What happens on a failure? Does the scene still move forward?"
],
"example": "Bribe the ferrywoman: quick, but she will sell them out later. Threaten her: she gives in, but secretly warns the watch. Swim across: discreet, but the gear is lost or damaged.",
"pitfall": "\"Fake choices\": every option leads to the same result. And forgetting failure: a bad roll shouldn't stop the game, it should complicate it."
},
"branches": {
"title": "Story branches",
"purpose": "Link the scene to the next ones based on what the players do, so no choice leads to a dead end.",
"questions": [
"Where do the players go if they succeed? And if they fail?",
"What if they do something unexpected: flee, side with the enemy, ignore the lead?",
"Is a key piece of information reachable through a single path only?"
],
"example": "Success → \"The smugglers' passage\". Failure → \"Arrested by the watch\" (which also leads to the passage, but in chains). The ferrywoman's betrayal → \"Ambush on the riverbank\".",
"pitfall": "A single exit that depends on one successful roll. If the dice turn, the game stops: always keep a path open, even a costlier one."
},
"combat": {
"title": "Combat or encounter",
"purpose": "Prepare an encounter that is easy to read, and interesting beyond trading blows.",
"questions": [
"Why are these enemies fighting? What do they really want: flee, protect, steal, buy time?",
"Does the terrain change anything: high ground, water, darkness, things to knock over?",
"Can this fight be avoided, won another way, or lost without dying?"
],
"example": "Three smugglers aren't trying to kill anyone: they want to sink the boat holding the evidence. If they succeed, the fight is lost, even with every PC still standing.",
"pitfall": "The \"bag of hit points\" fight: with no goal other than taking the enemy down, it quickly becomes repetitive. Give each side a purpose."
}
},
"chapter": {
"synopsis": {
"title": "Synopsis",
"purpose": "Your overview: the starting situation, what happens, and how it might end.",
"questions": [
"How are the characters involved?",
"What pushes them to act now rather than later?",
"What are two or three possible outcomes?"
],
"example": "The Vaulx bridge collapsed overnight and the village is cut off from the market. The bailiff blames the miners; the miners blame the bailiff. The PCs, stuck on the wrong bank, are the only ones nobody suspects.",
"pitfall": "Telling the story like a novel, including what the characters will do. Describe the situation and the forces at play, not the players' path."
},
"objectives": {
"title": "Player objectives",
"purpose": "What the characters are trying to achieve, from their own point of view.",
"questions": [
"Do the players clearly know what they have to do?",
"How and when will they find out?",
"Can the objective shift along the way, after a revelation?"
],
"example": "Find out who sabotaged the bridge, and prove it before the spring fair.",
"pitfall": "An objective only the GM knows: the players wander without knowing what to do. If they can't put it into words, they don't have it."
},
"stakes": {
"title": "Narrative stakes",
"purpose": "What is at stake: what can be gained and, above all, what can be lost.",
"questions": [
"What happens if the characters fail? Who suffers?",
"Does it affect a character personally?",
"Can the players lose something even when they succeed?"
],
"example": "If the culprit isn't found, the bailiff will hang the brother of the blacksmith, the PCs' ally, as an example.",
"pitfall": "Abstract stakes (\"save the kingdom\") with no face. An NPC the players like, in danger, matters more than an entire kingdom."
}
},
"arc": {
"synopsis": {
"title": "Arc synopsis",
"purpose": "The arc's main thread: the central problem and what drives it forward.",
"questions": [
"What is the central problem of this arc?",
"Who is responsible for it, and what do they want?",
"What happens if the characters don't step in?"
],
"example": "A guild of cartographers is slowly erasing villages from the official maps, to sell the \"empty\" land to the crown. Unchecked, three villages will vanish by winter.",
"pitfall": "A synopsis with no antagonist or opposing force: nothing drives the story, and the players wait for something to happen."
},
"themes": {
"title": "Themes",
"purpose": "The story's colour, what it is really about beyond the plot.",
"questions": [
"What moral question will the players face?",
"What hard choice will the arc force on them?"
],
"example": "Official truth versus lived truth. How far should one obey an unjust law?",
"pitfall": "Listing genres (\"horror, mystery\") instead of themes. A genre says how the story is told; a theme says what it is about."
},
"stakes": {
"title": "Stakes",
"purpose": "What changes, for the world and for the characters, depending on how the arc ends.",
"questions": [
"What becomes of the world if the antagonist wins?",
"What do the characters gain by getting involved?",
"What do they personally risk?"
],
"example": "If the guild wins, entire families lose their land, including one PC's home village.",
"pitfall": "Stakes that don't concern the characters. Always tie the world's problem to something they care about."
},
"rewards": {
"title": "Rewards and progression",
"purpose": "What motivates the characters and marks their progress.",
"questions": [
"Beyond gold, what can they gain: allies, reputation, knowledge, a place of their own?",
"How does the world react to their success?"
],
"example": "The gratitude of the saved villages (a safe haven), a true map nobody else owns, and a sworn enemy within the guild.",
"pitfall": "Only planning gold and items. The most memorable rewards change the characters' place in the world."
},
"resolution": {
"title": "Planned resolution",
"purpose": "The arc's possible endings, not a fixed one.",
"questions": [
"What are two or three possible outcomes?",
"What happens if the characters fail?",
"What stays open for what comes next?"
],
"example": "The guild is publicly exposed; or the PCs buy it out themselves; or the villages are lost and the next arc opens with the exodus.",
"pitfall": "A single ending written in advance: the players' choices no longer matter. Prepare outcomes, not a script."
}
}
}
}
}
@@ -0,0 +1,204 @@
{
"writingCoach": {
"triggerTitle": "Conseils d'écriture",
"panelLabel": "Conseils d'écriture",
"kicker": "Conseils d'écriture",
"purposeTitle": "À quoi ça sert",
"questionsTitle": "Questions pour t'aider",
"exampleTitle": "Exemple",
"pitfallTitle": "Piège classique",
"footer": "Ce sont des repères, pas des règles : ton aventure, tes choix. Besoin d'idées concrètes ? « Étoffer avec l'IA » propose des pistes que tu valides une à une.",
"topics": {
"scene": {
"description": {
"title": "Description courte",
"purpose": "Te rappeler en une phrase ce qui se joue ici, quand tu prépares la séance ou que tu dois improviser.",
"questions": [
"Si tu devais résumer la scène à un autre MJ en dix secondes, que dirais-tu ?",
"Qu'est-ce qui change entre le début et la fin de la scène ?",
"Qu'est-ce que les personnages viennent chercher ici ?"
],
"example": "Les PJ doivent convaincre la passeuse de leur faire traverser le fleuve avant l'aube, alors qu'elle a déjà été payée pour les dénoncer.",
"pitfall": "Décrire le décor au lieu de la situation : « une taverne » ne dit pas ce qui s'y joue. Une bonne description contient un objectif ou une tension."
},
"nodeType": {
"title": "Type de nœud",
"purpose": "Dire, à toi comme à l'outil, la nature de la scène : lieu à explorer, rencontre, PNJ, événement ou révélation.",
"questions": [
"Qu'est-ce que les joueurs vont surtout faire ici : explorer, combattre, parler, subir ou découvrir ?",
"Cette scène apporte-t-elle une information clé pour la suite ? (c'est alors une révélation)"
],
"example": "Un interrogatoire dans la cave du guet est une scène « PNJ » ; la découverte du registre falsifié qui s'y cache est une « révélation ».",
"pitfall": "Tout laisser en « générique » : tu perds la vue d'ensemble du rythme de ton aventure (trois combats d'affilée passent alors inaperçus)."
},
"setting": {
"title": "Lieu et moment",
"purpose": "Ancrer la scène quelque part et à un moment précis, pour que les joueurs puissent s'y projeter.",
"questions": [
"Pourquoi ce lieu-là plutôt qu'un autre ? Qu'offre-t-il comme opportunités ou obstacles ?",
"Le moment ajoute-t-il une contrainte : la nuit, la foule, la tempête, une cloche qui va sonner ?",
"Que peut-on y utiliser : un escalier, un lustre, une foule où se cacher ?"
],
"example": "Le marché aux poissons, une heure avant l'ouverture : les étals sont vides, mais les marchands arrivent bientôt et tout se saura.",
"pitfall": "Un lieu neutre qui n'apporte rien. Un bon lieu donne des idées aux joueurs et des complications au MJ."
},
"atmosphere": {
"title": "Ambiance et atmosphère",
"purpose": "Te donner des détails sensoriels à piocher en jeu, pour rendre la scène vivante sans tout préparer.",
"questions": [
"Qu'entend-on ? Que sent-on ? Quelle est la température ?",
"Quel détail un joueur retiendrait-il en sortant de la partie ?",
"Quelle émotion veux-tu provoquer : malaise, émerveillement, urgence ?"
],
"example": "Odeur de cire chaude et d'encens rance. Un goutte-à-goutte régulier quelque part dans le noir. Le froid de la pierre traverse les bottes.",
"pitfall": "Ne parler que de ce qu'on voit. Deux sens autres que la vue font plus d'effet qu'un long paragraphe descriptif."
},
"narration": {
"title": "Narration pour les joueurs",
"purpose": "Le texte que tu lis tel quel pour lancer la scène. Il plante le décor et met les joueurs en situation d'agir.",
"questions": [
"Peut-on le lire en moins d'une minute ?",
"Se termine-t-il sur une situation qui appelle une réaction ?",
"Qu'est-ce que les joueurs doivent absolument savoir, et que peuvent-ils découvrir en posant des questions ?"
],
"example": "La porte du moulin bat au vent. À l'intérieur, la meule tourne encore, à vide. Sur le sol fariné, des traces de pas mènent vers la trappe… et aucune n'en revient. Que faites-vous ?",
"pitfall": "Décider à la place des personnages (« vous avez peur », « vous entrez prudemment ») ou tout révéler d'un coup. Décris ce qu'ils perçoivent, laisse-les choisir ce qu'ils ressentent et font."
},
"gmNotes": {
"title": "Notes et secrets du MJ",
"purpose": "Ce que les joueurs ignorent : vérités cachées, motivations des PNJ, ce qui se passe en coulisse.",
"questions": [
"Que se passe-t-il si les joueurs ne font rien ?",
"Que cache le PNJ principal de la scène, et pourquoi ?",
"Quelle information dois-tu absolument retrouver en trois secondes pendant la partie ?"
],
"example": "• La passeuse a été payée par le guet.\n• Si on lui propose plus, elle hésite, puis trahit le guet.\n• Si les PJ tardent : la patrouille arrive au troisième son de cloche.",
"pitfall": "Rédiger la scène entière en prose : en jeu, tu ne retrouveras pas l'info. Préfère des puces courtes."
},
"choices": {
"title": "Choix et conséquences",
"purpose": "Ce qui donne du pouvoir aux joueurs : leurs décisions changent vraiment la suite.",
"questions": [
"Quelles sont au moins deux façons d'aborder la scène ?",
"Qu'est-ce que chaque option coûte, ou fait perdre ?",
"Que se passe-t-il en cas d'échec ? La scène avance-t-elle quand même ?"
],
"example": "Soudoyer la passeuse : rapide, mais elle les vendra plus tard. La menacer : elle cède, mais prévient le guet en cachette. Traverser à la nage : discret, mais l'équipement est perdu ou abîmé.",
"pitfall": "Les « faux choix » : toutes les options mènent au même résultat. Et oublier l'échec : un jet de dés raté ne doit pas bloquer la partie, il doit la compliquer."
},
"branches": {
"title": "Branches narratives",
"purpose": "Relier la scène aux suivantes selon ce que font les joueurs, pour qu'aucun choix ne mène à une impasse.",
"questions": [
"Où vont les joueurs s'ils réussissent ? Et s'ils échouent ?",
"Et s'ils font quelque chose d'inattendu : fuir, s'allier à l'ennemi, ignorer la piste ?",
"Une information essentielle n'est-elle accessible que par un seul chemin ?"
],
"example": "Succès → « Le passage clandestin ». Échec → « Arrêtés par le guet » (qui mène aussi au passage, mais menottés). Trahison de la passeuse → « Embuscade sur la rive ».",
"pitfall": "Une seule sortie qui dépend d'un seul jet réussi. Si les dés trahissent, la partie s'arrête : prévois toujours un chemin, même plus coûteux."
},
"combat": {
"title": "Combat ou rencontre",
"purpose": "Préparer une rencontre lisible, et intéressante au-delà de l'échange de coups.",
"questions": [
"Pourquoi ces ennemis se battent-ils ? Que veulent-ils vraiment : fuir, protéger, voler, gagner du temps ?",
"Le terrain change-t-il quelque chose : hauteur, eau, obscurité, objets à renverser ?",
"Peut-on éviter ce combat, le gagner autrement, ou le perdre sans mourir ?"
],
"example": "Trois contrebandiers ne cherchent pas à tuer : ils veulent couler la barque qui contient les preuves. S'ils y parviennent, le combat est perdu, même si tous les PJ sont debout.",
"pitfall": "Le combat « sac de points de vie » : sans autre objectif que d'abattre l'adversaire, il devient vite répétitif. Donne un but à chaque camp."
}
},
"chapter": {
"synopsis": {
"title": "Synopsis",
"purpose": "Ta vue d'ensemble : la situation de départ, ce qui se passe, et comment ça peut se terminer.",
"questions": [
"Comment les personnages sont-ils impliqués ?",
"Qu'est-ce qui les pousse à agir maintenant, et pas plus tard ?",
"Quelles sont deux ou trois issues possibles ?"
],
"example": "Le pont de Vaulx s'est effondré pendant la nuit et le village est coupé du marché. Le bailli accuse les mineurs ; les mineurs accusent le bailli. Les PJ, coincés sur la mauvaise rive, sont les seuls que personne ne soupçonne.",
"pitfall": "Raconter l'histoire comme un roman, avec ce que feront les personnages. Décris la situation et les forces en présence, pas le parcours des joueurs."
},
"objectives": {
"title": "Objectifs des joueurs",
"purpose": "Ce que les personnages cherchent à accomplir, de leur point de vue à eux.",
"questions": [
"Les joueurs savent-ils clairement ce qu'ils doivent faire ?",
"Comment et quand vont-ils l'apprendre ?",
"L'objectif peut-il évoluer en cours de route, à la suite d'une révélation ?"
],
"example": "Trouver qui a saboté le pont, et le prouver avant la foire de printemps.",
"pitfall": "Un objectif que seul le MJ connaît : les joueurs errent sans savoir quoi faire. S'ils ne peuvent pas le formuler, ils ne l'ont pas."
},
"stakes": {
"title": "Enjeux narratifs",
"purpose": "Ce qui est en jeu : ce qu'on peut gagner, et surtout ce qu'on peut perdre.",
"questions": [
"Que se passe-t-il si les personnages échouent ? Qui en souffre ?",
"Est-ce que ça touche un personnage personnellement ?",
"Les joueurs peuvent-ils perdre quelque chose même en réussissant ?"
],
"example": "Si le coupable n'est pas trouvé, le bailli fera pendre le frère de la forgeronne, l'alliée des PJ, pour l'exemple.",
"pitfall": "Des enjeux abstraits (« sauver le royaume ») sans visage. Un PNJ que les joueurs apprécient, en danger, compte plus qu'un royaume entier."
}
},
"arc": {
"synopsis": {
"title": "Synopsis de l'arc",
"purpose": "Le fil rouge de l'arc : le problème central et ce qui le fait avancer.",
"questions": [
"Quel est le problème central de cet arc ?",
"Qui en est responsable, et que veut-il ?",
"Que se passe-t-il si les personnages n'interviennent pas ?"
],
"example": "Une guilde de cartographes efface peu à peu des villages des cartes officielles, pour revendre les terres « vides » à la couronne. Sans intervention, trois villages disparaîtront d'ici l'hiver.",
"pitfall": "Un synopsis sans antagoniste ni force opposée : rien ne pousse l'histoire, et les joueurs attendent qu'il se passe quelque chose."
},
"themes": {
"title": "Thèmes",
"purpose": "La couleur de l'histoire, ce dont elle parle vraiment, au-delà de l'intrigue.",
"questions": [
"Quelle question morale les joueurs vont-ils rencontrer ?",
"Quel choix difficile l'arc va-t-il leur imposer ?"
],
"example": "La vérité officielle contre la vérité vécue. Jusqu'où obéir à une loi injuste ?",
"pitfall": "Lister des genres (« horreur, mystère ») au lieu de thèmes. Un genre dit comment l'histoire se raconte, un thème dit ce qu'elle raconte."
},
"stakes": {
"title": "Enjeux",
"purpose": "Ce qui change, pour le monde et pour les personnages, selon l'issue de l'arc.",
"questions": [
"Que devient le monde si l'antagoniste gagne ?",
"Qu'est-ce que les personnages gagnent à s'en mêler ?",
"Qu'est-ce qu'ils risquent personnellement ?"
],
"example": "Si la guilde gagne, des familles entières perdent leurs terres, dont le village natal d'un des PJ.",
"pitfall": "Des enjeux qui ne concernent pas les personnages. Relie toujours le problème du monde à quelque chose qui leur tient à cœur."
},
"rewards": {
"title": "Récompenses et progression",
"purpose": "Ce qui motive les personnages et marque leur progression.",
"questions": [
"Au-delà de l'or, que peuvent-ils gagner : des alliés, une réputation, un savoir, un lieu à eux ?",
"Comment le monde réagit-il à leur réussite ?"
],
"example": "La gratitude des villages sauvés (un refuge sûr), une vraie carte que personne d'autre ne possède, et un ennemi juré au sein de la guilde.",
"pitfall": "Ne prévoir que de l'or et des objets. Les récompenses les plus mémorables changent la place des personnages dans le monde."
},
"resolution": {
"title": "Dénouement prévu",
"purpose": "Les fins possibles de l'arc, pas une fin imposée.",
"questions": [
"Quelles sont deux ou trois issues possibles ?",
"Que se passe-t-il si les personnages échouent ?",
"Qu'est-ce qui reste ouvert pour la suite ?"
],
"example": "La guilde est démasquée publiquement ; ou bien elle est rachetée par les PJ eux-mêmes ; ou bien les villages sont perdus et l'arc suivant commence par l'exode.",
"pitfall": "Une seule fin écrite d'avance : les choix des joueurs ne comptent plus. Prépare des issues, pas un scénario."
}
}
}
}
}
@@ -0,0 +1,70 @@
{
"writingReview": {
"title": "Editor's review",
"countN": "{{n}} tip(s)",
"intro": "Writing tips to bring your adventure to life. Nothing mandatory: keep what serves your story.",
"allGood": "Nothing to report: your campaign avoids the classic pitfalls the review can spot.",
"showMore": "Show {{n}} more",
"see": "View",
"hintsTitle": "Review tips ({{n}})",
"kindCombat": "Combat",
"categories": {
"AGENCY": "Player agency",
"STAKES": "Stakes",
"PACING": "Pacing",
"NARRATION": "Narration"
},
"rules": {
"WRITE-001-CORRIDOR": {
"observation": "\"{{entity}}\" chains {{count}} scenes without any choice or branch.",
"why": "The players follow a path drawn in advance: they may feel like spectators of the story.",
"question": "At what point could they decide something that changes what happens next?"
},
"WRITE-002-FAKE-CHOICE": {
"observation": "The {{count}} exits of \"{{entity}}\" all lead to \"{{target}}\".",
"why": "When every option ends up in the same place, it's a fake choice, and players eventually notice.",
"question": "What could differ depending on the option chosen: a place, an ally, a price to pay?"
},
"WRITE-003-SINGLE-CLUE": {
"observation": "The revelation \"{{entity}}\" is linked from only {{incoming}} scene(s).",
"why": "If the players miss that path, they lose the information and the story stalls. The three clue rule suggests three ways to discover every essential piece of information.",
"question": "In which other scenes could the players find a clue leading there?"
},
"WRITE-004-MONOTONOUS-PACING": {
"observation": "\"{{entity}}\" chains {{count}} \"{{kind}}\" scenes in a row.",
"why": "Repetition wears the table out: three fights in a row, or three conversations, end up feeling the same.",
"question": "Could a scene of another kind (exploration, conversation, revelation) fit in between?"
},
"WRITE-005-NO-STAKES": {
"observation": "\"{{entity}}\" has no written stakes yet.",
"why": "Without stakes, the players don't know why they should act or what they risk: tension drops.",
"question": "What happens if the characters fail, and who suffers?"
},
"WRITE-006-LONG-NARRATION": {
"observation": "The narration of \"{{entity}}\" is {{chars}} characters long, more than a minute when read aloud.",
"why": "Past one minute, the players' attention drifts and important details get lost.",
"question": "What is essential to open the scene, and what can be discovered in play?"
},
"WRITE-007-NARRATION-DECIDES": {
"observation": "The narration of \"{{entity}}\" contains \"{{phrase}}\".",
"why": "The text decides what the characters do or feel. Players like to stay in charge of their reactions.",
"question": "How could you describe the situation so that they want to react that way on their own?"
},
"WRITE-008-COMBAT-NO-PURPOSE": {
"observation": "The fight in \"{{entity}}\" has no described choices and no notes on the enemies' motives.",
"why": "A fight with no goal other than taking the enemy down quickly becomes repetitive.",
"question": "What do these enemies really want: flee, protect, steal, buy time?"
},
"WRITE-009-SINGLE-ENDING": {
"observation": "\"{{entity}}\", the last scene of the arc \"{{arc}}\", offers no choice and no exit.",
"why": "A single ending written in advance takes the weight out of the players' decisions.",
"question": "What happens if the characters fail, or switch sides?"
},
"WRITE-010-UNTYPED-SCENES": {
"observation": "{{percent}}% of the campaign's scenes have no type ({{count}} scenes).",
"why": "Without types, you can't see the adventure's pacing at a glance, and the review can't help you with it.",
"question": "For each scene: will the players mostly explore, fight, talk, go through an event or discover something?"
}
}
}
}
@@ -0,0 +1,70 @@
{
"writingReview": {
"title": "Relecture d'éditeur",
"countN": "{{n}} conseil(s)",
"intro": "Des conseils d'auteur pour rendre ton aventure plus vivante. Rien d'obligatoire : à toi de voir ce qui sert ton histoire.",
"allGood": "Rien à signaler : ta campagne évite les pièges classiques que la relecture sait repérer.",
"showMore": "Voir les {{n}} autre(s)",
"see": "Voir",
"hintsTitle": "Conseils de relecture ({{n}})",
"kindCombat": "Combat",
"categories": {
"AGENCY": "Pouvoir des joueurs",
"STAKES": "Enjeux",
"PACING": "Rythme",
"NARRATION": "Narration"
},
"rules": {
"WRITE-001-CORRIDOR": {
"observation": "« {{entity}} » enchaîne {{count}} scènes sans aucun choix ni embranchement.",
"why": "Les joueurs suivent un chemin tracé d'avance : ils risquent de se sentir spectateurs de l'histoire.",
"question": "À quel moment pourraient-ils décider de quelque chose qui change la suite ?"
},
"WRITE-002-FAKE-CHOICE": {
"observation": "Les {{count}} sorties de « {{entity}} » mènent toutes à « {{target}} ».",
"why": "Quand toutes les options aboutissent au même endroit, c'est un faux choix, et les joueurs finissent par le sentir.",
"question": "Qu'est-ce qui pourrait différer selon l'option choisie : un lieu, un allié, un prix à payer ?"
},
"WRITE-003-SINGLE-CLUE": {
"observation": "La révélation « {{entity}} » n'est reliée qu'à {{incoming}} scène(s) qui y mène(nt).",
"why": "Si les joueurs ratent ce chemin, ils perdent l'information et l'histoire se bloque. La règle des 3 indices conseille de prévoir trois façons de découvrir chaque information essentielle.",
"question": "Dans quelles autres scènes les joueurs pourraient-ils trouver un indice qui y mène ?"
},
"WRITE-004-MONOTONOUS-PACING": {
"observation": "« {{entity}} » enchaîne {{count}} scènes de type « {{kind}} » d'affilée.",
"why": "La répétition fatigue la table : trois combats de suite, ou trois discussions, finissent par se ressembler.",
"question": "Une scène d'un autre genre (exploration, discussion, révélation) pourrait-elle s'intercaler ?"
},
"WRITE-005-NO-STAKES": {
"observation": "« {{entity}} » n'a pas encore d'enjeux écrits.",
"why": "Sans enjeu, les joueurs ne savent pas pourquoi agir ni ce qu'ils risquent : la tension retombe.",
"question": "Que se passe-t-il si les personnages échouent, et qui en souffre ?"
},
"WRITE-006-LONG-NARRATION": {
"observation": "La narration de « {{entity}} » fait {{chars}} caractères, soit plus d'une minute de lecture à voix haute.",
"why": "Au-delà d'une minute, l'attention des joueurs décroche et les détails importants se perdent.",
"question": "Que garder d'essentiel pour lancer la scène, et que laisser découvrir en jeu ?"
},
"WRITE-007-NARRATION-DECIDES": {
"observation": "La narration de « {{entity}} » contient « {{phrase}} ».",
"why": "Le texte décide à la place des personnages de ce qu'ils font ou ressentent. Les joueurs aiment rester maîtres de leurs réactions.",
"question": "Comment décrire la situation pour qu'ils aient envie de réagir ainsi d'eux-mêmes ?"
},
"WRITE-008-COMBAT-NO-PURPOSE": {
"observation": "Le combat de « {{entity}} » n'a ni choix décrits, ni notes sur les motivations des adversaires.",
"why": "Un combat sans autre but que d'abattre l'adversaire devient vite répétitif.",
"question": "Que veulent vraiment ces ennemis : fuir, protéger, voler, gagner du temps ?"
},
"WRITE-009-SINGLE-ENDING": {
"observation": "« {{entity}} », dernière scène de l'arc « {{arc}} », ne prévoit ni choix ni sortie.",
"why": "Une fin unique écrite d'avance enlève leur poids aux décisions des joueurs.",
"question": "Que se passe-t-il si les personnages échouent, ou s'ils changent de camp ?"
},
"WRITE-010-UNTYPED-SCENES": {
"observation": "{{percent}} % des scènes de la campagne n'ont pas de type ({{count}} scènes).",
"why": "Sans type, impossible de voir d'un coup d'œil le rythme de l'aventure, et la relecture ne peut pas t'aider sur ce point.",
"question": "Pour chaque scène : les joueurs vont-ils surtout explorer, combattre, parler, subir un événement ou découvrir quelque chose ?"
}
}
}
}
+11
View File
@@ -46,6 +46,17 @@
textarea { resize: vertical; min-height: 4rem; } textarea { resize: vertical; min-height: 4rem; }
} }
// Libellé + bouton 💡 du coach d'écriture sur une même ligne :
// <div class="field-label-row">
// <label for="x">Enjeux</label>
// <app-writing-coach-trigger topic="chapter.stakes"></app-writing-coach-trigger>
// </div>
.field-label-row {
display: flex;
align-items: center;
gap: 0.35rem;
}
.field-hint { .field-hint {
color: #6b7280; color: #6b7280;
font-size: 0.75rem; font-size: 0.75rem;