Esempio n. 1
0
        public bool Execute(Player player, Player opponent)
        {
            if (!IsActionValid(player, opponent))
            {
                return(true);
            }

            CombatCreature attackCreature  = player.Table[id];
            CombatCreature defenseCreature = target >= 0 ? opponent.Table[target] : null;

            int attackCreatureAttack = attackCreature.Attack;

            int damageDealt = 0;

            if (defenseCreature == null)
            {
                damageDealt = attackCreature.AttackPlayer(opponent);
            }
            else
            {
                int exceedDamage = 0;
                (damageDealt, exceedDamage) = attackCreature.AttackCreature(defenseCreature);

                opponent.TakeDamage(exceedDamage);
            }

            if (attackCreature.IsDrain)
            {
                player.TakeDamage(-damageDealt);
            }

            return(true);
        }