use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class LuminescentRainEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
if (player != null && player.choose(Outcome.BoostCreature, typeChoice, game)) {
FilterControlledPermanent filter = new FilterControlledPermanent();
filter.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
return new GainLifeEffect(new PermanentsOnBattlefieldCount(filter, 2)).apply(game, source);
}
return false;
}
use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class RighteousFuryEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int destroyedCreature = 0;
FilterCreaturePermanent filter = new FilterCreaturePermanent("all tapped creatures");
filter.add(TappedPredicate.TAPPED);
for (Permanent creature : game.getState().getBattlefield().getActivePermanents(filter, controller.getId(), game)) {
if (creature.destroy(source, game, false)) {
destroyedCreature++;
}
}
if (destroyedCreature > 0) {
new GainLifeEffect(destroyedCreature * 2).apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class ScentOfJasmineEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter));
if (!cost.pay(source, game, source, source.getControllerId(), true)) {
return false;
}
int xValue = cost.getNumberRevealedCards();
return new GainLifeEffect(2 * xValue).apply(game, source);
}
use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class TrevaTheRenewerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
ChoiceColor choice = new ChoiceColor();
if (controller.choose(outcome, choice, game)) {
game.informPlayers(controller.getLogName() + " chooses " + choice.getColor());
FilterPermanent filter = new FilterPermanent();
filter.add(new ColorPredicate(choice.getColor()));
int cardsWithColor = game.getBattlefield().count(filter, source.getSourceId(), controller.getId(), game);
if (cardsWithColor > 0) {
new GainLifeEffect(cardsWithColor).apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.GainLifeEffect in project mage by magefree.
the class JasmineSeerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter));
if (!cost.pay(source, game, source, source.getControllerId(), true)) {
return false;
}
int xValue = cost.getNumberRevealedCards();
return new GainLifeEffect(2 * xValue).apply(game, source);
}
Aggregations