if(weapon == 1){
damage = 3 + (rand() % 20);
dpm = damage*60;
cs = dpm;
cout << "Dreadlord Sword >> DPS = " << damage << " >> DPM >> " << dpm << endl;
cin.get();
time = time -1;
while(time >= 0){
dpm = dpm*multi;
cout << endl << endl << endl << "Minute: " << multi << endl <<"Damage: "<< dpm << endl << endl;
cout << "--Training Dummy-- -- HP: " << hp - dpm << endl;
cin.get();
multi = multi + 5;
time = time - 5;
dpm = cs;
}
int num = 1, fact, rawr, c1, gold;
cout << "---Duck's Game---" << endl << endl << endl << endl << endl << endl << endl;
cout << "Hi There! We challenge you to complete our 10 trials to get the prize of 1 Million Coins!" << endl << " <1> Sure! " << endl << " <2> No Thanks" << endl << ">> ";
cin >> c1;
while(c1 != 1 && c1 != 2){
cout << "Uhm, what? " << endl << ">> ";
cin >> c1;
}
if(c1 == 1){
cout << "Yay! Well then step right in to your first trial. Oh and by the way you'll need this later...'" << endl << endl << "---RUSTY SWORD---" << endl << "Item Damage: ??? " << endl << "Old Worn Out Sword" << endl << endl << "----------DUNGEON ROOM 1----------" << endl << endl;
cin.get();
cout << "Troll: YOU DARE STEP IN MY ROOM? YOU FOOL! YOU WILL PAY THE ULTIMATE PRICE";
cin.get();
cout << "* You remember the sword the gamemaster gave you earlier. *";
cin.get();
cout << " You can only get 1 good strike in so you have to really think about where you hit the troll! Entering a number now will be your damage number. ";
cin.get();
cout << " The troll has miserably low defense so hitting him will deal the factorial of the number you give" << endl << endl << "Enter your damage: " << endl << ">> ";
cin >> rawr;
while(rawr<0){
cout << "What? You can't deal negative damage!";
cin >> rawr;
}
fact = rawr;
while(fact>0){
num = fact*num;
fact = fact-1;
}
cout << "You deal " << num << " damage!" << endl ;
if (num < 15){
cout << "Oh, you didn't kill him..." << endl << "----GAME OVER----";
exit(1);
} else {
cout << "You killed him! " << endl << "+5 Coins!";
cin.get();
gold = gold + 5;
}
} else {
cout << "Oh Ok.";
exit(1);
}
int n1, n2, even, odd;
cout << "* Proceeding to the next room *" << endl << endl << "----------DUNGEON ROOM 2----------" << endl << endl;
cin.get();
cout << "You see a sphinx in the room.";
cin.get();
cout << "Suddenly it speaks!" << endl << endl << "Sphinx: TRAVELLER! WELCOME TO MY LABYRINTH, I HAVE PROVIDED YOU WITH TWO CLANS THE MEMBERS ARE SCATTERED AND THE CLAN OF TEN ONLY HAS MEMBERS THAT HAVE EVEN SHIRTS AND THE CLAN OF SEVEN ONLY HAS MEMBERS THAT HAVE ODD SHIRTS";
cin.get();
cout << "Sphinx: I WILL TELL YOU TWO NUMBERS. YOU HAVE TO GET ALL THE MEMBERS BACK IN THEIR PROPER CLANS! THESE TWO NUMBERS SERVE AS THE AMOUNT OF MEMBERS ARE THERE THE WITH THEIR SHIRTS";
cin.get();
cout << "Sphinx: THE SMALLEST NUMBER ON A PERSON'S SHIRT IS " << endl << ">> ";
cin >> n1;
cout << "Sphinx: THE BIGGEST NUMBER ON A PERSON'S SHIRT IS" << endl << ">> ";
cin >> n2;
while(n2 >= n1 ){
if (n2 % 2 == 0){
cout << endl << n2;
even = even + 1;
} else {
odd = odd + 1;
}
n2 = n2 - 1;
}
cout << endl << "You: Easy! There is " << odd << " amount of members of the clan of seven and " << even << " amount of members of the clan of ten!" << endl;
cin.get();
cout << "Sphinx: SMART TRAVELLER, I SHALL LET YOU PASS, ALSO TAKE MY TREASURE";
cin.get();
cout << "+10 Coins!";
gold = gold + 10;
int prod, r, k, l, hp = 99999, damage, php = 100, time, weapon, dpm, multi = 5, cs;
cout << endl << endl << "----------DUNGEON ROOM 3----------" << endl << endl;
cin.get();
cout << "Tour Guide: Oh! It's been a while since someone made it to this stage...";
cin.get();
cout << "Tour Guide: Most people died to the orc or got the wrong answer to the sphinx! But this is our humble abode.";
cin.get();
cout << "Tour Guide: This serves as a resting place for adventurers we have our tavern and our shop...";
cin.get();
cout << "Tour Guide: Let's go to the shop first";
cin.get();
cout << "Shopkeeper: Hi there! I'm here to sell you some artifacts..." << endl << "<1> Dreadlord Sword <2> Shadow Assassin Set <3> Wand of Atonement";
cout << endl << "*Dreadlord Sword is the only one in your budget*" << endl << "Can I take the dreadlord sword please?";
cin.get();
cout << "Shopkeeper: Sure!" << endl << "-15 Gold";
cin.get();
gold = gold-gold;
cout << "Tour Guide: Oh wow! You actually bought something. " << endl << "Tour Guide: You must be feeling tired, do you wanna rest in the tavern. " ;
cin.get();
cout << "You: No I'm not, I'll test out this sword first. I'll come with you later" << endl << "Tour Guide: Oki, tell me when you wanna sleep though. " << endl << endl;
cin.get();
cout << "How long do you want to practice? " << endl << ">> ";
cin >> time;
while(time > 30 || time % 5 != 0){
cout << "Time limit of 30 minutes and it has to be an interval of 5!" << endl << ">> ";
cin >> time;
}
cout << "--Training Dummy-- -- HP: " << hp << endl << " Moves:" << endl << " N/A" << endl << endl;
cout << "--You-- -- --HP: " << php << endl << " Weapon:" << endl << "<1> DreadLord Sword" << endl << "<2> Rusty Sword";
cout << endl << "What weapon will you use?" << endl << ">> ";
cin >> weapon;
if(weapon == 1){
damage = 3 + (rand() % 20);
dpm = damage*60;
cs = dpm;
cout << "Dreadlord Sword >> DPS = " << damage << " >> DPM >> " << dpm << endl;
cin.get();
time = time -1;
while(time >= 0){
dpm = dpm*multi;
cout << endl << endl << endl << "Minute: " << multi << endl <<"Damage: "<< dpm << endl << endl;
cout << "--Training Dummy-- -- HP: " << hp - dpm << endl;
cin.get();
multi = multi + 5;
time = time - 5;
dpm = cs;
}
} else {
damage = 1 + (rand() % 3);
dpm = damage*60;
cs = dpm;
cout << "Rusty Sword >> DPS = " << damage << " >> DPM >> " << dpm << endl;
cin.get();
time = time -1;
while(time >= 0){
dpm = dpm*multi;
cout << endl << endl << endl << "Minute: " << multi << endl <<"Damage: "<< dpm << endl << endl;
cout << "--Training Dummy-- -- HP: " << hp - dpm << endl;
cin.get();
multi = multi + 5;
time = time - 5;
dpm = cs;
}
}
float h1, h2, rl, rt , ht , htt, ch = 0;
float h9;
cout << endl << "That took a long time! Time to rest...";
cin.get();
cout << endl << "Tour Guide: Ah, there you are traveller! The tavern is already filled up...";
cin.get();
cout << endl << "You: Oh no, is there any way I can squeeze in?";
cin.get();
cout << endl << "Tour Guide: Not really, but you can look at the tavern arrangements and check if any rooms are occupied";
cin.get();
cout << endl << "Landlord: Hi, sorry but we're filled up at the moment. Please come again tomorrow and see";
cin.get();
cout << endl << "You: Can I see the tavern schematic so that I can see the occupied and unoccupied rooms?";
cin.get();
cout << endl << "Landlord: Sure!" << endl << "You: How many floors are there?";
cin.get();
cout << "Landlord: There are ___ amount of floors" << endl << ">> ";
cin >> h1;
h2 = h1;
while(h2 != 0){
ch = ch + 1;
h2 = h2-1;
cout << "You: How many rooms are in floor " << ch << "?"<< endl << ">> ";
cin >> rl;
cout << "You: How many occupied rooms are in floor " << ch << "?" << endl << ">> ";
cin >> ht;
while (ht > rl){
cout << "Invalid number! That's more occupied rooms than there are rooms...'" << endl << ">> ";
cin >> ht;
}
rt = rt + rl;
htt = htt + ht;
}
h9 = (htt/rt)*100;
if (htt != 100){
cout << "Ah! So there is an empty room infact there is " << htt << " amount of empty rooms meaning you have a occupancy rate of " << h9 << "%" << endl << " So, can I sleep in one of the rooms?";
cin.get();
cout << endl << "Landlord: Ok fine! Sure";
cin.get();
} else {
cout << "You: Oh... Fine I'll sleep outside then";
}
int x, y, z = 0, w = 0;
cout << "After your rest, you feel like you should go to the next room so you bid your goodbyes and enter dungeon room 4" << endl << endl << endl << "----------DUNGEON ROOM 4----------" << endl << endl <<endl;
cin.get();
="" cout="" <<="" "there's="" nothing="" in="" the="" room="" but="" a="" stone="" puzzle="" engraved="" is"="" endl="" "-i="" will="" tell="" you="" 10-20="" numbers="" then="" must="" me="" how="" many="" negative="" there="" are="" and="" positive="" are-";
="" "how="" do="" want="" to="" input?"="" "="">> ";
cin >> x;
while(x > 20 || x < 10){
cout << "Invalid Number! Try again..." << endl << ">> ";
cin >> x;
}
cout << "You go to the stone tablet and enter " << x << " numbers";
while(x != 0){
x = x-1;
cout << endl << "ENTER YOUR NUMBER! " << endl << ">> ";
cin >> y;
if(y > 0){
z = z + 1;
} else {
w = w + 1;
}
}
cout << "You: Uhh, I think there are " << z << " amount of positive numbers and " << w << " amount of negative numbers";
cin.get();
cout << endl << "The stone doors open";
cin.get();
cout << "+10 gold";
gold = gold + 10;
float mons, nm, dta, lp = 250, turn = 1, ldmg, vline;
float modi;
php = 100;
cout << endl << endl << endl << "----------DUNGEON ROOM 5----------" << endl << endl <<endl;
cin.get();
="" cout="" <<="" "...";
="" "you="" hear="" faint="" footsteps";
="" "footsteps="" get="" louder";
="" "???:="" traveller...="" ";
="" "...goodbye"="" endl;
="" "-----battle-initiated-----"="" endl="" "--livid--="" --hp="" "="" lp="" ???="" "--you--="" --="" --hp:="" php="" weapon:"="" "<1=""> DreadLord Sword" << endl << "<2> Rusty Sword";
cout << endl << "What weapon will you use?" << endl << ">> ";
cin >> weapon;
while(weapon != 1){
cout << "Your senses doesn't let you use the weak sword! " << endl << ">> ";
cin >> weapon;
}
if(weapon == 1){
while(php != 0 && lp != 0){
if(turn = 1){
damage = 3 + (rand() % 20);
cout << " <1> Great Slash " << endl << " <2> Dreadlord " << endl << " <3> Slash " << endl << ">> ";
cin >> mons;
while(mons > 3 || mons < 1){
cout << " <1> Great Slash " << endl << " <2> Dreadlord " << endl << " <3> Slash " << endl << ">> ";
cin >> mons;
}
if (mons = 1){
modi = 0 + (rand() % 2) * damage;
if(modi = 0){
cout << endl << "You have been paralyzed by fear" << endl;
} else {
cout << endl << "You have dealt " << modi << " amount of damage" << endl;
}
lp = lp - modi;
cout << "--Livid-- --HP " << lp << endl;
cout << "--YOU-- --HP " << php << endl;
turn = turn - 1;
} else if (mons = 2){
modi = 1 + (rand() % 2) * damage;
cout << endl << "You have dealt " << modi << " amount of damage" << endl;
lp = lp - modi;
cout << "--Livid-- --HP " << lp << endl << endl;
cout << "--YOU-- --HP " << php << endl << endl;
turn = turn - 1;
} else {
cout << endl << "You have dealt " << modi << " amount of damage" << endl;
lp = lp - damage;
cout << "--Livid-- --HP " << lp << endl << endl;
cout << "--YOU-- --HP " << php << endl << endl;
turn = turn - 1;
}
} else {
ldmg = 5 + (rand() % 10);
vline = 1 + (rand() % 5);
if (vline = 1){
cout << "Livid: You shall know death!" << endl << "Livid dealt " << ldmg << "!";
cout << "--Livid-- --HP " << lp << endl;
cout << "--YOU-- --HP " << php << endl;
turn = turn + 1;
} else if(vline = 2){
cout << "Livid: Fear me Traveller..." << endl << "Livid dealt " << ldmg << "!";
cout << "--Livid-- --HP " << lp << endl;
cout << "--YOU-- --HP " << php << endl;
turn = turn + 1;
} else if(vline = 3){
cout << "Livid: I am the beginning, I am the end" << endl << "Livid dealt " << ldmg << "!";
cout << "--Livid-- --HP " << lp << endl;
cout << "--YOU-- --HP " << php << endl;
turn = turn + 1;
} else if(vline = 4){
cout << "Livid: Who will you cry for? once you know you will die" << endl << "Livid dealt " << ldmg << "!";
cout << "--Livid-- --HP " << lp << endl;
cout << "--YOU-- --HP " << php << endl;
turn = turn + 1;
} else{
cout << "Livid: To dust..." << endl << "Livid dealt " << ldmg << "!";
php = php - ldmg;
cout << "--Livid-- --HP " << lp << endl;
cout << "--YOU-- --HP " << php << endl;
turn = turn + 1;
}
}
}
}
if(php = 0){
cout << endl << "...";
cin.get();
cout << endl << "...";
cin.get();
cout << endl << "...";
cin.get();
cout << endl << "Livid: No...";
cin.get();
cout << endl << "Livid: Pick it up";
cin.get();
cout << endl << "You: What?";
cin.get();
cout << endl << "Livid: I said pick it up!";
cin.get();
cout << endl << "Livid: Pick it up and leave this place...";
cin.get();
cout << endl << "Livid dissappears to the shadows once again, he lets you pass...";
} else {
cout << endl << "Livid: No, NO! Not again... Not Him";
cin.get();
cout << endl << "Thunder strikes livid leaving him burnt and dead...";
cin.get();
cout << "--------BATTLE WON!--------" << endl;
cout << "+30 Gold ";
}
}
What I have tried:
Error is C:\Users\ZACK\OneDrive\Documents\Asirit_Problem_Set_2.cpp [Error] 'rand' cannot be used as a function