Skip to content
Permalink
06e149b177
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
129 lines (112 sloc) 2.54 KB
#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;
}