public static void Fight(GameData.Character enemycharac, string[] words) { words = _words; enemycharac = _enemy; switch (words[0]) { case "f": case "fight": enemycharac._lifepoints = (float)(Math.Round((enemycharac._lifepoints - GameData.characters["Godess of the forest"]._hitpoints), 2)); if (enemycharac._lifepoints > 0F) { Console.WriteLine("Woooo!!!" + Environment.NewLine + "Damn! The " + enemycharac._name + "'s still alive...He still has got " + enemycharac._lifepoints + " lifepoints."); GameData.characters["Godess of the forest"]._lifepoints = (float)(Math.Round((GameData.characters["Godess of the forest"]._lifepoints - enemycharac._hitpoints), 2)); if (GameData.characters["Godess of the forest"]._lifepoints > 0F) { Console.WriteLine("Oouuuch! Augh!!! Oh, you dirty creature! I'm gonna finish you on the spot!" + Environment.NewLine + "You've got " + GameData.characters["Godess of the forest"]._lifepoints + " lifepoints left. Fight him 'till the end!"); CheckCases(); } else { Console.WriteLine("NOOOOOOOO! How could you! Now you're dead! Stupid! Loser! Try this game again..."); //quitgame(); } } else { Console.WriteLine("Wahhh! Nooo!!!" + Environment.NewLine + "Congratulations, great adventurer! You slayed the " + enemycharac._name + "! Awesome!"); isFightCase = false; enemycharac._lifepoints = 1F; } break; default: Console.WriteLine("Ohhh little one! You're far too slow for this. It's kind of impossible..."); GameData.characters["Godess of the forest"]._lifepoints = (float)(Math.Round((GameData.characters["Godess of the forest"]._lifepoints - enemycharac._hitpoints), 2)); if (GameData.characters["Godess of the forest"]._lifepoints > 0F) { Console.WriteLine("Oouuuch! Augh!!! Oh, you dirty creature! I'm gonna finish you on the spot!" + Environment.NewLine + "You've got " + GameData.characters["Godess of the forest"]._lifepoints + " lifepoints left. Fight him 'till the end!"); Console.WriteLine("You can't fight like this! Try another input. Valid inputs are: [fight/f] [arm/a <item>] [use/u <item>] [inventory/i] and [quit/q]"); CheckCases(); } else { Console.WriteLine("NOOOOOOOO! How could you! Now you're dead! Stupid! Loser! Try this game again..."); //quitgame(); } break; } }
public static void CheckEnemy() { foreach (var charac in GameData.characters.Values) { if (charac._currentLocation == AvatarCurrentLocation) { string name = charac._name; switch (name) { case "Golem": _enemy = charac; isFightCase = true; Console.WriteLine("There's an enemy! You're getting attacked." + Environment.NewLine + "Fight him!"); CheckCases(); CheckCases(); break; case "King of death": _enemy = charac; isFightCase = true; Console.WriteLine("There's a pressuring killing intent..." + Environment.NewLine + "Before you stands the King of death! Defeat him to complete the mission and free the spirits of the tyranny!"); CheckCases(); //quitgame(); break; case "Dragon of the sea": Talk(); CheckCases(); break; default: CheckCases(); break; } } } }