1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
int ncards;
Card **cardarr = new Card*[ncards];
void Create()
{
string title;
string number;
char restriction;
short int stock;
short int attr;
short int lvl;
short int mtype;
char tune;
short int atk;
short int def;
string meffect;
cout<<"How many cards do you want to create? ";
cin>>ncards;
// Define a pointer to an array of base class pointers
char decision; //switch control character
for(int i=0;i<ncards;i++)
{
//Ask for card type
cout<<"Do you want to creat a (m)onster card, (e)ffect monster card, (t)rap card or (s)pell card?"<<endl;
cin>>decision;
for(;decision!='m' && decision!='e' && decision!='t' && decision!= 's';cin>>decision)
{cout<<"Error: input not recognised. Please reenter choice."<<endl;}
switch(decision)
{
case 'e':
cout<<"Enter card name: "<<endl;
getline(cin, title);
for(;number.length()!=8;){
cout<<"Enter card number. It must be exaclty eight characters long."<<endl;
getline(cin, number);
if(number.length()!=8){cout<<"Error: The number entered is not the correct length."<<endl;}
}
do
{
cout<<"Set limit: (f)orbidden, (l)imited, (s)emi-limited or (u)nlimited."<<endl;
cin>>restriction;
if(restriction!='f'&& restriction!='l'&& restriction!='s'&& restriction!='u')
{cout<<"Error: Limitation not recognised"<<endl;}
}while(restriction!='f'&& restriction!='l'&& restriction!='s'&& restriction!='u');
cout<<"Enter the stock amount."<<endl;
cin>>stock;
cout<<"Set attribute: 1: Dark, 2: Divine, 3: Earth 4: Fire, ";
cout<<"5: Light, 6: Water, 7: Wind. Any other value will be taken as 0 (Unknown)"<<endl;
cin>>attr;
if(0>attr || attr>7){}
else{attr=0;}
cout<<"Set level. A value not between 1 and 12 will be taken as 0 (Unknown)"<<endl;
cin>>lvl;
if(0>lvl || lvl>12){}
else{lvl=0;}
cout<<"Set monster type: 1: Aqua, 2: Beast, 3: Beast-Warrior, 4:
Dinosaur, 5: Divine-Beast, 6: Dragon 7: Fairy, ";
cout<<"8: Fiend ,9: Fish, 10: Insect, 11: Machine, 12: Plant, 13:
Psychic, 14: Pyro, ";
cout<<"15: Reptile, 16: Rock, 17: Sea Serpent, 18: Spellcaster, 19:
Thunder, 20: Warrior, 21: Winged-Beast, ";
cout<<"22: Zombie. Any other value will be taken as 0 (Unknown)"<<endl;
cin>>mtype;
if(0>mtype || mtype>22){}
else{mtype=0;}
cout<<"Is the card a tuner? y/n"<<endl;
cin>>tune;
if(tune!='y'){tune='n';}
cout<<"Enter attack value."<<endl; cin>>atk;
cout<<"Enter defence value."<<endl; cin>>def;
cout<<"Type in the monster effect"<<endl;
getline(cin, meffect);
cardarr[i] = new Effect_Monster(meffect, attr, lvl, mtype, tune,
atk, def, title, number, restriction, stock);
break;
{
|