Examples of apply()


Examples of mage.ConditionalMana.apply()

        Iterator<ManaPoolItem> it = manaItems.iterator();
        while (it.hasNext()) {
            ManaPoolItem item = it.next();
            if (item.isConditional()) {
                ConditionalMana cm = item.getConditionalMana();
                if (cm.apply(ability, game, cm.getManaProducerId())) {
                    total += item.count();
                    it.remove();
                }
            }
            else {
View Full Code Here

Examples of mage.abilities.effects.Effect.apply()

                Permanent tokenToCopy = game.getPermanent(target.getFirstTarget());
                if (tokenToCopy != null) {
                    game.informPlayers("Token selected for populate: " + tokenToCopy.getLogName());
                    Effect effect = new PutTokenOntoBattlefieldCopyTargetEffect();
                    effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
                    return effect.apply(game, source);
                }
            }
        }
        return false;
    }
View Full Code Here

Examples of mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect.apply()

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null && token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), true, true)) {
            Effect effect = new ExileTargetEffect();
            effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
            CreateDelayedTriggeredAbilityEffect createEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect));
            createEffect.apply(game, source);
            return true;
        }
        return false;
    }
View Full Code Here

Examples of mage.abilities.effects.common.CreateTokenEffect.apply()

    }

    @Override
    public boolean apply(Game game, Ability source) {
        CreateTokenEffect effect =  new CreateTokenEffect(new TatsumaDragonToken());
        effect.apply(game, source);
        FixedTarget fixedTarget = new FixedTarget(effect.getLastAddedTokenId());
        DelayedTriggeredAbility delayedAbility = new TatsumaTheDragonsFangTriggeredAbility(fixedTarget);
        delayedAbility.setSourceId(source.getSourceId());
        delayedAbility.setControllerId(source.getControllerId());
        game.addDelayedTriggeredAbility(delayedAbility);
View Full Code Here

Examples of mage.abilities.effects.common.CreateTokenTargetEffect.apply()

            }
            if (xSum > 0) {
                for(UUID playerId : controller.getInRange()) {
                    Effect effect = new CreateTokenTargetEffect(new SoldierToken(), xSum);
                    effect.setTargetPointer(new FixedTarget(playerId));
                    effect.apply(game, source);
                }

            }
            // prevent undo
            controller.resetStoredBookmark(game);
View Full Code Here

Examples of mage.abilities.effects.common.DamageTargetEffect.apply()

            permanent.removeCounters(CounterType.P1P1.createInstance(), game);
            Target target = new TargetCreatureOrPlayer();
            if (controller.chooseTarget(outcome, target, source, game)) {
                Effect effect = new DamageTargetEffect(1);
                effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
                return effect.apply(game, source);
            }
            return true;
        }
        return false;
    }
View Full Code Here

Examples of mage.abilities.effects.common.ExileSourceEffect.apply()

  }

  @Override
  public boolean apply(Game game, Ability source) {
    ExileSourceEffect effect = new ExileSourceEffect();
    return effect.apply(game, source);
  }

  @Override
  public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    return apply(game, source);
View Full Code Here

Examples of mage.abilities.effects.common.ExileTargetEffect.apply()

    public boolean apply(Game game, Ability source) {
        Object object = game.getState().getValue(source.getSourceId().toString() + "returnedCreature");
        if ((object instanceof MageObjectReference)) {
            Effect effect = new ExileTargetEffect();
            effect.setTargetPointer(new FixedTarget(((MageObjectReference)object).getSourceId()));
            effect.apply(game, source);
            return new ReturnToHandSourceEffect(true).apply(game, source);
        }
        return false;
    }
}
View Full Code Here

Examples of mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect.apply()

            Player controller = game.getPlayer(creature.getControllerId());
            if (controller != null) {
                int power = creature.getPower().getValue();
                Effect effect = new PutLibraryIntoGraveTargetEffect(power);
                effect.setTargetPointer(new FixedTarget(controller.getId()));
                return effect.apply(game, source);
            }
        }
        return false;
    }
}
View Full Code Here

Examples of mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect.apply()

    public boolean apply(Game game, Ability source) {
        Permanent permanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
        if (permanent != null) {
            PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, CardType.ENCHANTMENT, true);
            effect.setTargetPointer(getTargetPointer());
            if (effect.apply(game, source) && effect.getAddedPermanent() != null) {
                ExileTargetEffect exileEffect = new ExileTargetEffect();
                exileEffect.setTargetPointer(new FixedTarget(effect.getAddedPermanent().getId()));
                DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(exileEffect);
                delayedAbility.setSourceId(source.getSourceId());
                delayedAbility.setControllerId(source.getControllerId());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.