Package mage.abilities.common.delayed

Examples of mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility


            Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
            Card card = game.getCard(getTargetPointer().getFirst(game, source));
            if (permanent != null) {
                if (permanent.moveToExile(source.getSourceId(), "Voidwalk", source.getSourceId(), game)) {
                    if (card != null) {
                        AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
                        delayedAbility.setSourceId(source.getSourceId());
                        delayedAbility.setControllerId(card.getOwnerId());
                        game.addDelayedTriggeredAbility(delayedAbility);
                        return true;
                    }
                }
            }
View Full Code Here


        UUID exileId = source.getSourceId();
        if (exileId != null) {
            for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
                if (creature != null) {
                    if (creature.moveToExile(source.getSourceId(), "Ghostway Exile", source.getSourceId(), game)) {
                        AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, true));
                        delayedAbility.setSourceId(source.getSourceId());
                        delayedAbility.setControllerId(source.getControllerId());
                        game.addDelayedTriggeredAbility(delayedAbility);
                    }
                }
            }
            return true;
View Full Code Here

                card.setFaceDown(true);
                if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY)) {
                    Effect returnToHandeffect = new ReturnToHandTargetEffect();
                    returnToHandeffect.setText("put that face down card into your hand");
                    returnToHandeffect.setTargetPointer(new FixedTarget(card.getId()));
                    DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(returnToHandeffect, TargetController.YOU);
                    delayedAbility.setSourceId(source.getSourceId());
                    delayedAbility.setControllerId(source.getControllerId());
                    game.addDelayedTriggeredAbility(delayedAbility);                   
                    return true;
                }
                return false;
            }
View Full Code Here

                            effect.setTargetPointer(new FixedTarget(permanent.getId()));
                            game.addEffect(effect, source);
                           
                            SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + card.getName());
                            sacrificeEffect.setTargetPointer(new FixedTarget(card.getId()));
                            DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(sacrificeEffect);
                            delayedAbility.setSourceId(source.getSourceId());
                            delayedAbility.setControllerId(source.getControllerId());
                            game.addDelayedTriggeredAbility(delayedAbility);
                           
                            return true;
                        }                       
                    }
View Full Code Here

            List<Permanent> perms = game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game);
            if (perms.size() > 0) {
                for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game)) {
                    controller.moveCardToExileWithInfo(permanent, source.getSourceId(), "Sudden Disappearance", source.getSourceId(), game, Zone.BATTLEFIELD);
                }
                AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
                delayedAbility.setSourceId(source.getSourceId());
                delayedAbility.setControllerId(source.getControllerId());
                game.addDelayedTriggeredAbility(delayedAbility);

            }
            return true;
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "DragonWhelp");
        if (amount == null) {
            amount = 0;
            DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new DragonWhelpDelayedEffect());
            delayedAbility.setSourceId(source.getSourceId());
            delayedAbility.setControllerId(source.getControllerId());
            game.addDelayedTriggeredAbility(delayedAbility);
        }
        amount++;
        game.getState().setValue(source.getSourceId().toString() + "DragonWhelp", amount);
View Full Code Here

        this.color.setBlue(true);

        // Draw three cards. Discard three cards at the beginning of the next end step.
        this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3));
        this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtEndOfTurnDelayedTriggeredAbility(new DiscardControllerEffect(3))));
    }
View Full Code Here

                Card card = game.getCard(getTargetPointer().getFirst(game, source));
                if (permanent != null) {
                    UUID exileId = UUID.randomUUID();
                    if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getName(), source.getSourceId(), game, Zone.BATTLEFIELD)) {
                        if (card != null) {
                            AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD));
                            delayedAbility.setSourceId(source.getSourceId());
                            delayedAbility.setControllerId(card.getOwnerId());
                            game.addDelayedTriggeredAbility(delayedAbility);
                        }
                    }
                }
            }           
View Full Code Here

                }               
                token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());

                ExileTargetEffect exileEffect = new ExileTargetEffect();
                exileEffect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
                DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(exileEffect);
                delayedAbility.setSourceId(source.getSourceId());
                delayedAbility.setControllerId(source.getControllerId());
                game.addDelayedTriggeredAbility(delayedAbility);
            }

            return true;
        }
View Full Code Here

            if (permanent.moveToExile(source.getSourceId(), "Otherworldly Journey", source.getSourceId(), game)) {
                ExileZone exile = game.getExile().getExileZone(source.getSourceId());
                // only if permanent is in exile (tokens would be stop to exist)
                if (exile != null && !exile.isEmpty()) {
                    //create delayed triggered ability
                    AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(
                            new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, "return that card to the battlefield under its owner's control with a +1/+1 counter on it"));
                    delayedAbility.setSourceId(source.getSourceId());
                    delayedAbility.setControllerId(source.getControllerId());
                    AddCountersTargetEffect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
                    effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
                    delayedAbility.addEffect(effect);
                    game.addDelayedTriggeredAbility(delayedAbility);
                }
                return true;
            }
        }
View Full Code Here

TOP

Related Classes of mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility

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.