Root cause: 1. Deal()完全忽略 _rules.Deck.Total → 牌库大小由 includeFlags 决定 2. Guangdong DSL: total=136 但 include_flowers=true → 实际144张 3. DS与引擎脱节导致广东无限对局(flaky test根因之一) 修复: - Deck构造加 expectedTotal 可选参数,不一致时抛 InvalidOperationException - Deal()传 _rules.Deck.Total → 所有DSL变更牌数时必须引擎一致 - Guangdong DSL: total 136→144(广东麻将含花牌=144张) Breaks: 无(向后兼容,expectedTotal默认null=不校验)
104 lines
2.7 KiB
YAML
104 lines
2.7 KiB
YAML
game:
|
||
name: 广东麻将鸡平胡
|
||
type: mahjong
|
||
engine_type: mahjong
|
||
players: { min: 4, max: 4 }
|
||
|
||
requires:
|
||
- meldsolver.standard_win
|
||
- meldsolver.seven_pairs
|
||
- meldsolver.thirteen_orphans
|
||
- deck.flower_cards
|
||
- phase.mahjong_turn
|
||
- phase.priority_arbitration
|
||
- scoring.fan_exclusion
|
||
|
||
deck:
|
||
generator: mahjong
|
||
include_honors: true
|
||
include_flowers: true
|
||
total: 144
|
||
|
||
deal:
|
||
cards_per_player: 13
|
||
dealer_extra: 1
|
||
|
||
flower_rules:
|
||
on_draw: replace_and_draw
|
||
replace_tiles: BEFORE_GAME_START
|
||
scoring:
|
||
normal: 1
|
||
matching:
|
||
value: 1
|
||
mapping:
|
||
1: [春, 梅]
|
||
2: [夏, 兰]
|
||
3: [秋, 竹]
|
||
4: [冬, 菊]
|
||
|
||
fan_types:
|
||
# 鸡胡(1番,只能自摸)
|
||
- { name: 鸡胡, base_fan: 1, level: 1 }
|
||
# 平胡(4番)
|
||
- { name: 清一色, base_fan: 8, level: 3, excludes: [缺一门, 无字] }
|
||
- { name: 对对胡, base_fan: 4, level: 2, conflicts: [暗七对] }
|
||
- { name: 暗七对, base_fan: 8, level: 3, conflicts: [对对胡] }
|
||
- { name: 混一色, base_fan: 4, level: 2, excludes: [缺一门] }
|
||
- { name: 带幺九, base_fan: 4, level: 2, excludes: [缺一门] }
|
||
# 爆胡(8番+)
|
||
- { name: 十三幺, base_fan: 32, level: 3, excludes: [五门齐, 门前清] }
|
||
- { name: 大四喜, base_fan: 32, level: 3 }
|
||
- { name: 大三元, base_fan: 32, level: 3 }
|
||
- { name: 杠上开花, base_fan: 1, level: 1, excludes: [海底捞月] }
|
||
- { name: 海底捞月, base_fan: 1, level: 1 }
|
||
- { name: 抢杠胡, base_fan: 1, level: 1 }
|
||
|
||
fan_stacking: max_level
|
||
max_fan: 999
|
||
|
||
win_rule:
|
||
ji_hu_self_draw_only: true # 鸡胡只能自摸
|
||
|
||
phases:
|
||
- name: deal
|
||
type: auto
|
||
action: deal_cards_with_flowers
|
||
next: play
|
||
|
||
- name: play
|
||
type: mahjong_turn
|
||
turn_order: counter_clockwise
|
||
sub_phases:
|
||
draw:
|
||
type: auto
|
||
action: draw_card
|
||
on_draw_flower: replace
|
||
on_empty_deck: exhausted
|
||
self_action:
|
||
options:
|
||
- { action: discard }
|
||
- { action: an_kong }
|
||
- { action: bu_kong, condition: has_punged_pair }
|
||
- { action: win, condition: can_win_tumo }
|
||
others_reaction:
|
||
options:
|
||
- { action: chi, priority: 1, condition: can_chi }
|
||
- { action: pung, priority: 2, condition: has_two_same }
|
||
- { action: ming_kong, priority: 3, condition: has_three_same }
|
||
- { action: win, priority: 4, condition: can_win }
|
||
- { action: pass, priority: 0 }
|
||
priority_policy: highest_wins
|
||
on_win: game_over
|
||
end_conditions:
|
||
- { type: player_wins, action: settle }
|
||
- { type: deck_exhausted, action: draw_game }
|
||
|
||
- name: settle
|
||
type: auto
|
||
action: calculate_scores
|
||
next: null
|
||
|
||
scoring:
|
||
mode: fan_table
|
||
max_cap: 999
|