YAPOG  0.0.1
Yet Another Pokemon Online Game
PokemonMove.cpp
Go to the documentation of this file.
6 
7 namespace yap
8 {
12 
14  : staticID_ (DEFAULT_STATIC_ID)
15  , currentPP_ (DEFAULT_PP_VALUE)
16  , maxPP_ (DEFAULT_MAX_PP_VALUE)
17  , skillInfo_ (nullptr)
18  {
19  skillInfo_ = new SkillInfo ();
20  }
21 
22  PokemonMove::PokemonMove (const ID& skillID)
23  : staticID_ (skillID)
24  , currentPP_ (DEFAULT_PP_VALUE)
25  , maxPP_ (DEFAULT_MAX_PP_VALUE)
26  , skillInfo_ (nullptr)
27  {
28  SetSkillInfo (skillID);
29  }
30 
32  : staticID_ (copy.staticID_)
33  , currentPP_ (copy.currentPP_)
34  , maxPP_ (copy.maxPP_)
35  , skillInfo_ (nullptr)
36  {
37  SetSkillInfo (copy.staticID_);
38  }
39 
40  // Getters
41  const ID& PokemonMove::GetStaticID () const
42  {
43  return staticID_;
44  }
45 
46  const String& PokemonMove::GetName () const
47  {
48  if (skillInfo_ == nullptr)
49  YAPOG_THROW("This skill's base informations doesn't exist !");
50 
51  return skillInfo_->GetName ();
52  }
53 
54  const UInt16& PokemonMove::GetPower () const
55  {
56  if (skillInfo_ == nullptr)
57  YAPOG_THROW("This skill's base informations doesn't exist !");
58 
59  return skillInfo_->GetPower ();
60  }
61 
63  {
64  return currentPP_;
65  }
66 
67  const UInt16& PokemonMove::GetMaxPP () const
68  {
69  return maxPP_;
70  }
71 
73  {
74  if (skillInfo_ == nullptr)
75  YAPOG_THROW("This skill's base informations doesn't exist !");
76 
77  return skillInfo_->GetMaxPP ();
78  }
79 
80  // Setters
81  void PokemonMove::SetPP (const UInt16& value)
82  {
84  }
85 
86  void PokemonMove::SetMaxPP (const UInt16& value)
87  {
90  }
91 
92 
93  void PokemonMove::SetSkillInfo (const ID& skillID)
94  {
96  Create<SkillInfo> ("SkillInfo", ID (skillID));
97 
98  maxPP_ = skillInfo_->GetPP ();
99  Refill ();
100  }
101 
103  {
104  currentPP_ = maxPP_;
105  }
106 
108  {
109  if (currentPP_ > 0)
110  currentPP_--;
111  }
112 
113  void PokemonMove::AddPP (int value)
114  {
115  maxPP_ += value;
116 
117  if (maxPP_ > GetLimitPPMax ())
118  maxPP_ = GetLimitPPMax ();
119  }
120 
122  {
123  maxPP_ = GetLimitPPMax ();
124  }
125 
127  {
128  return skillInfo_->GetType ();
129  }
130 
132  {
133  return skillInfo_->GetCategory ();
134  }
135 }