YAPOG  0.0.1
Yet Another Pokemon Online Game
PokemonFighterTeam.cpp
Go to the documentation of this file.
4 
5 #include "Pokemon/Pokemon.hpp"
6 #include "Pokemon/PokemonTeam.hpp"
7 #include "Battle/PokemonFighterTeam.hpp"
8 
9 namespace ycl
10 {
12  const sf::Color PokemonFighterTeam::DEFAULT_COLOR = sf::Color ();
13 
15  : yap::PokemonFighterTeam ()
16  , isVisible_ (DEFAULT_VISIBLE_STATE)
17  , fighters_ (PokemonTeam::MAX_POKEMON_TEAM_NUMBER, nullptr)
18  {
19  }
20 
22  {
23  }
24 
26  {
27  for (int i = 0; i < PokemonTeam::MAX_POKEMON_TEAM_NUMBER; i++)
28  {
29  if (fighters_[i] == nullptr)
30  {
31  fighters_[i] = pokemonFighter;
32  return true;
33  }
34  }
35 
36  return false;
37  }
38 
40  PokemonTeam& pokemonTeam,
41  bool isOpponent)
42  {
43  int counter = pokemonTeam.GetPokemonCount ();
44 
45  for (int i = 0; i < counter; i++)
46  {
47  try
48  {
50  &(pokemonTeam.GetPokemon (i)), isOpponent));
51  }
52  catch (yap::Exception)
53  {
54  continue;
55  }
56  }
57  }
58 
60  {
62  }
63 
65  {
67  }
68 
72  {
73  if (!IsVisible ())
74  return;
75 
76  HandleDraw (context);
77  }
78 
80  {
81  return isVisible_;
82  }
83 
84  void PokemonFighterTeam::Show (bool isVisible)
85  {
86  isVisible_ = isVisible;
87 
88  HandleShow (isVisible);
89  }
90 
91  void PokemonFighterTeam::ChangeColor (const sf::Color& color)
92  {
93  color_ = color;
94 
95  HandleChangeColor (color);
96  }
98 
100  {
101  }
102 
104  {
105  }
106 
108  {
109  GetCurrentFighter ().Draw (context);
110  }
111 
112  void PokemonFighterTeam::HandleShow (bool isVisible)
113  {
114  }
115 
116  void PokemonFighterTeam::HandleChangeColor (const sf::Color& color)
117  {
118  }
119 
123  {
124  return GetCurrentFighter ().GetBattleSprite ();
125  }
127 
128 } // namespace yap