/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-source/src/scoring/yakus/robbingakan.cc
Line | Count | Source |
1 | | #include "scoring/yakus/robbingakan.h" |
2 | | |
3 | | #include <vector> |
4 | | |
5 | | #include "analysis/handnode.h" |
6 | | #include "scoring/yakus.h" |
7 | | #include "types/gamestate.h" |
8 | | #include "types/statefunction.h" |
9 | | #include "types/yaku.h" |
10 | | |
11 | | namespace mahjong::yaku { |
12 | | bool isRobbingAKan(const GameState& state, int player, |
13 | 5 | const std::vector<const mahjong::Node*>& /*branch*/) { |
14 | 5 | if (!state.hasRonned.at(player)) { |
15 | 0 | return false; |
16 | 0 | } |
17 | 5 | if (state.nextState == StateFunctionType::kKanDiscard) { |
18 | 1 | return true; |
19 | 1 | } |
20 | 4 | return false; |
21 | 5 | } |
22 | | |
23 | | REGISTER_YAKU({ |
24 | | .id = "robbingakan", |
25 | | .name = "Robbing a Kan", |
26 | | .type = Yaku::kOpen, |
27 | | .value = 1, |
28 | | .is_yaku_func = yaku::isRobbingAKan, |
29 | | }); |
30 | | } // namespace mahjong::yaku |