use of mage.abilities.effects.common.search.SearchLibraryPutInHandEffect in project mage by magefree.
the class UrzasHotTubPredicate method apply.
@Override
public boolean apply(Game game, Ability source) {
for (Cost cost : source.getCosts()) {
if (cost instanceof DiscardTargetCost) {
DiscardTargetCost discardCost = (DiscardTargetCost) cost;
Card discardedCard = discardCost.getCards().get(0);
if (discardedCard != null) {
FilterCard filter = new FilterCard();
filter.add(new UrzasHotTubPredicate(discardedCard.getName()));
return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true).apply(game, source);
}
}
}
return false;
}
use of mage.abilities.effects.common.search.SearchLibraryPutInHandEffect in project mage by magefree.
the class UrzasHotTubPredicate method apply.
@Override
public boolean apply(Game game, Ability source) {
for (Cost cost : source.getCosts()) {
if (cost instanceof DiscardTargetCost) {
DiscardTargetCost discardCost = (DiscardTargetCost) cost;
Card discardedCard = discardCost.getCards().get(0);
if (discardedCard != null) {
FilterCard filter = new FilterCard();
filter.add(new UrzasHotTubPredicate(discardedCard.getName()));
return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true).apply(game, source);
}
}
}
return false;
}
use of mage.abilities.effects.common.search.SearchLibraryPutInHandEffect in project mage by magefree.
the class IsperiaTheInscrutableEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (player != null && cardName != null) {
player.revealCards(player.getLogName() + " hand", player.getHand(), game, true);
for (Card card : player.getHand().getCards(game)) {
if (CardUtil.haveSameNames(card, cardName, game)) {
return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true).apply(game, source);
}
}
return true;
}
return false;
}
Aggregations