use of mage.target.TargetPlayer in project mage by magefree.
the class DamnablePactEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (targetPlayer != null) {
targetPlayer.drawCards(source.getManaCostsToPay().getX(), source, game);
targetPlayer.loseLife(source.getManaCostsToPay().getX(), game, source, false);
return true;
}
return false;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class DonateEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (targetPlayer != null && permanent != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true, targetPlayer.getId());
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
return true;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class GiltLeafArchdruidEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (controller != null && targetPlayer != null) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_LANDS, targetPlayer.getId(), game)) {
if (permanent != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
}
return true;
}
return false;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class HellholeRatsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int damage = 0;
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (targetPlayer != null) {
Cards cards = targetPlayer.discard(1, false, false, source, game);
if (!cards.isEmpty()) {
for (Card card : cards.getCards(game)) {
damage = card.getManaValue();
}
targetPlayer.damage(damage, source.getSourceId(), source, game);
}
return true;
}
return false;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class JolraelEmpressOfBeastsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) {
FilterPermanent filter = new FilterLandPermanent();
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
game.addEffect(new BecomesCreatureAllEffect(new CreatureToken(3, 3), "lands", filter, Duration.EndOfTurn, false), source);
return true;
}
return false;
}
Aggregations