Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- namespace Hobo_Simulator
- {
- /// <summary>
- /// The class that contains the game.
- /// </summary>
- class Game
- {
- /* 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
- * eventuellt blir många :)
- * 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.
- * Om denne endast ska kommas åt inom den här klassen, så kan du ge den "access-modifiern" private.
- * dessa är de vanligaste:
- * - 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å)
- * - 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.
- * 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.
- * 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 ;)
- *
- * Annat tips:
- * 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.
- * Gäller också för funktioner och klasser och kanske mer saker.
- */
- // Instance Variables
- #region Massa olika variabler
- /// <summary>
- /// Avgör om man kan sova eller inte. Är från början true men ändras sedan till false.
- /// </summary>
- private bool CanSleep = true;
- private bool hasbeer = false;
- /// <summary>
- /// massa olika variabler till spelet, private verkar göra så att jag kan använda variablen överallt i spelets kod.
- /// </summary>
- /// Detta är alla Intergers till bars()
- private int playerhealth;
- private int stamina;
- private int addiction;
- private int money;
- private int sleep;
- private int x_pos;
- private int y_pos;
- private bool welfare = false;
- private int damage_taken;
- private int hitormissrandom;
- private int weapon_damage;
- private int enemyhealth;
- private int money_stolen;
- private int enemyweapon;
- private string enemyweapon_string;
- private string user_weapon_string;
- private bool ability_begging;
- private bool ability_mugging;
- private bool ability_healing = false;
- private int user_weapon_stamina;
- private int weapon_stick_damage;
- private bool Ready_to_attack = false;
- private bool difficulty_easy;
- private bool difficulty_normal;
- private bool difficulty_hard;
- private int max_money_stolen;
- private int min_money_stolen;
- private int max_damage_taken;
- private int min_damage_taken;
- private int min_miss_chance;
- private int max_miss_chance;
- private int base_damage;
- //consumables that increse stamina
- private int consumable;
- private int item_beer;
- private int item_heroin;
- private int item_coke;
- private int item_cigarette;
- private int item_blood;
- private int item_weed;
- private int item_mint;
- //consumables that restore health
- private int item_ricin_amount;
- private int item_arsenic_amount;
- private int item_mercury_amount;
- private int item_restore_ricin;
- private int item_restore_arsenic;
- private int item_restore_mercury;
- private int item_restore_steak;
- private int item_restore_protein_bar;
- //private int item_restore_milkshake;
- private int item_restore_insulin;
- //private int item_restore_bandage;
- private int item_restore_apple;
- private int item_restore_dirty_bandage;
- //consumables that add to base damage
- private int item_protein_bar_amount;
- //inventory thing
- private int item_beer_amount;
- private int item_heroin_amount;
- private int item_coke_amount;
- private int item_cigarette_amount;
- private int item_blood_amount;
- private int item_weed_amount;
- private int item_mint_amount;
- //another different inventory thing but for health instead
- private int item_apple_amount;
- private int item_steak_amount;
- private int item_insulin_amount;
- private int item_dirty_bandage_amount;
- //different strings to be diplayed when there are more of 1 in the int
- private string menu_beer;
- private string menu_heroin;
- private string menu_coke;
- private string menu_cigarette;
- private string menu_blood;
- private string menu_weed;
- private string menu_mint;
- private string menu_ricin;
- private string menu_arsenic;
- private string menu_apple;
- private string menu_steak;
- private string menu_insulin;
- private string menu_dirty_bandage;
- private string menu_protein_bar;
- //olika sorters drop chanser
- private int item_drop_chance_max;
- private int item_drop_chance_min;
- private int item_drop_chance;
- private int item_drop_amount;
- private Random rng = new Random();
- #endregion
- // Constructor
- public Game() { }
- /// <summary>
- /// Starts the game!
- /// </summary>
- ///
- static void Main(string[] args)
- {
- // Creating an instance of the game and starting it.
- Game game = new Game();
- game.Start();
- // When game is finished, let the user exit.
- Console.WriteLine(Environment.NewLine);
- Console.WriteLine("Press any key to exit the game!");
- Console.ReadKey(true);
- }
- public void Start()
- {
- itemlist();
- Random_Drop();
- Difficulty();
- Badthingshappen();
- Useitem();
- Mug25();
- //Perk();
- //begin();
- }
- //welcome to mugging hobo simulator!
- //welcome to super ultra mega hobo mugging simulator 2000!
- private void Intro()
- {
- Console.SetCursorPosition(0, 0);
- Console.SetCursorPosition(x_pos, y_pos);
- Console.WriteLine(" _ _ _ _ ");
- Console.SetCursorPosition(x_pos, y_pos + 1);
- Console.WriteLine(" _ |_|_| _ |_|_| ");
- Console.SetCursorPosition(x_pos, y_pos + 2);
- Console.WriteLine(" ___| |_ ___ ___ ___| |_ ___ ___ ");
- Console.SetCursorPosition(x_pos, y_pos + 3);
- Console.WriteLine(" | _| | . | . |_ | _| | . | . |");
- Console.SetCursorPosition(x_pos, y_pos + 4);
- Console.WriteLine(" |___|_|_|___| _| | |___|_|_|___| _|");
- Console.SetCursorPosition(x_pos, y_pos + 5);
- Console.WriteLine(" |_| |_| |_| ");
- for (int i = 0; i < 10; x_pos++, i++)
- {
- x_pos = +2;
- y_pos = +2;
- Thread.Sleep(500);
- }
- }
- private void Face()
- {
- Utils.PrintMessage("Welcome to face!",30,150);
- }
- private void Difficulty()
- {
- enemyhealth = 15;
- playerhealth = 100;
- stamina = 100;
- addiction = 100;
- money = 0;
- sleep = 100;
- Utils.PrintMessage("Choose difficulty", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("(1) Easy, (2) Normal, (3) Hard ", 15, 300);
- difficulty_easy = false;
- difficulty_normal = false;
- difficulty_hard = false;
- string difficulty = Console.ReadLine();
- if (difficulty == "1")
- {
- min_money_stolen = 10;
- max_money_stolen = 20;
- min_damage_taken = 5;
- max_damage_taken = 20;
- difficulty_easy = true;
- base_damage = 10;
- item_drop_chance_min = 1;
- item_drop_chance_max = 4;
- //Profession();
- item_drop_amount = 3;
- Perk();
- }
- else if (difficulty == "2")
- {
- difficulty_normal = true;
- min_damage_taken = 15;
- max_damage_taken = 25;
- min_money_stolen = 15;
- max_money_stolen = 25;
- base_damage = 7;
- item_drop_chance_min = 1;
- item_drop_chance_max = 3;
- //Profession();
- item_drop_amount = 2;
- Perk();
- }
- else if (difficulty == "3") // det finns fler olika bars() beroende på svårighetsgrad så att t.ex sömn, vatten, kyla finns med.
- {
- difficulty_hard = true;
- min_damage_taken = 20;
- max_damage_taken = 35;
- min_money_stolen = 20;
- max_money_stolen = 30;
- base_damage = 5;
- item_drop_chance_min =1;
- item_drop_chance_max =2;
- // Profession_hard();
- item_drop_amount = 1;
- Perk();
- }
- else
- {
- Console.Clear();
- Difficulty();
- }
- }
- private void Profession_hard()
- {
- //som vanliga professon men man har tillgång till thug
- Utils.PrintMessage("Choose your new profession: ", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("(1) Begger, (2) Pickpocketeer, (3) Trash hunter, (4) Thug ", 15, 300);
- string profession = Console.ReadLine();
- if (profession == "1") //man får bidrag av staten
- {
- bool isBegger = true;
- welfare = false;
- ability_begging = true;
- Perk();
- }
- if (profession == "2")
- {
- bool isPickpocketeer = true; // man kan hamna i trubbel med polisen
- Perk();
- }
- if (profession == "3")
- {
- bool isTrash_hunter = true; // varje dag kommer en lastbil och man kan om man vill leta igenom soporna mot lite stamina
- Perk();
- }
- if (profession == "4")
- {
- bool isThug = true; // thuglife, man får bonusar när man attackerar folk, kan få speciella vapen.
- welfare = true;
- }
- else
- {
- Console.Clear();
- Profession_hard();
- }
- }
- /// <Rename to ability>
- /// rename Profession to ability and stuff.
- /// </summary>6
- private void Profession()
- {
- Utils.PrintMessage("Choose your new profession: ", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("(1) Begger, (2) Pickpocketeer, (3) Trash hunter ", 15, 300);
- string profession = Console.ReadLine();
- if (profession == "1")
- {
- bool isBegger = true; //man får bidrag av staten
- welfare = false;
- ability_begging = true;
- Perk();
- }
- if (profession == "2")
- {
- bool isPickpocketeer = true; // man kan hamna i trubbel med polisen
- Perk();
- }
- if (profession == "3")
- {
- bool isTrash_hunter = true; // varje dag kommer en lastbil och man kan om man vill leta igenom soporna mot lite stamina
- Perk();
- }
- else
- {
- Console.Clear();
- Profession();
- }
- }
- private void Bars()
- {
- Console.SetCursorPosition(60, 0);
- Console.ForegroundColor = (ConsoleColor.Cyan);
- Console.Write(" Addiction: " + addiction);
- Console.ForegroundColor = (ConsoleColor.DarkYellow);
- Console.Write(" Stamina: " + stamina);
- Console.ForegroundColor = (ConsoleColor.Red);
- Console.Write(" Health: " + playerhealth);
- Console.ForegroundColor = (ConsoleColor.Green);
- Console.Write(" Money: " + money);
- Console.ForegroundColor = (ConsoleColor.White);
- Console.SetCursorPosition(0, 1);
- if (playerhealth < 1)
- {
- Thread.Sleep(1500);
- Console.Clear();
- Deadscreen();
- }
- }
- private void Perk()
- {
- Console.ForegroundColor = (ConsoleColor.White);
- Utils.PrintMessage("Choose a perk", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("(1) Healing, (2) Strenght, (3) Hunting ", 15, 300);
- Console.WriteLine();
- string prof2 = Console.ReadLine();
- if(prof2 == "1")
- {
- ability_healing = true;
- //ability_healing = true;
- }
- if(prof2 == "2")
- {
- base_damage += 5;
- }
- if(prof2 == "3")
- {
- stamina += 20;
- }
- /*
- * ABILITY HEALER om jag har tid
- * if (enemyhealth > playerhealth)
- {
- health += 5;
- }
- *
- *
- *
- if (prof2 == "1")
- {
- string profname = "Doctor";
- Utils.PrintMessage("You accidentaly left your toenail inside your patients brain while doing surgery and were fired. ", 15, 1000);
- Console.WriteLine();
- }
- else if (prof2 == "2")
- {
- string profname = "Engineer";
- ;
- Utils.PrintMessage("your lack of sleep caused a major screwup. A bridge collapsed and you boss fired you. ", 15, 1000);
- Console.WriteLine();
- Console.Clear();
- }
- else if (prof2 == "3")
- {
- string profname = "Hunter";
- Utils.PrintMessage("The animal you hunted, elephants died out. ", 15, 1000);
- Console.WriteLine();
- Console.Clear();
- }
- else
- {
- Console.Clear();
- Perk();
- }
- */
- //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);
- Console.WriteLine();
- Console.Clear();
- Console.SetCursorPosition(Console.WindowWidth / 2 - 5 / 2, 0);
- Utils.PrintMessage("Starting Game", 45, 1000);
- for (int i = 0; i < 3; i++)
- {
- Console.SetCursorPosition(Console.WindowWidth / 2 - 5 / 2, 0);
- Console.WriteLine("Starting Game");
- }
- Badthingshappen();
- Console.Clear();
- }
- /// <Perk Todo>
- /// kan ändra istället för förededetta yrken kan det vara olika abilities.
- /// t.ex kan hunter jäga råttor,doctor har bättre health, kan få droger lättare och engineer kan nånting.
- /// </summary>
- private void begin()
- {
- Utils.PrintMessage("You wake up, it seems like you are in a bin. ", 15, 1000);
- Console.WriteLine();
- Utils.PrintMessage("It's not a very fancy bin but it it's comfy.", 15, 1000);
- Console.WriteLine();
- Utils.PrintMessage("Last night was rough. ", 15, 1000);
- Console.WriteLine();
- Sleepless();
- }
- public void Look_around()
- {
- Console.Clear();
- Utils.PrintMessage("You open the trash lid and check what is happening outside. ", 15, 100);
- Console.WriteLine();
- Utils.PrintMessage("It's early morning and it's cold. No reason to get out just yet.", 15, 100);
- Console.WriteLine();
- Sleepless();
- }
- public void Random_Drop()
- {
- Console.WriteLine("It workis!");
- Console.ReadKey();
- item_drop_chance = rng.Next(1,50);
- //item_drop_amount = rng.Next(item_drop_chance_min, item_drop_chance_max);
- //vet att det finns bättre sätt at göra detta på men har inte lärt mig det än :(
- //gör så att det är random hur många gånger denna metoden går igenom.
- item_drop_chance = 2;
- item_drop_amount = 4;
- for (int i = 1; i > item_drop_amount; i++)
- {
- if (item_drop_chance == 1) { item_ricin_amount += 1; Console.WriteLine("1 + Ricin "); item_ricin_amount += 1;}
- if (item_drop_chance == 2) { item_arsenic_amount += 1; Console.WriteLine("1 + Arsenic "); Console.WriteLine(); }
- if (item_drop_chance == 3) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
- if (item_drop_chance == 4) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
- if (item_drop_chance == 5) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
- if (item_drop_chance == 6) { item_apple_amount += 1; Console.WriteLine("1 + Apple "); Console.WriteLine(); }
- if (item_drop_chance == 7) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
- if (item_drop_chance == 8) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
- if (item_drop_chance == 9) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
- if (item_drop_chance == 10) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
- if (item_drop_chance == 11) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
- if (item_drop_chance == 12) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
- if (item_drop_chance == 13) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
- if (item_drop_chance == 14) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
- if (item_drop_chance == 15) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
- if (item_drop_chance == 16) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
- if (item_drop_chance == 17) { item_steak_amount += 1; Console.WriteLine("1 + Steak "); Console.WriteLine(); }
- if (item_drop_chance == 18) { item_arsenic_amount += 1; Console.WriteLine("1 + Arsenic "); Console.WriteLine(); }
- if (item_drop_chance == 19) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
- if (item_drop_chance == 20) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
- if (item_drop_chance == 21) { item_protein_bar_amount += 1; Console.WriteLine("1 + Protein bar "); Console.WriteLine(); }
- if (item_drop_chance == 22) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
- if (item_drop_chance == 23) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
- if (item_drop_chance == 24) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
- if (item_drop_chance == 25) { item_beer_amount += 1; Console.WriteLine("1 + Beer "); Console.WriteLine(); }
- if (item_drop_chance == 26) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
- if (item_drop_chance == 27) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
- if (item_drop_chance == 28) { item_insulin_amount += 1; Console.WriteLine("1 + insulin "); Console.WriteLine(); }
- if (item_drop_chance == 29) { item_arsenic_amount += 1; Console.WriteLine("1 + Arsenic "); Console.WriteLine(); }
- if (item_drop_chance == 30) { item_heroin_amount += 1; Console.WriteLine("1 + Heroin "); Console.WriteLine(); }
- if (item_drop_chance == 31) { item_heroin_amount += 1; Console.WriteLine("1 + Heroin "); Console.WriteLine(); }
- if (item_drop_chance == 32) { item_heroin_amount += 1; Console.WriteLine("1 + Heroin "); Console.WriteLine(); }
- if (item_drop_chance == 33) { item_ricin_amount += 1; Console.WriteLine("1 + Ricin "); Console.WriteLine(); }
- if (item_drop_chance == 34) { item_coke_amount += 1; Console.WriteLine("1 + Coke "); Console.WriteLine(); }
- if (item_drop_chance == 35) { item_coke_amount += 1; Console.WriteLine("1 + Coke "); Console.WriteLine(); }
- if (item_drop_chance == 36) { item_ricin_amount += 1; Console.WriteLine("1 + Ricin "); Console.WriteLine(); }
- if (item_drop_chance == 37) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
- if (item_drop_chance == 38) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
- if (item_drop_chance == 39) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
- if (item_drop_chance == 40) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
- if (item_drop_chance == 41) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
- if (item_drop_chance == 42) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
- if (item_drop_chance == 43) { item_cigarette_amount += 1; Console.WriteLine("1 + Cigarette "); Console.WriteLine(); }
- if (item_drop_chance == 44) { item_weed_amount += 3; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
- if (item_drop_chance == 45) { item_weed_amount += 3; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
- if (item_drop_chance == 46) { item_weed_amount += 1; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
- if (item_drop_chance == 47) { item_weed_amount += 3; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
- if (item_drop_chance == 48) { item_weed_amount += 2; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
- if (item_drop_chance == 49) { item_mint_amount += 4; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
- if (item_drop_chance == 50) { item_mint_amount += 5; Console.WriteLine("1 + Weed "); Console.WriteLine(); }
- else
- {
- Bars();
- Console.WriteLine("nothing happened");
- Console.ReadKey();
- itemlist();
- }
- }
- }
- public void itemlist()
- {
- playerhealth = 100;
- //Weapons
- weapon_stick_damage = 5;
- //consumables, how stamina they will regain
- item_beer = 7;
- item_heroin = 30;
- item_coke = 20;
- item_cigarette = 5;
- item_blood = 3;
- item_weed = 10;
- item_mint = 1;
- //lägg check for death i bar() metoden
- //restores health
- item_restore_ricin = -100;
- item_restore_arsenic = -100;
- item_restore_apple = 7;
- item_restore_steak = 15;
- item_restore_insulin = 30;
- item_restore_dirty_bandage = -15;
- //increases damage
- item_restore_protein_bar = 7;
- //how many of every stamina consumable
- item_beer_amount = 0;
- item_heroin_amount = 0;
- item_coke_amount = 0;
- item_cigarette_amount = 0;
- item_weed_amount = 0;
- item_mint_amount = 1;
- item_blood_amount = 0;
- //amount of consumables that restores health
- item_ricin_amount = 0;
- item_arsenic_amount = 0;
- item_apple_amount = 0;
- item_steak_amount = 0;
- item_insulin_amount = 0;
- item_dirty_bandage_amount = 0;
- //amount of items that increases damage
- item_protein_bar_amount = 0;
- Useitem();
- }
- public void Useitem()
- {
- //makes so you can choose if you have one or more of an item they will appear in the menu
- 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 = "";
- //ask what item to equip or if you don't have any
- 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)
- {
- Utils.PrintMessage("You don't have anything in your inventory!", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("Returning to fight..", 15, 1000);
- Console.Clear();
- Mug25();
- }
- else
- {
- Utils.PrintMessage("What item do you want to use?", 15, 300);
- Console.WriteLine();
- }
- //tells you what items you have
- if (item_beer_amount > 0) {menu_beer = " [1] Beer: " + item_beer_amount; }
- if(item_heroin_amount > 0) { menu_heroin = " [2] heroin: " + item_heroin_amount + ",";}
- if (item_coke_amount > 0) {menu_coke = " [3] coke: " + item_coke_amount; }
- if (item_cigarette_amount > 0) {menu_cigarette = " [4] cigarette: " + item_cigarette_amount; }
- if (item_blood_amount > 0) {menu_blood = " [5] Blood: " + item_blood_amount; }
- if (item_weed_amount > 0) { menu_weed = " [6] weed: " + item_weed_amount;}
- if(item_mint_amount > 0) {menu_mint = " [7] mint: " + item_mint_amount; }
- if (item_ricin_amount > 0) { menu_ricin = " [8] ricin: " + item_ricin_amount; }
- if (item_arsenic_amount > 0) { menu_arsenic = " [9] arsenic: " + item_arsenic_amount;}
- if (item_apple_amount > 0) { menu_apple = " [10] apple: " + item_apple_amount;}
- if (item_steak_amount > 0) { menu_steak = " [11] steak: " + item_steak_amount;}
- if (item_insulin_amount > 0) { menu_insulin = " [12] insulin: " + item_insulin_amount;}
- if (item_dirty_bandage_amount > 0) { menu_dirty_bandage = " [13] dirty_bandage: " + item_dirty_bandage_amount;}
- if (item_protein_bar_amount > 0) { menu_protein_bar = " [14] protein_bar: " + item_protein_bar_amount;}
- 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");
- string consume_item_num = Console.ReadLine();
- if (consume_item_num == "1")
- {
- if (item_beer_amount > 0)
- {
- consumable = item_beer;
- Console.WriteLine();
- Utils.PrintMessage("Bottoms up!", 15, 300);
- Console.WriteLine();
- stamina += consumable; ;
- Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
- stamina += item_beer;
- consumable -= 1;
- Bars();
- Utils.PrintMessage("You feel a bit dizzy", 15, 700);
- }
- else
- {
- Console.Clear();
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (consume_item_num == "2")
- {
- if(item_heroin_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_heroin_amount > 0)
- {
- if (consume_item_num == "2")
- {
- consumable = item_heroin;
- Console.WriteLine();
- Utils.PrintMessage("Bottoms up!", 15, 300);
- Console.WriteLine();
- stamina += consumable; ;
- Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
- stamina += item_heroin;
- consumable -= 1;
- Bars();
- Utils.PrintMessage("You feel a bit dizzy", 15, 700);
- }
- }
- if (consume_item_num == "3")
- {
- if (item_coke_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_coke_amount > 0)
- {
- if (consume_item_num == "3")
- {
- consumable = item_coke;
- Console.WriteLine();
- Utils.PrintMessage("Bottoms up!", 15, 300);
- Console.WriteLine();
- stamina += consumable; ;
- Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
- stamina += item_coke;
- consumable -= 1;
- Bars();
- Utils.PrintMessage("You feel a bit dizzy", 15, 700);
- }
- }
- if (consume_item_num == "4")
- {
- if (item_cigarette_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_cigarette_amount > 0)
- {
- if (consume_item_num == "4")
- {
- consumable = item_cigarette;
- Console.WriteLine();
- Utils.PrintMessage("Bottoms up!", 15, 300);
- Console.WriteLine();
- stamina += consumable;
- Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
- stamina += item_cigarette;
- consumable -= 1;
- Bars();
- Utils.PrintMessage("You feel a bit dizzy", 15, 700);
- }
- }
- if (consume_item_num == "5")
- {
- if (item_blood_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_blood_amount > 0)
- {
- if (consume_item_num == "5")
- {
- consumable = item_blood;
- Console.WriteLine();
- Utils.PrintMessage("Tastes like iron!", 15, 300);
- Console.WriteLine();
- stamina += consumable;
- Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
- stamina += item_blood;
- consumable -= 1;
- Bars();
- Utils.PrintMessage("The extra red bloodcells makes so your stamina recover more quickly!", 15, 700);
- }
- }
- if (consume_item_num == "6")
- {
- if (item_weed_amount < 1)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_weed_amount > 0)
- {
- if (consume_item_num == "6")
- {
- consumable = item_weed;
- Console.WriteLine();
- Utils.PrintMessage("Bottoms up!", 15, 300);
- Console.WriteLine();
- stamina += consumable; ;
- Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
- stamina += item_weed;
- consumable -= 1;
- Bars();
- Utils.PrintMessage("You feel a bit dizzy", 15, 700);
- }
- }
- if (consume_item_num == "7")
- {
- if (item_mint_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_mint_amount > 0)
- {
- if (consume_item_num == "7")
- {
- consumable = item_mint;
- Console.WriteLine();
- Utils.PrintMessage("Bottoms up!", 15, 300);
- Console.WriteLine();
- stamina += consumable; ;
- Utils.PrintMessage("+ " + consumable + " stamina", 15, 1000);
- stamina += item_mint;
- consumable -= 1;
- Bars();
- Utils.PrintMessage("You feel a bit dizzy", 15, 700);
- }
- }
- if (consume_item_num == "8")
- {
- if (item_ricin_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_ricin_amount > 0)
- {
- if (consume_item_num == "8")
- {
- consumable = item_restore_ricin;
- Console.WriteLine();
- Utils.PrintMessage("Swalloing dem seeds!", 15, 700);
- Console.WriteLine();
- playerhealth += consumable; ;
- Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
- playerhealth += item_restore_ricin;
- consumable -= 1;
- Utils.PrintMessage("You're feeling rather warm", 40, 1000);
- Utils.PrintMessage("Really warm...", 40, 1000);
- Bars();
- }
- }
- if (consume_item_num == "9")
- {
- if (item_arsenic_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_arsenic_amount > 0)
- {
- if (consume_item_num == "9")
- {
- consumable = item_restore_arsenic;
- Console.WriteLine();
- Utils.PrintMessage("Drinking a good ol' bottle of arsenic!", 15, 700);
- Console.WriteLine();
- playerhealth += consumable; ;
- Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
- playerhealth += item_restore_arsenic;
- consumable -= 1;
- Utils.PrintMessage("You're starting to feel nauseous", 30, 2000);
- Utils.PrintMessage("Everything's spinning...",50, 1500);
- Bars();
- }
- }
- if (consume_item_num == "10")
- {
- if (item_apple_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_apple_amount > 0)
- {
- if (consume_item_num == "10")
- {
- consumable = item_restore_apple;
- Console.WriteLine();
- Utils.PrintMessage("Apple tastes nice", 15, 700);
- Console.WriteLine();
- playerhealth += consumable;
- Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
- playerhealth += item_restore_apple;
- consumable -= 1;
- Utils.PrintMessage("Sweet!", 15, 1000);
- Bars();
- }
- }
- if (consume_item_num == "11")
- {
- if (item_steak_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_steak_amount > 0)
- {
- if (consume_item_num == "11")
- {
- consumable = item_restore_steak;
- Console.WriteLine();
- Utils.PrintMessage("100% vegan!", 15, 700);
- Console.WriteLine();
- playerhealth += consumable; ;
- Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
- base_damage += item_restore_steak;
- consumable -= 1;
- Utils.PrintMessage("lol, jk it's meat", 15, 1000);
- Bars();
- }
- }
- if (consume_item_num == "12")
- {
- if (item_insulin_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_insulin_amount > 0)
- {
- if (consume_item_num == "12")
- {
- consumable = item_restore_insulin;
- Console.WriteLine();
- Utils.PrintMessage("How does this even work?!", 15, 700);
- Console.WriteLine();
- playerhealth += consumable;
- Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
- playerhealth += item_restore_insulin;
- consumable -= 1;
- Utils.PrintMessage("You're not even a diabetic!", 15, 1000);
- Bars();
- }
- }
- if (consume_item_num == "13")
- {
- if (item_dirty_bandage_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_dirty_bandage_amount > 0)
- {
- if (consume_item_num == "13")
- {
- consumable = item_restore_dirty_bandage;
- Console.WriteLine();
- Utils.PrintMessage("", 15, 700);
- playerhealth += consumable; ;
- Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
- playerhealth += item_restore_dirty_bandage;
- consumable -= 1;
- Utils.PrintMessage("turns out it was a diaper not a bandage", 15, 1000);
- Bars();
- }
- }
- if (consume_item_num == "14")
- {
- if (item_protein_bar_amount < 0)
- {
- Utils.PrintMessage("You don't have that item!", 15, 300);
- Console.Clear();
- Useitem();
- }
- }
- if (item_protein_bar_amount> 0)
- {
- if (consume_item_num == "13")
- {
- consumable = item_restore_protein_bar;
- Console.WriteLine();
- Utils.PrintMessage("Muscles in minutes!", 15, 700);
- Console.WriteLine();
- playerhealth += consumable; ;
- Utils.PrintMessage("+ " + consumable + " Health", 15, 1000);
- base_damage += item_restore_protein_bar;
- consumable -= 1;
- Utils.PrintMessage("Yaay, you're ripped now", 15, 1000);
- Bars();
- }
- }
- if (consume_item_num == "0")
- {
- Console.Clear();
- Mug25();
- }
- if (playerhealth < 1)
- {
- Console.Clear();
- Deadscreen();
- }
- else
- {
- Console.Clear();
- }
- }
- public void Badthingshappen()
- {
- Console.Clear();
- Utils.PrintMessage("You're waiting in an alley, hope someone comes soon...", 15, 2000);
- Console.WriteLine();
- Utils.PrintMessage("You can hear someone coming from your right",15,1000);
- Console.WriteLine();
- Utils.PrintMessage("That someone is right in front of you now...", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("What will you do?", 15,300);
- Console.WriteLine();
- Utils.PrintMessage("[1] Let him slip, [2] Mug him",15,0);
- string slip_or_mug = Console.ReadLine();
- if (slip_or_mug == "1")
- {
- Console.WriteLine();
- Utils.PrintMessage("You'll be nice for now...", 15, 1000);
- Console.Clear();
- Badthingshappen();
- }
- if(slip_or_mug == "2")
- {
- Console.Clear();
- Console.WriteLine();
- Utils.PrintMessage("You apporoach him from behind and", 15, 400);
- Console.WriteLine();
- Utils.PrintMessage("You tell him to give you all his stuff",15,700);
- Console.Clear();
- }
- else
- {
- Badthingshappen();
- }
- }
- public void Sleepless()
- {
- Ready_to_attack = true;
- if (Ready_to_attack == true)
- {
- Mug25();
- }
- Utils.PrintMessage("What will you do now?", 15, 10);
- Console.WriteLine();
- Utils.PrintMessage(" (1) Go back to sleep, (2) Look around", 15, 100);
- Console.WriteLine();
- string choise1 = Console.ReadLine();
- if (choise1 == "1")
- {
- if (CanSleep == true)
- {
- Utils.PrintMessage("You go back to sleep...", 15, 300);
- Console.WriteLine();
- Console.Clear();
- for (int i = 0; i < 5; i++)
- {
- Console.Write("Sleeping");
- Utils.loading();
- }
- Utils.PrintMessage("You wake up from a bag of trash smashing your face.", 15, 200);
- Console.WriteLine();
- CanSleep = false;
- Sleepless();
- }
- else if (CanSleep == false)
- {
- for (int i = 0; i < 5; i++)
- {
- Console.Write("Attempting to get back to sleep");
- Utils.loading();
- }
- Utils.PrintMessage("Someone throws another bag of trash into your bin and you're filled with rage", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("What will you do?", 15, 300);
- Utils.PrintMessage(" (1) Try to sleep, (2) Mug him.", 15, 300);
- string sleep_or_kill = Console.ReadLine();
- if (sleep_or_kill == "1")
- {
- for (int i = 0; i < 5; i++)
- {
- Console.Write("Attempting to get back to sleep");
- Utils.loading();
- }
- Utils.PrintMessage("Another bag of trash smacs your face. The smell of rotting food fills your nose.", 15, 300);
- Console.WriteLine();
- Utils.PrintMessage("You have no choice but to mug him.", 15, 1000);
- Ready_to_attack = true;
- Sleepless();
- }
- if (sleep_or_kill == "2")
- {
- Ready_to_attack = true;
- Sleepless();
- }
- else
- {
- CanSleep = true;
- Sleepless();
- }
- }
- }
- if (choise1 == "2")
- {
- Look_around();
- }
- else
- {
- Utils.PrintMessage("", 15, 500);
- Console.Clear();
- Sleepless();
- }
- }
- public void enemyhealthbar()
- {
- Console.ForegroundColor = (ConsoleColor.Red);
- Console.SetCursorPosition(14, 0);
- Console.ForegroundColor = (ConsoleColor.Magenta);
- Console.WriteLine("Enemy Health: " + enemyhealth); // instead i can make a bar like bar() but for enemy health instead.
- Console.ForegroundColor = (ConsoleColor.White);
- }
- public void Mug25()
- {
- enemyweapon_string = "*stick*";
- user_weapon_string = "*fist*";
- user_weapon_stamina = 7;
- Bars();
- enemyhealthbar();
- Console.Clear();
- min_miss_chance = 1;
- max_miss_chance = 6;
- Random rng = new Random();
- for (int i = 1; i < enemyhealth;)
- {
- hitormissrandom = rng.Next(min_miss_chance, max_miss_chance);
- damage_taken = rng.Next(min_damage_taken, max_damage_taken);
- Bars();
- enemyhealthbar();
- Console.SetCursorPosition(0, 1);
- if (stamina - user_weapon_stamina < 0)
- {
- Utils.PrintMessage("You are out of stamina!", 15, 600);
- Console.Clear();
- itemlist();
- }
- if (hitormissrandom == 1)
- {
- Console.Clear();
- enemyhealthbar();
- Bars();
- Utils.PrintMessage("You attack the enemy with " + user_weapon_string, 15, 1000);
- Console.WriteLine();
- Utils.PrintMessage("But you missed! ", 15, 1000);
- Console.WriteLine();
- Utils.PrintMessage("Continue...", 15, 300);
- Console.ReadKey();
- stamina -= user_weapon_stamina;
- Bars();
- }
- else
- {
- Console.Clear();
- Bars();
- enemyhealthbar();
- Utils.PrintMessage("You attack the enemy with " + user_weapon_string, 15, 1000);
- enemyhealthbar();
- Console.WriteLine();
- Utils.PrintMessage("You hit and deal " + base_damage + " damage!", 15, 1000);
- enemyhealth = enemyhealth - base_damage;
- Console.WriteLine();
- enemyhealthbar();
- Console.SetCursorPosition(0, 3);
- Utils.PrintMessage("Continue...", 15, 300);
- Console.ReadKey();
- }
- if (enemyhealth < 1)
- {
- Console.Clear();
- Utils.PrintMessage("You killed the enemy!", 15, 1000);
- Console.WriteLine();
- int money_stolen = rng.Next(min_money_stolen, max_money_stolen);
- money = +money_stolen;
- Utils.PrintMessage("You stole " + money_stolen + "$ and aquired *stick* ", 15, 300);
- Bars();
- Console.SetCursorPosition(0, 2);
- Utils.PrintMessage("Continue...", 15, 300);
- Console.ReadKey();
- Bars();
- Random_Drop();
- }
- Console.Clear();
- enemyhealthbar();
- Bars();
- int randomstring2 = rng.Next(1, 2);
- Utils.PrintMessage("The enemy attacks with " + enemyweapon_string, 15, 1000);
- if (randomstring2 == 1)
- {
- enemyhealthbar();
- Bars();
- Console.WriteLine();
- playerhealth -= damage_taken;
- Utils.PrintMessage("He hits and deals " + damage_taken + " damage!", 15, 1000);
- damage_taken = rng.Next(min_damage_taken, max_damage_taken);
- Bars();
- Console.WriteLine();
- Console.WriteLine();
- Utils.PrintMessage("Continue...", 15, 300);
- Console.ReadKey();
- }
- else if (randomstring2 == 2)
- {
- Utils.PrintMessage("He missed!", 15, 1000);
- }
- if (ability_healing == true)
- {
- if (enemyhealth > playerhealth)
- playerhealth += 4;
- Bars();
- }
- }
- ///<Mug25 Todo>
- /// kan lägga till massa andra saker här som om man har vapen händer någonting.
- ///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
- ///kan även vara kommentarer till det. Istället för att skiva 1 eller 2 kan det vara slå eller sparka
- ///fiender kan även ha andra vapen på sig som man kan obtaina.
- }
- public void beer()
- {
- Utils.PrintMessage("You look around and see a bottle of beer", 15, 100);
- Console.WriteLine();
- Utils.PrintMessage("Will you drink it?", 15, 100);
- Console.WriteLine();
- Utils.PrintMessage("(1) yes, (2), No", 15, 100);
- Console.WriteLine();
- string drink_or_not = Console.ReadLine();
- if (drink_or_not == "1")
- {
- Utils.PrintMessage("you drink what's left of the beer and feel a little better", 15, 100);
- playerhealth += 15;
- }
- else if (drink_or_not == "2")
- {
- Utils.PrintMessage(" You save it for later", 15, 100);
- bool hasbeer = true;
- }
- else
- {
- beer();
- }
- }
- public void Deadscreen()
- {
- Console.Clear();
- Console.SetCursorPosition(Console.WindowWidth / 2 - 21/2, Console.WindowHeight/2);
- Console.ForegroundColor = ConsoleColor.DarkRed;
- Utils.PrintMessage("Y o u d i e d . . .", 50, 3000);
- Console.SetCursorPosition(Console.WindowWidth / 2 - 17/2, Console.WindowHeight / 2 +2);
- Console.ForegroundColor = ConsoleColor.DarkGray;
- Utils.PrintMessage("Play again? y/n",30,0);
- Console.SetCursorPosition(Console.WindowWidth / 2 / 2, Console.WindowHeight / 2 + 3);
- Console.ForegroundColor = ConsoleColor.White;
- string quit_or_replay = Console.ReadLine();
- Console.SetCursorPosition(0,0);
- if(quit_or_replay == "y")
- {
- Console.Clear();
- Game game = new Game();
- game.Start();
- }
- if(quit_or_replay == "n")
- {
- Console.ForegroundColor = ConsoleColor.White;
- Console.SetCursorPosition(Console.WindowWidth / 2 - 7 / 2, Console.WindowHeight / 2 + 3);
- Utils.PrintMessage("Exiting", 15, 0);
- for (int i = 0; i < 3; i++)
- {
- Console.SetCursorPosition(Console.WindowWidth / 2 / 2, Console.WindowHeight / 2 + 3);
- Console.Write("Exiting");
- Console.SetCursorPosition(Console.WindowWidth / 2 / 2 + 6, Console.WindowHeight / 2 + 3);
- Utils.loading();
- }
- Environment.Exit(0);
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.DarkBlue;
- Console.SetCursorPosition(Console.WindowWidth / 2 / 2, Console.WindowHeight / 2 + 3);
- Utils.PrintMessage("Exiting",15,0);
- for (int i = 0; i < 3; i++)
- {
- Utils.loading();
- }
- Environment.Exit(0);
- }
- }
- }
- }
- /*
- Om programmet någonsin strular kan man trycka på "Rebuild Solution" i Solution Explorer. ex om error meddelanden inte reagerar
- System.Threading.Thread.Sleep(100);
- Utils.PrintMessage("", 10, 1000); kan användas för att skriva långsam text
- break; avlutar metoden
- return; avslutar metoden
- Console.ForegroundColor = (ConsoleColor.Red); sätter texten till röd
- Console.SetCursorPosition(Console.WindowWidth/2 - message.Length/2, Console.WindowHeight/2); sätter texten på mitten av skärmen
- while (true) fortsätter till man använder break; kommandot
- Environment.Exit(0); avslutar programmet
- 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
- finns det /*blabla*\ som går över flera rader
- */
- /*
- private void Intro()
- {
- int x_pos = 10;
- int y_pos = 10;
- StringBuilder logoBlock = new StringBuilder();
- Console.SetCursorPosition(0, 0);
- Console.SetCursorPosition(x_pos, y_pos);
- logoBlock.AppendLine(" _ _ _ _ ");
- Console.SetCursorPosition(x_pos, y_pos);
- logoBlock.AppendLine(" _ |_|_| _ |_|_| ");
- Console.SetCursorPosition(x_pos, y_pos);
- logoBlock.AppendLine(" ___| |_ ___ ___ ___| |_ ___ ___ ");
- Console.SetCursorPosition(x_pos, y_pos);
- logoBlock.AppendLine(" | _| | . | . |_ | _| | . | . |");
- Console.SetCursorPosition(x_pos, y_pos);
- logoBlock.AppendLine(" |___|_|_|___| _| | |___|_|_|___| _|");
- Console.SetCursorPosition(x_pos, y_pos);
- logoBlock.AppendLine(" |_| |_| |_| ");
- for (int i = 0; i < 10; i++)
- {
- Console.SetCursorPosition(x_pos, y_pos);
- }
- string logoBlockStr = logoBlock.ToString();
- Console.Write(logoBlockStr);
- Thread.Sleep(1000);
- }
- string randomstring1 = random.ToString(); konverterar int int till string
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement