YAPOG  0.0.1
Yet Another Pokemon Online Game
Pokemon.cpp
Go to the documentation of this file.
8 
9 #include "Pokemon/Pokemon.hpp"
10 #include "Pokemon/PokemonInfo.hpp"
11 
12 namespace ycl
13 {
14  Pokemon::Pokemon (const yap::ID& staticID)
15  : yap::Pokemon (staticID)
16  , icon_ (nullptr)
17  , genderIcon_ (nullptr)
18  , battleBack_ (nullptr)
19  , battleFront_ (nullptr)
20  , type1Icon_ (nullptr)
21  , type2Icon_ (nullptr)
22  {
23  Init ();
24  }
25 
27  const yap::ID& staticID,
28  const yap::UInt16& level,
29  const bool& shiny)
30  : yap::Pokemon (staticID, level, shiny)
31  , icon_ (nullptr)
32  , genderIcon_ (nullptr)
33  , battleBack_ (nullptr)
34  , battleFront_ (nullptr)
35  , type1Icon_ (nullptr)
36  , type2Icon_ (nullptr)
37  {
38  Init ();
39  }
40 
42  const yap::ID& uniqueID,
43  const yap::ID& staticID,
44  const yap::String& trainerName,
45  const yap::String& nickname,
46  const yap::PokemonStat& stats,
47  const yap::Gender& gender,
48  const yap::PokemonStatus& status,
49  const bool shiny,
50  const yap::Int16& loyalty,
51  const yap::PokemonMoveSet& moveSet,
52  const yap::ID& natureID,
53  const yap::uint& exp,
54  const yap::UInt8& boxNumber,
55  const yap::ID& boxIndex,
56  const yap::String& catchDate)
57  : yap::Pokemon (
58  uniqueID,
59  staticID,
60  trainerName,
61  nickname,
62  stats,
63  gender,
64  status,
65  shiny,
66  loyalty,
67  moveSet,
68  natureID,
69  exp,
70  boxNumber,
71  boxIndex,
72  catchDate)
73  , icon_ (nullptr)
74  , genderIcon_ (nullptr)
75  , battleBack_ (nullptr)
76  , battleFront_ (nullptr)
77  , type1Icon_ (nullptr)
78  , type2Icon_ (nullptr)
79  {
80  Init ();
81  }
82 
84  {
85  }
86 
88  {
91  + ".wav");
92  }
93 
94  void Pokemon::Init ()
95  {
97  Create<PokemonInfo> ("PokemonInfo", staticID_);
98 
99  LoadSprites ();
100  }
101 
103  {
105 
106  type1Icon_ = new yap::Sprite (
107  "Pictures/Types/" +
109  GetType1 ().GetID ().GetValue ()) + ".png");
110 
111  type2Icon_ = new yap::Sprite (
112  "Pictures/Types/" +
114  GetType2 ().GetID ().GetValue ()) + ".png");
115 
116  if (gender_ == yap::Gender::Female)
117  {
118  genderIcon_ = new yap::Sprite ("Pictures/Battle/FemaleIcon.png");
119 
120  if (shiny_)
121  {
122  battleFront_ = new yap::Sprite (
124 
125  battleBack_ = new yap::Sprite (
127  }
128  else
129  {
130  battleFront_ = new yap::Sprite (
132 
133  battleBack_ = new yap::Sprite (
135  }
136  }
137  else
138  {
139  genderIcon_ = new yap::Sprite ("Pictures/Battle/MaleIcon.png");
140 
141  if (shiny_)
142  {
143  battleFront_ = new yap::Sprite (
145 
146  battleBack_ = new yap::Sprite (
148  }
149  else
150  {
151  battleFront_ = new yap::Sprite (
153 
154  battleBack_ = new yap::Sprite (
156  }
157  }
158  }
159 
160  // Getters
162  { return *icon_; }
164  { return *genderIcon_; }
166  { return *battleBack_; }
168  { return *battleFront_; }
170  { return *type1Icon_; }
172  { return *type2Icon_; }
173 
174 } // namespace ycl