diff --git a/docs/decisions.md b/docs/decisions.md index 59efe04..3f00f39 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -190,6 +190,8 @@ CPU の打ち上げは中央値 0 個だった。取り方がどこにも書い | 取り方を「遊び方」に書く | 「最下段に居座るので、指で山の高いところまで運び、その下で点火して一緒に打ち上げる」 | 知っていれば狙える腕の見せ所。知らないと、壊せないマスが 1 試合に 4 つ溜まるだけになる | | 打ち上げの演出 | `+10,000` の吹き出し・閃光・揺れ・専用の音(`rareLaunch`) | 1 手で得点の 1 割が入るのに、打ち上げの音がわずかに違うだけだった | | 結果画面 | 打ち上げた個数を 1 行足す(0 個のときは出さない) | 次は狙おうと思える | +| 見た目 | 磨いた金属の地(真ん中に暗い帯を挟んだ鏡面)に、種類の色の太い縁と宝石の柄。斜めの照り返しが 1.5 秒ごとに横切る(`tile.ts`) | 火花のレアメタルは五角の隕石と同じ桃色で、盤面の中で見分けにくかった。色ではなく質感で分ける。面ぜんたいを明滅させる前のやり方は、点火したての光りと紛れた | +| 取り方の札 | 一度も宇宙へ出したことのない端末では、降ってきたたびに大気圏の帯へ「RARE METAL / 山の上まで運び、その下で点火して打ち上げる」を 3.5 秒出す。1 個でも出したら覚えて(`novaria.tips.v1`)出さない | 遊び方に書いても、読まずに遊ぶ人は知らないまま最下段に溜める。遊んでいる最中に出すので、盤面を隠さない大気圏の帯に置く。出せたなら取り方は分かっている | | 上がりやすさ | 変えない | 実測では、高さ 7 段以上で 3 個点火すれば乗せたレアメタルごと宇宙へ出る。低い位置では届かない(持ち上げる隕石が多い)。ルールではなく、知っているかどうかの差 | ## 燃えカス diff --git a/e2e/effects.spec.ts b/e2e/effects.spec.ts index b4362b6..7a7b36b 100644 --- a/e2e/effects.spec.ts +++ b/e2e/effects.spec.ts @@ -76,3 +76,39 @@ test('遊んでいる最中の節目の帯は大気圏の帯に出し、始ま await page.waitForFunction(() => window.__novaria.fx.bannerTitle === 'MAX LEVEL'); expect(await page.evaluate(() => window.__novaria.fx.bannerPlace)).toBe('sky'); }); + +/** 山の高いところにレアメタルを乗せた列。点火するとレアメタルごと宇宙へ出る */ +const RARE_LAUNCH: number[][] = [ + [ + ...Array.from({ length: 7 }, (_, i) => (i % 2 === 0 ? 0 : 7)), + 1, + 1, + 1, + 10, + ], +]; + +/** 次に隕石を降らせるときにレアメタルを落とす */ +async function dropRareMetal(page: import('@playwright/test').Page): Promise { + await page.evaluate(() => { + (window.__novaria.game as unknown as { rareTimer: number }).rareTimer = 1; + }); +} + +// レアメタルは取り方を知らないと最下段に溜まるだけになる。 +// 一度も打ち上げたことのない端末では、降ってきたときに取り方を帯で出す +test('レアメタルを打ち上げたことがないうちは、降ってきたときに取り方を大気圏の帯に出す', async ({ page }) => { + await startGame(page); + await dropRareMetal(page); + await page.waitForFunction(() => window.__novaria.fx.bannerTitle === 'RARE METAL'); + expect(await page.evaluate(() => window.__novaria.fx.bannerPlace)).toBe('sky'); + + // 打ち上げたら覚えて、次からは出さない + await page.evaluate((c) => window.__novaria.setColumns(c), RARE_LAUNCH); + await page.waitForFunction(() => window.__novaria.game.launched.rare > 0); + await page.evaluate(() => window.__novaria.start()); + await page.waitForFunction(() => window.__novaria.fx.bannerTitle === 'MISSION START'); + await dropRareMetal(page); + await page.waitForFunction(() => window.__novaria.game.ground.some((col) => col[0]?.kind === 10)); + expect(await page.evaluate(() => window.__novaria.fx.bannerTitle)).not.toBe('RARE METAL'); +}); diff --git a/src/main.ts b/src/main.ts index b0df05e..d5edf2d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -44,6 +44,7 @@ import { openMatchSocket } from './online/socket'; import { backdropHtml, skyHtml } from './render/sky'; import { NEWS, isUnread, markNewsRead, unreadNews } from './render/news'; import { setUpUpdates, takeUpdatedMark, updateCheckCount } from './render/update'; +import { knowsRareMetal, learnRareMetal } from './render/tips'; import { View } from './render/view'; const canvas = document.getElementById('game') as HTMLCanvasElement; @@ -843,7 +844,7 @@ function privacyHtml(): string {

扱う情報

この端末にだけ残すもの

-

