use of mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect in project mage by magefree.
the class AmplifireEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl();
Card lastCard = null;
for (Card card : player.getLibrary().getCards(game)) {
if (card != null) {
cards.add(card);
if (card.isCreature(game)) {
lastCard = card;
break;
}
}
}
player.revealCards(source, cards, game);
if (lastCard != null) {
game.addEffect(new SetPowerToughnessSourceEffect(2 * lastCard.getPower().getValue(), 2 * lastCard.getToughness().getValue(), Duration.UntilYourNextTurn, SubLayer.SetPT_7b), source);
}
player.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
Aggregations