/** * BOSQUE SUSURRO 🌲 — se llega SUBIENDO desde la salida de la cueva. * * Poderes disponibles aquí (en orden): burbujas 🫧, pistola de agua 🔫, linterna 🔦, pala 🪏 → * LLUVIA 🌧️ (Sabio) → FURIA 😡 (Anna, al regar su granja) → FUEGO 🔥 (Elfa). El HIELO 🥶 llega en la * puerta del castillo (Rey Frío) y el COOL 😎 con Emma: aquí solo hay secretos para cuando vuelvas. * * Reglas de poderes que el nivel explota: * · la LLUVIA revienta las burbujas y endurece la lava; las burbujas también revientan con calor, * espinos y chorros de vapor → no todo se cruza flotando; * · la PALA cava hacia abajo y hacia delante: hay túneles y cámaras ocultas bajo la tierra suelta; * · la FURIA rompe rocas agrietadas y voltea escarabajos; el FUEGO quema matorrales espinosos y * enciende antorchas/braseros; el agua (pistola o lluvia) apaga las Chispas. * * A. Linde (x -8..34) llegada desde la cueva, primeros saltos. * B. Granja de Anna (34..72) huerto seco, Anna furiosa → busca al Sabio. * C. Barranco (72..137) abismo con plataformas y espinos colgantes; acantilado con tierra * suelta en la base (cavar HACIA DELANTE); cámara bajo tierra (cavar * HACIA ABAJO); copa del gran árbol con cofre (secreto de burbujas). * D. Claro del Sabio (137..169) entrega la LLUVIA. * E. Senda humeante (169..207) poza seca con chorros de vapor (la lluvia la llena y los apaga) y * colada de lava con una Chispa (la lluvia la enfría y la apaga). * → vuelta a la granja con la lluvia: el huerto bebe y Anna da la FURIA. * F. Bosque profundo (207..259) roca agrietada bajo un saliente (FURIA), escarabajos acorazados * (FURIA), puerta de las flores (agua + FURIA), túnel secreto con cofre. * G. Santuario de la Elfa (259..310) reto de guardianes (cada uno pide un poder) → FUEGO; matorral * espinoso (FUEGO) y portón de las antorchas + brasero alto (FUEGO * rebotando). * H. Muralla del castillo (310..356) puerta congelada (FUEGO) → Rey Frío: HIELO + portales. * Secretos para la vuelta: paredón con cofre (bloques de HIELO + LLUVIA), cristal COOL. */ import type { ZoneDef } from '../../core/types'; import type { Game } from '../../core/game'; import type { KitZoneContext } from '../kit/context'; import { DigGrid, wireDig } from '../dig'; import { vfxAmbient } from '../../vfx/index'; import { invisibleWall } from './shared'; import { installForestKit } from './forestKit'; let grids: DigGrid[] = []; let offDig: (() => void) | null = null; /** Arco de monedas: n monedas de x0 a x1 con una joroba de altura h sobre y. */ function coinArc(z: { spawn: (t: string, x: number, y: number, p?: Record) => unknown }, x0: number, x1: number, y: number, h: number, n: number): void { for (let i = 0; i < n; i++) { const u = n === 1 ? 0.5 : i / (n - 1); z.spawn('item.coin', x0 + (x1 - x0) * u, y + Math.sin(u * Math.PI) * h); } } export const forestZone: ZoneDef = { id: 'forest', name: 'Bosque Susurro', emoji: '🌲', bounds: { minX: -8, maxX: 356, minY: -12, maxY: 34 }, spawns: { default: { x: 4, y: 0 }, 'from-cave': { x: 4, y: 0 }, 'from-city': { x: 4, y: 0 }, anna: { x: 42, y: 0 }, 'tp-farm': { x: 43, y: 0 }, ravine: { x: 124, y: 0 }, sage: { x: 147, y: 0 }, steam: { x: 170, y: 0 }, deep: { x: 230, y: 0 }, elf: { x: 280, y: 0 }, gate: { x: 327, y: 0 }, 'tp-castle': { x: 330, y: 0 }, 'castle-exit': { x: 324, y: 0 }, 'from-castle': { x: 324, y: 0 }, }, env: 'forest', music: 'forest', build(z) { const g = z.game; const k = z as KitZoneContext; installForestKit(g); z.backdrop('forest', { horizon: 0, layers: 4, seed: 19 }); invisibleWall(g, -8.5, 0, 24); invisibleWall(g, 356.5, 0, 30); grids = []; // ═══ A. Linde del bosque (x -8..34) ═══ z.ground(-8, 34, 0, { style: 'grass' }); z.exit(-7.2, 1.4, 1.8, 3.2, 'cave', 'from-forest', { arrow: 'left' }); z.prop('sign', -4.5, 0, { text: '⬅️ Cueva', z: 0.4 }); z.prop('pine', 1, 0, { z: -3, scale: 2.2 }); z.prop('pine', 12, 0, { z: -3.5, scale: 2.8 }); z.prop('bush', 9, 0, { z: -1.2, berries: true }); z.platform(17, 2.2, 3.4, { style: 'grass', oneWay: true }); z.platform(23, 3.8, 3.4, { style: 'grass', oneWay: true }); coinArc(z, 15.5, 18.5, 3, 0.6, 3); coinArc(z, 21.5, 24.5, 4.6, 0.6, 3); z.spawn('item.checkpoint', 6, 0, { spawn: 'from-cave' }); if (g.hasType('enemy.mushroom')) g.spawn('enemy.mushroom', 29, 0, { patrol: [26, 33] }); if (g.hasType('enemy.bee')) g.spawn('enemy.bee', 20, 6.4, { patrol: [15, 26] }); k.scatter('grassTuft', 0, 32, 0, 12, { z: 1.1, zJitter: 0.15 }); // ═══ B. Granja de Anna (x 34..72) ═══ z.ground(34, 72, 0, { style: 'grass' }); z.prop('house', 37, 0, { z: -2.4, roof: true, scale: 1.4 }); z.prop('fence', 50, 0, { width: 13, z: 0.4 }); z.prop('tree', 66, 0, { z: -0.6, scale: 1.3 }); z.spawn('forest.windmill', 27.5, 0, { h: 4.4 }); z.spawn('npc.anna', 42, 0, { facing: -1 }); z.spawn('item.checkpoint', 44, 0, { spawn: 'anna' }); z.spawn('item.teleporter', 47, 0, { id: 'farm', name: 'Granja de Anna' }); for (let i = 0; i < 9; i++) z.spawn('forest.farm', 54 + (i % 3) * 2.1, 0, { index: i, kind: ['corn', 'carrot', 'sunflower'][i % 3] }); coinArc(z, 60, 64, 1.3, 1.2, 3); if (g.hasType('enemy.slime')) g.spawn('enemy.slime', 69, 0, { patrol: [66, 71.5] }); // ═══ C. Barranco de los troncos (x 72..137) ═══ z.ground(72, 80, 0, { style: 'grass' }); // C1 · abismo (80..92): plataformas móviles; los espinos colgantes impiden flotar alto con burbujas z.platform(84, 1.4, 3, { style: 'grass', oneWay: true, move: { dy: 1.2, period: 3.4 } }); z.platform(89, 2.4, 3, { style: 'grass', oneWay: true, move: { dx: 1.6, period: 4.2 } }); z.block(86.5, 7.55, 10.5, 0.7, { style: 'wood' }); z.spawn('hazard.thorns', 86.5, 7.2, { w: 8.5, hang: true, h: 1.1 }); coinArc(z, 83, 90, 3.4, 1, 3); if (g.hasType('enemy.bee')) g.spawn('enemy.bee', 87, 4.6, { patrol: [83, 91] }); // C1b · SECRETO bajo el abismo: repisa de roca a 6,5 u por debajo del borde. Las monedas marcan el // camino hacia abajo; para volver a subir hacen falta BURBUJAS (saltar y soplar bajo los pies). z.platform(86, -6.5, 3.2, { style: 'stone', oneWay: false, float: false }); z.spawn('item.heartbox', 85.4, -6.5, { id: 'forest-abyss-heart' }); z.spawn('item.diamond', 86.9, -6.5, { id: 'forest-abyss-gem' }); for (const [x, y] of [[81.2, -1.4], [82.2, -2.8], [83.2, -4.2]] as const) z.spawn('item.coin', x, y); if (g.hasType('enemy.bat')) g.spawn('enemy.bat', 86, -3.6, { range: 4 }); z.ground(92, 104, 0, { style: 'grass' }); // C2 · acantilado: la base es tierra suelta → hay que cavar HACIA DELANTE para pasar por debajo. // La roca de arriba llega hasta y=12 y la cima tiene espinos: no se trepa ni con burbujas. z.block(101, 7.5, 6, 9, { style: 'grass' }); z.prop('pine', 101, 12, { z: -0.8, scale: 1.8 }); z.spawn('hazard.thorns', 101, 12, { w: 5.6, h: 0.9 }); const cliff = new DigGrid({ game: g, prefix: 'forest-cliff', x0: 98, y0: 0, cols: 6, rows: 3, top: 'none', rewards: [{ i: 2, j: 0, kind: 'coin', n: 3 }, { i: 4, j: 1, kind: 'coin', n: 3 }, { i: 5, j: 0, kind: 'diamond', id: 'forest-cliff-gem' }], }); grids.push(cliff); z.prop('sign', 95.5, 0, { text: '🪏 Tierra suelta', z: 0.5 }); // el suelo bajo el túnel: la rejilla se apoya sobre y=0 (el ground de 92..104 queda debajo) // C3 · tras el acantilado: robots y una cámara BAJO TIERRA (cavar hacia abajo) con tesoro z.ground(104, 108, 0, { style: 'grass' }); z.block(110, -1, 4, 2, { style: 'grass' }); // techo de la cámara (108..112) const under = new DigGrid({ game: g, prefix: 'forest-under', x0: 112, y0: -2, cols: 3, rows: 2, top: 'grass', rewards: [{ i: 1, j: 0, kind: 'coin', n: 2 }], }); grids.push(under); z.block(118, -1, 6, 2, { style: 'grass' }); // techo de la cámara (115..121) z.ground(108, 121, -4.5, { style: 'cave' }); // suelo de la cámara z.platform(113.5, -3, 1.6, { style: 'cave', oneWay: true, float: false }); // escalón bajo el agujero para volver a subir z.spawn('item.diamond', 119, -3.6, { id: 'forest-under-gem' }); coinArc(z, 108.8, 110.4, -3.7, 0.3, 3); coinArc(z, 116, 118, -3.7, 0.3, 3); z.prop('sign', 113.5, 0, { text: '🪏⬇️', z: 0.5 }); z.ground(121, 137, 0, { style: 'grass' }); if (g.hasType('enemy.robot')) g.spawn('enemy.robot', 107, 0, { patrol: [104, 125] }); if (g.hasType('enemy.mushroom')) g.spawn('enemy.mushroom', 116, -4.5, { patrol: [114.5, 120] }); // C4 · copa del gran árbol: cofre solo alcanzable encadenando burbujas (¡con la lluvia apagada!) z.prop('tree', 129, 0, { z: -1.6, scale: 3.2 }); z.platform(126.5, 5.2, 2.2, { style: 'grass', oneWay: true, float: false }); z.platform(130.5, 10.2, 3, { style: 'grass', oneWay: true, float: false }); z.spawn('item.chest', 130.5, 10.2, { id: 'forest-canopy', contains: 'diamond' }); coinArc(z, 126, 127, 6, 0.3, 2); z.spawn('item.checkpoint', 124, 0, { spawn: 'ravine' }); if (g.hasType('enemy.bee')) g.spawn('enemy.bee', 134, 3.6, { patrol: [128, 136] }); // ═══ D. Claro del Sabio (x 137..169) ═══ z.ground(137, 169, 0, { style: 'grass' }); z.prop('tree', 155, 0, { z: -3.5, scale: 4.5 }); z.prop('mushroom', 143, 0, { z: -1.7, scale: 1.4 }); z.prop('mushroom', 160, 0, { z: -1.2, scale: 1 }); z.spawn('npc.sage', 152, 0, { facing: -1 }); z.spawn('item.checkpoint', 147, 0, { spawn: 'sage' }); coinArc(z, 140, 144, 1.3, 1.4, 3); // D1 · SECRETO AÉREO: nubes altas sobre el claro, solo con burbujas (repisa a 6 u y nube a 12 u) z.platform(160.5, 6, 2.4, { style: 'cloud', oneWay: true, float: false }); z.platform(165, 12, 3.2, { style: 'cloud', oneWay: true, float: false }); z.spawn('item.chest', 164.2, 12, { id: 'forest-sky-cache', contains: 'coins:4' }); z.spawn('item.diamond', 165.9, 12, { id: 'forest-sky-gem' }); coinArc(z, 161.5, 164, 8, 2.2, 4); if (g.hasType('enemy.bee')) g.spawn('enemy.bee', 163, 3.4, { patrol: [159, 167] }); // ═══ E. Senda humeante (x 169..207) ═══ // E1 · poza seca (172..181): chorros de vapor en el fondo revientan las burbujas y queman. // Con LLUVIA la poza se llena, la balsa sube y el vapor se apaga. z.ground(169, 172, 0, { style: 'grass' }); z.ground(172, 183, -5, { style: 'sand' }); z.platform(173.2, -2.5, 1.6, { style: 'stone', oneWay: true, float: false }); // para salir si caes z.spawn('forest.pond', 177.5, 0, { floor: -5, surface: -0.3, w: 11, flag: 'forest.pond.crossing' }); for (const [x, off] of [[174.6, 0], [177.5, 0.9], [180.4, 1.8]] as const) { z.spawn('hazard.vent', x, -5, { h: 6.4, period: 2.6, offset: off, quench: 'forest.pond.crossing' }); } z.prop('sign', 170.5, 0, { text: '🌧️ ¿Y si lloviera?', z: 0.5 }); z.spawn('item.checkpoint', 170, 0, { spawn: 'steam' }); // E2 · colada de lava (191..200): la burbuja revienta con el calor → LLUVIA para enfriarla z.ground(183, 190, 0, { style: 'grass' }); coinArc(z, 184, 189, 1.3, 1.2, 3); if (g.hasType('enemy.slime')) g.spawn('enemy.slime', 186.5, 0, { patrol: [184, 189.5] }); const lava = z.water(190, 201, -0.3, 2.4, { lava: true, color: 0xff7a18, deep: 0x6e190c }); z.ground(190, 201, -2.7, { style: 'sand' }); const lavaHz = z.area('hazard', 195.5, -0.6, 11, 1.4, { visual: false, damage: 1, element: 'fire' }); z.spawn('forest.lava', 195.5, -0.3, { w: 11, flag: 'forest.lava.one', hazard: lavaHz, lava }); if (g.hasType('enemy.ember')) g.spawn('enemy.ember', 195.5, 0, { hover: 2.2 }); z.ground(201, 207, 0, { style: 'grass' }); z.prop('rock', 203, 0, { z: -1.4, scale: 1.3 }); // ═══ F. Bosque profundo (x 207..259) ═══ z.ground(207, 259, 0, { style: 'grass' }); // F1 · roca agrietada: solo la FURIA la rompe (no se puede saltar por encima). Dentro guarda un diamante y monedas. z.spawn('forest.rock', 210, 0, { w: 2.8, h: 6.2, flag: 'forest.rock.block', hp: 2, loot: 'diamond:forest-rock-gem,coins:3' }); z.prop('sign', 206, 0, { text: '😡 ¡Rómpela!', z: 0.5 }); // F2 · escarabajos acorazados: solo la FURIA los voltea if (g.hasType('enemy.beetle')) { g.spawn('enemy.beetle', 219, 0, { patrol: [214, 224] }); g.spawn('enemy.beetle', 242, 0, { patrol: [239.5, 244.5] }); } coinArc(z, 215, 225, 1.3, 1.6, 4); // F2b · SECRETO AÉREO: cofre en lo alto de los pinos (burbujas; ¡ojo con la lluvia!) z.platform(216, 5.8, 2.2, { style: 'grass', oneWay: true, float: false }); z.platform(221, 11, 3, { style: 'grass', oneWay: true, float: false }); z.spawn('item.chest', 221, 11, { id: 'forest-pine-cache', contains: 'coins:6' }); if (g.hasType('enemy.bee')) g.spawn('enemy.bee', 236, 4.2, { patrol: [231, 244] }); z.spawn('item.checkpoint', 229, 0, { spawn: 'deep' }); // F3 · puerta de las flores: dos flores que se abren con agua (pistola). Una a la vista; la otra en un // nicho de roca tapado por una piedra agrietada (FURIA para abrirlo, luego agua). z.spawn('forest.flower', 231.5, 0, { id: 'deep-a' }); z.block(235.75, 5.9, 5.5, 6.2, { style: 'grass' }); // techo del nicho (233..238.5, y 2.8..9) z.block(238.1, 1.4, 0.8, 2.8, { style: 'grass' }); // pared del fondo del nicho z.spawn('forest.rock', 233.6, 0, { w: 1.2, h: 2.8, flag: 'forest.rock.flower', hp: 2 }); z.spawn('forest.flower', 236, 0, { id: 'deep-b-hidden' }); z.spawn('puzzle.door', 246, 0, { id: 'deep-flowers', requires: 'forest.flower.deep-a,forest.flower.deep-b-hidden', w: 1.8, h: 6.4, style: 'wood', hint: '🌸' }); // F4 · ladera tras la puerta: se pasa por encima… o se cava un túnel (atajo con tesoro) HACIA DELANTE z.block(253.5, 3.5, 5, 3, { style: 'grass' }); const deepTunnel = new DigGrid({ game: g, prefix: 'forest-deep-tunnel', x0: 251, y0: 0, cols: 5, rows: 2, top: 'none', rewards: [{ i: 1, j: 0, kind: 'coin', n: 3 }, { i: 3, j: 1, kind: 'diamond', id: 'forest-tunnel-gem' }], }); grids.push(deepTunnel); // el paso principal sigue por encima de la ladera z.platform(249, 3, 2.2, { style: 'grass', oneWay: true }); // Secretos para la vuelta: paredón con cofre (trepa con bloques de HIELO + LLUVIA) y cristal COOL z.block(226.5, 4.5, 1.4, 9, { style: 'grass' }); z.platform(225, 9, 2.6, { style: 'grass', oneWay: true, float: false }); z.spawn('hazard.thorns', 226.5, 13.5, { w: 3, hang: true, h: 1 }); z.spawn('item.chest', 225, 9, { id: 'forest-wall-cache', contains: 'diamond' }); z.spawn('forest.cool', 212.8, 0, { id: 'still-platform', group: 'deep' }); // ═══ G. Santuario de la Elfa (x 259..310) ═══ // G0 · SECRETO BAJO TIERRA: un parche de hierba algo más claro (264..268) es tierra blanda. Cavando HACIA ABAJO // se cae a una gruta con un CONTENEDOR DE CORAZÓN. Para salir: escalón y doble salto. z.ground(259, 262, 0, { style: 'grass' }); z.block(263, -1, 2, 2, { style: 'grass' }); // techo de la gruta (262..264) grids.push(new DigGrid({ game: g, prefix: 'forest-elf-grotto', x0: 264, y0: -2, cols: 4, rows: 2, top: 'grass', rewards: [{ i: 2, j: 0, kind: 'coin', n: 2 }], })); z.block(270, -1, 4, 2, { style: 'grass' }); // techo de la gruta (268..272) z.ground(262, 272, -5.5, { style: 'cave' }); // suelo de la gruta z.platform(266, -3.5, 1.8, { style: 'cave', oneWay: true, float: false }); // escalón para volver a subir z.spawn('item.heartbox', 270.6, -5.5, { id: 'forest-grotto-heart' }); coinArc(z, 262.8, 264.6, -4.8, 0.3, 3); z.ground(272, 310, 0, { style: 'grass' }); z.prop('tree', 272, 0, { z: -3.4, scale: 4 }); z.prop('crystal', 269, 0, { z: -2.4, color: 0x2fa8f5, scale: 1.7 }); z.spawn('npc.elf', 285, 0, { facing: -1 }); z.spawn('item.checkpoint', 279, 0, { spawn: 'elf' }); if (g.hasType('enemy.mushroom')) g.spawn('enemy.mushroom', 276, 0, { patrol: [273, 280] }); if (g.hasType('enemy.slime')) g.spawn('enemy.slime', 265, -5.5, { patrol: [263, 269] }); if (g.hasType('enemy.bat')) g.spawn('enemy.bat', 292, 5.4, { range: 5 }); // G1 · matorral espinoso: solo el FUEGO lo quema z.spawn('hazard.thorns', 296, 0, { w: 2.6, h: 6.6, wall: true, flag: 'forest.thorns.sanctuary' }); // G2 · portón de las antorchas: tres antorchas y un brasero alto (la bola de fuego rebota) for (const x of [299.5, 302, 304.5]) z.spawn('forest.torch', x, 0, { id: `sanct-${x}` }); z.spawn('forest.fireswitch', 302, 4.2, { id: 'sanct-high' }); z.platform(302, 3.6, 1.6, { style: 'grass', oneWay: false, float: false }); z.spawn('puzzle.door', 307.5, 0, { id: 'sanct-gate', w: 1.8, h: 6.4, style: 'wood', hint: '🔥', requires: 'forest.torch.sanct-299.5,forest.torch.sanct-302,forest.torch.sanct-304.5,forest.fireswitch.sanct-high', }); // ═══ H. Muralla y puerta del castillo (x 310..356) ═══ z.ground(310, 356, 0, { style: 'castle' }); z.prop('rock', 319, 0, { z: -2.7, scale: 4.5, color: 0x5b76b8 }); z.prop('rock', 350, 0, { z: -2.8, scale: 4.6, color: 0x526ba8 }); // fachada (detrás del plano de juego) con dos torres y almenas // (decorado: sin colisión) const deco = (x: number, y: number, w: number, h: number, zb: number, zf: number) => { const c = z.block(x, y, w, h, { style: 'castle', zBack: zb, zFront: zf }); c.enabled = false; }; deco(337, 7, 24, 14, -3.2, -1.2); deco(326.5, 9.5, 4.2, 19, -2.8, -0.6); deco(347.5, 9.5, 4.2, 19, -2.8, -0.6); for (let x = 328.5; x < 346; x += 2.2) deco(x, 14.6, 1.1, 1.2, -3, -1.4); for (const x of [325, 328, 346, 349]) deco(x, 19.6, 1.2, 1.2, -2.6, -0.8); z.block(337, 9.5, 6.4, 9, { style: 'castle' }); // dintel del portalón (no se salta por encima) z.spawn('forest.gate', 337, 0, { w: 5, h: 5.2, flag: 'castle.gate', impacts: 4 }); z.spawn('item.teleporter', 327, 0, { id: 'castle', name: 'Puerta del Castillo' }); z.spawn('item.checkpoint', 324, 0, { spawn: 'gate' }); z.exit(337, 1.5, 1.8, 3, 'castle-lava', 'from-gate', { door: true, arrow: 'up', emoji: '🏰' }); coinArc(z, 314, 322, 1.3, 1.8, 4); if (g.hasType('enemy.robot')) g.spawn('enemy.robot', 316, 0, { patrol: [311, 321] }); z.spawn('item.heart', 163, 0.3); z.spawn('item.heart', 290, 0.3); k.scatter('pine', -5, 355, 0, 36, { z: -4.5, zJitter: 1.3, scale: 1.5 }); k.scatter('grassTuft', 1, 355, 0, 40, { z: 1.1, zJitter: 0.3 }); }, onEnter(game: Game) { offDig?.(); offDig = wireDig(game, grids); vfxAmbient(game, 'leaves', { density: 0.26, color: 0xffd56a, windX: 0.12 }); game.events.emit('map:poi', { zone: 'forest', x: 43, y: 1, emoji: '🌾', id: 'anna-farm' }); game.events.emit('map:poi', { zone: 'forest', x: 152, y: 2, emoji: '🧙', id: 'forest-sage' }); game.events.emit('map:poi', { zone: 'forest', x: 285, y: 1, emoji: '🧝‍♀️', id: 'forest-elf' }); game.events.emit('map:poi', { zone: 'forest', x: 337, y: 2, emoji: '🏰', id: 'castle-gate' }); game.state.set('forest.entered', true); }, update(game) { if (game.state.has('castle.gate') && !game.entities.some((e) => !e.dead && (e as { npcId?: string }).npcId === 'cold-king')) { if (game.hasType('npc.coldking')) game.spawn('npc.coldking', 331, 0, {}); } if (!game.state.has('anna.watered') && Array.from({ length: 9 }, (_, i) => game.state.has(`forest.farm.${i}`)).every(Boolean)) { game.state.set('anna.watered', true); game.state.save(); game.ui.toast('¡El huerto entero ha bebido! Vuelve con Anna.', '🌱'); } }, onExit(game) { offDig?.(); offDig = null; vfxAmbient(game, null); }, };