use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class BoostEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
ContinuousEffect effect = new BoostTargetEffect(amount, amount, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(effect, source);
return true;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class ErraticMutationEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
CardsImpl toReveal = new CardsImpl();
Card nonLandCard = null;
for (Card card : controller.getLibrary().getCards(game)) {
toReveal.add(card);
if (!card.isLand(game)) {
nonLandCard = card;
break;
}
}
// reveal cards
controller.revealCards(sourceObject.getIdName(), toReveal, game);
// the nonland card
if (nonLandCard != null) {
int boostValue = nonLandCard.getManaValue();
// unboost target
ContinuousEffect effect = new BoostTargetEffect(boostValue, -boostValue, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source), game));
game.addEffect(effect, source);
}
// put the cards on the bottom of the library in any order
return controller.putCardsOnBottomOfLibrary(toReveal, game, source, true);
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class FlareOfFaithEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
if (permanent.hasSubtype(SubType.HUMAN, game)) {
game.addEffect(new BoostTargetEffect(3, 3), source);
game.addEffect(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), source);
} else {
game.addEffect(new BoostTargetEffect(2, 2), source);
}
return true;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class InduceDespairEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
if (cost != null && creature != null) {
int cmcBoost = -1 * cost.manaValues;
ContinuousEffect effect = new BoostTargetEffect(cmcBoost, cmcBoost, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game)));
game.addEffect(effect, source);
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class NightshadeAssassinEffect 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) {
return false;
}
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(ObjectColor.BLACK));
int blackCards = controller.getHand().count(filter, source.getSourceId(), source.getControllerId(), game);
int cardsToReveal = controller.getAmount(0, blackCards, "Reveal how many black cards?", game);
game.informPlayers(controller.getLogName() + " chooses to reveal " + cardsToReveal + " black cards.");
if (cardsToReveal > 0) {
TargetCardInHand target = new TargetCardInHand(cardsToReveal, cardsToReveal, filter);
if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
controller.revealCards(sourceObject.getIdName(), new CardsImpl(target.getTargets()), game);
int unboost = target.getTargets().size() * -1;
ContinuousEffect effect = new BoostTargetEffect(unboost, unboost, Duration.EndOfTurn);
effect.setTargetPointer(getTargetPointer());
game.addEffect(effect, source);
}
}
return true;
}
Aggregations