Esempio n. 1
0
    public override bool IsTargettable(TargettingQuery targetQuery)
    {
        bool valid = false;

        if (!creatureState.IsDead())
        {
            ITargettingDescription desc = targetQuery.targettingDesc;
            if (desc.targettingType == TargettingType.EXCEPT)
            {
                ExceptTargetDescription exceptDesc = (ExceptTargetDescription)desc;
                desc = exceptDesc.targetDescription;
            }

            switch (desc.targetType)
            {
            case TargetType.CREATURES:
            case TargetType.PERMANENT:
            case TargetType.DAMAGEABLE:
                valid = true;
                break;
            }

            if (!targetQuery.ignoreUntouchable && HasKeyword(KeywordAttribute.UNTOUCHABLE))
            {
                valid = false;
            }

            if (valid)
            {
                IQualifiableTargettingDescription qualifiableDesc = (IQualifiableTargettingDescription)desc;
                if (qualifiableDesc != null)
                {
                    valid = qualifiableDesc.GetPlayerAlignment() == Alignment.NEUTRAL || (qualifiableDesc.GetPlayerAlignment() == GetAlignmentToPlayer(targetQuery.requestingPlayer));

                    IQualifierDescription qualifier = qualifiableDesc.qualifier;
                    if (valid && qualifier != null)
                    {
                        switch (qualifier.qualifierType)
                        {
                        case QualifierType.NONE:
                            break;

                        case QualifierType.CREATURE_TYPE:
                        {
                            CreatureTypeQualifierDescription creatureQualifier = (CreatureTypeQualifierDescription)qualifier;
                            valid = creatureQualifier.creatureType == card.cardData.GetCreatureType();
                        }
                        break;

                        default:
                            valid = false;
                            break;
                        }
                    }
                }
            }
        }
        return(valid);
    }
Esempio n. 2
0
    public override bool IsTargettable(TargettingQuery targetQuery)
    {
        bool valid = false;

        ITargettingDescription desc = targetQuery.targettingDesc;

        if (desc.targettingType == TargettingType.EXCEPT)
        {
            ExceptTargetDescription exceptDesc = (ExceptTargetDescription)desc;
            desc = exceptDesc.targetDescription;
        }
        switch (desc.targetType)
        {
        case TargetType.PLAYERS:
        case TargetType.DAMAGEABLE:
            valid = true;
            break;
        }

        if (valid)
        {
            IQualifiableTargettingDescription qualifiableDesc = (IQualifiableTargettingDescription)desc;
            if (qualifiableDesc != null)
            {
                valid = qualifiableDesc.GetPlayerAlignment() == Alignment.NEUTRAL || (qualifiableDesc.GetPlayerAlignment() == GetAlignmentToPlayer(targetQuery.requestingPlayer));

                IQualifierDescription qualifier = qualifiableDesc.qualifier;
                if (valid && qualifier != null)
                {
                    switch (qualifier.qualifierType)
                    {
                    case QualifierType.NONE:
                        break;

                    default:
                        valid = false;
                        break;
                    }
                }
            }
        }

        return(valid);
    }
Esempio n. 3
0
    private bool IsTargettableCard(TargettingQuery targetQuery)
    {
        bool valid = false;

        ITargettingDescription desc = targetQuery.targettingDesc;

        if (desc.targettingType == TargettingType.EXCEPT)
        {
            ExceptTargetDescription exceptDesc = (ExceptTargetDescription)desc;
            desc = exceptDesc.targetDescription;
        }
        switch (desc.targetType)
        {
        case TargetType.CARDS:
            valid = true;
            break;

        case TargetType.CREATURE_CARDS:
            valid = cardData.GetCardType() == CardType.CREATURE;
            break;

        case TargetType.SPELL_CARDS:
            valid = cardData.GetCardType() == CardType.SPELL;
            break;

        case TargetType.TRAP_CARDS:
            valid = cardData.GetCardType() == CardType.TRAP;
            break;
        }

        if (valid)
        {
            IQualifiableTargettingDescription qualifiableDesc = (IQualifiableTargettingDescription)desc;
            if (qualifiableDesc != null)
            {
                valid = qualifiableDesc.GetPlayerAlignment() == Alignment.NEUTRAL || (qualifiableDesc.GetPlayerAlignment() == GetAlignmentToPlayer(targetQuery.requestingPlayer));

                IQualifierDescription qualifier = qualifiableDesc.qualifier;
                if (valid && qualifier != null)
                {
                    switch (qualifier.qualifierType)
                    {
                    case QualifierType.NONE:
                        break;

                    case QualifierType.CREATURE_TYPE:
                    {
                        CreatureTypeQualifierDescription creatureQualifier = (CreatureTypeQualifierDescription)qualifier;
                        valid = creatureQualifier.creatureType == cardData.GetCreatureType();
                    }
                    break;

                    case QualifierType.CARD_TYPE:
                    {
                        CardTypeQualifierDescription cardTypeQualifier = (CardTypeQualifierDescription)qualifier;
                        valid = cardTypeQualifier.cardType == cardData.GetCardType();
                    }
                    break;

                    default:
                        valid = false;
                        break;
                    }
                }
            }
        }

        return(valid);
    }