I have a project that I have to do it, so I would like to get the quote for it.

1 answer below »
I have a project that I have to do it, so I would like to get the quote for it.
Answered Same DayMay 08, 2021

Answer To: I have a project that I have to do it, so I would like to get the quote for it.

Arun Shankar answered on May 14 2021
155 Votes
arena.cpp
#include
#include "arena.h"
// Default constructor
Arena::Arena()
{
attack_chance = 0;
heal_chance = 0;
alive_chance = 0;
}
Arena::Arena(int a, int b, int c, string d)
{
attack_chance = a;
heal_chance = b;
alive_chance = c;
name = d;
}
// Accessor methods
bool Arena::attack()
{
int r = rand() % 100;
if(r return true;
return false;
}
bool Arena::heal()
{
int r = rand() % 100;
if(r return true;
return false;
}
bool Arena::bring_to_life()
{
int r = rand() % 100;
if(r return true;
return false;
}
string Arena::get_name()
{
return name;
}
arena.h
#ifndef ARENA_H
#define ARENA_H
#include
using namespace std;
class Arena
{
private:
int attack_chance;
int heal_chance;
int alive_chance;
string name; // name of the arena
public:
// Constructor of the class
Arena();
Arena(int, int, int, string);
// Other methods
bool attack();
bool heal();
bool bring_to_life();
string get_name();
};
#endif
main
main.cpp
#include
#include
#include
using namespace std;
#include "unit.h"
#include "arena.h"
#include "team.h"
/* This is a helper function to print a row
of - characters. Only for aesthetics. */
void line()
{
cout<<"------------------------------------------------------------------------------------------------"<}
/* This is a helper function that
makes 28 characters - 4 of each type. */
void make_characters(Unit units[28])
{
units[0] = Warrior(122, 30, 28,12, "Assassin");
units[1] = Warrior(206, 39, 29,13, "Paladin");
units[2] = Warrior(106, 40, 21,16,"Thunder Idol");
units[3] = Warrior(184, 32, 20,14,"Barbarian");
units[4] = Warrior(203, 36, 21,13,"Berserker");
units[5] = Warrior(140, 30, 29,12,"Rocketeer");
units[6] = Warrior(170, 40, 30,14,"Sentinel");
units[7] = Defender(536, 19, 66,19,"Giant");
units[8] = Defender(309, 34, 51, 15,"Wraith");
units[9] = Defender(374, 25, 50,11,"Robot");
units[10] = Defender(455, 19, 60, 27,"Kong");
units[11] = Defender(438, 25, 68,11,"Skeleton");
units[12] = Defender(508, 29, 59,16,"Treant");
units[13] = Defender(347, 31, 60, 47,"Golem");
units[14] = Wizard(116, 22, 16, 14,"Frog mystic");
units[15] = Wizard(98, 22, 15, 16,"Vampire");
units[16] = Wizard(154, 11, 20,14,"Genie");
units[17] = Wizard(90, 30, 17, 12,"Druid");
units[18] = Wizard(136, 24, 15, 14,"Zombie");
units[19] = Wizard(94, 13, 19, 15,"Striker");
units[20] = Wizard(145, 23, 22,13,"Puppet master");
units[21] = Healer(139, 24, 19, 18, "Priest");
units[22] = Healer(218, 30, 23,17,"Enchantress");
units[23] = Healer(224, 29, 29, 20,"Shaman");
units[24] = Healer(199, 13, 26,16,"Ice queen");
units[25] = Healer(179, 21, 30,17,"Private");
units[26] = Healer(211, 19, 26,18,"Pheonix");
units[27] = Healer(146, 22, 25, 23,"Sorceress");
}
int main()
{
srand(time(NULL));
/* Make the 28 Units given in the assignment
document. */
Unit units[28];
make_characters(units);
// Dispay all the characters to the console.
for(int i=0;i<28;i++)
{
cout<\t";
units[i].display();
}
line();
/* Make the two teams. Ask the user to
select the two teams */
int a,b,c,d;
cout<<"Please select the first team:\t";
cin>>a>>b>>c>>d;
Team teamA(units[a-1], units[b-1], units[c-1], units[d-1]);
line();
cout<<"Please select the second team:\t";
cin>>a>>b>>c>>d;
Team teamB(units[a-1], units[b-1], units[c-1], units[d-1]);
line();
// Make the four arenas
Arena casual(0,0,0,"Casual");
Arena firespin(10,0,0,"Firespin");
Arena valhalla(0,0,5,"Valhalla");
Arena aurora(10,0,0,"Aurora");
// Choose a random arena
int random_arena = rand()%4;
Arena myArena;
switch(random_arena)
{
case 0: myArena = casual; break;
case 1: myArena = firespin; break;
case 2: myArena = valhalla; break;
case 3: myArena = aurora; break;
default: return 0; // unreachable code.
}
cout<<"\nThe battle will...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here