一个基于浏览器的回合制游戏:默认 1 名人类玩家对战 7 个机器人(可配置总人数 2~64)。
- 页面加载后可在浏览器中完整运行。
- 可配置人数:默认 8 人(1 人类 + 7 机器人),支持 2~64 人。
- 移动端友好布局,包含行动控制区与环形竞技场。
- UI 支持中英文切换。
- 已实现比赛/回合流程与确定性伤害结算。
- 攻击可视化指示:单体攻击使用弧形箭头,多目标攻击使用聚合徽标/高亮。
- 一局游戏包含多场 match。
- 一场 match 包含多个 round。
- 每回合阶段:
- 行动锁定阶段:玩家秘密选择行动;仅当人类玩家锁定行动后进入下一阶段。
- 导弹分配阶段:显示所有已锁定行动;导弹使用者按随机顺序逐个分配目标。
- 展示结算阶段:导弹分配完成后执行结算并展示结果;玩家点击
Next Round继续。
- 当某回合至少有一名玩家死亡时,该 match 结束。
- 死亡玩家从整局游戏中淘汰。
- 存活者进入下一场 match 时重置状态(
0点气、0护盾、无蓄力)。 - 淘汰发生的当回合会先完整展示(包含被淘汰者),随后点击一次
Next Round进入下一场 match。 - 当仅剩 1 名玩家存活时,游戏结束,并显示
Next Match按钮用于重开新局。
- 每种防御行动都有确定性格挡区间,例如
0~3。 - 若来袭伤害落在区间内,则完全格挡。
- 若来袭伤害超出区间,则承受溢出伤害:
- 高于上限:
incoming - max - 低于下限:
min - incoming
- 高于上限:
- 对攻规则:若两名玩家在同一回合互相直接攻击,
- 伤害较低的一方承受差值作为对攻溢出伤害,
- 若伤害相等,双方都不承受对攻溢出,
- 这两次直接攻击不再计入各自的普通来袭伤害。
- 护盾用于吸收溢出伤害:
- 每个护盾最多吸收
2点溢出伤害。 - 所需破盾数 =
ceil(overwhelmed / 2)。 - 若现有护盾不足以吸收,则玩家死亡。
- 每个护盾最多吸收
gather:+1 点气。defense:消耗 0,格挡0~3。fist:每次消耗 0.5,可叠加,对单目标每次造成 0.5 伤害。wood sword:消耗 1,对单目标造成 1 伤害。stone sword:消耗 2,对单目标造成 2 伤害。iron sword:消耗 3,对单目标造成 3 伤害。gold sword:消耗 4,对单目标造成 4 伤害。diamond sword:消耗 5,对单目标造成 5 伤害。enchanted diamond sword:消耗 6,对单目标造成 6 伤害。llama:消耗 2,对所有其他玩家各造成 0.5 伤害;若施放者当回合死亡,则不造成伤害。missile:选择X枚导弹(消耗X + 1,总伤害X),并在展示 + 导弹分配阶段拆分目标。shield:消耗 2,格挡0~2,并增加一层护盾(上限 2)。prep:消耗 1,格挡0~3;若本回合未受伤,则下一次攻击 +1 伤害。dt defense:消耗 1,格挡0~4。hollow defense:消耗 2,格挡2~6。superior defense:消耗 3,格挡0~6。
- 非法行动会被拒绝(例如:点气不足,或护盾已达上限仍尝试
shield)。 Qi/点气在内部以0.5为最小单位存储。- 机器人当前统一使用加权随机 AI 模式。
- 机器人基础规则包括:
- 第一回合必定
gather, - 行动仍保持随机,但会按局势加权(来袭威胁、消耗与伤害潜力),
- 防御行动会偏向单位成本下溢出防护效率更高的选项,
- 单体攻击会偏向预计更脆弱的对手,
- 仇恨权重:对本场 match 中对其造成累计伤害最高的对手为
2x,对最低气目标为1.5x, - 若没有存活对手点气大于 3,不使用
dt defense, - 若没有存活对手点气至少 5,不使用
hollow defense/superior defense, - 机器人不会使用
missile。
- 第一回合必定
- Match 切换规则:若本回合有人被淘汰,会先展示该回合结果(包含被淘汰者),点击一次
Next Round即进入下一场;若仅剩 1 人则进入Game Over,可点击Next Match重新开局。
使用维护者打包好的便携版:
- 解压
Wood-Sword-portable.zip。 - 打开解压后的文件夹。
- 双击
start-game.bat。
该包已包含:
- 构建产物(
dist), - 内置 Node 运行时(
runtime/node), - 本地启动脚本(
start-game.bat)。
启动器默认使用端口 4173,若被占用会自动切换到下一个可用端口。
运行:
npm run build:portable会生成 release/Wood-Sword-portable.zip,发送该 zip 给朋友即可。
要求:Node.js 18+
npm install
npm run dev打开 Vite 输出的本地地址。
运行引擎测试:
npm testA browser-based round game with a default roster of 1 human and 7 bots (configurable total player count: 2-64).
- Runs fully in the browser after page load.
- Configurable roster: default 8 players (1 human + 7 bots), supports 2-64 players.
- Mobile-friendly layout with action controls and a circular combat arena.
- English/Chinese language toggle in UI.
- Match/round flow implemented with deterministic damage checks.
- Visual attack indicators: curved arrows for single-target attacks, aggregate badges/highlights for multi-target attacks.
- A game has multiple matches.
- A match has multiple rounds.
- Round phases:
- Action lock phase: players choose actions in secret; round advances only when human locks action.
- Missile allocation phase: locked actions are visible; missile users choose target allocations one-by-one in random order.
- Display resolution phase: once missile allocations are done, actions resolve and results are revealed; player clicks
Next Roundto continue.
- A match ends when at least one player dies in a round.
- Dead players are eliminated from the game.
- Survivors start the next match with reset stats (
0points,0shields, no prep). - When elimination happens, that elimination round is shown first (including eliminated players), then one
Next Roundclick starts the next match. - Game ends when one player remains, and a
Next Matchbutton appears to restart a new game.
- Every defense action defines a deterministic block range, for example
0~3. - If incoming damage is inside the range, damage is fully blocked.
- If damage is outside the range, overwhelmed damage is applied:
- Above max:
incoming - max - Below min:
min - incoming
- Above max:
- Reciprocal duel rule: if two players directly attack each other in one round,
- lower attack damage takes overflow equal to the damage difference,
- equal damage means neither side takes duel overflow,
- those two direct attacks are otherwise canceled from normal incoming damage.
- Shields absorb overwhelmed damage:
- Each shield absorbs up to
2overwhelmed damage. - Broken shields needed =
ceil(overwhelmed / 2). - If available shields are insufficient, player dies.
- Each shield absorbs up to
gather: +1 point.defense: cost 0, blocks0~3.fist: cost 0.5 each, stackable, 0.5 damage each to one target.wood sword: cost 1, 1 damage to one target.stone sword: cost 2, 2 damage to one target.iron sword: cost 3, 3 damage to one target.gold sword: cost 4, 4 damage to one target.diamond sword: cost 5, 5 damage to one target.enchanted diamond sword: cost 6, 6 damage to one target.llama: cost 2, 0.5 damage to all other players, but deals no damage if the caster dies that round.missile: chooseXmissiles (costX + 1, total damageX), then split targets during the display + missile allocation phase.shield: cost 2, blocks0~2, add one shield (max 2).prep: cost 1, blocks0~3, next attack +1 damage if not damaged.dt defense: cost 1, blocks0~4.hollow defense: cost 2, blocks2~6.superior defense: cost 3, blocks0~6.
- Invalid actions are rejected (for example, not enough points or trying
shieldat cap 2). Qi/points are stored in0.5increments internally.- Bots now use one unified weighted-random AI mode.
- Bot baseline rules include:
- first round always
gather, - action picks remain random but are weighted by situation (incoming threat, cost, and damage potential),
- defense actions are biased toward better overflow prevention per cost,
- single-target attacks are biased toward opponents estimated to be more vulnerable,
- aggro multipliers:
2xagainst the opponent who has dealt this bot the most damage in the current match, and1.5xagainst lowest-Qi targets, dt defenseis not used unless an alive opponent has more than 3 points,hollow defense/superior defenseare not used unless an alive opponent has at least 5 points,- bots never use
missile.
- first round always
- Match transition rule: if someone is eliminated this round, that round is fully shown first (including eliminated players), then one
Next Roundclick starts the next match; if only one player remains, state entersGame OverandNext Matchcan restart the game.
Use the portable package produced by the maintainer:
- Unzip
Wood-Sword-portable.zip. - Open the extracted folder.
- Double-click
start-game.bat.
The package already includes:
- built game files (
dist), - bundled Node runtime (
runtime/node), - local launcher (
start-game.bat).
The launcher starts on port 4173 by default and automatically switches to the next free port if 4173 is occupied.
Run:
npm run build:portableThis creates release/Wood-Sword-portable.zip. Send that zip to your friend.
Requirements: Node.js 18+
npm install
npm run devOpen the local URL shown by Vite.
Run engine tests:
npm test