Search in sources :

Example 6 with BoostSourceEffect

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

the class DollhouseOfHorrorsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card card = game.getCard(getTargetPointer().getFirst(game, source));
    if (card == null) {
        return false;
    }
    CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), CardType.ARTIFACT, false, 1, false, false, null, 0, 0, false);
    effect.setSavedPermanent(new PermanentCard(card, source.getControllerId(), game));
    effect.setAdditionalSubType(SubType.CONSTRUCT);
    effect.addAdditionalAbilities(new SimpleStaticAbility(new BoostSourceEffect(ArtifactYouControlCount.instance, ArtifactYouControlCount.instance, Duration.WhileOnBattlefield).setText("This creature gets +1/+1 for each artifact you control")));
    effect.apply(game, source);
    game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(new FixedTargets(effect.getAddedPermanents(), game)), source);
    return true;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) FixedTargets(mage.target.targetpointer.FixedTargets) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) Card(mage.cards.Card) PermanentCard(mage.game.permanent.PermanentCard) PermanentCard(mage.game.permanent.PermanentCard)

Example 7 with BoostSourceEffect

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

the class OKagachiMadeManifestEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
    if (controller == null || player == null) {
        return false;
    }
    Card card;
    switch(controller.getGraveyard().count(StaticFilters.FILTER_CARD_A_NON_LAND, game)) {
        case 0:
            return false;
        case 1:
            card = controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_A_NON_LAND, game).stream().findFirst().orElse(null);
            break;
        default:
            TargetCard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_A_NON_LAND);
            target.setNotTarget(true);
            player.choose(Outcome.ReturnToHand, controller.getGraveyard(), target, game);
            card = game.getCard(target.getFirstTarget());
    }
    if (card == null) {
        return false;
    }
    int manaValue = card.getManaValue();
    player.moveCards(card, Zone.HAND, source, game);
    if (manaValue > 0) {
        game.addEffect(new BoostSourceEffect(manaValue, 0, Duration.EndOfTurn), source);
    }
    return true;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) TargetCardInGraveyard(mage.target.common.TargetCardInGraveyard) TargetCard(mage.target.TargetCard) TargetCard(mage.target.TargetCard) Card(mage.cards.Card)

Example 8 with BoostSourceEffect

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

the class JangoFettEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getSourceId());
    if (creature == null) {
        return false;
    }
    // Count the number of creatures attacked opponent controls with a bounty counter
    UUID defenderId = game.getCombat().getDefendingPlayerId(creature.getId(), game);
    int count = 0;
    if (defenderId != null) {
        FilterCreaturePermanent bountyFilter = new FilterCreaturePermanent("creatures defending player controls with a bounty counter");
        bountyFilter.add(CounterType.BOUNTY.getPredicate());
        count = game.getBattlefield().countAll(bountyFilter, defenderId, game);
    }
    if (count == 0) {
        return false;
    }
    game.addEffect(new BoostSourceEffect(count, 0, Duration.WhileOnBattlefield), source);
    return true;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetOpponentsCreaturePermanent(mage.target.common.TargetOpponentsCreaturePermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) UUID(java.util.UUID)

Example 9 with BoostSourceEffect

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

the class LesserWerewolfEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
    // must be valid target
    Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
    if (controller != null && sourcePermanent != null && targetPermanent != null) {
        if (sourcePermanent.getPower().getValue() >= 1) {
            game.addEffect(new BoostSourceEffect(-1, 0, Duration.EndOfTurn), source);
            new AddCountersTargetEffect(new BoostCounter(0, -1), outcome).apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : BoostSourceEffect(mage.abilities.effects.common.continuous.BoostSourceEffect) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) BoostCounter(mage.counters.BoostCounter)

Example 10 with BoostSourceEffect

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

the class PainiacEffect method apply.

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

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