static void Main(string[] args) { /* * iDice d20 = new D20(); * Console.Write("Please enter number of D20 to roll:"); * int count = Convert.ToInt32(Console.ReadLine()); * Console.WriteLine(); * Console.WriteLine("Rolling {0} d20...", count); * for (int i = 0; i < count; i++) * Console.WriteLine(d20.Roll());*/ iCharacter player = Helper.Helper.Creator(); Random rnd = new Random(); rnd.Next(); int[] stats = new int[6]; stats[0] = 15; stats[1] = 13; stats[2] = 14; stats[3] = 10; stats[4] = 12; stats[5] = 8; iCharacter enemy = new Orc(Helper.Helper.Random_Name(rnd), "", stats, new Axe(), new Chain(), new Attack(), new Block(), new Evade()); enemy.title = Helper.Helper.Title(rnd); iCharacter[] characters = new iCharacter[2]; characters[0] = player; characters[1] = enemy; Battle battle = new Battle(characters); Console.Write("Hit Enter to exit..."); Console.ReadLine(); }
public void Debuff(Orc orc) { mana -= costD; durationD = 2; if (durationD > 0) { orc.attack -= debuff; } Console.WriteLine("{0} used Debuff for {1} mana and debuffed the Orc for {2} rounds.", name, costD, durationD); }
public void Stun(Orc orc) { mana -= costS; durationS = 3; if (durationS > 0) { orc.can_attack = false; } Console.WriteLine("{0} used Stun for {1} mana and disabled the Orc for {2} rounds.", name, costS, durationS); }
static void Main(string[] args) { var character = new Orc("Saman", new Vector2D(0, 0)); var levelGenerator = new LevelGenerator(40, 15, character); Level level = levelGenerator.GetNext(); while (true) { level.DrawMap(); ConsoleKey key = Console.ReadKey().Key; switch (key) { case ConsoleKey.UpArrow: character.Move(Character.Character.Direction.Up, level); break; case ConsoleKey.DownArrow: character.Move(Character.Character.Direction.Down, level); break; case ConsoleKey.LeftArrow: character.Move(Character.Character.Direction.Left, level); break; case ConsoleKey.RightArrow: character.Move(Character.Character.Direction.Right, level); break; default: continue; } } }
static void Main(string[] args) { Console.Write("Player Name: "); Player player = new Player(Console.ReadLine()); Orc orc = new Orc(); bool end = false; // Preparations: bool stun_active = false; bool debuff_active = false; while (end == false) { // Player Move: Fail: Console.Write(">"); string command = Console.ReadLine(); if (command.ToLower() == "attack") { player.Attack(orc); PlayerAttackSound(); Thread.Sleep(2000); } else if (command.ToLower() == "fireball") { if (player.mana - player.costF >= 0) { player.Fireball(orc); PlayerFireballSound(); Thread.Sleep(2000); } else { Console.WriteLine("{0} failed Fireball spell due to lack of mana.", player.name); Thread.Sleep(2000); } } else if (command.ToLower() == "might") { if (player.mana - player.costM >= 0) { player.Might(); PlayerMightSound(); Thread.Sleep(2000); } else { Console.WriteLine("{0} failed Might spell due to lack of mana.", player.name); Thread.Sleep(2000); } } else if (command.ToLower() == "stun") { if (player.mana - player.costS >= 0) { player.Stun(orc); stun_active = true; PlayerStunSound(); Thread.Sleep(2000); } else { Console.WriteLine("{0} failed Stun spell due to lack of mana.", player.name); Thread.Sleep(2000); } } else if (command.ToLower() == "debuff") { if (player.mana - player.costD >= 0) { player.Debuff(orc); debuff_active = true; PlayerDebuffSound(); Thread.Sleep(2000); } else { Console.WriteLine("{0} failed Debuff spell due to lack of mana.", player.name); Thread.Sleep(2000); } } else if (command.ToLower() == "health potion") { if (player.healthPotions > 0) { player.HealthPotion(); player.healthPotions--; PlayerPotionSound(); Thread.Sleep(2000); } else { Console.WriteLine("{0} failed to drink health potion due to lack of such an item.", player.name); Thread.Sleep(2000); } } else if (command.ToLower() == "mana potion") { if (player.manaPotions > 0) { player.ManaPotion(); player.manaPotions--; PlayerPotionSound(); Thread.Sleep(2000); } else { Console.WriteLine("{0} failed to drink mana potion due to lack of such an item.", player.name); Thread.Sleep(2000); } } else if (command.ToLower() == "stats") { // Stats: Console.WriteLine("{0}: HP = {1}, ATK = {2}, MP = {3}", player.name, player.health, player.attack, player.mana); Console.WriteLine("Orc: HP = {0}, ATK = {1}, MP = {2}", orc.health, orc.attack, orc.mana); Console.WriteLine(new string('-', 25)); goto Fail; } else if (command.ToLower() == "rules") { // Open "Game Rules.txt" file: ReadRules(); PlayRulesSound(); Console.WriteLine(new string('-', 25)); goto Fail; } else { Console.WriteLine("Unknown command, try again!"); Console.WriteLine(new string('-', 25)); goto Fail; } // Extra effects from spells: if (debuff_active == true && player.durationD > 0) { player.durationD--; } else { debuff_active = false; orc.attack = 20; } if (stun_active == true && player.durationS > 0) { player.durationS--; } else { stun_active = false; orc.can_attack = true; } // Orc Move: orc.Attack(player); if (orc.can_attack != false) { if (orc.crit == true) { OrcAttackCritSound(); System.Threading.Thread.Sleep(2000); orc.crit = false; } else { OrcAttackSound(); System.Threading.Thread.Sleep(2000); } } // End if (orc.health <= 0) { Console.WriteLine("WINNER: " + player.name); PlayVictorySound(); Thread.Sleep(10000); end = true; } else if (player.health <= 0) { Console.WriteLine("WINNER: Orc"); PlayDefeatSound(); Thread.Sleep(1000); end = true; } } }
public void Fireball(Orc orc) { mana -= costF; orc.TakeDamage(fireball); Console.WriteLine("{0} used Fireball for {1} mana and did {2} damage to Orc.", name, costF, fireball); }
// Abilities public void Attack(Orc orc) { orc.TakeDamage(attack); Console.WriteLine("{0} used Attack and did {1} damage to Orc.", name, attack); }