initial commit
[COMP345---Clone.git] / Ring.cpp
blobc30384a595a87536161aca4698966965cafaf193
1 //!@file Ring.cpp
2 //! @brief Implementation of Ring equipment
3 //!
4 //! This class represents the ring that is equipped or carried by a character
5 //! This class validates the ring and assigns its stats
6 #include "Ring.h"
8 //! Default ring constructor sets stats to 1
9 Ring::Ring()
11 ac = 1;
12 wis = 1;
13 str = 1;
14 charisma = 1;
15 constitution = 1;
16 level = 1;
17 setName("ring");
21 //! Ring constructor sets stats.
22 //! @param r_ac: the armor class to be set
23 //! @param r_wis the value of wisdom to be set
24 //! @param r_cha the value of charisma to be set
25 //! @param r_str the value of strength to be set
26 //! @param r_con the value of consitution to be set
27 //! @param r_level the level to be set to
28 Ring::Ring(int r_ac, int r_wis, int r_str, int r_cha, int r_con, int r_level)
30 ac = r_ac;
31 wis = r_wis;
32 str = r_str;
33 charisma = r_cha;
34 constitution = r_con;
35 level = r_level;
36 setName("ring");
39 //! Ring constructor sets stats based on level.
40 //! @param r_level the level which designates stat values
41 Ring::Ring(int r_level)
43 levelUpEquipment(r_level);
44 level = r_level;
45 name = "ring";
48 Ring::~Ring()
52 //! Validates the ring
53 //! Ring has an armor class attribute that must be between 1 and 5
54 //! Ring has an wisdom attribute that must be between 1 and 5
55 //! Ring has an strength attribute that must be between 1 and 5
56 //! Ring has an charisma attribute that must be between 1 and 5
57 //! Ring has an constitution attribute that must be between 1 and 5
58 bool Ring::validateEquipment()
60 if (ac < 1 || ac > 5 ||
61 wis < 1 || wis > 5 ||
62 str < 1 || str > 5 ||
63 constitution < 1 || constitution> 5 ||
64 charisma < 1 || charisma> 5)
65 return false;
66 else
67 return true;
71 //! Sets the ring stats to the given level
72 void Ring::levelUpEquipment(int r_level)
74 ac = r_level;
75 wis = r_level;
76 str = r_level;
77 charisma = r_level;
78 constitution = r_level;
79 level = r_level;