Esempio n. 1
0
        public void Attack(warrior enemy)
        {
            int damage = m_weapon.Damage / enemy.m_armor.ArmorPoints;

            enemy.m_health = enemy.m_health - damage;

            AttackResult(enemy, damage);
            Thread.Sleep(100);
        }
Esempio n. 2
0
 private void AttackResult(warrior enemy, int damage)
 {
     if (enemy.m_health < 0)
     {
         enemy.m_isAlive = false;
         Tools.selectColour($"{enemy.m_name} is dead.", ConsoleColor.Red);
         Tools.selectColour($"{this.m_name} is Victorious", ConsoleColor.Green);
     }
     else
     {
         Console.WriteLine($"{this.m_name} Attacked {enemy.m_name} for {damage} points Damage ");
         Console.WriteLine($"{this.m_name}'s Current Health is {m_health}.");
         Console.WriteLine($"{enemy.m_name}'s Current Health is {enemy.m_health}.");
         Console.WriteLine($"_ _ _ _ _ _ _ _ _  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  _ _ _ _ _");
     }
 }
Esempio n. 3
0
        static int Main()
        {
            warrior goodguy = new warrior("Pratik", Faction.GoodGuy);
            warrior badguy  = new warrior("Kalya", Faction.BadGuy);

            while (goodguy.IsAlive && badguy.IsAlive)
            {
                if (rng.Next(0, 10) < 5)
                {
                    goodguy.Attack(badguy);
                }
                else
                {
                    badguy.Attack(goodguy);
                }
            }
            Console.ReadLine();
            return(0);
        }