static void LevelUp(Player player) { Console.Clear(); ScreenWindows.DisplayGameScreen(); ScreenWindows.DisplayTextBoxPlayer(); Console.CursorVisible = false; Console.SetCursorPosition(44, 10); Console.Write("Health : " + player.MaxHealth); // left 54 for end || 57 for + 59 for health Console.SetCursorPosition(44, 12); Console.Write("Defense : " + player.Defense); // 55 for end, || 57 for + 59 for defense Console.SetCursorPosition(44, 14); Console.Write("Damage : " + player.Damage[1]); // left 54 for end || 57 for + 59 for damage //Options Health, Defense, Attack //These will be added to the max int health = 0; int defense = 0; int damage = 0; int pointsAvlb = 3; //------------------------------------- Random random = new Random(); int action; //Origin of tOb is unknown but now im calling it tOb as a reference to a tab. It works so shhhhh //Cursors current position int tOb = 10; //cursors last position int tObLast = 10; // Option Positions 28 : 17,18,19 ConsoleKeyInfo keyPress; bool optionSelected = false; Console.CursorVisible = true; action = 1; Console.SetCursorPosition(40, 10); Console.Write("->"); while (!optionSelected) { keyPress = Console.ReadKey(); //Movement for cursor tOb #region tOb movement if (keyPress.Key == ConsoleKey.UpArrow) { if (action == 2) { action--; tOb--; tOb--; } else if (action == 3) { action--; tOb--; tOb--; } Console.SetCursorPosition(40, tObLast); Console.Write(" "); Console.SetCursorPosition(40, tOb); Console.Write("->"); tObLast = tOb; } if (keyPress.Key == ConsoleKey.DownArrow) { if (action == 1) { action++; tOb++; tOb++; } else if (action == 2) { action++; tOb++; tOb++; } Console.SetCursorPosition(40, tObLast); Console.Write(" "); Console.SetCursorPosition(40, tOb); Console.Write("->"); tObLast = tOb; } #endregion if (keyPress.Key == ConsoleKey.RightArrow) { if (action == 1) { if (pointsAvlb > 0) { //57 for + 59 for health health++; pointsAvlb--; Console.SetCursorPosition(57, 10); Console.Write("+ " + health); } } if (action == 2) { if (pointsAvlb > 0) { defense++; pointsAvlb--; Console.SetCursorPosition(57, 12); Console.Write("+ " + defense); } } if (action == 3) { if (pointsAvlb > 0) { damage++; pointsAvlb--; Console.SetCursorPosition(57, 14); Console.Write("+ " + damage); } } } if (keyPress.Key == ConsoleKey.LeftArrow) { if (action == 1) { if (pointsAvlb >= 0 && health != 0) { health--; pointsAvlb++; Console.SetCursorPosition(57, 10); Console.Write("+ " + health); } else if (health <= 0) { Console.SetCursorPosition(57, 10); Console.Write(" "); } } if (action == 2) { if (pointsAvlb >= 0 && defense != 0) { defense--; pointsAvlb++; Console.SetCursorPosition(57, 12); Console.Write("+ " + defense); } else if (defense <= 0) { Console.SetCursorPosition(57, 12); Console.Write(" "); } } if (action == 3) { if (pointsAvlb >= 0 && damage != 0) { damage--; pointsAvlb++; Console.SetCursorPosition(57, 14); Console.Write("+ " + damage); } else if (damage <= 0) { Console.SetCursorPosition(57, 14); Console.Write(" "); } } } if (keyPress.Key == ConsoleKey.Enter) { optionSelected = true; } Console.SetCursorPosition(0, 0); Console.Write("health " + health + "| Defense " + defense + "| Damage " + damage + "| Points Available " + pointsAvlb); Console.SetCursorPosition(40, tObLast); } //applying the stat points to the player player.Health = player.Health + health; player.Defense = player.Defense + defense; player.Damage[1] = player.Damage[1] + damage; player.Damage[0] = player.Damage[0] + damage; }
//-----------------------------Slime PASSIVE------------------------------------- static void SlimePassive(Player player, Slime slime, Ally ally) { //Some setup ScreenWindows.DisplayGameScreen(); ScreenWindows.DisplayTextBoxPlayer(); ScreenWindows.SlimeAndChatColor(slime); ScreenWindows.DisplaySlime(slime); Random random = new Random(); int slimePassive = random.Next(1, 4); bool fight = false; //The chances to happen ScreenWindows.ClearPlayerTextBox(); if (slimePassive == 1) { Console.SetCursorPosition(27, 33); Console.Write("The slime slides around in a circle"); } else if (slimePassive == 2) { Console.SetCursorPosition(27, 33); Console.Write("The slime lunges at you but misses..."); Thread.Sleep(1000); Console.SetCursorPosition(27, 34); Console.Write("It seems to want to play"); Thread.Sleep(2000); } else if (slimePassive == 3) { Console.SetCursorPosition(27, 33); Console.Write("The slime jiggles it's body"); Thread.Sleep(1000); Console.SetCursorPosition(27, 34); Console.Write("It seems to be taunting you"); } else { } Thread.Sleep(2000); ScreenWindows.ClearPlayerTextBox(); Console.SetCursorPosition(27, 31); Console.Write("Would you like to fight the slime minding its own buisness?"); ConsoleKeyInfo keyPress; bool optionSelected = false; Console.CursorVisible = false; //Options Console.SetCursorPosition(33, 33); Console.Write("Yes"); Console.SetCursorPosition(33, 34); Console.Write("No"); ScreenWindows.DisplayTextBoxPlayer(); fight = true; Console.SetCursorPosition(29, 33); Console.Write("->"); int tOb = 33; int tObLast = 33; while (!optionSelected) { keyPress = Console.ReadKey(); if (keyPress.Key == ConsoleKey.UpArrow) { tOb = 33; Console.SetCursorPosition(29, tObLast); Console.Write(" "); Console.SetCursorPosition(29, tOb); Console.Write("-> "); fight = true; tObLast = tOb; } if (keyPress.Key == ConsoleKey.DownArrow) { tOb = 34; Console.SetCursorPosition(29, tObLast); Console.Write(" "); Console.SetCursorPosition(29, tOb); Console.Write("-> "); fight = false; tObLast = tOb; } if (keyPress.Key == ConsoleKey.Enter) { optionSelected = true; } } ScreenWindows.ClearPlayerTextBox(); Console.SetCursorPosition(27, 33); if (fight) { BattleLoop(player, slime, ally); } else if (!fight) { Console.Write("You continue on..."); } Thread.Sleep(2000); Console.ForegroundColor = ConsoleColor.Gray; }
//#------------------------------The actual game-------------------------- static int GameLoop(Player player, Slime slime, Ally ally) { ScreenWindows.DisplayTextBoxPlayer(); Random random = new Random(); int end = 2; Console.Clear(); ScreenWindows.DisplayGameScreen(); ScreenWindows.DisplayTextBoxPlayer(); int KingEncounter = 0; bool kingKilled = false; int nothing = 0; while ((player.Health > 0) && !kingKilled) { Thread.Sleep(1000); Console.SetCursorPosition(27, 32); Console.Write("You walk down a cave corridor..."); int slimechance = random.Next(1, 4); Console.SetCursorPosition(27, 33); Thread.Sleep(2000); if (slimechance == 1) { Console.Write("A slime Attacks!"); Thread.Sleep(1000); Slime.InitializeNewSlime(slime, ally); ScreenWindows.DisplaySlime(slime); BattleLoop(player, slime, ally); nothing = 0; } if (slimechance == 2) { Thread.Sleep(2000); Slime.InitializeNewSlime(slime, ally); Console.Write($"You have spotted a {slime.Color} slime minding its own buisness"); Thread.Sleep(1000); ScreenWindows.DisplaySlime(slime); SlimePassive(player, slime, ally); nothing = 0; } else if (slimechance == 3) { Console.Write("You got lucky and encountered no slimes"); Thread.Sleep(1000); nothing++; } else { Console.Write("Nothing happend and you move on"); nothing++; } if (nothing > 5) { Console.WriteLine("A slime dropped onto your head and suprized you"); BattleLoop(player, slime, ally); nothing = 0; } if (KingEncounter > 20) { ScreenWindows.ClearPlayerTextBox(); Console.SetCursorPosition(27, 33); Console.Write("You feel an intense presense up ahead"); for (int dot = 0; dot < 4; dot++) { Console.Write("."); Thread.Sleep(1000); } Console.SetCursorPosition(27, 34); Console.Write("You get a glimpse of a regal slime hiding behind"); Console.SetCursorPosition(27, 35); Console.Write("a nearby pillar... you enter the room filled with"); Console.SetCursorPosition(27, 36); Console.Write("a powerful presence."); ScreenWindows.DisplayContinuePrompt(103, 38); slime.KingSlime = true; Slime.InitializeNewSlime(slime, ally); BattleLoop(player, slime, ally); kingKilled = true; end = 3; } KingEncounter++; Thread.Sleep(2500); ScreenWindows.ClearPlayerTextBox(); Console.ForegroundColor = ConsoleColor.Gray; ScreenWindows.ClearSlime(); } return(end); }
//-----------------------------Player Menu------------------------------- static void Player(Player player, Slime slime, Ally ally) { Random random = new Random(); int damage = 1; // // PLAYER MENU // Console.Clear(); ScreenWindows.DisplayGameScreen(); ScreenWindows.DisplayTextBoxPlayer(); int action; Console.CursorVisible = true; Console.SetCursorPosition(29, 33); Console.Write($" 1 Attack"); Console.SetCursorPosition(50, 33); Console.Write($"{player.Name} : {player.Health}"); Console.SetCursorPosition(29, 34); Console.Write($" 2 Throw a stick"); Console.SetCursorPosition(50, 34); Console.Write($"Slime:{slime.Health}"); if (ally.Active) { Console.SetCursorPosition(29, 35); Console.WriteLine($" 3 Ally"); } Console.SetCursorPosition(34, 36); Console.WriteLine("Gold: " + player.Gold); Console.SetCursorPosition(34, 37); Console.WriteLine("Experience: " + player.Experience); int tOb = 33; int tObLast = 33; ConsoleKeyInfo keyPress; bool optionSelected = false; Console.CursorVisible = true; action = 1; Console.SetCursorPosition(26, 33); Console.Write("->"); while (!optionSelected) { keyPress = Console.ReadKey(); if (keyPress.Key == ConsoleKey.UpArrow) { if (action == 2) { action--; tOb--; } else if (action == 3) { action--; tOb--; } Console.SetCursorPosition(26, tObLast); Console.Write(" "); Console.SetCursorPosition(26, tOb); Console.Write("->"); tObLast = tOb; } if (keyPress.Key == ConsoleKey.DownArrow) { if (action == 1) { action++; tOb++; } if (ally.Active) { if (action == 2) { action++; tOb++; } } Console.SetCursorPosition(26, tObLast); Console.Write(" "); Console.SetCursorPosition(26, tOb); Console.Write("->"); tObLast = tOb; } if (keyPress.Key == ConsoleKey.Enter) { optionSelected = true; } Console.SetCursorPosition(26, tObLast); } // // END PLAYER MENU // Console.CursorVisible = false; ScreenWindows.ClearPlayerTextBox(); if (action == 1) { damage = random.Next(player.Damage[0], player.Damage[1]); //switch to visual effects (NOT DONE) Console.SetCursorPosition(27, 33); Console.Write($"You slash your sword at the slime and deal {damage} damage!"); Thread.Sleep(1000); slime.Health = slime.Health - damage; } else if (action == 2) { //switch to visual effects (NOT DONE) Console.SetCursorPosition(27, 33); Console.Write("You throw a stick at the slime for no reason..."); Console.SetCursorPosition(27, 33); Console.Write("It did nothing..."); Thread.Sleep(1000); } else if (action == 3) { int healAmt = random.Next(2, 10); player.Health = player.Health + healAmt; Console.SetCursorPosition(27, 33); Console.Write($"You let {ally.Name} heal you."); Console.SetCursorPosition(27, 34); Console.Write($"You healed for {healAmt} health!"); } }