use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class MoltenPrimordialEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
boolean result = false;
for (Target target : source.getTargets()) {
if (target instanceof TargetCreaturePermanent) {
Permanent targetCreature = game.getPermanent(target.getFirstTarget());
if (targetCreature != null) {
ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn);
effect1.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect1, source);
ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect2.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect2, source);
targetCreature.untap(game);
result = true;
}
}
}
return result;
}
use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class NecromanticSelectionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && controller != null) {
Cards cards = new CardsImpl();
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, controller.getId(), source.getSourceId(), game)) {
permanent.destroy(source, game, false);
// Meren of the Clan Nel Toth bug #8515
game.checkStateAndTriggered();
if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
cards.add(permanent);
}
}
FilterCard filter = new FilterCreatureCard("creature card put into a graveyard with " + sourceObject.getLogName());
List<Predicate<MageObject>> cardIdPredicates = new ArrayList<>();
for (UUID cardId : cards) {
cardIdPredicates.add(new CardIdPredicate(cardId));
}
filter.add(Predicates.or(cardIdPredicates));
Target target = new TargetCardInGraveyard(filter);
target.setNotTarget(true);
if (controller.chooseTarget(Outcome.Benefit, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
ContinuousEffect effect = new BecomesBlackZombieAdditionEffect();
effect.setText("It's a black Zombie in addition to its other colors and types");
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class RapidFireEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && permanent != null) {
if (!permanent.getAbilities().containsClass(RampageAbility.class)) {
ContinuousEffect effect = new GainAbilityTargetEffect(new RampageAbility(2), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
}
return false;
}
use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class RohgahhOfKherKeepEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player == null) {
return false;
}
Cost cost = new ManaCostsImpl("{R}{R}{R}");
if (!cost.canPay(source, source, player.getId(), game) || !player.chooseUse(Outcome.Benefit, "Pay {R}{R}{R}?", source, game) || !cost.pay(source, game, source, player.getId(), false)) {
TargetOpponent target = new TargetOpponent();
Player opponent = null;
if (target.choose(Outcome.Detriment, player.getId(), source.getSourceId(), game)) {
opponent = game.getPlayer(target.getFirstTarget());
}
new TapAllEffect(filter).apply(game, source);
if (permanent != null) {
permanent.tap(source, game);
}
if (opponent != null) {
new GainControlAllEffect(Duration.Custom, filter, opponent.getId()).apply(game, source);
if (permanent != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true, opponent.getId());
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.ContinuousEffect in project mage by magefree.
the class RookieMistakeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
ContinuousEffect effect = new BoostTargetEffect(0, 2, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (permanent != null) {
ContinuousEffect effect = new BoostTargetEffect(-2, 0, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
return true;
}
Aggregations