skitzFist

Untitled

Nov 23rd, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. //funktion för text på dialog
  8. void txtDia(){
  9.  
  10. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
  11. }
  12.  
  13.  
  14. //funktion för att återställa färg på text
  15. void* txtNorm(){
  16. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
  17. }
  18.  
  19.  
  20. //Function for Highligting choices in colour
  21. void txtChoice(){
  22. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE);
  23. }
  24.  
  25.  
  26. //Funktion för UI input
  27. void uiInput(){
  28. cout << "--> ";
  29. }
  30.  
  31.  
  32. //Klass för att skapa en karaktär, hålla koll på stats och inventory.
  33. class Hero{
  34. public:
  35. string name;
  36. int str;
  37. int dex;
  38. int inte;
  39.  
  40. int gold;
  41.  
  42. int sword;
  43. int knife;
  44. int magic;
  45. int health;
  46. //Hero (string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic);
  47.  
  48. void createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health);
  49. void statsScr(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health);
  50. };
  51.  
  52.  
  53. //Konstruktor till klassen Hero
  54. /*Hero::Hero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic){
  55.  
  56. name = _name;
  57. str = _str;
  58. dex = _dex;
  59. inte = _inte;
  60. gold = _gold;
  61. sword = _sword;
  62. knife = _knife;
  63. magic = _magic;
  64. } */
  65.  
  66. void Hero::createHero(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health){
  67.  
  68.  
  69. cout << "Your goal is to survive one day in this crazy and messed up world.\n"
  70. "In order to survive you must know that every action has a consequence. Choose\nwisely who you are,"
  71. " your life depends on it...\n\n\n";
  72.  
  73. cout << "Your name: "; cin >> _name;
  74.  
  75. string choice1;
  76.  
  77. do{
  78. cout << "\nYour parents are since long dead, they left you with a small hut\nin the poorer districts of the city. But they also left you something else.\n\n"
  79. "A) Your father, whom was a soldier, left you his "; txtChoice(); cout << "sword\n\n"; txtNorm();
  80. cout << "B) Your mother was a fierce rogue while alive, she left you her beloved "; txtChoice(); cout << "dagger"; txtNorm(); cout << ".\n\n";
  81. cout << "C) Your parents were always poor while alive, but they had managed to save up a\nsmall pile of "; txtChoice(); cout << "gold"; txtNorm(); cout << " for you.\n\n";
  82. cout << "D) A dusty"; txtChoice(); cout << " book"; txtNorm(); cout << " that your mother always hid away from your father.\n\n";
  83. uiInput(); cin >> choice1;
  84.  
  85. if (choice1 == "sword" || choice1 == "Sword"){
  86. _sword = 1;
  87. _knife = 0;
  88. _str = 1;
  89. _health = 12;
  90.  
  91.  
  92. cout << "\n\nYour fathers sword is still sharp, it feels heavy in your arms.\nIt will come of good use to you in the future\n\n";
  93. break;
  94. }
  95. else if (choice1 == "Dagger" || choice1 == "dagger"){
  96. _knife = 1;
  97. _sword = 0;
  98. _dex = 1;
  99. _health = 10;
  100.  
  101. cout << "\n\nHer dagger has saved you more times than you can remember.\nThe poor district is a harsh place.\n\n";
  102. break;
  103. }
  104. else if (choice1 == "gold" || choice1 == "Gold"){
  105. _gold = 100;
  106. _health = 10;
  107. _sword = 0;
  108. _knife = 0;
  109.  
  110. cout << "\n\nAll that remains of the hefty sum they left you is only a hundred gold pieces,\nstill enough money for a years living\n\n";
  111. break;
  112. }
  113. else if (choice1 == "book" || choice1 == "Book"){
  114. _inte = 1;
  115. _magic = 1;
  116. _health = 8;
  117. _sword = 0;
  118. _knife = 0;
  119.  
  120. cout << "\n\nWhile reading the book for the first time, you realise it's a book \nexplaining the principles and basics of blood magic.\n"
  121. "You're able to do some basic magic from the book, but the cost is always in\nblood. You only use your magic if your life depends on it.\n\n";
  122. break;
  123. }
  124. else {
  125. system ("cls");
  126. continue;
  127. }
  128. }
  129. while (true);
  130. system ("PAUSE");
  131.  
  132.  
  133.  
  134. name = _name;
  135. str = _str;
  136. dex = _dex;
  137. inte = _inte;
  138. gold = _gold;
  139. sword = _sword;
  140. knife = _knife;
  141. magic = _magic;
  142. health = _health;
  143. }
  144.  
  145.  
  146. void Hero::statsScr(string _name, int _str, int _dex, int _inte, int _gold, int _sword, int _knife, int _magic, int _health){
  147.  
  148. cout << "_____________________________________\n"
  149. " \n"
  150. "Name: " << name << " \n"
  151. " \n"
  152. "Weapon: ";
  153.  
  154. //För att kontrollera vilket vapen man har
  155. if ( knife > 0){
  156. cout << "Dagger \n";
  157. }
  158. else if (sword > 0 ){
  159. cout << "Sword \n";
  160. }
  161. else {
  162. cout << "No weapon \n";
  163. }
  164.  
  165. // Kontrollerar vilken magi typ man använder.
  166. cout << "Magic: ";
  167.  
  168. if (magic == 1){
  169. cout << "Blood Magic \n";
  170. }
  171. else {
  172. cout << "No magic \n";
  173. }
  174.  
  175. // guld och health
  176. cout << endl << "Gold: " << gold << endl;
  177. cout << endl << "Health: " << health << endl;
  178. cout << "_____________________________________\n";
  179.  
  180. }
  181.  
  182. //Funktion för titlescreeen
  183. void titleScr(){
  184.  
  185. cout << "Please extend the console window until it reaches a congenial size\n"
  186. "Choices in this game will be highlighted in"; txtChoice(); cout << " purple"; txtNorm(); cout << ".\nEnjoy:\n";
  187. system ("PAUSE");
  188. system ("cls");
  189.  
  190. cout <<"___________________¶¶¶¶ \n"
  191. "_______________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶ \n"
  192. "___________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶_¶¶¶ \n"
  193. "_________¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  194. "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  195. "______¶¶¶¶¶¶¶¶_______¶¶¶¶¶¶¶¶¶___¶¶¶¶\n"
  196. "_____¶¶¶¶¶¶¶______________________¶¶\n"
  197. "_____¶¶¶¶¶¶___¶¶¶¶¶________________¶\n"
  198. "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
  199. "____¶¶¶¶¶¶___¶¶111¶¶\n"
  200. "____¶¶¶¶¶¶___¶¶¶1¶¶¶\n"
  201. "____¶¶¶¶¶¶____¶¶1¶¶\n"
  202. "_____¶¶¶¶¶¶___¶¶1¶¶\n"
  203. "_____¶¶¶¶¶¶¶¶_¶¶¶¶¶\n"
  204. "______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  205. "_______¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  206. "_________¶¶¶¶¶¶¶¶¶¶¶¶\n"
  207. "______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  208. "__¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  209. "____¶¶¶¶11111111111111111¶¶¶¶¶\n"
  210. "_______¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  211. "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
  212. "______________¶¶_1_¶¶¶¶¶¶¶¶¶¶\n"
  213. "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
  214. "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
  215. "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
  216. "______________¶¶_1_¶¶___¶¶¶¶¶¶\n"
  217. "______________¶¶_1_¶¶___¶¶¶¶¶\n"
  218. "______________¶¶_1_¶¶__¶¶¶¶¶¶\n"
  219. "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
  220. "______________¶¶¶¶¶¶¶¶¶¶¶¶¶\n"
  221. "______________¶¶¶¶¶¶¶¶¶¶¶\n"
  222. "_____________¶¶¶¶¶¶¶¶¶¶\n"
  223. "____________¶¶¶¶¶¶¶¶¶\n"
  224. "___________¶¶¶¶¶¶¶_¶¶\n"
  225. "__________¶¶¶¶¶¶_1_¶¶\n"
  226. "__________¶¶¶¶¶¶_1_¶¶\n"
  227. "__________¶¶¶¶¶¶_1_¶¶\n"
  228. "__________¶¶¶¶¶¶_1_¶¶\n"
  229. "__________¶¶¶¶¶¶_1_¶¶\n"
  230. "___________¶¶¶¶¶_1_¶¶\n"
  231. "____________¶¶¶¶_1_¶¶\n"
  232. "______________¶¶_1_¶¶¶¶¶¶\n"
  233. "______________¶¶_1_¶¶¶¶¶¶¶¶\n"
  234. "______________¶¶_1_¶¶¶¶¶¶¶¶¶\n"
  235. "______________¶¶_1_¶¶¶_¶¶¶¶¶\n"
  236. "______________¶¶_1_¶¶__¶¶¶¶¶\n"
  237. "______________¶¶___¶¶¶¶¶¶¶¶¶\n"
  238. "______________¶¶___¶¶¶¶¶¶¶¶\n"
  239. "______________¶¶¶¶¶¶¶¶¶¶¶\n"
  240. "______________¶¶¶¶¶¶¶¶¶\n"
  241. "_____________¶¶¶¶¶¶¶¶¶\n"
  242. "____________¶¶¶¶¶¶¶¶¶\n"
  243. "___________¶¶¶¶¶___¶¶\n"
  244. "___________¶¶¶¶¶___¶¶\n"
  245. "___________¶¶¶¶¶___¶¶\n"
  246. "____________¶¶¶¶___¶¶\n"
  247. "____________¶¶¶¶___¶¶\n"
  248. "______________¶¶___¶¶¶¶¶¶\n"
  249. "______________¶¶___¶¶¶¶¶¶¶\n"
  250. "______________¶¶___¶¶_¶¶¶¶¶\n"
  251. "______________¶¶___¶¶___¶¶¶¶\n"
  252. "_______________¶¶_¶¶_____¶¶¶\n"
  253. "________________¶¶¶______¶¶¶\n"
  254. "_________________¶_______¶¶\n"
  255. " _ \n "
  256. "___ _ _ _ __ __ __ (_) __ __ ___ \n"
  257. "/ __| | | | | | '__| \\ \\ / / | | \\ \\ / / / _ \\ \n"
  258. "\\__ \\ | |_| | | | \\ V / | | \\ V / | __/ \n"
  259. "|___/ \\__,_| |_| \\_/ |_| \\_/ \\___| \n";
  260.  
  261. system ("PAUSE");
  262. system ("cls");
  263.  
  264.  
  265.  
  266.  
  267.  
  268. }
  269.  
  270. void chap1(Hero& myHero){
  271. system ("cls");
  272. myHero.statsScr(myHero.name, myHero.str, myHero.dex, myHero.inte, myHero.gold, myHero.sword, myHero.knife, myHero.magic, myHero.health);
  273.  
  274. cout << "\n\nYou're lying in your bed, dreaming of another life. A life without poverty\n"
  275. "Even before your parents died, life was harsh. As long as you could remember\n"
  276. "Temolia had always been a cruel city to live in, but when your parents where\n"
  277. "still alive they told you about how it used to be. What seemed like distant\n"
  278. "tales from now, tales about a prosperous small town, with an excellent harbor\n"
  279. "and economy, getting a work would be no problem for almost anyone. But as the \n"
  280. "war with the neighboruing countries went on, Temolia quickly became\n"
  281. "overpopulated. And when the capital was destroyed, rulers decided to make\n"
  282. "Temolia the new capital and move their basis of operation there, things just\n"
  283. "got worse. The city was being expanded in a quick rate, which resulted in\n"
  284. "sloppy work. Nowadays it wasn't unusual for buildings in the poorer district\n"
  285. "to fall in. The city were still being expanded. but only mansions and buildings\n"
  286. "for the rich was being manufactured. The war was over, but no one could really\n"
  287. "tell who won and who lost the war. Temolia was untouched by the battles of the\n"
  288. "war, but the whole as an empire was fundamentally shaken the the bones, the \n"
  289. "economy collapsed and the remaining politicians greedily tried to clutch on\n"
  290. "the last remaining resources for their own use.";
  291.  
  292. }
  293.  
  294. int main() {
  295. titleScr();
  296.  
  297. //Skapa ett objekt av klassen Hero
  298. Hero myHero;
  299.  
  300. myHero.createHero(myHero.name, myHero.str, myHero.dex, myHero.inte, myHero.gold, myHero.sword, myHero.knife, myHero.magic, myHero.health);
  301.  
  302. chap1(myHero);
  303.  
  304.  
  305. system ("PAUSE");
  306. return 0;
  307. }
Advertisement
Add Comment
Please, Sign In to add comment