Package mage.target.targetpointer

Examples of mage.target.targetpointer.FixedTarget


            if (event.getType() == EventType.DAMAGED_CREATURE) {
                  if (event.getSourceId().equals(this.sourceId)
                    && ((DamagedCreatureEvent) event).isCombatDamage()) {
                            if (setTargetPointer) {
                                for (Effect effect : this.getEffects()) {
                                        effect.setTargetPointer(new FixedTarget(event.getTargetId()));
                                        effect.setValue("damage", event.getAmount());
                                }
                            }
                            return true;
                    }
View Full Code Here


            if (spell != null && filter.match(spell, game)) {
                if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
                    for (Effect effect: this.getEffects()) {
                        switch (setTargetPointer) {
                            case SPELL:
                                effect.setTargetPointer(new FixedTarget(event.getTargetId()));
                                break;
                            case PLAYER:
                                effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
                                break;
                            default:
                                throw new UnsupportedOperationException("Value of SetTargetPointer not supported!");
                        }
                       
View Full Code Here

            UUID targetId = event.getTargetId();
            Permanent permanent = game.getPermanent(targetId);
            if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
                if (setTargetPointer) {
                    for (Effect effect : this.getEffects()) {
                        effect.setTargetPointer(new FixedTarget(event.getTargetId()));
                    }
                }
                return true;
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        List<FixedTarget> detainedObjects = new ArrayList<>();
        for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
            game.informPlayers("Detained permanent: " + permanent.getName());
            FixedTarget fixedTarget = new FixedTarget(permanent.getId());
            fixedTarget.init(game, source);
            detainedObjects.add(fixedTarget);
        }

        game.addEffect(new DetainAllRestrictionEffect(detainedObjects), source);
        return false;
View Full Code Here

                        Card card = game.getCard(getSourceId());
                        if (card != null) {
                            String key = new StringBuilder("Haunting_").append(getSourceId().toString()).append("_").append(card.getZoneChangeCounter()).toString();
                            Object object = game.getState().getValue(key);
                            if (object != null && object instanceof FixedTarget) {
                                FixedTarget target = (FixedTarget) object;
                                if (target.getTarget() != null &&  target.getTarget().equals(event.getTargetId())) {
                                    usedFromExile = true;
                                    return true;
                                }
                            }
                        }
View Full Code Here

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
            Card card = game.getCard(event.getTargetId());
            if (card != null && !card.isCopy() && game.getOpponents(controllerId).contains(card.getOwnerId())) {
                this.getEffects().get(0).setTargetPointer(new FixedTarget(card.getOwnerId()));
                return true;
            }
        }
        return false;
    }
View Full Code Here

            // haunting card will only be moved to exile, if
            if (hauntedCreature != null) {
                if (card.moveToExile(source.getSourceId(), "Haunting", source.getSourceId(), game)) {
                    // remember the haunted creature
                    String key = new StringBuilder("Haunting_").append(source.getSourceId().toString()).append("_").append(card.getZoneChangeCounter()).toString();
                    game.getState().setValue(key, new FixedTarget(targetPointer.getFirst(game, source)));
                    card.addInfo("hauntinfo", new StringBuilder("Haunting ").append(hauntedCreature.getLogName()).toString());
                    hauntedCreature.addInfo("hauntinfo", new StringBuilder("Haunted by ").append(card.getLogName()).toString());
                    game.informPlayers(new StringBuilder(card.getName()).append(" haunting ").append(hauntedCreature.getLogName()).toString());
                }
                return true;
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
            RegenerateTargetEffect regenEffect = new RegenerateTargetEffect();
            regenEffect.setTargetPointer(new FixedTarget(permanent.getId()));
            game.addEffect(regenEffect, source);
        }
        return true;
    }
View Full Code Here

    public void init(Ability source, Game game) {
        super.init(source, game);
        if (fixedTarget) {
            Permanent equipment = game.getPermanent(source.getSourceId());
            if (equipment != null && equipment.getAttachedTo() != null) {
                this.setTargetPointer(new FixedTarget(equipment.getAttachedTo()));
            }
        }
    }
View Full Code Here

            if (chooseUseText == null || player.chooseUse(executingEffect.getOutcome(), message, game)) {
                if (ClashEffect.getInstance().apply(game, source)) {
                    if (setTargetPointerToClashedOpponent) {
                        Object opponent = getValue("clashOpponent");
                        if (opponent instanceof Player) {
                            executingEffect.setTargetPointer(new FixedTarget(((Player)opponent).getId()));
                        }                       
                    } else {
                        executingEffect.setTargetPointer(this.targetPointer);
                    }
                    if (executingEffect instanceof OneShotEffect) {
View Full Code Here

TOP

Related Classes of mage.target.targetpointer.FixedTarget

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.