Add solo Expeditions, the second Guilde des Veilleurs quest of Sokko TCG
- Every catalog card carries expedition tags and every collection a stat profile, validated at load; twelve destinations live server-side so hidden ones stay secret. - Pure rules compute card power, per-slot requirements, roles, dangers, the long-trip malus, the score (one more star never raises it) and loot proportional to the chosen duration. - A simulator script and a balance test guard the design thresholds; agent docs and a new-card skill explain how to tag new cards. - Migration 8 adds Éclats d'étoile, expedition settings stored as one validated JSON, daily destinations, expeditions, members and slots, and rebuilds gift_packs so a pack can come from an expedition. - Players launch a solo expedition from the Guild, see an exact preview, and claim their loot when it returns; the card sheet shows cards away on an expedition. - Administration › Guilde tunes every value with server-side bounds, toggles destinations and cancels running expeditions; expeditions stay closed until an administrator opens them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0ef213cf4f
commit
8bb1d53d70
46 changed files with 4752 additions and 213 deletions
|
|
@ -3,6 +3,7 @@ import { mkdirSync } from "node:fs";
|
|||
import { dirname } from "node:path";
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import { INITIAL_COLLECTION_STATES, INITIAL_DROP_RATES, INITIAL_RECHARGE_SETTING, INITIAL_SHOP_SETTING } from "./admin-seed.js";
|
||||
import { DEFAULT_EXPEDITION_SETTINGS } from "./expedition-settings.js";
|
||||
|
||||
const MIGRATIONS = [
|
||||
`
|
||||
|
|
@ -219,6 +220,84 @@ const MIGRATIONS = [
|
|||
PRIMARY KEY (player_id, day)
|
||||
) STRICT;
|
||||
CREATE INDEX daily_attempts_day_idx ON daily_attempts(day, status);
|
||||
`,
|
||||
// Expéditions : Éclats d'étoile, réglages (un JSON validé par expedition-settings.js, Expéditions fermées au départ), destinations du jour,
|
||||
// expéditions, participants et places. Les CHECK prévoient déjà le groupe (mode, inscription, 5 ★, 4 places, rôles).
|
||||
// gift_packs est reconstruite : un paquet offert vient d'une campagne ou d'une expédition.
|
||||
`
|
||||
ALTER TABLE players ADD COLUMN eclats INTEGER NOT NULL DEFAULT 0 CHECK (eclats >= 0);
|
||||
CREATE TABLE expedition_settings (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 1),
|
||||
settings_json TEXT NOT NULL CHECK (json_valid(settings_json)),
|
||||
updated_at INTEGER NOT NULL,
|
||||
updated_by TEXT REFERENCES players(id)
|
||||
) STRICT;
|
||||
INSERT INTO expedition_settings(id, settings_json, updated_at, updated_by) VALUES (1, '${JSON.stringify(DEFAULT_EXPEDITION_SETTINGS)}', 0, NULL);
|
||||
-- draw_json : destinations tirées (identifiant, condition et dangers) ; les exigences chiffrées sont calculées à la lecture.
|
||||
CREATE TABLE expedition_days (
|
||||
day TEXT PRIMARY KEY,
|
||||
draw_json TEXT NOT NULL CHECK (json_valid(draw_json)),
|
||||
created_at INTEGER NOT NULL
|
||||
) STRICT;
|
||||
-- setup_json fige la destination, les exigences et les réglages du départ ; result_json n'est montré qu'au retour.
|
||||
CREATE TABLE expeditions (
|
||||
id TEXT PRIMARY KEY,
|
||||
mode TEXT NOT NULL CHECK (mode IN ('solo', 'group')),
|
||||
day TEXT NOT NULL REFERENCES expedition_days(day),
|
||||
destination_id TEXT NOT NULL,
|
||||
difficulty INTEGER NOT NULL CHECK (difficulty BETWEEN 1 AND 5),
|
||||
duration_ms INTEGER NOT NULL CHECK (duration_ms > 0),
|
||||
creator_id TEXT NOT NULL REFERENCES players(id),
|
||||
status TEXT NOT NULL CHECK (status IN ('forming', 'running', 'completed', 'cancelled')),
|
||||
setup_json TEXT NOT NULL CHECK (json_valid(setup_json)),
|
||||
result_json TEXT CHECK (result_json IS NULL OR json_valid(result_json)),
|
||||
created_at INTEGER NOT NULL,
|
||||
departs_at INTEGER,
|
||||
returns_at INTEGER,
|
||||
completed_at INTEGER
|
||||
) STRICT;
|
||||
CREATE INDEX expeditions_status_idx ON expeditions(status, returns_at);
|
||||
CREATE INDEX expeditions_day_idx ON expeditions(day, creator_id);
|
||||
CREATE TABLE expedition_members (
|
||||
expedition_id TEXT NOT NULL REFERENCES expeditions(id) ON DELETE CASCADE,
|
||||
player_id TEXT NOT NULL REFERENCES players(id),
|
||||
reward_json TEXT CHECK (reward_json IS NULL OR json_valid(reward_json)),
|
||||
joined_at INTEGER NOT NULL,
|
||||
claimed_at INTEGER,
|
||||
PRIMARY KEY (expedition_id, player_id)
|
||||
) STRICT;
|
||||
CREATE INDEX expedition_members_player_idx ON expedition_members(player_id, claimed_at);
|
||||
-- player_id nul : place tenue par le Veilleur de la Guilde, sans carte ni rôle.
|
||||
CREATE TABLE expedition_slots (
|
||||
expedition_id TEXT NOT NULL REFERENCES expeditions(id) ON DELETE CASCADE,
|
||||
position INTEGER NOT NULL CHECK (position BETWEEN 0 AND 3),
|
||||
role TEXT CHECK (role IS NULL OR role IN ('leader', 'guardian', 'seeker', 'navigator')),
|
||||
player_id TEXT REFERENCES players(id),
|
||||
edition_id TEXT,
|
||||
card_id TEXT,
|
||||
level INTEGER NOT NULL DEFAULT 0 CHECK (level >= 0),
|
||||
stats_json TEXT NOT NULL CHECK (json_valid(stats_json)),
|
||||
PRIMARY KEY (expedition_id, position)
|
||||
) STRICT;
|
||||
CREATE INDEX expedition_slots_player_idx ON expedition_slots(player_id, edition_id);
|
||||
CREATE TABLE gift_packs_next (
|
||||
id TEXT PRIMARY KEY,
|
||||
player_id TEXT NOT NULL REFERENCES players(id),
|
||||
source TEXT NOT NULL DEFAULT 'campaign' CHECK (source IN ('campaign', 'expedition')),
|
||||
campaign_id TEXT REFERENCES campaigns(id),
|
||||
expedition_id TEXT REFERENCES expeditions(id),
|
||||
collection_id TEXT NOT NULL,
|
||||
options_json TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
opening_id TEXT REFERENCES openings(id),
|
||||
opened_at INTEGER,
|
||||
CHECK ((source = 'campaign' AND campaign_id IS NOT NULL) OR (source = 'expedition' AND expedition_id IS NOT NULL))
|
||||
) STRICT;
|
||||
INSERT INTO gift_packs_next(id, player_id, source, campaign_id, collection_id, options_json, created_at, opening_id, opened_at)
|
||||
SELECT id, player_id, 'campaign', campaign_id, collection_id, options_json, created_at, opening_id, opened_at FROM gift_packs;
|
||||
DROP TABLE gift_packs;
|
||||
ALTER TABLE gift_packs_next RENAME TO gift_packs;
|
||||
CREATE INDEX gift_packs_player_idx ON gift_packs(player_id, opened_at);
|
||||
`
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue