Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.14 KB | None | 0 0
  1.  
  2. #include <iostream.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <conio.h>
  7. #include <iomanip.h>
  8. #include <windows.h>
  9. #include <time.h>
  10.  
  11.  
  12. void Menu(); //declaring my fuctions, variables, integers etc.
  13. void InstructionsManuel();
  14. void YouWinTheGame();
  15. void YouWin();
  16. void YouWinTR();
  17. void YouWinTo();
  18. void YouLose();
  19. void Battle();
  20. void BattleTR();
  21. void TournamentBattle();
  22. void SingleMatch();
  23. void Tournament();
  24. void BuyEquipement();
  25. void ExitChoice();
  26. void Attack();
  27. void AttackTR();
  28. void Potion();
  29. void GiveUp();
  30. void Damage();
  31. void DamageTR();
  32. void DamageEN();
  33. void DamageENTR();
  34. void Weapons();
  35. void Armors();
  36. void Potions();
  37. void Boss1();
  38. void Boss2();
  39. void Boss3();
  40. void Boss4();
  41. void Boss5();
  42. void Boss6();
  43. void Boss7();
  44. char UserName[20];
  45. char EnemyName[20];
  46. int Boss = 0;
  47. int weapon;
  48. int TrainingKills;
  49. int MaxHealth = 100;
  50. int SmallPotion = 2;
  51. int MediumPotion = 1;
  52. int BigPotion = 1;
  53. int MaxPotion = 1;
  54. int SmallMaxHealthPotion = 0;
  55. int MediumMaxHealthPotion = 0;
  56. int BigMaxHealthPotion = 0;
  57. int WoodenStick = 1;
  58. int WoodenSword = 0;
  59. int IronSword = 0;
  60. int SilverSword = 0;
  61. int GoldenSword = 0;
  62. int PlatinumSword = 0;
  63. int Excalibur = 0;
  64. int WoodenArmor = 0;
  65. int IronArmor = 0;
  66. int SilverArmor = 0;
  67. int GoldenArmor = 0;
  68. int PlatinumArmor = 0;
  69. int KristalArmor = 0;
  70. int UserHealth = 100;
  71. int MenuChoice;
  72. int response;
  73. int experience = 0;
  74. int EnemyHealth = 100;
  75. int money = 0;
  76. int DamagePoints;
  77. int gain = 100;
  78. int TR = 0;
  79. int y;
  80. int x;
  81.  
  82. HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE); //Has something to do with colors
  83.  
  84.  
  85. void Menu() //The main menu function
  86. {
  87. system("CLS");
  88. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY); //Setting color
  89. cout<<"What do you want to do "<<UserName<<"?\n\n";
  90. cout<<"(1) Training\n";
  91. cout<<"(2) Single match\n";
  92. cout<<"(3) Tournament\n";
  93. cout<<"(4) Shop\n";
  94. cout<<"(5) Read the instructions manuel\n";
  95. cout<<"Or enter (6) to exit the game\n\n";
  96. cin>>MenuChoice;
  97.  
  98. switch (MenuChoice)
  99. {
  100. case 1 : strcpy(EnemyName, "Harold");
  101. BattleTR();
  102. break;
  103. case 2 : SingleMatch();
  104. break;
  105. case 3 : Tournament();
  106. break;
  107. case 4 : BuyEquipement();
  108. break;
  109. case 5 : InstructionsManuel();
  110. break;
  111. case 6 : ExitChoice();
  112. break;
  113. default : cout<<"Error, bad innput, press any key to continue.";
  114. getch();
  115. Menu();
  116. break;
  117. }
  118. };
  119.  
  120. void InstructionsManuel() //Instructions Manuel
  121. {
  122. system("CLS");
  123. SetConsoleTextAttribute(stdOut, FOREGROUND_GREEN | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  124. cout<<"Welcome to the Instructions Manuel, here you'lle find\n";
  125. cout<<"all the basic rules of the game.\n\n";
  126.  
  127. cout<<"1. Every 5 victorys in Single Match mode you get a Boss,\n";
  128. cout<<"wich is much stronger than the other opponnents.\n\n";
  129.  
  130. cout<<"2. In Tournament Mode you get to play 7 matches,\n";
  131. cout<<"for the first two matches you get 100,- each,\n";
  132. cout<<"for matches 4 to 6 you get 200,- each,\n";
  133. cout<<"and for the last match you get 500,-!!!.\n\n";
  134.  
  135. cout<<"3. You only begin with a few potions, so be carefull with them.\n";
  136. cout<<"If you want to buy some more Potions, go to the shop.\n\n";
  137.  
  138. cout<<"Press any key to return to the Main Menu.\n";
  139. getch();
  140. Menu();
  141. };
  142.  
  143. void ExitChoice() //Used for checking if you realy want to exit the game
  144. {
  145. system("CLS");
  146. cout<<"You really want to exit the game? (1) yes / (2) no\n";
  147. cin>>response;
  148. if (response == 1)
  149. {
  150. exit(0);
  151. }
  152. else if (response == 2)
  153. {
  154. system("CLS");
  155. Menu();
  156. }
  157. else
  158. {
  159. cout<<"Error, enter 1 or 2\n";
  160. ExitChoice();
  161. }
  162. };
  163.  
  164. void BattleTR() //Batlle function in Training mode
  165. {
  166. system("CLS");
  167. strcpy(EnemyName, "Harold");
  168. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  169. cout<<UserName<<"\t\t\t\t\t\t\t\t "<<EnemyName<<endl;
  170. cout<<"Health "<<UserHealth<<"%\t\t\t\t\t\t\t "<<"Health "<<EnemyHealth<<"%"<<"\n\n";
  171.  
  172. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  173. cout<<"(1) Attack\n";
  174. cout<<"(2) Use potion\n";
  175. cout<<"(3) Give up\n";
  176. cin>>y;
  177. cout<<"\n\n";
  178.  
  179. switch (y)
  180. {
  181. case 1 : AttackTR();
  182. break;
  183. case 2 : Potion();
  184. break;
  185. case 3 : GiveUp();
  186. break;
  187. default : cout<<"Error, bad input, press any key to continue.\n";
  188. getch();
  189. system("CLS");
  190. BattleTR();
  191. break;
  192. }
  193. };
  194.  
  195. void Battle() //Battle function for all the other modes
  196. {
  197. system("CLS");;
  198. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  199. cout<<UserName<<"\t\t\t\t\t\t\t\t "<<EnemyName<<endl;
  200. cout<<"Health "<<UserHealth<<"%\t\t\t\t\t\t\t "<<"Health "<<EnemyHealth<<"%"<<"\n\n";
  201.  
  202. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  203. cout<<"(1) Attack\n";
  204. cout<<"(2) Use potion\n";
  205. cout<<"(3) Give up\n";
  206. cin>>y;
  207. cout<<"\n\n";
  208.  
  209. switch (y)
  210. {
  211. case 1 : Attack();
  212. break;
  213. case 2 : Potion();
  214. break;
  215. case 3 : GiveUp();
  216. break;
  217. default : cout<<"Error, bad input, press any key to continue.\n";
  218. getch();
  219. system("CLS");
  220. Battle();
  221. break;
  222. }
  223. };
  224.  
  225. void SingleMatch() //Single match mode
  226. {
  227. system("CLS");
  228. srand((unsigned)time(NULL)); //random number
  229. x = rand() % 15;
  230. if (x == 0)
  231. {
  232. strcpy(EnemyName, "Claude"); //declaring random names
  233. }
  234. else if (x == 1)
  235. {
  236. strcpy(EnemyName, "Luca");
  237. }
  238. else if(x == 2)
  239. {
  240. strcpy(EnemyName, "Ludovic");
  241. }
  242. else if(x == 3)
  243. {
  244. strcpy(EnemyName, "Tristan");
  245. }
  246. else if(x == 4)
  247. {
  248. strcpy(EnemyName, "Joshua");
  249. }
  250. else if(x == 5)
  251. {
  252. strcpy(EnemyName, "Christiaan");
  253. }
  254. else if(x == 6)
  255. {
  256. strcpy(EnemyName, "Florian");
  257. }
  258. else if(x == 7)
  259. {
  260. strcpy(EnemyName, "Duke");
  261. }
  262. else if(x == 8)
  263. {
  264. strcpy(EnemyName, "Maria");
  265. }
  266. else if(x == 9)
  267. {
  268. strcpy(EnemyName, "Andreas");
  269. }
  270. else if(x == 10)
  271. {
  272. strcpy(EnemyName, "Jona");
  273. }
  274. else if(x == 11)
  275. {
  276. strcpy(EnemyName, "Piccard");
  277. }
  278. else if(x == 12)
  279. {
  280. strcpy(EnemyName, "Stefan");
  281. }
  282. else if(x == 13)
  283. {
  284. strcpy(EnemyName, "Jeremie");
  285. }
  286. else if(x == 14)
  287. {
  288. strcpy(EnemyName, "Nathalie");
  289. }
  290. else if(x == 15)
  291. {
  292. strcpy(EnemyName, "Paul");
  293. }
  294. Battle();
  295. };
  296.  
  297. void Tournament() //tournament mode
  298. {
  299. system("CLS");
  300. TR = TR + 1;
  301. srand((unsigned)time(NULL)); //random number
  302. x = rand() % 15;
  303. if (x == 0)
  304. {
  305. strcpy(EnemyName, "Claude"); //declaring random names
  306. }
  307. else if (x == 1)
  308. {
  309. strcpy(EnemyName, "Luca");
  310. }
  311. else if(x == 2)
  312. {
  313. strcpy(EnemyName, "Ludovic");
  314. }
  315. else if(x == 3)
  316. {
  317. strcpy(EnemyName, "Tristan");
  318. }
  319. else if(x == 4)
  320. {
  321. strcpy(EnemyName, "Joshua");
  322. }
  323. else if(x == 5)
  324. {
  325. strcpy(EnemyName, "Christiaan");
  326. }
  327. else if(x == 6)
  328. {
  329. strcpy(EnemyName, "Florian");
  330. }
  331. else if(x == 7)
  332. {
  333. strcpy(EnemyName, "Duke");
  334. }
  335. else if(x == 8)
  336. {
  337. strcpy(EnemyName, "Maria");
  338. }
  339. else if(x == 9)
  340. {
  341. strcpy(EnemyName, "Andreas");
  342. }
  343. else if(x == 10)
  344. {
  345. strcpy(EnemyName, "Jona");
  346. }
  347. else if(x == 11)
  348. {
  349. strcpy(EnemyName, "Piccard");
  350. }
  351. else if(x == 12)
  352. {
  353. strcpy(EnemyName, "Stefan");
  354. }
  355. else if(x == 13)
  356. {
  357. strcpy(EnemyName, "Jeremie");
  358. }
  359. else if(x == 14)
  360. {
  361. strcpy(EnemyName, "Nathalie");
  362. }
  363. else if(x == 15)
  364. {
  365. strcpy(EnemyName, "Paul");
  366. }
  367. Battle();
  368. };
  369.  
  370. void BuyEquipement() //Shop mode
  371. {
  372. system("CLS");
  373. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  374. cout<<"Welcome to The Shop, here you'lle find everything you need.\n";
  375. cout<<"We are the best, cheapest and only shop in the neighborhood,\n";
  376. cout<<"so buy as much as you can!\n\n";
  377.  
  378. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  379. cout<<"What do you want to buy?\n\n";
  380.  
  381. cout<<"1. Weapons\n";
  382. cout<<"2. Armor\n";
  383. cout<<"3. Potions\n";
  384. cout<<"4. Return to main menu\n";
  385. cin>>x;
  386.  
  387. switch (x)
  388. {
  389. case 1 : Weapons();
  390. break;
  391. case 2 : Armors();
  392. break;
  393. case 3 : Potions();
  394. break;
  395. case 4 : Menu();
  396. break;
  397. default : cout<<"Error, please enter correct number.\n";
  398. BuyEquipement();
  399. break;
  400. }
  401.  
  402. };
  403.  
  404. void GiveUp() //battle function 3, give up and return to main menu
  405. {
  406. system("CLS");
  407. experience = experience - 1;
  408. Menu();
  409. };
  410.  
  411. void Weapons() //My weapon shop
  412. {
  413. system("CLS");
  414. cout<<"Wich Weapon(s) do you want to buy?\n\n";
  415. cout<<"Your money = "<<money<<"\n\n";
  416. cout<<"NAME\t\t\tDAMAGE\t\t\tCOST\n";
  417. cout<<"1. Wooden Sword\t\t10-20\t\t\t250\n";
  418. cout<<"2. Iron Sword\t\t20-30\t\t\t350\n";
  419. cout<<"3. Silver Sword\t\t30-40\t\t\t500\n";
  420. cout<<"4. Golden Sword\t\t40-50\t\t\t750\n";
  421. cout<<"5. Platinum Sword\t50-60\t\t\t1000\n";
  422. cout<<"6. Excalibur\t\t70-100\t\t\t1500\n";
  423. cout<<"7. Return to buy menu\n";
  424. cout<<"8. Return to main menu\n\n";
  425. cout<<"What do you want to do?\n";
  426. cin>>x;
  427.  
  428. switch (x)
  429. {
  430. case 1 : if (money >= 250)
  431. {
  432. cout<<"Fine Choice\n";
  433. money = money - 250;
  434. WoodenSword = 1;
  435. cout<<"Press any key to continue.\n";
  436. getch();
  437. Weapons();
  438. }
  439. else
  440. {
  441. cout<<"You don't have enough money\n";
  442. cout<<"Press any key to continue.\n";
  443. getch();
  444. Weapons();
  445. };
  446. break;
  447. case 2 : if (money >= 350)
  448. {
  449. cout<<"Fine Choice\n";
  450. money = money - 350;
  451. IronSword = 1;
  452. cout<<"Press any key to continue.\n";
  453. getch();
  454. Weapons();
  455. }
  456. else
  457. {
  458. cout<<"You don't have enough money\n";
  459. cout<<"Press any key to continue.\n";
  460. getch();
  461. Weapons();
  462. };
  463. break;
  464. case 3 : if (money >= 500)
  465. {
  466. cout<<"Fine Choice\n";
  467. money = money - 500;
  468. SilverSword = 1;
  469. cout<<"Press any key to continue.\n";
  470. getch();
  471. Weapons();
  472. }
  473. else
  474. {
  475. cout<<"You don't have enough money\n";
  476. cout<<"Press any key to continue.\n";
  477. getch();
  478. Weapons();
  479. };
  480. break;
  481. case 4 : if (money >= 750)
  482. {
  483. cout<<"Fine Choice\n";
  484. money = money - 750;
  485. GoldenSword = 1;
  486. cout<<"Press any key to continue.\n";
  487. getch();
  488. Weapons();
  489. }
  490. else
  491. {
  492. cout<<"You don't have enough money\n";
  493. cout<<"Press any key to continue.\n";
  494. getch();
  495. Weapons();
  496. };
  497. break;
  498. case 5 : if (money >= 1000)
  499. {
  500. cout<<"Fine Choice\n";
  501. money = money - 1000;
  502. PlatinumSword = 1;
  503. cout<<"Press any key to continue.\n";
  504. getch();
  505. Weapons();
  506. }
  507. else
  508. {
  509. cout<<"You don't have enough money\n";
  510. cout<<"Press any key to continue.\n";
  511. getch();
  512. Weapons();
  513. };
  514. break;
  515. case 6 : if (money >= 1500)
  516. {
  517. cout<<"Fine Choice\n";
  518. money = money - 1500;
  519. Excalibur = 1;
  520. cout<<"Press any key to continue.\n";
  521. getch();
  522. Weapons();
  523. }
  524. else
  525. {
  526. cout<<"You don't have enough money\n";
  527. cout<<"Press any key to continue.\n";
  528. getch();
  529. Weapons();
  530. };
  531. break;
  532. case 7 : BuyEquipement();
  533. break;
  534. case 8 : Menu();
  535. break;
  536. default : cout<<"Error, enter a number from 1 to 6, press any key to continue.\n";
  537. getch();
  538. Weapons();
  539. break;
  540. }
  541. };
  542.  
  543. void Armors() //My armor shop
  544. {
  545. system("CLS");
  546. cout<<"Wich Armor(s) do you want to buy?\n\n";
  547. cout<<"Your money = "<<money<<"\n\n";
  548. cout<<"NAME\t\t\tDAMAGE RES.\t\t\tCOST\n";
  549. cout<<"1. Woode Armor\t\t0-5\t\t\t250\n";
  550. cout<<"2. Iron Armor\t\t5-10\t\t\t350\n";
  551. cout<<"3. Silver Armor\t\t10-15\t\t\t500\n";
  552. cout<<"4. Golden Armor\t\t15-20\t\t\t750\n";
  553. cout<<"5. Platinum Armor\t20-25\t\t\t1000\n";
  554. cout<<"6. Kristal Armor\t25-35\t\t\t1500\n";
  555. cout<<"7. Return to buy menu\n";
  556. cout<<"8. Return to main menu\n\n";
  557. cout<<"What do you want to do?\n";
  558. cin>>x;
  559.  
  560. switch (x )
  561. {
  562. case 1 : if (money >= 250)
  563. {
  564. cout<<"Fine Choice.\n";
  565. money = money - 250;
  566. WoodenArmor = 1;
  567. cout<<"Press any key to continue.\n";
  568. getch();
  569. Armors();
  570. }
  571. else
  572. {
  573. cout<<"You don't have enough money!!!\n";
  574. cout<<"Press any key to continue.\n";
  575. getch();
  576. Armors();
  577. };
  578. break;
  579. case 2 : if (money >= 350)
  580. {
  581. cout<<"Fine Choice.\n";
  582. money = money - 350;
  583. IronArmor = 1;
  584. cout<<"Press any key to continue.\n";
  585. getch();
  586. Armors();
  587. }
  588. else
  589. {
  590. cout<<"You don't have enough money!!!\n";
  591. cout<<"Press any key to continue.\n";
  592. getch();
  593. Armors();
  594. };
  595. break;
  596. case 3 : if (money >= 500)
  597. {
  598. cout<<"Fine Choice.\n";
  599. money = money - 500;
  600. SilverArmor = 1;
  601. cout<<"Press any key to continue.\n";
  602. getch();
  603. Armors();
  604. }
  605. else
  606. {
  607. cout<<"You don't have enough money!!!\n";
  608. cout<<"Press any key to continue.\n";
  609. getch();
  610. Armors();
  611. };
  612. break;
  613. case 4 : if (money >= 750)
  614. {
  615. cout<<"Fine Choice.\n";
  616. money = money - 750;
  617. GoldenArmor = 1;
  618. cout<<"Press any key to continue.\n";
  619. getch();
  620. Armors();
  621. }
  622. else
  623. {
  624. cout<<"You don't have enough money!!!\n";
  625. cout<<"Press any key to continue.\n";
  626. getch();
  627. Armors();
  628. };
  629. break;
  630. case 5 : if (money >= 1000)
  631. {
  632. cout<<"Fine Choice.\n";
  633. money = money - 1000;
  634. PlatinumArmor = 1;
  635. cout<<"Press any key to continue.\n";
  636. getch();
  637. Armors();
  638. }
  639. else
  640. {
  641. cout<<"You don't have enough money!!!\n";
  642. cout<<"Press any key to continue.\n";
  643. getch();
  644. Armors();
  645. };
  646. break;
  647. case 6 : if (money >= 1500)
  648. {
  649. cout<<"Fine Choice.\n";
  650. money = money - 1500;
  651. KristalArmor = 1;
  652. cout<<"Press any key to continue.\n";
  653. getch();
  654. Armors();
  655. }
  656. else
  657. {
  658. cout<<"You don't have enough money!!!\n";
  659. cout<<"Press any key to continue.\n";
  660. getch();
  661. Armors();
  662. };
  663. break;
  664. case 7 : BuyEquipement();
  665. break;
  666. case 8 : Menu();
  667. break;
  668. default : cout<<"Error, enter a number from 1 to 6, press any key to continue.\n";
  669. getch();
  670. Weapons();
  671. break;
  672. }
  673. };
  674.  
  675. void Potions() //and my potions shop
  676. {
  677. system("CLS");
  678. cout<<"Wich Potion(s) do you want to buy?\n\n";
  679. cout<<"Your money = "<<money<<"\n\n";
  680. cout<<"NAME\t\t\tEFFECT\t\t\tCOST\n";
  681. cout<<"1. Small Potion\t\t+25HP\t\t\t50\n";
  682. cout<<"2. Medium Potion\t+50HP\t\t\t75\n";
  683. cout<<"3. Big Potion\t\t+100HP\t\t\t125\n";
  684. cout<<"4. Max Helath Potion\tMax Health\t\t150\n\n";
  685. cout<<"5. Small Max Potion\tMax Health +25\t\t200\n";
  686. cout<<"6. Medium Max Potion\tMax Health +50\t\t300\n";
  687. cout<<"7. Big Max Potion\tMax Health +100\t\t500\n";
  688. cout<<"8. Return to buy menu\n";
  689. cout<<"9. Return to main menu\n\n";
  690. cout<<"What do you want to do?\n";
  691. cin>>x;
  692.  
  693. switch (x)
  694. {
  695. case 1 : if (money >= 50)
  696. {
  697. cout<<"Fine Choice\n";
  698. SmallPotion = SmallPotion + 1;
  699. money = money - 50;
  700. cout<<"Press any key to continue.\n";
  701. getch();
  702. Potions();
  703. }
  704. else
  705. {
  706. cout<<"You don't have enough money yet!!!";
  707. cout<<"Press any key to continue.\n";
  708. getch();
  709. Potions();
  710. }
  711. break;
  712. case 2 : if (money >= 75)
  713. {
  714. cout<<"Fine Choice\n";
  715. MediumPotion = MediumPotion + 1;
  716. money = money - 75;
  717. cout<<"Press any key to continue.\n";
  718. getch();
  719. Potions();
  720. }
  721. else
  722. {
  723. cout<<"You don't have enough money yet!!!";
  724. cout<<"Press any key to continue.\n";
  725. getch();
  726. Potions();
  727. }
  728. break;
  729. case 3 : if (money >= 125)
  730. {
  731. cout<<"Fine Choice\n";
  732. BigPotion = BigPotion + 1;
  733. money = money - 125;
  734. cout<<"Press any key to continue.\n";
  735. getch();
  736. Potions();
  737. }
  738. else
  739. {
  740. cout<<"You don't have enough money yet!!!";
  741. cout<<"Press any key to continue.\n";
  742. getch();
  743. Potions();
  744. }
  745. break;
  746. case 4 : if (money >= 150)
  747. {
  748. cout<<"Fine Choice\n";
  749. MaxPotion = MaxPotion + 1;
  750. money = money - 150;
  751. cout<<"Press any key to continue.\n";
  752. getch();
  753. Potions();
  754. }
  755. else
  756. {
  757. cout<<"You don't have enough money yet!!!";
  758. cout<<"Press any key to continue.\n";
  759. getch();
  760. Potions();
  761. }
  762. break;
  763. case 5 : if (money >= 200)
  764. {
  765. cout<<"Fine Choice\n";
  766. SmallMaxHealthPotion = SmallMaxHealthPotion + 1;
  767. money = money - 200;
  768. cout<<"Press any key to continue.\n";
  769. getch();
  770. Potions();
  771. }
  772. else
  773. {
  774. cout<<"You don't have enough money yet!!!";
  775. cout<<"Press any key to continue.\n";
  776. getch();
  777. Potions();
  778. }
  779. break;
  780. case 6 : if (money >= 300)
  781. {
  782. cout<<"Fine Choice\n";
  783. MediumMaxHealthPotion = MediumMaxHealthPotion + 1;
  784. money = money - 300;
  785. cout<<"Press any key to continue.\n";
  786. getch();
  787. Potions();
  788. }
  789. else
  790. {
  791. cout<<"You don't have enough money yet!!!";
  792. cout<<"Press any key to continue.\n";
  793. getch();
  794. Potions();
  795. }
  796. break;
  797. case 7 : if (money >= 500)
  798. {
  799. cout<<"Fine Choice\n";
  800. BigMaxHealthPotion = BigMaxHealthPotion + 1;
  801. money = money - 500;
  802. cout<<"Press any key to continue.\n";
  803. getch();
  804. Potions();
  805. }
  806. else
  807. {
  808. cout<<"You don't have enough money yet!!!";
  809. cout<<"Press any key to continue.\n";
  810. getch();
  811. Potions();
  812. }
  813. break;
  814. case 8 : BuyEquipement();
  815. break;
  816. case 9 : Menu();
  817. break;
  818. default : cout<<"Error, number from 1 to 7, press any key to continue.";
  819. getch();
  820. Potions();
  821. }
  822. };
  823.  
  824. void AttackTR() //option Attack in Training mode
  825. {
  826. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  827. cout<<"Wich weapon do you want to use?\n";
  828. cout<<"1. Wooden Stick\n";
  829. cout<<"2. Wooden Sword\n";
  830. cout<<"3. Iron Sword\n";
  831. cout<<"4. Silver Sword\n";
  832. cout<<"5. Golden Sword\n";
  833. cout<<"6. PLatinum Sword\n";
  834. cout<<"7. Excalibur\n";
  835. cin>>y;
  836.  
  837. switch (y)
  838. {
  839. case 1 : weapon = 1;
  840. break;
  841. case 2 : if (WoodenSword == 1) //checking if you have the sword
  842. {
  843. weapon = 2;
  844. }
  845. else
  846. {
  847. cout<<"You don't have this weapon yet!!!\n\n";
  848. cout<<"Press any key to continue.\n";
  849. getch();
  850. system("CLS");
  851. BattleTR();
  852. };
  853. break;
  854. case 3 : if (IronSword == 1)
  855. {
  856. weapon = 3;
  857. }
  858. else
  859. {
  860. cout<<"You don't have this weapon yet!!!\n\n";
  861. cout<<"Press any key to continue.\n";
  862. getch();
  863. system("CLS");
  864. BattleTR();
  865. };
  866. break;
  867. case 4 : if (SilverSword == 1)
  868. {
  869. weapon = 4;
  870. }
  871. else
  872. {
  873. cout<<"You don't have this weapon yet!!!\n\n";
  874. cout<<"Press any key to continue.\n";
  875. getch();
  876. system("CLS");
  877. BattleTR();
  878. };
  879. break;
  880. case 5 : if (GoldenSword == 1)
  881. {
  882. weapon = 5;
  883. }
  884. else
  885. {
  886. cout<<"You don't have this weapon yet!!!\n\n";
  887. cout<<"Press any key to continue.\n";
  888. getch();
  889. system("CLS");
  890. BattleTR();
  891. };
  892. break;
  893. case 6 : if (PlatinumSword == 1)
  894. {
  895. weapon = 6;
  896. }
  897. else
  898. {
  899. cout<<"You don't have this weapon yet!!!\n\n";
  900. cout<<"Press any key to continue.\n";
  901. getch();
  902. system("CLS");
  903. BattleTR();
  904. };
  905. break;
  906. case 7 : if (Excalibur == 1)
  907. {
  908. weapon = 7;
  909. }
  910. else
  911. {
  912. cout<<"You don't have this weapon yet!!!\n\n";
  913. cout<<"Press any key to continue.\n";
  914. getch();
  915. system("CLS");
  916. BattleTR();
  917. };
  918. break;
  919. default : cout<<"Bad input, press enter and try again.";
  920. getch();
  921. AttackTR();
  922. break;
  923. }
  924. srand ((unsigned)time(NULL));
  925. x = rand() % 10;
  926. if (x == 3)
  927. {
  928. cout<<"You missed! press any key to continue\n";
  929. getch();
  930. DamageENTR();
  931. }
  932. DamageTR();
  933. };
  934.  
  935. void Attack() //Option attck in all the other modes
  936. {
  937. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  938. cout<<"Wich weapon do you want to use?\n";
  939. cout<<"1. Wooden Stick\n";
  940. cout<<"2. Wooden Sword\n";
  941. cout<<"3. Iron Sword\n";
  942. cout<<"4. Silver Sword\n";
  943. cout<<"5. Golden Sword\n";
  944. cout<<"6. PLatinum Sword\n";
  945. cout<<"7. Excalibur\n";
  946. cin>>y;
  947.  
  948. switch (y)
  949. {
  950. case 1 : weapon = 1;
  951. break;
  952. case 2 : if (WoodenSword == 1)
  953. {
  954. weapon = 2;
  955. }
  956. else
  957. {
  958. cout<<"You don't have this weapon yet!!!\n\n";
  959. cout<<"Press any key to continue.\n";
  960. getch();
  961. system("CLS");
  962. Battle();
  963. };
  964. break;
  965. case 3 : if (IronSword == 1)
  966. {
  967. weapon = 3;
  968. }
  969. else
  970. {
  971. cout<<"You don't have this weapon yet!!!\n\n";
  972. cout<<"Press any key to continue.\n";
  973. getch();
  974. system("CLS");
  975. Battle();
  976. };
  977. break;
  978. case 4 : if (SilverSword == 1)
  979. {
  980. weapon = 4;
  981. }
  982. else
  983. {
  984. cout<<"You don't have this weapon yet!!!\n\n";
  985. cout<<"Press any key to continue.\n";
  986. getch();
  987. system("CLS");
  988. Battle();
  989. };
  990. break;
  991. case 5 : if (GoldenSword == 1)
  992. {
  993. weapon = 5;
  994. }
  995. else
  996. {
  997. cout<<"You don't have this weapon yet!!!\n\n";
  998. cout<<"Press any key to continue.\n";
  999. getch();
  1000. system("CLS");
  1001. Battle();
  1002. };
  1003. break;
  1004. case 6 : if (PlatinumSword == 1)
  1005. {
  1006. weapon = 6;
  1007. }
  1008. else
  1009. {
  1010. cout<<"You don't have this weapon yet!!!\n\n";
  1011. cout<<"Press any key to continue.\n";
  1012. getch();
  1013. system("CLS");
  1014. Battle();
  1015. };
  1016. break;
  1017. case 7 : if (Excalibur == 1)
  1018. {
  1019. weapon = 7;
  1020. }
  1021. else
  1022. {
  1023. cout<<"You don't have this weapon yet!!!\n\n";
  1024. cout<<"Press any key to continue.\n";
  1025. getch();
  1026. system("CLS");
  1027. Battle();
  1028. };
  1029. break;
  1030. default : cout<<"Bad input, press enter and try again.";
  1031. getch();
  1032. Attack();
  1033. break;
  1034. }
  1035. srand ((unsigned)time(NULL)); //random number
  1036. x = rand() % 10;
  1037. if (x == 3)
  1038. {
  1039. cout<<"You missed! press any key to continue.\n";
  1040. getch();
  1041. DamageEN();
  1042. }
  1043. Damage();
  1044. };
  1045.  
  1046.  
  1047. void Potion() //Option : Use Potion
  1048. {
  1049. cout<<"Wich potion do you want to use?\n";
  1050. cout<<"1. Small Potion ("<<SmallPotion<<")\n";
  1051. cout<<"2. Medium Potion ("<<MediumPotion<<")\n";
  1052. cout<<"3. Big Potion ("<<BigPotion<<")\n";
  1053. cout<<"4. Max Health Potion ("<<MaxPotion<<")\n";
  1054. cout<<"5. Small Max Health Potion ("<<SmallMaxHealthPotion<<")\n";
  1055. cout<<"6. Medium Max Health Potion("<<MediumMaxHealthPotion<<")\n";
  1056. cout<<"7. Big Max Health Potion ("<<BigMaxHealthPotion<<")\n";
  1057. cin>>x;
  1058. switch(x)
  1059. {
  1060. case 1 : if (SmallPotion >= 1)
  1061. {
  1062. UserHealth = UserHealth + 25;
  1063. if (UserHealth > MaxHealth)
  1064. {
  1065. UserHealth = MaxHealth;
  1066. }
  1067. SmallPotion = SmallPotion - 1;
  1068. cout<<"Your health increased by 25%, press any key to continue.";
  1069. getch();
  1070. Battle();
  1071. }
  1072. else
  1073. {
  1074. cout<<"You don't have this potion yet, press any key to continue.";
  1075. getch();
  1076. Battle();
  1077. }
  1078. break;
  1079. case 2 : if (MediumPotion >= 1)
  1080. {
  1081. UserHealth = UserHealth + 50;
  1082. if (UserHealth > MaxHealth)
  1083. {
  1084. UserHealth = MaxHealth;
  1085. }
  1086. MediumPotion = MediumPotion - 1;
  1087. cout<<"Your health increased by 50%, press any key to continue.";
  1088. getch();
  1089. Battle();
  1090. }
  1091. else
  1092. {
  1093. cout<<"You don't have this potion yet, press any key to continue.";
  1094. getch();
  1095. Battle();
  1096. }
  1097. break;
  1098. case 3 : if (BigPotion >= 1)
  1099. {
  1100. UserHealth = UserHealth + 100;
  1101. if (UserHealth > MaxHealth)
  1102. {
  1103. UserHealth = MaxHealth;
  1104. }
  1105. BigPotion = BigPotion - 1;
  1106. cout<<"Your health increased by 100%, press any key to continue.";
  1107. getch();
  1108. Battle();
  1109. }
  1110. else
  1111. {
  1112. cout<<"You don't have this potion yet, press any key to continue.";
  1113. getch();
  1114. Battle();
  1115. };
  1116. break;
  1117. case 4 : if (MaxPotion >= 1)
  1118. {
  1119. UserHealth = MaxHealth;
  1120. MaxPotion = MaxPotion - 1;
  1121. cout<<"Your Health is restored, press any key to continue.";
  1122. getch();
  1123. Battle();
  1124. }
  1125. else
  1126. {
  1127. cout<<"You don't have this potion yet, press any key to continue.";
  1128. getch();
  1129. Battle();
  1130. };
  1131. break;
  1132. case 5 : if (SmallMaxHealthPotion >= 1)
  1133. {
  1134. MaxHealth = MaxHealth + 25;
  1135. SmallMaxHealthPotion = SmallMaxHealthPotion - 1;
  1136. cout<<"You maximal health increased by 25%, press any key to continue.";
  1137. getch();
  1138. Battle();
  1139. }
  1140. else
  1141. {
  1142. cout<<"You don't have this potion yet, press any key to continue.";
  1143. getch();
  1144. Battle();
  1145. };
  1146. break;
  1147. case 6 : if (MediumMaxHealthPotion >= 1)
  1148. {
  1149. MaxHealth = MaxHealth + 50;
  1150. MediumMaxHealthPotion = MediumMaxHealthPotion - 1;
  1151. cout<<"You maximal health increased by 50%, press any key to continue.";
  1152. getch();
  1153. Battle();
  1154. }
  1155. else
  1156. {
  1157. cout<<"You don't have this potion yet, press any key to continue.";
  1158. getch();
  1159. Battle();
  1160. };
  1161. break;
  1162. case 7 : if (BigMaxHealthPotion >= 1)
  1163. {
  1164. MaxHealth = MaxHealth + 100;
  1165. BigMaxHealthPotion = BigMaxHealthPotion - 1;
  1166. cout<<"You maximal health increased by 100%, press any key to continue.";
  1167. getch();
  1168. Battle();
  1169. }
  1170. else
  1171. {
  1172. cout<<"You don't have this potion yet, press any key to continue.";
  1173. getch();
  1174. Battle();
  1175. };
  1176. break;
  1177. default : cout<<"Please try again, press any key to continue.\n";
  1178. getch();
  1179. Potion();
  1180. break;
  1181. };
  1182. };
  1183.  
  1184.  
  1185. void DamageTR() //Damage in Training mode
  1186. {
  1187. if (weapon == 1)
  1188. {
  1189. srand ((unsigned)time(NULL));
  1190. x = rand() % 10;
  1191. EnemyHealth = EnemyHealth - x;
  1192. DamagePoints = x;
  1193. }
  1194. else if (weapon == 2)
  1195. {
  1196. srand ((unsigned)time(NULL));
  1197. x = rand() % 10;
  1198. EnemyHealth = EnemyHealth - 10;
  1199. EnemyHealth = EnemyHealth - x;
  1200. DamagePoints = 10;
  1201. DamagePoints = DamagePoints + x;
  1202. }
  1203. else if (weapon == 3)
  1204. {
  1205. srand ((unsigned)time(NULL));
  1206. x = rand() % 10;
  1207. EnemyHealth = EnemyHealth - 20;
  1208. EnemyHealth = EnemyHealth - x;
  1209. DamagePoints = 20;
  1210. DamagePoints = DamagePoints + x;
  1211. }
  1212. else if (weapon == 4)
  1213. {
  1214. srand ((unsigned)time(NULL));
  1215. x = rand() % 10;
  1216. EnemyHealth = EnemyHealth - 30;
  1217. EnemyHealth = EnemyHealth - x;
  1218. DamagePoints = 30;
  1219. DamagePoints = DamagePoints + x;
  1220. }
  1221. else if (weapon == 5)
  1222. {
  1223. srand ((unsigned)time(NULL));
  1224. x = rand() % 10;
  1225. EnemyHealth = EnemyHealth - 40;
  1226. EnemyHealth = EnemyHealth - x;
  1227. DamagePoints = 40;
  1228. DamagePoints = DamagePoints + x;
  1229. }
  1230. else if (weapon == 6)
  1231. {
  1232. srand ((unsigned)time(NULL));
  1233. x = rand() % 10;
  1234. EnemyHealth = EnemyHealth - 50;
  1235. EnemyHealth = EnemyHealth - x;
  1236. DamagePoints = 50;
  1237. DamagePoints = DamagePoints + x;
  1238. }
  1239. else if (weapon == 7)
  1240. {
  1241. srand ((unsigned)time(NULL));
  1242. x = rand() % 30;
  1243. EnemyHealth = EnemyHealth - 70;
  1244. EnemyHealth = EnemyHealth - x;
  1245. DamagePoints = 70;
  1246. DamagePoints = DamagePoints + x;
  1247. }
  1248. if (EnemyHealth > 0)
  1249. {
  1250. cout<<"You dealt "<<DamagePoints<<" damage to "<<EnemyName<<"."<<endl;;
  1251. cout<<"Press any key to continue.\n";
  1252. getch();
  1253. DamageENTR();
  1254. }
  1255. else
  1256. {
  1257. YouWinTR(); //if UserHealth < 0 ....
  1258. }
  1259. };
  1260.  
  1261. void Damage() //damage in all the other modes
  1262. {
  1263. if (weapon == 1)
  1264. {
  1265. srand ((unsigned)time(NULL));
  1266. x = rand() % 10;
  1267. EnemyHealth = EnemyHealth - x;
  1268. DamagePoints = x;
  1269. }
  1270. else if (weapon == 2)
  1271. {
  1272. srand ((unsigned)time(NULL));
  1273. x = rand() % 10;
  1274. EnemyHealth = EnemyHealth - 10;
  1275. EnemyHealth = EnemyHealth - x;
  1276. DamagePoints = 10;
  1277. DamagePoints = DamagePoints + x;
  1278. }
  1279. else if (weapon == 3)
  1280. {
  1281. srand ((unsigned)time(NULL));
  1282. x = rand() % 10;
  1283. EnemyHealth = EnemyHealth - 20;
  1284. EnemyHealth = EnemyHealth - x;
  1285. DamagePoints = 20;
  1286. DamagePoints = DamagePoints + x;
  1287. }
  1288. else if (weapon == 4)
  1289. {
  1290. srand ((unsigned)time(NULL));
  1291. x = rand() % 10;
  1292. EnemyHealth = EnemyHealth - 30;
  1293. EnemyHealth = EnemyHealth - x;
  1294. DamagePoints = 30;
  1295. DamagePoints = DamagePoints + x;
  1296. }
  1297. else if (weapon == 5)
  1298. {
  1299. srand ((unsigned)time(NULL));
  1300. x = rand() % 10;
  1301. EnemyHealth = EnemyHealth - 40;
  1302. EnemyHealth = EnemyHealth - x;
  1303. DamagePoints = 40;
  1304. DamagePoints = DamagePoints + x;
  1305. }
  1306. else if (weapon == 6)
  1307. {
  1308. srand ((unsigned)time(NULL));
  1309. x = rand() % 10;
  1310. EnemyHealth = EnemyHealth - 50;
  1311. EnemyHealth = EnemyHealth - x;
  1312. DamagePoints = 50;
  1313. DamagePoints = DamagePoints + x;
  1314. }
  1315. else if (weapon == 7)
  1316. {
  1317. srand ((unsigned)time(NULL));
  1318. x = rand() % 30;
  1319. EnemyHealth = EnemyHealth - 70;
  1320. EnemyHealth = EnemyHealth - x;
  1321. DamagePoints = 70;
  1322. DamagePoints = DamagePoints + x;
  1323. }
  1324. if (EnemyHealth > 0)
  1325. {
  1326. cout<<"You dealt "<<DamagePoints<<" damage to "<<EnemyName<<"."<<endl;
  1327. cout<<"Press any key to continue.\n";
  1328. getch();
  1329. DamageEN();
  1330. }
  1331. else
  1332. {
  1333. if (TR == 1)
  1334. {
  1335. YouWinTo();
  1336. }
  1337. else
  1338. {
  1339. YouWin();
  1340. }
  1341. }
  1342. };
  1343.  
  1344. void DamageEN() //damage dealt by the enemy
  1345. {
  1346. srand ((unsigned)time(NULL));
  1347. x = rand() % 10;
  1348. if (x == 7)
  1349. { //Can't always have a hit
  1350. cout<<"He missed!\n";
  1351. cout<<"Press any key to continue.\n";
  1352. getch();
  1353. Battle();
  1354. }
  1355. if (experience <= 5)
  1356. {
  1357. srand ((unsigned)time(NULL));
  1358. x = rand() % 10;
  1359. UserHealth = UserHealth - x;
  1360. DamagePoints = x;
  1361. }
  1362. else if (experience <= 10)
  1363. {
  1364. srand ((unsigned)time(NULL));
  1365. x = rand() % 15;
  1366. UserHealth = UserHealth - x;
  1367. DamagePoints = x;
  1368. }
  1369. else if (experience <= 15)
  1370. {
  1371. srand ((unsigned)time(NULL));
  1372. x = rand() % 10;
  1373. UserHealth = UserHealth - 10;
  1374. UserHealth = UserHealth - x;
  1375. DamagePoints = 10;
  1376. DamagePoints = DamagePoints + x;
  1377. }
  1378. else if (experience <= 25)
  1379. {
  1380. srand ((unsigned)time(NULL));
  1381. x = rand() % 15;
  1382. UserHealth = UserHealth - 15;
  1383. UserHealth = UserHealth - x;
  1384. DamagePoints = 15;
  1385. DamagePoints = DamagePoints + x;
  1386. }
  1387. else
  1388. {
  1389. srand ((unsigned)time(NULL));
  1390. x = rand() % 15;
  1391. UserHealth = UserHealth - 25;
  1392. UserHealth = UserHealth - x;
  1393. DamagePoints = 25;
  1394. DamagePoints = DamagePoints + x;
  1395. }
  1396. if (WoodenArmor == 1)
  1397. {
  1398. srand ((unsigned)time(NULL));
  1399. x = rand() % 5;
  1400. DamagePoints = DamagePoints - x;
  1401. UserHealth = UserHealth + x;
  1402. if (DamagePoints < 0)
  1403. {
  1404. x = 0 - DamagePoints;
  1405. UserHealth = UserHealth - x;
  1406. DamagePoints = 0;
  1407. }
  1408. }
  1409. else if (IronArmor == 1)
  1410. {
  1411. srand ((unsigned)time(NULL));
  1412. x = rand() % 5;
  1413. DamagePoints = DamagePoints - 5;
  1414. DamagePoints = DamagePoints - x;
  1415. UserHealth = UserHealth + 5;
  1416. UserHealth = UserHealth + x;
  1417. if (DamagePoints < 0)
  1418. {
  1419. x = 0 - DamagePoints;
  1420. UserHealth = UserHealth - x;
  1421. DamagePoints = 0;
  1422. }
  1423. }
  1424. else if (SilverArmor == 1)
  1425. {
  1426. srand ((unsigned)time(NULL));
  1427. x = rand() % 5;
  1428. DamagePoints = DamagePoints - 10;
  1429. DamagePoints = DamagePoints - x;
  1430. UserHealth = UserHealth + 10;
  1431. UserHealth = UserHealth + x;
  1432. if (DamagePoints < 0)
  1433. {
  1434. x = 0 - DamagePoints;
  1435. UserHealth = UserHealth - x;
  1436. DamagePoints = 0;
  1437. }
  1438. }
  1439. else if (GoldenArmor == 1)
  1440. {
  1441. srand ((unsigned)time(NULL));
  1442. x = rand() % 5;
  1443. DamagePoints = DamagePoints - 15;
  1444. DamagePoints = DamagePoints - x;
  1445. UserHealth = UserHealth + 15;
  1446. UserHealth = UserHealth + x;
  1447. if (DamagePoints < 0)
  1448. {
  1449. x = 0 - DamagePoints;
  1450. UserHealth = UserHealth - x;
  1451. DamagePoints = 0;
  1452. }
  1453. }
  1454. else if (PlatinumArmor == 1)
  1455. {
  1456. srand ((unsigned)time(NULL));
  1457. x = rand() % 5;
  1458. DamagePoints = DamagePoints - 20;
  1459. DamagePoints = DamagePoints - x;
  1460. UserHealth = UserHealth + 20;
  1461. UserHealth = UserHealth + x;
  1462. if (DamagePoints < 0)
  1463. {
  1464. x = 0 - DamagePoints;
  1465. UserHealth = UserHealth - x;
  1466. DamagePoints = 0;
  1467. }
  1468. }
  1469. else if (KristalArmor == 1)
  1470. {
  1471. srand ((unsigned)time(NULL));
  1472. x = rand() % 10;
  1473. DamagePoints = DamagePoints - 25;
  1474. DamagePoints = DamagePoints - x;
  1475. UserHealth = UserHealth + 25;
  1476. UserHealth = UserHealth + x;
  1477. if (DamagePoints < 0)
  1478. {
  1479. x = 0 - DamagePoints;
  1480. UserHealth = UserHealth - x;
  1481. DamagePoints = 0;
  1482. }
  1483. }
  1484. if (UserHealth <= 0)
  1485. {
  1486. cout<<"You Lose!!!\n";
  1487. getch();
  1488. YouLose();
  1489. }
  1490. else
  1491. {
  1492. cout<<EnemyName<<" dealt "<<DamagePoints<<" damage to you.\n";
  1493. cout<<"Press any key to continue.\n";
  1494. getch();
  1495. Battle();
  1496. }
  1497. };
  1498.  
  1499. void DamageENTR() //damage dealt by the enemy in Training mode
  1500. {
  1501. srand ((unsigned)time(NULL));
  1502. x = rand() % 10;
  1503. if (x == 7)
  1504. {
  1505. cout<<"He missed!\n";
  1506. cout<<"Press any key to continue.\n";
  1507. getch();
  1508. Battle();
  1509. }
  1510. if (experience <= 5)
  1511. {
  1512. srand ((unsigned)time(NULL));
  1513. x = rand() % 10;
  1514. UserHealth = UserHealth - x;
  1515. }
  1516. else if (experience <= 10)
  1517. {
  1518. srand ((unsigned)time(NULL));
  1519. x = rand() % 15;
  1520. UserHealth = UserHealth - x;
  1521. }
  1522. else if (experience <= 15)
  1523. {
  1524. srand ((unsigned)time(NULL));
  1525. x = rand() % 10;
  1526. UserHealth = UserHealth - 10;
  1527. UserHealth = UserHealth -x;
  1528. }
  1529. else if (experience <= 25)
  1530. {
  1531. srand ((unsigned)time(NULL));
  1532. x = rand() % 15;
  1533. UserHealth = UserHealth - 15;
  1534. UserHealth = UserHealth -x;
  1535. }
  1536. else
  1537. {
  1538. srand ((unsigned)time(NULL));
  1539. x = rand() % 15;
  1540. UserHealth = UserHealth - 25;
  1541. UserHealth = UserHealth -x;
  1542. }
  1543. cout<<EnemyName<<" Dealt "<<DamagePoints<<" damage to you.\n";
  1544. cout<<"Press any key to continue.\n";
  1545. getch();
  1546. BattleTR();
  1547. };
  1548.  
  1549. void YouWinTR() //You win in Training mode, this is where it is different from
  1550. { //the single match mode
  1551. UserHealth = MaxHealth;
  1552. EnemyHealth = 100;
  1553. TrainingKills = TrainingKills + 1;
  1554. cout<<"You won!!!\n";
  1555. if (TrainingKills == 5)
  1556. {
  1557. cout<<"You've got 5 Training Kills, and won a Small Potion!!!";
  1558. SmallPotion = SmallPotion + 1;
  1559. }
  1560. else if (TrainingKills == 10)
  1561. {
  1562. cout<<"You've got 10 Training Kills, and you won a Medium Potion!!!";
  1563. MediumPotion = MediumPotion + 1;
  1564. }
  1565. else if (TrainingKills == 15)
  1566. {
  1567. cout<<"You've got 15 Training Kills, and you won a Big Potion!!!";
  1568. BigPotion = BigPotion + 1;
  1569. }
  1570. else if (TrainingKills == 20)
  1571. {
  1572. cout<<"You've got 20 Training Kills, and you won a Max Potion!!!";
  1573. MaxPotion = MaxPotion + 1;
  1574. }
  1575. cout<<"Press any key to continue.\n";
  1576. getch();
  1577. system("CLS");
  1578. Menu();
  1579. };
  1580.  
  1581. void YouWin() //You win in all the other modes
  1582. {
  1583. EnemyHealth = 100;
  1584. experience = experience + 1;
  1585. money = money + 100;
  1586. cout<<"You won!!!\n";
  1587. if (Boss == 1) //Declaring Bosses
  1588. {
  1589. system("CLS");
  1590. cout<<"This can't be happening, you beat me...\n";
  1591. cout<<"Van Hooi will teach you a lessen, one day!!!\n\n";
  1592. cout<<"You won a Small Potion\n";
  1593. SmallPotion = SmallPotion + 1;
  1594. cout<<"Press any key to continue\n";
  1595. Boss = 0;
  1596. getch();
  1597. Menu();
  1598. }
  1599. else if (Boss == 2)
  1600. {
  1601. system("CLS");
  1602. cout<<"This can't be happening, you beat me...\n";
  1603. cout<<"Van Hooi will teach you a lessen, one day!!!\n\n";
  1604. cout<<"You won a Medium Potion\n";
  1605. MediumPotion = MediumPotion + 1;
  1606. cout<<"Press any key to continue\n";
  1607. Boss = 0;
  1608. getch();
  1609. Menu();
  1610. }
  1611. else if (Boss == 3)
  1612. {
  1613. system("CLS");
  1614. cout<<"This can't be happening, you beat me...\n";
  1615. cout<<"Van Hooi will teach you a lessen, one day!!!\n\n";
  1616. cout<<"You won a Big Potion\n";
  1617. BigPotion = BigPotion + 1;
  1618. cout<<"Press any key to continue\n";
  1619. Boss = 0;
  1620. getch();
  1621. Menu();
  1622. }
  1623. else if (Boss == 4)
  1624. {
  1625. system("CLS");
  1626. cout<<"This can't be happening, you beat me...\n";
  1627. cout<<"Van Hooi will teach you a lessen, one day!!!\n\n";
  1628. cout<<"You won a Max Potion\n";
  1629. MaxPotion = MaxPotion + 1;
  1630. cout<<"Press any key to continue\n";
  1631. Boss = 0;
  1632. getch();
  1633. Menu();
  1634. }
  1635. else if (Boss == 5)
  1636. {
  1637. system("CLS");
  1638. cout<<"This can't be happening, you beat me...\n";
  1639. cout<<"Van Hooi will teach you a lessen, one day!!!\n\n";
  1640. cout<<"You won a Small Max Health Potion\n";
  1641. SmallMaxHealthPotion = SmallMaxHealthPotion + 1;
  1642. cout<<"Press any key to continue\n";
  1643. Boss = 0;
  1644. getch();
  1645. Menu();
  1646. }
  1647. else if (Boss == 6)
  1648. {
  1649. system("CLS");
  1650. cout<<"This can't be happening, you beat me...\n";
  1651. cout<<"Van Hooi will teach you a lessen, one day!!!\n\n";
  1652. cout<<"You won a Medium Max Health Potion\n";
  1653. MediumMaxHealthPotion = MediumMaxHealthPotion + 1;
  1654. cout<<"Press any key to continue\n";
  1655. Boss = 0;
  1656. getch();
  1657. Menu();
  1658. }
  1659. else if (Boss == 7)
  1660. {
  1661. YouWinTheGame();
  1662. }
  1663.  
  1664. if (experience == 5)
  1665. {
  1666. system("CLS");
  1667. Boss1();
  1668. }
  1669. else if (experience == 10)
  1670. {
  1671. system("CLS");
  1672. Boss2();
  1673. }
  1674. else if (experience == 15)
  1675. {
  1676. system("CLS");
  1677. Boss3();
  1678. }
  1679. else if (experience == 20)
  1680. {
  1681. system("CLS");
  1682. Boss4();
  1683. }
  1684. else if (experience == 25)
  1685. {
  1686. system("CLS");
  1687. Boss5();
  1688. }
  1689. else if (experience == 30)
  1690. {
  1691. system("CLS");
  1692. Boss6();
  1693. }
  1694. else if (experience == 40)
  1695. {
  1696. system("CLS");
  1697. Boss7();
  1698. }
  1699. cout<<"Press any key to continue.\n";
  1700. getch();
  1701. system("CLS");
  1702. Menu();
  1703. };
  1704.  
  1705. void YouWinTo() //You win while in Tournament
  1706. {
  1707. cout<<"Get ready for your second opponent.";
  1708. getch();
  1709. EnemyHealth = 100;
  1710. if (TR <= 3)
  1711. {
  1712. money = money + gain;
  1713. cout<<"You gained "<<gain<<" for "<<TR<<" match(es)"<<endl;
  1714. cout<<"Press any key to continue.\n";
  1715. getch();
  1716. gain = gain + 100;
  1717. Battle();
  1718. }
  1719. else if (TR <= 5)
  1720. {
  1721. money = money + gain;
  1722. cout<<"You gained "<<gain<<" for " <<TR<<" matches"<<endl;
  1723. cout<<"Press any key to continue.\n";
  1724. getch();
  1725. gain = gain + 200;
  1726. Battle();
  1727. }
  1728. else if (TR == 7)
  1729. {
  1730. money = money + 500;
  1731. gain = gain + 500;
  1732. cout<<"You've won the tournament!!!\n";
  1733. cout<<"You gained "<<gain<<" for this tournament";
  1734. gain = 0;
  1735. TR = 0;
  1736. Menu();
  1737. }
  1738. };
  1739.  
  1740. void YouLose() //Game Over
  1741. {
  1742. system("CLS");
  1743. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1744. cout<<"//__________________GAME OVER__________________\\"<<endl<<endl;
  1745. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  1746. cout<<"This game was created by : Joshua Wohle\n\n";
  1747. cout<<"My first game in c++!!!\n\n";
  1748. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  1749. cout<<"If you have some tips or some information, please mail me at:\n\n";
  1750. cout<<"JoshuaWohle1987@hotmail.com\n\n";
  1751. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1752. cout<<"I hope you had fun playing the game.";
  1753. getch();
  1754. exit(0);
  1755. };
  1756.  
  1757. void YouWinTheGame() //when you finished the game
  1758. {
  1759. system("CLS");
  1760. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1761. cout<<"//__________________YOU WON__________________\\"<<endl<<endl;
  1762. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  1763. cout<<"This game was created by : Joshua Wohle\n\n";
  1764. cout<<"My first game in c++!!!\n\n";
  1765. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  1766. cout<<"If you have some tips or some information, please mail me at:\n\n";
  1767. cout<<"JoshuaWohle1987@hotmail.com\n\n";
  1768. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1769. cout<<"I hope you had fun playing the game.";
  1770. getch();
  1771. exit(0);
  1772. };
  1773.  
  1774. void Boss1() //Bosses
  1775. {
  1776. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1777. getch();
  1778. cout<<"Press any key to continue.\n";
  1779. system("CLS");
  1780. cout<<"You've made it to a village called Green Town.\n";
  1781. cout<<"You go to the nearest cafe to drink and eat something,\n";
  1782. cout<<"you are so hungry that you ask for the first menu you see.\n";
  1783. cout<<"Quickly you go to the toilets(you didn't have a leak for about three days),\n";
  1784. cout<<"and the moment you enter them, you see a man slapping a girl.\n";
  1785. cout<<"As you are a gentleman, you can't let him continue.\n";
  1786. cout<<"He takes his sword, and you take yours...\n\n";
  1787. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1788. cout<<"Press any key to continue.\n";
  1789. getch();
  1790. strcpy(EnemyName, "DUDE");
  1791. EnemyHealth = 125;
  1792. Boss = 1;
  1793. Battle();
  1794. };
  1795.  
  1796. void Boss2()
  1797. {
  1798. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1799. getch();
  1800. cout<<"Press any key to continue.\n";
  1801. cout<<"After two days of walking in the desert, you arrive at an hotel.\n";
  1802. cout<<"You ask for a room, but you don't have any money.\n";
  1803. cout<<"The owner of the hotel tells you that if you want a room,\n";
  1804. cout<<"You can make the money for it by fighting his strongest man.\n";
  1805. cout<<"As this is your last chance, you don't say no, but the man\n";
  1806. cout<<"is much stronger than you would think he is!!!\n\n";
  1807. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1808. cout<<"Press any key to continue.\n";
  1809. getch();
  1810. strcpy(EnemyName, "BULDOZER");
  1811. EnemyHealth = 150;
  1812. Boss = 2;
  1813. Battle();
  1814. };
  1815.  
  1816. void Boss3()
  1817. {
  1818. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1819. getch();
  1820. cout<<"You crossed the desert, and ran into an old man.\n";
  1821. cout<<"He asks you for a piece of bread, but you don't have any,\n";
  1822. cout<<"The old man is angry, and begins to sniffle in your stuff.\n";
  1823. cout<<"The moment he sees your sword he grabbes it, but he is to slow,\n";
  1824. cout<<"You take your wsord first, and challange him for a battle...\n\n";
  1825. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1826. cout<<"Press any key to continue.\n";
  1827. getch();
  1828. strcpy(EnemyName, "POOR OLD MAN");
  1829. EnemyHealth = 175;
  1830. Boss = 3;
  1831. Battle();
  1832. };
  1833.  
  1834. void Boss4()
  1835. {
  1836. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1837. getch();
  1838. cout<<"You hear a voice in your head, it tells you to look around.\n";
  1839. cout<<"You look around and you see a man with a sword in is hand,\n";
  1840. cout<<"must be a servant of Van Hooi...\n\n";
  1841. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1842. cout<<"Press any key to continue.\n";
  1843. getch();
  1844. strcpy(EnemyName, "SERVANT");
  1845. EnemyHealth = 200;
  1846. Boss = 4;
  1847. Battle();
  1848.  
  1849. };
  1850.  
  1851. void Boss5()
  1852. {
  1853. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1854. getch();
  1855. cout<<"You get attacked from behind, but are able to free yourself.\n";
  1856. cout<<"Would you be able to defeat this enemy???\n\n";
  1857. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1858. cout<<"Press any key to continue.\n";
  1859. getch();
  1860. strcpy(EnemyName, "WARIOR");
  1861. EnemyHealth = 200;
  1862. Boss = 5;
  1863. Battle();
  1864. };
  1865.  
  1866. void Boss6()
  1867. {
  1868. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1869. getch();
  1870. cout<<"You arrived at Van Hooi's castle. The first thing you see\n";
  1871. cout<<"when you enter is a big welcome poster, with your photo on it.\n";
  1872. cout<<"You know that something is going to happen, but what?\n";
  1873. cout<<"After a few moments of silence, you hear foot steps behind you.\n\n";
  1874. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1875. cout<<"Press any key to continue.\n";
  1876. getch();
  1877. strcpy(EnemyName, "CASTLE GUARD");
  1878. EnemyHealth = 225;
  1879. Boss = 6;
  1880. Battle();
  1881. };
  1882.  
  1883. void Boss7()
  1884. {
  1885. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1886. getch();
  1887. cout<<"You finally arrive in front of Van Hooi, will you be able to beat him?\n";
  1888. cout<<"Van Hooi : come on little rat, show me what you've got.\n";
  1889. cout<<UserName<<" : when I'm finished with you, you would wish\n";
  1890. cout<<"you where never born!!!\n\n";
  1891. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1892. cout<<"Press any key to continue.\n";
  1893. getch();
  1894. strcpy(EnemyName, "Van Hooi");
  1895. EnemyHealth = 250;
  1896. Boss = 7;
  1897. Battle();
  1898. };
  1899.  
  1900. int main() //main structure, first the story and then calling Menu() fuction
  1901. {
  1902. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  1903. cout<<"Welcome to";
  1904. SetConsoleTextAttribute(stdOut, FOREGROUND_RED | FOREGROUND_RED | FOREGROUND_INTENSITY);
  1905. cout<<" Swordsman 1.0 ";
  1906. SetConsoleTextAttribute(stdOut, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  1907. cout<<"The goal of the game is to defeat\n";
  1908. cout<<"your enemys before they defeat you. On the way, you have\n";
  1909. cout<<"to make some choices and fight some real tough guys.\n";
  1910. cout<<"This is an action game, so I hope you have fun.\n\n";
  1911.  
  1912. cout<<"Enter your name:\n";
  1913. cin>>UserName;
  1914. system("CLS");
  1915.  
  1916.  
  1917. cout<<"It all began on a peacefull Sunday morning, you and your\n";
  1918. cout<<"dad where having breakfast together when suddenly a man with\n";
  1919. cout<<"a sword came out of nowhere. Your dad was a man of courage,\n";
  1920. cout<<"so he took his sword as well and told you to run away as fast\n";
  1921. cout<<"as possible. You didnt want to leave him behind, but you had to,\n";
  1922. cout<<"you where only 10 years old...\n\n";
  1923.  
  1924. cout<<"After two hours of running, you ran into a man that knew you somehow.\n";
  1925. cout<<"He asked you what happened, you told him the whole story and then you\n";
  1926. cout<<"realised that the man that you where talking to was the old trainer\n";
  1927. cout<<"in fencing of your father, his name was Harold. He did try to stop the\n";
  1928. cout<<"man that was fighting with your father, but it was already too late.\n";
  1929. cout<<"He was dead...\n\n";
  1930.  
  1931. cout<<"Harold told you after that the man that killed your father was called\n";
  1932. cout<<"Rick van Hooi. He told you also that he would train you till you would\n";
  1933. cout<<"be able to beat the man who killed your father...\n\n";
  1934.  
  1935. cout<<"Press any key to continue.\n";
  1936. getch();
  1937. system("CLS");
  1938.  
  1939. cout<<"Ten years later, you have become a skilled fencer, but you have much to learn.\n";
  1940. cout<<"Harold: "<<UserName<<" I have learned you all I could, now you have to go and\n";
  1941. cout<<"practice in the open world, challange as many people as you can, because Rick\n";
  1942. cout<<"van Hooi is not an easy opponnent.\n\n";
  1943.  
  1944. cout<<"Press any key to continue.\n";
  1945. getch();
  1946. system("CLS");
  1947.  
  1948. Menu();
  1949. system("PAUSE");
  1950. return 0;
  1951. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement