Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
danyalm committed Mar 20, 2020
1 parent ac05880 commit 06e149b1775d102be2b975c6cdb6e15f023a7b35
Show file tree
Hide file tree
Showing 18 changed files with 1,377 additions and 0 deletions.
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>
@@ -0,0 +1,107 @@
#include "Master.h"
#include "AI.h"
#include <iostream>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <sstream>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <map>

using namespace std;

AI::AI()
{

}

void AI::RandomCombo()
{
srand(time(NULL));
int randNum = rand() % 30;
name = deck[randNum][0];
AttackPoints = deck[randNum][1];
DefencePoints = deck[randNum][2];
deck.erase(randNum);
/*
for (int j = 0; j < 29; j++)
{
if (j = randNum)
{
for (int k = 0; k < 3; k++)
{
m[j][k] = m[j + 1][k + 1];
}
}
}
*/
}

int AI::ZonePicker()
{
srand(time(NULL));
int randNum = rand() % 5;
return randNum;
}

void AI::AIHand()
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon, 6);
string topBorder(75, '|'), fillArea(13, ' '), bottomBorder(75, '|'), halfArea(6, ' '), halfArea2(5, ' ');
cout << topBorder << "\n";
for (int i = 0; i < 7; i++)
{
for (int z = 0; z <= 4; z++)
{
cout << "|" << fillArea << "|";

}
cout << "\n";
}
cout << bottomBorder << "\n\n\n";
HANDLE i = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(i, 14);
}

string AI::getCardName()
{
return name;
}

string AI::getCardAttack()
{
return AttackPoints;
}

string AI::getCardDefence()
{
return DefencePoints;
}



void AI::AICard()
{
string temp_name = getCardName();
string temp_AttackPoints = getCardAttack();
string temp_DefencePoints = getCardDefence();
string TopBorder(15, '|'), fillArea(13, ' ');
string atkPoints = temp_AttackPoints + " Attack";
string defPoints = temp_DefencePoints + " Defence";
cout << TopBorder << endl;
cout << '|' << textFormatter(temp_name) << '|' << "\n";
for (int i = 0; i <= 2; i++)
{
cout << '|' << fillArea << '|' << "\n";
}
cout << '|' << textFormatter(atkPoints) << '|' << "\n";
cout << '|' << textFormatter(defPoints) << '|' << "\n";
cout << '|' << fillArea << '|' << "\n";
cout << TopBorder << endl;
}


@@ -0,0 +1,28 @@
#include <iostream>
#include <map>

using namespace std;


class AI : public Master
{
public:
AI();

int lifePoints = 3000;
string name;
string AttackPoints;
string DefencePoints;

void RandomCombo();
int ZonePicker();
void AIHand();

void AICard();

string getCardName();
string getCardAttack();
string getCardDefence();

};

@@ -0,0 +1,129 @@
#include "Master.h"
#include "Player.h"
#include "Hand.h"
#include "Card.h"
#include <iostream>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <sstream>
#include <stdlib.h>
#include <time.h>
#include <windows.h>

using namespace std;

Card::Card() {}

int Card::getID()
{
ofstream cFile;
cFile.open("Dreamman.txt");
return 0;
}

string Card::getName()
{
string cName = "testName";
return cName;
}

string Card::getDesc()
{
string cDesc = "test Description";
return cDesc;
}

void Card::disName(string cName)
{
cout << "The name of the card:" << cName << endl;
}

void Card::disDesc(string cDesc)
{
cout << "The discription of the card" << cDesc << endl;
}

void Card::GenerateMonster()
{
string line;
ifstream myfile("monsterDetails.txt");
if (myfile.is_open())
{
while (getline(myfile, line))
{
int a;
int i;
i = 0;
while (!myfile.eof()) //while the end of file is NOT reached
{

a = 0;
getline(myfile, line); //get one line from the file
monsterNames[i][a] = line;
//cout << monsterNames[i][a] << "\n";
a++;
getline(myfile, line); //get one line from the file
monsterNames[i][a] = line;
//cout << monsterNames[i][a] << "\n";
a++;
getline(myfile, line); //get one line from the file
monsterNames[i][a] = line;
//cout << monsterNames[i][a] << "\n";
i++;
}
}
myfile.close();
}
else {

cout << "Unable to open file";
}
}

void Card::GenerateStats()
{
srand(time(NULL));
int randNum = rand() % 10;
name = monsterNames[randNum][0];
AttackPoints = monsterNames[randNum][1];
DefencePoints = monsterNames[randNum][2];
}

string Card::getCardName()
{
return name;
}

string Card::getCardAttack()
{
return AttackPoints;
}

string Card::getCardDefence()
{
return DefencePoints;
}

void Card::CardGenerator()
{
string temp_name = getCardName();
string temp_AttackPoints = getCardAttack();
string temp_DefencePoints = getCardDefence();
string TopBorder(15, '|'), fillArea(13, ' ');
string atkPoints = temp_AttackPoints + " Attack";
string defPoints = temp_DefencePoints + " Defence";
cout << TopBorder << endl;
cout << '|' << textFormatter(temp_name) << '|' << "\n";
for (int i = 0; i <= 2; i++)
{
cout << '|' << fillArea << '|' << "\n";
}
cout << '|' << textFormatter(atkPoints) << '|' << "\n";
cout << '|' << textFormatter(defPoints) << '|' << "\n";
cout << '|' << fillArea << '|' << "\n";
cout << TopBorder << endl;
}


@@ -0,0 +1,35 @@
#include <iostream>

using namespace std;

class Card : public Hand //This is the Card Base class
{
public:
Card();
int cardID;
string cardName;
string cardDesc;

int getID();
string getName(); //Get methods to retrive data to pass to set methods to apply data.
string getDesc();

void disName(string cName); //dis=display
void disDesc(string cDesc);

void GenerateStats();
void GenerateMonster();
void CardGenerator();
string monsterNames[10][3];

string name;
string AttackPoints;
string DefencePoints;

string getCardName();
string getCardAttack();
string getCardDefence();


};

0 comments on commit 06e149b

Please sign in to comment.