Search in sources :

Example 16 with SetPowerToughnessSourceEffect

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;
}
Also used : SetPowerToughnessSourceEffect(mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect) Player(mage.players.Player)

Aggregations

SetPowerToughnessSourceEffect (mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect)16 Player (mage.players.Player)13 Permanent (mage.game.permanent.Permanent)10 Card (mage.cards.Card)4 UUID (java.util.UUID)3 ContinuousEffect (mage.abilities.effects.ContinuousEffect)3 Ability (mage.abilities.Ability)2 Cost (mage.abilities.costs.Cost)2 PayLifeCost (mage.abilities.costs.common.PayLifeCost)2 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)2 EntersTheBattlefieldEvent (mage.game.events.EntersTheBattlefieldEvent)2 Target (mage.target.Target)2 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)2 ArrayList (java.util.ArrayList)1 EntersBattlefieldAbility (mage.abilities.common.EntersBattlefieldAbility)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 Condition (mage.abilities.condition.Condition)1 SourceHasCounterCondition (mage.abilities.condition.common.SourceHasCounterCondition)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1