TheCOSCGameProject  1.0
weapon.h
Go to the documentation of this file.
1 
8 #ifndef WEAPON_H
9 #define WEAPON_H
10 
11 #include <string>
12 #include <unordered_map>
13 #include <vector>
14 
20 class Weapon
21 {
22 public:
27  Weapon();
28 
33  int giveRandWeapon();
34 
40  int giveRariWeapon(const std::string &rarity);
41 
47  std::string getName(int weaponId);
48 
54  std::string getDescription(int weaponId);
55 
61  int getDamage(int weaponId);
62 
68  std::string getRarity(int weaponId);
69 
75  bool getRanged(int weaponId);
76 
82  bool getStun(int weaponId);
83 
84 private:
89  struct WeaponData
90  {
91  std::string name;
92  std::string description;
93  int damage;
94  std::string rarity;
95  bool ranged;
96  bool stun;
97  };
98 
102  std::unordered_map<int, WeaponData> weapons;
103 
107  std::vector<int> weaponIds;
108 
119  void addWeapon(int id, const std::string &name, const std::string &description, int damage, const std::string &rarity, bool ranged, bool stun);
120 };
121 
122 #endif // WEAPON_H
std::string getName(int weaponId)
Get the name of a weapon.
Definition: weapon.cpp:93
int getDamage(int weaponId)
Get the damage value of a weapon.
Definition: weapon.cpp:111
bool getRanged(int weaponId)
Check if a weapon is ranged.
Definition: weapon.cpp:131
bool getStun(int weaponId)
Check if a weapon can stun.
Definition: weapon.cpp:140
std::string getDescription(int weaponId)
Get the description of a weapon.
Definition: weapon.cpp:102
std::string getRarity(int weaponId)
Get the rarity of a weapon.
Definition: weapon.cpp:120
Weapon()
Constructor for the Weapon class.
Definition: weapon.cpp:17
int giveRandWeapon()
Get a random weapon ID.
Definition: weapon.cpp:59
int giveRariWeapon(const std::string &rarity)
Get a weapon ID based on its rarity.
Definition: weapon.cpp:70
Manages different types of weapons in the game.
Definition: weapon.h:20