Example #1
0
        /// <summary>
        /// Simulate one hit to opponent
        /// </summary>
        /// <param name="opponent">your enemy</param>
        public virtual void Hit(Person opponent)
        {
            var rand = new Random();
            int res = rand.Next(1, 101);

            var damage = (decimal)Math.Ceiling((double)(Power - Power * (res - 1) / (Precise + 1)));

            MessageHelper.ShowMessage(string.Format("{0} hits...", Name));
            Thread.Sleep(1500);
            if (!CalculatePrecise(Precise, res))
            {
                MessageHelper.ShowMessage("Miss");
            }
            else
            {
                opponent.Health -= damage;
                if (opponent.Health < 0)
                {
                    damage += opponent.Health;
                    opponent.Health = 0;
                }
                MessageHelper.ShowMessage(string.Format("{0} makes push for {1} damage - {2}'s health now is {3}", Name, damage, opponent.Name, opponent.Health));
            }
            Thread.Sleep(1500);
        }
Example #2
0
        /// <summary>
        /// Simulate one hit to opponent
        /// </summary>
        /// <param name="opponent">your enemy</param>
        public override void Hit(Person opponent)
        {
            if (Bottles > 0)
            {
                MessageHelper.ShowMessage(string.Format("If you want to drink a bottle, press 1. You have {0} bottle{1}", Bottles, Bottles > 1 ? "s" : ""));
                if(Console.ReadLine() == "1")
                {
                    DrinkBottle(Convert.ToUInt32(ConfigurationManager.AppSettings["BottleHealth"]));
                    return;
                }
            }

            base.Hit(opponent);
        }
Example #3
0
 public Fight(Person first, Person second)
 {
     firstFighter = first;
     secondFighter = second;
 }