遊び手の id(初めて開いたときに作る無作為の番号)、名前、自己ベスト、惑星めぐりの到達、対戦の戦績(相手の名前ごとの勝ち負け)、お知らせをどこまで読んだかの印、音の切り替え。ブラウザのサイトデータを消すと消える。

+

遊び手の id(初めて開いたときに作る無作為の番号)、名前、自己ベスト、惑星めぐりの到達、対戦の戦績(相手の名前ごとの勝ち負け)、お知らせをどこまで読んだかの印、レアメタルを打ち上げたことがあるかの印、音の切り替え。ブラウザのサイトデータを消すと消える。

ランキングに送るもの

名前を決めた人の 1 人用の結果だけ。id・名前・スコア・打ち上げ数・最大連続点火・時間・送った時刻を残す。表に出るのは上位 50 人の名前とスコアで、id は誰にも見せない。

送りすぎを止めるため、接続元の IP アドレスを日付と混ぜて元に戻せない形(ハッシュ)にしたものも残す。IP アドレスそのものは残さない。

@@ -1921,6 +1922,7 @@ function step(): void { fx.addShake(1.5 + Math.min(10, ev.screenOut.length)); // レアメタルは 1 個 10,000 点。得点の 1 割を超える 1 手なので、ここだけ別に出す if (ev.screenOutRare > 0) { + learnRareMetal(); fx.popup( L.fieldX + L.fieldW / 2, view.rowTop(VISIBLE_ROWS - 2), @@ -1956,6 +1958,11 @@ function step(): void { fx.burst(view.colLeft(ev.rareMetal) + L.cell / 2, view.rowTop(r) + L.cell / 2, Kind.Spark, 4); } fx.popup(view.colLeft(ev.rareMetal) + L.cell / 2, view.rowTop(8), 'レアメタル', '#ff9ad8', 26); + // 取り方を知らないと、壊せないマスが最下段に溜まるだけになる。 + // 一度も打ち上げたことのない端末では、降ってきたたびに取り方を出す(遊びを止めない大気圏の帯) + if (!knowsRareMetal()) { + fx.banner('RARE METAL', '山の上まで運び、その下で点火して打ち上げる', '#ff9ad8', 210, 0, 'sky'); + } } if (ev.landed > 0) audio.land(ev.landed, ev.lumpLanded > 0); if (ev.reverted > 0) audio.revert(ev.reverted); diff --git a/src/render/news.ts b/src/render/news.ts index 7322f41..c4b2af8 100644 --- a/src/render/news.ts +++ b/src/render/news.ts @@ -19,6 +19,15 @@ export interface NewsItem { } export const NEWS: readonly NewsItem[] = [ + { + id: '2026-10-01-2', + date: '2026.10.01', + title: 'レアメタルを見分けやすくした', + lines: [ + 'レアメタルは磨いた金属の板に見え、ときどき光が横切る。同じ色の隕石と見分けがつく。', + 'まだ打ち上げたことがないうちは、降ってきたときに取り方を上の帯に出す。', + ], + }, { id: '2026-10-01', date: '2026.10.01', diff --git a/src/render/tile.ts b/src/render/tile.ts index f084c9d..370275c 100644 --- a/src/render/tile.ts +++ b/src/render/tile.ts @@ -1,5 +1,5 @@ import { Glyph, LOOKS } from './theme'; -import { Kind } from '../core/types'; +import { Kind, isRareMetal } from '../core/types'; /** 角の丸い四角を引く */ function roundRect(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number): void { @@ -115,8 +115,8 @@ export interface TileOptions { burn?: number; /** 炎の揺らぎの駒番号。数フレームごとに進めると火が動いて見える */ burnPhase?: number; - /** レアメタルの明滅 */ - shimmer?: number; + /** レアメタルの照り返しの帯がどこまで横切ったか(0〜1。1 以上で出さない) */ + glint?: number; alpha?: number; } @@ -303,12 +303,29 @@ export function drawTile( ctx.stroke(); } - if (opts.shimmer) { - ctx.globalCompositeOperation = 'lighter'; - ctx.fillStyle = `rgba(255,255,255,${0.35 * opts.shimmer})`; + // レアメタルの照り返し。斜めの光の帯が面を横切る。 + // 面ぜんたいを明滅させると、点火したての隕石の光りと見分けがつかなかった + if (opts.glint !== undefined && opts.glint < 1) { + ctx.save(); roundRect(ctx, x + pad, y + pad, w, w, r); - ctx.fill(); - ctx.globalCompositeOperation = 'source-over'; + ctx.clip(); + ctx.globalCompositeOperation = 'lighter'; + const at = x + pad - w * 0.6 + opts.glint * w * 2.2; + for (const [off, width, a] of [ + [0, 0.22, 0.55], + [0.3, 0.08, 0.4], + ] as const) { + const bx = at + off * w; + ctx.fillStyle = `rgba(255,255,255,${a})`; + ctx.beginPath(); + ctx.moveTo(bx, y + pad + w); + ctx.lineTo(bx + width * w, y + pad + w); + ctx.lineTo(bx + width * w + w * 0.5, y + pad); + ctx.lineTo(bx + w * 0.5, y + pad); + ctx.closePath(); + ctx.fill(); + } + ctx.restore(); } if (opts.flash) { @@ -349,10 +366,21 @@ function paintTile( const cy = y + size / 2; const dust = kind === Kind.Dust; - // 地の色。上が明るく下が暗い + const metal = isRareMetal(kind); + // 地の色。上が明るく下が暗い。 + // レアメタルは磨いた金属の地にする。真ん中に暗い帯を挟むと、景色を映した鏡面に見える。 + // 同じ色味の隕石(火花と五角)と、色ではなく質感で見分けられるようにする const grad = ctx.createLinearGradient(x, y, x, y + size); - grad.addColorStop(0, look.light); - grad.addColorStop(1, look.dark); + if (metal) { + grad.addColorStop(0, '#fbfcff'); + grad.addColorStop(0.42, '#b8c1d4'); + grad.addColorStop(0.5, '#5c6580'); + grad.addColorStop(0.58, '#d7deec'); + grad.addColorStop(1, '#6d7690'); + } else { + grad.addColorStop(0, look.light); + grad.addColorStop(1, look.dark); + } ctx.fillStyle = grad; roundRect(ctx, x + pad, y + pad, w, w, r); ctx.fill(); @@ -387,7 +415,18 @@ function paintTile( ctx.stroke(); ctx.restore(); - // 縁 + // 縁。レアメタルは種類の色で太く縁取り、内側に細い光を返す(はめ込んだ板に見える) + if (metal) { + const rim = Math.max(2, size * 0.1); + ctx.strokeStyle = look.dark; + ctx.lineWidth = rim; + roundRect(ctx, x + pad + rim / 2, y + pad + rim / 2, w - rim, w - rim, r * 0.8); + ctx.stroke(); + ctx.strokeStyle = 'rgba(255,255,255,0.7)'; + ctx.lineWidth = Math.max(1, size * 0.025); + roundRect(ctx, x + pad + rim, y + pad + rim, w - rim * 2, w - rim * 2, r * 0.6); + ctx.stroke(); + } ctx.strokeStyle = look.ink; ctx.lineWidth = Math.max(1, size * EDGE); roundRect(ctx, x + pad, y + pad, w, w, r); @@ -447,11 +486,18 @@ function paintTile( drawGlyph(ctx, look.glyph, cx, gy + Math.max(1, size * 0.03), size); if (stroked) ctx.stroke(); else ctx.fill(); - ctx.fillStyle = look.ink; - ctx.strokeStyle = look.ink; + // レアメタルの柄は種類の色の宝石。金属の地の上で色だけが浮く + ctx.fillStyle = metal ? look.dark : look.ink; + ctx.strokeStyle = metal ? look.dark : look.ink; drawGlyph(ctx, look.glyph, cx, gy, size); if (stroked) ctx.stroke(); else ctx.fill(); + if (metal) { + ctx.lineWidth = Math.max(1, size * 0.025); + ctx.strokeStyle = look.ink; + drawGlyph(ctx, look.glyph, cx, gy, size); + ctx.stroke(); + } } } diff --git a/src/render/tips.ts b/src/render/tips.ts new file mode 100644 index 0000000..297f913 --- /dev/null +++ b/src/render/tips.ts @@ -0,0 +1,33 @@ +/** + * 遊びの中で 1 度だけ教える札を、もう教えたかどうか。端末の localStorage(`novaria.tips.v1`)に残す。 + * いまはレアメタルの取り方だけ。打ち上げたことがあれば、取り方は分かっているとみなす + */ +const KEY = 'novaria.tips.v1'; + +interface Tips { + rareMetal?: boolean; +} + +function read(): Tips { + try { + const raw = JSON.parse(localStorage.getItem(KEY) ?? 'null') as Tips | null; + return raw && typeof raw === 'object' ? raw : {}; + } catch { + return {}; + } +} + +/** レアメタルを宇宙へ出したことがあるか */ +export function knowsRareMetal(): boolean { + return read().rareMetal === true; +} + +/** レアメタルを宇宙へ出した。次からは取り方を出さない */ +export function learnRareMetal(): void { + if (knowsRareMetal()) return; + try { + localStorage.setItem(KEY, JSON.stringify({ ...read(), rareMetal: true })); + } catch { + /* 残せなくても遊びは止めない。次も取り方を出すだけ */ + } +} diff --git a/src/render/view.ts b/src/render/view.ts index 31e2a5a..0f2a42c 100644 --- a/src/render/view.ts +++ b/src/render/view.ts @@ -1079,7 +1079,8 @@ export class View { fx.ember(x + L.cell / 2, y + L.cell * 0.35, heat, L.cell * 0.6); } } - if (isRareMetal(kind)) opts.shimmer = 0.5 + 0.5 * Math.sin(game.frame * 0.25); + // 照り返しは 1.5 秒ごとに 0.4 秒かけて横切る。列ごとにずらして、揃って光らないようにする + if (isRareMetal(kind)) opts.glint = ((game.frame + col * 23) % 90) / 24; drawTile(ctx, kind, x, y, L.cell, opts); }