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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
#include <iostream>
#include <string>
#include <ctime>
#include <algorithm>
#include <fstream>
void rollDice();
class
{
public:
std:: string char_type;
int Str;
int Dex;
int Con;
int Int;
int Wis;
int Cha;
int roll;
void Roll_Die(std::string character)
{
char_type = character;
std:: cout << "\nEnter the number you rolled for the " << char_type << "\n";
std:: cin >> roll;
}
void setStr(int value) //void set can be called out in int main
{
Str = value + roll;
}
void setDex(int value) //title void set___ is how it is found by anil
{
Dex = value + roll;
}
void setCon(int value)
{
Con = value + roll;
}
void setInt(int value)
{
Int = value + roll;
}
void setWis(int value)
{
Wis = value + roll;
}
void setCha(int value)
{
Cha = value + roll;
}
void displayStats(std:: string character) //in order to cout in must be declared
{
std:: cout << "Saving throws for " << char_type << " are \n";
std :: cout << "Str = " << Str << "\n";
std:: cout << "Dex = " << Dex << "\n";
std:: cout << "Con = " << Con << "\n";
std:: cout << "Int = " << Int << "\n";
std:: cout << "Wis = " << Wis << "\n";
std:: cout << "Cha = " << Cha << "\n";
}
} play_char[4];
int main()
{
srand(time(NULL));
int nrOfThrows = 0;
int sizeOfDice = 0;
int result = 0;
int total = 0;
int x;
std::cout << "Welcome to the DND Pick-a-Me: Please choose from the following Predesigned and tested Characters!:" << std::endl << "1. Randal Greyman-Warlock" << std::endl << "2. Roya-Bard" << std::endl << "3. Ogg-Gnar the Cloak-Ranger" << std::endl << "4. Sirella Tanir- Sorcerer" << std::endl;
std:: cin >> x;
std::string players[4] = { "Ogg Gnar-Ranger", "Sirella Tanir-Sorcerer", "Roya-Bard", "Warlock-Randal Greyman" };
int strength[4] = {3, 1, 0, -1}, dexterity[4] = {3, 3, 2, 2}, constiution[4] = {-1, 2, 1, 1}, intelligence[4] = {0, 2, 1, 2}, wisdom[4] = {2, 0, 0, 0},charisma[4] = {1, -1, 3, 3 };
for (x = 0; x < 4; x++)
{
play_char[x].Roll_Die(players[x]);
play_char[x].setStr(strength[x]);
play_char[x].setDex(dexterity[x]);
play_char[x].setCon(constiution[x]);
play_char[x].setInt(intelligence[x]);
play_char[x].setWis(wisdom[x]);
play_char[x].setCha(charisma[x]);
play_char[x].displayStats(players[x]);
}
while (1)
{
std::cout << "Welcome to Our Dungeons And Dragons Helpful Rolling Application. (If you are going to roll for advantage or disadvantage please roll two dice.) Please input the action you are doing: " << std::endl << "Run=r" << std::endl << "action=a" << std::endl << "action=a" << std::endl << "check=c" << std::endl << "investigation=i"
<< std::endl << "cantrip=p" << std::endl << "spell= s" << std::endl << "attack=t" << std::endl;
std::string input;
std::cin >> input;
do
{
if (input == "r")
{
std::cout << "Please tell the DM your movement location." << std::endl;
input = "a";
}
else if (input == "c" || input == "i")
{
std::cout << "Please tell the DM what you are inspecting: " << std::endl;
rollDice();
}
else if (input != "r" || input != "a")
{
if (input == "c" || input == "s")
{
std::cout << "Please tell the DM which spell or cantrip you are using: " << std::endl;
rollDice();
}
if (input == "t")
{
std::cout << "what arer you waiting for attack!" << std::endl;
rollDice();
}
/*
{if (input == "saving throw")
{
std::cout << "what modifier type are you adding to your rolls?" << std::endl;
std::cin >>
}
if (input =="sexy time"
{
std::out << "You fail you fucking bard!"
}
*/
}
} while (input == "r" || input == "a" || input == "s" || input == "c" || input == "t" || input == "e" || input == "i" || input == "c");
}
return 0;
}
void rollDice()
{
int nrOfThrows;
int sizeOfDice;
int total = 0;
std::cout << "Please roll your dice for attack: " << std::endl;
std::cin >> nrOfThrows;
std::cout << " Please input the size of the die: " << std::endl;
std::cin >> sizeOfDice;
for (int i = 0; i < nrOfThrows; i++)
{
int result;
result = rand() % sizeOfDice + 1;
total = result;
std::cout << "Total is: " << total << std::endl;
}
}
|