Spaces:
Running
Running
Deploy wispmarch
Browse files- core.js +5 -3
- fun.css +2 -0
- funpass.js +106 -29
- game.js +34 -13
- index.html +5 -5
- levels.js +36 -0
- offer.js +2 -0
- sw.js +2 -2
core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
// Wispmarch core: pure, deterministic rules (weapons, passives, meta shop, daily modifiers, save data).
|
| 2 |
// No DOM here, so node --test can check it. (c) 2026 CyberMax. All rights reserved.
|
| 3 |
import { hash, rng, dayNumber } from './cmx.js';
|
| 4 |
-
import { loadProg, defaultProg, loadStreak, defaultStreak, NIGHTS } from './levels.js';
|
| 5 |
|
| 6 |
export const GAME = 'wispmarch';
|
| 7 |
export const SAVE_KEY = 'wispmarch:save';
|
|
@@ -124,9 +124,9 @@ export function embersFor(run) {
|
|
| 124 |
}
|
| 125 |
|
| 126 |
// ---------------------------------------------------------------- save
|
| 127 |
-
export const MODES = ['nights', 'daily', 'standard', 'endless'];
|
| 128 |
export function defaultSave() {
|
| 129 |
-
return { v: 2, embers: 0, up: {}, unlocked: [], stats: { runs: 0, kills: 0, bestTime: 0, bestLevel: 0, wins: 0 }, daily: { iso: '', best: 0, tries: 0 }, wisp: 'pip', weapon: '', skin: 'lantern', mode: 'nights', mouse: false, nights: defaultProg(), streak: defaultStreak(), night: 1 };
|
| 130 |
}
|
| 131 |
export function loadSave(raw) {
|
| 132 |
const d = defaultSave();
|
|
@@ -146,6 +146,8 @@ export function loadSave(raw) {
|
|
| 146 |
d.nights = loadProg(raw.nights);
|
| 147 |
d.streak = loadStreak(raw.streak);
|
| 148 |
if (Number.isInteger(raw.night) && raw.night >= 1 && raw.night <= NIGHTS.length) d.night = raw.night;
|
|
|
|
|
|
|
| 149 |
return d;
|
| 150 |
}
|
| 151 |
export const wispUnlocked = (save, w) => !w.unlock || save.unlocked.includes(w.unlock);
|
|
|
|
| 1 |
// Wispmarch core: pure, deterministic rules (weapons, passives, meta shop, daily modifiers, save data).
|
| 2 |
// No DOM here, so node --test can check it. (c) 2026 CyberMax. All rights reserved.
|
| 3 |
import { hash, rng, dayNumber } from './cmx.js';
|
| 4 |
+
import { loadProg, defaultProg, loadStreak, defaultStreak, NIGHTS, loadTrials } from './levels.js';
|
| 5 |
|
| 6 |
export const GAME = 'wispmarch';
|
| 7 |
export const SAVE_KEY = 'wispmarch:save';
|
|
|
|
| 124 |
}
|
| 125 |
|
| 126 |
// ---------------------------------------------------------------- save
|
| 127 |
+
export const MODES = ['nights', 'trials', 'daily', 'standard', 'endless'];
|
| 128 |
export function defaultSave() {
|
| 129 |
+
return { v: 2, embers: 0, up: {}, unlocked: [], stats: { runs: 0, kills: 0, bestTime: 0, bestLevel: 0, wins: 0 }, daily: { iso: '', best: 0, tries: 0 }, wisp: 'pip', weapon: '', skin: 'lantern', mode: 'nights', mouse: false, nights: defaultProg(), streak: defaultStreak(), night: 1, trials: {}, trialDay: '' };
|
| 130 |
}
|
| 131 |
export function loadSave(raw) {
|
| 132 |
const d = defaultSave();
|
|
|
|
| 146 |
d.nights = loadProg(raw.nights);
|
| 147 |
d.streak = loadStreak(raw.streak);
|
| 148 |
if (Number.isInteger(raw.night) && raw.night >= 1 && raw.night <= NIGHTS.length) d.night = raw.night;
|
| 149 |
+
d.trials = loadTrials(raw.trials);
|
| 150 |
+
if (typeof raw.trialDay === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(raw.trialDay)) d.trialDay = raw.trialDay;
|
| 151 |
return d;
|
| 152 |
}
|
| 153 |
export const wispUnlocked = (save, w) => !w.unlock || save.unlocked.includes(w.unlock);
|
fun.css
CHANGED
|
@@ -50,3 +50,5 @@ dialog.funpass::backdrop{background:rgba(10,12,18,.55)}
|
|
| 50 |
@media (max-width:560px){.chips{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -16px;padding:2px 16px 4px}.chips::-webkit-scrollbar{display:none}.chip{flex:0 0 auto}}
|
| 51 |
@media (min-width:760px){dialog.funpass{max-width:720px}.fp-perks{columns:2;column-gap:28px}}
|
| 52 |
.fp-after{margin:14px 0 0;padding:12px 14px;border:1px solid var(--line, rgba(127,127,127,.35));border-radius:14px;text-align:left}.fp-after p{margin:0 0 8px}.fp-after .fp-row{display:flex;gap:8px;flex-wrap:wrap}
|
|
|
|
|
|
|
|
|
| 50 |
@media (max-width:560px){.chips{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -16px;padding:2px 16px 4px}.chips::-webkit-scrollbar{display:none}.chip{flex:0 0 auto}}
|
| 51 |
@media (min-width:760px){dialog.funpass{max-width:720px}.fp-perks{columns:2;column-gap:28px}}
|
| 52 |
.fp-after{margin:14px 0 0;padding:12px 14px;border:1px solid var(--line, rgba(127,127,127,.35));border-radius:14px;text-align:left}.fp-after p{margin:0 0 8px}.fp-after .fp-row{display:flex;gap:8px;flex-wrap:wrap}
|
| 53 |
+
.fp-game{border-color:var(--acc);display:grid;grid-template-columns:1fr auto;align-items:center;text-align:left;gap:2px 12px;padding:14px 14px 12px;margin:0 0 6px}.fp-game b{font-size:16px}.fp-game .fp-price{grid-row:span 2}.fp-game .fp-note{grid-column:1}
|
| 54 |
+
.fp-or{margin:12px 0 8px;font-size:14px}
|
funpass.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
| 1 |
-
// CyberMax
|
| 2 |
-
//
|
| 3 |
-
//
|
| 4 |
-
//
|
| 5 |
-
//
|
| 6 |
-
// the
|
| 7 |
-
//
|
| 8 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import { count, store, toast } from './cmx.js';
|
|
|
|
|
|
|
| 10 |
|
| 11 |
const DATA = 'https://data.cybermaxtools.com';
|
| 12 |
const KEY = 'cmx-pro:fun-pass';
|
|
@@ -17,27 +24,52 @@ export const PLANS = [
|
|
| 17 |
{ id: 'yearly', label: 'Yearly', price: '$19', per: '/year', note: 'Save 47%', best: true },
|
| 18 |
{ id: 'unlock', label: 'Lifetime', price: '$29.99', per: ' once', note: 'Pay once, keep forever' },
|
| 19 |
];
|
| 20 |
-
export const COMMON_PERKS = ['
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
let state = store(KEY);
|
|
|
|
| 23 |
const listeners = [];
|
| 24 |
let cfg = { game: 'games', name: 'CyberMax games', perks: [] };
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
export function onChange(fn) { listeners.push(fn); fn(isPro()); }
|
| 28 |
function emit() {
|
| 29 |
document.documentElement.classList.toggle('cmx-pro', isPro());
|
| 30 |
listeners.forEach((fn) => { try { fn(isPro()); } catch { /* game hook */ } });
|
| 31 |
}
|
| 32 |
|
| 33 |
-
async function check(code) {
|
| 34 |
try {
|
| 35 |
-
const r = await fetch(`${DATA}/unlock/
|
| 36 |
const j = await r.json();
|
| 37 |
return j && typeof j.pro === 'boolean' ? j.pro : null;
|
| 38 |
} catch { return null; }
|
| 39 |
}
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
export async function unlock(code) {
|
| 42 |
const ok = await check(code);
|
| 43 |
if (ok) {
|
|
@@ -46,7 +78,10 @@ export async function unlock(code) {
|
|
| 46 |
toast('Fun Pass is on. Thank you for supporting CyberMax games!', 3500);
|
| 47 |
emit();
|
| 48 |
render();
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
else toast('Could not reach the pass check. Try again in a minute.', 3500);
|
| 51 |
return ok;
|
| 52 |
}
|
|
@@ -60,6 +95,8 @@ async function recheck() {
|
|
| 60 |
|
| 61 |
const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
| 62 |
const buyUrl = (plan) => `${DATA}/buy/st-fun-pass-${plan}?s=game-${cfg.game}`;
|
|
|
|
|
|
|
| 63 |
|
| 64 |
function dialog() {
|
| 65 |
let d = document.getElementById('funpass');
|
|
@@ -73,28 +110,59 @@ function dialog() {
|
|
| 73 |
return d;
|
| 74 |
}
|
| 75 |
|
|
|
|
|
|
|
|
|
|
| 76 |
function render() {
|
| 77 |
const d = dialog();
|
| 78 |
const perks = [...(cfg.perks || []), ...COMMON_PERKS.filter((p) => !(cfg.perks || []).some((q) => q.split(' ')[0] === p.split(' ')[0]))].slice(0, 6);
|
| 79 |
if (isPro()) {
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
return;
|
| 85 |
}
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
<h2>One pass. Every game. More to play.</h2>
|
| 88 |
<ul class="fp-perks">${perks.map((p) => `<li>${esc(p)}</li>`).join('')}</ul>
|
| 89 |
-
<div class="fp-plans">${
|
| 90 |
-
<p class="fp-small">Secure Stripe checkout. Works in every CyberMax game. The
|
| 91 |
-
<
|
| 92 |
d.querySelector('.fp-form').addEventListener('submit', (e) => {
|
| 93 |
e.preventDefault();
|
| 94 |
const c = e.target.querySelector('input').value.trim();
|
| 95 |
if (SID.test(c)) unlock(c); else toast('Paste the code from your receipt page (cs_live_…) or your Gumroad licence key.', 3500);
|
| 96 |
});
|
| 97 |
d.querySelectorAll('[data-plan]').forEach((a) => a.addEventListener('click', () => count(cfg.game, 'cta', `pass-${a.dataset.plan}`)));
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
/** Open the pass sheet; `from` names the button that opened it (counted as cta). */
|
|
@@ -110,15 +178,20 @@ export function open(from = 'button') {
|
|
| 110 |
* `host` is the result panel; the card is added once and removed for pass holders. */
|
| 111 |
export function afterWin(host, from = 'win') {
|
| 112 |
if (!host) return;
|
| 113 |
-
if (isPro()) { host.querySelector('.fp-after')?.remove(); return; }
|
| 114 |
let el = host.querySelector('.fp-after');
|
| 115 |
if (!el) { el = document.createElement('div'); el.className = 'fp-after'; host.appendChild(el); }
|
| 116 |
const best = PLANS.find((p) => p.best) || PLANS[0];
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
<div class="fp-cap"></div>`;
|
| 121 |
-
el.querySelector('[data-after]').addEventListener('click', () => { count(cfg.game, 'cta', `pass-${best.id}-after`); kit((K) => K.event('upgrade-click', cfg.game)); });
|
| 122 |
el.querySelector('[data-plans]').addEventListener('click', () => open(`after-${from}`));
|
| 123 |
kit((K) => {
|
| 124 |
K.event('result', cfg.game); K.event('upgrade-view', cfg.game);
|
|
@@ -138,13 +211,17 @@ function kit(fn) {
|
|
| 138 |
document.head.appendChild(sc);
|
| 139 |
}
|
| 140 |
|
| 141 |
-
/** Call once per page: game id, display name and the game's own
|
|
|
|
| 142 |
export function init(options) {
|
| 143 |
cfg = { ...cfg, ...options };
|
| 144 |
const m = /[#&]cmx-pro=([^&]+)/.exec(location.hash || '');
|
| 145 |
if (m && SID.test(decodeURIComponent(m[1]))) {
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
| 148 |
} else recheck();
|
| 149 |
emit();
|
| 150 |
}
|
|
|
|
| 1 |
+
// CyberMax games checkout: the per-game "full game" unlock + the Fun Pass (every game), copied into each game's web/ folder.
|
| 2 |
+
// Model (games lane GM, 9 Oct 2026; evidence docs/ceo/games-monetization-2026-10-09.md):
|
| 3 |
+
// - Free demo: every game's daily challenge stays free for everyone, plus the first levels (OFFER.demo once the per-game
|
| 4 |
+
// unlock is live; levels 1-20 until then). A level the player has opened is never locked again.
|
| 5 |
+
// - Full game: ONE payment per game (OFFER.price, Stripe pack revenue/packs/stripe/<game>-full) unlocks every level,
|
| 6 |
+
// mode, the daily archive and themes in that game, for good. Shown only when OFFER.live is true (owner-approved).
|
| 7 |
+
// - Fun Pass = the all-games bundle: Monthly $2.99 · Yearly $19 · Lifetime $29.99 (pack revenue/packs/stripe/fun-pass).
|
| 8 |
+
// - Portal builds (scripts/games/portals.py) never show a checkout; where the portal SDK offers rewarded ads, the player
|
| 9 |
+
// may watch one to open the full game for an hour (shared/portal-adapter/cmx-portal.js CMXPortal.rewarded()).
|
| 10 |
+
// Buy: counted redirect https://data.cybermaxtools.com/buy/st-<pack>-<plan>?s=game-<id> -> Stripe checkout.
|
| 11 |
+
// After checkout the data Worker (/unlock/fun-pass or /unlock/<game>-full) checks the Checkout Session and returns with
|
| 12 |
+
// #cmx-pro=<code> (the full-game return adds ?unlock=full). The code on the receipt page unlocks any other device.
|
| 13 |
+
// No account, no cookies, nothing personal stored. (c) 2026 CyberMax. All rights reserved.
|
| 14 |
import { count, store, toast } from './cmx.js';
|
| 15 |
+
import { OFFER } from './offer.js'; // written by scripts/games/sync_kit.py from products/fun-pass/games.json
|
| 16 |
+
export { OFFER };
|
| 17 |
|
| 18 |
const DATA = 'https://data.cybermaxtools.com';
|
| 19 |
const KEY = 'cmx-pro:fun-pass';
|
|
|
|
| 24 |
{ id: 'yearly', label: 'Yearly', price: '$19', per: '/year', note: 'Save 47%', best: true },
|
| 25 |
{ id: 'unlock', label: 'Lifetime', price: '$29.99', per: ' once', note: 'Pay once, keep forever' },
|
| 26 |
];
|
| 27 |
+
export const COMMON_PERKS = ['Every level and mode in every CyberMax game', 'The full archive of past dailies', 'Custom colour themes', 'New games included as they launch'];
|
| 28 |
+
const FULL_KEY = `cmx-full:${OFFER.game}`;
|
| 29 |
+
const REWARD_KEY = `cmx-reward:${OFFER.game}`;
|
| 30 |
+
const REWARD_MS = 60 * 60 * 1000; // one rewarded ad on a portal build opens the full game for an hour
|
| 31 |
|
| 32 |
let state = store(KEY);
|
| 33 |
+
let full = store(FULL_KEY);
|
| 34 |
const listeners = [];
|
| 35 |
let cfg = { game: 'games', name: 'CyberMax games', perks: [] };
|
| 36 |
|
| 37 |
+
const passOn = () => !!(state && state.code);
|
| 38 |
+
export const ownsGame = () => !!(full && full.code);
|
| 39 |
+
const rewardOn = () => { const r = store(REWARD_KEY); return !!(r && Date.now() - r.at < REWARD_MS); };
|
| 40 |
+
/** True when this player may use everything in this game: Fun Pass, this game's full unlock, or a portal reward hour. */
|
| 41 |
+
export const isPro = () => passOn() || ownsGame() || rewardOn();
|
| 42 |
+
/** Free levels in this game's demo: OFFER.demo once the per-game unlock is live, else the game's current number. */
|
| 43 |
+
export const freeLevels = (current = 20) => (OFFER.live && OFFER.demo ? Math.min(current, OFFER.demo) : current);
|
| 44 |
+
const portal = () => (typeof window !== 'undefined' && window.CMXPortal && window.CMXPortal.portal) || '';
|
| 45 |
export function onChange(fn) { listeners.push(fn); fn(isPro()); }
|
| 46 |
function emit() {
|
| 47 |
document.documentElement.classList.toggle('cmx-pro', isPro());
|
| 48 |
listeners.forEach((fn) => { try { fn(isPro()); } catch { /* game hook */ } });
|
| 49 |
}
|
| 50 |
|
| 51 |
+
async function check(code, what = 'fun-pass') {
|
| 52 |
try {
|
| 53 |
+
const r = await fetch(`${DATA}/unlock/${what}?json=1&session_id=${encodeURIComponent(code)}`);
|
| 54 |
const j = await r.json();
|
| 55 |
return j && typeof j.pro === 'boolean' ? j.pro : null;
|
| 56 |
} catch { return null; }
|
| 57 |
}
|
| 58 |
|
| 59 |
+
/** Turn on a full-game code for this game (receipt code of the <game>-full Payment Link). */
|
| 60 |
+
export async function unlockGame(code) {
|
| 61 |
+
const ok = await check(code, `${OFFER.game}-full`);
|
| 62 |
+
if (ok) {
|
| 63 |
+
full = store(FULL_KEY, { code, at: new Date().toISOString() });
|
| 64 |
+
count(cfg.game, 'pro', 'full-unlocked');
|
| 65 |
+
toast(`${OFFER.name}: the full game is on. Thank you for supporting CyberMax games!`, 3500);
|
| 66 |
+
emit(); render();
|
| 67 |
+
} else if (ok === false) toast('That code is not a full-game order for this game.', 3500);
|
| 68 |
+
else toast('Could not reach the unlock check. Try again in a minute.', 3500);
|
| 69 |
+
return ok;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/** Turn on a pasted or returned code: a Fun Pass code, or (where this game sells its own unlock) a full-game code. */
|
| 73 |
export async function unlock(code) {
|
| 74 |
const ok = await check(code);
|
| 75 |
if (ok) {
|
|
|
|
| 78 |
toast('Fun Pass is on. Thank you for supporting CyberMax games!', 3500);
|
| 79 |
emit();
|
| 80 |
render();
|
| 81 |
+
return ok;
|
| 82 |
+
}
|
| 83 |
+
if (sellsGame() && (await check(code, `${OFFER.game}-full`))) return unlockGame(code);
|
| 84 |
+
if (ok === false) toast('That code is not an active Fun Pass.', 3500);
|
| 85 |
else toast('Could not reach the pass check. Try again in a minute.', 3500);
|
| 86 |
return ok;
|
| 87 |
}
|
|
|
|
| 95 |
|
| 96 |
const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
| 97 |
const buyUrl = (plan) => `${DATA}/buy/st-fun-pass-${plan}?s=game-${cfg.game}`;
|
| 98 |
+
const gameUrl = (from = '') => `${DATA}/buy/st-${OFFER.game}-full-unlock?s=game-${cfg.game}${from ? `-${from}` : ''}`;
|
| 99 |
+
const sellsGame = () => !!(OFFER.live && OFFER.price && OFFER.game !== 'games');
|
| 100 |
|
| 101 |
function dialog() {
|
| 102 |
let d = document.getElementById('funpass');
|
|
|
|
| 110 |
return d;
|
| 111 |
}
|
| 112 |
|
| 113 |
+
const planHtml = () => PLANS.map((p) => `<a class="fp-plan${p.best ? ' best' : ''}" href="${buyUrl(p.id)}" rel="nofollow" data-plan="${p.id}">${p.best ? '<i>Best value</i>' : ''}<b>${p.label}</b><span class="fp-price">${p.price}<small>${p.per}</small></span><span class="fp-note">${p.note}</span></a>`).join('');
|
| 114 |
+
const codeForm = `<details><summary>Already bought?</summary><form class="fp-form"><input aria-label="Order code" autocomplete="off" placeholder="Receipt code (cs_live_…) or Gumroad licence key"><button class="btn sm" type="submit">Turn on</button></form></details>`;
|
| 115 |
+
|
| 116 |
function render() {
|
| 117 |
const d = dialog();
|
| 118 |
const perks = [...(cfg.perks || []), ...COMMON_PERKS.filter((p) => !(cfg.perks || []).some((q) => q.split(' ')[0] === p.split(' ')[0]))].slice(0, 6);
|
| 119 |
if (isPro()) {
|
| 120 |
+
const what = passOn() ? 'The Fun Pass is on in this browser for every CyberMax game' : ownsGame() ? `You own the full ${esc(OFFER.name)}` : 'The full game is open for the next hour (rewarded ad)';
|
| 121 |
+
const code = passOn() ? state.code : ownsGame() ? full.code : '';
|
| 122 |
+
d.innerHTML = `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">${passOn() ? 'CyberMax Fun Pass' : esc(OFFER.name)}</p><h2>Everything is open. Thank you!</h2>
|
| 123 |
+
<p>${what}: ${perks.map(esc).join(' · ')}.</p>
|
| 124 |
+
${code ? `<p class="fp-small">Your code (paste it on another device to turn it on there):</p><code class="fp-code">${esc(code)}</code>` : ''}
|
| 125 |
+
${passOn() ? '<p class="fp-small">Manage or cancel a subscription any time from the link in your Stripe receipt email.</p>' : ''}</div>`;
|
| 126 |
+
return;
|
| 127 |
+
}
|
| 128 |
+
if (portal()) { // portal build: no outside checkout; a rewarded ad (when the portal offers one) opens the game for an hour
|
| 129 |
+
d.innerHTML = `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">${esc(OFFER.name || 'Full game')}</p>
|
| 130 |
+
<h2>Open the full game for an hour</h2><ul class="fp-perks">${perks.slice(0, 4).map((p) => `<li>${esc(p)}</li>`).join('')}</ul>
|
| 131 |
+
<p><button class="btn" type="button" data-reward>▶ Watch a short ad</button></p>
|
| 132 |
+
<p class="fp-small">Optional. The daily challenge and the free levels stay free without ads.</p></div>`;
|
| 133 |
+
d.querySelector('[data-reward]').addEventListener('click', async () => {
|
| 134 |
+
count(cfg.game, 'cta', 'reward-ad');
|
| 135 |
+
const ok = await window.CMXPortal.rewarded().catch(() => false);
|
| 136 |
+
if (ok) { store(REWARD_KEY, { at: Date.now() }); count(cfg.game, 'pro', 'reward-hour'); toast('Everything is open for the next hour. Have fun!', 3000); emit(); d.close(); }
|
| 137 |
+
else toast('No ad is available right now. Try again later.', 3000);
|
| 138 |
+
});
|
| 139 |
return;
|
| 140 |
}
|
| 141 |
+
const allGames = `${OFFER.games || 'every'} CyberMax games`;
|
| 142 |
+
const own = cfg.perks || [];
|
| 143 |
+
const gamePerks = [...own, ...(own.some((p) => /archive/i.test(p)) ? [] : ['The full archive of past dailies']), 'Every bonus mode in this game'].slice(0, 6);
|
| 144 |
+
d.innerHTML = sellsGame()
|
| 145 |
+
? `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">${esc(OFFER.name)} · full game</p>
|
| 146 |
+
<h2>Unlock the full ${esc(OFFER.name)}</h2>
|
| 147 |
+
<ul class="fp-perks">${gamePerks.map((p) => `<li>${esc(p)}</li>`).join('')}</ul>
|
| 148 |
+
<a class="fp-plan fp-game" href="${gameUrl()}" rel="nofollow" data-game><i>This game</i><b>Full ${esc(OFFER.name)}</b><span class="fp-price">${esc(OFFER.price)}<small> once</small></span><span class="fp-note">Pay once, keep it forever. No subscription.</span></a>
|
| 149 |
+
<p class="fp-or"><b>Or get all ${esc(allGames)}</b> with the Fun Pass:</p>
|
| 150 |
+
<div class="fp-plans">${planHtml()}</div>
|
| 151 |
+
<p class="fp-small">Secure Stripe checkout · turns on as soon as you pay · your code works on any device · 14-day promise: if it doesn't work as described, we fix it or refund you. The daily challenge and the first ${OFFER.demo || ''} levels stay free for everyone.</p>
|
| 152 |
+
${codeForm}</div>`
|
| 153 |
+
: `<div class="fp"><button class="fp-x" data-close aria-label="Close">×</button><p class="fp-kick">CyberMax Fun Pass</p>
|
| 154 |
<h2>One pass. Every game. More to play.</h2>
|
| 155 |
<ul class="fp-perks">${perks.map((p) => `<li>${esc(p)}</li>`).join('')}</ul>
|
| 156 |
+
<div class="fp-plans">${planHtml()}</div>
|
| 157 |
+
<p class="fp-small">Secure Stripe checkout. Works in every CyberMax game. The daily challenges and the free levels stay free for everyone.</p>
|
| 158 |
+
${codeForm}</div>`;
|
| 159 |
d.querySelector('.fp-form').addEventListener('submit', (e) => {
|
| 160 |
e.preventDefault();
|
| 161 |
const c = e.target.querySelector('input').value.trim();
|
| 162 |
if (SID.test(c)) unlock(c); else toast('Paste the code from your receipt page (cs_live_…) or your Gumroad licence key.', 3500);
|
| 163 |
});
|
| 164 |
d.querySelectorAll('[data-plan]').forEach((a) => a.addEventListener('click', () => count(cfg.game, 'cta', `pass-${a.dataset.plan}`)));
|
| 165 |
+
d.querySelector('[data-game]')?.addEventListener('click', () => count(cfg.game, 'cta', 'full-game'));
|
| 166 |
}
|
| 167 |
|
| 168 |
/** Open the pass sheet; `from` names the button that opened it (counted as cta). */
|
|
|
|
| 178 |
* `host` is the result panel; the card is added once and removed for pass holders. */
|
| 179 |
export function afterWin(host, from = 'win') {
|
| 180 |
if (!host) return;
|
| 181 |
+
if (isPro() || portal()) { host.querySelector('.fp-after')?.remove(); return; }
|
| 182 |
let el = host.querySelector('.fp-after');
|
| 183 |
if (!el) { el = document.createElement('div'); el.className = 'fp-after'; host.appendChild(el); }
|
| 184 |
const best = PLANS.find((p) => p.best) || PLANS[0];
|
| 185 |
+
const game = sellsGame();
|
| 186 |
+
const href = game ? gameUrl('after') : `${buyUrl(best.id)}-after`;
|
| 187 |
+
const label = game ? `Get the full ${OFFER.name}: ${OFFER.price} once` : `Get the Fun Pass: ${best.price}${best.per}`;
|
| 188 |
+
const line = game ? (cfg.extra || `The full game opens every level, mode, the daily archive and themes in ${OFFER.name}.`)
|
| 189 |
+
: (cfg.extra || 'The Fun Pass opens every level, mode, the full archive and themes in every CyberMax game.');
|
| 190 |
+
el.innerHTML = `<p><b>Want more today?</b> ${esc(line)}</p>
|
| 191 |
+
<p class="fp-row"><a class="btn sm" href="${href}" rel="nofollow" data-after>${esc(label)}</a> <button class="btn sm ghost" type="button" data-plans>${game ? 'All games pass' : 'See all plans'}</button></p>
|
| 192 |
+
<p class="fp-small">Secure Stripe checkout · turns on as soon as you pay · ${game ? 'one payment, no subscription' : 'cancel any time from your receipt email'} · 14-day promise: if it doesn't work as described, we fix it or refund you (<a href="https://cybermaxtools.com/terms#payments" target="_blank" rel="noopener">terms</a>). Today's daily challenge stays free.</p>
|
| 193 |
<div class="fp-cap"></div>`;
|
| 194 |
+
el.querySelector('[data-after]').addEventListener('click', () => { count(cfg.game, 'cta', game ? 'full-game-after' : `pass-${best.id}-after`); kit((K) => K.event('upgrade-click', cfg.game)); });
|
| 195 |
el.querySelector('[data-plans]').addEventListener('click', () => open(`after-${from}`));
|
| 196 |
kit((K) => {
|
| 197 |
K.event('result', cfg.game); K.event('upgrade-view', cfg.game);
|
|
|
|
| 211 |
document.head.appendChild(sc);
|
| 212 |
}
|
| 213 |
|
| 214 |
+
/** Call once per page: game id, display name and the game's own perks (listed first). Reads #cmx-pro=<code> after
|
| 215 |
+
* checkout (?unlock=full marks this game's full-game return). Skin-pack codes are taken first by skins.js capture(). */
|
| 216 |
export function init(options) {
|
| 217 |
cfg = { ...cfg, ...options };
|
| 218 |
const m = /[#&]cmx-pro=([^&]+)/.exec(location.hash || '');
|
| 219 |
if (m && SID.test(decodeURIComponent(m[1]))) {
|
| 220 |
+
const q = new URLSearchParams(location.search);
|
| 221 |
+
const fullReturn = q.get('unlock') === 'full';
|
| 222 |
+
q.delete('unlock');
|
| 223 |
+
history.replaceState(null, '', location.pathname + (q.toString() ? `?${q}` : ''));
|
| 224 |
+
if (fullReturn) unlockGame(decodeURIComponent(m[1])); else unlock(decodeURIComponent(m[1]));
|
| 225 |
} else recheck();
|
| 226 |
emit();
|
| 227 |
}
|
game.js
CHANGED
|
@@ -13,12 +13,14 @@ const STEP = 1 / 60, TAU = Math.PI * 2;
|
|
| 13 |
const REDUCED = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
| 14 |
const TOUCH = matchMedia('(pointer: coarse)').matches || 'ontouchstart' in window;
|
| 15 |
|
| 16 |
-
pass.init({ game: GAME, name: 'Wispmarch', perks: [`Nights ${L.FREE_NIGHTS + 1}-${L.NIGHTS.length}: ${L.NIGHTS.length - L.FREE_NIGHTS} bonus hand-made nights`, '3 wisp skins: Aurora, Ember Rose, Frostlight', 'Endless Night mode: no dawn, scaling forever'] });
|
| 17 |
themeToggle($('theme'));
|
| 18 |
const install = pwa(GAME, $('install'));
|
| 19 |
|
| 20 |
let save = C.loadSave(store(C.SAVE_KEY));
|
| 21 |
const persist = () => store(C.SAVE_KEY, save);
|
|
|
|
|
|
|
| 22 |
const TODAY = today(), DAILY = C.daily(TODAY);
|
| 23 |
if (save.daily.iso !== TODAY) save.daily = { iso: TODAY, best: 0, tries: 0 };
|
| 24 |
$('num').textContent = `#${DAILY.num}`;
|
|
@@ -241,6 +243,13 @@ function startRun(mode, o = {}) {
|
|
| 241 |
audio();
|
| 242 |
if (mode === 'endless' && !pass.isPro()) { pass.open('endless'); return; }
|
| 243 |
let N = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
if (mode === 'nights') {
|
| 245 |
const n = o.n || save.night || 1, a = L.access(n, save.nights, pass.isPro());
|
| 246 |
if (a === 'pass') { pass.open(`night-${n}`); return; }
|
|
@@ -248,7 +257,7 @@ function startRun(mode, o = {}) {
|
|
| 248 |
N = L.NIGHTS[n - 1]; save.night = n;
|
| 249 |
if (a === 'open') L.markPlayed(save.nights, n);
|
| 250 |
}
|
| 251 |
-
lastStart = { mode, n: N ? N.n : 0, seed: o.seed ?? null, target: o.target ?? null, link: !!o.link };
|
| 252 |
resetPools();
|
| 253 |
const meta = C.metaBonus(save.up);
|
| 254 |
Object.assign(run, {
|
|
@@ -277,9 +286,10 @@ function startRun(mode, o = {}) {
|
|
| 277 |
hideAll(); $('pause').hidden = false;
|
| 278 |
state = 'play'; acc = 0; musicOn = true;
|
| 279 |
cam.x = 0; cam.y = 0;
|
| 280 |
-
count(GAME, 'play', N ? 'night' : mode);
|
| 281 |
cv.focus({ preventScroll: true });
|
| 282 |
-
if (N
|
|
|
|
| 283 |
else if (mode === 'daily') banner(run.dcfg.num ? `Daily #${run.dcfg.num}: ${run.mod.name}` : `Seed ${run.seed}: ${run.mod.name}`);
|
| 284 |
}
|
| 285 |
function banner(t) { run.banner = t; run.bannerT = 2.6; }
|
|
@@ -819,7 +829,7 @@ function resume() { if (state !== 'paused') return; $('pausem').hidden = true; s
|
|
| 819 |
$('pause').onclick = () => (state === 'play' ? pauseGame() : resume());
|
| 820 |
$('resume').onclick = resume;
|
| 821 |
$('endrun').onclick = () => { if (state === 'paused') { $('pausem').hidden = true; state = 'play'; endRun(false); } };
|
| 822 |
-
function retry() { const o = lastStart; startRun(o.mode === 'endless' && !pass.isPro() ? 'standard' : o.mode, { n: o.n, seed: o.seed, target: o.target, link: o.link }); }
|
| 823 |
$('retry').onclick = retry;
|
| 824 |
$('tomenu').onclick = () => showMenu();
|
| 825 |
|
|
@@ -834,15 +844,20 @@ function menuNight() { // the night the Play button starts
|
|
| 834 |
}
|
| 835 |
function renderMenu() {
|
| 836 |
const modes = $('modes'); modes.innerHTML = '';
|
| 837 |
-
const M = [['nights', '🌙 Nights'], ['daily', `Daily #${DAILY.num}`], ['standard', '10-min run'], ['endless', 'Endless']];
|
| 838 |
for (const [id, label] of M) {
|
| 839 |
const b = document.createElement('button'); b.type = 'button'; b.className = 'chip'; b.setAttribute('aria-pressed', String(save.mode === id));
|
| 840 |
-
b.innerHTML = `${label}${id === 'endless' && !pass.isPro() ? ' <span class="lock">🔒 Pass</span>' : ''}`;
|
| 841 |
b.onclick = () => { sfx('ui'); if (id === 'endless' && !pass.isPro()) { pass.open('endless'); return; } if (id !== save.mode) LINK = null; save.mode = id; persist(); renderMenu(); };
|
| 842 |
modes.appendChild(b);
|
| 843 |
}
|
| 844 |
const line = $('modline'), n = menuNight(), N = L.NIGHTS[n - 1];
|
| 845 |
-
if (save.mode === '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 846 |
const st = save.nights.stars[n] || 0, g = L.groupOf(n);
|
| 847 |
line.textContent = `Night ${n}${N.challenge ? ' (challenge)' : ''}: ${N.name} · ${C.fmtTime(N.dur)} · ${g.icon} ${g.twist}${st ? ` · ${'★'.repeat(st)}${'☆'.repeat(3 - st)}` : ''}`;
|
| 848 |
$('play').textContent = `▶ Play night ${n}`;
|
|
@@ -896,6 +911,7 @@ function renderMenu() {
|
|
| 896 |
}
|
| 897 |
function playFromMenu() {
|
| 898 |
if (LINK && (save.mode === 'nights' ? LINK.lvl === menuNight() : save.mode === 'daily' && !LINK.lvl)) startRun(save.mode, { n: LINK.lvl || 0, seed: LINK.seed, target: LINK.score, link: true });
|
|
|
|
| 899 |
else startRun(save.mode, { n: save.mode === 'nights' ? menuNight() : 0 });
|
| 900 |
}
|
| 901 |
$('play').onclick = playFromMenu;
|
|
@@ -921,11 +937,13 @@ function renderMap() {
|
|
| 921 |
b.type = 'button'; b.className = `node${N.challenge ? ' ch' : ''}${a !== 'open' ? ` ${a}` : ''}${n === cur ? ' cur' : ''}`;
|
| 922 |
b.dataset.n = n;
|
| 923 |
b.setAttribute('aria-label', `Night ${n}: ${N.name}${N.challenge ? ', challenge' : ''}, ${a === 'open' ? `${st} of 3 stars` : a === 'pass' ? 'needs the Fun Pass' : 'locked'}`);
|
| 924 |
-
|
|
|
|
| 925 |
b.onclick = () => {
|
| 926 |
sfx('ui');
|
| 927 |
if (a === 'pass') { pass.open(`map-night-${n}`); return; }
|
| 928 |
if (a === 'locked') { toast(`🔒 Clear night ${n - 1} first`); return; }
|
|
|
|
| 929 |
if (LINK && LINK.lvl !== n) LINK = null;
|
| 930 |
save.mode = 'nights'; save.night = n; persist(); startRun('nights', { n, ...(LINK && LINK.lvl === n ? { seed: LINK.seed, target: LINK.score, link: true } : {}) });
|
| 931 |
};
|
|
@@ -963,7 +981,10 @@ function endRun(won) {
|
|
| 963 |
const r = { mode: run.mode, time: t, kills: run.kills, shards: Math.round(run.shards), level: run.level, won, boss: run.bossDone, wisp: run.wisp.name, skin: save.skin, score: C.dailyScore(t, run.kills, Math.round(run.shards)),
|
| 964 |
n: N ? N.n : 0, dur: N ? N.dur : goalTime(), hpFrac: won ? run.hp / run.maxhp : 0, stars: 0, seed: run.seed, target: run.target, daily: run.dcfg === DAILY, dnum: run.dcfg ? run.dcfg.num : 0, mod: run.mod ? run.mod.name : '' };
|
| 965 |
if (N) r.stars = L.starsFor(N, r);
|
| 966 |
-
r.
|
|
|
|
|
|
|
|
|
|
| 967 |
last = r;
|
| 968 |
let rec = null;
|
| 969 |
if (!run.god) {
|
|
@@ -979,7 +1000,7 @@ function endRun(won) {
|
|
| 979 |
const got = run.god ? [] : C.checkUnlocks(save, r);
|
| 980 |
persist();
|
| 981 |
state = 'over'; musicOn = false; joy.on = false; $('pause').hidden = true;
|
| 982 |
-
$('over-title').textContent = N ? (won ? `Night ${N.n} cleared!` : `Night ${N.n}: your lantern went out`) : won ? (r.mode === 'daily' ? (r.dnum ? `Daily #${r.dnum} complete!` : 'Seed night survived!') : 'Dawn reached!') : 'Your lantern went out';
|
| 983 |
$('over-line').textContent = `${C.fmtTime(t)} survived · ${r.kills.toLocaleString()} gloom banished · level ${r.level} · score ${r.score.toLocaleString()}`;
|
| 984 |
// stars (nights only): pop in one by one with a sound each
|
| 985 |
const se = $('over-stars');
|
|
@@ -1000,7 +1021,7 @@ function endRun(won) {
|
|
| 1000 |
$('over-streak').textContent = sk ? `🕯️ ${sk}-day streak${save.streak.best > sk ? ` · best ${save.streak.best}` : ''}` : '';
|
| 1001 |
// next night / map buttons
|
| 1002 |
const nb = $('next'), mb = $('tomap');
|
| 1003 |
-
nb.hidden = !(N && won && N.n < L.NIGHTS.length); mb.hidden = !N;
|
| 1004 |
if (!nb.hidden) {
|
| 1005 |
const a = L.access(N.n + 1, save.nights, pass.isPro());
|
| 1006 |
nb.textContent = a === 'pass' ? `Night ${N.n + 1} 🔒 Fun Pass` : `▶ Night ${N.n + 1}`;
|
|
@@ -1036,7 +1057,7 @@ function grid(r) {
|
|
| 1036 |
}
|
| 1037 |
function shareText(r) {
|
| 1038 |
const stars = r.n ? ` ${'★'.repeat(r.stars)}${'☆'.repeat(3 - r.stars)}` : '';
|
| 1039 |
-
const head = r.n ? `Wispmarch Night ${r.n}${stars} 🏮` : r.mode === 'daily' ? (r.dnum ? `Wispmarch Daily #${r.dnum} 🏮` : `Wispmarch Seed ${r.seed} 🏮`) : r.mode === 'endless' ? `Wispmarch Endless Night 🌑 ${C.fmtTime(r.time)}` : `Wispmarch 🏮 ${r.won ? 'Reached dawn!' : `Lasted ${C.fmtTime(r.time)}`}`;
|
| 1040 |
const mod = r.mode === 'daily' ? `${r.mod} · ` : r.n ? `${L.NIGHTS[r.n - 1].name} · ` : '';
|
| 1041 |
const sk = L.liveStreak(save.streak, TODAY);
|
| 1042 |
const beat = r.n || r.mode === 'daily' ? `\nBeat my ${r.score.toLocaleString()}:` : '';
|
|
|
|
| 13 |
const REDUCED = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
| 14 |
const TOUCH = matchMedia('(pointer: coarse)').matches || 'ontouchstart' in window;
|
| 15 |
|
| 16 |
+
pass.init({ game: GAME, name: 'Wispmarch', perks: [`Nights ${L.FREE_NIGHTS + 1}-${L.NIGHTS.length}: ${L.NIGHTS.length - L.FREE_NIGHTS} bonus hand-made nights`, `Trials: replay any cleared night at Danger 1-3 for ${L.MAX_CROWNS} crowns and more Embers (one free trial a day)`, '3 wisp skins: Aurora, Ember Rose, Frostlight', 'Endless Night mode: no dawn, scaling forever'] });
|
| 17 |
themeToggle($('theme'));
|
| 18 |
const install = pwa(GAME, $('install'));
|
| 19 |
|
| 20 |
let save = C.loadSave(store(C.SAVE_KEY));
|
| 21 |
const persist = () => store(C.SAVE_KEY, save);
|
| 22 |
+
// Trials: one free trial a day; unlimited with the full game or the Fun Pass.
|
| 23 |
+
const trialFree = () => pass.isPro() || save.trialDay !== today();
|
| 24 |
const TODAY = today(), DAILY = C.daily(TODAY);
|
| 25 |
if (save.daily.iso !== TODAY) save.daily = { iso: TODAY, best: 0, tries: 0 };
|
| 26 |
$('num').textContent = `#${DAILY.num}`;
|
|
|
|
| 243 |
audio();
|
| 244 |
if (mode === 'endless' && !pass.isPro()) { pass.open('endless'); return; }
|
| 245 |
let N = null;
|
| 246 |
+
if (mode === 'trials') {
|
| 247 |
+
const n = o.n || L.nextTrial(save.nights, save.trials), d = o.danger || L.nextDanger(save.nights, save.trials, n);
|
| 248 |
+
if (!n || !d) { toast('Clear a night first: Trials replay nights you have cleared, at Danger 1-3.', 3500); return; }
|
| 249 |
+
if (!trialFree()) { pass.open('trial'); toast("Today's free trial is used. The full game makes Trials unlimited.", 3500); return; }
|
| 250 |
+
if (!pass.isPro()) save.trialDay = today();
|
| 251 |
+
N = L.trialNight(L.NIGHTS[n - 1], d);
|
| 252 |
+
}
|
| 253 |
if (mode === 'nights') {
|
| 254 |
const n = o.n || save.night || 1, a = L.access(n, save.nights, pass.isPro());
|
| 255 |
if (a === 'pass') { pass.open(`night-${n}`); return; }
|
|
|
|
| 257 |
N = L.NIGHTS[n - 1]; save.night = n;
|
| 258 |
if (a === 'open') L.markPlayed(save.nights, n);
|
| 259 |
}
|
| 260 |
+
lastStart = { mode, n: N ? N.n : 0, danger: N && N.danger ? N.danger : 0, seed: o.seed ?? null, target: o.target ?? null, link: !!o.link };
|
| 261 |
resetPools();
|
| 262 |
const meta = C.metaBonus(save.up);
|
| 263 |
Object.assign(run, {
|
|
|
|
| 286 |
hideAll(); $('pause').hidden = false;
|
| 287 |
state = 'play'; acc = 0; musicOn = true;
|
| 288 |
cam.x = 0; cam.y = 0;
|
| 289 |
+
count(GAME, 'play', N ? (N.danger ? `trial-${N.danger}` : 'night') : mode);
|
| 290 |
cv.focus({ preventScroll: true });
|
| 291 |
+
if (N && N.danger) banner(`Trial · Night ${N.n} at ${N.dangerName}: ${N.name}`);
|
| 292 |
+
else if (N) banner(L.isTwist(N.n) && N.n > 1 ? `Night ${N.n} · New: ${L.groupOf(N.n).twist}` : N.challenge ? `Challenge night ${N.n}: ${N.name}` : `Night ${N.n}: ${N.name}`);
|
| 293 |
else if (mode === 'daily') banner(run.dcfg.num ? `Daily #${run.dcfg.num}: ${run.mod.name}` : `Seed ${run.seed}: ${run.mod.name}`);
|
| 294 |
}
|
| 295 |
function banner(t) { run.banner = t; run.bannerT = 2.6; }
|
|
|
|
| 829 |
$('pause').onclick = () => (state === 'play' ? pauseGame() : resume());
|
| 830 |
$('resume').onclick = resume;
|
| 831 |
$('endrun').onclick = () => { if (state === 'paused') { $('pausem').hidden = true; state = 'play'; endRun(false); } };
|
| 832 |
+
function retry() { const o = lastStart; startRun(o.mode === 'endless' && !pass.isPro() ? 'standard' : o.mode, { n: o.n, danger: o.danger, seed: o.seed, target: o.target, link: o.link }); }
|
| 833 |
$('retry').onclick = retry;
|
| 834 |
$('tomenu').onclick = () => showMenu();
|
| 835 |
|
|
|
|
| 844 |
}
|
| 845 |
function renderMenu() {
|
| 846 |
const modes = $('modes'); modes.innerHTML = '';
|
| 847 |
+
const M = [['nights', '🌙 Nights'], ['daily', `Daily #${DAILY.num}`], ['standard', '10-min run'], ['endless', 'Endless'], ['trials', `⚔ Trials 👑${L.crowns(save.trials)}`]];
|
| 848 |
for (const [id, label] of M) {
|
| 849 |
const b = document.createElement('button'); b.type = 'button'; b.className = 'chip'; b.setAttribute('aria-pressed', String(save.mode === id));
|
| 850 |
+
b.innerHTML = `${label}${id === 'endless' && !pass.isPro() ? ' <span class="lock">🔒 Pass</span>' : id === 'trials' && !trialFree() ? ' <span class="lock">🔒</span>' : ''}`;
|
| 851 |
b.onclick = () => { sfx('ui'); if (id === 'endless' && !pass.isPro()) { pass.open('endless'); return; } if (id !== save.mode) LINK = null; save.mode = id; persist(); renderMenu(); };
|
| 852 |
modes.appendChild(b);
|
| 853 |
}
|
| 854 |
const line = $('modline'), n = menuNight(), N = L.NIGHTS[n - 1];
|
| 855 |
+
if (save.mode === 'trials') {
|
| 856 |
+
const tn = L.nextTrial(save.nights, save.trials), d = tn ? L.nextDanger(save.nights, save.trials, tn) : 0, D = L.DANGER[d];
|
| 857 |
+
line.textContent = tn ? `Trial: night ${tn} (${L.NIGHTS[tn - 1].name}) at ${D.name}: gloom ×${D.hp} toughness, ×${D.rate} spawns${D.mods.length ? `, ${D.mods.map((m) => (m === 'fog' ? 'fog' : 'fast moths')).join(' + ')}` : ''}, ×${D.embers} Embers · 👑 ${L.crowns(save.trials)}/${L.MAX_CROWNS} crowns · pick any cleared night on the map${pass.isPro() ? '' : ' · 1 free trial a day'}`
|
| 858 |
+
: 'Trials replay nights you have cleared at Danger 1-3. Clear night 1 first.';
|
| 859 |
+
$('play').textContent = tn ? `⚔ Play trial: night ${tn}, ${D.name}` : '▶ Play night 1';
|
| 860 |
+
} else if (save.mode === 'nights') {
|
| 861 |
const st = save.nights.stars[n] || 0, g = L.groupOf(n);
|
| 862 |
line.textContent = `Night ${n}${N.challenge ? ' (challenge)' : ''}: ${N.name} · ${C.fmtTime(N.dur)} · ${g.icon} ${g.twist}${st ? ` · ${'★'.repeat(st)}${'☆'.repeat(3 - st)}` : ''}`;
|
| 863 |
$('play').textContent = `▶ Play night ${n}`;
|
|
|
|
| 911 |
}
|
| 912 |
function playFromMenu() {
|
| 913 |
if (LINK && (save.mode === 'nights' ? LINK.lvl === menuNight() : save.mode === 'daily' && !LINK.lvl)) startRun(save.mode, { n: LINK.lvl || 0, seed: LINK.seed, target: LINK.score, link: true });
|
| 914 |
+
else if (save.mode === 'trials' && !L.nextTrial(save.nights, save.trials)) startRun('nights', { n: 1 });
|
| 915 |
else startRun(save.mode, { n: save.mode === 'nights' ? menuNight() : 0 });
|
| 916 |
}
|
| 917 |
$('play').onclick = playFromMenu;
|
|
|
|
| 937 |
b.type = 'button'; b.className = `node${N.challenge ? ' ch' : ''}${a !== 'open' ? ` ${a}` : ''}${n === cur ? ' cur' : ''}`;
|
| 938 |
b.dataset.n = n;
|
| 939 |
b.setAttribute('aria-label', `Night ${n}: ${N.name}${N.challenge ? ', challenge' : ''}, ${a === 'open' ? `${st} of 3 stars` : a === 'pass' ? 'needs the Fun Pass' : 'locked'}`);
|
| 940 |
+
const cr = save.trials[n] || 0;
|
| 941 |
+
b.innerHTML = `<span>${N.challenge ? '⚔' : ''}${n}</span><span class="st">${a === 'pass' ? '🔒 Fun Pass' : a === 'locked' ? '🔒' : `${'★'.repeat(st)}<i>${'★'.repeat(3 - st)}</i>`}</span>${cr ? `<span class="st">${'👑'.repeat(cr)}</span>` : ''}`;
|
| 942 |
b.onclick = () => {
|
| 943 |
sfx('ui');
|
| 944 |
if (a === 'pass') { pass.open(`map-night-${n}`); return; }
|
| 945 |
if (a === 'locked') { toast(`🔒 Clear night ${n - 1} first`); return; }
|
| 946 |
+
if (save.mode === 'trials' && st) { startRun('trials', { n }); return; }
|
| 947 |
if (LINK && LINK.lvl !== n) LINK = null;
|
| 948 |
save.mode = 'nights'; save.night = n; persist(); startRun('nights', { n, ...(LINK && LINK.lvl === n ? { seed: LINK.seed, target: LINK.score, link: true } : {}) });
|
| 949 |
};
|
|
|
|
| 981 |
const r = { mode: run.mode, time: t, kills: run.kills, shards: Math.round(run.shards), level: run.level, won, boss: run.bossDone, wisp: run.wisp.name, skin: save.skin, score: C.dailyScore(t, run.kills, Math.round(run.shards)),
|
| 982 |
n: N ? N.n : 0, dur: N ? N.dur : goalTime(), hpFrac: won ? run.hp / run.maxhp : 0, stars: 0, seed: run.seed, target: run.target, daily: run.dcfg === DAILY, dnum: run.dcfg ? run.dcfg.num : 0, mod: run.mod ? run.mod.name : '' };
|
| 983 |
if (N) r.stars = L.starsFor(N, r);
|
| 984 |
+
r.danger = N && N.danger ? N.danger : 0;
|
| 985 |
+
r.embers = Math.floor(C.embersFor(r) * (r.danger ? L.DANGER[r.danger].embers : 1)) + bonusEmbers; bonusEmbers = 0;
|
| 986 |
+
let crown = false;
|
| 987 |
+
if (r.danger && won && !run.god && (save.trials[N.n] || 0) < r.danger) { save.trials[N.n] = r.danger; crown = true; count(GAME, 'level_clear', `trial-${N.n}-${r.danger}`); }
|
| 988 |
last = r;
|
| 989 |
let rec = null;
|
| 990 |
if (!run.god) {
|
|
|
|
| 1000 |
const got = run.god ? [] : C.checkUnlocks(save, r);
|
| 1001 |
persist();
|
| 1002 |
state = 'over'; musicOn = false; joy.on = false; $('pause').hidden = true;
|
| 1003 |
+
$('over-title').textContent = r.danger ? (won ? `${crown ? '👑 Crown! ' : ''}Night ${N.n} cleared at ${N.dangerName}!` : `Trial lost: night ${N.n} at ${N.dangerName}`) : N ? (won ? `Night ${N.n} cleared!` : `Night ${N.n}: your lantern went out`) : won ? (r.mode === 'daily' ? (r.dnum ? `Daily #${r.dnum} complete!` : 'Seed night survived!') : 'Dawn reached!') : 'Your lantern went out';
|
| 1004 |
$('over-line').textContent = `${C.fmtTime(t)} survived · ${r.kills.toLocaleString()} gloom banished · level ${r.level} · score ${r.score.toLocaleString()}`;
|
| 1005 |
// stars (nights only): pop in one by one with a sound each
|
| 1006 |
const se = $('over-stars');
|
|
|
|
| 1021 |
$('over-streak').textContent = sk ? `🕯️ ${sk}-day streak${save.streak.best > sk ? ` · best ${save.streak.best}` : ''}` : '';
|
| 1022 |
// next night / map buttons
|
| 1023 |
const nb = $('next'), mb = $('tomap');
|
| 1024 |
+
nb.hidden = !(N && won && N.n < L.NIGHTS.length) || !!r.danger; mb.hidden = !N;
|
| 1025 |
if (!nb.hidden) {
|
| 1026 |
const a = L.access(N.n + 1, save.nights, pass.isPro());
|
| 1027 |
nb.textContent = a === 'pass' ? `Night ${N.n + 1} 🔒 Fun Pass` : `▶ Night ${N.n + 1}`;
|
|
|
|
| 1057 |
}
|
| 1058 |
function shareText(r) {
|
| 1059 |
const stars = r.n ? ` ${'★'.repeat(r.stars)}${'☆'.repeat(3 - r.stars)}` : '';
|
| 1060 |
+
const head = r.danger ? `Wispmarch Trial · Night ${r.n} at Danger ${r.danger}${r.won ? ' 👑' : ''} 🏮` : r.n ? `Wispmarch Night ${r.n}${stars} 🏮` : r.mode === 'daily' ? (r.dnum ? `Wispmarch Daily #${r.dnum} 🏮` : `Wispmarch Seed ${r.seed} 🏮`) : r.mode === 'endless' ? `Wispmarch Endless Night 🌑 ${C.fmtTime(r.time)}` : `Wispmarch 🏮 ${r.won ? 'Reached dawn!' : `Lasted ${C.fmtTime(r.time)}`}`;
|
| 1061 |
const mod = r.mode === 'daily' ? `${r.mod} · ` : r.n ? `${L.NIGHTS[r.n - 1].name} · ` : '';
|
| 1062 |
const sk = L.liveStreak(save.streak, TODAY);
|
| 1063 |
const beat = r.n || r.mode === 'daily' ? `\nBeat my ${r.score.toLocaleString()}:` : '';
|
index.html
CHANGED
|
@@ -18,14 +18,14 @@
|
|
| 18 |
<meta name="twitter:title" content="Wispmarch: Free Survivors-Like Roguelite Game Online">
|
| 19 |
<meta name="twitter:description" content="Play Wispmarch free: a survivors-like roguelite with 40 short nights to survive. Auto-fire, dodge hordes, earn stars, beat the daily. No download, phone or PC.">
|
| 20 |
<style>.h1kw{display:block;font-size:.42em;font-weight:600;opacity:.75;letter-spacing:.01em;margin-top:.15em}.seo ol,.seo ul{padding-left:1.2em}.seo li{margin:.25em 0}</style>
|
| 21 |
-
<script type="application/ld+json">{"@context": "https://schema.org", "@graph": [{"@type": "VideoGame", "@id": "https://cybermaxtools.com/games/wispmarch/#game", "name": "Wispmarch", "alternateName": "Survivors-like roguelite game online free", "url": "https://cybermaxtools.com/games/wispmarch/", "image": "https://cybermaxtools.com/games/wispmarch/og.png", "description": "Wispmarch is a free survivors-like (bullet heaven) roguelite you play right in your browser. You are a lantern wisp lost in a night marsh. Your lantern fires on its own; you only move, weaving through hundreds of gloom creatures while you collect light shards, level up and build a combo of weapons and passives. Survive 40 short hand-made nights, from 45 seconds to 4 minutes, and earn up to 3 stars on each. No download, no sign-up, and it runs smoothly on phones, tablets, Chromebooks and desktop PCs.", "genre": ["Action", "Roguelite", "Survivors-like", "Bullet heaven"], "gamePlatform": ["Web browser", "Android", "iOS", "Windows", "macOS", "ChromeOS"], "applicationCategory": "Game", "operatingSystem": "Any (web browser)", "playMode": "SinglePlayer", "inLanguage": "en", "isAccessibleForFree": true, "offers": {"@type": "Offer", "price": "0", "priceCurrency": "USD"}, "author": {"@type": "Organization", "name": "CyberMax", "url": "https://cybermaxtools.com/"}, "publisher": {"@type": "Organization", "name": "CyberMax"}, "datePublished": "2026-10-03", "keywords": "Survivors-like roguelite game online free, free survivors-like roguelite, unblocked, no download, browser game", "trailer": {"@id": "https://cybermaxtools.com/games/wispmarch/#video"}}, {"@type": "FAQPage", "@id": "https://cybermaxtools.com/games/wispmarch/#faq", "mainEntity": [{"@type": "Question", "name": "Is Wispmarch free?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. Nights 1 to 20, the daily challenge, the 10-minute run and all permanent upgrades are free, with no ads. The optional CyberMax Fun Pass adds nights 21 to 40, the Endless Night mode and cosmetic wisp skins."}}, {"@type": "Question", "name": "Do I need to download anything?", "acceptedAnswer": {"@type": "Answer", "text": "No. Wispmarch is an HTML5 game that runs in any modern browser. You can also install it to your home screen and play offline."}}, {"@type": "Question", "name": "What is a survivors-like game?", "acceptedAnswer": {"@type": "Answer", "text": "A survivors-like (or bullet heaven) is an action roguelite where your weapons fire automatically and you focus on movement and on choosing upgrades as you level up during a run."}}, {"@type": "Question", "name": "Can I play Wispmarch on my phone?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. It is built for touch with a floating joystick and runs at 60 fps on modern phones. It also plays with a keyboard on desktop and Chromebook."}}, {"@type": "Question", "name": "How long is a run?", "acceptedAnswer": {"@type": "Answer", "text": "Each night lasts 45 seconds to 4 minutes, so it fits a short break. The daily challenge is 5 minutes and the classic run 10 minutes. You can pause any time."}}, {"@type": "Question", "name": "What carries over between runs?", "acceptedAnswer": {"@type": "Answer", "text": "Embers you earn in every run buy permanent upgrades such as health, speed, damage, pickup range and rerolls, and you unlock new wisps by playing."}}, {"@type": "Question", "name": "How do I challenge a friend?", "acceptedAnswer": {"@type": "Answer", "text": "After a night, tap Share score. The link opens the same night for your friend with your score shown as the one to beat."}}]}, {"@type": "VideoObject", "name": "Wispmarch demo: Survive the night, reach dawn", "description": "A 14-second screen recording of the live Wispmarch page: Move. Your lantern fires by itself; Level up: pick 1 of 3 upgrades; Daily challenge, shareable score. Real result, no voice.", "thumbnailUrl": ["https://cybermax.cybermax-tools.workers.dev/media/demos/wispmarch/poster.jpg"], "uploadDate": "2026-10-08T22:17:52+00:00", "duration": "PT14S", "contentUrl": "https://cybermax.cybermax-tools.workers.dev/media/demos/wispmarch/demo-16x9.mp4", "embedUrl": "https://cybermaxtools.com/games/wispmarch/", "inLanguage": "en", "publisher": {"@type": "Organization", "name": "CyberMax", "logo": {"@type": "ImageObject", "url": "https://cybermax.cybermax-tools.workers.dev/store/img/favicon.webp"}}, "@id": "https://cybermaxtools.com/games/wispmarch/#video"}]}</script>
|
| 22 |
</head><body>
|
| 23 |
<div class="wrap">
|
| 24 |
<header class="top"><a class="brand" href="https://cybermaxtools.com/games/"><svg viewBox="0 0 512 512" aria-hidden="true"><clipPath id="lg"><rect width="512" height="512" rx="116"/></clipPath><g clip-path="url(#lg)"><rect width="512" height="512" fill="#FF6A3D"/><path d="M512 250V512H250Z" fill="#D9481F"/></g><g transform="translate(86 86) scale(3.4)"><path d="M66 27 A27 27 0 1 0 66 73" fill="none" stroke="#11141B" stroke-width="17" stroke-linecap="round"/><rect x="66" y="41" width="20" height="18" rx="4" fill="#11141B"/></g></svg>CyberMax</a>
|
| 25 |
<nav><a href="https://cybermaxtools.com/games/">Games</a></nav><button class="icon" id="mute" type="button" aria-label="Sound on or off">🔊</button><button class="icon" id="theme" type="button" aria-label="Switch light or dark">◐</button></header>
|
| 26 |
<main>
|
| 27 |
<section class="game">
|
| 28 |
-
<div class="headline"><h1>Wispmarch <span id="num" class="num"></span> <span class="pro-badge">PASS</span>
|
| 29 |
<div class="stage" id="stage">
|
| 30 |
<canvas id="c" aria-label="Wispmarch game. Move with a finger drag, WASD or arrow keys; your lantern fires by itself." tabindex="0"></canvas>
|
| 31 |
<button class="hudbtn" id="pause" type="button" aria-label="Pause" hidden>❚❚</button>
|
|
@@ -75,8 +75,8 @@
|
|
| 75 |
<h2>Wispmarch tips and strategy</h2>
|
| 76 |
<ul><li>Keep moving in wide circles: standing still is how swarms trap you.</li><li>Grab a magnet or pickup-range boost early; more shards per second means more levels.</li><li>Take an area weapon (orbiting fireflies or the lantern nova) by minute 3 to handle crowds.</li><li>Plan evolutions: hold one weapon slot for the weapon that pairs with your best passive.</li><li>Spend your first Embers on max health and pickup range; they make every later run easier.</li><li>Before the boss, clear a ring of space and keep your back to open ground.</li></ul>
|
| 77 |
<h2>Game modes</h2>
|
| 78 |
-
<ul><li>Nights: 40 hand-tuned levels with a new twist every 5 nights and a challenge night every 10th. Nights 1-20 are free; 21-40 come with the Fun Pass.</li><li>Daily challenge: the same seeded modifier for everyone today, a 5-minute run, a streak counter and a shareable score card.</li><li>10-minute run: survive until dawn with escalating waves and the Gloam Warden boss.</li><li>Endless Night (Fun Pass): no dawn, the swarm scales forever, chase a personal record.</li></ul>
|
| 79 |
-
<p>
|
| 80 |
<h2>Wispmarch FAQ</h2>
|
| 81 |
<h3>Is Wispmarch free?</h3><p>Yes. Nights 1 to 20, the daily challenge, the 10-minute run and all permanent upgrades are free, with no ads. The optional CyberMax Fun Pass adds nights 21 to 40, the Endless Night mode and cosmetic wisp skins.</p>
|
| 82 |
<h3>Do I need to download anything?</h3><p>No. Wispmarch is an HTML5 game that runs in any modern browser. You can also install it to your home screen and play offline.</p>
|
|
@@ -92,4 +92,4 @@
|
|
| 92 |
<footer>© 2026 CyberMax · <a href="https://cybermaxtools.com/games/">Games</a> · <a href="https://cybermaxtools.com/toys/">Toys</a> · <a href="https://cybermaxtools.com/store/">Store</a> · <a href="https://cybermaxtools.com/privacy">Privacy</a> · <a href="https://cybermaxtools.com/terms">Terms</a></footer>
|
| 93 |
</div>
|
| 94 |
<script type="module" src="game.js"></script>
|
| 95 |
-
<
|
|
|
|
| 18 |
<meta name="twitter:title" content="Wispmarch: Free Survivors-Like Roguelite Game Online">
|
| 19 |
<meta name="twitter:description" content="Play Wispmarch free: a survivors-like roguelite with 40 short nights to survive. Auto-fire, dodge hordes, earn stars, beat the daily. No download, phone or PC.">
|
| 20 |
<style>.h1kw{display:block;font-size:.42em;font-weight:600;opacity:.75;letter-spacing:.01em;margin-top:.15em}.seo ol,.seo ul{padding-left:1.2em}.seo li{margin:.25em 0}</style>
|
| 21 |
+
<script type="application/ld+json">{"@context": "https://schema.org", "@graph": [{"@type": "VideoGame", "@id": "https://cybermaxtools.com/games/wispmarch/#game", "name": "Wispmarch", "alternateName": "Survivors-like roguelite game online free", "url": "https://cybermaxtools.com/games/wispmarch/", "image": "https://cybermaxtools.com/games/wispmarch/og.png", "description": "Wispmarch is a free survivors-like (bullet heaven) roguelite you play right in your browser. You are a lantern wisp lost in a night marsh. Your lantern fires on its own; you only move, weaving through hundreds of gloom creatures while you collect light shards, level up and build a combo of weapons and passives. Survive 40 short hand-made nights, from 45 seconds to 4 minutes, and earn up to 3 stars on each. No download, no sign-up, and it runs smoothly on phones, tablets, Chromebooks and desktop PCs.", "genre": ["Action", "Roguelite", "Survivors-like", "Bullet heaven"], "gamePlatform": ["Web browser", "Android", "iOS", "Windows", "macOS", "ChromeOS"], "applicationCategory": "Game", "operatingSystem": "Any (web browser)", "playMode": "SinglePlayer", "inLanguage": "en", "isAccessibleForFree": true, "offers": [{"@type": "Offer", "name": "Free demo (daily challenge + levels 1-20)", "price": "0", "priceCurrency": "USD"}], "author": {"@type": "Organization", "name": "CyberMax", "url": "https://cybermaxtools.com/"}, "publisher": {"@type": "Organization", "name": "CyberMax"}, "datePublished": "2026-10-03", "keywords": "Survivors-like roguelite game online free, free survivors-like roguelite, unblocked, no download, browser game", "trailer": {"@id": "https://cybermaxtools.com/games/wispmarch/#video"}}, {"@type": "FAQPage", "@id": "https://cybermaxtools.com/games/wispmarch/#faq", "mainEntity": [{"@type": "Question", "name": "Is Wispmarch free?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. Nights 1 to 20, the daily challenge, the 10-minute run and all permanent upgrades are free, with no ads. The optional CyberMax Fun Pass adds nights 21 to 40, the Endless Night mode and cosmetic wisp skins."}}, {"@type": "Question", "name": "Do I need to download anything?", "acceptedAnswer": {"@type": "Answer", "text": "No. Wispmarch is an HTML5 game that runs in any modern browser. You can also install it to your home screen and play offline."}}, {"@type": "Question", "name": "What is a survivors-like game?", "acceptedAnswer": {"@type": "Answer", "text": "A survivors-like (or bullet heaven) is an action roguelite where your weapons fire automatically and you focus on movement and on choosing upgrades as you level up during a run."}}, {"@type": "Question", "name": "Can I play Wispmarch on my phone?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. It is built for touch with a floating joystick and runs at 60 fps on modern phones. It also plays with a keyboard on desktop and Chromebook."}}, {"@type": "Question", "name": "How long is a run?", "acceptedAnswer": {"@type": "Answer", "text": "Each night lasts 45 seconds to 4 minutes, so it fits a short break. The daily challenge is 5 minutes and the classic run 10 minutes. You can pause any time."}}, {"@type": "Question", "name": "What carries over between runs?", "acceptedAnswer": {"@type": "Answer", "text": "Embers you earn in every run buy permanent upgrades such as health, speed, damage, pickup range and rerolls, and you unlock new wisps by playing."}}, {"@type": "Question", "name": "How do I challenge a friend?", "acceptedAnswer": {"@type": "Answer", "text": "After a night, tap Share score. The link opens the same night for your friend with your score shown as the one to beat."}}]}, {"@type": "VideoObject", "name": "Wispmarch demo: Survive the night, reach dawn", "description": "A 14-second screen recording of the live Wispmarch page: Move. Your lantern fires by itself; Level up: pick 1 of 3 upgrades; Daily challenge, shareable score. Real result, no voice.", "thumbnailUrl": ["https://cybermax.cybermax-tools.workers.dev/media/demos/wispmarch/poster.jpg"], "uploadDate": "2026-10-08T22:17:52+00:00", "duration": "PT14S", "contentUrl": "https://cybermax.cybermax-tools.workers.dev/media/demos/wispmarch/demo-16x9.mp4", "embedUrl": "https://cybermaxtools.com/games/wispmarch/", "inLanguage": "en", "publisher": {"@type": "Organization", "name": "CyberMax", "logo": {"@type": "ImageObject", "url": "https://cybermax.cybermax-tools.workers.dev/store/img/favicon.webp"}}, "@id": "https://cybermaxtools.com/games/wispmarch/#video"}]}</script>
|
| 22 |
</head><body>
|
| 23 |
<div class="wrap">
|
| 24 |
<header class="top"><a class="brand" href="https://cybermaxtools.com/games/"><svg viewBox="0 0 512 512" aria-hidden="true"><clipPath id="lg"><rect width="512" height="512" rx="116"/></clipPath><g clip-path="url(#lg)"><rect width="512" height="512" fill="#FF6A3D"/><path d="M512 250V512H250Z" fill="#D9481F"/></g><g transform="translate(86 86) scale(3.4)"><path d="M66 27 A27 27 0 1 0 66 73" fill="none" stroke="#11141B" stroke-width="17" stroke-linecap="round"/><rect x="66" y="41" width="20" height="18" rx="4" fill="#11141B"/></g></svg>CyberMax</a>
|
| 25 |
<nav><a href="https://cybermaxtools.com/games/">Games</a></nav><button class="icon" id="mute" type="button" aria-label="Sound on or off">🔊</button><button class="icon" id="theme" type="button" aria-label="Switch light or dark">◐</button></header>
|
| 26 |
<main>
|
| 27 |
<section class="game">
|
| 28 |
+
<div class="headline"><h1>Wispmarch <span id="num" class="num"></span> <span class="pro-badge">PASS</span> <small class="h1kw">Free survivors-like roguelite</small></h1></div>
|
| 29 |
<div class="stage" id="stage">
|
| 30 |
<canvas id="c" aria-label="Wispmarch game. Move with a finger drag, WASD or arrow keys; your lantern fires by itself." tabindex="0"></canvas>
|
| 31 |
<button class="hudbtn" id="pause" type="button" aria-label="Pause" hidden>❚❚</button>
|
|
|
|
| 75 |
<h2>Wispmarch tips and strategy</h2>
|
| 76 |
<ul><li>Keep moving in wide circles: standing still is how swarms trap you.</li><li>Grab a magnet or pickup-range boost early; more shards per second means more levels.</li><li>Take an area weapon (orbiting fireflies or the lantern nova) by minute 3 to handle crowds.</li><li>Plan evolutions: hold one weapon slot for the weapon that pairs with your best passive.</li><li>Spend your first Embers on max health and pickup range; they make every later run easier.</li><li>Before the boss, clear a ring of space and keep your back to open ground.</li></ul>
|
| 77 |
<h2>Game modes</h2>
|
| 78 |
+
<ul><li>Nights: 40 hand-tuned levels with a new twist every 5 nights and a challenge night every 10th. Nights 1-20 are free; 21-40 come with the Fun Pass.</li><li>Daily challenge: the same seeded modifier for everyone today, a 5-minute run, a streak counter and a shareable score card.</li><li>10-minute run: survive until dawn with escalating waves and the Gloam Warden boss.</li><li>Endless Night (Fun Pass): no dawn, the swarm scales forever, chase a personal record.</li><li>Trials: replay any night you have cleared at Danger 1, 2 or 3 (tougher gloom, denser swarms, fog, fast moths) for 120 crowns and up to 3x Embers. One free trial a day; unlimited with the full game or the Fun Pass.</li></ul>
|
| 79 |
+
<p>The daily challenge and levels 1-20 are free to play, with no ads and no sign-up. Later levels, bonus modes, the daily archive and colour themes come with the optional <a href="https://cybermaxtools.com/games/#pass">CyberMax Fun Pass</a> ($2.99/month, $19/year or $29.99 for life), which opens everything in every CyberMax game.</p>
|
| 80 |
<h2>Wispmarch FAQ</h2>
|
| 81 |
<h3>Is Wispmarch free?</h3><p>Yes. Nights 1 to 20, the daily challenge, the 10-minute run and all permanent upgrades are free, with no ads. The optional CyberMax Fun Pass adds nights 21 to 40, the Endless Night mode and cosmetic wisp skins.</p>
|
| 82 |
<h3>Do I need to download anything?</h3><p>No. Wispmarch is an HTML5 game that runs in any modern browser. You can also install it to your home screen and play offline.</p>
|
|
|
|
| 92 |
<footer>© 2026 CyberMax · <a href="https://cybermaxtools.com/games/">Games</a> · <a href="https://cybermaxtools.com/toys/">Toys</a> · <a href="https://cybermaxtools.com/store/">Store</a> · <a href="https://cybermaxtools.com/privacy">Privacy</a> · <a href="https://cybermaxtools.com/terms">Terms</a></footer>
|
| 93 |
</div>
|
| 94 |
<script type="module" src="game.js"></script>
|
| 95 |
+
</body></html>
|
levels.js
CHANGED
|
@@ -194,3 +194,39 @@ export function linkQuery({ seed = null, score = null, lvl = null } = {}) {
|
|
| 194 |
if (Number.isInteger(lvl) && lvl >= 1 && lvl <= NIGHTS.length) q.push(`lvl=${lvl}`);
|
| 195 |
return q.length ? `?${q.join('&')}` : '';
|
| 196 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
if (Number.isInteger(lvl) && lvl >= 1 && lvl <= NIGHTS.length) q.push(`lvl=${lvl}`);
|
| 195 |
return q.length ? `?${q.join('&')}` : '';
|
| 196 |
}
|
| 197 |
+
|
| 198 |
+
// ---------------------------------------------------------------- Trials (full-game mode, games lane GM 9 Oct 2026)
|
| 199 |
+
// Replay any night you have cleared at Danger 1-3 (tougher gloom, denser swarms; fog at Danger 2, fast moths at 3).
|
| 200 |
+
// Clearing a Danger level earns that night's crown for it (3 per night, 120 in all) and more Embers for the shop.
|
| 201 |
+
export const DANGER = [
|
| 202 |
+
null,
|
| 203 |
+
{ name: 'Danger 1', hp: 1.35, rate: 1.2, crowd: 1.15, mods: [], embers: 1.5 },
|
| 204 |
+
{ name: 'Danger 2', hp: 1.7, rate: 1.4, crowd: 1.3, mods: ['fog'], embers: 2 },
|
| 205 |
+
{ name: 'Danger 3', hp: 2.1, rate: 1.6, crowd: 1.45, mods: ['fog', 'swiftmoths'], embers: 3 },
|
| 206 |
+
];
|
| 207 |
+
export const MAX_DANGER = 3;
|
| 208 |
+
export const MAX_CROWNS = NIGHTS.length * MAX_DANGER;
|
| 209 |
+
/** Night N played at Danger d (a new object; the night table is never changed). */
|
| 210 |
+
export function trialNight(N, d) {
|
| 211 |
+
const D = DANGER[d];
|
| 212 |
+
if (!N || !D) return N;
|
| 213 |
+
const mul = (a, m) => [a[0] * m, a[1] * m];
|
| 214 |
+
return { ...N, hp: mul(N.hp, D.hp), rate: mul(N.rate, D.rate), spawn: mul(N.spawn, D.crowd), mods: [...new Set([...N.mods, ...D.mods])], danger: d, dangerName: D.name };
|
| 215 |
+
}
|
| 216 |
+
/** Clean a saved trials map { night: highest danger cleared }. */
|
| 217 |
+
export function loadTrials(raw) {
|
| 218 |
+
const t = {};
|
| 219 |
+
if (!raw || typeof raw !== 'object') return t;
|
| 220 |
+
for (const k of Object.keys(raw)) { const n = Number(k), d = Math.floor(Number(raw[k])); if (Number.isInteger(n) && n >= 1 && n <= NIGHTS.length && d >= 1) t[n] = Math.min(MAX_DANGER, d); }
|
| 221 |
+
return t;
|
| 222 |
+
}
|
| 223 |
+
export const crowns = (trials) => Object.values(trials).reduce((a, b) => a + b, 0);
|
| 224 |
+
/** Trials open for night n: cleared at least once. Returns the next danger to try (1..3) or 0 when all are crowned. */
|
| 225 |
+
export function nextDanger(prog, trials, n) { return prog.stars[n] ? ((trials[n] || 0) < MAX_DANGER ? (trials[n] || 0) + 1 : MAX_DANGER) : 0; }
|
| 226 |
+
/** The trial the Play button starts: the lowest cleared night with a danger level left, else the highest cleared night. */
|
| 227 |
+
export function nextTrial(prog, trials) {
|
| 228 |
+
let hi = 0;
|
| 229 |
+
for (let n = 1; n <= NIGHTS.length; n++) if (prog.stars[n]) { hi = n; if ((trials[n] || 0) < MAX_DANGER) return n; }
|
| 230 |
+
return hi;
|
| 231 |
+
}
|
| 232 |
+
|
offer.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Written by scripts/games/sync_kit.py from products/fun-pass/games.json; do not edit by hand. (c) 2026 CyberMax.
|
| 2 |
+
export const OFFER = {"game": "wispmarch", "name": "Wispmarch", "price": "$4.99", "live": false, "demo": 20, "games": 10};
|
sw.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
// CyberMax game service worker: the game works offline after the first visit. Cache-first for the game's own files,
|
| 2 |
// network-first for the page itself (so updates arrive), never caches API calls or other sites. (c) 2026 CyberMax.
|
| 3 |
const GAME = 'wispmarch';
|
| 4 |
-
const CACHE = `cmx-${GAME}-
|
| 5 |
-
const FILES = ["index.html", "cmx.js", "core.js", "fun.css", "funpass.js", "game.js", "icon-192.png", "icon-512.png", "icon-maskable.png", "icon.svg", "index.html", "levels.js", "manifest.webmanifest", "style.css"];
|
| 6 |
|
| 7 |
self.addEventListener('install', (e) => {
|
| 8 |
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(FILES)).then(() => self.skipWaiting()));
|
|
|
|
| 1 |
// CyberMax game service worker: the game works offline after the first visit. Cache-first for the game's own files,
|
| 2 |
// network-first for the page itself (so updates arrive), never caches API calls or other sites. (c) 2026 CyberMax.
|
| 3 |
const GAME = 'wispmarch';
|
| 4 |
+
const CACHE = `cmx-${GAME}-87e98b018b`;
|
| 5 |
+
const FILES = ["index.html", "cmx.js", "core.js", "fun.css", "funpass.js", "game.js", "icon-192.png", "icon-512.png", "icon-maskable.png", "icon.svg", "index.html", "levels.js", "manifest.webmanifest", "offer.js", "style.css"];
|
| 6 |
|
| 7 |
self.addEventListener('install', (e) => {
|
| 8 |
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(FILES)).then(() => self.skipWaiting()));
|