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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
void earth()
{
// Variables ********************************
string line1, line2, line3, line4, line5, line6, line7, line8;
string choice;
int floop;
int HP;
int PP;
int Att;
int Def;
int Agi;
int Lck;
fstream results;
ifstream stats;
// Helpful output for the user to follow *********************
for (int floop = 0; floop < 7; ++floop){
cout << "______________________________________" << endl;
cout << "Welcome, Earth Adept!" << endl;
cout << "Select Earth Djinni from below:" << endl << endl;
cout << "________ HP PP Att Def Agi Lck" << endl;
cout << "Flint 8 4 3 -- -- --" << endl;
cout << "Granite 9 -- -- 2 2 1" << endl;
cout << "Quartz 10 3 -- -- 3 --" << endl;
cout << "Vine 12 4 -- 3 -- 1" << endl;
cout << "Sap 10 -- 3 -- -- 1" << endl;
cout << "Ground 9 3 -- -- 3 --" << endl;
cout << "Bane 12 -- 4 -- -- --" << endl;
cout << "________" << endl << endl;
stats.open("isaacstats.txt");
stats >> HP >> PP >> Att >> Def >> Agi >> Lck;
stats.close();
// write current stats to console
cout << "-Current-" << endl;
cout << "HP: " << HP << endl;
cout << "PP: " << PP << endl;
cout << "Att: " << Att << endl;
cout << "Def: " << Def << endl;
cout << "Agi: " << Agi << endl;
cout << "Lck: " << Lck << endl;
// If statements for each Djinni to be called with
cout << endl;
cout << "Earth Djinni: ";
cin >> choice;
cout << endl;
if (choice == "flint" || choice == "Flint" || choice == "FLINT"){
cout << "You teamed up with Flint!" << endl << endl;
cout << "-Stats Added-" << endl;
cout << "HP: 8" << endl;
cout << "PP: 4" << endl;
cout << "Att: 3" << endl;
cout << "______________________________________" << endl;
// increment the variables by their correct amounts
HP += 8;
PP += 4;
Att += 3;
}
if (choice == "granite" || choice == "Granite" || choice == "GRANITE"){
cout << "You teamed up with Granite!" << endl << endl;
cout << "-Stats Added-" << endl;
cout << "HP: 9" << endl;
cout << "Def: 2" << endl;
cout << "Agi: 2" << endl;
cout << "Lck: 1" << endl;
cout << "______________________________________" << endl;
HP += 9;
Def += 2;
Agi += 2;
Lck += 1;
}
if (choice == "quartz" || choice == "Quartz" || choice == "QUARTZ"){
cout << "You teamed up with Quartz!" << endl << endl;
cout << "-Stats Added-" << endl;
cout << "HP: 10" << endl;
cout << "PP: 3" << endl;
cout << "Agi: 3" << endl;
cout << "______________________________________" << endl;
HP += 10;
PP += 3;
Agi += 3;
}
if (choice == "vine" || choice == "Vine" || choice == "VINE"){
cout << "You teamed up with Vine!" << endl << endl;
cout << "-Stats Added-" << endl;
cout << "HP: 12" << endl;
cout << "PP: 4" << endl;
cout << "Def: 3" << endl;
cout << "Lck: 1" << endl;
cout << "______________________________________" << endl;
HP += 12;
PP += 4;
Def += 3;
Lck += 1;
}
if (choice == "sap" || choice == "Sap" || choice == "SAP"){
cout << "You teamed up with Sap!" << endl << endl;
cout << "-Stats Added-" << endl;
cout << "HP: 10" << endl;
cout << "Att: 3" << endl;
cout << "Lck: 1" << endl;
cout << "______________________________________" << endl;
HP += 10;
Att += 3;
Lck += 1;
}
if (choice == "ground" || choice == "Ground" || choice == "GROUND"){
cout << "You teamed up with Ground!" << endl << endl;
cout << "-Stats Added-" << endl;
cout << "HP: 9" << endl;
cout << "PP: 3" << endl;
cout << "Agi: 3" << endl;
cout << "______________________________________" << endl;
HP += 9;
PP += 3;
Agi += 3;
}
if (choice == "bane" || choice == "Bane" || choice == "BANE"){
cout << "You teamed up with Bane!" << endl << endl;
cout << "-Stats Added-" << endl;
cout << "HP: 12" << line1 << endl;
cout << "Att: 4" << line2 << endl << endl;
cout << "______________________________________" << endl;
HP += 12;
Att += 4;
}
// write results to results.txt
results.open("results.txt");
results << "-Isaac-" << endl;
results << "Earth Adept" << endl;
results << "HP: " << HP << endl;
results << "PP: " << PP << endl;
results << "Att: " << Att << endl;
results << "Def: " << Def << endl;
results << "Agi: " << Agi << endl;
results << "Lck: " << Lck;
results.close();
} // end of loop
// read first 7 lines in results.txt
results.open("results.txt");
getline(results, line1);
getline(results, line2);
getline(results, line3);
getline(results, line4);
getline(results, line5);
getline(results, line6);
getline(results, line7);
getline(results, line8);
results.close();
// display results.txt to console
cout << line1 << endl;
cout << line2 << endl;
cout << line3 << endl;
cout << line4 << endl;
cout << line5 << endl;
cout << line6 << endl;
cout << line7 << endl;
cout << line8 << endl;
} // end function earth
|