Search in sources :

Example 21 with BoostSourceEffect

use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.

the class EndlingEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (player == null || permanent == null) {
        return false;
    }
    int boost = player.chooseUse(outcome, "Give +1/-1 or -1/+1?", null, "+1/-1", "-1/+1", source, game) ? 1 : -1;
    game.addEffect(new BoostSourceEffect(boost, -1 * boost, Duration.EndOfTurn), source);
    return true;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent)

Example 22 with BoostSourceEffect

use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.

the class HarshDeceiverEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            Cards cards = new CardsImpl(card);
            controller.revealCards(sourceObject.getIdName(), cards, game);
            if (card.isLand(game)) {
                new UntapSourceEffect().apply(game, source);
                game.addEffect(new BoostSourceEffect(1, 1, Duration.EndOfTurn), source);
            }
        }
        return true;
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) MageObject(mage.MageObject) UntapSourceEffect(mage.abilities.effects.common.UntapSourceEffect) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) Card(mage.cards.Card)

Example 23 with BoostSourceEffect

use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.

the class ImpetuousProtegeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int maxPower = 0;
    for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
        maxPower = Math.max(maxPower, creature.getPower().getValue());
    }
    game.addEffect(new BoostSourceEffect(maxPower, 0, Duration.EndOfTurn), source);
    return true;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent)

Example 24 with BoostSourceEffect

use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.

the class LedevChampionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int tappedAmount = 0;
    TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true);
    if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
        for (UUID creatureId : target.getTargets()) {
            Permanent creature = game.getPermanent(creatureId);
            if (creature != null) {
                creature.tap(source, game);
                tappedAmount++;
            }
        }
    }
    if (tappedAmount > 0) {
        game.addEffect(new BoostSourceEffect(tappedAmount, tappedAmount, Duration.EndOfTurn), source);
        return true;
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) UUID(java.util.UUID)

Example 25 with BoostSourceEffect

use of mage.abilities.effects.common.continuous.BoostSourceEffect in project mage by magefree.

the class SpellboundDragonEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player you = game.getPlayer(source.getControllerId());
    Permanent dragon = game.getPermanent(source.getSourceId());
    if (you != null) {
        you.drawCards(1, source, game);
        TargetDiscard target = new TargetDiscard(you.getId());
        you.choose(Outcome.Discard, target, source.getSourceId(), game);
        Card card = you.getHand().get(target.getFirstTarget(), game);
        if (card != null && you.discard(card, false, source, game)) {
            int cmc = card.getManaValue();
            if (dragon != null) {
                game.addEffect(new BoostSourceEffect(cmc, 0, Duration.EndOfTurn), source);
                return true;
            }
        }
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetDiscard(mage.target.common.TargetDiscard) Card(mage.cards.Card)

Aggregations

BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)41 Player (mage.players.Player)25 Permanent (mage.game.permanent.Permanent)21 Card (mage.cards.Card)9 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)7 UUID (java.util.UUID)6 MageObject (mage.MageObject)5 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)5 CardsImpl (mage.cards.CardsImpl)5 Ability (mage.abilities.Ability)4 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)4 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)4 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)4 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)4 TargetPermanent (mage.target.TargetPermanent)4 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)4 Test (org.junit.Test)4 ContinuousEffect (mage.abilities.effects.ContinuousEffect)3 Cards (mage.cards.Cards)3 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)3