use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class NicolBolasGodPharaohPlusTwoEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
if (opponent == null) {
return false;
}
Library library = opponent.getLibrary();
Card card;
do {
card = library.getFromTop(game);
if (card == null) {
continue;
}
opponent.moveCards(card, Zone.EXILED, source, game);
if (card.isLand(game)) {
continue;
}
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(card, game));
game.addEffect(effect, source);
break;
} while (library.hasCards() && card != null);
return true;
}
use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class ChangeCreatureTypeTargetEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true);
effect.setTargetPointer(new FixedTarget(targetPermanent, game));
game.addEffect(effect, source);
effect = new ChangeCreatureTypeTargetEffect(null, SubType.VAMPIRE, Duration.Custom);
effect.setTargetPointer(new FixedTarget(targetPermanent, game));
game.addEffect(effect, source);
return true;
}
return false;
}
use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class OverwhelmingStampedeInitEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int maxPower = 0;
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
if (perm.getPower().getValue() > maxPower) {
maxPower = perm.getPower().getValue();
}
}
ContinuousEffect effect = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent());
game.addEffect(effect, source);
if (maxPower != 0) {
effect = new BoostControlledEffect(maxPower, maxPower, Duration.EndOfTurn);
game.addEffect(effect, source);
}
return true;
}
use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class PyrrhicRevivalEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Set<Card> toBattlefield = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (Card card : player.getGraveyard().getCards(game)) {
if (card != null && card.isCreature(game)) {
toBattlefield.add(card);
ContinuousEffect effect = new EntersBattlefieldEffect(new AddCountersTargetEffect(CounterType.M1M1.createInstance()));
effect.setDuration(Duration.OneUse);
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
}
}
}
controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, false, false, true, null);
return true;
}
use of mage.abilities.effects.ContinuousEffect 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;
}
Aggregations