/// <summary>
        ///     copy from GI161-Character-Solution
        /// </summary>
        /// <param name="opponent"></param>
        protected virtual void UseSkill(CharacterBase opponent)
        {
            var damage = 0;

            if (Mana >= SelectedSkill.ManaUsed)
            {
                Mana -= SelectedSkill.ManaUsed;
                if (Mana <= 0)
                {
                    Mana = 0;
                }
                Console.WriteLine($"{Name} using {SelectedSkill.Name} to Make {SelectedSkill.Damage} Damage");
                damage = SelectedSkill.Damage;
            }

            opponent.TakeHit(opponent, damage);
        }
        /// <summary>
        ///     Choose Physical Attack to Attack opponent
        ///     copy from GI161-Character-Solution
        /// </summary>
        /// <param name="opponent"></param>
        public virtual void PhysicalAttack(CharacterBase opponent)
        {
            Console.WriteLine($"{Name} Is Attack {opponent.Name}");
            var damage = 0;

            if (opponent.Defend >= Atk)
            {
                damage = 0;
            }
            else
            {
                damage = Atk - opponent.Defend;
            }

            Console.WriteLine($"Attack {damage} Damage");

            opponent.TakeHit(opponent, damage);
        }
Esempio n. 3
0
        public override void SkillAttack(CharacterBase opponent)
        {
            var random        = new Random();
            var skillNumber   = random.Next(Skills.Length);
            var selectedSkill = Skills[skillNumber];
            var damage        = 0;

            if (Mana >= selectedSkill.ManaUsed)
            {
                Mana -= selectedSkill.ManaUsed;
                if (Mana <= 0)
                {
                    Mana = 0;
                }
                Console.WriteLine($"{Name} using Skill {selectedSkill.Name} to Make {selectedSkill.Damage} Damage");
                damage = selectedSkill.Damage;
            }

            opponent.TakeHit(opponent, damage);
        }