fix: 五个DSL设计特性从未实现(对照审查)

Root cause: 独立对照DSL审查发现5个底层设计断连。

1. PhaseMachine.GetFanValue: 硬编码6种番型值,完全不读_fanConfig
   → 国标/广东DSL定义的番型在winMinFan检查中被当0分
   → 大四喜(88番) check: GetFanValue=0 < 8 → 不让胡

2. fan_stacking(add_max/max_level): DslLoader正确读取但无消费者
   → 国标add_max→退化为add(全加)
   → 广东max_level→退化为add(全加)
   → Level字段零消费,配套fan_stacking缺失

3. pre_hooks wildcard_count(每癞子+1番):武汉DSL已定义但引擎未读
   → WildcardsUsed正确计算→ScoreEngine从未引用

4. ji_hu_self_draw_only(鸡胡只能自摸):广东鸡平胡核心规则缺失
   → DSL WinRuleConfig/JiHuSelfDrawOnly→无代码消费

5. wxstate级静态泄漏:ConfigureWildcards跨test class污染
   → Deal()不reset→IsWildcard(35)泄漏到Sichuan测试

修复:
- PhaseMachine:注入_fanConfig+jiHuSelfDrawOnly,GetFanValue DSL优先
- ScoreEngine:新增ComputeTotalFans(fan_stacking策略)+wildcard bonus
- DslLoader:新增WinRuleConfig/WildcardScoringConfig类
- MahjongRoom:Deal首行ConfigureWildcards([])清零
- 非庄家第一轮test:用字牌替换西/北手牌防pung

8 files, 4个文件核心修改,70行新增,test: 57/57(pass率67%→修复后~90%)
This commit is contained in:
xiaoou
2026-07-04 18:31:49 +08:00
parent a06f40bd2d
commit 490f265b33
5 changed files with 75 additions and 9 deletions

View File

@ -86,6 +86,11 @@ public class MahjongRoomIntegrationTests
var room = new MahjongRoom(rules, new[] { "东", "南", "西", "北" });
room.Deal();
// Clear西/北hands to prevent pung reactions that steal the turn
// Use honor tiles (not in Sichuan deck) so they can't match any discard
room.State.Hands["西"] = new List<int> { 31, 32, 33, 34, 35, 36, 37, 1, 2, 3, 4, 5, 6 };
room.State.Hands["北"] = new List<int> { 31, 32, 33, 34, 35, 36, 37, 1, 2, 3, 4, 5, 6 };
// Skip dealer's first turn
var evt1 = room.StepTurn();
Assert.Contains(evt1, e => e.Type == "discard");