Search in sources :

Example 11 with BoostSourceEffect

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

the class CallousDeceiverEffect 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) {
        Cards cards = new CardsImpl();
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            cards.add(card);
            controller.revealCards(sourceObject.getIdName(), cards, game);
            if (card.isLand(game)) {
                game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);
                game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
            }
        }
        return true;
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) MageObject(mage.MageObject)

Example 12 with BoostSourceEffect

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

the class FeralDeceiverEffect 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)) {
                game.addEffect(new BoostSourceEffect(2, 2, Duration.EndOfTurn), source);
                game.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), source);
            }
        }
        return true;
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) MageObject(mage.MageObject) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) Card(mage.cards.Card)

Example 13 with BoostSourceEffect

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

the class HexParasiteEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    TargetPermanent target = (TargetPermanent) source.getTargets().get(0);
    Permanent permanent = game.getPermanent(target.getFirstTarget());
    Player controller = game.getPlayer(source.getControllerId());
    if (permanent != null && controller != null) {
        int toRemove = source.getManaCostsToPay().getX();
        int removed = 0;
        String[] counterNames = permanent.getCounters(game).keySet().toArray(new String[0]);
        for (String counterName : counterNames) {
            if (controller.chooseUse(Outcome.Neutral, "Remove " + counterName + " counters?", source, game)) {
                if (permanent.getCounters(game).get(counterName).getCount() == 1 || (toRemove - removed == 1)) {
                    permanent.removeCounters(counterName, 1, source, game);
                    removed++;
                } else {
                    int amount = controller.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game);
                    if (amount > 0) {
                        removed += amount;
                        permanent.removeCounters(counterName, amount, source, game);
                    }
                }
            }
            if (removed >= toRemove) {
                break;
            }
        }
        if (removed > 0) {
            game.addEffect(new BoostSourceEffect(removed, 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) TargetPermanent(mage.target.TargetPermanent) TargetPermanent(mage.target.TargetPermanent)

Example 14 with BoostSourceEffect

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

the class KeldonBattlewagonBoostEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent KeldonBattlewagon = game.getPermanent(source.getSourceId());
    Permanent tappedCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
    if (tappedCreature != null && KeldonBattlewagon != null) {
        int amount = tappedCreature.getPower().getValue();
        game.addEffect(new BoostSourceEffect(amount, 0, Duration.EndOfTurn), source);
    }
    return true;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetControlledPermanent(mage.target.common.TargetControlledPermanent)

Example 15 with BoostSourceEffect

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

the class SteelSquirrelEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    Integer amount = (Integer) this.getValue("rolled");
    if (controller != null && permanent != null && amount != null) {
        game.addEffect(new BoostSourceEffect(amount, amount, 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)

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