A ⚙ preferences slip in the masthead, saved to this device: - Token art, all or nothing: the photographed cardboard or the hand-drawn vectors (the workshop's per-category query params stay as the undocumented editing override). - Ending a turn on a lone grabbable treasure picks it up on the way out — never on your own home, never when two share the square. - Spell flourishes on or off, honored by the live board and the replay reel alike (trap notices still fire; they are information). Preferences change what you see or what routine commands the client sends for you — never what is legal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0138A8CjeQRpvzKxuMfz1Bqc
39 lines
1.7 KiB
TypeScript
39 lines
1.7 KiB
TypeScript
// Which art set a token draws from: the player's preference, with the
|
|
// workshop's per-category query params (?svgPlayers=true, ...) as a
|
|
// deliberate override for editing sessions under `npm run dev`.
|
|
import { prefs } from "./prefs.svelte";
|
|
|
|
export type ArtCategory = "players" | "creatures" | "terrain" | "objects";
|
|
|
|
const q = new URLSearchParams(typeof location === "undefined" ? "" : location.search);
|
|
const PARAM: Record<ArtCategory, string> = {
|
|
players: "svgPlayers", creatures: "svgCreatures", terrain: "svgTerrain", objects: "svgObjects",
|
|
};
|
|
|
|
export function tokenArt(file: string, cat: ArtCategory): string {
|
|
const override = q.get(PARAM[cat]);
|
|
const drawn = override !== null ? override === "true" : prefs.art === "drawn";
|
|
return drawn ? `/tokens-svg/${file}.svg` : `/tokens/${file}.png`;
|
|
}
|
|
|
|
// Which token file depicts each board thing (shared by the board renderer
|
|
// and the card-peek modal). Anything without an entry has no token art.
|
|
export const TERRAIN_ART: Record<string, string> = {
|
|
stone: "solid-stone", thornbush: "thorn-bush", rosebush: "rosebush",
|
|
ooze: "killer-ooze", dust: "dustcloud", slime: "slime",
|
|
tacks: "tacks", pit: "pit", safe: "safe",
|
|
};
|
|
export const CREATURE_ART: Record<string, string> = {
|
|
skeleton: "skeleton", troll: "troll", wraith: "wraith",
|
|
"fire-imp": "fire-imp", "democratic-monster": "democratic-monster",
|
|
shadow: "shadow", "alter-ego": "alter-ego",
|
|
};
|
|
export function objectArt(cardId: string): string | null {
|
|
if (cardId === "dagger") return "dagger";
|
|
if (cardId === "large-rock") return "rock";
|
|
if (cardId === "master-key") return "master-key";
|
|
if (cardId.endsWith("stone")) return "magic-stone";
|
|
if (cardId.endsWith("-wand")) return "magic-wand";
|
|
return null;
|
|
}
|