Question: Files Provided: Main.cpp: Character.h : **WHAT IS NEEDED** Character.cpp Warrior.cpp Warrior.h Wizard.cpp Wizard.h Elf.cpp Elf.h THANK YOU!!! Base Class enum HeroType {WARRIOR, ELF, WIZARD}; const




Files Provided:
Main.cpp:


Character.h:

**WHAT IS NEEDED**
Character.cpp Warrior.cpp Warrior.h Wizard.cpp Wizard.h Elf.cpp Elf.h
THANK YOU!!!
Base Class enum HeroType {WARRIOR, ELF, WIZARD}; const double MAX_HEALTH = 100.0; class Character { protected: HeroType type; string name; double health; double attackstrength; public: Character (HeroType type, const string &name, double health, double attackstrength); HeroType getType() const; const string & getName() const; /* Returns the whole number of the health value (static_cast to int). */ int getHealth() const; /* Reduces health value by amount passed in. */ void damage (double d); /* Returns true if getHealth() returns an integer greater than o, otherwise false */ bool is Alive () const; virtual void attack (Character &) = 0; Derived Classes Warrior Stores the warrior's allegiance as a string. The warrior does not attack warriors that have the same allegiance. The damage done by the warrior is the percentage of the warrior's health remaining (health / MAX_HEALTH) multiplied by the warrior's attack strength. Elf Stores the elf's family name as a string. The elf does not attack an elf from its own family. The damage done by the elf is the percentage of the elfs health remaining (health / MAX_HEALTH) multiplied by the elf's attack strength. Wizard Stores the wizard's rank as an int. When a wizard attacks another wizard, the damage done is the wizard's attack strength multiplied by the ratio of the attacking wizard's rank over the defending wizard's rank. The damage done to non-wizards is just the attack strength. The wizard's health is not taken into consideration Dynamic casting type of Character in attack function In order to access the Warrior data field allegiance using the Character reference passed in to the attack function, you will need to dynamic cast the Character reference to a Warrior reference. Here's an example of dynamic casting a Character reference named opponent to a Warrior reference named opp: Warrior &opp = dynamic_cast(opponent); You will need to do the same for the Wizard and Elf attack functions, only dynamic casting to Wizard or Elf reference instead. Hero Type Notice the enum declaration above the Character class declaration. This creates a special type called Hero Type that has the values, WARRIOR, ELF, and WIZARD. Those are the values you store in a variable of type Hero Type. For example, you can initialize a variable of type Hero Type and set it to the value of WARRIOR like this: HeroType type = WARRIOR; You can compare a variable named t of type Hero Type to one of the Hero Type values like this: if (t == WARRIOR) { // do something based on t being a warrior } Example main function This shows you what your attack function should do in all situations. Look below this to find the main function you will need to pass the zyBook tests #include using namespace std; #include "Warrior.h" #include "Elf.h" #include "Wizard.h" int main() { Warrior w1 ("Arthur", 100, 5, "King George"); Warrior w2 ("Jane", 100, 6, "King George"); Warrior w3("Bob", 100, 4, "Queen Emily"); Elf el ("Raegron", 100, 4, "Sylvarian"); Elf e2 ("Cereasstar", 100, 3, "Sylvarian"); Elf e3 ("Melimion", 100, 4, "Valinorian"); Wizard wz1 ("Merlin", 100, 5, 10); Wizard wz2 ("Adali", 100, 5, 8); Wizard wz3("Vrydore", 100, 4, 6); el.attack (w1); cout #include #include using namespace std; #include "Character.h" #include "Warrior.h" #include "Elf.h" #include "Wizard.h" int main() { int seed; cout > seed; cout adventurers; adventurers.push_back (new Warrior ("Arthur", 100, 5, "King George")); adventurers.push_back (new Warrior ("Jane", 100, 6, "King George")); adventurers.push back (new Warrior ("Bob" 100, 4, "Queen Emily")); adventurers.push_back (new Elf("Raestro", 100, 4, "Svivarian")); adventurers.push_back (new Elf("Cereasstar", 100, 3, "Svivarian")); adventurers.push_back (new Elf ("Melimion", 100, 4, "Valinorian")); adventurers.push_back (new Wizard ("Merlin", 100, 5, 10)); adventurers.push_back (new Wizard ("Adali", 100, 5, 8)); adventurers.push_back (new Wizard ("Vxvdore", 100, 4, 6)); unsigned numAttacks = 10 + rand() 11; unsigned attacker, defender; for (unsigned i = 0; i attack(*adventurers.at (defender)); cout getName() getHealth() using namespace std; #ifndef #define CHARACTER H CHARACTER H 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 enum HeroType (WARRIOR, ELF, WIZARD) : const double MAX_HEALTH = 100.0; Fclass Character protected: HeroType type; string name; double health; double attackStrength; 17 18 19 20 22 23 24 25 26 public: Character (HeroType, const string &, double, double); HeroType getType () const; const string & getName() const; int getHealth() const; void damage (double d); bool isAlive () const; virtual void attack (Character &) = 0; 27 28 29 #endif