跳过主要内容
WEB
Skill免费GameSkill 出品GameSkill 原创

Tower Defense Power Grid (relays, light beam, night)

/mechanic-tower-defense-power-grid

A GameSkill original: towers fire only while linked to the power source through relays, a fixed capacity is shared in a stable order so new towers never black out old ones, selling recomputes and reports a brownout, a movable light beam adds damage and slow, and at night towers need light to see far.

许可证
MIT
出品
GameSkill 出品
下载 ZIP

我们测过

在 Canvas 2D in Chrome 156 headless 上通过 39/39 项检查(2026-10-28):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。

测试报告

GameSkill 测过的版本

GameSkill 为 gameskill.dev 原创编写并测过。ZIP 里是完整的 skill:SKILL.md 及中文版、脚本、可运行示例、测试、自检清单和我们的测试报告。

下载测过的 ZIP(612 KB)路线图:玩法机制

GameSkill 原创,协议 MIT。ZIP 保留 LICENSE 和 CREDITS.md,里面列出了流程灵感来源、CC0 测试素材和第三方库及其协议。

Tower Defense Power Grid (relays, light beam, night)

自检清单

  • 卖掉中继后,下游的塔立刻停火,并提示断电 / Selling a relay stops the towers behind it at once and shows a brownout
  • 新建的塔不会让已有的塔断电 / Building a new tower never switches off an existing one
  • 塔不会把电转发给别的塔 / Towers never pass power on
  • 光束的增伤和减速用同一个范围判断 / The beam's damage bonus and slow use the same in-spot test
  • 夜里画面上看不见的敌人,塔也打不到 / At night, enemies you cannot see are enemies no tower can shoot
  • npm test 和 npm run test:browser 都通过 / npm test and npm run test:browser pass

中文指南

这个 skill 做什么

GameSkill 原创(MIT)。在普通的塔防上加一层电网:塔必须经过中继连到电源才能开火,电源容量有限,按“优先级 → 建造先后 → 跳数”稳定分配,所以新塔永远不会让老塔断电;卖掉中继会重算下游并提示断电。另有一束可以移动的光:光斑里伤害 +25%、速度 −15%;夜里塔只能看到射程 70% 以内的敌人,更远的必须被光束、灯塔或有电的中继照亮。

什么时候用

  • 在做塔防,想加电力、能量、电塔、中继
  • 想做夜战、照明、探照灯玩法
  • 塔会因为造了别的东西而莫名其妙地开开关关

怎么装

下载本页的 ZIP,把 mechanic-tower-defense-power-grid/ 文件夹放进 .claude/skills/(Claude Code)或 .agents/skills/(Codex、Cursor),重启 agent。没有运行时依赖。

最小示例

示例《港口灯塔》:16×9 棋盘,灯塔就是电源。node test/serve.mjs 后打开 http://localhost:8770/;先点工具再点棋盘,选 Beam 后拖动光束,N 切换昼夜。加 ?demo 看脚本演示:入夜、卖掉中继造成断电、再建回来。

我们怎么测的

npm test 跑 14 个 Node 测试:连线范围、中继串联、塔不转发、容量截断和置顶、建造先后优先于距离、卖中继和卖塔的重算、光束限速、增伤和减速、夜间视野和灯光,还有两场完整战斗:同一波怪在有中继时零漏怪、没中继时大量漏怪;夜里开光束守住、不开守不住。npm run test:browser 在无头 Chrome 里用触屏点击做 11 项检查,包括建造、出售、断电提示、光束移动、夜间可见性和没有控制台错误。

致谢

设计思路来自 stackloomdev 的 Last Beacon(MIT):灯塔经中继供电、容量有限、可操控的光束、取决于光照的夜间视野。我们沿用了 +25% 伤害、−15% 速度、70% 视野这三个数值,代码、布局和文字都是我们写的。

搭配

  • tower-defense:路径、波次、索敌模式
  • web-audio-sfx-synth:断电、开火、夜晚环境声的合成音效
  • game-feel:断电闪烁、命中反馈

安装

告诉你的 AI

Install the skill from https://gameskill.dev/skills/mechanic-tower-defense-power-grid/install.md

GameSkill 测过的版本

测过的版本装到 .claude/skills/
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/mechanic-tower-defense-power-grid.zip -o /tmp/gameskill-mechanic-tower-defense-power-grid.zip
unzip -oq /tmp/gameskill-mechanic-tower-defense-power-grid.zip -d .claude/skills
rm /tmp/gameskill-mechanic-tower-defense-power-grid.zip

