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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations