#include <iostream>
#include <sstream>
#include <fstream>
#include <ctime>
#include "Bunny.h"
#include "BunnyManager.h"
#include <vector>
using namespace std;
Bunny::Bunny()
{
}
Bunny::Bunny(string inputname, bool isfemale, string furcolor, bool isradioactive)
{
name=inputname;
isFemale=isfemale;
color=furcolor;
isRadioactive=isradioactive;
age=0;
isAlive=true;
isAdult=false;
bunnyPlaceHolder=' ';
isMarkedRadioactive=false;
}
string Bunny::ToString()
{
if(isAlive)
{
char agetostr[20];
sprintf(agetostr, "%d", GetAge());
string outputString= "\n Bunny " + GetName() + " is: \n\t" + agetostr + " years old \n\t" + GetGenderAsText() + "\n\t" + GetColor() + "\n\t" + GetRadioactiveAsText() + "\n";
return outputString;
}
else
{
string outputString="Bunny " + GetName() + " is DEAD \n ";
return outputString;
}
cout<<"\n \n";
}
string Bunny::GetName()
{
return name;
}
string Bunny::GetGenderAsText()
{
string gender;
if(isFemale)
{
gender="Female";
}
else
{
gender="Male";
}
return gender;
}
string Bunny::GetColor()
{
return color;
}
string Bunny::GetRadioactiveAsText()
{
string radioactive;
if(isRadioactive)
radioactive="Radioactive Mutant Vampire Bunny has emerged!";
else
radioactive="";
return radioactive;
}
bool Bunny::GetIsFemale()
{
return isFemale;
}
bool Bunny::GetIsAlive()
{
return isAlive;
}
bool Bunny::GetisAdult()
{
return isAdult;
}
bool Bunny::GetisRadioactive()
{
return isRadioactive;
}
bool Bunny::SetIsAlive()
{
if (age>=10 && !isRadioactive)
{
isAlive=false;
}
else if (age>=50)
{
isAlive=false;
}
else
{
isAlive=true;
}
return isAlive;
}
int Bunny::GetAge()
{
return age;
}
int Bunny::IncrementAge()
{
if(isAlive)
age++;
if((age>=10 && !isRadioactive) ||(age>=50 && isRadioactive))
{
isAlive=false;
}
if (age>=2)
{
isAdult=true;
}
else
{
isAdult=false;
}
return age;
}
void Bunny::SetIsAliveFalse()
{
isAlive=false;
}
void Bunny::SetIsRadioactiveTrue()
{
isRadioactive=true;
}
Coordinates Bunny::GetLocation()
{
return location;
}
void Bunny::SetLocation(Coordinates newLocation)
{
location.SetX(newLocation.GetX());
location.SetY(newLocation.GetY());
}
char Bunny::GetBunnyPlaceHolder()
{
return bunnyPlaceHolder;
}
void Bunny::SetBunnyPlaceHolder(Bunny currentBunny)
{
if( currentBunny.GetIsFemale() &&
!currentBunny.GetisRadioactive() &&
!currentBunny.GetisAdult())
{
bunnyPlaceHolder='f';
}
else if(!currentBunny.GetisRadioactive() &&
!currentBunny.GetisAdult())
{
bunnyPlaceHolder='m';
}
else if(currentBunny.GetIsFemale() &&
!currentBunny.GetisRadioactive() &&
currentBunny.GetisAdult())
{
bunnyPlaceHolder='F';
}
else if(!currentBunny.GetisRadioactive() &&
currentBunny.GetisAdult())
{
bunnyPlaceHolder='M';
}
else
{
bunnyPlaceHolder='X';
}
}
bool Bunny::GetIsMarkedRadioactive()
{
return isMarkedRadioactive;
}
void Bunny::SetIsMarkedRadioactive(bool isMarked)
{
isMarkedRadioactive=isMarked;
}