Some cleanup and minor rework.

This commit is contained in:
LevelX2 2016-01-18 08:18:17 +01:00
parent 2985fb8af1
commit f3154fab54
89 changed files with 358 additions and 569 deletions

View file

@ -98,10 +98,7 @@ class SlaveOfBolasEffect extends OneShotEffect {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice this", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -27,6 +27,7 @@
*/
package mage.sets.avacynrestored;
import java.util.ArrayList;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
@ -42,7 +43,7 @@ import mage.constants.Rarity;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
/**
*
@ -88,14 +89,16 @@ class ThatcherRevoltEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
RedHumanToken token = new RedHumanToken();
token.putOntoBattlefield(3, game, source.getSourceId(), source.getControllerId());
ArrayList<Permanent> toSacrifice = new ArrayList<>();
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect();
sacrificeEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
toSacrifice.add(tokenPermanent);
}
}
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect();
sacrificeEffect.setTargetPointer(new FixedTargets(toSacrifice, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
return true;
}
}

View file

@ -79,15 +79,15 @@ public class ShireiShizosCaretaker extends CardImpl {
}
class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl {
ShireiShizosCaretakerTriggeredAbility(UUID shireiId) {
super(Zone.BATTLEFIELD, new ShireiShizosCaretakerEffect(shireiId), false);
}
ShireiShizosCaretakerTriggeredAbility(final ShireiShizosCaretakerTriggeredAbility ability) {
super(ability);
}
@Override
public ShireiShizosCaretakerTriggeredAbility copy() {
return new ShireiShizosCaretakerTriggeredAbility(this);
@ -97,19 +97,19 @@ class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent LKIpermanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
Card card = game.getCard(zEvent.getTargetId());
if (card != null && LKIpermanent != null &&
card.getOwnerId().equals(this.controllerId) &&
zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
card.getCardType().contains(CardType.CREATURE) &&
LKIpermanent.getPower().getValue() <= 1) {
if (card != null && LKIpermanent != null
&& card.getOwnerId().equals(this.controllerId)
&& zEvent.getToZone() == Zone.GRAVEYARD
&& zEvent.getFromZone() == Zone.BATTLEFIELD
&& card.getCardType().contains(CardType.CREATURE)
&& LKIpermanent.getPower().getValue() <= 1) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
}
@ -117,7 +117,7 @@ class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl {
}
return false;
}
@Override
public String getRule() {
return "Whenever a creature with power 1 or less is put into your graveyard from the battlefield, you may return that card to the battlefield at the beginning of the next end step if Shirei, Shizo's Caretaker is still on the battlefield.";
@ -125,25 +125,25 @@ class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl {
}
class ShireiShizosCaretakerEffect extends OneShotEffect {
protected final UUID shireiId;
ShireiShizosCaretakerEffect(UUID shireiId) {
super(Outcome.PutCreatureInPlay);
this.staticText = "you may return that card to the battlefield at the beginning of the next end step if {this} is still on the battlefield.";
this.shireiId = shireiId;
}
ShireiShizosCaretakerEffect(final ShireiShizosCaretakerEffect effect) {
super(effect);
this.shireiId = effect.shireiId;
}
@Override
public ShireiShizosCaretakerEffect copy() {
return new ShireiShizosCaretakerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
@ -151,11 +151,8 @@ class ShireiShizosCaretakerEffect extends OneShotEffect {
Effect effect = new ShireiShizosCaretakerReturnEffect(shireiId);
effect.setText("return that card to the battlefield if {this} is still on the battlefield");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId()));
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;
@ -163,23 +160,23 @@ class ShireiShizosCaretakerEffect extends OneShotEffect {
}
class ShireiShizosCaretakerReturnEffect extends ReturnToBattlefieldUnderYourControlTargetEffect {
protected final UUID shireiId;
ShireiShizosCaretakerReturnEffect(UUID shireiId) {
this.shireiId = shireiId;
}
ShireiShizosCaretakerReturnEffect(final ShireiShizosCaretakerReturnEffect effect) {
super(effect);
this.shireiId = effect.shireiId;
}
@Override
public ShireiShizosCaretakerReturnEffect copy() {
return new ShireiShizosCaretakerReturnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
if (game.getBattlefield().containsPermanent(shireiId)) {

View file

@ -113,10 +113,7 @@ class FelhideSpiritbinderEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -57,7 +57,6 @@ public class SearingBlood extends CardImpl {
super(ownerId, 111, "Searing Blood", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}{R}");
this.expansionSetCode = "BNG";
// Searing Blood deals 2 damage to target creature. When that creature dies this turn, Searing Blood deals 3 damage to that creature's controller.
this.getSpellAbility().addEffect(new SearingBloodEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -92,10 +91,7 @@ class SearingBloodEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new SearingBloodDelayedTriggeredAbility(source.getFirstTarget());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return new DamageTargetEffect(2).apply(game, source);
}

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -58,7 +58,7 @@ public class HikariTwilightGuardian extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast a Spirit or Arcane spell, you may exile Hikari, Twilight Guardian. If you do, return it to the battlefield under its owner's control at the beginning of the next end step.
Effect effect = new ExileReturnToBattlefieldOwnerNextEndStepEffect();
Effect effect = new ExileReturnBattlefieldOwnerNextEndStepSourceEffect();
effect.setText("you may exile {this}. If you do, return it to the battlefield under its owner's control at the beginning of the next end step");
this.addAbility(new SpellCastControllerTriggeredAbility(effect, filter, true));
}

View file

@ -98,10 +98,7 @@ public class JunkyoBell extends CardImpl {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice boosted " + creature.getName(), source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(creature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -117,10 +117,7 @@ class TatsumaTheDragonsFangEffect extends OneShotEffect {
Effect returnEffect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
returnEffect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId())));
DelayedTriggeredAbility delayedAbility = new TatsumaTheDragonsFangTriggeredAbility(fixedTarget, returnEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}

View file

@ -115,10 +115,7 @@ class ThroughTheBreachEffect extends OneShotEffect {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + card.getName(), source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -60,6 +60,7 @@ import mage.target.targetpointer.FixedTarget;
public class AdarkarValkyrie extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature");
static {
filter.add(new AnotherPredicate());
}
@ -113,15 +114,11 @@ class AdarkarValkyrieEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new AdarkarValkyrieDelayedTriggeredAbility(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return false;
}
}
class AdarkarValkyrieDelayedTriggeredAbility extends DelayedTriggeredAbility {
protected FixedTarget fixedTarget;
@ -162,4 +159,3 @@ class AdarkarValkyrieDelayedTriggeredAbility extends DelayedTriggeredAbility {
return "When target creature other than Adarkar Valkyrie dies this turn, " + super.getRule();
}
}

View file

@ -57,7 +57,7 @@ import mage.watchers.common.AttackedThisTurnWatcher;
* @author LevelX2
*/
public class FuryOfTheHorde extends CardImpl {
private static final FilterCard filter = new FilterCard("two red cards");
static {
@ -68,15 +68,14 @@ public class FuryOfTheHorde extends CardImpl {
super(ownerId, 81, "Fury of the Horde", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{R}{R}");
this.expansionSetCode = "CSP";
// You may exile two red cards from your hand rather than pay Fury of the Horde's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(2, filter))));
// Untap all creatures that attacked this turn. After this main phase, there is an additional combat phase followed by an additional main phase.
this.getSpellAbility().addEffect(new FuryOfTheHordeUntapEffect());
this.getSpellAbility().addEffect(new FuryOfTheHordeAddPhasesEffect());
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
}
public FuryOfTheHorde(final FuryOfTheHorde card) {
@ -89,7 +88,6 @@ public class FuryOfTheHorde extends CardImpl {
}
}
class FuryOfTheHordeUntapEffect extends OneShotEffect {
public FuryOfTheHordeUntapEffect() {
@ -110,7 +108,7 @@ class FuryOfTheHordeUntapEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Watcher watcher = game.getState().getWatchers().get("AttackedThisTurn");
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
Set<UUID> attackedThisTurn = ((AttackedThisTurnWatcher)watcher).getAttackedThisTurnCreatures();
Set<UUID> attackedThisTurn = ((AttackedThisTurnWatcher) watcher).getAttackedThisTurnCreatures();
for (UUID uuid : attackedThisTurn) {
Permanent permanent = game.getPermanent(uuid);
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
@ -141,21 +139,19 @@ class FuryOfTheHordeAddPhasesEffect extends OneShotEffect {
}
@Override
public boolean apply(Game game, Ability source) {
public boolean apply(Game game, Ability source) {
// 15.07.2006 If it's somehow not a main phase when Fury of the Horde resolves, all it does is untap all creatures that attacked that turn. No new phases are created.
if (TurnPhase.PRECOMBAT_MAIN.equals(game.getTurn().getPhaseType())
|| TurnPhase.POSTCOMBAT_MAIN.equals(game.getTurn().getPhaseType()) ) {
if (TurnPhase.PRECOMBAT_MAIN.equals(game.getTurn().getPhaseType())
|| TurnPhase.POSTCOMBAT_MAIN.equals(game.getTurn().getPhaseType())) {
// we can't add two turn modes at once, will add additional post combat on delayed trigger resolution
TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, TurnPhase.POSTCOMBAT_MAIN, false);
game.getState().getTurnMods().add(combat);
DelayedAddMainPhaseAbility delayedTriggeredAbility = new DelayedAddMainPhaseAbility();
delayedTriggeredAbility.setSourceId(source.getSourceId());
delayedTriggeredAbility.setControllerId(source.getControllerId());
delayedTriggeredAbility.setConnectedTurnMod(combat.getId());
game.addDelayedTriggeredAbility(delayedTriggeredAbility);
game.addDelayedTriggeredAbility(delayedTriggeredAbility, source);
return true;
}
return false;
return false;
}
}
@ -164,7 +160,7 @@ class DelayedAddMainPhaseAbility extends DelayedTriggeredAbility {
private UUID connectedTurnMod;
private boolean enabled;
public DelayedAddMainPhaseAbility() {
super(null, Duration.EndOfTurn);
this.usesStack = false; // don't show this to the user

View file

@ -96,10 +96,7 @@ class ScatteringStrokeEffect extends OneShotEffect {
Effect effect = new AddManaToManaPoolSourceControllerEffect(new Mana(0, 0, 0, 0, 0, 0, 0, spell.getConvertedManaCost()));
AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfMainPhaseDelayedTriggeredAbility(effect, true, TargetController.YOU, AtTheBeginOfMainPhaseDelayedTriggeredAbility.PhaseSelection.NEXT_MAIN);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -56,12 +56,11 @@ public class ArcaneDenial extends CardImpl {
super(ownerId, 28, "Arcane Denial", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "C13";
// Counter target spell. Its controller may draw up to two cards at the beginning of the next turn's upkeep.
this.getSpellAbility().addEffect(new ArcaneDenialEffect());
this.getSpellAbility().addTarget(new TargetSpell());
// You draw a card at the beginning of the next turn's upkeep.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(1)),false));
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(1)), false));
}
public ArcaneDenial(final ArcaneDenial card) {
@ -78,7 +77,7 @@ class ArcaneDenialEffect extends OneShotEffect {
public ArcaneDenialEffect() {
super(Outcome.Detriment);
staticText ="Counter target spell. Its controller may draw up to two cards at the beginning of the next turn's upkeep";
staticText = "Counter target spell. Its controller may draw up to two cards at the beginning of the next turn's upkeep";
}
public ArcaneDenialEffect(final ArcaneDenialEffect effect) {
@ -107,9 +106,7 @@ class ArcaneDenialEffect extends OneShotEffect {
effect.setTargetPointer(new FixedTarget(controller.getId()));
effect.setText("Its controller may draw up to two cards");
DelayedTriggeredAbility ability = new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(effect);
ability.setSourceId(source.getSourceId());
ability.setControllerId(controller.getId());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
}
return countered;
}

View file

@ -37,8 +37,6 @@ import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -67,7 +65,6 @@ public class Flickerform extends CardImpl {
this.expansionSetCode = "C13";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
@ -92,6 +89,7 @@ public class Flickerform extends CardImpl {
class FlickerformEffect extends OneShotEffect {
private static final FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent();
static {
filter.add(new SubtypePredicate("Aura"));
}
@ -122,7 +120,7 @@ class FlickerformEffect extends OneShotEffect {
if (enchantedCreature != null) {
UUID exileZoneId = UUID.randomUUID();
enchantedCreature.moveToExile(exileZoneId, enchantment.getName(), source.getSourceId(), game);
for (UUID attachementId: enchantedCreature.getAttachments()) {
for (UUID attachementId : enchantedCreature.getAttachments()) {
Permanent attachment = game.getPermanent(attachementId);
if (attachment != null && filter.match(attachment, game)) {
attachment.moveToExile(exileZoneId, enchantment.getName(), source.getSourceId(), game);
@ -130,13 +128,10 @@ class FlickerformEffect extends OneShotEffect {
}
if (!(enchantedCreature instanceof Token)) {
// At the beginning of the next end step, return that card to the battlefield under its owner's control.
// If you do, return the other cards exiled this way to the battlefield under their owners' control attached to that creature
// If you do, return the other cards exiled this way to the battlefield under their owners' control attached to that creature
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new FlickerformReturnEffect(enchantedCreature.getId(), exileZoneId));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
@ -149,6 +144,7 @@ class FlickerformEffect extends OneShotEffect {
class FlickerformReturnEffect extends OneShotEffect {
private static final FilterCard filterAura = new FilterCard();
static {
filterAura.add(new CardTypePredicate(CardType.ENCHANTMENT));
filterAura.add(new SubtypePredicate("Aura"));
@ -183,7 +179,7 @@ class FlickerformReturnEffect extends OneShotEffect {
enchantedCard.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), enchantedCard.getOwnerId());
Permanent newPermanent = game.getPermanent(enchantedCardId);
if (newPermanent != null) {
for(Card enchantment : exileZone.getCards(game)) {
for (Card enchantment : exileZone.getCards(game)) {
if (filterAura.match(enchantment, game)) {
boolean canTarget = false;
for (Target target : enchantment.getSpellAbility().getTargets()) {

View file

@ -60,7 +60,6 @@ public class Reincarnation extends CardImpl {
super(ownerId, 166, "Reincarnation", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{G}{G}");
this.expansionSetCode = "C13";
// Choose target creature. When that creature dies this turn, return a creature card from its owner's graveyard to the battlefield under the control of that creature's owner.
this.getSpellAbility().addEffect(new ReincarnationEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -95,10 +94,7 @@ class ReincarnationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new ReincarnationDelayedTriggeredAbility(targetPointer.getFirst(game, source));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}
@ -175,7 +171,7 @@ class ReincarnationDelayedEffect extends OneShotEffect {
filter.add(new OwnerIdPredicate(player.getId()));
Target targetCreature = new TargetCardInGraveyard(filter);
if (targetCreature.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseTarget(outcome, targetCreature, source, game)) {
&& controller.chooseTarget(outcome, targetCreature, source, game)) {
Card card = game.getCard(targetCreature.getFirstTarget());
if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) {
return card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), player.getId());

View file

@ -35,11 +35,11 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -51,6 +51,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -59,6 +60,7 @@ import mage.target.common.TargetCreaturePermanent;
public class RoonOfTheHiddenRealm extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature");
static {
filter.add(new AnotherPredicate());
}
@ -118,22 +120,19 @@ class RoonOfTheHiddenRealmEffect extends OneShotEffect {
if (controller != null && sourceObject != null) {
if (getTargetPointer().getFirst(game, source) != null) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (permanent != null) {
UUID exileId = UUID.randomUUID();
if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
if (card != null) {
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(card.getOwnerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
}
int zcc = permanent.getZoneChangeCounter(game);
if (controller.moveCards(permanent, Zone.EXILED, source, game)) {
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
effect.setTargetPointer(new FixedTarget(permanent.getId(), zcc + 1));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
}
}
return true;
}
}
return false;
}
}

View file

@ -110,10 +110,7 @@ class FeldonOfTheThirdPathEffect extends OneShotEffect {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice the token at the beginning of the next end step", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(addedToken, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -27,6 +27,7 @@
*/
package mage.sets.commander2014;
import java.util.ArrayList;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -50,7 +51,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
/**
*
@ -111,19 +112,18 @@ class WakeTheDeadReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEff
if (controller != null) {
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
controller.moveCards(cards, Zone.BATTLEFIELD, source, game);
ArrayList<Permanent> toSacrifice = new ArrayList<>(cards.size());
for (UUID targetId : cards) {
Permanent creature = game.getPermanent(targetId);
if (creature != null) {
Effect effect = new SacrificeTargetEffect("Sacrifice those creatures at the beginning of the next end step", source.getControllerId());
effect.setTargetPointer(new FixedTarget(creature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
toSacrifice.add(creature);
}
}
Effect effect = new SacrificeTargetEffect("Sacrifice those creatures at the beginning of the next end step", source.getControllerId());
effect.setTargetPointer(new FixedTargets(toSacrifice, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -44,6 +44,7 @@ import mage.game.combat.CombatGroup;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
/**
*
@ -108,10 +109,10 @@ class MirrorMatchEffect extends OneShotEffect {
group.addBlockerToGroup(addedToken.getId(), attackerId, game);
isCreature = true;
}
ExileTargetEffect exileEffect = new ExileTargetEffect("Exile the token at end of combat");
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
}
ExileTargetEffect exileEffect = new ExileTargetEffect("Exile those tokens at end of combat");
exileEffect.setTargetPointer(new FixedTargets(effect.getAddedPermanent(), game));
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
if (isCreature) {
group.pickBlockerOrder(attacker.getControllerId(), game);
}

View file

@ -116,9 +116,9 @@ class HavengulLichPlayEffect extends AsThoughEffectImpl {
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
UUID targetId = getTargetPointer().getFirst(game, source);
if (targetId != null) {
return targetId.equals(objectId) &&
source.getControllerId().equals(affectedControllerId) &&
Zone.GRAVEYARD.equals(game.getState().getZone(objectId));
return targetId.equals(objectId)
&& source.getControllerId().equals(affectedControllerId)
&& Zone.GRAVEYARD.equals(game.getState().getZone(objectId));
} else {
// the target card has changed zone meanwhile, so the effect is no longer needed
discard();
@ -142,9 +142,7 @@ class HavengulLichPlayedEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility ability = new HavengulLichDelayedTriggeredAbility(getTargetPointer().getFirst(game, source));
ability.setSourceId(source.getSourceId());
ability.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
return true;
}
@ -160,7 +158,7 @@ class HavengulLichDelayedTriggeredAbility extends DelayedTriggeredAbility {
private UUID cardId;
public HavengulLichDelayedTriggeredAbility (UUID cardId) {
public HavengulLichDelayedTriggeredAbility(UUID cardId) {
super(new HavengulLichEffect(cardId), Duration.EndOfTurn);
this.cardId = cardId;
}
@ -216,7 +214,7 @@ class HavengulLichEffect extends ContinuousEffectImpl {
Permanent permanent = game.getPermanent(source.getSourceId());
Card card = game.getCard(cardId);
if (permanent != null && card != null) {
for (ActivatedAbility ability: card.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
for (ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
permanent.addAbility(ability, source.getSourceId(), game);
}
}

View file

@ -83,7 +83,7 @@ class LoyalCatharEffect extends OneShotEffect {
private static final String effectText = "return it to the battlefield transformed under your control at the beginning of the next end step";
LoyalCatharEffect ( ) {
LoyalCatharEffect() {
super(Outcome.Benefit);
staticText = effectText;
}
@ -96,10 +96,7 @@ class LoyalCatharEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
//create delayed triggered ability
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnLoyalCatharEffect(source.getSourceId()));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}

View file

@ -44,10 +44,10 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
/**
*
@ -96,20 +96,15 @@ class SeanceEffect extends OneShotEffect {
Card card = game.getCard(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null) {
if (controller.moveCards(card, null, Zone.EXILED, source, game)) {
if (controller.moveCards(card, Zone.EXILED, source, game)) {
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(source.getControllerId(), null, false);
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
effect.setAdditionalSubType("Spirit");
effect.apply(game, source);
for (Permanent addedToken : effect.getAddedPermanent()) {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
}
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTargets(effect.getAddedPermanent(), game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -55,7 +55,6 @@ public class SuddenDisappearance extends CardImpl {
super(ownerId, 23, "Sudden Disappearance", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{W}");
this.expansionSetCode = "DKA";
// Exile all nonland permanents target player controls. Return the exiled cards to the battlefield under their owner's control at the beginning of the next end step.
this.getSpellAbility().addEffect(new SuddenDisappearanceEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
@ -96,10 +95,7 @@ class SuddenDisappearanceEffect extends OneShotEffect {
controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
}
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
@ -55,7 +55,7 @@ public class AEtherling extends CardImpl {
this.toughness = new MageInt(5);
// {U}: Exile AEtherling. Return it to the battlefield under its owner's control at the beginning of the next end step.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnToBattlefieldOwnerNextEndStepEffect(true), new ManaCostsImpl("{U}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true), new ManaCostsImpl("{U}")));
// {U}: AEtherling can't be blocked this turn
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedSourceEffect(Duration.EndOfTurn), new ManaCostsImpl("{U}")));
// {1}: AEtherling gets +1/-1 until end of turn.

View file

@ -28,12 +28,6 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -48,7 +42,12 @@ import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -67,6 +66,7 @@ public class LegionsInitiative extends CardImpl {
private static final FilterCreaturePermanent filterRedCreature = new FilterCreaturePermanent("Red creatures");
private static final FilterCreaturePermanent filterWhiteCreature = new FilterCreaturePermanent("White creatures");
static {
filterRedCreature.add(new ColorPredicate(ObjectColor.RED));
filterWhiteCreature.add(new ColorPredicate(ObjectColor.WHITE));
@ -76,13 +76,12 @@ public class LegionsInitiative extends CardImpl {
super(ownerId, 81, "Legion's Initiative", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT}, "{R}{W}");
this.expansionSetCode = "DGM";
// Red creatures you control get +1/+0.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.WhileOnBattlefield, filterRedCreature)));
// White creatures you control get +0/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(0, 1, Duration.WhileOnBattlefield, filterWhiteCreature)));
// {R}{W}, Exile Legion's Initiative: Exile all creatures you control. At the beginning of the next combat, return those cards to the battlefield under their owner's control and those creatures gain haste until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LegionsInitiativeExileEffect(), new ManaCostsImpl("{R}{W}"));
ability.addCost(new ExileSourceCost());
@ -102,6 +101,7 @@ public class LegionsInitiative extends CardImpl {
class LegionsInitiativeExileEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent("all creatures you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new CardTypePredicate(CardType.CREATURE));
@ -129,10 +129,7 @@ class LegionsInitiativeExileEffect extends OneShotEffect {
if (creatureExiled) {
//create delayed triggered ability
AtTheBeginOfCombatDelayedTriggeredAbility delayedAbility = new AtTheBeginOfCombatDelayedTriggeredAbility(new LegionsInitiativeReturnFromExileEffect());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return true;
@ -165,7 +162,7 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect {
ExileZone exile = game.getExile().getExileZone(source.getSourceId());
if (exile != null) {
exile = exile.copy();
for (UUID cardId: exile) {
for (UUID cardId : exile) {
Card card = game.getCard(cardId);
card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
Permanent returnedCreature = game.getPermanent(cardId);

View file

@ -28,11 +28,6 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfMainPhaseDelayedTriggeredAbility;
@ -41,6 +36,10 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
@ -56,7 +55,6 @@ public class PlasmCapture extends CardImpl {
super(ownerId, 91, "Plasm Capture", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{G}{G}{U}{U}");
this.expansionSetCode = "DGM";
// Counter target spell. At the beginning of your next precombat main phase, add X mana in any combination of colors to your mana pool, where X is that spell's converted mana cost.
this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addEffect(new PlasmCaptureCounterEffect());
@ -95,12 +93,9 @@ class PlasmCaptureCounterEffect extends OneShotEffect {
game.getStack().counter(getTargetPointer().getFirst(game, source), source.getSourceId(), game);
// mana gets added also if counter is not successful
int mana = spell.getConvertedManaCost();
AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility =
new AtTheBeginOfMainPhaseDelayedTriggeredAbility(new PlasmCaptureManaEffect(mana), false, TargetController.YOU, PhaseSelection.NEXT_PRECOMBAT_MAIN);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfMainPhaseDelayedTriggeredAbility(new PlasmCaptureManaEffect(mana), false, TargetController.YOU, PhaseSelection.NEXT_PRECOMBAT_MAIN);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;
@ -130,9 +125,9 @@ class PlasmCaptureManaEffect extends ManaEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if(player != null){
if (player != null) {
Mana mana = new Mana();
for(int i = 0; i < amountOfMana; i++){
for (int i = 0; i < amountOfMana; i++) {
ChoiceColor choiceColor = new ChoiceColor();
while (!player.choose(Outcome.Benefit, choiceColor, game)) {
if (!player.canRespond()) {

View file

@ -131,10 +131,7 @@ class SwiftWarkiteEffect extends OneShotEffect {
Effect effect2 = new ReturnToHandTargetEffect();
effect2.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game)));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2);
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
}
@ -152,10 +149,7 @@ class SwiftWarkiteEffect extends OneShotEffect {
Effect effect2 = new ReturnToHandTargetEffect();
effect2.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game)));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect2);
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
}

View file

@ -60,7 +60,7 @@ public class WavesOfAggression extends CardImpl {
// Untap all creatures that attacked this turn. After this main phase, there is an additional combat phase followed by an additional main phase.
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
this.getSpellAbility().addEffect(new WavesOfAggressionUntapEffect());
this.getSpellAbility().addEffect(new WavesOfAggressionAddPhasesEffect());
this.getSpellAbility().addEffect(new WavesOfAggressionAddPhasesEffect());
// Retrace
this.addAbility(new RetraceAbility(this));
}
@ -132,10 +132,8 @@ class WavesOfAggressionAddPhasesEffect extends OneShotEffect {
TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, TurnPhase.POSTCOMBAT_MAIN, false);
game.getState().getTurnMods().add(combat);
WavesOfAggressionDelayedAddMainPhaseAbility delayedTriggeredAbility = new WavesOfAggressionDelayedAddMainPhaseAbility();
delayedTriggeredAbility.setSourceId(source.getSourceId());
delayedTriggeredAbility.setControllerId(source.getControllerId());
delayedTriggeredAbility.setConnectedTurnMod(combat.getId());
game.addDelayedTriggeredAbility(delayedTriggeredAbility);
game.addDelayedTriggeredAbility(delayedTriggeredAbility, source);
return true;
}
return false;

View file

@ -27,6 +27,7 @@
*/
package mage.sets.fatereforged;
import java.util.ArrayList;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
@ -48,7 +49,7 @@ import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
/**
*
@ -101,20 +102,19 @@ class RallyTheAncestorsEffect extends OneShotEffect {
filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, xValue + 1));
Set<Card> cards = player.getGraveyard().getCards(filter, game);
player.moveCards(cards, Zone.BATTLEFIELD, source, game);
ArrayList<Permanent> toExile = new ArrayList<>(cards.size());
for (Card card : cards) {
if (card != null) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
Effect exileEffect = new ExileTargetEffect("Exile those creatures at the beginning of your next upkeep");
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
toExile.add(permanent);
}
}
}
Effect exileEffect = new ExileTargetEffect("Exile those creatures at the beginning of your next upkeep");
exileEffect.setTargetPointer(new FixedTargets(toExile, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -30,7 +30,7 @@ package mage.sets.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
@ -58,7 +58,7 @@ public class Saltskitter extends CardImpl {
this.toughness = new MageInt(4);
// Whenever another creature enters the battlefield, exile Saltskitter. Return Saltskitter to the battlefield under its owner's control at the beginning of the next end step.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(new ExileReturnToBattlefieldOwnerNextEndStepEffect(true), filter));
this.addAbility(new EntersBattlefieldAllTriggeredAbility(new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true), filter));
}
public Saltskitter(final Saltskitter card) {

View file

@ -35,7 +35,7 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -67,7 +67,7 @@ public class GhostCouncilOfOrzhova extends CardImpl {
this.addAbility(ability);
// {1}, Sacrifice a creature: Exile Ghost Council of Orzhova. Return it to the battlefield under its owner's control at the beginning of the next end step.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnToBattlefieldOwnerNextEndStepEffect(), new GenericManaCost(1));
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(), new GenericManaCost(1));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
this.addAbility(ability);
}

View file

@ -27,6 +27,8 @@
*/
package mage.sets.guildpact;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -34,19 +36,21 @@ import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbil
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
import mage.util.CardUtil;
/**
@ -96,23 +100,21 @@ class GhostwayEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && controller != null) {
Set<Card> toExile = new HashSet<>();
toExile.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game));
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
if (creature != null) {
int zcc = game.getState().getZoneChangeCounter(creature.getId());
controller.moveCardToExileWithInfo(creature, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
if (zcc == game.getState().getZoneChangeCounter(creature.getId()) - 1) {
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
effect.setTargetPointer(new FixedTarget(creature.getId(), zcc + 1));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
controller.moveCardsToExile(toExile, source, game, true, exileId, sourceObject.getIdName());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
}
Cards cardsToReturn = new CardsImpl();
for (Card exiled : toExile) {
if (((Permanent) exiled).getZoneChangeCounter(game) == game.getState().getZoneChangeCounter(exiled.getId()) - 1) {
cardsToReturn.add(exiled);
}
}
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
effect.setTargetPointer(new FixedTargets(cardsToReturn, game));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -45,7 +45,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author LoneFox
*
*/
public class Liberate extends CardImpl {
@ -83,13 +83,10 @@ class LiberateEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
MageObject sourceObject = game.getObject(source.getSourceId());
if(permanent != null && sourceObject != null) {
if(permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) {
if (permanent != null && sourceObject != null) {
if (permanent.moveToExile(source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game)) {
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -113,10 +113,7 @@ class SpinalEmbraceAddDelayedEffect extends OneShotEffect {
SpinalEmbraceSacrificeEffect sacrificeEffect = new SpinalEmbraceSacrificeEffect();
sacrificeEffect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -61,7 +61,6 @@ public class Skybind extends CardImpl {
super(ownerId, 25, "Skybind", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}");
this.expansionSetCode = "JOU";
// Constellation When Skybind or another enchantment enters the battlefield under your control, exile target nonenchantment permanent. Return that card to the battlefield under its owner's control at the beginning of the next end step.
Ability ability = new ConstellationAbility(new SkybindEffect(), false);
ability.addTarget(new TargetPermanent(filter));
@ -97,10 +96,7 @@ class SkybindEffect extends OneShotEffect {
if (permanent.moveToExile(source.getSourceId(), sourcePermanent.getName(), source.getSourceId(), game)) {
//create delayed triggered ability
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.sets.journeyintonyx;
import java.util.ArrayList;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -45,6 +46,7 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
/**
*
@ -94,23 +96,20 @@ class TwinflameCopyEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
ArrayList<Permanent> toExile = new ArrayList<>();
for (UUID creatureId : this.getTargetPointer().getTargets(game, source)) {
Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);
if (creature != null) {
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(source.getControllerId(), null, true);
effect.setTargetPointer(new FixedTarget(creature, game));
effect.apply(game, source);
for (Permanent addedToken : effect.getAddedPermanent()) {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
}
toExile.addAll(effect.getAddedPermanent());
}
}
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTargets(toExile, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
@ -55,7 +55,7 @@ public class AnuridBrushhopper extends CardImpl {
// Discard two cards: Exile Anurid Brushhopper. Return it to the battlefield under its owner's control at the beginning of the next end step.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new ExileReturnToBattlefieldOwnerNextEndStepEffect(true),
new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true),
new DiscardTargetCost(new TargetCardInHand(2, new FilterCard("two cards")))));
}

View file

@ -134,10 +134,7 @@ class KheruLichLordEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(fixedTarget);
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
KheruLichLordReplacementEffect replacementEffect = new KheruLichLordReplacementEffect();
replacementEffect.setTargetPointer(fixedTarget);

View file

@ -112,10 +112,7 @@ class HazezonTamarEntersEffect extends OneShotEffect {
Effect effect = new CreateTokenEffect(new HazezonTamarSandWarrior(), new PermanentsOnBattlefieldCount(new FilterControlledLandPermanent()));
effect.setText("put X 1/1 Sand Warrior creature tokens that are red, green, and white onto the battlefield, where X is the number of lands you control at that time");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -65,11 +65,10 @@ public class Berserk extends CardImpl {
super(ownerId, 94, "Berserk", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{G}");
this.expansionSetCode = "LEA";
// Cast Berserk only before the combat damage step. (Zone = all because it can be at least graveyard or hand)
this.addAbility(new SimpleStaticAbility(Zone.ALL, new BerserkReplacementEffect()), new CombatDamageStepStartedWatcher());
// Target creature gains trample and gets +X/+0 until end of turn, where X is its power.
// Target creature gains trample and gets +X/+0 until end of turn, where X is its power.
// At the beginning of the next end step, destroy that creature if it attacked this turn.
Effect effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
effect.setText("Target creature gains trample");
@ -94,6 +93,7 @@ public class Berserk extends CardImpl {
}
class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl {
BerserkReplacementEffect() {
super(Duration.EndOfGame, Outcome.Detriment);
staticText = "Cast {this} only before the combat damage step";
@ -171,10 +171,7 @@ class BerserkDestroyEffect extends OneShotEffect {
Effect effect = new BerserkDelayedDestroyEffect();
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;
@ -205,7 +202,7 @@ class BerserkDelayedDestroyEffect extends OneShotEffect {
if (permanent != null) {
Watcher watcher = game.getState().getWatchers().get("AttackedThisTurn");
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
if (((AttackedThisTurnWatcher)watcher).getAttackedThisTurnCreatures().contains(permanent.getId())) {
if (((AttackedThisTurnWatcher) watcher).getAttackedThisTurnCreatures().contains(permanent.getId())) {
return permanent.destroy(source.getSourceId(), game, false);
}
}

View file

@ -28,11 +28,6 @@
package mage.sets.magic2010;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -43,6 +38,11 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -100,10 +100,7 @@ class DragonWhelpEffect extends OneShotEffect {
if (amount == null) {
amount = 0;
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new DragonWhelpDelayedEffect());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
amount++;
game.getState().setValue(source.getSourceId().toString() + "DragonWhelp", amount);

View file

@ -27,6 +27,7 @@
*/
package mage.sets.magic2015;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -41,8 +42,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import java.util.UUID;
/**
*
* @author LevelX2
@ -76,7 +75,7 @@ class PhytotitanEffect extends OneShotEffect {
private static final String effectText = "return it to the battlefield tapped under its owner's control at the beginning of his or her next upkeep";
PhytotitanEffect ( ) {
PhytotitanEffect() {
super(Outcome.Benefit);
staticText = effectText;
}
@ -91,10 +90,7 @@ class PhytotitanEffect extends OneShotEffect {
Effect effect = new ReturnSourceFromGraveyardToBattlefieldEffect(true, true);
effect.setText(staticText);
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}

View file

@ -109,10 +109,7 @@ class FlameshadowConjuringEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -104,10 +104,7 @@ class TouchOfMoongloveAddTriggerEffect extends OneShotEffect {
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
if (permanent != null) {
DelayedTriggeredAbility delayedAbility = new TouchOfMoongloveDelayedTriggeredAbility(new MageObjectReference(permanent, game));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -112,10 +112,7 @@ class ShallowGraveEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
exileEffect.setTargetPointer(fixedTarget);
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
}

View file

@ -60,7 +60,7 @@ import mage.target.targetpointer.FixedTarget;
* @author fireshoes
*/
public class ZirilanOfTheClaw extends CardImpl {
public ZirilanOfTheClaw(UUID ownerId) {
super(ownerId, 204, "Zirilan of the Claw", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.expansionSetCode = "MIR";
@ -70,7 +70,7 @@ public class ZirilanOfTheClaw extends CardImpl {
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// {1}{R}{R}, {tap}: Search your library for a Dragon permanent card and put that card onto the battlefield. Then shuffle your library.
// {1}{R}{R}, {tap}: Search your library for a Dragon permanent card and put that card onto the battlefield. Then shuffle your library.
// That Dragon gains haste until end of turn. Exile it at the beginning of the next end step.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ZirilanOfTheClawEffect(), new ManaCostsImpl("{1}{R}{R}"));
ability.addCost(new TapSourceCost());
@ -125,10 +125,7 @@ class ZirilanOfTheClawEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD);
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
return true;

View file

@ -25,13 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mirrodin;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
@ -42,7 +38,9 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -53,7 +51,7 @@ import mage.game.permanent.Permanent;
*/
public class ClockworkCondor extends CardImpl {
public ClockworkCondor (UUID ownerId) {
public ClockworkCondor(UUID ownerId) {
super(ownerId, 154, "Clockwork Condor", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.expansionSetCode = "MRD";
this.subtype.add("Bird");
@ -64,7 +62,7 @@ public class ClockworkCondor extends CardImpl {
this.addAbility(new AttacksOrBlocksTriggeredAbility(new ClockworkCondorEffect(), false));
}
public ClockworkCondor (final ClockworkCondor card) {
public ClockworkCondor(final ClockworkCondor card) {
super(card);
}
@ -75,6 +73,7 @@ public class ClockworkCondor extends CardImpl {
}
class ClockworkCondorEffect extends OneShotEffect {
ClockworkCondorEffect() {
super(Outcome.UnboostCreature);
staticText = "remove a +1/+1 counter from {this} at end of combat";
@ -89,9 +88,7 @@ class ClockworkCondorEffect extends OneShotEffect {
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()));
ability.setSourceId(source.getSourceId());
ability.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
}
return false;
}

View file

@ -25,14 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mirrodin;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
@ -45,7 +40,10 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -56,7 +54,7 @@ import mage.game.permanent.Permanent;
*/
public class ClockworkDragon extends CardImpl {
public ClockworkDragon (UUID ownerId) {
public ClockworkDragon(UUID ownerId) {
super(ownerId, 155, "Clockwork Dragon", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{7}");
this.expansionSetCode = "MRD";
this.subtype.add("Dragon");
@ -68,7 +66,7 @@ public class ClockworkDragon extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new GenericManaCost(3)));
}
public ClockworkDragon (final ClockworkDragon card) {
public ClockworkDragon(final ClockworkDragon card) {
super(card);
}
@ -79,6 +77,7 @@ public class ClockworkDragon extends CardImpl {
}
class ClockworkDragonEffect extends OneShotEffect {
ClockworkDragonEffect() {
super(Outcome.UnboostCreature);
staticText = "remove a +1/+1 counter from {this} at end of combat";
@ -93,9 +92,7 @@ class ClockworkDragonEffect extends OneShotEffect {
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()));
ability.setSourceId(source.getSourceId());
ability.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
}
return false;
}

View file

@ -28,9 +28,6 @@
package mage.sets.mirrodin;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
@ -43,7 +40,9 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
@ -79,6 +78,7 @@ public class ClockworkVorrac extends CardImpl {
}
class ClockworkVorracEffect extends OneShotEffect {
ClockworkVorracEffect() {
super(Outcome.UnboostCreature);
staticText = "remove a +1/+1 counter from {this} at end of combat";
@ -93,9 +93,7 @@ class ClockworkVorracEffect extends OneShotEffect {
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()));
ability.setSourceId(source.getSourceId());
ability.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
}
return false;
}
@ -106,4 +104,3 @@ class ClockworkVorracEffect extends OneShotEffect {
}
}

View file

@ -28,11 +28,6 @@
package mage.sets.mirrodinbesieged;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
@ -44,6 +39,11 @@ import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -63,7 +63,7 @@ public class GruesomeEncore extends CardImpl {
super(ownerId, 44, "Gruesome Encore", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{B}");
this.expansionSetCode = "MBS";
// Put target creature card from an opponent's graveyard onto the battlefield under your control. It gains haste.
// Put target creature card from an opponent's graveyard onto the battlefield under your control. It gains haste.
this.getSpellAbility().addEffect(new GruesomeEncoreEffect());
// Exile it at the beginning of the next end step. If that creature would leave the battlefield, exile it instead of putting it anywhere else.
this.getSpellAbility().addEffect(new GruesomeEncoreReplacementEffect());
@ -109,10 +109,7 @@ class GruesomeEncoreEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}

View file

@ -84,7 +84,7 @@ public class ChancellorOfTheAnnex extends CardImpl {
class ChancellorOfTheAnnexEffect extends OneShotEffect {
public ChancellorOfTheAnnexEffect () {
public ChancellorOfTheAnnexEffect() {
super(Outcome.Benefit);
staticText = "when each opponent casts his or her first spell of the game, counter that spell unless that player pays {1}";
}
@ -97,9 +97,7 @@ class ChancellorOfTheAnnexEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
DelayedTriggeredAbility ability = new ChancellorOfTheAnnexDelayedTriggeredAbility(opponentId);
ability.setSourceId(source.getSourceId());
ability.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
}
return true;
}
@ -115,7 +113,7 @@ class ChancellorOfTheAnnexDelayedTriggeredAbility extends DelayedTriggeredAbilit
private final UUID playerId;
ChancellorOfTheAnnexDelayedTriggeredAbility (UUID playerId) {
ChancellorOfTheAnnexDelayedTriggeredAbility(UUID playerId) {
super(new CounterUnlessPaysEffect(new GenericManaCost(1)));
this.playerId = playerId;
}

View file

@ -54,7 +54,6 @@ public class AstralSlide extends CardImpl {
super(ownerId, 4, "Astral Slide", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
this.expansionSetCode = "ONS";
// Whenever a player cycles a card, you may exile target creature. If you do, return that card to the battlefield under its owner's control at the beginning of the next end step.
Ability ability = new CycleAllTriggeredAbility(new AstralSlideEffect(), true);
ability.addTarget(new TargetCreaturePermanent());
@ -71,7 +70,6 @@ public class AstralSlide extends CardImpl {
}
}
class AstralSlideEffect extends OneShotEffect {
public AstralSlideEffect() {
@ -94,10 +92,7 @@ class AstralSlideEffect extends OneShotEffect {
if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
//create delayed triggered ability
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD, false));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -99,10 +99,7 @@ class FatalFrenzyEffect extends OneShotEffect {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice this", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(targetCreature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -35,7 +35,7 @@ import mage.abilities.condition.common.SourceOnBattlefieldCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -97,7 +97,7 @@ class FreneticSliverEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
if (player.flipCoin(game)) {
return new ExileReturnToBattlefieldOwnerNextEndStepEffect(true).apply(game, source);
return new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true).apply(game, source);
} else {
Permanent perm = game.getPermanent(source.getSourceId());
if (perm != null) {

View file

@ -110,10 +110,7 @@ class GraveBetrayalTriggeredAbility extends TriggeredAbilityImpl {
Effect effect = new GraveBetrayalEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(this.getSourceId());
delayedAbility.setControllerId(this.getControllerId());
delayedAbility.setSourceObject(this.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, this);
return true;
}
}

View file

@ -116,10 +116,7 @@ class JaceArchitectOfThoughtStartEffect1 extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new JaceArchitectOfThoughtDelayedTriggeredAbility(game.getTurnNum());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -28,21 +28,21 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.abilities.effects.OneShotEffect;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.cards.CardImpl;
/**
*
@ -132,11 +132,8 @@ class ArrogantBloodlordEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
AtTheEndOfCombatDelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect());
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(source.getSourceId()));
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -111,10 +111,7 @@ class SplinterTwinEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -55,7 +55,6 @@ public class WorldAtWar extends CardImpl {
super(ownerId, 172, "World at War", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
this.expansionSetCode = "ROE";
// After the first postcombat main phase this turn, there's an additional combat phase followed by an additional main phase. At the beginning of that combat, untap all creatures that attacked this turn.
this.getSpellAbility().addEffect(new WorldAtWarEffect());
@ -95,10 +94,8 @@ class WorldAtWarEffect extends OneShotEffect {
TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, TurnPhase.POSTCOMBAT_MAIN, false);
game.getState().getTurnMods().add(combat);
UntapDelayedTriggeredAbility delayedTriggeredAbility = new UntapDelayedTriggeredAbility();
delayedTriggeredAbility.setSourceId(source.getSourceId());
delayedTriggeredAbility.setControllerId(source.getControllerId());
delayedTriggeredAbility.setConnectedTurnMod(combat.getId());
game.addDelayedTriggeredAbility(delayedTriggeredAbility);
game.addDelayedTriggeredAbility(delayedTriggeredAbility, source);
return true;
}
@ -108,7 +105,7 @@ class UntapDelayedTriggeredAbility extends DelayedTriggeredAbility {
private UUID connectedTurnMod;
private boolean enabled;
public UntapDelayedTriggeredAbility() {
super(new UntapAttackingThisTurnEffect());
}
@ -173,7 +170,7 @@ class UntapAttackingThisTurnEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Watcher watcher = game.getState().getWatchers().get("AttackedThisTurn");
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
Set<UUID> attackedThisTurn = ((AttackedThisTurnWatcher)watcher).getAttackedThisTurnCreatures();
Set<UUID> attackedThisTurn = ((AttackedThisTurnWatcher) watcher).getAttackedThisTurnCreatures();
for (UUID uuid : attackedThisTurn) {
Permanent permanent = game.getPermanent(uuid);
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
@ -185,5 +182,3 @@ class UntapAttackingThisTurnEffect extends OneShotEffect {
}
}

View file

@ -102,10 +102,7 @@ class FootstepsOfTheGoryoEffect extends OneShotEffect {
Effect sacrificeEffect = new SacrificeTargetEffect("Sacrifice that creature at the beginning of next end step", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
}

View file

@ -104,10 +104,7 @@ class ArgentSphinxEffect extends OneShotEffect {
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -27,24 +27,27 @@
*/
package mage.sets.scarsofmirrodin;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -52,6 +55,12 @@ import java.util.UUID;
*/
public class GlimmerpointStag extends CardImpl {
private final static FilterPermanent filter = new FilterPermanent("another target permanent");
static {
filter.add(new AnotherPredicate());
}
public GlimmerpointStag(UUID ownerId) {
super(ownerId, 9, "Glimmerpoint Stag", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.expansionSetCode = "SOM";
@ -60,10 +69,12 @@ public class GlimmerpointStag extends CardImpl {
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
Target etbTarget = new TargetPermanent();
// When Glimmerpoint Stag enters the battlefield, exile another target permanent. Return that card to the battlefield under its owner's control at the beginning of the next end step.
Ability etbAbility = new EntersBattlefieldTriggeredAbility(new GlimmerpointStagEffect());
etbAbility.addTarget(etbTarget);
etbAbility.addTarget(new TargetPermanent(filter));
this.addAbility(etbAbility);
}
@ -81,7 +92,7 @@ class GlimmerpointStagEffect extends OneShotEffect {
private static final String effectText = "exile another target permanent. Return that card to the battlefield under its owner's control at the beginning of the next end step";
GlimmerpointStagEffect ( ) {
GlimmerpointStagEffect() {
super(Outcome.Detriment);
staticText = effectText;
}
@ -92,17 +103,19 @@ class GlimmerpointStagEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
if (permanent.moveToExile(source.getSourceId(), "Glimmerpoint Stag Exile", source.getSourceId(), game)) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
int zcc = permanent.getZoneChangeCounter(game);
controller.moveCards(permanent, Zone.EXILED, source, game);
//create delayed triggered ability
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
return true;
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
effect.setTargetPointer(new FixedTarget(permanent.getId(), zcc + 1));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
return false;
}

View file

@ -209,10 +209,7 @@ class MimicVatCreateTokenEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;

View file

@ -1,16 +1,16 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
@ -110,10 +110,7 @@ class OgreGeargrabberEffect1 extends OneShotEffect {
UUID equipmentId = source.getFirstTarget();
if (equipmentId != null) {
OgreGeargrabberDelayedTriggeredAbility delayedAbility = new OgreGeargrabberDelayedTriggeredAbility(equipmentId);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
Permanent equipment = game.getPermanent(equipmentId);
if (equipment != null) {
Permanent ogre = game.getPermanent(source.getSourceId());
@ -132,7 +129,7 @@ class OgreGeargrabberDelayedTriggeredAbility extends DelayedTriggeredAbility {
private UUID equipmentId;
OgreGeargrabberDelayedTriggeredAbility (UUID equipmentId) {
OgreGeargrabberDelayedTriggeredAbility(UUID equipmentId) {
super(new OgreGeargrabberEffect2(equipmentId));
this.equipmentId = equipmentId;
}
@ -151,6 +148,7 @@ class OgreGeargrabberDelayedTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(controllerId) && event.getTargetId().equals(equipmentId);
}
@Override
public OgreGeargrabberDelayedTriggeredAbility copy() {
return new OgreGeargrabberDelayedTriggeredAbility(this);

View file

@ -56,7 +56,6 @@ public class RelentlessAssault extends CardImpl {
super(ownerId, 214, "Relentless Assault", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{R}{R}");
this.expansionSetCode = "7ED";
// Untap all creatures that attacked this turn. After this main phase, there is an additional combat phase followed by an additional main phase.
this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
this.getSpellAbility().addEffect(new RelentlessAssaultUntapEffect());
@ -130,10 +129,8 @@ class RelentlessAssaultAddPhasesEffect extends OneShotEffect {
TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, TurnPhase.POSTCOMBAT_MAIN, false);
game.getState().getTurnMods().add(combat);
RelentlessAssaultDelayedAddMainPhaseAbility delayedTriggeredAbility = new RelentlessAssaultDelayedAddMainPhaseAbility();
delayedTriggeredAbility.setSourceId(source.getSourceId());
delayedTriggeredAbility.setControllerId(source.getControllerId());
delayedTriggeredAbility.setConnectedTurnMod(combat.getId());
game.addDelayedTriggeredAbility(delayedTriggeredAbility);
game.addDelayedTriggeredAbility(delayedTriggeredAbility, source);
return true;
}
return false;
@ -163,7 +160,7 @@ class RelentlessAssaultDelayedAddMainPhaseAbility extends DelayedTriggeredAbilit
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.PHASE_CHANGED
return event.getType() == EventType.PHASE_CHANGED
|| event.getType() == EventType.COMBAT_PHASE_PRE;
}

View file

@ -126,10 +126,7 @@ class ImpromptuRaidEffect extends OneShotEffect {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -127,10 +127,7 @@ class PuppeteerCliqueEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect("exile " + permanent.getLogName());
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect, TargetController.YOU);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
result = true;
}
}

View file

@ -62,7 +62,6 @@ public class Skeletonize extends CardImpl {
super(ownerId, 114, "Skeletonize", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{R}");
this.expansionSetCode = "ALA";
// Skeletonize deals 3 damage to target creature.
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -100,10 +99,7 @@ class SkeletonizeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new SkeletonizeDelayedTriggeredAbility();
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}
@ -130,7 +126,7 @@ class SkeletonizeDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zce = (ZoneChangeEvent) event;
ZoneChangeEvent zce = (ZoneChangeEvent) event;
if (zce.isDiesEvent()) {
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", this.getSourceId());
if (watcher != null) {

View file

@ -115,10 +115,7 @@ class CorpseDanceEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
exileEffect.setTargetPointer(fixedTarget);
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
}

View file

@ -150,9 +150,6 @@ class RescueFromTheUnderworldCreateDelayedTriggeredAbilityEffect extends OneShot
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = (DelayedTriggeredAbility) ability.copy();
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
delayedAbility.getTargets().addAll(source.getTargets());
for (Effect effect : delayedAbility.getEffects()) {
effect.getTargetPointer().init(game, source);
@ -169,7 +166,7 @@ class RescueFromTheUnderworldCreateDelayedTriggeredAbilityEffect extends OneShot
}
}
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}

View file

@ -126,10 +126,7 @@ class WhipOfErebosEffect extends OneShotEffect {
ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD);
exileEffect.setTargetPointer(new FixedTarget(creature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
return true;

View file

@ -30,7 +30,7 @@ package mage.sets.timespiral;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.ExileReturnToBattlefieldOwnerNextEndStepEffect;
import mage.abilities.effects.common.ExileReturnBattlefieldOwnerNextEndStepSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
@ -73,7 +73,7 @@ public class NorinTheWary extends CardImpl {
class NorinTheWaryTriggeredAbility extends TriggeredAbilityImpl {
public NorinTheWaryTriggeredAbility() {
super(Zone.BATTLEFIELD, new ExileReturnToBattlefieldOwnerNextEndStepEffect(true), false);
super(Zone.BATTLEFIELD, new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(true), false);
}
public NorinTheWaryTriggeredAbility(final NorinTheWaryTriggeredAbility ability) {

View file

@ -102,15 +102,11 @@ class SaffiEriksdotterEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new SaffiEriksdotterDelayedTriggeredAbility(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return false;
}
}
class SaffiEriksdotterDelayedTriggeredAbility extends DelayedTriggeredAbility {
protected FixedTarget fixedTarget;
@ -140,7 +136,7 @@ class SaffiEriksdotterDelayedTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkTrigger(GameEvent event, Game game) {
if (((ZoneChangeEvent) event).isDiesEvent()) {
if (fixedTarget.getFirst(game, this).equals(event.getTargetId())) {
if (this.getControllerId().equals(event.getPlayerId())){
if (this.getControllerId().equals(event.getPlayerId())) {
return true;
}
}
@ -153,5 +149,3 @@ class SaffiEriksdotterDelayedTriggeredAbility extends DelayedTriggeredAbility {
return "When target creature is put into your graveyard from the battlefield this turn, " + super.getRule();
}
}

View file

@ -113,10 +113,7 @@ class SneakAttackEffect extends OneShotEffect {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + card.getName(), source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -33,8 +33,9 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -48,6 +49,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -56,11 +58,11 @@ import mage.target.common.TargetCreaturePermanent;
public class GalepowderMage extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature");
static {
filter.add(new AnotherPredicate());
}
public GalepowderMage(UUID ownerId) {
super(ownerId, 12, "Galepowder Mage", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "DDI";
@ -74,7 +76,7 @@ public class GalepowderMage extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever Galepowder Mage attacks, exile another target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step.
Ability ability = new AttacksTriggeredAbility(new GalepowderMageEffect(), false);
ability.addTarget(new TargetCreaturePermanent(filter));
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}
@ -116,17 +118,16 @@ class GalepowderMageEffect extends OneShotEffect {
UUID exileId = UUID.randomUUID();
if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
if (card != null) {
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(card.getOwnerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
}
}
}
return true;
}
}
return false;
}
}
}

View file

@ -97,10 +97,7 @@ class ManaDrainCounterEffect extends OneShotEffect {
effect.setTargetPointer(new FixedTarget(source.getControllerId()));
AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility
= new AtTheBeginOfMainPhaseDelayedTriggeredAbility(effect, false, TargetController.YOU, PhaseSelection.NEXT_MAIN);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -160,11 +160,8 @@ class MarchesaTheBlackRoseEffect extends OneShotEffect {
Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect();
effect.setText("return that card to the battlefield under your control at the beginning of the next end step");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
delayedAbility.getEffects().get(0).setTargetPointer(getTargetPointer());
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -120,10 +120,7 @@ class NemesisTrapEffect extends OneShotEffect {
Effect exileEffect = new ExileTargetEffect("Exile " + addedToken.getName() + " at the beginning of the next end step");
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -74,9 +74,6 @@ public class CreateDelayedTriggeredAbilityEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = ability.copy();
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
if (this.copyTargets) {
if (source.getTargets().isEmpty()) {
for (Effect effect : delayedAbility.getEffects()) {
@ -92,7 +89,7 @@ public class CreateDelayedTriggeredAbilityEffect extends OneShotEffect {
if (initAbility) {
delayedAbility.init(game);
}
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}

View file

@ -30,7 +30,6 @@ package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.target.targetpointer.FixedTarget;
@ -60,10 +59,7 @@ public class DestroyTargetAtBeginningOfNextEndStepEffect extends OneShotEffect {
DestroyTargetEffect effect = new DestroyTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}

View file

@ -64,9 +64,7 @@ public class EpicEffect extends OneShotEffect {
}
spell.getSpellAbility().getEffects().remove(epicEffect);
DelayedTriggeredAbility ability = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(new EpicPushEffect(spell, rule), Duration.EndOfGame, false);
ability.setSourceId(source.getSourceId());
ability.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
game.addEffect(new EpicReplacementEffect(), source);
return true;
}
@ -104,7 +102,7 @@ class EpicReplacementEffect extends ContinuousRuleModifyingEffectImpl {
public String getInfoMessage(Ability source, GameEvent event, Game game) {
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() +")";
return "For the rest of the game, you can't cast spells (Epic - " + mageObject.getName() + ")";
}
return null;
}

View file

@ -40,12 +40,12 @@ import mage.players.Player;
*
* @author LevelX2
*/
public class ExileReturnToBattlefieldOwnerNextEndStepEffect extends OneShotEffect {
public class ExileReturnBattlefieldOwnerNextEndStepSourceEffect extends OneShotEffect {
private static final String effectText = "exile {this}. Return it to the battlefield under its owner's control at the beginning of the next end step";
private boolean returnAlways;
public ExileReturnToBattlefieldOwnerNextEndStepEffect() {
public ExileReturnBattlefieldOwnerNextEndStepSourceEffect() {
this(false);
}
@ -55,13 +55,13 @@ public class ExileReturnToBattlefieldOwnerNextEndStepEffect extends OneShotEffec
* but is moved to another zone (e.g. command zone by commander replacement
* effect)
*/
public ExileReturnToBattlefieldOwnerNextEndStepEffect(boolean returnAlways) {
public ExileReturnBattlefieldOwnerNextEndStepSourceEffect(boolean returnAlways) {
super(Outcome.Benefit);
staticText = effectText;
this.returnAlways = returnAlways;
}
public ExileReturnToBattlefieldOwnerNextEndStepEffect(ExileReturnToBattlefieldOwnerNextEndStepEffect effect) {
public ExileReturnBattlefieldOwnerNextEndStepSourceEffect(ExileReturnBattlefieldOwnerNextEndStepSourceEffect effect) {
super(effect);
this.returnAlways = effect.returnAlways;
}
@ -78,10 +78,7 @@ public class ExileReturnToBattlefieldOwnerNextEndStepEffect extends OneShotEffec
//create delayed triggered ability and return it from every public zone he was next moved to
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new ReturnToBattlefieldUnderOwnerControlSourceEffect(false, zcc + 1));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}
return true;
@ -90,8 +87,8 @@ public class ExileReturnToBattlefieldOwnerNextEndStepEffect extends OneShotEffec
}
@Override
public ExileReturnToBattlefieldOwnerNextEndStepEffect copy() {
return new ExileReturnToBattlefieldOwnerNextEndStepEffect(this);
public ExileReturnBattlefieldOwnerNextEndStepSourceEffect copy() {
return new ExileReturnBattlefieldOwnerNextEndStepSourceEffect(this);
}
}

View file

@ -35,20 +35,18 @@ import mage.abilities.SpecialAction;
import mage.abilities.costs.Cost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RemoveDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.RemoveSpecialActionEffect;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LoneFox (based on Quenchable Fire code by BetaSteward_at_googlemail.com)
* @author LoneFox (based on Quenchable Fire code by
* BetaSteward_at_googlemail.com)
*/
public class UnlessPaysDelayedEffect extends OneShotEffect {
private final Cost cost;
@ -63,7 +61,7 @@ public class UnlessPaysDelayedEffect extends OneShotEffect {
this.step = step;
this.affectedPlayersTurn = affectedPlayersTurn;
staticText = text + "<br><i>Use the Special button to pay the " + cost.getText()
+ " with a special action before that step.</i>";
+ " with a special action before that step.</i>";
}
public UnlessPaysDelayedEffect(final UnlessPaysDelayedEffect effect) {
@ -91,11 +89,8 @@ public class UnlessPaysDelayedEffect extends OneShotEffect {
UUID turnPlayer = affectedPlayersTurn ? getTargetPointer().getFirst(game, source) : source.getControllerId();
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
UnlessPaysDelayedEffectTriggeredAbility delayedAbility = new UnlessPaysDelayedEffectTriggeredAbility(turnPlayer, step, effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(sourceObject, game);
delayedAbility.setSpecialActionId(newAction.getId());
UUID delayedAbilityId = game.addDelayedTriggeredAbility(delayedAbility);
UUID delayedAbilityId = game.addDelayedTriggeredAbility(delayedAbility, source);
// update special action
newAction.addCost(cost);
@ -143,7 +138,7 @@ class UnlessPaysDelayedEffectTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkEventType(GameEvent event, Game game) {
switch(step) {
switch (step) {
case UPKEEP:
return event.getType() == EventType.UPKEEP_STEP_PRE;
case DRAW:
@ -156,7 +151,7 @@ class UnlessPaysDelayedEffectTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(turnPlayer)) {
for (SpecialAction action: game.getState().getSpecialActions()) {
for (SpecialAction action : game.getState().getSpecialActions()) {
if (action.getId().equals(specialActionId)) {
game.getState().getSpecialActions().remove(action);
break;

View file

@ -37,7 +37,6 @@ import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.util.CardUtil;
@ -75,23 +74,20 @@ public class DistributeCountersEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if(source.getTargets().size() > 0) {
if (source.getTargets().size() > 0) {
Target multiTarget = source.getTargets().get(0);
for(UUID target : multiTarget.getTargets()) {
for (UUID target : multiTarget.getTargets()) {
Permanent permanent = game.getPermanent(target);
if(permanent != null) {
if (permanent != null) {
permanent.addCounters(counterType.createInstance(multiTarget.getTargetAmount(target)), game);
}
}
if(removeAtEndOfTurn) {
if (removeAtEndOfTurn) {
DelayedTriggeredAbility ability = new AtTheBeginOfNextCleanupDelayedTriggeredAbility(
new RemoveCountersAtEndOfTurn(counterType));
ability.setSourceId(source.getSourceId());
ability.setControllerId(source.getControllerId());
ability.setSourceObject(source.getSourceObject(game), game);
new RemoveCountersAtEndOfTurn(counterType));
ability.getTargets().addAll(source.getTargets());
game.addDelayedTriggeredAbility(ability);
game.addDelayedTriggeredAbility(ability, source);
}
return true;
@ -107,9 +103,9 @@ public class DistributeCountersEffect extends OneShotEffect {
String name = counterType.getName();
String text = "distribute " + CardUtil.numberToText(amount) + " " + name + " counters among " + targetDescription + ".";
if(removeAtEndOfTurn) {
if (removeAtEndOfTurn) {
text += " For each " + name + " counter you put on a creature this way, remove a "
+ name + " counter from that creature at the beginning of the next cleanup step.";
+ name + " counter from that creature at the beginning of the next cleanup step.";
}
return text;
}
@ -124,7 +120,7 @@ class RemoveCountersAtEndOfTurn extends OneShotEffect {
this.counterType = counterType;
String name = counterType.getName();
staticText = "For each " + name + " counter you put on a creature this way, remove a "
+ name + " counter from that creature at the beginning of the next cleanup step.";
+ name + " counter from that creature at the beginning of the next cleanup step.";
}
public RemoveCountersAtEndOfTurn(final RemoveCountersAtEndOfTurn effect) {
@ -139,11 +135,11 @@ class RemoveCountersAtEndOfTurn extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if(source.getTargets().size() > 0) {
if (source.getTargets().size() > 0) {
Target multiTarget = source.getTargets().get(0);
for(UUID target : multiTarget.getTargets()) {
for (UUID target : multiTarget.getTargets()) {
Permanent permanent = game.getPermanent(target);
if(permanent != null) {
if (permanent != null) {
permanent.removeCounters(counterType.getName(), multiTarget.getTargetAmount(target), game);
}
}

View file

@ -78,10 +78,8 @@ public class AddExtraTurnControllerEffect extends OneShotEffect {
game.getState().getTurnMods().add(extraTurn);
if (loseGameAtEnd) {
LoseGameDelayedTriggeredAbility delayedTriggeredAbility = new LoseGameDelayedTriggeredAbility();
delayedTriggeredAbility.setSourceId(source.getSourceId());
delayedTriggeredAbility.setControllerId(source.getControllerId());
delayedTriggeredAbility.setConnectedTurnMod(extraTurn.getId());
game.addDelayedTriggeredAbility(delayedTriggeredAbility);
game.addDelayedTriggeredAbility(delayedTriggeredAbility, source);
}
}
return true;

View file

@ -232,10 +232,7 @@ class DashAddDelayedTriggeredAbilityEffect extends OneShotEffect {
// init target pointer now because the dashed creature will only be returned from battlefield zone (now in entering state so zone change counter is not raised yet)
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()) + 1));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
return false;

View file

@ -19,6 +19,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
public class MyriadAbility extends AttacksTriggeredAbility {
@ -70,15 +71,10 @@ class MyriadEffect extends OneShotEffect {
PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(controller.getId(), null, false, 1, true, true, playerId);
effect.setTargetPointer(new FixedTarget(sourceObject, game));
effect.apply(game, source);
for (Permanent tokenPermanent : effect.getAddedPermanent()) {
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
}
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTargets(effect.getAddedPermanent(), game));
DelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
}

View file

@ -127,9 +127,7 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl {
if (player != null) {
// Add the delayed triggered effect
ReboundEffectCastFromExileDelayedTrigger trigger = new ReboundEffectCastFromExileDelayedTrigger(source.getSourceId(), source.getSourceId());
trigger.setControllerId(source.getControllerId());
trigger.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(trigger);
game.addDelayedTriggeredAbility(trigger, source);
player.moveCardToExileWithInfo(sourceCard, sourceCard.getId(), player.getName() + " Rebound", source.getSourceId(), game, Zone.STACK, true);
return true;

View file

@ -1495,9 +1495,17 @@ public abstract class GameImpl implements Game, Serializable {
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(this), this);
return addDelayedTriggeredAbility(delayedAbility);
// return addDelayedTriggeredAbility(delayedAbility);
DelayedTriggeredAbility newAbility = delayedAbility.copy();
newAbility.newId();
// ability.init is called as the ability triggeres not now.
// If a FixedTarget pointer is already set from the effect setting up this delayed ability
// it has to be already initialized so it won't be overwitten as the ability triggers
state.addDelayedTriggeredAbility(newAbility);
return newAbility.getId();
}
@Deprecated
@Override
public UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility) {
DelayedTriggeredAbility newAbility = delayedAbility.copy();