包含内容

  • Harbor Lamp: a 16x9 Canvas 2D board with a lighthouse, relays, three tower types, tap and keyboard controls
  • src/logic.js: link ranges, BFS from the source, stable capacity allocation, recompute with lost and gained lists
  • A light beam that moves at a capped speed and gives +25% damage and 15% slow inside its spot
  • Night sight: 70% of tower range unless the enemy is lit by the beam, the source or a powered relay
  • 14 Node tests (including whole-wave fights) and an 11-check headless Chrome test

适合

  • Tower defense games with power, energy, pylons or relays
  • Night waves, lighting and spotlight mechanics
  • Fixing towers that switch on and off when unrelated things are built

不适合

  • Paths, wave design and targeting modes on their own (see tower-defense)
  • Electrical simulation with voltage, losses or flow

试试这条提示词

提示词
Add a power grid to my tower defense: towers need to be connected to the generator through pylons, power is limited, and selling a pylon should cut the towers behind it.

关于这个 Skill

A GameSkill original, written and tested for gameskill.dev under MIT. The demo, Harbor Lamp: a lighthouse powers towers through relays on a 16×9 board, with a steerable beam for night waves. All rules are in src/logic.js (no DOM).

Agent steps

  1. Nodes, not towers: one list; connected, hops, powered are rewritten only by recompute(grid).
  2. Recompute on every change and return lost / gained for a brownout pop-up.
  3. Towers never relay; only the source and relays transmit.
  4. Stable allocation: priority, then build order, then hops. A new tower never blacks out an old one.
  5. Show the cause: live and dead cables, link-range rings, ⚡! (over capacity) vs ⚡✕ (no link).
  6. Beam as a moving spot with a capped speed; damage bonus and slow use the same inBeam test.
  7. Night sight in one function shared by targeting and rendering; powered relays are lamps too.
  8. Prove it with fights: the same wave with and without the relay, at night with and without the beam.

Common errors it fixes

  • Towers flickering because allocation depends on distance or array order.
  • Towers still firing after their relay was sold.
  • Night rules that hide enemies on screen but not from targeting.

Credits

Design ideas from Last Beacon by stackloomdev (MIT). Code, layout and text are ours.

环境要求

  • Any engine: the rules are plain JavaScript and port line by line
  • Node.js 20+ to run the tests; Chrome for the browser check

相关主题

常见问题

基于 Last Beacon (作者 stackloomdev,MIT)的思路。代码和文字由 GameSkill 编写,ZIP 里的 CREDITS.md 列出所有来源。

搭配使用

作者标注的相关 Skills,或更适合相邻任务的 Skills。

相似 skills

open-game-skills
GDT
Starter Kit
6

open-game-skills

An MIT pack of about 190 SKILL.md agent skills for game design: combat feel, camera, traversal, world, validation, 2D/Spine and art pipeline, with a dispatcher and adapters for Three.js, PixiJS, Phaser, Cocos, Godot, Unity and Unreal.

Engine-agnosticGodotUnityClaude Code · Codex +1
Kart Drift Boost
WEB
Skill
GameSkill 出品

Kart Drift Boost (tiers, windows, ramps)

A GameSkill original: arcade kart drift-boost rules that reward skill. Drifts charge three tiers, release opens a 0.85 s window you must press in, counter-steer adds a CUT bonus, ramps give one air and one landing boost, boosts take the maximum instead of stacking, and walls cancel everything pending.

Web (Phaser / Three.js)Engine-agnosticClaude Code · Codex +2
One-button Flight
WEB
Skill
GameSkill 出品

One-button Flight (fair tap-to-flap)

A GameSkill original: the rules of a one-button flight game that is never unfair. Flaps set speed instead of adding it, a fixed-step simulation plays the same at 30 and 144 fps, the hitbox forgives grazes, and a seeded gap generator stays inside the reachable band, checked by an autopilot.

Web (Phaser / Three.js)Engine-agnosticClaude Code · Codex +2
Procedural Low-Poly Buildings
WEB
Skill
GameSkill 出品

Procedural Low-Poly Buildings (kit, validator, views)

A GameSkill original: build stylised low-poly buildings in code from a small spec, then prove them: plot and height limits, a triangle budget per tier, closed outward meshes, supported parts, level roofs and side-only taper measured from silhouettes, plus front, side, top and 3/4 renders checked against the geometry.

Web (Phaser / Three.js)Engine-agnosticClaude Code · Codex +2