예제 #1
0
        public static ICharacters Spell(ref ICharacters character, ref ICharacters opponent)
        {
            int    AttackDealt;
            int    HitPointsDefender;
            Random rand = new Random();

            AttackDealt       = OffensiveActions.IntelligenceAction(character);
            HitPointsDefender = opponent.HitPoints;
            int damage = AttackDealt * DefenseActions.LuckAction(opponent);

            opponent.HitPoints = HitPointsDefender - damage;
            Console.WriteLine("You take him:" + damage);
            return(opponent);
        }
예제 #2
0
        private static ICharacters Attack(ref ICharacters attacker, ref ICharacters defender)
        {
            int    AttackDealt;
            int    HitPointsDefender;
            Random rand = new Random();

            AttackDealt       = OffensiveActions.StrengthAction(attacker);
            HitPointsDefender = defender.HitPoints;
            int damage = (AttackDealt) - defender.HeldArmor * DefenseActions.LuckAction(defender);

            if (defender.HeldArmor > AttackDealt)
            {
                defender.HitPoints = HitPointsDefender - 5;
                Console.WriteLine("You take him: 5 damage!");
            }
            else
            {
                defender.HitPoints = HitPointsDefender - damage;
                Console.WriteLine("You take him:" + damage + "damage");
            }
            return(defender);
        }