Package mage.cards

Examples of mage.cards.Card


    }

    @Override
    public boolean apply(Game game, Ability source, Ability abilityToModify) {
        Player controller = game.getPlayer(source.getControllerId());
        Card spliceCard = game.getCard(source.getSourceId());
        if (spliceCard != null && controller != null) {
            Spell spell = game.getStack().getSpell(abilityToModify.getId());
            if (spell != null) {
                SpellAbility splicedAbility = spliceCard.getSpellAbility().copy();
                splicedAbility.setSpellAbilityType(SpellAbilityType.SPLICE);
                splicedAbility.setSourceId(abilityToModify.getSourceId());
                spell.addSpellAbility(splicedAbility);
                for (Iterator it = ((SpliceOntoArcaneAbility) source).getSpliceCosts().iterator(); it.hasNext();) {
                    Cost cost = (Cost) it.next();
View Full Code Here


        return false;
    }

    private boolean spliceSpellCanBeActivated(Ability source, Game game) {
        // check if spell can be activated (protection problem not solved because effect will be used from the base spell?)
        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            return card.getSpellAbility().canActivate(source.getControllerId(), game);
        }
        return false;
    }
View Full Code Here

        criteria.rarities(Rarity.LAND).name(landName);
        List<CardInfo> lands = CardRepository.instance.findCards(criteria);
        List<Card> cards = new ArrayList<>();
        if (!lands.isEmpty()) {
            for (int i = 0; i < number; i++) {
                Card land = lands.get(random.nextInt(lands.size())).getCard();
                cards.add(land);
            }           
        }       
        return cards;
    }
View Full Code Here

        return fInstance;
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            for (Ability ability: card.getAbilities()) {
                if (ability instanceof KickerAbility) {
                    if(((KickerAbility) ability).isKicked(game)) {
                        return true;
                    }
                }
View Full Code Here

    @Override
    public void init(Game game, Ability source) {
        if (source.getTargets().size() > 0) {
            for (UUID target : source.getTargets().get(0).getTargets()) {
                Card card = game.getCard(target);
                if (card != null) {
                    this.zoneChangeCounter.put(target, card.getZoneChangeCounter());
                }   
            }
        }
    }
View Full Code Here

    @Override
    public List<UUID> getTargets(Game game, Ability source) {
        ArrayList<UUID> target = new ArrayList<>();
        if (source.getTargets().size() > 0) {
            for (UUID targetId : source.getTargets().get(0).getTargets()) {
                Card card = game.getCard(targetId);
                if (card != null && zoneChangeCounter.containsKey(targetId)
                        && card.getZoneChangeCounter() != zoneChangeCounter.get(targetId)) {
                    continue;
                }
                target.add(targetId);
            }
        }
View Full Code Here

    @Override
    public UUID getFirst(Game game, Ability source) {
        UUID targetId = source.getFirstTarget();
        if (zoneChangeCounter.containsKey(targetId)) {
            Card card = game.getCard(targetId);
            if (card != null && zoneChangeCounter.containsKey(targetId)
                        && card.getZoneChangeCounter() != zoneChangeCounter.get(targetId)) {
                return null;
            }
        }
        return targetId;
    }
View Full Code Here

        }
        return 0;
    }

    public boolean isKicked(Game game) {
        Card card = game.getCard(sourceId);
        // kicked status counts only if card not changed zone since it was kicked
        if (card != null && card.getZoneChangeCounter() <= zoneChangeCounter +1) {
            for (OptionalAdditionalCost cost: kickerCosts) {
                if(cost.isActivated()) {
                    return true;
                }
            }
View Full Code Here

    private void activateKicker(OptionalAdditionalCost kickerCost, Game game) {
        kickerCost.activate();
        // remember zone change counter
        if (zoneChangeCounter == 0) {
            Card card = game.getCard(getSourceId());
            if (card != null) {
                zoneChangeCounter = card.getZoneChangeCounter();
            } else {
                throw new IllegalArgumentException("Kicker source card not found");
            }
        }
    }
View Full Code Here

        this.zoneChangeCounter = fixedTarget.zoneChangeCounter;
    }

    @Override
    public void init(Game game, Ability source) {
        Card card = game.getCard(target);
        if (card != null) {
            this.zoneChangeCounter = card.getZoneChangeCounter();
        }
    }
View Full Code Here

TOP

Related Classes of mage.cards.Card

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.