Dice.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _DICE_HH_
00018 # define _DICE_HH_
00019
00020 # include "Constants.hh"
00021 # include "rules/PacketHandler.hh"
00022
00023 class BaseRules;
00024
00031 DECLARE_PACKET(MSG_CHEATDICE, MsgCheatDice)
00032 int next_result;
00033 END_PACKET;
00034
00037
00039 enum eDiceFaceNumber {
00040 D2 = 2,
00041 D3,
00042 D4,
00043 DBLOCK,
00044 D6,
00045 D8 = 8,
00046 D10 = 10,
00047 D12 = 12,
00048 D16 = 16,
00049 D66 = 666
00050 };
00051
00053 enum eBlockDiceFace {
00054 BATTACKER_DOWN = 1,
00055 BBOTH_DOWN,
00056 BPUSHED,
00057 BDEFENDER_STUMBLE,
00058 BDEFENDER_DOWN
00059 };
00060
00062
00067 class Dice
00068 {
00069 public:
00072 Dice(BaseRules* r);
00074 ~Dice();
00075
00084 int roll(const std::string& msg, enum eDiceFaceNumber type = D6, int nb_dice = 1);
00085 int roll(enum eRoll bb_roll_type, enum eDiceFaceNumber type = D6, int nb_dice = 1);
00086
00088 static const char* stringify(enum eBlockDiceFace face);
00090 static const char* stringify(enum eRoll roll);
00091
00092 private:
00096 int roll(enum eDiceFaceNumber type = D6, int nb_dice = 1);
00097
00098 void msgCheatDice(const MsgCheatDice* m);
00099
00100 std::deque<int> cheat_dice_;
00101 };
00102
00103 #endif // !_DICE_HH_