write a c++ program to Create a game where a player and an enemy battle each oth
ID: 3645057 • Letter: W
Question
write a c++ program to Create a game where a player and an enemy battle each other. Each has a certain amount ofhealth, which decreases when they are attacked. The battle ends when either the player or the
enemy runs out of health.
Each round, the player gets a chance to attack the enemy. The player (the user) can choose to
attack normally, or use a magic spell. Casting a spell costs 1 magic point, and the player only has
3 to begin with. However, magic spells hit for more damage. Check that the player has sufficient
MP to use the spell if it is chosen. After the player
Explanation / Answer
#ifndef Being_h #define Being_h #include using namespace std; class Being {public: string name; int attackBonus; int range; float attackMod; int health; int healthMax; int mp; int mpMax; int arrows; void attack(Being& target); void rangedAttack(Being& target); void heal(); }; #endif or #include "Combat.h" 02 #include "Monster.h" 03 #include "Character.h" 04 05 Combat::Combat(Monster& newM) : M(newM) 06 { 07 08 } 09 10 11 void Combat::combatChoice(Character& C) 12 { 13 if (C.health>0) 14 { 15 C.display(); 16 17 coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.