[art-prep] Phase2Pictures: Add the fox, berries, bush, paths and lanterns to the art board, each card marked with its phase
This commit is contained in:
@@ -19,6 +19,7 @@ export interface BoardCell {
|
||||
export interface BoardAsset {
|
||||
readonly id: string;
|
||||
readonly type: Asset['type'];
|
||||
readonly phase: number;
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
readonly background: Background;
|
||||
@@ -47,7 +48,7 @@ export function boardData(m: Manifest, styleMarkdown: string): BoardData {
|
||||
|
||||
const assets = m.assets.map((a): BoardAsset => {
|
||||
const base = {
|
||||
id: a.id, type: a.type, width: a.width, height: a.height, background: a.background,
|
||||
id: a.id, type: a.type, phase: a.phase, width: a.width, height: a.height, background: a.background,
|
||||
shipped: a.shipped, usedBy: a.usedBy, checks: a.checks, smallest: a.smallest,
|
||||
attach: attachments(a, m), prompt: promptFor(a, m, style)
|
||||
};
|
||||
|
||||
@@ -16,6 +16,8 @@ export interface Cell {
|
||||
export interface Asset {
|
||||
readonly id: string;
|
||||
readonly type: AssetType;
|
||||
/** The roadmap phase that first shows it (docs/ROADMAP.md §4). The manifest lists phases in order. */
|
||||
readonly phase: number;
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
readonly background: Background;
|
||||
@@ -88,8 +90,12 @@ export function checkManifest(m: Manifest, checklistLength: number): string[] {
|
||||
else if (sheet.type !== 'sheet') problems.push(`character ${name}: "${c.sheet}" is a ${sheet.type}, not a character sheet`);
|
||||
}
|
||||
|
||||
let lastPhase = 0;
|
||||
for (const a of m.assets) {
|
||||
claim(a.id, a.id);
|
||||
if (!Number.isInteger(a.phase) || a.phase < 1 || a.phase > 6) problems.push(`${a.id}: phase ${String(a.phase)} is not a roadmap phase (1–6)`);
|
||||
else if (a.phase < lastPhase) problems.push(`${a.id}: phase ${a.phase} comes after phase ${lastPhase}; list the pictures in phase order`);
|
||||
else lastPhase = a.phase;
|
||||
if (!TYPES.includes(a.type)) problems.push(`${a.id}: unknown type "${a.type}"`);
|
||||
if (!GENERATOR_SIZES.some(([w, h]) => w === a.width && h === a.height)) {
|
||||
problems.push(`${a.id}: ${a.width} × ${a.height} is not a size image generators offer (${GENERATOR_SIZES.map(([w, h]) => `${w} × ${h}`).join(', ')})`);
|
||||
|
||||
@@ -20,7 +20,15 @@ const C = {
|
||||
amber: '#f2b860',
|
||||
coral: '#e9846a',
|
||||
night: '#2e3561',
|
||||
lamp: '#f4d58d'
|
||||
lamp: '#f4d58d',
|
||||
fox: '#b65a35',
|
||||
cream: '#f3e3c8',
|
||||
foxLeg: '#5a3a33',
|
||||
strawberry: '#d2554e',
|
||||
blueberry: '#5b6fa6',
|
||||
raspberry: '#c2456a',
|
||||
blackberry: '#3f2e4a',
|
||||
hip: '#d0632e'
|
||||
} as const;
|
||||
|
||||
type Eyes = 'open' | 'half' | 'closed' | 'down' | 'squeeze';
|
||||
@@ -87,6 +95,82 @@ function rose(look: RoseLook): string {
|
||||
return stem + thorns + leaves + bloom;
|
||||
}
|
||||
|
||||
interface FoxLook {
|
||||
readonly pose: 'sit' | 'stand' | 'lie' | 'curl';
|
||||
readonly eyes: 'open' | 'half' | 'closed';
|
||||
/** Faces right instead of left. */
|
||||
readonly right?: boolean;
|
||||
/** The head turned back over the shoulder. */
|
||||
readonly back?: boolean;
|
||||
/** Seen from behind: no face. */
|
||||
readonly behind?: boolean;
|
||||
readonly petal?: boolean;
|
||||
readonly fluffed?: boolean;
|
||||
/** Degrees the head tilts. */
|
||||
readonly tilt?: number;
|
||||
}
|
||||
|
||||
/** The fox in a 300 × 240 box, facing left unless `right`, feet on the bottom edge. */
|
||||
function fox(look: FoxLook): string {
|
||||
const ink = `stroke="${C.ink}" stroke-width="4"`;
|
||||
const leg = (x: number, y0: number, y1: number): string => `<path d="M${x} ${y0} V ${y1}" stroke="${C.foxLeg}" stroke-width="14" stroke-linecap="round"/>`;
|
||||
const thick = look.fluffed ? 8 : 0;
|
||||
const tail = (d: string): string =>
|
||||
`<path d="${d}" fill="none" stroke="${C.ink}" stroke-width="${38 + thick}" stroke-linecap="round"/>` +
|
||||
`<path d="${d}" fill="none" stroke="${C.fox}" stroke-width="${30 + thick}" stroke-linecap="round"/>` +
|
||||
`<path d="${d}" fill="none" stroke="${C.foxLeg}" stroke-width="${32 + thick}" stroke-dasharray="6 26" opacity=".45"/>`;
|
||||
const head = (x: number, y: number, r: number): string => {
|
||||
const k = look.back ? -1 : 1;
|
||||
const ears = [-0.55, 0.35].map((o) => `<path d="M${x + o * r * k - 12} ${y - r * 0.6} l12 -${r * 0.9} l12 ${r * 0.9}z" fill="${C.fox}" ${ink}/>`).join('');
|
||||
if (look.behind) return ears + `<circle cx="${x}" cy="${y}" r="${r}" fill="${C.fox}" ${ink}/>`;
|
||||
const eye = (ex: number): string =>
|
||||
look.eyes === 'open'
|
||||
? `<circle cx="${ex}" cy="${y - 4}" r="4" fill="${C.ink}"/>`
|
||||
: `<path d="M${ex - 6} ${y - 4} q6 ${look.eyes === 'half' ? 4 : 6} 12 0" fill="${look.eyes === 'half' ? C.ink : 'none'}" stroke="${C.ink}" stroke-width="3" stroke-linecap="round"/>`;
|
||||
const snout = x - k * r * 0.75;
|
||||
return ears + `<g transform="rotate(${look.tilt ?? 0} ${x} ${y})"><circle cx="${x}" cy="${y}" r="${r}" fill="${C.fox}" ${ink}/>
|
||||
<ellipse cx="${snout + k * 6}" cy="${y + r * 0.35}" rx="${r * 0.55}" ry="${r * 0.38}" fill="${C.cream}" ${ink}/>
|
||||
<circle cx="${x - k * 12}" cy="${y - r * 0.45}" r="5" fill="${C.cream}"/><circle cx="${x + k * 10}" cy="${y - r * 0.45}" r="5" fill="${C.cream}"/>
|
||||
${eye(x - k * 13)}${eye(x + k * 9)}<circle cx="${snout - k * 6}" cy="${y + r * 0.3}" r="5" fill="${C.ink}"/>
|
||||
${look.petal ? `<ellipse cx="${snout - k * 10}" cy="${y + r * 0.75}" rx="16" ry="9" fill="${C.cream}" ${ink}/>` : ''}</g>`;
|
||||
};
|
||||
let body: string;
|
||||
switch (look.pose) {
|
||||
case 'sit':
|
||||
body = tail('M185 215 Q 250 205 240 150') + `<ellipse cx="160" cy="150" rx="50" ry="64" fill="${C.fox}" ${ink}/>`
|
||||
+ `<ellipse cx="148" cy="160" rx="24" ry="38" fill="${C.cream}"/>` + leg(140, 175, 225) + leg(168, 175, 225)
|
||||
+ head(look.back ? 175 : 145, 72, 38);
|
||||
break;
|
||||
case 'stand':
|
||||
body = tail('M235 120 Q 280 110 290 60') + leg(110, 140, 225) + leg(130, 140, 225) + leg(200, 140, 225) + leg(220, 140, 225)
|
||||
+ `<ellipse cx="165" cy="128" rx="80" ry="38" fill="${C.fox}" ${ink}/>` + head(look.back ? 215 : 80, 98, 34);
|
||||
break;
|
||||
case 'lie':
|
||||
body = tail('M250 205 Q 285 215 290 180') + `<ellipse cx="170" cy="192" rx="92" ry="30" fill="${C.fox}" ${ink}/>`
|
||||
+ leg(70, 215, 222) + head(72, 178, 32);
|
||||
break;
|
||||
case 'curl':
|
||||
body = `<circle cx="150" cy="160" r="66" fill="${C.fox}" ${ink}/>` + tail('M205 200 Q 170 235 110 205') + head(125, 168, 30);
|
||||
break;
|
||||
}
|
||||
return look.right ? `<g transform="translate(300 0) scale(-1 1)">${body}</g>` : body;
|
||||
}
|
||||
|
||||
const FOXES: Record<string, FoxLook> = {
|
||||
'fox-watching': { pose: 'sit', eyes: 'open', back: true },
|
||||
'fox-curious': { pose: 'stand', eyes: 'open', tilt: -14 },
|
||||
'fox-sitting': { pose: 'sit', eyes: 'half' },
|
||||
'fox-resting': { pose: 'lie', eyes: 'half' },
|
||||
'fox-petted': { pose: 'sit', eyes: 'closed', tilt: -18 },
|
||||
'fox-brushed': { pose: 'sit', eyes: 'half', fluffed: true, tilt: 8 },
|
||||
'fox-eating': { pose: 'stand', eyes: 'closed', tilt: -30 },
|
||||
'fox-asleep': { pose: 'curl', eyes: 'closed' },
|
||||
'fox-trotting': { pose: 'stand', eyes: 'open' },
|
||||
'fox-leading': { pose: 'stand', eyes: 'open', right: true, back: true },
|
||||
'fox-carrying-petal': { pose: 'stand', eyes: 'half', petal: true },
|
||||
'fox-visiting': { pose: 'sit', eyes: 'half', tilt: 16 }
|
||||
};
|
||||
|
||||
/** Place a drawing made in a w × h box centred in the target, filling about 76 %. */
|
||||
function fit(body: string, w: number, h: number, W: number, H: number, fill = 0.76): string {
|
||||
const s = Math.min((W * fill) / w, (H * fill) / h);
|
||||
@@ -128,6 +212,51 @@ const PROPS: Record<string, string> = {
|
||||
<path d="M62 134 v46 M138 134 v46 M80 134 v36 M120 134 v36" stroke="${C.wood}" stroke-width="9" stroke-linecap="round"/>`
|
||||
};
|
||||
|
||||
const berries = (fill: string, at: readonly (readonly [number, number])[], r: number, leaves = 1): string =>
|
||||
Array.from({ length: leaves }, (_, i) => `<ellipse cx="${80 + i * 40}" cy="58" rx="30" ry="13" fill="${C.leaf}" stroke="${C.ink}" stroke-width="4" transform="rotate(${i ? 25 : -25} ${80 + i * 40} 58)"/>`).join('')
|
||||
+ `<path d="M100 40 V 80" stroke="${C.moss}" stroke-width="5"/>`
|
||||
+ at.map(([x, y]) => `<circle cx="${x}" cy="${y}" r="${r}" fill="${fill}" stroke="${C.ink}" stroke-width="4"/>`).join('');
|
||||
|
||||
const bush = (extra: string): string =>
|
||||
[[60, 120, 50], [140, 120, 50], [100, 80, 56], [100, 140, 46]].map(([x, y, r]) => `<circle cx="${x}" cy="${y}" r="${r}" fill="${C.leaf}" stroke="${C.ink}" stroke-width="4"/>`).join('')
|
||||
+ `<path d="M70 70 q30 -14 60 0 M50 120 q20 -10 40 0 M115 125 q20 -10 40 0" fill="none" stroke="${C.moss}" stroke-width="4"/>` + extra;
|
||||
|
||||
/** The fox's food and the bush, each in a 200 × 200 box like PROPS. */
|
||||
const MORE_PROPS: Record<string, string> = {
|
||||
'wild-strawberries': berries(C.strawberry, [[70, 120], [110, 140], [140, 105]], 22, 2),
|
||||
blueberries: berries(C.blueberry, [[70, 120], [100, 140], [130, 120], [85, 95], [118, 95]], 16, 2),
|
||||
raspberries: berries(C.raspberry, [[72, 120], [110, 138], [138, 108]], 22),
|
||||
blackberries: berries(C.blackberry, [[72, 120], [110, 138], [138, 108]], 22),
|
||||
'rose-hips': `<circle cx="100" cy="115" r="80" fill="${C.lamp}" opacity=".3"/><path d="M100 30 V 70 M100 70 L 70 90 M100 70 L 130 90" stroke="${C.moss}" stroke-width="5" fill="none"/>`
|
||||
+ [[70, 125], [130, 125]].map(([x, y]) => `<ellipse cx="${x}" cy="${y}" rx="24" ry="34" fill="${C.hip}" stroke="${C.ink}" stroke-width="4"/><path d="M${(x ?? 0) - 8} ${(y ?? 0) + 34} l8 10 l8 -10" fill="${C.foxLeg}"/>`).join(''),
|
||||
'leaf-plate': `<path d="M20 110 Q 100 10 185 100 Q 100 190 20 110z" fill="${C.leaf}" stroke="${C.ink}" stroke-width="5"/><path d="M20 110 Q 100 100 185 100" fill="none" stroke="${C.moss}" stroke-width="5"/>`,
|
||||
'bush-resting': bush(''),
|
||||
'bush-flowering': bush([[55, 100], [100, 60], [145, 105], [90, 135], [125, 150]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="9" fill="${C.paper}" stroke="${C.ink}" stroke-width="3"/><circle cx="${x}" cy="${y}" r="3" fill="${C.amber}"/>`).join('')),
|
||||
'bush-ripe': bush([[60, 105], [138, 108], [100, 70]].map(([x, y]) => `<ellipse cx="${x}" cy="${y}" rx="20" ry="15" fill="${C.lamp}" stroke="${C.moss}" stroke-width="3"/>`).join('')),
|
||||
'fox-brush': `<path d="M30 110 Q 30 70 100 70 Q 170 70 170 110z" fill="${C.wood}" stroke="${C.ink}" stroke-width="5"/>`
|
||||
+ Array.from({ length: 12 }, (_, i) => `<path d="M${40 + i * 11} 112 v26" stroke="${C.cream}" stroke-width="6" stroke-linecap="round"/>`).join('')
|
||||
};
|
||||
|
||||
const meadow = (path: string): string =>
|
||||
`<ellipse cx="100" cy="200" rx="92" ry="190" fill="${C.meadow}" stroke="${C.ink}" stroke-width="3" stroke-dasharray="10 8"/>${path}`;
|
||||
const lantern = (lit: boolean): string =>
|
||||
(lit ? `<circle cx="140" cy="170" r="60" fill="${C.lamp}" opacity=".45"/>` : '')
|
||||
+ `<path d="M60 390 V 80 Q 60 40 100 40 Q 140 40 140 80 V 110" fill="none" stroke="${C.wood}" stroke-width="14" stroke-linecap="round"/>`
|
||||
+ `<rect x="115" y="130" width="50" height="72" rx="8" fill="${lit ? C.lamp : '#e8eef0'}" stroke="${C.ink}" stroke-width="5"/>`
|
||||
+ `<path d="M115 130 l25 -18 l25 18" fill="${C.foxLeg}" stroke="${C.ink}" stroke-width="4"/>`
|
||||
+ `<rect x="133" y="160" width="14" height="30" fill="${C.paper}" stroke="${C.ink}" stroke-width="3"/>`
|
||||
+ (lit ? `<path d="M140 160 q-8 -12 0 -22 q8 10 0 22z" fill="${C.amber}" stroke="${C.ink}" stroke-width="2"/>` : '');
|
||||
|
||||
/** Tall things, each in a 200 × 400 box: the path stretches and the lanterns. */
|
||||
const TALL: Record<string, string> = {
|
||||
'path-prints': meadow([340, 290, 240, 190, 140, 95, 55].map((y, i) => `<ellipse cx="${100 + (i % 2 ? 12 : -12) * (1 - i / 9)}" cy="${y}" rx="${9 - i}" ry="${7 - i * 0.7}" fill="${C.soil}"/>`).join('')),
|
||||
'path-trail': meadow(`<path d="M92 385 Q 120 260 96 160 T 100 15" fill="none" stroke="#c8d8a8" stroke-width="22" stroke-linecap="round"/><path d="M92 385 Q 120 260 96 160 T 100 15" fill="none" stroke="${C.soil}" stroke-width="5" stroke-dasharray="4 18"/>`),
|
||||
'path-road': meadow(`<path d="M60 388 Q 110 260 88 160 T 92 15 L 108 15 Q 120 120 112 170 T 140 388z" fill="${C.soil}" stroke="${C.ink}" stroke-width="4"/>`
|
||||
+ [[52, 360], [148, 360], [70, 260], [130, 255], [80, 160], [118, 150], [88, 70], [110, 65]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="7" fill="#c9bcae" stroke="${C.ink}" stroke-width="2"/>`).join('')),
|
||||
'lantern-unlit': lantern(false),
|
||||
'lantern-lit': lantern(true)
|
||||
};
|
||||
|
||||
function garden(W: number, H: number, time: 'morning' | 'day' | 'sunset' | 'night'): string {
|
||||
const tint = {
|
||||
morning: { field: '#b8d1a0', far: '#c9dbe0', wall: '#b4a596', light: '#ffffff' },
|
||||
@@ -149,6 +278,14 @@ function single(a: Asset): string {
|
||||
const { width: W, height: H } = a;
|
||||
switch (a.type) {
|
||||
case 'sheet': {
|
||||
if (a.character === 'fox') {
|
||||
const views: FoxLook[] = [{ pose: 'sit', eyes: 'half' }, { pose: 'stand', eyes: 'half' }, { pose: 'stand', eyes: 'half', tilt: -8 }, { pose: 'sit', eyes: 'half', behind: true }];
|
||||
const figures = views.map((l, i) => `<g transform="translate(${30 + i * 375} 60) scale(1.15)">${fox(l)}</g>`).join('');
|
||||
const heads: FoxLook[] = [{ pose: 'sit', eyes: 'half' }, { pose: 'sit', eyes: 'open', tilt: -14 }, { pose: 'sit', eyes: 'closed' }];
|
||||
// Close-ups: only the head, cropped by a nested viewBox.
|
||||
const close = heads.map((l, i) => `<svg x="${200 + i * 400}" y="620" width="320" height="320" viewBox="90 10 120 120">${fox(l)}</svg>`).join('');
|
||||
return `<rect width="${W}" height="${H}" fill="${C.paper}"/>${figures}${close}`;
|
||||
}
|
||||
const looks: RoseLook[] = [
|
||||
{ stage: 'full', eyes: 'half', mouth: 'smile' },
|
||||
{ stage: 'full', eyes: 'half', mouth: 'smile', tilt: -12 },
|
||||
@@ -166,7 +303,7 @@ function single(a: Asset): string {
|
||||
return `<rect width="${W}" height="${H}" fill="${C.paper}"/>${figures}${close}`;
|
||||
}
|
||||
case 'sprite':
|
||||
return fit(PROPS[a.id] ?? '', 200, 200, W, H, 0.7);
|
||||
return fit(drawing(PROPS, a.id), 200, 200, W, H, 0.7);
|
||||
case 'layer': {
|
||||
const time = (['morning', 'day', 'sunset', 'night'] as const).find((t) => a.id.endsWith(t)) ?? 'day';
|
||||
return garden(W, H, time);
|
||||
@@ -179,11 +316,21 @@ function single(a: Asset): string {
|
||||
}
|
||||
}
|
||||
|
||||
/** A stand-in drawing by id. A picture with none fails the build rather than showing an empty box. */
|
||||
function drawing(from: Record<string, string>, id: string): string {
|
||||
const d = from[id];
|
||||
if (d === undefined) throw new Error(`tools/art-prep/src/placeholders.ts has no stand-in drawing for "${id}"`);
|
||||
return d;
|
||||
}
|
||||
|
||||
/** One cell's drawing, sized to the cell it ships at. */
|
||||
function cellBody(id: string, W: number, H: number): string {
|
||||
const look = ROSES[id];
|
||||
if (look) return fit(rose(look), 200, 520, W, H);
|
||||
return fit(PROPS[id] ?? '', 200, 200, W, H, 0.7);
|
||||
const pose = FOXES[id];
|
||||
if (pose) return fit(fox(pose), 300, 240, W, H);
|
||||
if (id in TALL) return fit(drawing(TALL, id), 200, 400, W, H);
|
||||
return fit(drawing({ ...PROPS, ...MORE_PROPS }, id), 200, 200, W, H, 0.7);
|
||||
}
|
||||
|
||||
function sheet(a: Asset): string {
|
||||
|
||||
Reference in New Issue
Block a user