Search in sources :

Example 1 with PutLibraryIntoGraveTargetEffect

use of mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect in project mage by magefree.

the class GrislySpectacleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent creature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
    if (creature != null) {
        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;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) PutLibraryIntoGraveTargetEffect(mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect) Effect(mage.abilities.effects.Effect) PutLibraryIntoGraveTargetEffect(mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect)

Example 2 with PutLibraryIntoGraveTargetEffect

use of mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect in project mage by magefree.

the class BelltowerSphinxEffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (event.getTargetId().equals(this.sourceId)) {
        UUID controller = game.getControllerId(event.getSourceId());
        if (controller != null) {
            Player player = game.getPlayer(controller);
            if (player != null) {
                getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
                ((PutLibraryIntoGraveTargetEffect) getEffects().get(0)).setAmount(StaticValue.get(event.getAmount()));
                return true;
            }
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) UUID(java.util.UUID) PutLibraryIntoGraveTargetEffect(mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect)

Aggregations

PutLibraryIntoGraveTargetEffect (mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect)2 Player (mage.players.Player)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 UUID (java.util.UUID)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 DestroyTargetEffect (mage.abilities.effects.common.DestroyTargetEffect)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 TargetPermanent (mage.target.TargetPermanent)1