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;
- namespace PlayerMonsterSpajanje
- {
- class Program
- {
- public static ConsoleColor boja;
- public static string monsterChoice;
- public static string monsterChoice1;
- public static string monsterChoice2;
- public static string monsterChoice3;
- public static string monsterChoice4;
- static int monsterRandom;
- static void Main(string[] args)
- {
- Console.WriteLine("What is the name of your Hero?");
- Player playa = new Player();
- Console.WriteLine("You choose to be" + playa.race + " named " + playa.name + "!" );
- Console.Write("Your Attack is " + playa.attack + ", your Defense is " + playa.defense + ", you have " );
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP! \n \n ");
- Monsta daMonsta = new Monsta();
- Console.WriteLine("Your enemy is " + daMonsta.Race + "" + daMonsta.Class + "!");
- Item daItem = new Item();
- Armor daArmor = new Armor();
- Console.Write("His Attack is " + daItem.MaxDamage + ", his Defense is " + daArmor.armorDef + ", he has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP! \n \n ");
- Console.WriteLine("Hope you win!");
- while (daMonsta.monsterHP >= 1)
- {
- Console.WriteLine("Choose 5 of your next actions!");
- Console.WriteLine("Press A for attack, or D for defense");
- var actionChoice = Console.ReadKey();
- if (actionChoice.Key == ConsoleKey.A)
- Console.WriteLine(" = Attack");
- if (actionChoice.Key == ConsoleKey.D)
- Console.WriteLine(" = Defense");
- var actionChoice1 = Console.ReadKey();
- if (actionChoice1.Key == ConsoleKey.A)
- Console.WriteLine(" = Attack");
- if (actionChoice1.Key == ConsoleKey.D)
- Console.WriteLine(" = Defense");
- var actionChoice2 = Console.ReadKey();
- if (actionChoice2.Key == ConsoleKey.A)
- Console.WriteLine(" = Attack");
- if (actionChoice2.Key == ConsoleKey.D)
- Console.WriteLine(" = Defense");
- var actionChoice3 = Console.ReadKey();
- if (actionChoice3.Key == ConsoleKey.A)
- Console.WriteLine(" = Attack");
- if (actionChoice3.Key == ConsoleKey.D)
- Console.WriteLine(" = Defense");
- var actionChoice4 = Console.ReadKey();
- if (actionChoice4.Key == ConsoleKey.A)
- Console.WriteLine(" = Attack \n ");
- if (actionChoice4.Key == ConsoleKey.D)
- Console.WriteLine(" = Defense \n ");
- Console.WriteLine("The monster chooses...");
- monsterRandom = Monsta.gener.Next(1, 10);
- if (monsterRandom >= 1 && monsterRandom < 3)
- monsterChoice = "Attack";
- if (monsterRandom >= 3 && monsterRandom < 5)
- monsterChoice = "Defense";
- if (monsterRandom >= 5 && monsterRandom < 8)
- monsterChoice = "Attack";
- if (monsterRandom >= 8 && monsterRandom < 10)
- monsterChoice = "Defense";
- monsterRandom = Monsta.gener.Next(1, 10);
- if (monsterRandom >= 1 && monsterRandom < 3)
- monsterChoice1 = "Attack";
- if (monsterRandom >= 3 && monsterRandom < 5)
- monsterChoice1 = "Defense";
- if (monsterRandom >= 5 && monsterRandom < 8)
- monsterChoice1 = "Attack";
- if (monsterRandom >= 8 && monsterRandom < 10)
- monsterChoice1 = "Defense";
- monsterRandom = Monsta.gener.Next(1, 10);
- if (monsterRandom >= 1 && monsterRandom < 3)
- monsterChoice2 = "Attack";
- if (monsterRandom >= 3 && monsterRandom < 5)
- monsterChoice2 = "Defense";
- if (monsterRandom >= 5 && monsterRandom < 8)
- monsterChoice2 = "Attack";
- if (monsterRandom >= 8 && monsterRandom < 10)
- monsterChoice2 = "Defense";
- monsterRandom = Monsta.gener.Next(1, 10);
- if (monsterRandom >= 1 && monsterRandom < 3)
- monsterChoice3 = "Attack";
- if (monsterRandom >= 3 && monsterRandom < 5)
- monsterChoice3 = "Defense";
- if (monsterRandom >= 5 && monsterRandom < 8)
- monsterChoice3 = "Attack";
- if (monsterRandom >= 8 && monsterRandom < 10)
- monsterChoice3 = "Defense";
- monsterRandom = Monsta.gener.Next(1, 10);
- if (monsterRandom >= 1 && monsterRandom < 3)
- monsterChoice4 = "Attack \n ";
- if (monsterRandom >= 3 && monsterRandom < 5)
- monsterChoice4 = "Defense \n ";
- if (monsterRandom >= 5 && monsterRandom < 8)
- monsterChoice4 = "Attack \n ";
- if (monsterRandom >= 8 && monsterRandom < 10)
- monsterChoice4 = "Defense \n ";
- Console.WriteLine(monsterChoice);
- Console.WriteLine(monsterChoice1);
- Console.WriteLine(monsterChoice2);
- Console.WriteLine(monsterChoice3);
- Console.WriteLine(monsterChoice4, " \n ");
- if (actionChoice.Key == ConsoleKey.A && monsterChoice == "Attack")
- {
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("You swing and hit each other, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice.Key == ConsoleKey.A && monsterChoice == "Defense")
- {
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- Console.Write("You swing and hit the monster, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice.Key == ConsoleKey.D && monsterChoice == "Attack")
- {
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("The monster swings and hits you, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice.Key == ConsoleKey.D && monsterChoice == "Defense")
- {
- Console.Write("You slam your shields together, no one takes damage, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left, your enemy has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- if (actionChoice1.Key == ConsoleKey.A && monsterChoice1 == "Attack")
- {
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("You swing and hit each other, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice1.Key == ConsoleKey.A && monsterChoice1 == "Defense")
- {
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- Console.Write("You swing and hit the monster, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice1.Key == ConsoleKey.D && monsterChoice1 == "Attack")
- {
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("The monster swings and hits you, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice1.Key == ConsoleKey.D && monsterChoice1 == "Defense")
- {
- Console.Write("You slam your shields together, no one takes damage, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left, your enemy has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- if (actionChoice2.Key == ConsoleKey.A && monsterChoice2 == "Attack")
- {
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("You swing and hit each other, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice2.Key == ConsoleKey.A && monsterChoice2 == "Defense")
- {
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- Console.Write("You swing and hit the monster, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice2.Key == ConsoleKey.D && monsterChoice2 == "Attack")
- {
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("The monster swings and hits you, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice2.Key == ConsoleKey.D && monsterChoice2 == "Defense")
- {
- Console.Write("You slam your shields together, no one takes damage, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left, your enemy has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- if (actionChoice3.Key == ConsoleKey.A && monsterChoice3 == "Attack")
- {
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("You swing and hit each other, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice3.Key == ConsoleKey.A && monsterChoice3 == "Defense")
- {
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- Console.Write("You swing and hit the monster, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice3.Key == ConsoleKey.D && monsterChoice3 == "Attack")
- {
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("The monster swings and hits you, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice3.Key == ConsoleKey.D && monsterChoice3 == "Defense")
- {
- Console.WriteLine("You slam your shields together, no one takes damage, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left, your enemy has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- if (actionChoice3.Key == ConsoleKey.A && monsterChoice3 == "Attack")
- {
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("You swing and hit each other, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice3.Key == ConsoleKey.A && monsterChoice3 == "Defense")
- {
- daMonsta.monsterHP = daMonsta.monsterHP - playa.attack;
- Console.Write("You swing and hit the monster, the monster has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice3.Key == ConsoleKey.D && monsterChoice3 == "Attack")
- {
- playa.currentHP = playa.currentHP - daItem.MaxDamage;
- Console.Write("The monster swings and hits you, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (actionChoice3.Key == ConsoleKey.D && monsterChoice3 == "Defense")
- {
- Console.Write("You slam your shields together, no one takes damage, you have ");
- if (playa.currentHP >= 0 && playa.currentHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (playa.currentHP >= 7 && playa.currentHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (playa.currentHP >= 14 && playa.currentHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + playa.currentHP + "");
- Console.ResetColor();
- Console.Write(" HP left, your enemy has ");
- if (daMonsta.monsterHP >= 0 && daMonsta.monsterHP < 7)
- {
- boja = ConsoleColor.Red;
- }
- if (daMonsta.monsterHP >= 7 && daMonsta.monsterHP < 14)
- {
- boja = ConsoleColor.Yellow;
- }
- if (daMonsta.monsterHP >= 14 && daMonsta.monsterHP <= 20)
- {
- boja = ConsoleColor.Green;
- }
- Console.ForegroundColor = boja;
- Console.Write("" + daMonsta.monsterHP + "");
- Console.ResetColor();
- Console.Write(" HP left! \n ");
- }
- if (daMonsta.monsterHP <= 0 || playa.currentHP <= 0)
- {
- break;
- }
- }
- if (daMonsta.monsterHP <= 0)
- {
- Console.WriteLine("You killed the monster, good job! \n ");
- }
- else if (playa.currentHP <= 0)
- {
- Console.WriteLine("The monster killed you, go in the corner and be ashamed of yourself... \n ");
- }
- Console.ReadKey();
- }
- }
- }
- class Player
- {
- public Player()
- {
- charName();
- RaceChoice();
- playerAttack();
- playerDefense();
- playerCurrentHP();
- playerMaxHP();
- }
- public string name;
- public int raceChoice;
- public string race;
- public int attack;
- public int defense;
- public int currentHP;
- public int maxHP;
- private void charName()
- {
- name = Console.ReadLine();
- }
- private void RaceChoice()
- {
- Console.WriteLine("Which race is your Hero going to be : [1] Human ");
- Console.WriteLine(" [2] Elf ");
- Console.WriteLine(" [3] Dwarf ");
- Console.WriteLine(" [4] Orc");
- raceChoice = int.Parse(Console.ReadLine());
- if (raceChoice == 1)
- race = " Human";
- if (raceChoice == 2)
- race = " Elf";
- if (raceChoice == 3)
- race = " Dwarf";
- if (raceChoice == 4)
- race = " Orc";
- }
- private void playerAttack()
- {
- if (race == " Human")
- attack = 3;
- if (race == " Elf")
- attack = 2;
- if (race == " Dwarf")
- attack = 3;
- if (race == " Orc")
- attack = 4;
- }
- private void playerDefense()
- {
- if (race == " Human")
- {
- defense = 2;
- }
- if (race == " Elf")
- {
- defense = 1;
- }
- if (race == " Dwarf")
- {
- defense = 3;
- }
- if (race == " Orc")
- {
- defense = 3;
- }
- }
- private void playerCurrentHP()
- {
- if (race == " Human")
- {
- currentHP = 20;
- }
- if (race == " Elf")
- {
- currentHP = 20;
- }
- if (race == " Dwarf")
- {
- currentHP = 20;
- }
- if (race == " Orc")
- {
- currentHP = 20;
- }
- }
- private void playerMaxHP()
- {
- if (race == " Human")
- {
- maxHP = 20;
- }
- if (race == " Elf")
- {
- maxHP = 20;
- }
- if (race == " Dwarf")
- {
- maxHP = 20;
- }
- if (race == " Orc")
- {
- maxHP = 20;
- }
- }
- }
- /* Monsta daMonsta = new Monsta();
- Item forMonsta = new Item();
- Armor defMonsta = new Armor();
- Console.WriteLine(daMonsta.Race + "" + daMonsta.Class + "" + " has " + forMonsta.Rarity + " " + forMonsta.Type + "" + " with damage (" + forMonsta.MinDamage + " - " + forMonsta.MaxDamage + ") " + "wearing" + defMonsta.armorType + "" + " with def. rating of " + defMonsta.armorDef + "!");
- if (forMonsta.Rarity == "Common")
- Console.ForegroundColor = ConsoleColor.White;
- if (forMonsta.Rarity == "Uncommon")
- Console.ForegroundColor = ConsoleColor.Green;
- if (forMonsta.Rarity == "Rare")
- Console.ForegroundColor = ConsoleColor.Blue;
- if (forMonsta.Rarity == "Epic")
- Console.ForegroundColor = ConsoleColor.DarkMagenta;
- if (forMonsta.Rarity == "Legendary")
- Console.ForegroundColor = ConsoleColor.Yellow;
- }
- }
- }
- static void GetInput()
- {
- Console.WriteLine("How much monsters do you want to summon? ");
- PlayerChoice = int.Parse(Console.ReadLine());
- Console.Clear();
- } */
- class Monsta
- {
- public static Random gener = new Random();
- public string Race;
- public string Class;
- public int monsterHP;
- public int curentMonsHP;
- public Monsta()
- {
- GenerateRace();
- GenerateClass();
- MonsterHP();
- MonsterCurrentHP();
- }
- private void GenerateRace()
- {
- int _race = gener.Next(1, 340);
- if (_race >= 1 && _race < 30)
- Race = "Gnome";
- if (_race >= 30 && _race < 60)
- Race = "Gremlin";
- if (_race >= 60 && _race < 90)
- Race = "Imp";
- if (_race >= 90 && _race < 120)
- Race = "Kobold";
- if (_race >= 120 && _race < 150)
- Race = "Incubus";
- if (_race >= 150 && _race < 165)
- Race = "Succubus";
- if (_race >= 165 && _race < 180)
- Race = "Goblin";
- if (_race >= 180 && _race < 195)
- Race = "Gorgon";
- if (_race >= 195 && _race < 205)
- Race = "Lamia";
- if (_race >= 205 && _race < 215)
- Race = "Troll";
- if (_race >= 215 && _race < 225)
- Race = "Siren";
- if (_race >= 225 && _race < 235)
- Race = "Ogre";
- if (_race >= 235 && _race < 245)
- Race = "Orc";
- if (_race >= 245 && _race < 249)
- Race = "Ent";
- if (_race >= 249 && _race < 259)
- Race = "Dryad";
- if (_race >= 259 && _race < 275)
- Race = "Rusalka";
- if (_race >= 275 && _race < 295)
- Race = "Ghoul";
- if (_race >= 295 && _race < 310)
- Race = "Gargoyle";
- if (_race >= 310 && _race < 315)
- Race = "Hydra";
- if (_race >= 315 && _race < 322)
- Race = "Demons";
- if (_race >= 322 && _race < 330)
- Race = "Werewolf";
- if (_race >= 330 && _race < 336)
- Race = "Vampire";
- if (_race >= 336 && _race < 339)
- Race = "Dragonling";
- if (_race >= 339 && _race < 340)
- Race = "Dragon";
- }
- private void GenerateClass()
- {
- int _class = gener.Next(1, 100);
- if (_class >= 1 && _class <= 9)
- Class = " Rogue";
- if (_class >= 9 && _class <= 18)
- Class = " Warrior";
- if (_class >= 18 && _class <= 25)
- Class = " Paladin";
- if (_class >= 25 && _class <= 45)
- Class = " Hunter";
- if (_class >= 45 && _class <= 55)
- Class = " Priest";
- if (_class >= 55 && _class <= 61)
- Class = " Mage";
- if (_class >= 61 && _class <= 67)
- Class = " Summoner";
- if (_class >= 67 && _class <= 71)
- Class = " Necromancer";
- if (_class >= 71 && _class <= 76)
- Class = " Knight";
- if (_class >= 76 && _class <= 99)
- Class = " Peasant";
- if (_class == 100)
- Class = " Vegan Feminist Progressive Hipster";
- }
- private void MonsterHP()
- {
- if (Race == "Gnome")
- {
- monsterHP = 10;
- }
- if (Race == "Gremlin")
- {
- monsterHP = 10;
- }
- if (Race == "Imp")
- {
- monsterHP = 10;
- }
- if (Race == "Kobold")
- {
- monsterHP = 10;
- }
- if (Race == "Incubus")
- {
- monsterHP = 12;
- }
- if (Race == "Succubus")
- {
- monsterHP = 12;
- }
- if (Race == "Goblin")
- {
- monsterHP = 13;
- }
- if (Race == "Gorgon")
- {
- monsterHP = 13;
- }
- if (Race == "Lamia")
- {
- monsterHP = 14;
- }
- if (Race == "Troll")
- {
- monsterHP = 14;
- }
- if (Race == "Siren")
- {
- monsterHP = 15;
- }
- if (Race == "Ogre")
- {
- monsterHP = 15;
- }
- if (Race == "Orc")
- {
- monsterHP = 14;
- }
- if (Race == "Ent")
- {
- monsterHP = 20;
- }
- if (Race == "Dryad")
- {
- monsterHP = 16;
- }
- if (Race == "Rusalka")
- {
- monsterHP = 16;
- }
- if (Race == "Ghoul")
- {
- monsterHP = 17;
- }
- if (Race == "Gargoyle")
- {
- monsterHP = 16;
- }
- if (Race == "Hydra")
- {
- monsterHP = 18;
- }
- if (Race == "Demon")
- {
- monsterHP = 20;
- }
- if (Race == "Werewolf")
- {
- monsterHP = 16;
- }
- if (Race == "Vampire")
- {
- monsterHP = 15;
- }
- if (Race == "Dragonling")
- {
- monsterHP = 19;
- }
- if (Race == "Dragon")
- {
- monsterHP = 20;
- }
- }
- private void MonsterCurrentHP()
- {
- if (Race == "Gnome")
- {
- curentMonsHP = 10;
- }
- if (Race == "Gremlin")
- {
- curentMonsHP = 10;
- }
- if (Race == "Imp")
- {
- curentMonsHP = 10;
- }
- if (Race == "Kobold")
- {
- curentMonsHP = 10;
- }
- if (Race == "Incubus")
- {
- curentMonsHP = 12;
- }
- if (Race == "Succubus")
- {
- curentMonsHP = 12;
- }
- if (Race == "Goblin")
- {
- curentMonsHP = 13;
- }
- if (Race == "Gorgon")
- {
- curentMonsHP = 13;
- }
- if (Race == "Lamia")
- {
- curentMonsHP = 14;
- }
- if (Race == "Troll")
- {
- curentMonsHP = 14;
- }
- if (Race == "Siren")
- {
- curentMonsHP = 15;
- }
- if (Race == "Ogre")
- {
- curentMonsHP = 15;
- }
- if (Race == "Orc")
- {
- curentMonsHP = 14;
- }
- if (Race == "Ent")
- {
- curentMonsHP = 20;
- }
- if (Race == "Dryad")
- {
- curentMonsHP = 16;
- }
- if (Race == "Rusalka")
- {
- curentMonsHP = 16;
- }
- if (Race == "Ghoul")
- {
- curentMonsHP = 17;
- }
- if (Race == "Gargoyle")
- {
- curentMonsHP = 16;
- }
- if (Race == "Hydra")
- {
- curentMonsHP = 18;
- }
- if (Race == "Demon")
- {
- curentMonsHP = 20;
- }
- if (Race == "Werewolf")
- {
- curentMonsHP = 16;
- }
- if (Race == "Vampire")
- {
- curentMonsHP = 15;
- }
- if (Race == "Dragonling")
- {
- curentMonsHP = 19;
- }
- if (Race == "Dragon")
- {
- curentMonsHP = 20;
- }
- }
- }
- class Item
- {
- private static Random _randomGenarator = new Random();
- public Item()
- {
- GenerateType();
- GenerateRarity();
- GenerateMinDamage();
- GenerateMaxDamage();
- GenerateValue();
- }
- public string Type;
- public string Rarity;
- public int MinDamage;
- public int MaxDamage;
- public int Value;
- private void GenerateType()
- {
- int _type = _randomGenarator.Next(1, 11);
- if (_type == 1)
- this.Type = "Sword";
- if (_type == 2)
- this.Type = "Flail";
- if (_type == 3)
- this.Type = "Bow";
- if (_type == 4)
- this.Type = "Mace";
- if (_type == 5)
- this.Type = "Spear";
- if (_type == 6)
- this.Type = "Axe";
- if (_type == 7)
- this.Type = "Dagger";
- if (_type == 8)
- this.Type = "Whip";
- if (_type == 9)
- this.Type = "Warhammer";
- if (_type == 10)
- this.Type = "Glaive";
- }
- private void GenerateRarity()
- {
- int rarityIndex = _randomGenarator.Next(1, 1001);
- if (rarityIndex >= 1 && rarityIndex < 800)
- {
- this.Rarity = "Common";
- }
- if (rarityIndex >= 800 && rarityIndex < 920)
- {
- this.Rarity = "Uncommon";
- }
- if (rarityIndex >= 920 && rarityIndex < 985)
- {
- this.Rarity = "Rare";
- }
- if (rarityIndex >= 985 && rarityIndex < 997)
- {
- this.Rarity = "Epic";
- }
- if (rarityIndex >= 997 && rarityIndex <= 1000)
- {
- this.Rarity = "Legendary";
- }
- }
- private void GenerateMinDamage()
- {
- if (this.Rarity == "Common")
- {
- this.MinDamage = _randomGenarator.Next(1, 3);
- }
- if (this.Rarity == "Uncommon")
- {
- this.MinDamage = _randomGenarator.Next(2, 5);
- }
- if (this.Rarity == "Rare")
- {
- this.MinDamage = _randomGenarator.Next(3, 7);
- }
- if (this.Rarity == "Epic")
- {
- this.MinDamage = _randomGenarator.Next(5, 11);
- }
- if (this.Rarity == "Legendary")
- {
- this.MinDamage = _randomGenarator.Next(7, 14);
- }
- }
- private void GenerateMaxDamage()
- {
- if (this.Rarity == "Common")
- {
- this.MaxDamage = _randomGenarator.Next(2, 4);
- }
- if (this.Rarity == "Uncommon")
- {
- this.MaxDamage = _randomGenarator.Next(3, 6);
- }
- if (this.Rarity == "Rare")
- {
- this.MaxDamage = _randomGenarator.Next(5, 10);
- }
- if (this.Rarity == "Epic")
- {
- this.MaxDamage = _randomGenarator.Next(7, 13);
- }
- if (this.Rarity == "Legendary")
- {
- this.MaxDamage = _randomGenarator.Next(11, 17);
- }
- }
- private void GenerateValue()
- {
- if (this.Rarity == "Common")
- {
- this.Value = 5 + _randomGenarator.Next(1, 25);
- }
- if (this.Rarity == "Uncommon")
- {
- this.Value = 30 + _randomGenarator.Next(1, 70);
- }
- if (this.Rarity == "Rare")
- {
- this.Value = 100 + _randomGenarator.Next(1, 100);
- }
- if (this.Rarity == "Epic")
- {
- this.Value = 200 + _randomGenarator.Next(1, 800);
- }
- if (this.Rarity == "Legendary")
- {
- this.Value = 1000 + _randomGenarator.Next(1, 1001);
- }
- }
- }
- class Armor
- {
- private static Random gener = new Random();
- public Armor()
- {
- GenArmorType();
- GenArmorDef();
- }
- public string armorType;
- public int armorDef;
- private void GenArmorType()
- {
- int armorIndex = gener.Next(1, 101);
- if (armorIndex >= 1 && armorIndex <= 40)
- {
- armorType = " Leather Armor";
- }
- if (armorIndex >= 40 && armorIndex <= 68)
- {
- armorType = " Std. Leather Armor";
- }
- if (armorIndex >= 68 && armorIndex <= 83)
- {
- armorType = " Scale Armor";
- }
- if (armorIndex >= 83 && armorIndex <= 93)
- {
- armorType = " Mail Armor";
- }
- if (armorIndex >= 93 && armorIndex <= 98)
- {
- armorType = " Plate Armor";
- }
- if (armorIndex >= 98 && armorIndex <= 100)
- {
- armorType = " Full Plate Armor";
- }
- }
- private void GenArmorDef()
- {
- if (armorType == " Leather Armor")
- {
- this.armorDef = gener.Next(1, 2);
- }
- if (armorType == " Std.Leather Armor")
- {
- armorDef = gener.Next(3, 4);
- }
- if (armorType == " Scale Armor")
- {
- armorDef = gener.Next(7, 8);
- }
- if (armorType == " Mail Armor")
- {
- armorDef = gener.Next(9, 10);
- }
- if (armorType == " Plate Armor")
- {
- armorDef = gener.Next(12, 13);
- }
- if (armorType == " Full Plate Armor")
- {
- armorDef = gener.Next(19, 20);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement