Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Threading;
  7.  
  8.  
  9. namespace Hobo_Simulator
  10. {
  11. /// <summary>
  12. /// The class that contains the game.
  13. /// </summary>
  14. class Game
  15. {
  16. /* En region är ett område i Visual Studio som du kan kollapsa för att enklare hålla reda på din kod... Alla instansvariabler kan ligga innanför den här regionen t.ex. om det
  17. * eventuellt blir många :)
  18. * En instansvariabel är en variabel utanför någon funktion/metod. Dessa kan bli nådda från alla metoder i hela klassen. De kan ha något som heter access-modifiers.
  19. * Om denne endast ska kommas åt inom den här klassen, så kan du ge den "access-modifiern" private.
  20. * dessa är de vanligaste:
  21. * - public | Gör så att variabeln kan kommas åt från vilken klass som helst. Om den är public så kan den t.ex. kommas åt från Utils (måste dock också vara static för att det ska gå)
  22. * - private | Gör så att variabeln endast kan kommas åt inom den klassen där den är deklarerad (skapad). Grundläggande är det bra att använda private.
  23. * Om du inte ger en access-modifier så blir den "internal", vilket är okej också. Vet inte exakt vad det gör, men rekommenderar att använda private eller public.
  24. * Senare, när du lär dig mer, är protected också väldigt bra, men det är inte förrän du börjar jobba med arv (inheritance), vilket är när saker börjar bli kul på riktigt ;)
  25. *
  26. * Annat tips:
  27. * Skriv tre /// för att skriva en kommentar för kompilatorn (visual studio). När du hoverar över variabeln så får du en beskrivning av vad denne gör osv.
  28. * Gäller också för funktioner och klasser och kanske mer saker.
  29. */
  30. // Instance Variables
  31. #region Massa olika variabler
  32. /// <summary>
  33. /// Avgör om man kan sova eller inte. Är från början true men ändras sedan till false.
  34. /// </summary>
  35. private bool CanSleep = true;
  36. private bool hasbeer = false;
  37. /// <summary>
  38. /// massa olika variabler till spelet, private verkar göra så att jag kan använda variablen överallt i spelets kod.
  39. /// </summary>
  40. /// Detta är alla Intergers till bars()
  41. private int playerhealth;
  42. private int stamina;
  43. private int addiction;
  44. private int money;
  45. private int sleep;
  46. private int x_pos;
  47. private int y_pos;
  48. private bool welfare = false;
  49. private int damage_taken;
  50. private int hitormissrandom;
  51. private int weapon_damage;
  52. private int enemyhealth;
  53. private int money_stolen;
  54. private int enemyweapon;
  55. private string enemyweapon_string;
  56. private string user_weapon_string;
  57. private bool ability_begging;
  58. private bool ability_mugging;
  59. private bool ability_healing = false;
  60. private int user_weapon_stamina;
  61. private int weapon_stick_damage;
  62. private bool Ready_to_attack = false;
  63. private bool difficulty_easy;
  64. private bool difficulty_normal;
  65. private bool difficulty_hard;
  66.  
  67.  
  68. private int max_money_stolen;
  69. private int min_money_stolen;
  70. private int max_damage_taken;
  71. private int min_damage_taken;
  72. private int min_miss_chance;
  73. private int max_miss_chance;
  74. private int base_damage;
  75.  
  76. //consumables that increse stamina
  77. private int consumable;
  78. private int item_beer;
  79. private int item_heroin;
  80. private int item_coke;
  81. private int item_cigarette;
  82. private int item_blood;
  83. private int item_weed;
  84. private int item_mint;
  85.  
  86. //consumables that restore health
  87. private int item_ricin_amount;
  88. private int item_arsenic_amount;
  89. private int item_mercury_amount;
  90. private int item_restore_ricin;
  91. private int item_restore_arsenic;
  92. private int item_restore_mercury;
  93. private int item_restore_steak;
  94. private int item_restore_protein_bar;
  95.  
  96. //private int item_restore_milkshake;
  97. private int item_restore_insulin;
  98. //private int item_restore_bandage;
  99. private int item_restore_apple;
  100. private int item_restore_dirty_bandage;
  101.  
  102. //consumables that add to base damage
  103. private int item_protein_bar_amount;
  104.  
  105. //inventory thing
  106. private int item_beer_amount;
  107. private int item_heroin_amount;
  108. private int item_coke_amount;
  109. private int item_cigarette_amount;
  110. private int item_blood_amount;
  111. private int item_weed_amount;
  112. private int item_mint_amount;
  113.  
  114. //another different inventory thing but for health instead
  115. private int item_apple_amount;
  116. private int item_steak_amount;
  117. private int item_insulin_amount;
  118. private int item_dirty_bandage_amount;
  119.  
  120. //different strings to be diplayed when there are more of 1 in the int
  121. private string menu_beer;
  122. private string menu_heroin;
  123. private string menu_coke;
  124. private string menu_cigarette;
  125. private string menu_blood;
  126. private string menu_weed;
  127. private string menu_mint;
  128.  
  129. private string menu_ricin;
  130. private string menu_arsenic;
  131. private string menu_apple;
  132. private string menu_steak;
  133. private string menu_insulin;
  134. private string menu_dirty_bandage;
  135. private string menu_protein_bar;
  136.  
  137. //olika sorters drop chanser
  138. private int item_drop_chance_max;
  139. private int item_drop_chance_min;
  140. private int item_drop_chance;
  141. private int item_drop_amount;
  142.  
  143.  
  144.  
  145. private Random rng = new Random();
  146. #endregion
  147. // Constructor
  148. public Game() { }
  149. /// <summary>
  150. /// Starts the game!
  151. /// </summary>
  152. ///
  153. static void Main(string[] args)
  154. {
  155.  
  156. // Creating an instance of the game and starting it.
  157. Game game = new Game();
  158. game.Start();
  159.  
  160. // When game is finished, let the user exit.
  161. Console.WriteLine(Environment.NewLine);
  162. Console.WriteLine("Press any key to exit the game!");
  163. Console.ReadKey(true);
  164. }
  165. public void Start()
  166. {
  167. itemlist();
  168. Random_Drop();
  169.  
  170. Difficulty();
  171. Badthingshappen();
  172.  
  173.  
  174.  
  175. Useitem();
  176. Mug25();
  177.  
  178.  
  179. //Perk();
  180. //begin();
  181.  
  182. }
  183. //welcome to mugging hobo simulator!
  184. //welcome to super ultra mega hobo mugging simulator 2000!
  185. private void Intro()
  186. {
  187.  
  188. Console.SetCursorPosition(0, 0);
  189. Console.SetCursorPosition(x_pos, y_pos);
  190. Console.WriteLine(" _ _ _ _ ");
  191. Console.SetCursorPosition(x_pos, y_pos + 1);
  192. Console.WriteLine(" _ |_|_| _ |_|_| ");
  193. Console.SetCursorPosition(x_pos, y_pos + 2);
  194. Console.WriteLine(" ___| |_ ___ ___ ___| |_ ___ ___ ");
  195. Console.SetCursorPosition(x_pos, y_pos + 3);
  196. Console.WriteLine(" | _| | . | . |_ | _| | . | . |");
  197. Console.SetCursorPosition(x_pos, y_pos + 4);
  198. Console.WriteLine(" |___|_|_|___| _| | |___|_|_|___| _|");
  199. Console.SetCursorPosition(x_pos, y_pos + 5);
  200. Console.WriteLine(" |_| |_| |_| ");
  201.  
  202. for (int i = 0; i < 10; x_pos++, i++)
  203. {
  204. x_pos = +2;
  205. y_pos = +2;
  206.  
  207. Thread.Sleep(500);
  208. }
  209.  
  210.  
  211. }
  212. private void Face()
  213. {
  214. Utils.PrintMessage("Welcome to face!",30,150);
  215. }
  216. private void Difficulty()
  217. {
  218. enemyhealth = 15;
  219. playerhealth = 100;
  220. stamina = 100;
  221. addiction = 100;
  222. money = 0;
  223. sleep = 100;
  224.  
  225.  
  226. Utils.PrintMessage("Choose difficulty", 15, 300);
  227. Console.WriteLine();
  228. Utils.PrintMessage("(1) Easy, (2) Normal, (3) Hard ", 15, 300);
  229. difficulty_easy = false;
  230. difficulty_normal = false;
  231. difficulty_hard = false;
  232.  
  233.  
  234.  
  235. string difficulty = Console.ReadLine();
  236. if (difficulty == "1")
  237. {
  238. min_money_stolen = 10;
  239. max_money_stolen = 20;
  240. min_damage_taken = 5;
  241. max_damage_taken = 20;
  242. difficulty_easy = true;
  243. base_damage = 10;
  244. item_drop_chance_min = 1;
  245. item_drop_chance_max = 4;
  246. //Profession();
  247. item_drop_amount = 3;
  248.  
  249. Perk();
  250.  
  251.  
  252. }
  253. else if (difficulty == "2")
  254. {
  255. difficulty_normal = true;
  256. min_damage_taken = 15;
  257. max_damage_taken = 25;
  258. min_money_stolen = 15;
  259. max_money_stolen = 25;
  260. base_damage = 7;
  261. item_drop_chance_min = 1;
  262. item_drop_chance_max = 3;
  263. //Profession();
  264. item_drop_amount = 2;
  265. Perk();
  266.  
  267. }
  268. else if (difficulty == "3") // det finns fler olika bars() beroende på svårighetsgrad så att t.ex sömn, vatten, kyla finns med.
  269. {
  270.  
  271. difficulty_hard = true;
  272. min_damage_taken = 20;
  273. max_damage_taken = 35;
  274. min_money_stolen = 20;
  275. max_money_stolen = 30;
  276. base_damage = 5;
  277. item_drop_chance_min =1;
  278. item_drop_chance_max =2;
  279. // Profession_hard();
  280. item_drop_amount = 1;
  281. Perk();
  282.  
  283. }
  284.  
  285. else
  286. {
  287. Console.Clear();
  288. Difficulty();
  289. }
  290. }
  291. private void Profession_hard()
  292. {
  293. //som vanliga professon men man har tillgång till thug
  294. Utils.PrintMessage("Choose your new profession: ", 15, 300);
  295. Console.WriteLine();
  296. Utils.PrintMessage("(1) Begger, (2) Pickpocketeer, (3) Trash hunter, (4) Thug ", 15, 300);
  297. string profession = Console.ReadLine();
  298. if (profession == "1") //man får bidrag av staten
  299. {
  300. bool isBegger = true;
  301. welfare = false;
  302. ability_begging = true;
  303. Perk();
  304. }
  305. if (profession == "2")
  306. {
  307. bool isPickpocketeer = true; // man kan hamna i trubbel med polisen
  308. Perk();
  309. }
  310. if (profession == "3")
  311. {
  312. bool isTrash_hunter = true; // varje dag kommer en lastbil och man kan om man vill leta igenom soporna mot lite stamina
  313. Perk();
  314. }
  315. if (profession == "4")
  316. {
  317. bool isThug = true; // thuglife, man får bonusar när man attackerar folk, kan få speciella vapen.
  318. welfare = true;
  319. }
  320. else
  321. {
  322. Console.Clear();
  323. Profession_hard();
  324. }
  325. }
  326. /// <Rename to ability>
  327. /// rename Profession to ability and stuff.
  328. /// </summary>6
  329. private void Profession()
  330. {
  331. Utils.PrintMessage("Choose your new profession: ", 15, 300);
  332. Console.WriteLine();
  333. Utils.PrintMessage("(1) Begger, (2) Pickpocketeer, (3) Trash hunter ", 15, 300);
  334. string profession = Console.ReadLine();
  335. if (profession == "1")
  336. {
  337. bool isBegger = true; //man får bidrag av staten
  338. welfare = false;
  339. ability_begging = true;
  340. Perk();
  341. }
  342. if (profession == "2")
  343. {
  344. bool isPickpocketeer = true; // man kan hamna i trubbel med polisen
  345. Perk();
  346. }
  347. if (profession == "3")
  348. {
  349. bool isTrash_hunter = true; // varje dag kommer en lastbil och man kan om man vill leta igenom soporna mot lite stamina
  350. Perk();
  351. }
  352. else
  353. {
  354. Console.Clear();
  355. Profession();
  356.  
  357. }
  358.  
  359. }
  360. private void Bars()
  361. {
  362. Console.SetCursorPosition(60, 0);
  363. Console.ForegroundColor = (ConsoleColor.Cyan);
  364. Console.Write(" Addiction: " + addiction);
  365. Console.ForegroundColor = (ConsoleColor.DarkYellow);
  366. Console.Write(" Stamina: " + stamina);
  367. Console.ForegroundColor = (ConsoleColor.Red);
  368. Console.Write(" Health: " + playerhealth);
  369. Console.ForegroundColor = (ConsoleColor.Green);
  370. Console.Write(" Money: " + money);
  371. Console.ForegroundColor = (ConsoleColor.White);
  372. Console.SetCursorPosition(0, 1);
  373.  
  374. if (playerhealth < 1)
  375. {
  376. Thread.Sleep(1500);
  377. Console.Clear();
  378. Deadscreen();
  379. }
  380. }
  381. private void Perk()
  382. {
  383. Console.ForegroundColor = (ConsoleColor.White);
  384. Utils.PrintMessage("Choose a perk", 15, 300);
  385. Console.WriteLine();
  386. Utils.PrintMessage("(1) Healing, (2) Strenght, (3) Hunting ", 15, 300);
  387. Console.WriteLine();
  388. string prof2 = Console.ReadLine();
  389.  
  390. if(prof2 == "1")
  391. {
  392. ability_healing = true;
  393. //ability_healing = true;
  394.  
  395.  
  396. }
  397. if(prof2 == "2")
  398. {
  399. base_damage += 5;
  400. }
  401. if(prof2 == "3")
  402. {
  403. stamina += 20;
  404. }
  405.  
  406.  
  407.  
  408.  
  409. /*
  410. * ABILITY HEALER om jag har tid
  411. * if (enemyhealth > playerhealth)
  412. {
  413. health += 5;
  414. }
  415. *
  416. *
  417. *
  418. if (prof2 == "1")
  419. {
  420. string profname = "Doctor";
  421. Utils.PrintMessage("You accidentaly left your toenail inside your patients brain while doing surgery and were fired. ", 15, 1000);
  422. Console.WriteLine();
  423. }
  424. else if (prof2 == "2")
  425. {
  426. string profname = "Engineer";
  427. ;
  428. Utils.PrintMessage("your lack of sleep caused a major screwup. A bridge collapsed and you boss fired you. ", 15, 1000);
  429. Console.WriteLine();
  430. Console.Clear();
  431. }
  432. else if (prof2 == "3")
  433. {
  434. string profname = "Hunter";
  435. Utils.PrintMessage("The animal you hunted, elephants died out. ", 15, 1000);
  436. Console.WriteLine();
  437. Console.Clear();
  438. }
  439. else
  440. {
  441. Console.Clear();
  442. Perk();
  443. }
  444. */
  445.  
  446. //Utils.PrintMessage("And so, you were left with no other option but to go out on the streets since you have no job and no friends...", 15, 2000);
  447. Console.WriteLine();
  448. Console.Clear();
  449. Console.SetCursorPosition(Console.WindowWidth / 2 - 5 / 2, 0);
  450. Utils.PrintMessage("Starting Game", 45, 1000);
  451. for (int i = 0; i < 3; i++)
  452. {
  453. Console.SetCursorPosition(Console.WindowWidth / 2 - 5 / 2, 0);
  454. Console.WriteLine("Starting Game");
  455.  
  456. }
  457. Badthingshappen();
  458. Console.Clear();
  459. }
  460. /// <Perk Todo>
  461. /// kan ändra istället för förededetta yrken kan det vara olika abilities.
  462. /// t.ex kan hunter jäga råttor,doctor har bättre health, kan få droger lättare och engineer kan nånting.
  463. /// </summary>
  464. private void begin()
  465. {
  466. Utils.PrintMessage("You wake up, it seems like you are in a bin. ", 15, 1000);
  467. Console.WriteLine();
  468. Utils.PrintMessage("It's not a very fancy bin but it it's comfy.", 15, 1000);
  469. Console.WriteLine();
  470. Utils.PrintMessage("Last night was rough. ", 15, 1000);
  471. Console.WriteLine();
  472. Sleepless();
  473. }
  474. public void Look_around()
  475. {
  476. Console.Clear();
  477. Utils.PrintMessage("You open the trash lid and check what is happening outside. ", 15, 100);
  478. Console.WriteLine();
  479. Utils.PrintMessage("It's early morning and it's cold. No reason to get out just yet.", 15, 100);
  480. Console.WriteLine();
  481. Sleepless();
  482. }
  483. public void Random_Drop()
  484. {
  485. Console.WriteLine("It workis!");
  486. Console.ReadKey();
  487. item_drop_chance = rng.Next(1,50);
  488. //item_drop_amount = rng.Next(item_drop_chance_min, item_drop_chance_max);
  489. //vet att det finns bättre sätt at göra detta på men har inte lärt mig det än :(
  490. //gör så att det är random hur många gånger denna metoden går igenom.
  491. item_drop_chance = 2;
  492. item_drop_amount = 4;
  493. for (int i = 1; i > item_drop_amount; i++)
  494. {
  495. if (item_drop_chance == 1) { item_ricin_amount += 1; Console.WriteLine("1 + Ricin "); item_ricin_amount += 1;}
  496. if (item_drop_chance == 2) { item_arsenic_amount += 1; Console.WriteLine("1 + Arsenic "); Console.WriteLine(); }
  497. if (item_drop_chance == 3) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
  498. if (item_drop_chance == 4) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
  499. if (item_drop_chance == 5) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
  500. if (item_drop_chance == 6) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
  501. if (item_drop_chance == 7) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
  502. if (item_drop_chance == 8) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
  503. if (item_drop_chance == 9) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
  504. if (item_drop_chance == 10) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
  505. if (item_drop_chance == 11) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
  506. if (item_drop_chance == 12) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
  507. if (item_drop_chance == 13) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
  508. if (item_drop_chance == 14) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
  509. if (item_drop_chance == 15) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
  510. if (item_drop_chance == 16) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
  511. if (item_drop_chance == 17) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
  512. if (item_drop_chance == 18) { item_arsenic_amount += 1; Console.WriteLine("1 + Arsenic "); Console.WriteLine(); }
  513. if (item_drop_chance == 19) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
  514. if (item_drop_chance == 20) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
  515. if (item_drop_chance == 21) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
  516. if (item_drop_chance == 22) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
  517. if (item_drop_chance == 23) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
  518. if (item_drop_chance == 24) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
  519. if (item_drop_chance == 25) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
  520. if (item_drop_chance == 26) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
  521. if (item_drop_chance == 27) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
  522. if (item_drop_chance == 28) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
  523. if (item_drop_chance == 29) { item_arsenic_amount += 1; Console.WriteLine("1 + Arsenic "); Console.WriteLine(); }
  524. if (item_drop_chance == 30) { item_heroin_amount += 1; Console.WriteLine("1 + Heroin "); Console.WriteLine(); }
  525. if (item_drop_chance == 31) { item_heroin_amount += 1; Console.WriteLine("1 + Heroin "); Console.WriteLine(); }
  526. if (item_drop_chance == 32) { item_heroin_amount += 1; Console.WriteLine("1 + Heroin "); Console.WriteLine(); }
  527. if (item_drop_chance == 33) { item_ricin_amount += 1; Console.WriteLine("1 + Ricin "); Console.WriteLine(); }
  528. if (item_drop_chance == 34) { item_coke_amount += 1; Console.WriteLine("1 + Coke "); Console.WriteLine(); }
  529. if (item_drop_chance == 35) { item_coke_amount += 1; Console.WriteLine("1 + Coke "); Console.WriteLine(); }
  530. if (item_drop_chance == 36) { item_ricin_amount += 1; Console.WriteLine("1 + Ricin "); Console.WriteLine(); }
  531. if (item_drop_chance == 37) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
  532. if (item_drop_chance == 38) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
  533. if (item_drop_chance == 39) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
  534. if (item_drop_chance == 40) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
  535. if (item_drop_chance == 41) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
  536. if (item_drop_chance == 42) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
  537. if (item_drop_chance == 43) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
  538. if (item_drop_chance == 44) { item_weed_amount += 3; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
  539. if (item_drop_chance == 45) { item_weed_amount += 3; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
  540. if (item_drop_chance == 46) { item_weed_amount += 1; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
  541. if (item_drop_chance == 47) { item_weed_amount += 3; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
  542. if (item_drop_chance == 48) { item_weed_amount += 2; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
  543. if (item_drop_chance == 49) { item_mint_amount += 4; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
  544. if (item_drop_chance == 50) { item_mint_amount += 5; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
  545. else
  546. {
  547. Bars();
  548. Console.WriteLine("nothing happened");
  549. Console.ReadKey();
  550. itemlist();
  551.  
  552. }
  553.  
  554.  
  555.  
  556.  
  557. }
  558. }
  559. public void itemlist()
  560. {
  561. playerhealth = 100;
  562.  
  563. //Weapons
  564. weapon_stick_damage = 5;
  565.  
  566. //consumables, how stamina they will regain
  567.  
  568. item_beer = 7;
  569. item_heroin = 30;
  570. item_coke = 20;
  571. item_cigarette = 5;
  572. item_blood = 3;
  573. item_weed = 10;
  574. item_mint = 1;
  575.  
  576. //lägg check for death i bar() metoden
  577.  
  578. //restores health
  579. item_restore_ricin = -100;
  580. item_restore_arsenic = -100;
  581. item_restore_apple = 7;
  582. item_restore_steak = 15;
  583. item_restore_insulin = 30;
  584. item_restore_dirty_bandage = -15;
  585. //increases damage
  586. item_restore_protein_bar = 7;
  587.  
  588. //how many of every stamina consumable
  589. item_beer_amount = 0;
  590. item_heroin_amount = 0;
  591. item_coke_amount = 0;
  592. item_cigarette_amount = 0;
  593. item_weed_amount = 0;
  594. item_mint_amount = 1;
  595. item_blood_amount = 0;
  596.  
  597. //amount of consumables that restores health
  598. item_ricin_amount = 0;
  599. item_arsenic_amount = 0;
  600. item_apple_amount = 0;
  601. item_steak_amount = 0;
  602. item_insulin_amount = 0;
  603. item_dirty_bandage_amount = 0;
  604. //amount of items that increases damage
  605. item_protein_bar_amount = 0;
  606. Useitem();
  607. }
  608. public void Useitem()
  609. {
  610.  
  611. //makes so you can choose if you have one or more of an item they will appear in the menu
  612. menu_beer = "";
  613. menu_heroin = "";
  614. menu_coke = "";
  615. menu_cigarette = "";
  616. menu_blood = "";
  617. menu_weed = "";
  618. menu_mint = "";
  619. menu_ricin = "";
  620. menu_arsenic = "";
  621. menu_apple = "";
  622. menu_steak = "";
  623. menu_insulin = "";
  624. menu_dirty_bandage = "";
  625. menu_protein_bar = "";
  626.  
  627.  
  628. //ask what item to equip or if you don't have any
  629. if (item_beer_amount + item_heroin_amount + item_coke_amount + item_cigarette_amount + item_blood_amount + item_weed_amount + item_mint_amount + item_ricin_amount + item_arsenic_amount + item_apple_amount + item_steak_amount + item_insulin_amount + item_dirty_bandage_amount + item_protein_bar_amount < 1)
  630. {
  631. Utils.PrintMessage("You don't have anything in your inventory!", 15, 300);
  632. Console.WriteLine();
  633. Utils.PrintMessage("Returning to fight..", 15, 1000);
  634. Console.Clear();
  635. Mug25();
  636. }
  637. else
  638. {
  639. Utils.PrintMessage("What item do you want to use?", 15, 300);
  640. Console.WriteLine();
  641. }
  642. //tells you what items you have
  643. if (item_beer_amount > 0) {menu_beer = " [1] Beer: " + item_beer_amount; }
  644. if(item_heroin_amount > 0) { menu_heroin = " [2] heroin: " + item_heroin_amount + ",";}
  645. if (item_coke_amount > 0) {menu_coke = " [3] coke: " + item_coke_amount; }
  646. if (item_cigarette_amount > 0) {menu_cigarette = " [4] cigarette: " + item_cigarette_amount; }
  647. if (item_blood_amount > 0) {menu_blood = " [5] Blood: " + item_blood_amount; }
  648. if (item_weed_amount > 0) { menu_weed = " [6] weed: " + item_weed_amount;}
  649. if(item_mint_amount > 0) {menu_mint = " [7] mint: " + item_mint_amount; }
  650. if (item_ricin_amount > 0) { menu_ricin = " [8] ricin: " + item_ricin_amount; }
  651. if (item_arsenic_amount > 0) { menu_arsenic = " [9] arsenic: " + item_arsenic_amount;}
  652. if (item_apple_amount > 0) { menu_apple = " [10] apple: " + item_apple_amount;}
  653. if (item_steak_amount > 0) { menu_steak = " [11] steak: " + item_steak_amount;}
  654. if (item_insulin_amount > 0) { menu_insulin = " [12] insulin: " + item_insulin_amount;}
  655. if (item_dirty_bandage_amount > 0) { menu_dirty_bandage = " [13] dirty_bandage: " + item_dirty_bandage_amount;}
  656. if (item_protein_bar_amount > 0) { menu_protein_bar = " [14] protein_bar: " + item_protein_bar_amount;}
  657.  
  658. Console.WriteLine(menu_beer + menu_heroin + menu_coke + menu_cigarette + menu_blood + menu_weed + menu_mint + menu_ricin + menu_arsenic + menu_apple + menu_steak + menu_insulin + menu_dirty_bandage + menu_protein_bar +", [0] exit");
  659.  
  660. string consume_item_num = Console.ReadLine();
  661. if (consume_item_num == "1")
  662. {
  663. if (item_beer_amount > 0)
  664. {
  665. consumable = item_beer;
  666. Console.WriteLine();
  667. Utils.PrintMessage("Bottoms up!", 15, 300);
  668. Console.WriteLine();
  669. stamina += consumable; ;
  670. Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
  671. stamina += item_beer;
  672. consumable -= 1;
  673. Bars();
  674. Utils.PrintMessage("You feel a bit dizzy", 15, 700);
  675. }
  676. else
  677. {
  678. Console.Clear();
  679. Utils.PrintMessage("You don't have that item!", 15, 300);
  680. Console.Clear();
  681. Useitem();
  682. }
  683.  
  684. }
  685. if (consume_item_num == "2")
  686. {
  687. if(item_heroin_amount < 0)
  688. {
  689. Utils.PrintMessage("You don't have that item!", 15, 300);
  690. Console.Clear();
  691. Useitem();
  692. }
  693. }
  694. if (item_heroin_amount > 0)
  695. {
  696. if (consume_item_num == "2")
  697. {
  698. consumable = item_heroin;
  699. Console.WriteLine();
  700. Utils.PrintMessage("Bottoms up!", 15, 300);
  701. Console.WriteLine();
  702. stamina += consumable; ;
  703. Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
  704. stamina += item_heroin;
  705. consumable -= 1;
  706. Bars();
  707. Utils.PrintMessage("You feel a bit dizzy", 15, 700);
  708. }
  709.  
  710. }
  711. if (consume_item_num == "3")
  712. {
  713. if (item_coke_amount < 0)
  714. {
  715. Utils.PrintMessage("You don't have that item!", 15, 300);
  716. Console.Clear();
  717. Useitem();
  718. }
  719. }
  720. if (item_coke_amount > 0)
  721. {
  722. if (consume_item_num == "3")
  723. {
  724. consumable = item_coke;
  725. Console.WriteLine();
  726. Utils.PrintMessage("Bottoms up!", 15, 300);
  727. Console.WriteLine();
  728. stamina += consumable; ;
  729. Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
  730. stamina += item_coke;
  731. consumable -= 1;
  732. Bars();
  733. Utils.PrintMessage("You feel a bit dizzy", 15, 700);
  734. }
  735.  
  736. }
  737. if (consume_item_num == "4")
  738. {
  739. if (item_cigarette_amount < 0)
  740. {
  741. Utils.PrintMessage("You don't have that item!", 15, 300);
  742. Console.Clear();
  743. Useitem();
  744. }
  745. }
  746. if (item_cigarette_amount > 0)
  747. {
  748. if (consume_item_num == "4")
  749. {
  750. consumable = item_cigarette;
  751. Console.WriteLine();
  752. Utils.PrintMessage("Bottoms up!", 15, 300);
  753. Console.WriteLine();
  754. stamina += consumable;
  755. Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
  756. stamina += item_cigarette;
  757. consumable -= 1;
  758. Bars();
  759. Utils.PrintMessage("You feel a bit dizzy", 15, 700);
  760. }
  761.  
  762. }
  763. if (consume_item_num == "5")
  764. {
  765. if (item_blood_amount < 0)
  766. {
  767. Utils.PrintMessage("You don't have that item!", 15, 300);
  768. Console.Clear();
  769. Useitem();
  770. }
  771. }
  772. if (item_blood_amount > 0)
  773. {
  774. if (consume_item_num == "5")
  775. {
  776. consumable = item_blood;
  777. Console.WriteLine();
  778. Utils.PrintMessage("Tastes like iron!", 15, 300);
  779. Console.WriteLine();
  780. stamina += consumable;
  781. Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
  782. stamina += item_blood;
  783. consumable -= 1;
  784. Bars();
  785. Utils.PrintMessage("The extra red bloodcells makes so your stamina recover more quickly!", 15, 700);
  786. }
  787.  
  788. }
  789. if (consume_item_num == "6")
  790.  
  791.  
  792.  
  793. {
  794. if (item_weed_amount < 1)
  795. {
  796. Utils.PrintMessage("You don't have that item!", 15, 300);
  797. Console.Clear();
  798. Useitem();
  799. }
  800. }
  801. if (item_weed_amount > 0)
  802. {
  803. if (consume_item_num == "6")
  804. {
  805. consumable = item_weed;
  806. Console.WriteLine();
  807. Utils.PrintMessage("Bottoms up!", 15, 300);
  808. Console.WriteLine();
  809. stamina += consumable; ;
  810. Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
  811. stamina += item_weed;
  812. consumable -= 1;
  813. Bars();
  814. Utils.PrintMessage("You feel a bit dizzy", 15, 700);
  815. }
  816.  
  817. }
  818. if (consume_item_num == "7")
  819. {
  820. if (item_mint_amount < 0)
  821. {
  822. Utils.PrintMessage("You don't have that item!", 15, 300);
  823. Console.Clear();
  824. Useitem();
  825. }
  826. }
  827. if (item_mint_amount > 0)
  828. {
  829. if (consume_item_num == "7")
  830. {
  831. consumable = item_mint;
  832. Console.WriteLine();
  833. Utils.PrintMessage("Bottoms up!", 15, 300);
  834. Console.WriteLine();
  835. stamina += consumable; ;
  836. Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
  837. stamina += item_mint;
  838. consumable -= 1;
  839. Bars();
  840. Utils.PrintMessage("You feel a bit dizzy", 15, 700);
  841. }
  842.  
  843. }
  844. if (consume_item_num == "8")
  845. {
  846. if (item_ricin_amount < 0)
  847. {
  848. Utils.PrintMessage("You don't have that item!", 15, 300);
  849. Console.Clear();
  850. Useitem();
  851. }
  852. }
  853. if (item_ricin_amount > 0)
  854. {
  855. if (consume_item_num == "8")
  856. {
  857. consumable = item_restore_ricin;
  858. Console.WriteLine();
  859. Utils.PrintMessage("Swalloing dem seeds!", 15, 700);
  860. Console.WriteLine();
  861. playerhealth += consumable; ;
  862. Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
  863. playerhealth += item_restore_ricin;
  864. consumable -= 1;
  865. Utils.PrintMessage("You're feeling rather warm", 40, 1000);
  866. Utils.PrintMessage("Really warm...", 40, 1000);
  867. Bars();
  868. }
  869.  
  870. }
  871. if (consume_item_num == "9")
  872. {
  873. if (item_arsenic_amount < 0)
  874. {
  875. Utils.PrintMessage("You don't have that item!", 15, 300);
  876. Console.Clear();
  877. Useitem();
  878. }
  879. }
  880. if (item_arsenic_amount > 0)
  881. {
  882. if (consume_item_num == "9")
  883. {
  884. consumable = item_restore_arsenic;
  885. Console.WriteLine();
  886. Utils.PrintMessage("Drinking a good ol' bottle of arsenic!", 15, 700);
  887. Console.WriteLine();
  888. playerhealth += consumable; ;
  889. Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
  890. playerhealth += item_restore_arsenic;
  891. consumable -= 1;
  892. Utils.PrintMessage("You're starting to feel nauseous", 30, 2000);
  893. Utils.PrintMessage("Everything's spinning...",50, 1500);
  894. Bars();
  895. }
  896.  
  897. }
  898. if (consume_item_num == "10")
  899. {
  900. if (item_apple_amount < 0)
  901. {
  902. Utils.PrintMessage("You don't have that item!", 15, 300);
  903. Console.Clear();
  904. Useitem();
  905. }
  906. }
  907. if (item_apple_amount > 0)
  908. {
  909. if (consume_item_num == "10")
  910. {
  911. consumable = item_restore_apple;
  912. Console.WriteLine();
  913. Utils.PrintMessage("Apple tastes nice", 15, 700);
  914. Console.WriteLine();
  915. playerhealth += consumable;
  916. Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
  917. playerhealth += item_restore_apple;
  918. consumable -= 1;
  919. Utils.PrintMessage("Sweet!", 15, 1000);
  920. Bars();
  921. }
  922. }
  923. if (consume_item_num == "11")
  924. {
  925. if (item_steak_amount < 0)
  926. {
  927. Utils.PrintMessage("You don't have that item!", 15, 300);
  928. Console.Clear();
  929. Useitem();
  930. }
  931. }
  932. if (item_steak_amount > 0)
  933. {
  934. if (consume_item_num == "11")
  935. {
  936. consumable = item_restore_steak;
  937.  
  938. Console.WriteLine();
  939. Utils.PrintMessage("100% vegan!", 15, 700);
  940. Console.WriteLine();
  941. playerhealth += consumable; ;
  942. Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
  943. base_damage += item_restore_steak;
  944.  
  945. consumable -= 1;
  946. Utils.PrintMessage("lol, jk it's meat", 15, 1000);
  947. Bars();
  948. }
  949.  
  950. }
  951. if (consume_item_num == "12")
  952. {
  953. if (item_insulin_amount < 0)
  954. {
  955. Utils.PrintMessage("You don't have that item!", 15, 300);
  956. Console.Clear();
  957. Useitem();
  958. }
  959. }
  960. if (item_insulin_amount > 0)
  961. {
  962. if (consume_item_num == "12")
  963. {
  964. consumable = item_restore_insulin;
  965. Console.WriteLine();
  966. Utils.PrintMessage("How does this even work?!", 15, 700);
  967. Console.WriteLine();
  968. playerhealth += consumable;
  969. Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
  970. playerhealth += item_restore_insulin;
  971. consumable -= 1;
  972. Utils.PrintMessage("You're not even a diabetic!", 15, 1000);
  973. Bars();
  974. }
  975. }
  976. if (consume_item_num == "13")
  977. {
  978. if (item_dirty_bandage_amount < 0)
  979. {
  980. Utils.PrintMessage("You don't have that item!", 15, 300);
  981. Console.Clear();
  982. Useitem();
  983. }
  984. }
  985. if (item_dirty_bandage_amount > 0)
  986. {
  987. if (consume_item_num == "13")
  988. {
  989. consumable = item_restore_dirty_bandage;
  990.  
  991. Console.WriteLine();
  992. Utils.PrintMessage("", 15, 700);
  993.  
  994. playerhealth += consumable; ;
  995. Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
  996. playerhealth += item_restore_dirty_bandage;
  997.  
  998. consumable -= 1;
  999. Utils.PrintMessage("turns out it was a diaper not a bandage", 15, 1000);
  1000. Bars();
  1001. }
  1002. }
  1003. if (consume_item_num == "14")
  1004. {
  1005. if (item_protein_bar_amount < 0)
  1006. {
  1007. Utils.PrintMessage("You don't have that item!", 15, 300);
  1008. Console.Clear();
  1009. Useitem();
  1010. }
  1011. }
  1012. if (item_protein_bar_amount> 0)
  1013. {
  1014. if (consume_item_num == "13")
  1015. {
  1016. consumable = item_restore_protein_bar;
  1017.  
  1018. Console.WriteLine();
  1019. Utils.PrintMessage("Muscles in minutes!", 15, 700);
  1020. Console.WriteLine();
  1021. playerhealth += consumable; ;
  1022. Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
  1023. base_damage += item_restore_protein_bar;
  1024.  
  1025. consumable -= 1;
  1026. Utils.PrintMessage("Yaay, you're ripped now", 15, 1000);
  1027. Bars();
  1028. }
  1029.  
  1030. }
  1031. if (consume_item_num == "0")
  1032. {
  1033. Console.Clear();
  1034. Mug25();
  1035. }
  1036. if (playerhealth < 1)
  1037. {
  1038. Console.Clear();
  1039. Deadscreen();
  1040. }
  1041. else
  1042. {
  1043. Console.Clear();
  1044. }
  1045. }
  1046. public void Badthingshappen()
  1047. {
  1048. Console.Clear();
  1049. Utils.PrintMessage("You're waiting in an alley, hope someone comes soon...", 15, 2000);
  1050. Console.WriteLine();
  1051. Utils.PrintMessage("You can hear someone coming from your right",15,1000);
  1052. Console.WriteLine();
  1053. Utils.PrintMessage("That someone is right in front of you now...", 15, 300);
  1054. Console.WriteLine();
  1055. Utils.PrintMessage("What will you do?", 15,300);
  1056. Console.WriteLine();
  1057.  
  1058. Utils.PrintMessage("[1] Let him slip, [2] Mug him",15,0);
  1059. string slip_or_mug = Console.ReadLine();
  1060. if (slip_or_mug == "1")
  1061. {
  1062. Console.WriteLine();
  1063. Utils.PrintMessage("You'll be nice for now...", 15, 1000);
  1064. Console.Clear();
  1065. Badthingshappen();
  1066. }
  1067. if(slip_or_mug == "2")
  1068. {
  1069. Console.Clear();
  1070. Console.WriteLine();
  1071. Utils.PrintMessage("You apporoach him from behind and", 15, 400);
  1072. Console.WriteLine();
  1073. Utils.PrintMessage("You tell him to give you all his stuff",15,700);
  1074. Console.Clear();
  1075. }
  1076. else
  1077. {
  1078. Badthingshappen();
  1079. }
  1080.  
  1081. }
  1082. public void Sleepless()
  1083. {
  1084. Ready_to_attack = true;
  1085. if (Ready_to_attack == true)
  1086. {
  1087. Mug25();
  1088. }
  1089. Utils.PrintMessage("What will you do now?", 15, 10);
  1090. Console.WriteLine();
  1091. Utils.PrintMessage(" (1) Go back to sleep, (2) Look around", 15, 100);
  1092. Console.WriteLine();
  1093. string choise1 = Console.ReadLine();
  1094. if (choise1 == "1")
  1095. {
  1096. if (CanSleep == true)
  1097. {
  1098.  
  1099. Utils.PrintMessage("You go back to sleep...", 15, 300);
  1100. Console.WriteLine();
  1101. Console.Clear();
  1102. for (int i = 0; i < 5; i++)
  1103. {
  1104. Console.Write("Sleeping");
  1105. Utils.loading();
  1106. }
  1107. Utils.PrintMessage("You wake up from a bag of trash smashing your face.", 15, 200);
  1108. Console.WriteLine();
  1109.  
  1110. CanSleep = false;
  1111.  
  1112. Sleepless();
  1113. }
  1114. else if (CanSleep == false)
  1115. {
  1116. for (int i = 0; i < 5; i++)
  1117. {
  1118. Console.Write("Attempting to get back to sleep");
  1119. Utils.loading();
  1120. }
  1121. Utils.PrintMessage("Someone throws another bag of trash into your bin and you're filled with rage", 15, 300);
  1122. Console.WriteLine();
  1123. Utils.PrintMessage("What will you do?", 15, 300);
  1124. Utils.PrintMessage(" (1) Try to sleep, (2) Mug him.", 15, 300);
  1125. string sleep_or_kill = Console.ReadLine();
  1126. if (sleep_or_kill == "1")
  1127. {
  1128. for (int i = 0; i < 5; i++)
  1129. {
  1130. Console.Write("Attempting to get back to sleep");
  1131. Utils.loading();
  1132. }
  1133. Utils.PrintMessage("Another bag of trash smacs your face. The smell of rotting food fills your nose.", 15, 300);
  1134. Console.WriteLine();
  1135. Utils.PrintMessage("You have no choice but to mug him.", 15, 1000);
  1136. Ready_to_attack = true;
  1137. Sleepless();
  1138. }
  1139. if (sleep_or_kill == "2")
  1140. {
  1141. Ready_to_attack = true;
  1142. Sleepless();
  1143. }
  1144. else
  1145. {
  1146. CanSleep = true;
  1147. Sleepless();
  1148. }
  1149. }
  1150.  
  1151. }
  1152. if (choise1 == "2")
  1153. {
  1154. Look_around();
  1155. }
  1156. else
  1157. {
  1158. Utils.PrintMessage("", 15, 500);
  1159. Console.Clear();
  1160. Sleepless();
  1161. }
  1162. }
  1163. public void enemyhealthbar()
  1164. {
  1165. Console.ForegroundColor = (ConsoleColor.Red);
  1166. Console.SetCursorPosition(14, 0);
  1167. Console.ForegroundColor = (ConsoleColor.Magenta);
  1168. Console.WriteLine("Enemy Health: " + enemyhealth); // instead i can make a bar like bar() but for enemy health instead.
  1169. Console.ForegroundColor = (ConsoleColor.White);
  1170. }
  1171. public void Mug25()
  1172. {
  1173. enemyweapon_string = "*stick*";
  1174. user_weapon_string = "*fist*";
  1175. user_weapon_stamina = 7;
  1176. Bars();
  1177. enemyhealthbar();
  1178. Console.Clear();
  1179. min_miss_chance = 1;
  1180. max_miss_chance = 6;
  1181. Random rng = new Random();
  1182. for (int i = 1; i < enemyhealth;)
  1183. {
  1184. hitormissrandom = rng.Next(min_miss_chance, max_miss_chance);
  1185. damage_taken = rng.Next(min_damage_taken, max_damage_taken);
  1186. Bars();
  1187. enemyhealthbar();
  1188. Console.SetCursorPosition(0, 1);
  1189. if (stamina - user_weapon_stamina < 0)
  1190. {
  1191. Utils.PrintMessage("You are out of stamina!", 15, 600);
  1192. Console.Clear();
  1193. itemlist();
  1194. }
  1195. if (hitormissrandom == 1)
  1196. {
  1197. Console.Clear();
  1198. enemyhealthbar();
  1199. Bars();
  1200. Utils.PrintMessage("You attack the enemy with " + user_weapon_string, 15, 1000);
  1201. Console.WriteLine();
  1202. Utils.PrintMessage("But you missed! ", 15, 1000);
  1203. Console.WriteLine();
  1204. Utils.PrintMessage("Continue...", 15, 300);
  1205. Console.ReadKey();
  1206. stamina -= user_weapon_stamina;
  1207. Bars();
  1208. }
  1209. else
  1210. {
  1211. Console.Clear();
  1212. Bars();
  1213. enemyhealthbar();
  1214. Utils.PrintMessage("You attack the enemy with " + user_weapon_string, 15, 1000);
  1215. enemyhealthbar();
  1216. Console.WriteLine();
  1217. Utils.PrintMessage("You hit and deal " + base_damage + " damage!", 15, 1000);
  1218. enemyhealth = enemyhealth - base_damage;
  1219. Console.WriteLine();
  1220. enemyhealthbar();
  1221. Console.SetCursorPosition(0, 3);
  1222. Utils.PrintMessage("Continue...", 15, 300);
  1223. Console.ReadKey();
  1224. }
  1225.  
  1226. if (enemyhealth < 1)
  1227. {
  1228. Console.Clear();
  1229. Utils.PrintMessage("You killed the enemy!", 15, 1000);
  1230. Console.WriteLine();
  1231. int money_stolen = rng.Next(min_money_stolen, max_money_stolen);
  1232. money = +money_stolen;
  1233. Utils.PrintMessage("You stole " + money_stolen + "$ and aquired *stick* ", 15, 300);
  1234. Bars();
  1235. Console.SetCursorPosition(0, 2);
  1236. Utils.PrintMessage("Continue...", 15, 300);
  1237. Console.ReadKey();
  1238. Bars();
  1239. Random_Drop();
  1240. }
  1241.  
  1242. Console.Clear();
  1243. enemyhealthbar();
  1244. Bars();
  1245. int randomstring2 = rng.Next(1, 2);
  1246. Utils.PrintMessage("The enemy attacks with " + enemyweapon_string, 15, 1000);
  1247. if (randomstring2 == 1)
  1248. {
  1249. enemyhealthbar();
  1250. Bars();
  1251. Console.WriteLine();
  1252. playerhealth -= damage_taken;
  1253. Utils.PrintMessage("He hits and deals " + damage_taken + " damage!", 15, 1000);
  1254. damage_taken = rng.Next(min_damage_taken, max_damage_taken);
  1255. Bars();
  1256. Console.WriteLine();
  1257. Console.WriteLine();
  1258.  
  1259. Utils.PrintMessage("Continue...", 15, 300);
  1260. Console.ReadKey();
  1261.  
  1262. }
  1263.  
  1264. else if (randomstring2 == 2)
  1265. {
  1266. Utils.PrintMessage("He missed!", 15, 1000);
  1267. }
  1268. if (ability_healing == true)
  1269. {
  1270. if (enemyhealth > playerhealth)
  1271. playerhealth += 4;
  1272. Bars();
  1273. }
  1274.  
  1275. }
  1276. ///<Mug25 Todo>
  1277. /// kan lägga till massa andra saker här som om man har vapen händer någonting.
  1278. ///kan även hända att man kan göra mug() i en for loop och beroende på hur många rätt man får förlorar eller vinner man
  1279. ///kan även vara kommentarer till det. Istället för att skiva 1 eller 2 kan det vara slå eller sparka
  1280. ///fiender kan även ha andra vapen på sig som man kan obtaina.
  1281.  
  1282. }
  1283. public void beer()
  1284. {
  1285.  
  1286. Utils.PrintMessage("You look around and see a bottle of beer", 15, 100);
  1287. Console.WriteLine();
  1288. Utils.PrintMessage("Will you drink it?", 15, 100);
  1289. Console.WriteLine();
  1290. Utils.PrintMessage("(1) yes, (2), No", 15, 100);
  1291. Console.WriteLine();
  1292. string drink_or_not = Console.ReadLine();
  1293. if (drink_or_not == "1")
  1294. {
  1295. Utils.PrintMessage("you drink what's left of the beer and feel a little better", 15, 100);
  1296. playerhealth += 15;
  1297. }
  1298. else if (drink_or_not == "2")
  1299. {
  1300. Utils.PrintMessage(" You save it for later", 15, 100);
  1301. bool hasbeer = true;
  1302.  
  1303. }
  1304. else
  1305. {
  1306. beer();
  1307. }
  1308.  
  1309. }
  1310. public void Deadscreen()
  1311. {
  1312. Console.Clear();
  1313. Console.SetCursorPosition(Console.WindowWidth / 2 - 21/2, Console.WindowHeight/2);
  1314. Console.ForegroundColor = ConsoleColor.DarkRed;
  1315.  
  1316. Utils.PrintMessage("Y o u d i e d . . .", 50, 3000);
  1317. Console.SetCursorPosition(Console.WindowWidth / 2 - 17/2, Console.WindowHeight / 2 +2);
  1318. Console.ForegroundColor = ConsoleColor.DarkGray;
  1319. Utils.PrintMessage("Play again? y/n",30,0);
  1320. Console.SetCursorPosition(Console.WindowWidth / 2 / 2, Console.WindowHeight / 2 + 3);
  1321. Console.ForegroundColor = ConsoleColor.White;
  1322. string quit_or_replay = Console.ReadLine();
  1323. Console.SetCursorPosition(0,0);
  1324.  
  1325. if(quit_or_replay == "y")
  1326. {
  1327. Console.Clear();
  1328. Game game = new Game();
  1329. game.Start();
  1330. }
  1331. if(quit_or_replay == "n")
  1332. {
  1333. Console.ForegroundColor = ConsoleColor.White;
  1334. Console.SetCursorPosition(Console.WindowWidth / 2 - 7 / 2, Console.WindowHeight / 2 + 3);
  1335. Utils.PrintMessage("Exiting", 15, 0);
  1336. for (int i = 0; i < 3; i++)
  1337. {
  1338. Console.SetCursorPosition(Console.WindowWidth / 2 / 2, Console.WindowHeight / 2 + 3);
  1339. Console.Write("Exiting");
  1340. Console.SetCursorPosition(Console.WindowWidth / 2 / 2 + 6, Console.WindowHeight / 2 + 3);
  1341. Utils.loading();
  1342. }
  1343. Environment.Exit(0);
  1344. }
  1345. else
  1346. {
  1347. Console.ForegroundColor = ConsoleColor.DarkBlue;
  1348. Console.SetCursorPosition(Console.WindowWidth / 2 / 2, Console.WindowHeight / 2 + 3);
  1349. Utils.PrintMessage("Exiting",15,0);
  1350. for (int i = 0; i < 3; i++)
  1351. {
  1352. Utils.loading();
  1353. }
  1354. Environment.Exit(0);
  1355.  
  1356. }
  1357. }
  1358.  
  1359. }
  1360. }
  1361.  
  1362.  
  1363.  
  1364.  
  1365. /*
  1366. Om programmet någonsin strular kan man trycka på "Rebuild Solution" i Solution Explorer. ex om error meddelanden inte reagerar
  1367. System.Threading.Thread.Sleep(100);
  1368. Utils.PrintMessage("", 10, 1000); kan användas för att skriva långsam text
  1369. break; avlutar metoden
  1370. return; avslutar metoden
  1371. Console.ForegroundColor = (ConsoleColor.Red); sätter texten till röd
  1372. Console.SetCursorPosition(Console.WindowWidth/2 - message.Length/2, Console.WindowHeight/2); sätter texten på mitten av skärmen
  1373. while (true) fortsätter till man använder break; kommandot
  1374. Environment.Exit(0); avslutar programmet
  1375.  
  1376. Philip lärde mig hur man gör kommentarer. Det finns // som funkar för en lång rad och sedan /// som automatiskt skriver nya rader och sen
  1377. finns det /*blabla*\ som går över flera rader
  1378.  
  1379. */
  1380.  
  1381.  
  1382. /*
  1383. private void Intro()
  1384. {
  1385. int x_pos = 10;
  1386. int y_pos = 10;
  1387. StringBuilder logoBlock = new StringBuilder();
  1388. Console.SetCursorPosition(0, 0);
  1389. Console.SetCursorPosition(x_pos, y_pos);
  1390. logoBlock.AppendLine(" _ _ _ _ ");
  1391. Console.SetCursorPosition(x_pos, y_pos);
  1392. logoBlock.AppendLine(" _ |_|_| _ |_|_| ");
  1393. Console.SetCursorPosition(x_pos, y_pos);
  1394. logoBlock.AppendLine(" ___| |_ ___ ___ ___| |_ ___ ___ ");
  1395. Console.SetCursorPosition(x_pos, y_pos);
  1396. logoBlock.AppendLine(" | _| | . | . |_ | _| | . | . |");
  1397. Console.SetCursorPosition(x_pos, y_pos);
  1398. logoBlock.AppendLine(" |___|_|_|___| _| | |___|_|_|___| _|");
  1399. Console.SetCursorPosition(x_pos, y_pos);
  1400. logoBlock.AppendLine(" |_| |_| |_| ");
  1401.  
  1402. for (int i = 0; i < 10; i++)
  1403. {
  1404. Console.SetCursorPosition(x_pos, y_pos);
  1405.  
  1406. }
  1407. string logoBlockStr = logoBlock.ToString();
  1408. Console.Write(logoBlockStr);
  1409. Thread.Sleep(1000);
  1410.  
  1411. }
  1412.  
  1413.  
  1414. string randomstring1 = random.ToString(); konverterar int int till string
  1415. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement