SOURCE / PINNED RELEASE
Made of little things.
Gem Warden
- Release
- 7c457bfe5427…
- Author-recorded commit
- fb5453b5fc06…
- License
- LICENSE
- Author’s source reference
- nostr://npub1eg5pfnws6tg6rtp33tugpppqtv5u05crmf983qp438cdycwzngys0gxzcs/wss%3A%2F%2Fgit.napplet.soy%2F/n-3929629ef1d
Archive hash verified: 895b8dd430aad9fe…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
// Damage one structure deals to a stream of unkillable monsters, per monster.
// node tests/gem-damage.ts: rows are colour x kind, columns are gem grades.
import * as G from '../src/game.ts';
export function damagePerMonster(kind: G.StructKind, color: G.GemColor, grade: number, armor: number, interval: number): number {
const g = G.newGame(4); // Crossroads: every colour, a long straight first leg
g.mana = 1e9;
g.manaCap = 1e9;
// On the path for a trap, beside it for a tower, a few tiles in.
const [x, y] = kind === 'trap' ? [6, 6] : [6, 7];
const s = G.build(g, kind, x, y)!;
s.gem = { id: 0, mass: Math.pow(2, grade - 1), comp: { [color]: 1 }, kills: 0 };
g.waves = [];
const n = 20;
const hp = 1e9;
for (let i = 0; i < n; i++)
g.monsters.push({ id: 100 + i, type: 'crawler', dist: -i * interval, hp, maxHp: hp, armor, speed: 1, slowF: 0, slowT: 0, poisonDps: 0, poisonT: 0, ward: 0, regen: 0, mana: 0, wobble: 0, x: 0, y: 6 });
const all = [...g.monsters];
for (let t = 0; t < 40; t += 0.05) G.step(g, 0.05);
return all.reduce((d, m) => d + (hp - m.hp), 0) / n;
}
const grades = [1, 3, 6];
for (const armor of [0, 8])
for (const interval of [0.6, 0.32]) {
console.log(`armor ${armor}, spacing ${interval}s grades ${grades.join(' / ')}`);
for (const color of G.COLORS)
for (const kind of ['tower', 'trap'] as const)
console.log(` ${(color + ' ' + kind).padEnd(14)} ${grades.map((gr) => damagePerMonster(kind, color, gr, armor, interval).toFixed(0).padStart(6)).join('')}`);
}
