/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-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/hand.h" |
9 | | #include "types/statefunction.h" |
10 | | #include "types/yaku.h" |
11 | | |
12 | | namespace mahjong::yaku { |
13 | | bool isRobbingAKan(const GameState& state, const Hand& hand, |
14 | 6 | const std::vector<const mahjong::Node*>& /*branch*/) { |
15 | 6 | if (!hand.hasRonned) { |
16 | 1 | return false; |
17 | 1 | } |
18 | 5 | if (state.nextState == StateFunctionType::kKanDiscard) { |
19 | 1 | return true; |
20 | 1 | } |
21 | 4 | return false; |
22 | 5 | } |
23 | | |
24 | | REGISTER_YAKU({ |
25 | | .id = "robbingakan", |
26 | | .name = "Robbing a Kan", |
27 | | .type = Yaku::kOpen, |
28 | | .value = 1, |
29 | | .is_yaku_func = yaku::isRobbingAKan, |
30 | | }); |
31 | | } // namespace mahjong::yaku |