#include #include using namespace std; char name[50]; char prof[50]; // int numclass; int level; int hp; int init; int hitdie; int armbon; int fort; int ref; int wil; int str; int dex; int con; int intel; int wis; int cha; int modifyStat (int stat); int main() { // ===================================INPUT=================================== cout<<"Alex's Stat Block Creator Version 1.2, Copyright Alexander Bliskovsky \n"; cin.get(); cout<<"===General Information=== \n"; cin.get(); cout<<"Please Enter Character Name: "; cin.getline ( name, 50, '\n' ); cout<<"Class Name: "; cin.getline ( prof, 50, '\n' ); cout<<"Level: "; cin>> level; cout<< "Str: "; cin>>str; cout<< "Dex: "; cin>> dex; cout<< "Con: "; cin>> con; cout<< "Int: "; cin>> intel; cout<< "Wis: "; cin>> wis; cout<< "Cha: "; cin>> cha; cout<<"===Combat Info=== \n"; cin.get(); cout<<"HP: "; cin>> hp; cout<<"Hit Die: "; cin>> hitdie; cout<<"Init: "; cin>> init; cin.get(); cout<< "Armor Bonus: "; cin>> armbon; cout<< "Base Fort Bonus: "; cin>> fort; cout<< "Base Reflex Bonus: "; cin>> ref; cout<< "Base Will Bonus: "; cin>> wil; // ===================================OUTPUT=================================== int strmod = modifyStat(str); int dexmod = modifyStat(dex); int conmod = modifyStat(con); int intmod = modifyStat(intel); int wismod = modifyStat(wis); int chamod = modifyStat(cha); char filen[50]; // ofstream savef; cout << "Please enter the filename: (no .txt): "; cin >> filen; strcat(filen, ".txt"); cout << endl << filen << " will be saved in the same directory as the program." << endl << endl; ofstream a_file ( filen ); if (a_file.is_open() ) { // if it opened the file successfully, then put the write commands in here, ie. a_file << name <<" \n"; a_file <<"Class/Level: "<< prof << " " << level <<" \n"; a_file <<"Init: +"<< init << " \n"; a_file <<"HP: "<< hp <<" ("<< level << "d" << hitdie <<") \n"; a_file <<"AC: "<< 10 + dexmod + armbon << " (10 +" << armbon << "(A) "; if (dexmod > 0 ) { a_file<< "+"; } a_file << dexmod << "(Dex)) \n"; a_file <<"\nAttacks \n \nSaves \n"; a_file <<"Fort: +" << fort + conmod << ", Ref: +" << ref + dexmod << ", Wil: +" << wil + wismod << "\n"; a_file <<"\nAttributes \n"; a_file <<"Str: "<< str << "("; if (strmod > 0 ) { a_file <<"+"; } a_file << strmod << "), Dex: " << dex <<"("; if (dexmod > 0 ) { a_file <<"+"; } a_file << dexmod << "), Con: " << con << "("; if ( conmod > 0 ) { a_file <<"+"; } a_file << conmod << ") \n"; a_file <<"Int: "<< intel << "("; if ( intmod > 0 ) { a_file<< "+"; } a_file << intmod << "), Wis: " << wis <<"("; if ( wismod > 0 ) { a_file <<"+"; } a_file << wismod << "), Cha: " << cha << "("; if (chamod > 0 ) { a_file<< "+"; } a_file << chamod << ") \n \n"; a_file <<"Relevant Feats \n \nItems" ; a_file.close(); cout<< "File " << filen << " successfully created. Please open it and add the 'Items',\n 'Attacks' and 'Relevant Feats' in notepad."; cin.get(); cin.get(); } else { cout << "Error." << endl; //if the file could not be opened } cout<< "File successfully created. Please open it and add the 'Items', 'Attacks' and \n'Relevant Feats' in notepad."; cin.get(); cin.get(); return 0; }//main int modifyStat (int stat) { int mod; mod = stat - 10; if(mod < 0) { mod--; } return mod / 2; } // Modify Stat