Robot Devastation
Player.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_PLAYER_HPP__
6 #define __RD_PLAYER_HPP__
7 
8 #include <string>
9 #include "Weapon.hpp"
10 
11 namespace rd{
12 
13 class Weapon;
14 
21 class Player
22 {
23 public:
25  Player();
26  Player(int id, const std::string & name, int health, int max_health, int team_id, int score);
27 
28  int getId() const;
29  void setId(int value);
30 
31  const std::string & getName() const;
32  void setName(const std::string &value);
33 
34  int getHealth() const;
35  void setHealth(int value);
36 
38  bool getDamageFromWeapon(const Weapon& weapon);
39 
40  int getMaxHealth() const;
41  void setMaxHealth(int value);
42 
43  int getTeamId() const;
44  void setTeamId(int value);
45 
46  int getScore() const;
47  void setScore(int value);
48 
50  std::string str() const;
51 
52 private:
53  std::string name;
54  int id;
55  int health;
56  int max_health;
57  int team_id;
58  int score;
59 
60 };
61 }
62 
63 #endif //__RD_PLAYER_HPP__
rd::Player
Class that represents a player of this game, with a 'unique' id, name, health, team id and score.
Definition: Player.hpp:21
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::Weapon
Class that represents a weapon.
Definition: Weapon.hpp:22
rd::Player::str
std::string str() const
Returns a string representing this object.
Definition: Player.cpp:98
rd::Player::Player
Player()
Constructs a default, dummy player. (That is invalid for the game, by the way)
Definition: Player.cpp:9
rd::Player::getDamageFromWeapon
bool getDamageFromWeapon(const Weapon &weapon)
Reduces this player's health by an amount specified by the weapon used.
Definition: Player.cpp:60