Search in sources :

Example 96 with TargetPlayer

use of mage.target.TargetPlayer in project mage by magefree.

the class WishclawTalismanEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    effect.apply(game, source);
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    TargetPlayer target = new TargetOpponent();
    target.setNotTarget(true);
    if (!player.choose(outcome, target, source.getSourceId(), game)) {
        return false;
    }
    ContinuousEffect continuousEffect = new GainControlTargetEffect(Duration.Custom, true, target.getFirstTarget());
    continuousEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
    game.addEffect(continuousEffect, source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) TargetPlayer(mage.target.TargetPlayer) TargetOpponent(mage.target.common.TargetOpponent) ContinuousEffect(mage.abilities.effects.ContinuousEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect) TargetPlayer(mage.target.TargetPlayer)

Example 97 with TargetPlayer

use of mage.target.TargetPlayer in project mage by magefree.

the class DomineeringWillEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
    if (targetPlayer != null) {
        ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, targetPlayer.getId());
        effect.setTargetPointer(new SecondTargetPointer());
        effect.setText("Target player gains control of up to three target nonattacking creatures until end of turn");
        game.addEffect(effect, source);
        Effect effect2 = new UntapTargetEffect();
        effect2.setTargetPointer(new SecondTargetPointer());
        effect2.setText("Untap those creatures");
        effect2.apply(game, source);
        RequirementEffect effect3 = new BlocksIfAbleTargetEffect(Duration.EndOfTurn);
        effect3.setTargetPointer(new SecondTargetPointer());
        effect3.setText("They block this turn if able");
        game.addEffect(effect3, source);
        return true;
    }
    return false;
}
Also used : SecondTargetPointer(mage.target.targetpointer.SecondTargetPointer) RequirementEffect(mage.abilities.effects.RequirementEffect) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) BlocksIfAbleTargetEffect(mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect) RequirementEffect(mage.abilities.effects.RequirementEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) Effect(mage.abilities.effects.Effect) BlocksIfAbleTargetEffect(mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect)

Example 98 with TargetPlayer

use of mage.target.TargetPlayer in project mage by magefree.

the class DiseasedVerminWatcher method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
    if (sourcePermanent != null && controller != null) {
        TargetPlayer targetOpponent = new TargetPlayer(1, 1, false, filter);
        if (targetOpponent.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(Outcome.Damage, targetOpponent, source.getSourceId(), game)) {
            Player opponent = game.getPlayer(targetOpponent.getFirstTarget());
            if (opponent != null && sourcePermanent.getCounters(game).getCount(CounterType.INFECTION) > 0) {
                opponent.damage(sourcePermanent.getCounters(game).getCount(CounterType.INFECTION), source.getSourceId(), source, game, false, true);
                return true;
            }
        }
    }
    return false;
}
Also used : Player(mage.players.Player) ObjectSourcePlayer(mage.filter.predicate.ObjectSourcePlayer) TargetPlayer(mage.target.TargetPlayer) Permanent(mage.game.permanent.Permanent) TargetPlayer(mage.target.TargetPlayer)

Example 99 with TargetPlayer

use of mage.target.TargetPlayer in project mage by magefree.

the class ElementalAuguryEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player targetPlayer = game.getPlayer(source.getFirstTarget());
    if (targetPlayer == null || controller == null) {
        return false;
    }
    Cards cards = new CardsImpl(targetPlayer.getLibrary().getTopCards(game, 3));
    controller.lookAtCards(source, null, cards, game);
    controller.putCardsOnTopOfLibrary(cards, game, source, true);
    return true;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player)

Example 100 with TargetPlayer

use of mage.target.TargetPlayer in project mage by magefree.

the class GrindclockEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (sourceObject != null) {
        int amount = sourceObject.getCounters(game).getCount(CounterType.CHARGE);
        Player targetPlayer = game.getPlayer(source.getFirstTarget());
        if (targetPlayer != null) {
            targetPlayer.millCards(amount, source, game);
            return true;
        }
    }
    return false;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent)

Aggregations

TargetPlayer (mage.target.TargetPlayer)134 Player (mage.players.Player)129 Card (mage.cards.Card)38 Permanent (mage.game.permanent.Permanent)32 FilterCard (mage.filter.FilterCard)27 UUID (java.util.UUID)25 MageObject (mage.MageObject)16 CardsImpl (mage.cards.CardsImpl)16 FilterPlayer (mage.filter.FilterPlayer)16 TargetCard (mage.target.TargetCard)13 Cards (mage.cards.Cards)12 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)12 ObjectSourcePlayer (mage.filter.predicate.ObjectSourcePlayer)10 Target (mage.target.Target)10 FixedTarget (mage.target.targetpointer.FixedTarget)10 Spell (mage.game.stack.Spell)9 ContinuousEffect (mage.abilities.effects.ContinuousEffect)8 TargetPermanent (mage.target.TargetPermanent)7 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)6 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)5