Search in sources :

Example 26 with BoostTargetEffect

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

the class CatacombDragonEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
    if (permanent == null || !permanent.isCreature(game)) {
        return false;
    }
    int unBoost = -1 * Math.floorDiv(permanent.getPower().getValue(), 2);
    game.addEffect(new BoostTargetEffect(unBoost, 0), source);
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect)

Example 27 with BoostTargetEffect

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

the class HandOfVecnaEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null || player.getHand().size() < 1) {
        return false;
    }
    Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
    Permanent equipped = game.getPermanent(sourcePermanent != null ? sourcePermanent.getAttachedTo() : null);
    List<Permanent> chooseable = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
    if (equipped != null) {
        chooseable.add(equipped);
    }
    Permanent toBoost;
    switch(chooseable.size()) {
        case 0:
            return false;
        case 1:
            toBoost = chooseable.get(0);
            break;
        default:
            FilterPermanent filter = new FilterPermanent("a creature to give +X/+X to");
            filter.add(Predicates.or(chooseable.stream().map(permanent -> new MageObjectReferencePredicate(permanent, game)).collect(Collectors.toList())));
            TargetPermanent target = new TargetPermanent(filter);
            target.setNotTarget(true);
            player.choose(outcome, target, source.getSourceId(), game);
            toBoost = game.getPermanent(target.getFirstTarget());
    }
    int xValue = player.getHand().size();
    game.addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn).setTargetPointer(new FixedTarget(toBoost, game)), source);
    return true;
}
Also used : BeginningOfCombatTriggeredAbility(mage.abilities.common.BeginningOfCombatTriggeredAbility) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) CardsInControllerHandCount(mage.abilities.dynamicvalue.common.CardsInControllerHandCount) PayLifeCost(mage.abilities.costs.common.PayLifeCost) EquipAbility(mage.abilities.keyword.EquipAbility) OneShotEffect(mage.abilities.effects.OneShotEffect) Predicates(mage.filter.predicate.Predicates) MageObjectReferencePredicate(mage.filter.predicate.mageobject.MageObjectReferencePredicate) UUID(java.util.UUID) FilterPermanent(mage.filter.FilterPermanent) Collectors(java.util.stream.Collectors) Player(mage.players.Player) FixedTarget(mage.target.targetpointer.FixedTarget) CardSetInfo(mage.cards.CardSetInfo) Game(mage.game.Game) List(java.util.List) CardImpl(mage.cards.CardImpl) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) mage.constants(mage.constants) NamePredicate(mage.filter.predicate.mageobject.NamePredicate) TargetPermanent(mage.target.TargetPermanent) Ability(mage.abilities.Ability) FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) MageObjectReferencePredicate(mage.filter.predicate.mageobject.MageObjectReferencePredicate) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) TargetPermanent(mage.target.TargetPermanent)

Example 28 with BoostTargetEffect

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

the class RevengeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
    if (target != null && target.isCreature(game)) {
        ContinuousEffect effect = new BoostTargetEffect(4, 0, Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTarget(target.getId(), game));
        game.addEffect(effect, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetOpponentsCreaturePermanent(mage.target.common.TargetOpponentsCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 29 with BoostTargetEffect

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

the class ChooseYourWeaponEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    game.addEffect(new BoostTargetEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn), source);
    return true;
}
Also used : FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect)

Example 30 with BoostTargetEffect

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

the class FlunkEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(game.getControllerId(source.getFirstTarget()));
    if (player == null) {
        return false;
    }
    int xValue = Math.max(7 - player.getHand().size(), 0);
    game.addEffect(new BoostTargetEffect(-xValue, -xValue), source);
    return true;
}
Also used : Player(mage.players.Player) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect)

Aggregations

BoostTargetEffect (mage.abilities.effects.common.continuous.BoostTargetEffect)81 Permanent (mage.game.permanent.Permanent)58 FixedTarget (mage.target.targetpointer.FixedTarget)46 ContinuousEffect (mage.abilities.effects.ContinuousEffect)36 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)34 Player (mage.players.Player)31 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)16 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)10 TargetPermanent (mage.target.TargetPermanent)10 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)10 Card (mage.cards.Card)9 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)8 CardsImpl (mage.cards.CardsImpl)7 FilterPermanent (mage.filter.FilterPermanent)7 UUID (java.util.UUID)5 RevealTargetFromHandCost (mage.abilities.costs.common.RevealTargetFromHandCost)5 OneShotEffect (mage.abilities.effects.OneShotEffect)5 TargetCardInHand (mage.target.common.TargetCardInHand)5 Ability (mage.abilities.Ability)4 MageObject (mage.MageObject)3