use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class ExponentialGrowthEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
int xValue = source.getManaCostsToPay().getX();
int multiplier = 1;
for (int i = 0; i < xValue; i++) {
multiplier = CardUtil.overflowMultiply(multiplier, 2);
}
multiplier = CardUtil.overflowDec(multiplier, 1);
game.addEffect(new BoostTargetEffect(CardUtil.overflowMultiply(multiplier, permanent.getPower().getValue()), 0, Duration.EndOfTurn), source);
return true;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class FistfulOfForceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && creature != null) {
ContinuousEffect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect, source);
if (ClashEffect.getInstance().apply(game, source)) {
game.addEffect(effect.copy(), source);
effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
game.addEffect(effect.copy(), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class PhantasmalMountDelayedTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
ContinuousEffect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(effect, source);
Effect sacrificeCreatureEffect = new SacrificeTargetEffect();
Effect sacrificePhantasmalMountEffect = new SacrificeTargetEffect();
ContinuousEffect gainAbility = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
gainAbility.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(gainAbility, source);
sacrificeCreatureEffect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
sacrificePhantasmalMountEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
DelayedTriggeredAbility dTA = new PhantasmalMountDelayedTriggeredAbility(sacrificeCreatureEffect, source.getSourceId());
DelayedTriggeredAbility dTA2 = new PhantasmalMountDelayedTriggeredAbility(sacrificePhantasmalMountEffect, source.getFirstTarget());
game.addDelayedTriggeredAbility(dTA, source);
game.addDelayedTriggeredAbility(dTA2, source);
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class SigardianZealotEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (player == null || permanent == null) {
return false;
}
int power = permanent.getPower().getValue();
if (power == 0) {
return false;
}
TargetPermanent target = new TargetCreaturesWithDifferentPowers();
player.choose(outcome, target, source.getSourceId(), game);
Cards cards = new CardsImpl(target.getTargets());
if (cards.isEmpty()) {
return false;
}
game.addEffect(new BoostTargetEffect(power, power).setTargetPointer(new FixedTargets(cards, game)), source);
game.addEffect(new GainAbilityTargetEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(new FixedTargets(cards, game)), source);
return true;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class TrepanationBladeDiscardEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(equipment.getAttachedTo());
if (creature == null) {
return false;
}
UUID defenderId = game.getCombat().getDefenderId(creature.getId());
Player defendingPlayer = game.getPlayer(defenderId);
if (defendingPlayer == null) {
return false;
}
CardsImpl cards = new CardsImpl();
for (Card card : defendingPlayer.getLibrary().getCards(game)) {
cards.add(card);
if (card.isLand(game)) {
break;
}
}
defendingPlayer.revealCards(equipment.getName(), cards, game);
defendingPlayer.moveCards(cards, Zone.GRAVEYARD, source, game);
if (!cards.isEmpty()) {
ContinuousEffect effect = new BoostTargetEffect(cards.size(), 0, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature, game));
game.addEffect(effect, source);
}
return true;
}
return false;
}
Aggregations