Libsaki
Core library of Pancake Mahjong
usuzan_sawaya.h
1 #ifndef SAKI_GIRL_USUZAN_SAWAYA_H
2 #define SAKI_GIRL_USUZAN_SAWAYA_H
3 
4 #include "../table/princess.h"
5 #include "../table/irs_ctrl.h"
6 
7 
8 
9 namespace saki
10 {
11 
12 
13 
14 class Sawaya : public GirlCrtp<Sawaya>, public HrhBargainer
15 {
16 public:
18 
19  bool checkInit(Who who, const Hand &init, const Table &table, int iter) override;
20  void onDice(util::Rand &rand, const Table &table) override;
21  void onMonkey(std::array<Exist, 4> &exists, const Table &table) override;
22  void onDraw(const Table &table, Mount &mount, Who who, bool rinshan) override;
23  void onIrsChecked(const Table &table, Mount &mount) override;
24 
25  HrhBargainer *onHrhBargain(const Table &table) override;
26  Claim hrhBargainClaim(int plan, T34 t) override;
27  int hrhBargainPlanCt() override;
28  void onHrhBargained(int plan, Mount &mount) override;
29 
30  bool canUseRedCloud(unsigned &mask) const;
31  bool canUseWhiteCloud(unsigned &mask) const;
32 
33  bool usingRedCloud() const;
34 
35 protected:
36  IrsCtrlGetter attachIrsOnDice() override;
37  IrsCtrlGetter attachIrsOnDrawn(const Table &table) override;
38 
39 private:
40  enum Cloud
41  {
42  // *** SYNC order with "mCloudCtrl" ***
43  BLUE, YELLOW, RED, RED_SELF, RED_RIVALS, WHITE, BLACK,
44  NUM_CLOUD
45  };
46 
47  enum Kamuy
48  {
49  // *** SYNC order with "mKamuyCtrl" ***
50  PA_KOR, PA_KOR_R, PA_KOR_C, PA_KOR_L, AT_KOR, HOYAW, HURI, PAWCI,
51  NUM_KAMUY
52  };
53 
54  bool usingCloud(Cloud which) const;
55  bool usingKamuy(Kamuy which) const;
56 
57 private:
58  bool mPredice;
59  Who mPaKorTarget;
60  bool mConsumedPaKor = false;
61  bool mConsumedSecondHuri = false;
62 
63  IrsCtrlCheck<Sawaya> mCloudCtrl {
65  "SAWAYA_CLOUD",
66  IrsCheckList {
67  IrsCheckItem::CHECK_DISABLED,
68  IrsCheckItem::CHECK_DISABLED,
69  IrsCheckItem::CHECK_ENABLED,
70  IrsCheckItem::CHILD_RADIO_DEFAULT,
71  IrsCheckItem::CHILD_RADIO,
72  IrsCheckItem::CHECK_ENABLED,
73  IrsCheckItem::CHECK_DISABLED,
74  }
75  }
76  };
77 
78  IrsCtrlClickCheck<Sawaya> mKamuyCtrl {
80  "SAWAYA_KAMUY",
81  IrsCheckList {
82  IrsCheckItem::CHECK_ENABLED,
83  IrsCheckItem::CHILD_RADIO_DEFAULT,
84  IrsCheckItem::CHILD_RADIO,
85  IrsCheckItem::CHILD_RADIO,
86  IrsCheckItem::CHECK_ENABLED,
87  IrsCheckItem::CHECK_DISABLED,
88  IrsCheckItem::CHECK_ENABLED,
89  IrsCheckItem::CHECK_DISABLED,
90  }
91  },
92  &Sawaya::mKamuyCtrl
93  };
94 };
95 
96 
97 
98 } // namespace saki
99 
100 
101 
102 #endif // SAKI_GIRL_USUZAN_SAWAYA_H
void onDice(util::Rand &rand, const Table &table) override
Called when someone is about to dice.
Definition: usuzan_sawaya.cpp:20
Interface for working with the &#39;bargain&#39; stage.
Definition: princess.h:38
void onIrsChecked(const Table &table, Mount &mount) override
Called after self&#39;s IRS-check action.
Definition: usuzan_sawaya.cpp:137
IrsCtrlGetter attachIrsOnDrawn(const Table &table) override
Overriden to define a drawn-time IRS&#39;s showing condition.
Definition: usuzan_sawaya.cpp:265
IrsCtrlGetter attachIrsOnDice() override
Overriden to define a dice-time IRS&#39;s showing condition.
Definition: usuzan_sawaya.cpp:259
Definition: irs_ctrl.h:121
Claim
Definition: princess.h:47
Definition: mount.h:54
Definition: table.h:87
Definition: rand.h:19
Definition: tile.h:25
void onDraw(const Table &table, Mount &mount, Who who, bool rinshan) override
Called when someone is about to draw a tile from the mountain.
Definition: usuzan_sawaya.cpp:71
Definition: usuzan_sawaya.h:14
bool usingRedCloud() const
Definition: usuzan_sawaya.cpp:254
Definition: irs_ctrl.h:60
Definition: ai.cpp:18
Definition: choices.h:130
Definition: hand.h:17
Wrapper of a "T Girl::*" value where T implements IrsCtrl.
Definition: girl.h:77
Definition: girl.h:212
Definition: who.h:14