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

@game-claw/dou-di-zhu

v0.0.1

Published

Dou Di Zhu (Fight the Landlord) plugin for game-claw — 3-player, bombs, spring

Downloads

77

Readme

English | 中文

@game-claw/dou-di-zhu

Game Claw 引擎的斗地主插件。经典 3 人爬升类卡牌游戏,含叫地主、炸弹和翻倍系统。

概述

3 人卡牌游戏,使用 54 张牌(标准 52 张 + 大小王)。一名玩家成为地主并获得 3 张额外底牌,地主对抗两名农民。先出完手牌的一方获胜。

规则

基本设置

  • 人数:固定 3 人
  • 牌组:54 张(52 张标准牌 + 小王 + 大王)
  • 发牌:每人 17 张,3 张底牌留给地主

牌序

3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < J < Q < K < A < 2 < 小王 < 大王

游戏阶段

准备 → 叫地主 → 发底牌 → 加倍 → 出牌 → 结束
                │
                └→ (全部不叫) → 重新发牌
  1. 准备阶段:玩家示意准备好(可选择明牌翻倍)
  2. 叫地主:每人出价 0(不叫)或 1-3。出价最高者成为地主。全部不叫则重新发牌。
  3. 发底牌:3 张底牌归地主(共 20 张)
  4. 加倍:每人可选择翻倍个人倍数
  5. 出牌:地主先出。轮流出牌或过牌。

操作

| 操作 | 阶段 | 参数 | |------|------|------| | ready | 准备阶段 | — | | show-cards | 准备阶段 | 明牌,翻倍个人乘数 | | bid | 叫地主 | { bid: 0\|1\|2\|3 }(0=不叫) | | double | 加倍阶段 | 个人乘数翻倍 | | no-double | 加倍阶段 | 保持当前乘数 | | play | 出牌阶段 | { cards: Card[] } | | pass | 出牌阶段 | 过牌(非首出时) |

牌型

| 牌型 | 张数 | 示例 | |------|------|------| | 单张 | 1 | 5 | | 对子 | 2 | 5-5 | | 三条 | 3 | 5-5-5 | | 三带一 | 4 | 5-5-5-3 | | 三带一对 | 5 | 5-5-5-3-3 | | 顺子 | 5 张以上连续单张 | 3-4-5-6-7(不含 2 和王) | | 连对 | 3 对以上连续对子 | 3-3-4-4-5-5(不含 2 和王) | | 飞机 | 2 组以上连续三条 | 5-5-5-6-6-6 | | 飞机带单张 | 连续三条 + 每组一张单张 | 5-5-5-6-6-6-3-4 | | 飞机带对子 | 连续三条 + 每组一个对子 | 5-5-5-6-6-6-3-3-4-4 | | 四带二单 | 四条 + 2 张不同单张 | 5-5-5-5-3-4 | | 四带二对 | 四条 + 2 个不同对子 | 5-5-5-5-3-3-4-4 | | 炸弹 | 4 张同点 | 5-5-5-5 | | 火箭 | 大小王 | 王-王 |

压牌规则

  • 只能用同牌型且更大的牌压
  • 炸弹可以压任何非炸弹牌型
  • 火箭压一切(包括炸弹)
  • 炸弹和火箭可以在任何时候出,不受当前牌型限制
  • 四带二的张数必须匹配(6 张或 8 张)

飞机带牌规则

  • 带的牌不能含王
  • 带的牌不能构成炸弹(不能四张相同)
  • 带单张:必须是不同点数(每组三条带一张)
  • 带对子:必须是有效对子且不同点数

倍数系统

最终赔付计算:

赔付 = 10 × 基础倍数 × 地主个人倍数 × 农民个人倍数

基础倍数 = 以下各项相乘:

| 因素 | 值 | |------|------| | 叫牌分数 | 1、2 或 3 | | 炸弹 | 每个炸弹 ×2 | | 春天/反春天 | ×4 | | 明牌 | 每位明牌玩家 ×2 |

个人倍数(来自加倍阶段):

| 因素 | 值 | |------|------| | 加倍 | 该玩家 ×2 | | 不加倍 | ×1 |

春天与反春天

  • 春天:地主获胜且两个农民一张牌都没出过(×4)
  • 反春天:农民获胜且地主只出了第一手牌(×4)

结算

每个农民与地主独立结算:

农民赔付 = 10 × 基础倍数 × 地主倍数 × 该农民倍数
  • 地主赢:每个农民向地主支付 赔付额
  • 农民赢:地主向每个农民支付 赔付额
  • 始终零和:地主的收益/损失 = 两个农民的损失/收益之和

使用

import { DouDiZhuPlugin } from '@game-claw/dou-di-zhu';

const plugin = new DouDiZhuPlugin();
// plugin.meta = { name: 'dou-di-zhu', minPlayers: 3, maxPlayers: 3 }

导出

export class DouDiZhuPlugin implements GamePlugin { ... }

// 牌型工具:
export enum PatternType { Single, Pair, Triple, ... }
export interface CardPattern { type: PatternType; rank: number; length?: number; }
export function identifyPattern(cards: Card[]): CardPattern | null;  // 识别牌型
export function canBeat(play: CardPattern, lastPlay: CardPattern): boolean;  // 能否压过
export function getAllPlays(hand: Card[]): { cards: Card[]; pattern: CardPattern }[];  // 所有可出的牌

文件结构

src/
  plugin.ts          游戏规则、叫地主、出牌、计分
  card-patterns.ts   牌型识别、比较、可出牌枚举