Пример #1
0
        //should have defining source to know opponent...

        public virtual bool Accept(object _target, CardInstance _source)
        {
            switch (TypeOfTarget)
            {
            case TargetType.Spell:
                return(_target is Spell);

            case TargetType.Activated:
                AbilityActivation aa = _target as AbilityActivation;
                return(aa == null ? false : aa.Source.IsActivatedAbility);

            case TargetType.Triggered:
                AbilityActivation aaa = _target as AbilityActivation;
                return(aaa == null ? false : aaa.Source.IsTriggeredAbility);

            case TargetType.Opponent:
                Player p = _target as Player;
                if (p == null)
                {
                    return(false);
                }
                break;

            case TargetType.Player:
                return(_target is Player);

            case TargetType.Card:
                return(_target is CardInstance);

            case TargetType.Permanent:
                CardInstance c = _target as CardInstance;
                if (c == null)
                {
                    return(false);
                }
                return(c.CurrentGroup.GroupName == CardGroupEnum.InPlay);

            case TargetType.Self:
                return(_target == _source);

            case TargetType.EquipedBy:
                if (_target is CardInstance)
                {
                    return((_target as CardInstance).AttachedTo == _source);
                }
                return(false);

            case TargetType.EnchantedBy:
                if (_target is CardInstance)
                {
                    return((_target as CardInstance).AttachedTo == _source);
                }
                return(false);
            }
            return(false);
        }
Пример #2
0
        public override void Validate()
        {
            if (currentAbilityActivation == null)
            {
                MagicEngine.CurrentEngine.MagicStack.CancelLastActionOnStack();
                return;                //maybe cancel spell if not completed
            }
            //cancel spell if mandatory ability activation is canceled
            if (currentAbilityActivation.IsMandatory)
            {
                MagicEngine.CurrentEngine.MagicStack.CancelLastActionOnStack();
                return;                //maybe cancel spell if not completed
            }

            currentAbilityActivation.Validate();

            spellAbilities.Add(currentAbilityActivation);
            currentAbilityActivation = null;
        }