Prototype · moteur point & click
-Clic : examiner · flèches : tourner / reculer (ou clic droit, Échap) · objet en main + autre objet : combiner · H : indice · D : mode debug
+Clic : examiner · flèches : tourner / reculer (ou clic droit, Échap) · objet en main + autre objet : combiner · C : carnet · H : indice · D : mode debug
Facile : objets surlignés et nommés au survol · Difficile : seul le curseur vous guide
`; const list = screen.querySelector('.chapters')!; diff --git a/src/scenarios/chapitre1/scenario.json b/src/scenarios/chapitre1/scenario.json index f18f272..d653424 100644 --- a/src/scenarios/chapitre1/scenario.json +++ b/src/scenarios/chapitre1/scenario.json @@ -4,33 +4,73 @@ "subtitle": "Le professeur Lindqvist a disparu en laissant son bureau truffé d’énigmes. Cinq mécanismes vous séparent de la sortie. Durée : 15 à 20 minutes.", "difficulty": 2, "world": "bureau", - "resolution": [1280, 720], + "resolution": [ + 1280, + 720 + ], "startScene": "north", "intro": "Vous vous réveillez dans le bureau du professeur Lindqvist. La porte est verrouillée et le plafonnier ne fonctionne plus… Fouillez la pièce : le professeur aimait les secrets.", "outro": "La clé tourne dans la serrure avec un claquement sec. La porte s’ouvre sur un couloir éclairé… Le professeur Lindqvist cachait bien d’autres secrets. Fin du chapitre 1.", - - "vars": { "dial1": 3, "dial2": 7, "dial3": 2, "dial4": 5 }, - + "vars": { + "dial1": 3, + "dial2": 7, + "dial3": 2, + "dial4": 5 + }, "items": [ - { "id": "uvlamp", "name": "Lampe UV", "icon": "images/uvlamp.svg", "description": "Une petite lampe à ultraviolets. Elle n’a pas de piles." }, - { "id": "batteries", "name": "Piles", "icon": "images/batteries.svg", "description": "Deux piles, encore chargées." }, - { "id": "uvlampOn", "name": "Lampe UV allumée", "icon": "images/uvlamp_on.svg", "description": "Sa lumière violette révèle les encres invisibles." }, - { "id": "lever", "name": "Manette", "icon": "images/lever.svg", "description": "Une manette à poignée rouge, comme celles des disjoncteurs." }, - { "id": "key", "name": "Clé en laiton", "icon": "images/key.svg", "description": "Une vieille clé, lourde et finement ouvragée." } + { + "id": "uvlamp", + "name": "Lampe UV", + "icon": "images/uvlamp.svg", + "description": "Une petite lampe à ultraviolets. Elle n’a pas de piles." + }, + { + "id": "batteries", + "name": "Piles", + "icon": "images/batteries.svg", + "description": "Deux piles, encore chargées." + }, + { + "id": "uvlampOn", + "name": "Lampe UV allumée", + "icon": "images/uvlamp_on.svg", + "description": "Sa lumière violette révèle les encres invisibles." + }, + { + "id": "lever", + "name": "Manette", + "icon": "images/lever.svg", + "description": "Une manette à poignée rouge, comme celles des disjoncteurs." + }, + { + "id": "key", + "name": "Clé en laiton", + "icon": "images/key.svg", + "description": "Une vieille clé, lourde et finement ouvragée." + } ], - "combinations": [ { - "items": ["uvlamp", "batteries"], + "items": [ + "uvlamp", + "batteries" + ], "do": [ - { "remove": "uvlamp" }, - { "remove": "batteries" }, - { "give": "uvlampOn" }, - { "message": "Vous glissez les piles dans la lampe : une lueur violette s’allume." } + { + "remove": "uvlamp" + }, + { + "remove": "batteries" + }, + { + "give": "uvlampOn" + }, + { + "message": "Vous glissez les piles dans la lampe : une lueur violette s’allume." + } ] } ], - "puzzles": [ { "id": "cipher", @@ -41,7 +81,14 @@ "ciphertext": "SL JVMMYL Z'VBCYL H S'OLBYL VB SL ALTWZ Z'LZA HYYLAL", "shift": 7 }, - "onSolve": [{ "message": "« LE COFFRE S’OUVRE À L’HEURE OÙ LE TEMPS S’EST ARRÊTÉ »" }] + "onSolve": [ + { + "message": "« LE COFFRE S’OUVRE À L’HEURE OÙ LE TEMPS S’EST ARRÊTÉ »" + }, + { + "clue": "cipher" + } + ] }, { "id": "colorPanel", @@ -50,96 +97,553 @@ "params": { "caption": "Commande", "colors": [ - { "id": "red", "label": "Rouge", "hex": "#d64541" }, - { "id": "blue", "label": "Bleu", "hex": "#3a7bd5" }, - { "id": "green", "label": "Vert", "hex": "#3fae5a" }, - { "id": "yellow", "label": "Jaune", "hex": "#f2c230" }, - { "id": "purple", "label": "Violet", "hex": "#8e5bd0" }, - { "id": "white", "label": "Blanc", "hex": "#e8e8e8" } + { + "id": "red", + "label": "Rouge", + "hex": "#d64541" + }, + { + "id": "blue", + "label": "Bleu", + "hex": "#3a7bd5" + }, + { + "id": "green", + "label": "Vert", + "hex": "#3fae5a" + }, + { + "id": "yellow", + "label": "Jaune", + "hex": "#f2c230" + }, + { + "id": "purple", + "label": "Violet", + "hex": "#8e5bd0" + }, + { + "id": "white", + "label": "Blanc", + "hex": "#e8e8e8" + } ], - "solution": ["yellow", "red", "blue", "green"] + "solution": [ + "yellow", + "red", + "blue", + "green" + ] }, "onSolve": [ - { "setFlag": "drawer_open" }, - { "sound": "drawer" }, - { "message": "Un déclic sourd résonne dans la pièce… quelque chose s’est ouvert du côté du bureau." } + { + "setFlag": "drawer_open" + }, + { + "sound": "drawer" + }, + { + "message": "Un déclic sourd résonne dans la pièce… quelque chose s’est ouvert du côté du bureau." + } ] } ], - "triggers": [ { "id": "safeCode", - "when": ["var:dial1=1", "var:dial2=0", "var:dial3=4", "var:dial4=0"], + "when": [ + "var:dial1=1", + "var:dial2=0", + "var:dial3=4", + "var:dial4=0" + ], "do": [ - { "setFlag": "safe_open" }, - { "sound": "unlock" }, - { "message": "1-0-4-0 : clic ! La porte du coffret s’entrouvre." } + { + "setFlag": "safe_open" + }, + { + "sound": "unlock" + }, + { + "message": "1-0-4-0 : clic ! La porte du coffret s’entrouvre." + } ] } ], - "props": [ - { "object": "uvMessage", "when": ["!flag:uv_painting"], "visible": false }, - - { "object": "dial1", "spin": { "var": "dial1", "axis": [1, 0, 0], "step": 0.6283 } }, - { "object": "dial2", "spin": { "var": "dial2", "axis": [1, 0, 0], "step": 0.6283 } }, - { "object": "dial3", "spin": { "var": "dial3", "axis": [1, 0, 0], "step": 0.6283 } }, - { "object": "dial4", "spin": { "var": "dial4", "axis": [1, 0, 0], "step": 0.6283 } }, - { "object": "safeDoor", "when": ["flag:safe_open"], "rotation": [0, -1.75, 0] }, - { "object": "leverItem", "when": ["flag:lever_taken"], "visible": false }, - - { "object": "breakerLever", "when": ["!flag:lever_installed"], "visible": false }, - { "object": "breakerLever", "when": ["flag:power_on"], "rotation": [2.79, 0, 0] }, - { "object": "breakerLed", "when": ["!flag:power_on"], "emissive": "#ff3b30" }, - { "object": "breakerLed", "when": ["flag:power_on"], "emissive": "#3fe06a" }, - { "object": "ceilingLight", "when": ["!flag:power_on"], "visible": false }, - { "object": "ceilingBulb", "when": ["flag:power_on"], "emissive": "#ffe6b0" }, - { "object": "paintingSpot", "when": ["!flag:power_on"], "visible": false }, - - { "object": "panelLed", "when": ["flag:power_on"], "emissive": "#ff3b30" }, - { "object": "panelLamp1", "when": ["solved:colorPanel"], "emissive": "#f2c230" }, - { "object": "panelLamp2", "when": ["solved:colorPanel"], "emissive": "#d64541" }, - { "object": "panelLamp3", "when": ["solved:colorPanel"], "emissive": "#3a7bd5" }, - { "object": "panelLamp4", "when": ["solved:colorPanel"], "emissive": "#3fae5a" }, - { "object": "panelLed", "when": ["solved:colorPanel"], "emissive": "#3fe06a" }, - - { "object": "secretDrawer", "when": ["flag:drawer_open"], "offset": [0, 0, 0.3] }, - { "object": "key", "when": ["flag:key_taken"], "visible": false }, - { "object": "door", "when": ["flag:door_open"], "rotation": [0, 1.35, 0] } + { + "object": "uvMessage", + "when": [ + "flag:uv_painting" + ], + "reveal": true + }, + { + "object": "drawerL1", + "when": [ + "flag:drawerL1_open" + ], + "offset": [ + 0, + 0, + 0.3 + ] + }, + { + "object": "uvlampItem", + "when": [ + "flag:uvlamp_found" + ], + "visible": false + }, + { + "object": "flowers", + "when": [ + "flag:vase_open" + ], + "rotation": [ + 0, + 0, + -1.45 + ] + }, + { + "object": "batteriesItem", + "when": [ + "flag:batteries_found" + ], + "visible": false + }, + { + "object": "dial1", + "spin": { + "var": "dial1", + "axis": [ + 1, + 0, + 0 + ], + "step": 0.6283 + } + }, + { + "object": "dial2", + "spin": { + "var": "dial2", + "axis": [ + 1, + 0, + 0 + ], + "step": 0.6283 + } + }, + { + "object": "dial3", + "spin": { + "var": "dial3", + "axis": [ + 1, + 0, + 0 + ], + "step": 0.6283 + } + }, + { + "object": "dial4", + "spin": { + "var": "dial4", + "axis": [ + 1, + 0, + 0 + ], + "step": 0.6283 + } + }, + { + "object": "safeDoor", + "when": [ + "flag:safe_open" + ], + "rotation": [ + 0, + -1.75, + 0 + ] + }, + { + "object": "leverItem", + "when": [ + "flag:lever_taken" + ], + "visible": false + }, + { + "object": "breakerLever", + "when": [ + "!flag:lever_installed" + ], + "visible": false + }, + { + "object": "breakerLever", + "when": [ + "flag:power_on" + ], + "rotation": [ + 2.79, + 0, + 0 + ] + }, + { + "object": "breakerLed", + "when": [ + "!flag:power_on" + ], + "emissive": "#ff3b30" + }, + { + "object": "breakerLed", + "when": [ + "flag:power_on" + ], + "emissive": "#3fe06a" + }, + { + "object": "ceilingLight", + "when": [ + "!flag:power_on" + ], + "visible": false + }, + { + "object": "ceilingBulb", + "when": [ + "flag:power_on" + ], + "emissive": "#ffe6b0" + }, + { + "object": "paintingSpot", + "when": [ + "!flag:power_on" + ], + "visible": false + }, + { + "object": "panelLed", + "when": [ + "flag:power_on" + ], + "emissive": "#ff3b30" + }, + { + "object": "panelLamp1", + "when": [ + "solved:colorPanel" + ], + "emissive": "#f2c230" + }, + { + "object": "panelLamp2", + "when": [ + "solved:colorPanel" + ], + "emissive": "#d64541" + }, + { + "object": "panelLamp3", + "when": [ + "solved:colorPanel" + ], + "emissive": "#3a7bd5" + }, + { + "object": "panelLamp4", + "when": [ + "solved:colorPanel" + ], + "emissive": "#3fae5a" + }, + { + "object": "panelLed", + "when": [ + "solved:colorPanel" + ], + "emissive": "#3fe06a" + }, + { + "object": "secretDrawer", + "when": [ + "flag:drawer_open" + ], + "offset": [ + 0, + 0, + 0.3 + ] + }, + { + "object": "key", + "when": [ + "flag:key_taken" + ], + "visible": false + }, + { + "object": "door", + "when": [ + "flag:door_open" + ], + "rotation": [ + 0, + 1.35, + 0 + ] + } ], - "scenes": [ { "id": "north", "title": "Mur nord — le bureau", - "camera": { "position": [0, 1.6, 0], "target": [0, 1.3, -3], "fov": 55 }, + "camera": { + "position": [ + 0, + 1.6, + 0 + ], + "target": [ + 0, + 1.3, + -3 + ], + "fov": 55 + }, "left": "west", "right": "east", "hotspots": [ - { "id": "desk", "label": "Bureau", "object": "desk", "interactions": [{ "do": [{ "goto": "desk" }] }] }, - { "id": "note", "label": "Mot épinglé", "object": "note", "interactions": [{ "do": [{ "goto": "note" }] }] }, - { "id": "digit3", "label": "Inscription", "cursor": "look", "object": "digit3", "interactions": [{ "do": [{ "message": "Un grand « 3 » peint en bleu, à même le papier peint. La peinture a coulé." }] }] }, - { "id": "clock", "label": "Horloge", "object": "clock", "interactions": [{ "do": [{ "goto": "clock" }] }] }, - { "id": "map", "label": "Carte", "object": "map", "interactions": [{ "do": [{ "message": "Une vieille carte de la Baltique, annotée à la main." }] }] } + { + "id": "desk", + "label": "Bureau", + "object": "desk", + "interactions": [ + { + "do": [ + { + "goto": "desk" + } + ] + } + ] + }, + { + "id": "note", + "label": "Mot épinglé", + "object": "note", + "interactions": [ + { + "do": [ + { + "goto": "note" + } + ] + } + ] + }, + { + "id": "digit3", + "label": "Inscription", + "cursor": "look", + "object": "digit3", + "interactions": [ + { + "do": [ + { + "message": "Un grand « 3 » peint en bleu, à même le papier peint. La peinture a coulé." + }, + { + "clue": "digit3" + } + ] + } + ] + }, + { + "id": "clock", + "label": "Horloge", + "object": "clock", + "interactions": [ + { + "do": [ + { + "goto": "clock" + } + ] + } + ] + }, + { + "id": "map", + "label": "Carte", + "object": "map", + "interactions": [ + { + "do": [ + { + "message": "Une vieille carte de la Baltique, annotée à la main." + } + ] + } + ] + } ] }, { "id": "east", "title": "Mur est — la fenêtre", - "camera": { "position": [0, 1.6, 0], "target": [3, 1.3, 0], "fov": 55 }, + "camera": { + "position": [ + 0, + 1.6, + 0 + ], + "target": [ + 3, + 1.3, + 0 + ], + "fov": 55 + }, "left": "north", "right": "south", "hotspots": [ - { "id": "window", "label": "Fenêtre", "object": ["window", "curtains"], "interactions": [{ "do": [{ "message": "Des planches sont clouées de l’autre côté de la vitre. Aucune issue par ici." }] }] }, - { "id": "painting", "label": "Tableau", "object": "painting", "interactions": [{ "do": [{ "goto": "painting" }] }] }, + { + "id": "window", + "label": "Fenêtre", + "object": [ + "window", + "curtains" + ], + "interactions": [ + { + "do": [ + { + "message": "Des planches sont clouées de l’autre côté de la vitre. Aucune issue par ici." + } + ] + } + ] + }, + { + "id": "painting", + "label": "Tableau", + "object": "painting", + "interactions": [ + { + "do": [ + { + "goto": "painting" + } + ] + } + ] + }, { "id": "vase", "label": "Vase", "object": "vase", "interactions": [ - { "when": ["!flag:batteries_found"], "do": [{ "give": "batteries" }, { "setFlag": "batteries_found" }, { "message": "Quelque chose cliquette au fond du vase… deux piles !" }] }, - { "do": [{ "message": "Des fleurs fanées. Le vase est vide, maintenant." }] } + { + "when": [ + "!flag:vase_open" + ], + "do": [ + { + "setFlag": "vase_open" + }, + { + "goto": "vase" + } + ] + }, + { + "do": [ + { + "goto": "vase" + } + ] + } + ] + } + ] + }, + { + "id": "vase", + "title": "Le vase", + "camera": { + "position": [ + 2.75, + 1.42, + 1.0 + ], + "target": [ + 2.78, + 0.84, + 1.0 + ], + "fov": 24 + }, + "back": "east", + "hotspots": [ + { + "id": "vaseInside", + "label": "Vase", + "cursor": "look", + "object": "vase", + "interactions": [ + { + "when": [ + "flag:batteries_found" + ], + "do": [ + { + "message": "Le fond du vase est vide, maintenant." + } + ] + }, + { + "do": [ + { + "message": "Vous écartez les fleurs fanées : quelque chose brille au fond du vase." + } + ] + } + ] + }, + { + "id": "batteries", + "label": "Piles", + "visibleWhen": [ + "!flag:batteries_found" + ], + "object": "batteriesItem", + "interactions": [ + { + "do": [ + { + "give": "batteries" + }, + { + "setFlag": "batteries_found" + }, + { + "message": "Deux piles, encore chargées." + } + ] + } ] } ] @@ -147,103 +651,531 @@ { "id": "south", "title": "Mur sud — la porte", - "camera": { "position": [0, 1.6, 0], "target": [0, 1.3, 3], "fov": 55 }, + "camera": { + "position": [ + 0, + 1.6, + 0 + ], + "target": [ + 0, + 1.3, + 3 + ], + "fov": 55 + }, "left": "east", "right": "west", "hotspots": [ - { "id": "door", "label": "Porte", "object": "door", "interactions": [{ "do": [{ "goto": "door" }] }] }, + { + "id": "door", + "label": "Porte", + "object": "door", + "interactions": [ + { + "do": [ + { + "goto": "door" + } + ] + } + ] + }, { "id": "panel", "label": "Boîtier de commande", "cursor": "zoom", "object": "panel", "interactions": [ - { "when": ["solved:colorPanel"], "do": [{ "message": "Les quatre voyants sont allumés. Le boîtier ne répond plus." }] }, - { "when": ["!flag:power_on"], "do": [{ "message": "Le boîtier est éteint : son circuit est coupé. Il doit y avoir un disjoncteur quelque part." }] }, - { "do": [{ "puzzle": "colorPanel" }] } + { + "when": [ + "solved:colorPanel" + ], + "do": [ + { + "message": "Les quatre voyants sont allumés. Le boîtier ne répond plus." + } + ] + }, + { + "when": [ + "!flag:power_on" + ], + "do": [ + { + "message": "Le boîtier est éteint : son circuit est coupé. Il doit y avoir un disjoncteur quelque part." + }, + { + "clue": "panel" + } + ] + }, + { + "do": [ + { + "puzzle": "colorPanel" + } + ] + } ] }, - { "id": "digit4", "label": "Inscription", "cursor": "look", "object": "digit4", "interactions": [{ "do": [{ "message": "Un « 4 » vert, peint maladroitement sur les boiseries." }] }] }, - { "id": "mirror", "label": "Miroir", "object": "mirror", "interactions": [{ "do": [{ "message": "Votre reflet a l’air fatigué." }] }] } + { + "id": "digit4", + "label": "Inscription", + "cursor": "look", + "object": "digit4", + "interactions": [ + { + "do": [ + { + "message": "Un « 4 » vert, peint maladroitement sur les boiseries." + }, + { + "clue": "digit4" + } + ] + } + ] + }, + { + "id": "mirror", + "label": "Miroir", + "object": "mirror", + "interactions": [ + { + "do": [ + { + "message": "Votre reflet a l’air fatigué." + } + ] + } + ] + } ] }, { "id": "west", "title": "Mur ouest — la bibliothèque", - "camera": { "position": [0, 1.6, 0], "target": [-3, 1.3, 0], "fov": 55 }, + "camera": { + "position": [ + 0, + 1.6, + 0 + ], + "target": [ + -3, + 1.3, + 0 + ], + "fov": 55 + }, "left": "south", "right": "north", "hotspots": [ - { "id": "shelf", "label": "Bibliothèque", "object": "bookshelf", "interactions": [{ "do": [{ "goto": "shelf" }] }] }, - { "id": "safe", "label": "Coffret", "object": "safe", "interactions": [{ "do": [{ "goto": "safe" }] }] }, - { "id": "breaker", "label": "Disjoncteur", "object": "breaker", "interactions": [{ "do": [{ "goto": "breaker" }] }] }, - { "id": "armchair", "label": "Fauteuil", "object": "armchair", "interactions": [{ "do": [{ "message": "Un fauteuil en cuir usé. Rien sous les coussins." }] }] } + { + "id": "shelf", + "label": "Bibliothèque", + "object": "bookshelf", + "interactions": [ + { + "do": [ + { + "goto": "shelf" + } + ] + } + ] + }, + { + "id": "safe", + "label": "Coffret", + "object": "safe", + "interactions": [ + { + "do": [ + { + "goto": "safe" + } + ] + } + ] + }, + { + "id": "breaker", + "label": "Disjoncteur", + "object": "breaker", + "interactions": [ + { + "do": [ + { + "goto": "breaker" + } + ] + } + ] + }, + { + "id": "armchair", + "label": "Fauteuil", + "object": "armchair", + "interactions": [ + { + "do": [ + { + "message": "Un fauteuil en cuir usé. Rien sous les coussins." + } + ] + } + ] + } ] }, - { "id": "desk", "title": "Le bureau", - "camera": { "position": [0, 1.45, -1.05], "target": [0, 0.85, -2.7], "fov": 50 }, + "camera": { + "position": [ + 0, + 1.45, + -1.05 + ], + "target": [ + 0, + 0.85, + -2.7 + ], + "fov": 50 + }, "back": "north", "hotspots": [ - { "id": "note", "label": "Mot épinglé", "object": "note", "interactions": [{ "do": [{ "goto": "note" }] }] }, - { "id": "lamp", "label": "Lampe", "object": "lamp", "interactions": [{ "do": [{ "message": "Une lampe de banquier, sur batterie de secours. Sa lumière est chaude et rassurante." }] }] }, - { "id": "inkwell", "label": "Encrier", "object": "inkwell", "interactions": [{ "do": [{ "message": "L’encre a séché depuis longtemps." }] }] }, - { "id": "books", "label": "Livres", "object": "deskBooks", "interactions": [{ "do": [{ "message": "« Chromatisme et mémoire », « Traité des serrures », « Le chiffre de César ». Lectures étranges." }] }] }, { - "id": "drawersLeft", - "label": "Tiroirs", - "object": "drawersLeft", + "id": "note", + "label": "Mot épinglé", + "object": "note", "interactions": [ - { "when": ["!flag:uvlamp_found"], "do": [{ "give": "uvlamp" }, { "setFlag": "uvlamp_found" }, { "message": "Sous une pile de factures : une petite lampe à ultraviolets. Elle ne s’allume pas, il manque les piles." }] }, - { "do": [{ "message": "Des factures, des crayons, des trombones. Rien d’autre." }] } + { + "do": [ + { + "goto": "note" + } + ] + } + ] + }, + { + "id": "lamp", + "label": "Lampe", + "object": "lamp", + "interactions": [ + { + "do": [ + { + "message": "Une lampe de banquier, sur batterie de secours. Sa lumière est chaude et rassurante." + } + ] + } + ] + }, + { + "id": "inkwell", + "label": "Encrier", + "object": "inkwell", + "interactions": [ + { + "do": [ + { + "message": "L’encre a séché depuis longtemps." + } + ] + } + ] + }, + { + "id": "books", + "label": "Livres", + "object": "deskBooks", + "interactions": [ + { + "do": [ + { + "message": "« Chromatisme et mémoire », « Traité des serrures », « Le chiffre de César ». Lectures étranges." + } + ] + } + ] + }, + { + "id": "drawersLeft", + "label": "Tiroir du bas", + "object": "drawersLeft", + "interactions": [ + { + "do": [ + { + "message": "Le tiroir du bas est rempli de vieux carnets de comptes. Rien d’utile." + } + ] + } + ] + }, + { + "id": "drawerL1", + "label": "Tiroir", + "object": "drawerL1", + "interactions": [ + { + "when": [ + "!flag:drawerL1_open" + ], + "do": [ + { + "setFlag": "drawerL1_open" + }, + { + "sound": "drawer" + }, + { + "goto": "drawerLeft" + } + ] + }, + { + "do": [ + { + "goto": "drawerLeft" + } + ] + } + ] + }, + { + "id": "drawersRight", + "label": "Tiroirs", + "object": "drawersRight", + "interactions": [ + { + "do": [ + { + "message": "Vides. Quelqu’un a fait le ménage." + } + ] + } ] }, - { "id": "drawersRight", "label": "Tiroirs", "object": "drawersRight", "interactions": [{ "do": [{ "message": "Vides. Quelqu’un a fait le ménage." }] }] }, { "id": "secretPanel", "label": "Panneau central", - "visibleWhen": ["!flag:drawer_open"], + "visibleWhen": [ + "!flag:drawer_open" + ], "object": "secretDrawer", - "interactions": [{ "do": [{ "sound": "step" }, { "message": "Le panneau sonne creux… mais il n’a ni poignée ni serrure." }] }] + "interactions": [ + { + "do": [ + { + "sound": "step" + }, + { + "message": "Le panneau sonne creux… mais il n’a ni poignée ni serrure." + } + ] + } + ] }, { "id": "secretDrawer", "label": "Tiroir secret", - "visibleWhen": ["flag:drawer_open", "flag:key_taken"], + "visibleWhen": [ + "flag:drawer_open", + "flag:key_taken" + ], "object": "secretDrawer", - "interactions": [{ "do": [{ "message": "Le tiroir secret est vide, maintenant." }] }] + "interactions": [ + { + "do": [ + { + "message": "Le tiroir secret est vide, maintenant." + } + ] + } + ] }, { "id": "key", "label": "Clé", - "visibleWhen": ["flag:drawer_open", "!flag:key_taken"], + "visibleWhen": [ + "flag:drawer_open", + "!flag:key_taken" + ], "object": "key", - "interactions": [{ "do": [{ "give": "key" }, { "setFlag": "key_taken" }, { "message": "Vous prenez une clé en laiton. Elle est lourde et froide." }] }] + "interactions": [ + { + "do": [ + { + "give": "key" + }, + { + "setFlag": "key_taken" + }, + { + "message": "Vous prenez une clé en laiton. Elle est lourde et froide." + } + ] + } + ] + } + ] + }, + { + "id": "drawerLeft", + "title": "Le tiroir", + "camera": { + "position": [ + -0.55, + 1.25, + -1.8 + ], + "target": [ + -0.55, + 0.48, + -2.17 + ], + "fov": 34 + }, + "back": "desk", + "hotspots": [ + { + "id": "invoices", + "label": "Factures", + "cursor": "look", + "object": "drawerL1", + "interactions": [ + { + "do": [ + { + "message": "Des factures de l’horloger, du libraire… rien d’intéressant." + } + ] + } + ] + }, + { + "id": "uvlamp", + "label": "Lampe", + "visibleWhen": [ + "!flag:uvlamp_found" + ], + "object": "uvlampItem", + "interactions": [ + { + "do": [ + { + "give": "uvlamp" + }, + { + "setFlag": "uvlamp_found" + }, + { + "message": "Une petite lampe à ultraviolets, cachée sous les factures. Elle ne s’allume pas : il manque les piles." + } + ] + } + ] } ] }, { "id": "note", "title": "Le mot", - "camera": { "position": [0.35, 1.18, -2.62], "target": [0.35, 1.18, -3], "fov": 30 }, + "camera": { + "position": [ + 0.35, + 1.18, + -2.62 + ], + "target": [ + 0.35, + 1.18, + -3 + ], + "fov": 30 + }, "back": "desk", - "hotspots": [] + "hotspots": [ + { + "id": "paper", + "label": "Mot", + "cursor": "look", + "object": "note", + "interactions": [ + { + "do": [ + { + "message": "« Lindqvist, ils ont repeint la pièce, mais j’ai laissé les chiffres. Chaque chiffre a sa couleur. Chaque couleur a sa place. — A. »" + }, + { + "clue": "note" + } + ] + } + ] + } + ] }, { "id": "clock", "title": "L’horloge", - "camera": { "position": [-1.9, 1.88, -2.2], "target": [-1.9, 1.94, -3], "fov": 34 }, + "camera": { + "position": [ + -1.9, + 1.88, + -2.2 + ], + "target": [ + -1.9, + 1.94, + -3 + ], + "fov": 34 + }, "back": "north", "hotspots": [ - { "id": "clockFace", "label": "Horloge", "cursor": "look", "object": "clock", "interactions": [{ "do": [{ "message": "Les aiguilles sont figées. Le temps s’est arrêté, ici." }] }] } + { + "id": "clockFace", + "label": "Horloge", + "cursor": "look", + "object": "clock", + "interactions": [ + { + "do": [ + { + "message": "Les aiguilles sont figées. Le temps s’est arrêté, ici." + }, + { + "clue": "clock" + } + ] + } + ] + } ] }, { "id": "painting", "title": "Le tableau", - "camera": { "position": [1.55, 1.72, 1.0], "target": [3, 1.72, 1.0], "fov": 40 }, + "camera": { + "position": [ + 1.55, + 1.72, + 1.0 + ], + "target": [ + 3, + 1.72, + 1.0 + ], + "fov": 40 + }, "back": "east", "hotspots": [ { @@ -252,22 +1184,99 @@ "cursor": "look", "object": "paintingCanvas", "interactions": [ - { "when": ["selected:uvlampOn", "!flag:uv_painting"], "do": [{ "setFlag": "uv_painting" }, { "sound": "reveal" }, { "message": "Sous la lumière violette, des lettres luminescentes apparaissent sur la toile !" }] }, - { "when": ["selected:uvlampOn"], "do": [{ "message": "Le message brille toujours sous la lampe." }] }, - { "do": [{ "message": "Un paysage au crépuscule, signé « A. L. »." }] } + { + "when": [ + "selected:uvlampOn", + "!flag:uv_painting" + ], + "do": [ + { + "setFlag": "uv_painting" + }, + { + "sound": "reveal" + }, + { + "message": "Sous la lumière violette, des lettres luminescentes apparaissent sur la toile ! Cliquez sur le message pour l’examiner." + } + ] + }, + { + "when": [ + "selected:uvlampOn" + ], + "do": [ + { + "message": "Le message brille toujours sous la lampe." + } + ] + }, + { + "do": [ + { + "message": "Un paysage au crépuscule, signé « A. L. »." + } + ] + } + ] + }, + { + "id": "digit1", + "label": "Détail", + "cursor": "look", + "object": "digit1", + "interactions": [ + { + "do": [ + { + "message": "Un « 1 » jaune a été ajouté dans le ciel, d’un coup de pinceau rapide." + }, + { + "clue": "digit1" + } + ] + } ] }, - { "id": "digit1", "label": "Détail", "cursor": "look", "object": "digit1", "interactions": [{ "do": [{ "message": "Un « 1 » jaune a été ajouté dans le ciel, d’un coup de pinceau rapide." }] }] }, { "id": "uvText", "label": "Message luminescent", "cursor": "zoom", - "visibleWhen": ["flag:uv_painting"], + "visibleWhen": [ + "flag:uv_painting" + ], "object": "uvMessage", "interactions": [ - { "when": ["solved:cipher"], "do": [{ "message": "« LE COFFRE S’OUVRE À L’HEURE OÙ LE TEMPS S’EST ARRÊTÉ »" }] }, - { "when": ["selected:uvlampOn"], "do": [{ "puzzle": "cipher" }] }, - { "do": [{ "puzzle": "cipher" }] } + { + "when": [ + "solved:cipher" + ], + "do": [ + { + "message": "« LE COFFRE S’OUVRE À L’HEURE OÙ LE TEMPS S’EST ARRÊTÉ »" + }, + { + "clue": "cipher" + } + ] + }, + { + "when": [ + "selected:uvlampOn" + ], + "do": [ + { + "puzzle": "cipher" + } + ] + }, + { + "do": [ + { + "puzzle": "cipher" + } + ] + } ] } ] @@ -275,46 +1284,229 @@ { "id": "shelf", "title": "La bibliothèque", - "camera": { "position": [-1.7, 1.3, -0.08], "target": [-3, 1.25, -0.08], "fov": 40 }, + "camera": { + "position": [ + -1.7, + 1.3, + -0.08 + ], + "target": [ + -3, + 1.25, + -0.08 + ], + "fov": 40 + }, "back": "west", "hotspots": [ - { "id": "books", "label": "Livres", "cursor": "look", "object": "bookshelf", "interactions": [{ "do": [{ "message": "Cryptographie, chimie, horlogerie… Rien qui ne serve maintenant." }] }] }, - { "id": "book2", "label": "Livre blanc", "cursor": "look", "object": "book2", "interactions": [{ "do": [{ "message": "Un livre sans titre. Un « 2 » rouge est peint à la main sur la tranche." }] }] } + { + "id": "books", + "label": "Livres", + "cursor": "look", + "object": "bookshelf", + "interactions": [ + { + "do": [ + { + "message": "Cryptographie, chimie, horlogerie… Rien qui ne serve maintenant." + } + ] + } + ] + }, + { + "id": "book2", + "label": "Livre blanc", + "cursor": "look", + "object": "book2", + "interactions": [ + { + "do": [ + { + "message": "Un livre sans titre. Un « 2 » rouge est peint à la main sur la tranche." + }, + { + "clue": "digit2" + } + ] + } + ] + } ] }, { "id": "safe", "title": "Le coffret", - "camera": { "position": [-1.95, 0.62, -0.36], "target": [-2.7, 0.22, -0.36], "fov": 40 }, + "camera": { + "position": [ + -1.95, + 0.62, + -0.36 + ], + "target": [ + -2.7, + 0.22, + -0.36 + ], + "fov": 40 + }, "back": "west", "hotspots": [ - { "id": "dial1", "label": "Molette 1", "cursor": "use", "visibleWhen": ["!flag:safe_open"], "object": "dial1", "interactions": [{ "do": [{ "add": "dial1", "mod": 10 }, { "sound": "dial" }] }] }, - { "id": "dial2", "label": "Molette 2", "cursor": "use", "visibleWhen": ["!flag:safe_open"], "object": "dial2", "interactions": [{ "do": [{ "add": "dial2", "mod": 10 }, { "sound": "dial" }] }] }, - { "id": "dial3", "label": "Molette 3", "cursor": "use", "visibleWhen": ["!flag:safe_open"], "object": "dial3", "interactions": [{ "do": [{ "add": "dial3", "mod": 10 }, { "sound": "dial" }] }] }, - { "id": "dial4", "label": "Molette 4", "cursor": "use", "visibleWhen": ["!flag:safe_open"], "object": "dial4", "interactions": [{ "do": [{ "add": "dial4", "mod": 10 }, { "sound": "dial" }] }] }, + { + "id": "dial1", + "label": "Molette 1", + "cursor": "use", + "visibleWhen": [ + "!flag:safe_open" + ], + "object": "dial1", + "interactions": [ + { + "do": [ + { + "add": "dial1", + "mod": 10 + }, + { + "sound": "dial" + } + ] + } + ] + }, + { + "id": "dial2", + "label": "Molette 2", + "cursor": "use", + "visibleWhen": [ + "!flag:safe_open" + ], + "object": "dial2", + "interactions": [ + { + "do": [ + { + "add": "dial2", + "mod": 10 + }, + { + "sound": "dial" + } + ] + } + ] + }, + { + "id": "dial3", + "label": "Molette 3", + "cursor": "use", + "visibleWhen": [ + "!flag:safe_open" + ], + "object": "dial3", + "interactions": [ + { + "do": [ + { + "add": "dial3", + "mod": 10 + }, + { + "sound": "dial" + } + ] + } + ] + }, + { + "id": "dial4", + "label": "Molette 4", + "cursor": "use", + "visibleWhen": [ + "!flag:safe_open" + ], + "object": "dial4", + "interactions": [ + { + "do": [ + { + "add": "dial4", + "mod": 10 + }, + { + "sound": "dial" + } + ] + } + ] + }, { "id": "safeBody", "label": "Coffret", "cursor": "look", "object": "safe", "interactions": [ - { "when": ["flag:safe_open"], "do": [{ "message": "Le coffret est ouvert." }] }, - { "do": [{ "message": "Un coffret en acier « Lindqvist & Fils ». Quatre molettes chiffrées le verrouillent." }] } + { + "when": [ + "flag:safe_open" + ], + "do": [ + { + "message": "Le coffret est ouvert." + } + ] + }, + { + "do": [ + { + "message": "Un coffret en acier « Lindqvist & Fils ». Quatre molettes chiffrées le verrouillent." + } + ] + } ] }, { "id": "lever", "label": "Manette", - "visibleWhen": ["flag:safe_open", "!flag:lever_taken"], + "visibleWhen": [ + "flag:safe_open", + "!flag:lever_taken" + ], "object": "leverItem", - "interactions": [{ "do": [{ "give": "lever" }, { "setFlag": "lever_taken" }, { "message": "Une manette à poignée rouge… comme celles des disjoncteurs." }] }] + "interactions": [ + { + "do": [ + { + "give": "lever" + }, + { + "setFlag": "lever_taken" + }, + { + "message": "Une manette à poignée rouge… comme celles des disjoncteurs." + } + ] + } + ] } ] }, { "id": "breaker", "title": "Le disjoncteur", - "camera": { "position": [-2.05, 1.5, 1.6], "target": [-2.9, 1.42, 1.6], "fov": 40 }, + "camera": { + "position": [ + -2.05, + 1.5, + 1.6 + ], + "target": [ + -2.9, + 1.42, + 1.6 + ], + "fov": 40 + }, "back": "west", "hotspots": [ { @@ -322,39 +1514,163 @@ "label": "Disjoncteur", "object": "breaker", "interactions": [ - { "when": ["selected:lever"], "do": [{ "remove": "lever" }, { "setFlag": "lever_installed" }, { "sound": "switch" }, { "message": "La manette s’emboîte parfaitement. Elle est en position haute." }] }, - { "when": ["flag:power_on"], "do": [{ "message": "Le voyant est vert : le courant est rétabli." }] }, - { "when": ["flag:lever_installed"], "do": [{ "message": "La manette est en position haute. Il suffit de l’abaisser." }] }, - { "when": ["item:lever"], "do": [{ "message": "La manette du coffret devrait s’emboîter ici. Sélectionnez-la dans l’inventaire, puis cliquez sur le disjoncteur." }] }, - { "do": [{ "message": "Un disjoncteur dont on a retiré la manette. Impossible de rétablir le courant ainsi." }] } + { + "when": [ + "selected:lever" + ], + "do": [ + { + "remove": "lever" + }, + { + "setFlag": "lever_installed" + }, + { + "sound": "switch" + }, + { + "message": "La manette s’emboîte parfaitement. Elle est en position haute." + } + ] + }, + { + "when": [ + "flag:power_on" + ], + "do": [ + { + "message": "Le voyant est vert : le courant est rétabli." + } + ] + }, + { + "when": [ + "flag:lever_installed" + ], + "do": [ + { + "message": "La manette est en position haute. Il suffit de l’abaisser." + } + ] + }, + { + "when": [ + "item:lever" + ], + "do": [ + { + "message": "La manette du coffret devrait s’emboîter ici. Sélectionnez-la dans l’inventaire, puis cliquez sur le disjoncteur." + } + ] + }, + { + "do": [ + { + "message": "Un disjoncteur dont on a retiré la manette. Impossible de rétablir le courant ainsi." + } + ] + } ] }, { "id": "breakerLever", "label": "Abaisser la manette", "cursor": "use", - "visibleWhen": ["flag:lever_installed", "!flag:power_on"], + "visibleWhen": [ + "flag:lever_installed", + "!flag:power_on" + ], "object": "breakerLever", - "interactions": [{ "do": [{ "setFlag": "power_on" }, { "sound": "switch" }, { "sound": "power" }, { "message": "Clac ! Le plafonnier grésille puis s’allume. Le courant est revenu dans la pièce." }] }] + "interactions": [ + { + "do": [ + { + "setFlag": "power_on" + }, + { + "sound": "switch" + }, + { + "sound": "power" + }, + { + "message": "Clac ! Le plafonnier grésille puis s’allume. Le courant est revenu dans la pièce." + } + ] + } + ] } ] }, { "id": "door", "title": "La porte", - "camera": { "position": [0, 1.35, 1.55], "target": [-0.1, 1.15, 3], "fov": 50 }, + "camera": { + "position": [ + 0, + 1.35, + 1.55 + ], + "target": [ + -0.1, + 1.15, + 3 + ], + "fov": 50 + }, "back": "south", "hotspots": [ - { "id": "doorBody", "label": "Porte", "cursor": "look", "object": "door", "interactions": [{ "do": [{ "message": "Une lourde porte en chêne. Impossible de la forcer." }] }] }, + { + "id": "doorBody", + "label": "Porte", + "cursor": "look", + "object": "door", + "interactions": [ + { + "do": [ + { + "message": "Une lourde porte en chêne. Impossible de la forcer." + } + ] + } + ] + }, { "id": "panelSide", "label": "Boîtier de commande", "cursor": "zoom", "object": "panel", "interactions": [ - { "when": ["solved:colorPanel"], "do": [{ "message": "Les quatre voyants sont allumés. Le boîtier ne répond plus." }] }, - { "when": ["!flag:power_on"], "do": [{ "message": "Le boîtier est éteint : son circuit est coupé. Il doit y avoir un disjoncteur quelque part." }] }, - { "do": [{ "puzzle": "colorPanel" }] } + { + "when": [ + "solved:colorPanel" + ], + "do": [ + { + "message": "Les quatre voyants sont allumés. Le boîtier ne répond plus." + } + ] + }, + { + "when": [ + "!flag:power_on" + ], + "do": [ + { + "message": "Le boîtier est éteint : son circuit est coupé. Il doit y avoir un disjoncteur quelque part." + }, + { + "clue": "panel" + } + ] + }, + { + "do": [ + { + "puzzle": "colorPanel" + } + ] + } ] }, { @@ -363,40 +1679,84 @@ "cursor": "look", "object": "lock", "interactions": [ - { "when": ["selected:key"], "do": [{ "sound": "unlock" }, { "remove": "key" }, { "setFlag": "door_open" }, { "win": true }] }, - { "when": ["item:key"], "do": [{ "message": "Cette clé en laiton devrait aller dans la serrure. Sélectionnez-la dans l’inventaire, puis cliquez ici." }] }, - { "do": [{ "message": "Verrouillée. Le trou de serrure est assez large pour une vieille clé." }] } + { + "when": [ + "selected:key" + ], + "do": [ + { + "sound": "unlock" + }, + { + "remove": "key" + }, + { + "setFlag": "door_open" + }, + { + "win": true + } + ] + }, + { + "when": [ + "item:key" + ], + "do": [ + { + "message": "Cette clé en laiton devrait aller dans la serrure. Sélectionnez-la dans l’inventaire, puis cliquez ici." + } + ] + }, + { + "do": [ + { + "message": "Verrouillée. Le trou de serrure est assez large pour une vieille clé." + } + ] + } ] } ] } ], - "hints": [ { - "when": ["!item:uvlampOn", "!flag:uv_painting"], + "when": [ + "!item:uvlampOn", + "!flag:uv_painting" + ], "hints": [ - "Fouillez les meubles : les tiroirs du bureau, ce qui traîne sur les murs et les tables…", - "La lampe UV trouvée dans le bureau n’a pas de piles. Le vase posé sur la console, près du tableau, en cache peut-être.", + "Fouillez les meubles : ouvrez les tiroirs du bureau, regardez dans ce qui traîne…", + "La lampe UV, dans un tiroir du bureau, n’a pas de piles. Regardez au fond du vase posé sous le tableau.", "Sélectionnez la lampe UV dans l’inventaire, puis cliquez sur les piles pour les combiner." ] }, { - "when": ["item:uvlampOn", "!flag:uv_painting"], + "when": [ + "item:uvlampOn", + "!flag:uv_painting" + ], "hints": [ "Une lampe UV révèle les encres invisibles. Où un artiste laisserait-il un message ?", - "Approchez-vous du tableau, sélectionnez la lampe UV allumée, puis cliquez sur la toile." + "Approchez-vous du tableau, prenez la lampe UV allumée en main et promenez son halo sur la toile, puis cliquez sur ce qui apparaît." ] }, { - "when": ["flag:uv_painting", "!solved:cipher"], + "when": [ + "flag:uv_painting", + "!solved:cipher" + ], "hints": [ "Chaque lettre a été remplacée par une autre, plus loin dans l’alphabet.", "Cliquez sur le message lumineux et tournez la roue jusqu’à ce que le texte devienne lisible (décalage 7)." ] }, { - "when": ["solved:cipher", "!flag:safe_open"], + "when": [ + "solved:cipher", + "!flag:safe_open" + ], "hints": [ "À quelle heure le temps s’est-il arrêté dans cette pièce ? Regardez l’horloge de près.", "Un coffret à molettes est rangé en bas de la bibliothèque.", @@ -404,14 +1764,20 @@ ] }, { - "when": ["flag:safe_open", "!flag:power_on"], + "when": [ + "flag:safe_open", + "!flag:power_on" + ], "hints": [ "La manette du coffret doit servir à rétablir le courant. Le boîtier près de la porte est éteint…", "Le disjoncteur est sur le mur ouest, à gauche de la bibliothèque : installez la manette, puis abaissez-la." ] }, { - "when": ["flag:power_on", "!solved:colorPanel"], + "when": [ + "flag:power_on", + "!solved:colorPanel" + ], "hints": [ "Le boîtier près de la porte est maintenant sous tension. Relisez le mot épinglé au-dessus du bureau.", "Quatre chiffres de couleur sont cachés dans la pièce : deux sont peints sur les murs, les deux autres se trouvent sur le tableau et dans la bibliothèque.", @@ -419,12 +1785,61 @@ ] }, { - "when": ["flag:drawer_open", "!flag:key_taken"], - "hints": ["Le déclic venait du bureau.", "Le panneau central du bureau s’est ouvert : approchez-vous du bureau pour voir ce qu’il contient."] + "when": [ + "flag:drawer_open", + "!flag:key_taken" + ], + "hints": [ + "Le déclic venait du bureau.", + "Le panneau central du bureau s’est ouvert : approchez-vous du bureau pour voir ce qu’il contient." + ] }, { - "when": ["flag:key_taken"], - "hints": ["Cette clé doit bien ouvrir quelque chose…", "Sélectionnez la clé dans l’inventaire, puis cliquez sur la serrure de la porte."] + "when": [ + "flag:key_taken" + ], + "hints": [ + "Cette clé doit bien ouvrir quelque chose…", + "Sélectionnez la clé dans l’inventaire, puis cliquez sur la serrure de la porte." + ] + } + ], + "uvLight": { + "item": "uvlampOn", + "radius": 0.14 + }, + "clues": [ + { + "id": "note", + "text": "Mot du professeur : « Chaque chiffre a sa couleur. Chaque couleur a sa place. »" + }, + { + "id": "digit1", + "text": "Un « 1 » jaune, peint dans le ciel du tableau." + }, + { + "id": "digit2", + "text": "Un « 2 » rouge, sur la tranche d’un livre de la bibliothèque." + }, + { + "id": "digit3", + "text": "Un « 3 » bleu, peint sur le mur au-dessus du bureau." + }, + { + "id": "digit4", + "text": "Un « 4 » vert, peint sur les boiseries près de la porte." + }, + { + "id": "cipher", + "text": "Message décodé : « Le coffre s’ouvre à l’heure où le temps s’est arrêté. »" + }, + { + "id": "clock", + "text": "L’horloge du mur nord est arrêtée." + }, + { + "id": "panel", + "text": "Le boîtier près de la porte a 4 emplacements, numérotés de 1 à 4, et plusieurs couleurs possibles." } ] } diff --git a/src/scenarios/chapitre1/walkthrough.json b/src/scenarios/chapitre1/walkthrough.json index c68e5c0..9fd1b62 100644 --- a/src/scenarios/chapitre1/walkthrough.json +++ b/src/scenarios/chapitre1/walkthrough.json @@ -1,43 +1,240 @@ { "description": "Solution de référence du chapitre 1. Rejouée automatiquement par `npm test` (moteur seul) et `npm run smoke` (vrais clics dans le navigateur).", "steps": [ - { "click": "desk", "expect": ["scene:desk"] }, - { "click": "drawersLeft", "expect": ["item:uvlamp"] }, - { "click": "__back" }, - { "click": "__right", "expect": ["scene:east"] }, - { "click": "vase", "expect": ["item:batteries"] }, - { "combine": ["uvlamp", "batteries"], "expect": ["item:uvlampOn", "!item:uvlamp"] }, - { "click": "painting", "expect": ["scene:painting"] }, - { "use": "uvlampOn", "on": "canvas", "expect": ["flag:uv_painting"] }, - { "click": "uvText" }, - { "solve": "cipher", "expect": ["solved:cipher"] }, - { "click": "__back" }, - { "click": "__left", "expect": ["scene:north"] }, - { "click": "clock", "expect": ["scene:clock"] }, - { "click": "__back" }, - { "click": "__left", "expect": ["scene:west"] }, - { "click": "safe", "expect": ["scene:safe"] }, - { "click": "dial1", "times": 8 }, - { "click": "dial2", "times": 3 }, - { "click": "dial3", "times": 2 }, - { "click": "dial4", "times": 5, "expect": ["flag:safe_open"] }, - { "click": "lever", "expect": ["item:lever"] }, - { "click": "__back" }, - { "click": "breaker", "expect": ["scene:breaker"] }, - { "use": "lever", "on": "breakerBox", "expect": ["flag:lever_installed", "!item:lever"] }, - { "click": "breakerLever", "expect": ["flag:power_on"] }, - { "click": "__back" }, - { "click": "__left", "expect": ["scene:south"] }, - { "click": "panel" }, - { "solve": "colorPanel", "expect": ["flag:drawer_open"] }, - { "click": "__right" }, - { "click": "__right", "expect": ["scene:north"] }, - { "click": "desk" }, - { "click": "key", "expect": ["item:key"] }, - { "click": "__back" }, - { "click": "__left" }, - { "click": "__left", "expect": ["scene:south"] }, - { "click": "door" }, - { "use": "key", "on": "lock", "expect": ["won"] } + { + "click": "desk", + "expect": [ + "scene:desk" + ] + }, + { + "click": "drawerL1", + "expect": [ + "scene:drawerLeft", + "flag:drawerL1_open" + ] + }, + { + "click": "uvlamp", + "expect": [ + "item:uvlamp" + ] + }, + { + "click": "__back", + "expect": [ + "scene:desk" + ] + }, + { + "click": "__back", + "expect": [ + "scene:north" + ] + }, + { + "click": "__right", + "expect": [ + "scene:east" + ] + }, + { + "click": "vase", + "expect": [ + "scene:vase" + ] + }, + { + "click": "batteries", + "expect": [ + "item:batteries" + ] + }, + { + "click": "__back", + "expect": [ + "scene:east" + ] + }, + { + "combine": [ + "uvlamp", + "batteries" + ], + "expect": [ + "item:uvlampOn", + "!item:uvlamp" + ] + }, + { + "click": "painting", + "expect": [ + "scene:painting" + ] + }, + { + "click": "digit1" + }, + { + "note": "digit1" + }, + { + "use": "uvlampOn", + "on": "canvas", + "expect": [ + "flag:uv_painting" + ] + }, + { + "click": "uvText" + }, + { + "solve": "cipher", + "expect": [ + "solved:cipher" + ] + }, + { + "click": "__back" + }, + { + "click": "__left", + "expect": [ + "scene:north" + ] + }, + { + "click": "clock", + "expect": [ + "scene:clock" + ] + }, + { + "click": "clockFace" + }, + { + "note": "clock" + }, + { + "click": "__back" + }, + { + "click": "__left", + "expect": [ + "scene:west" + ] + }, + { + "click": "safe", + "expect": [ + "scene:safe" + ] + }, + { + "click": "dial1", + "times": 8 + }, + { + "click": "dial2", + "times": 3 + }, + { + "click": "dial3", + "times": 2 + }, + { + "click": "dial4", + "times": 5, + "expect": [ + "flag:safe_open" + ] + }, + { + "click": "lever", + "expect": [ + "item:lever" + ] + }, + { + "click": "__back" + }, + { + "click": "breaker", + "expect": [ + "scene:breaker" + ] + }, + { + "use": "lever", + "on": "breakerBox", + "expect": [ + "flag:lever_installed", + "!item:lever" + ] + }, + { + "click": "breakerLever", + "expect": [ + "flag:power_on" + ] + }, + { + "click": "__back" + }, + { + "click": "__left", + "expect": [ + "scene:south" + ] + }, + { + "click": "panel" + }, + { + "solve": "colorPanel", + "expect": [ + "flag:drawer_open" + ] + }, + { + "click": "__right" + }, + { + "click": "__right", + "expect": [ + "scene:north" + ] + }, + { + "click": "desk" + }, + { + "click": "key", + "expect": [ + "item:key" + ] + }, + { + "click": "__back" + }, + { + "click": "__left" + }, + { + "click": "__left", + "expect": [ + "scene:south" + ] + }, + { + "click": "door" + }, + { + "use": "key", + "on": "lock", + "expect": [ + "won" + ] + } ] } diff --git a/src/style.css b/src/style.css index a20d3c8..b88815e 100644 --- a/src/style.css +++ b/src/style.css @@ -196,16 +196,16 @@ button.primary:hover { background: #dbb55c; } .message { position: absolute; left: 50%; - bottom: 14%; - transform: translate(-50%, 12px); - max-width: min(760px, 86%); - padding: 14px 22px; + top: 14px; + transform: translate(-50%, -12px); + max-width: min(700px, 80%); + padding: 12px 20px; background: rgba(8, 9, 10, .86); border: 1px solid rgba(201, 162, 74, .35); border-radius: 8px; font-family: var(--serif); - font-size: clamp(14px, 1.6vw, 18px); - line-height: 1.55; + font-size: clamp(13px, 1.45vw, 17px); + line-height: 1.5; text-align: center; opacity: 0; pointer-events: none; @@ -217,6 +217,90 @@ button.primary:hover { background: #dbb55c; } .message.visible { opacity: 1; transform: translate(-50%, 0); } .message.hint { border-color: #5aa0d8; } .message.hint::before { content: 'Indice — '; color: #7fbaea; font-style: italic; } +.message-text { display: block; } +.clue-btn { + pointer-events: auto; + margin-top: 10px; + font: 600 13px/1 system-ui, sans-serif; + padding: 8px 14px; + background: #2a2214; + border-color: var(--brass-dark); + color: #f1d58e; +} +.clue-btn::before { content: ''; display: inline-block; width: 12px; height: 14px; margin-right: 8px; vertical-align: -2px; background: linear-gradient(#e9dec4, #cdb88a); border-left: 3px solid #8a3a2a; border-radius: 1px; } +.clue-btn:disabled { opacity: .8; cursor: default; } + +/* Halo de la lampe UV (le révélateur d'encre est calculé en 3D, ceci est l'effet lumineux) */ +.uv-halo { + position: absolute; + left: 0; + top: 0; + width: clamp(140px, 17vw, 230px); + aspect-ratio: 1; + border-radius: 50%; + background: radial-gradient(circle, rgba(180, 120, 255, .5) 0%, rgba(140, 80, 255, .28) 40%, rgba(90, 40, 220, 0) 70%); + mix-blend-mode: screen; + pointer-events: none; + opacity: 0; + transition: opacity .25s; + z-index: 12; +} +.uv-halo.visible { opacity: 1; } + +/* Annonce « Objet obtenu » */ +.item-toast { + position: absolute; + left: 50%; + top: 46%; + transform: translate(-50%, -50%); + display: flex; + flex-direction: column; + align-items: center; + gap: 6px; + padding: 18px 34px 16px; + border-radius: 14px; + background: radial-gradient(ellipse at center, rgba(20, 16, 8, .92), rgba(8, 7, 4, .85)); + border: 1px solid rgba(201, 162, 74, .55); + box-shadow: 0 0 60px rgba(201, 162, 74, .25), 0 20px 50px rgba(0, 0, 0, .7); + opacity: 0; + pointer-events: none; + z-index: 24; +} +.item-toast img { width: 72px; height: 72px; filter: drop-shadow(0 0 14px rgba(255, 215, 130, .45)); } +.item-toast-label { font: 600 11px/1 system-ui, sans-serif; letter-spacing: .25em; text-transform: uppercase; color: var(--brass); } +.item-toast-name { font-family: var(--serif); font-size: clamp(20px, 2.4vw, 28px); color: #f4e6c8; } +.item-toast.show { animation: toast 2.4s ease forwards; } +@keyframes toast { + 0% { opacity: 0; transform: translate(-50%, -40%) scale(.9); } + 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } + 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } + 100% { opacity: 0; transform: translate(-50%, -62%) scale(.98); } +} +.slot.fresh { animation: fresh 0.8s ease 3; border-color: var(--brass); } +@keyframes fresh { 50% { box-shadow: 0 0 0 3px rgba(201, 162, 74, .6), 0 0 22px rgba(201, 162, 74, .6); } } + +/* Carnet d'indices */ +.notebook-btn b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 4px; border-radius: 9px; background: var(--brass); color: #1a1408; font-size: 11px; } +.notebook-btn.pulse { animation: fresh .8s ease 2; } +.notebook { + position: relative; + width: min(560px, 84%); + max-height: 80%; + overflow: auto; + padding: 26px 34px 30px 52px; + border-radius: 6px; + background: + repeating-linear-gradient(transparent 0 31px, rgba(90, 120, 160, .28) 31px 32px), + linear-gradient(90deg, transparent 38px, rgba(200, 70, 60, .45) 38px 40px, transparent 40px), + #efe6cf; + color: #2a2a4a; + box-shadow: 0 25px 60px rgba(0, 0, 0, .8); + font-family: 'Segoe Script', 'Bradley Hand', 'Comic Sans MS', cursive; +} +.notebook h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 24px; color: #3a2a1a; } +.notebook ol { margin: 0; padding-left: 18px; line-height: 32px; font-size: 16px; } +.notebook-empty { font-family: var(--serif); font-style: italic; color: #6a5a4a; line-height: 1.6; } +.notebook .puzzle-close { top: 10px; right: 10px; color: var(--text); } .tooltip { position: absolute; diff --git a/src/worlds/bureau.ts b/src/worlds/bureau.ts index 4f41614..3dec025 100644 --- a/src/worlds/bureau.ts +++ b/src/worlds/bureau.ts @@ -1,7 +1,7 @@ import * as THREE from 'three'; import * as T from './textures'; import type { World } from './index'; -import { PICK_LAYER } from './common'; +import { PICK_LAYER, invisibleInk } from './common'; /** * Le bureau du professeur, en 3D, construit par code (primitives + textures @@ -149,16 +149,65 @@ function desk(): THREE.Group { const g = group(name, x, 0, 0); g.add(box(0.5, 0.68, 0.72, M.woodDark, 0, 0.42, 0)); for (const y of [0.6, 0.26]) { - g.add(box(0.46, 0.3, 0.02, M.woodMid, 0, y, 0.37)); + const front = box(0.46, 0.3, 0.02, M.woodMid, 0, 0, 0.37); const handle = new THREE.Mesh(new THREE.CylinderGeometry(0.008, 0.008, 0.1, 12), M.brass); handle.rotation.z = Math.PI / 2; - handle.position.set(0, y, 0.39); - g.add(handle); + handle.position.set(0, 0, 0.39); + const drawer = group(undefined, 0, y, 0, front, handle); + // Le tiroir du haut à gauche s'ouvre réellement (contenu : factures + lampe UV). + if (name === 'drawersLeft' && y === 0.6) { + drawer.name = 'drawerL1'; + drawer.add(...drawerBody(), ...drawerContents()); + } + g.add(drawer); } for (const fx of [-0.22, 0.22]) for (const fz of [-0.32, 0.32]) g.add(box(0.05, 0.08, 0.05, M.woodBlack, fx, 0.04, fz)); return g; }; + /** Caisson intérieur d'un tiroir (visible une fois tiré). */ + function drawerBody(): THREE.Object3D[] { + const inside = new THREE.MeshStandardMaterial({ color: '#3a2414', map: grain, roughness: 0.9 }); + return [ + box(0.42, 0.01, 0.5, inside, 0, -0.12, 0.11), + box(0.01, 0.2, 0.5, inside, -0.205, -0.03, 0.11), + box(0.01, 0.2, 0.5, inside, 0.205, -0.03, 0.11), + box(0.42, 0.2, 0.01, inside, 0, -0.03, -0.14), + ]; + } + + /** Factures en vrac et lampe UV à moitié cachée dessous. */ + function drawerContents(): THREE.Object3D[] { + const paper = (c: string) => new THREE.MeshStandardMaterial({ color: c, roughness: 0.95 }); + const sheets: THREE.Object3D[] = []; + [ + ['#e9e1cc', -0.07, 0.12, 0.15], + ['#ddd3b8', -0.05, 0.16, -0.1], + ['#efe8d6', -0.02, 0.1, 0.32], + ].forEach(([c, x, z, r], i) => { + const s = box(0.17, 0.003, 0.12, paper(c as string), x as number, -0.113 + i * 0.004, z as number); + s.rotation.y = r as number; + sheets.push(s); + }); + // Lampe UV : corps sombre, tête et lentille violette qui dépasse des factures + const body = new THREE.Mesh(new THREE.CylinderGeometry(0.016, 0.016, 0.12, 16), new THREE.MeshStandardMaterial({ color: '#3d4247', metalness: 0.6, roughness: 0.4 })); + body.rotation.z = Math.PI / 2; + const head = new THREE.Mesh(new THREE.CylinderGeometry(0.024, 0.02, 0.035, 16), new THREE.MeshStandardMaterial({ color: '#2c2f33', metalness: 0.6, roughness: 0.4 })); + head.rotation.z = Math.PI / 2; + head.position.x = 0.075; + const lens = new THREE.Mesh(new THREE.CircleGeometry(0.02, 16), new THREE.MeshStandardMaterial({ color: '#6a3fc0', emissive: '#4a2a90', emissiveIntensity: 0.6, roughness: 0.2 })); + lens.rotation.y = Math.PI / 2; + lens.position.x = 0.093; + const zone = pickZone(0.18, 0.09, 0.02, 0, 0); + zone.rotation.x = -Math.PI / 2; + const lamp = group('uvlampItem', 0.085, -0.098, 0.15, body, head, lens, zone); + lamp.rotation.y = 0.5; + // Une facture posée en travers de la lampe + const over = box(0.15, 0.003, 0.1, paper('#e4dcc4'), 0.02, -0.08, 0.16); + over.rotation.set(0.12, -0.4, 0.05); + return [...sheets, lamp, over]; + } + // Tiroir secret : façade sans poignée, identique au bandeau du bureau. const drawerInside = new THREE.MeshStandardMaterial({ color: '#2a1a0e', roughness: 1 }); const keyGroup = key(); @@ -343,18 +392,11 @@ function eastWall(): THREE.Group { canvas, pickZone(0.12, 0.14, 0.33, 0.24, 0.025, 'digit1'), ); - // Message à l'encre invisible : caché tant que la lampe UV ne l'a pas révélé. - const uv = plane( - 0.92, - 0.41, - new THREE.MeshBasicMaterial({ map: T.uvMessage(["SL JVMMYL Z'VBCYL", "H S'OLBYL VB SL", "ALTWZ Z'LZA HYYLAL"]), transparent: true, depthWrite: false, blending: THREE.AdditiveBlending }), - 0, - -0.08, - 0.024, - 'uvMessage', - ); + // Message à l'encre invisible : n'apparaît que dans le halo de la lampe UV, + // puis reste visible une fois révélé. Enfant de la toile : un clic dessus = clic sur la toile. + const uv = plane(0.92, 0.41, invisibleInk(T.uvMessage(["SL JVMMYL Z'VBCYL", "H S'OLBYL VB SL", "ALTWZ Z'LZA HYYLAL"])), 0, -0.08, 0.004, 'uvMessage'); uv.userData.noShadow = true; - painting.add(uv); + canvas.add(uv); g.add(painting); // Applique de tableau const bar = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.02, 0.36, 16), M.brass); @@ -369,10 +411,25 @@ function eastWall(): THREE.Group { // Console et vase const vase = new THREE.Mesh( - new THREE.LatheGeometry([new THREE.Vector2(0.0, 0), new THREE.Vector2(0.06, 0.0), new THREE.Vector2(0.09, 0.08), new THREE.Vector2(0.06, 0.2), new THREE.Vector2(0.04, 0.26), new THREE.Vector2(0.05, 0.28)], 32), - new THREE.MeshStandardMaterial({ color: '#2c4a5e', roughness: 0.25, metalness: 0.1 }), + new THREE.LatheGeometry([new THREE.Vector2(0.0, 0), new THREE.Vector2(0.06, 0.0), new THREE.Vector2(0.09, 0.08), new THREE.Vector2(0.07, 0.2), new THREE.Vector2(0.065, 0.26), new THREE.Vector2(0.075, 0.28)], 32), + new THREE.MeshStandardMaterial({ color: '#2c4a5e', roughness: 0.25, metalness: 0.1, side: THREE.DoubleSide }), ); - const flowers = group(undefined, 0, 0.28, 0); + // Fond du vase (intérieur) et deux piles cachées dedans + const vaseBottom = new THREE.Mesh(new THREE.CircleGeometry(0.06, 24), new THREE.MeshStandardMaterial({ color: '#1d3442', roughness: 0.6 })); + vaseBottom.rotation.x = -Math.PI / 2; + vaseBottom.position.y = 0.005; + const battery = (x: number, z: number, r: number) => { + const b = new THREE.Mesh(new THREE.CylinderGeometry(0.0075, 0.0075, 0.05, 16), new THREE.MeshStandardMaterial({ color: '#2a2d31', metalness: 0.5, roughness: 0.4 })); + const cap = new THREE.Mesh(new THREE.CylinderGeometry(0.0076, 0.0076, 0.014, 16), new THREE.MeshStandardMaterial({ color: '#c9a24a', metalness: 0.7, roughness: 0.3, emissive: '#5a4210', emissiveIntensity: 0.6 })); + cap.position.y = 0.019; + const bg = group(undefined, x, 0.013, z, b, cap); + bg.rotation.set(Math.PI / 2, 0, r); + return bg; + }; + const batteryZone = pickZone(0.1, 0.1, 0, 0.03, 0); + batteryZone.rotation.x = -Math.PI / 2; + const batteries = group('batteriesItem', 0, 0, 0, battery(-0.012, 0.004, 0.4), battery(0.012, -0.006, -0.3), batteryZone); + const flowers = group('flowers', 0, 0.28, 0); [ ['#c84a5a', -0.05, 0.25], ['#e0b84a', 0.07, 0.2], @@ -392,7 +449,7 @@ function eastWall(): THREE.Group { 0.22, box(0.8, 0.04, 0.34, M.woodLight, 0, 0.8, 0), ...[-0.36, 0.36].flatMap((x) => [-0.14, 0.14].map((z) => box(0.035, 0.78, 0.035, M.woodDark, x, 0.39, z))), - group('vase', 0, 0.82, 0, vase, flowers, pickZone(0.24, 0.6, 0, 0.27, 0.1)), + group('vase', 0, 0.82, 0, vase, vaseBottom, batteries, flowers, pickZone(0.24, 0.6, 0, 0.27, 0.1)), ); g.add(consoleTable); return g; diff --git a/src/worlds/common.ts b/src/worlds/common.ts index 8b3de45..bc08eb7 100644 --- a/src/worlds/common.ts +++ b/src/worlds/common.ts @@ -1,2 +1,38 @@ +import * as THREE from 'three'; + /** Calque des zones cliquables invisibles : ignoré par la caméra, vu par le raycast. */ export const PICK_LAYER = 1; + +/** + * Lampe UV : uniformes partagés par tous les matériaux « encre invisible ». + * Le rendu met à jour le point visé par la souris quand la lampe est en main. + */ +export const UV_LIGHT = { + uUvPoint: { value: new THREE.Vector3(0, -100, 0) }, + uUvRadius: { value: 0.14 }, + uUvActive: { value: 0 }, +}; + +/** + * Matériau d'encre invisible : rien n'apparaît, sauf dans le halo de la lampe UV + * ou une fois l'encre « révélée » (prop `reveal`, uniforme uRevealed). + */ +export function invisibleInk(map: THREE.Texture): THREE.MeshBasicMaterial { + const mat = new THREE.MeshBasicMaterial({ map, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending }); + const uRevealed = { value: 0 }; + mat.userData.uRevealed = uRevealed; + mat.onBeforeCompile = (shader) => { + Object.assign(shader.uniforms, UV_LIGHT, { uRevealed }); + shader.vertexShader = shader.vertexShader + .replace('#include