npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

koishi-plugin-kcd-dice

v0.2.0

Published

自用插件,天国:拯救骰子游戏,支持多人及人机对战。

Readme

koishi-plugin-kcd-dice

一个运行于 Koishi 的多人群聊骰子游戏插件。

本插件的骰子玩法设计灵感来自 《天国:拯救》,适合在 QQ 群聊中进行多人对局。

本项目为非官方插件,与《天国:拯救》及其开发、发行方没有官方关联。

功能

  • 支持多人群聊对局
  • 创建、加入和开始游戏
  • 玩家轮流投掷骰子
  • 选择骰子保留并累计回合分数
  • 继续冒险或保存当前回合分数
  • 无法计分时触发爆骰
  • 所有骰子计分后触发热骰
  • 自动切换玩家回合
  • 玩家操作超时自动结束当前回合
  • 支持目标分数和最大玩家数配置

安装

可以在 Koishi 控制台的插件市场中搜索:

kcd-dice

也可以通过包管理器安装:

npm install koishi-plugin-kcd-dice

或:

yarn add koishi-plugin-kcd-dice

安装后,在 Koishi 控制台中启用 kcd-dice 插件即可。

游戏流程

1. 创建对局

骰子开局

创建者会成为房主。

2. 加入对局

其他玩家发送:

骰子加入

至少需要两名玩家才能开始游戏。

3. 开始游戏

房主发送:

骰子开始

4. 投掷骰子

当前玩家发送:

骰子投掷

机器人会显示骰子及其编号,例如:

[1]⚀ [2]⚂ [3]⚄ [4]⚂ [5]⚂ [6]⚁

5. 选择要保留的骰子

直接发送骰子编号即可:

135

也可以使用空格或逗号:

1 3 5
1,3,5

选择的是骰子前面的编号,不是骰子的点数。

选择成功后,玩家可以继续发送:

骰子投掷

继续投掷剩余骰子,或者发送:

骰子停止

保存当前回合分数并结束回合。

游戏规则

基础计分

| 组合 | 分数 | | --- | ---: | | 单个 1 | 100 | | 单个 5 | 50 | | 三个 1 | 1000 | | 三个 2 | 200 | | 三个 3 | 300 | | 三个 4 | 400 | | 三个 5 | 500 | | 三个 6 | 600 | | 四个相同 | 三个相同的分数 × 2 | | 五个相同 | 三个相同的分数 × 4 | | 六个相同 | 三个相同的分数 × 8 | | 1~6 顺子 | 1500 | | 三对 | 1500 |

例如:

[1]       = 100 分
[5]       = 50 分
[1, 5]    = 150 分
[3, 3, 3] = 300 分
[1, 1, 1] = 1000 分

选中的骰子必须全部参与计分。

例如:

[1, 2]

选择无效,因为 2 没有参与任何计分组合。

爆骰

如果一次投掷中没有任何可以计分的骰子:

  • 当前回合分数全部清零;
  • 当前玩家回合结束;
  • 自动轮到下一名玩家。

热骰

如果玩家在一次回合中将当前所有骰子都选走并成功计分:

  • 触发热骰;
  • 下一次可以重新投掷 6 颗骰子;
  • 玩家可以继续累计当前回合分数。

获胜

玩家累计分数达到目标分数后,游戏结束,该玩家获胜。

默认目标分数为:

4000 分

指令

| 指令 | 说明 | | --- | --- | | 骰子帮助 | 查看游戏帮助 | | 骰子开局 | 创建一场对局 | | 骰子加入 | 加入等待中的对局 | | 骰子开始 | 房主开始游戏 | | 骰子投掷 | 投掷当前可用骰子 | | 135 | 选择第 1、3、5 颗骰子 | | 1 3 5 | 使用空格选择骰子 | | 骰子保留 1 3 5 | 使用完整指令选择骰子 | | 骰子停止 | 保存本回合分数 | | 骰子状态 | 查看当前对局状态 | | 骰子退出 | 在游戏开始前退出对局 | | 骰子结束 | 房主结束当前对局 |

配置项

可以在 Koishi 控制台中调整以下配置:

| 配置项 | 默认值 | 说明 | | --- | ---: | --- | | targetScore | 4000 | 玩家获胜所需的目标分数 | | maxPlayers | 6 | 一场对局允许加入的最大玩家数量 | | turnTimeout | 60 | 当前玩家每次操作的超时时间,单位为秒 |

当玩家超过操作时间没有进行有效操作时,机器人会发送:

选择超时

当前回合分数会清零,并自动切换到下一名玩家。

超时时间不会显示在游戏指令消息中。

注意事项

  • 每个聊天频道独立进行一场对局。
  • 当前对局数据保存在内存中。
  • Koishi 重启后,正在进行的对局会消失。
  • 当前版本暂不保存历史战绩和排行榜。
  • 建议先在测试群中进行游戏。
  • 请勿将本插件用于真实货币下注或其他形式的赌博活动。

开发

安装依赖:

npm install

类型检查:

npm run typecheck

构建插件:

npm run build

插件构建入口:

src/index.ts

构建产物:

dist/index.js
dist/index.d.ts

许可证

MIT License