use of mage.target.TargetPlayer in project mage by magefree.
the class GerrardsVerdictEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller != null && targetPlayer != null) {
controller.gainLife(targetPlayer.discard(2, false, false, source, game).count(new FilterLandCard(), game) * 3, game, source);
return true;
}
return false;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class GraveyardShovelEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (targetPlayer == null || controller == null || targetPlayer.getGraveyard().isEmpty()) {
return false;
}
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard();
target.setNotTarget(true);
targetPlayer.chooseTarget(Outcome.Exile, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return true;
}
targetPlayer.moveCards(card, Zone.EXILED, source, game);
if (card.isCreature(game)) {
controller.gainLife(2, game, source);
}
return true;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class InfernalKirinEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source));
if (spell == null) {
return false;
}
int cmc = spell.getManaValue();
Player targetPlayer = null;
for (Target target : source.getTargets()) {
if (target instanceof TargetPlayer) {
targetPlayer = game.getPlayer(target.getFirstTarget());
}
}
if (targetPlayer == null) {
return false;
}
if (targetPlayer.getHand().isEmpty()) {
return true;
}
targetPlayer.revealCards(source, targetPlayer.getHand(), game);
Cards cards = targetPlayer.getHand().copy();
cards.removeIf(uuid -> game.getCard(uuid).getManaValue() != cmc);
targetPlayer.discard(cards, false, source, game);
return true;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class LeechesEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer == null) {
return false;
}
int countPoisonCounters = targetPlayer.getCounters().getCount(CounterType.POISON);
if (countPoisonCounters > 0) {
targetPlayer.removeCounters(CounterType.POISON.getName(), countPoisonCounters, source, game);
targetPlayer.damage(countPoisonCounters, source.getSourceId(), source, game);
return true;
}
return false;
}
use of mage.target.TargetPlayer in project mage by magefree.
the class SearchWarrantEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (player != null && targetPlayer != null) {
targetPlayer.revealCards("Search Warrant", targetPlayer.getHand(), game);
int ctd = targetPlayer.getHand().size();
player.gainLife(ctd, game, source);
return true;
}
return false;
}
Aggregations