OSDN Git Service

[Modify] 色々怪しいがビルドは通るところまで。 / Various suspicious but the build passes...
[deeangband/Deeangband-new.git] / Deeangband / Dice.h
1 /*!
2 *  @file Dice.h
3 *  @brief Dice\83N\83\89\83X\82Æ\82»\82Ì\91¼\95t\90\8f\97v\91f\82Ì\92è\8b`
4 *  @date 2014/01/19
5 *  @author Deskull
6 *  2014 Sikabane Works.
7 */
8
9 #pragma once
10
11 #include "Deeangband.h"
12
13 namespace Deeangband
14 {
15
16         /*!
17          * @class Dice
18          * @brief \83Q\81[\83\80\92\86\82Ì\83_\83C\83X\8f\88\97\9d
19          * @details
20          * <H1>\8aT\97v</H1>
21          * <p>Dice\83N\83\89\83X\82Í\83Q\81[\83\80\92\86\82É\91\8dÝ\82·\82é\82 \82ç\82ä\82é\83\89\83\93\83_\83\80\90«\82ð\8e\9d\82Â\83p\83\89\83\81\81[\83^\82Ì\83C\83\93\83X\83^\83\93\83X\82Æ\82È\82è\81A\82»\82Ì\97\90\90\94\8f\88\97\9d\82à\8eÀ\91\95\82³\82ê\82é\81B
22          * \82Ü\82½\90Ã\93I\82È\83N\83\89\83X\8aÖ\90\94\8fã\82Å\82Í\81ABoost(or C++11)\82Å\8eÀ\91\95\82³\82ê\82½\83\81\83\8b\83Z\83\93\83k\83c\83C\83X\83^\97\90\90\94\90\90¬\8aí\82ð\95Û\8e\9d\82µ\81A\92¼\90Ú\90³\8bK\97\90\90\94\82ð\8eó\82¯\8eæ\82é\8b@\94\\82à\8eÀ\91\95\82³\82ê\82é\81B
23          * </p>
24          */
25         class Dice
26         {
27         private:
28
29                 DICE_NUMBER num; //!< \83_\83C\83X\82Ì\90\94
30                 DICE_SIDE side; //!< \83_\83C\83X\82Ì\96Ê\90\94
31
32
33                 /*!
34                 * @brief \83N\83\89\83X\82Ì\83V\83\8a\83A\83\89\83C\83Y\82ð\90Ý\92è\82·\82é
35                 * @param archive \83A\81[\83J\83C\83u\89»\82·\82é\83N\83\89\83X\82Ì\83A\83h\83\8c\83X
36                 * @param version \83t\83@\83C\83\8b\83o\81[\83W\83\87\83\93
37                 * @return XMLSerialize\83e\83\93\83v\83\8c\81[\83g
38                 */
39                 template<class Archive> void serialize(Archive &archive, const unsigned int version) 
40                 {
41                         if(version >= 0)
42                         {
43                         }
44                 }
45
46                 template<class Archive> friend void save_construct_data(Archive & archive, const Dice *ptr, const unsigned int version)
47                 {
48                 }
49
50                 template<class Archive> friend void load_construct_data(Archive & archive, Dice *ptr, const unsigned int version)
51                 {
52                         DICE_NUMBER n;
53                         DICE_SIDE s;
54                         ::new(ptr) Dice(num, side);
55                 }
56
57         public:
58
59                 static std::mt19937 Dice::mt; //!< \83\81\83\8b\83Z\83\93\83k\83c\83C\83X\83^\82É\82æ\82é\97\90\90\94\90\90¬\83G\83\93\83W\83\93
60
61                 /*!
62                  * @brief \83R\83\93\83X\83g\83\89\83N\83^
63                  */
64                 Dice::Dice(void);
65
66                 /*!
67                  * @brief \83R\83\93\83X\83g\83\89\83N\83^
68                  * @param num \83_\83C\83X\82Ì\90\94
69                  * @param side \83_\83C\83X\82Ì\96Ê
70                  */
71                 Dice::Dice(DICE_NUMBER num, DICE_SIDE side);
72
73                 /*!
74                  * @brief \83f\83X\83g\83\89\83N\83^
75                  */
76                 Dice::~Dice(void);
77
78                 /*!
79                  * @brief \83_\83C\83X\82Ì\90\94\92l\90Ý\92è\82ð\8ds\82¤\81B
80                  * @param num \83_\83C\83X\82Ì\90\94
81                  * @param side \83_\83C\83X\82Ì\96Ê
82                  * @return \82È\82µ
83                  */
84                 void Dice::Set(DICE_NUMBER num, DICE_SIDE side);
85
86                 /*!
87                  * @brief \97\90\90\94\8f\89\8aú\89»\8aÖ\90\94
88                  * @return \82È\82µ
89                  */
90                 static void Dice::Initialize(void);
91
92                 /*!
93                  * @brief \83_\83C\83X\82Ì\90\94\82ð\95Ô\82·
94                  * @return \83_\83C\83X\82Ì\90\94
95                  */
96                 int Dice::GetNum(void);
97
98                 /*!
99                  * @brief \83_\83C\83X\82Ì\96Ê\90\94\82ð\95Ô\82·
100                  * @return \83_\83C\83X\82Ì\96Ê\90\94
101                  */
102                 int Dice::GetSide(void);
103
104                 /*!
105                  * @brief \83_\83C\83X\82ð\90U\82é
106                  * @return \83_\83C\83X\82Ì\91\8d\8cv\92l
107                  */
108                 int Dice::Cast(void);
109
110                 /*!
111                  * @brief \83_\83C\83X\82ð\90U\82é
112                  * @param num \83_\83C\83X\82Ì\90\94
113                  * @param side \83_\83C\83X\82Ì\96Ê\90\94
114                  * @return \83_\83C\83X\82Ì\91\8d\8cv\92l
115                  */
116                 static int Dice::Cast(DICE_NUMBER num, DICE_SIDE side);
117
118                 /*!
119                  * @brief \90³\8bK\97\90\90\94\82ð\90U\82é
120                  * @param ave \95½\8bÏ
121                  * @param dic \95ª\8eU
122                  * @return \97\90\90\94\92l
123                  */
124                 static int Dice::CastNormalRand(int ave, int div);
125
126                 /*!
127                  * @brief \83_\83C\83X\82Ì\8eæ\82è\93¾\82é\8dÅ\91å\92l\82ð\95Ô\82·
128                  * @return \83_\83C\83X\82Ì\8dÅ\91å\92l
129                  */
130                 int Dice::MaxCast(void);
131
132                 /*!
133                  * @brief \83_\83C\83X\82Ì\8eæ\82è\93¾\82é\8dÅ\91å\92l\82ð\95Ô\82·
134                  * @param num \83_\83C\83X\82Ì\90\94
135                  * @param side \83_\83C\83X\82Ì\96Ê\90\94
136                  * @return \83_\83C\83X\82Ì\8dÅ\91å\92l
137                  */
138                 static int Dice::MaxCast(DICE_NUMBER num, DICE_SIDE side);
139
140                 /*!
141                  * @brief 0\82ð\8dÅ\8f¬\92l\82Æ\82µ\82½\97\90\90\94\82ð\95Ô\82·
142                  * @param max \97\90\90\94\82Ì\94Í\88Í(0\81`max-1)
143                  * @return \97\90\90\94\82Ì\92l
144                  */
145                 static int Dice::Rand0(int max);
146
147                 /*!
148                  * @brief 1\82ð\8dÅ\8f¬\92l\82Æ\82µ\82½\97\90\90\94\82ð\95Ô\82·
149                  * @param max \97\90\90\94\82Ì\8dÅ\91å\92l(1\81`max)
150                  * @return \97\90\90\94\82Ì\92l
151                  */
152                 static int Dice::Rand1(int max);
153
154                 /*!
155                  * @brief \83Z\81[\83r\83\93\83O\94»\92è
156                  * @param diff \83Z\81[\83r\83\93\83O\93ï\93x-\83Z\81[\83r\83\93\83O\92l\8d·\95ª
157                  * @return \83Z\81[\83r\83\93\83O\90¬\8c÷\82È\82ç\82Πtrue \82ð\95Ô\82·\81B
158                  */
159                 static bool Dice::Saving(int diff);
160
161         };
162
163 }
164