diff --git a/Mage.Sets/src/mage/cards/c/CommitMemory.java b/Mage.Sets/src/mage/cards/c/CommitMemory.java index 1ce9ffe6fa..9b3e4c7b68 100644 --- a/Mage.Sets/src/mage/cards/c/CommitMemory.java +++ b/Mage.Sets/src/mage/cards/c/CommitMemory.java @@ -72,7 +72,7 @@ public class CommitMemory extends SplitCard { // Memory // Aftermath // Each player shuffles his or her hand and graveyard into his or her library, then draws seven cards. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addEffect(new MemoryEffect()); Effect effect = new DrawCardAllEffect(7); effect.setText(", then draws seven cards"); diff --git a/Mage.Sets/src/mage/cards/c/CutRibbons.java b/Mage.Sets/src/mage/cards/c/CutRibbons.java index 30abdaf1aa..ac1e6fa473 100644 --- a/Mage.Sets/src/mage/cards/c/CutRibbons.java +++ b/Mage.Sets/src/mage/cards/c/CutRibbons.java @@ -23,12 +23,12 @@ public class CutRibbons extends SplitCard { // Cut // Cut deals 4 damage to target creature. getLeftHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent()); - getLeftHalfCard().getSpellAbility().addEffect(new DamageTargetEffect(4)); + getLeftHalfCard().getSpellAbility().addEffect(new DamageTargetEffect(4).setText("Cut deals 4 damage to target creature")); // to // Ribbons // Each opponent loses X life. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addEffect(new LoseLifeOpponentsEffect(new ManacostVariableValue())); } diff --git a/Mage.Sets/src/mage/cards/d/DestinedLead.java b/Mage.Sets/src/mage/cards/d/DestinedLead.java index 1882451776..af2b2dd423 100644 --- a/Mage.Sets/src/mage/cards/d/DestinedLead.java +++ b/Mage.Sets/src/mage/cards/d/DestinedLead.java @@ -61,7 +61,7 @@ public class DestinedLead extends SplitCard { // to // Lead // All creatures able to block target creature this turn must do so. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent()); getRightHalfCard().getSpellAbility().addEffect(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn)); } diff --git a/Mage.Sets/src/mage/cards/d/DuskDawn.java b/Mage.Sets/src/mage/cards/d/DuskDawn.java index 247f8a50a0..92db3e1321 100644 --- a/Mage.Sets/src/mage/cards/d/DuskDawn.java +++ b/Mage.Sets/src/mage/cards/d/DuskDawn.java @@ -69,7 +69,7 @@ public class DuskDawn extends SplitCard { // Dawn // Return all creature cards with power less than or equal to 2 from your graveyard to your hand. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addEffect(new DawnEffect()); } diff --git a/Mage.Sets/src/mage/cards/f/FailureComply.java b/Mage.Sets/src/mage/cards/f/FailureComply.java index 8ed7542bf4..4b5663e31d 100644 --- a/Mage.Sets/src/mage/cards/f/FailureComply.java +++ b/Mage.Sets/src/mage/cards/f/FailureComply.java @@ -63,7 +63,7 @@ public class FailureComply extends SplitCard { // to // Comply // Choose a card name. Until your next turn, your opponents can't cast spells with the chosen name - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); Effect effect = new NameACardEffect(NameACardEffect.TypeOfName.ALL); effect.setText("Choose a card name"); getRightHalfCard().getSpellAbility().addEffect(effect); diff --git a/Mage.Sets/src/mage/cards/h/HeavenEarth.java b/Mage.Sets/src/mage/cards/h/HeavenEarth.java index 0dff7803ef..6fd3a88d32 100644 --- a/Mage.Sets/src/mage/cards/h/HeavenEarth.java +++ b/Mage.Sets/src/mage/cards/h/HeavenEarth.java @@ -1,53 +1,53 @@ -package mage.cards.h; - -import java.util.UUID; -import mage.abilities.dynamicvalue.common.ManacostVariableValue; -import mage.abilities.effects.common.DamageAllEffect; -import mage.abilities.keyword.AftermathAbility; -import mage.abilities.keyword.FlyingAbility; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.cards.SplitCard; -import mage.constants.CardType; -import mage.constants.SpellAbilityType; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.AbilityPredicate; - -/** - * - * @author Styxo - */ -public class HeavenEarth extends SplitCard { - - private static final FilterCreaturePermanent filterFlying = new FilterCreaturePermanent("creature with flying"); - private static final FilterCreaturePermanent filterWithouFlying = new FilterCreaturePermanent("creature without flying"); - - static { - filterFlying.add(new AbilityPredicate(FlyingAbility.class)); - filterWithouFlying.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); - } - - public HeavenEarth(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, new CardType[]{CardType.SORCERY}, "{X}{G}", "{X}{R}{R}", SpellAbilityType.SPLIT_AFTERMATH); - - // Falling - // Falling deals X damage to each creature with flying. - getLeftHalfCard().getSpellAbility().addEffect(new DamageAllEffect(new ManacostVariableValue(), filterFlying)); - - // to - // Earth - // Earth deals X damage to each creature without flying. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); - getRightHalfCard().getSpellAbility().addEffect(new DamageAllEffect(new ManacostVariableValue(), filterWithouFlying)); - } - - public HeavenEarth(final HeavenEarth card) { - super(card); - } - - @Override - public HeavenEarth copy() { - return new HeavenEarth(this); - } -} +package mage.cards.h; + +import java.util.UUID; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.keyword.AftermathAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.SplitCard; +import mage.constants.CardType; +import mage.constants.SpellAbilityType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; + +/** + * + * @author Styxo + */ +public class HeavenEarth extends SplitCard { + + private static final FilterCreaturePermanent filterFlying = new FilterCreaturePermanent("creature with flying"); + private static final FilterCreaturePermanent filterWithouFlying = new FilterCreaturePermanent("creature without flying"); + + static { + filterFlying.add(new AbilityPredicate(FlyingAbility.class)); + filterWithouFlying.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + + public HeavenEarth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, new CardType[]{CardType.SORCERY}, "{X}{G}", "{X}{R}{R}", SpellAbilityType.SPLIT_AFTERMATH); + + // Falling + // Falling deals X damage to each creature with flying. + getLeftHalfCard().getSpellAbility().addEffect(new DamageAllEffect(new ManacostVariableValue(), filterFlying)); + + // to + // Earth + // Earth deals X damage to each creature without flying. + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); + getRightHalfCard().getSpellAbility().addEffect(new DamageAllEffect(new ManacostVariableValue(), filterWithouFlying)); + } + + public HeavenEarth(final HeavenEarth card) { + super(card); + } + + @Override + public HeavenEarth copy() { + return new HeavenEarth(this); + } +} diff --git a/Mage.Sets/src/mage/cards/i/InsultInjury.java b/Mage.Sets/src/mage/cards/i/InsultInjury.java index b4721e7174..b4c272be79 100644 --- a/Mage.Sets/src/mage/cards/i/InsultInjury.java +++ b/Mage.Sets/src/mage/cards/i/InsultInjury.java @@ -37,7 +37,7 @@ public class InsultInjury extends SplitCard { // to // Injury // Injury deals 2 damage to target creature and 2 damage to target player. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent()); getRightHalfCard().getSpellAbility().addTarget(new TargetPlayer()); getRightHalfCard().getSpellAbility().addEffect(new InjuryEffect()); diff --git a/Mage.Sets/src/mage/cards/m/MouthFeed.java b/Mage.Sets/src/mage/cards/m/MouthFeed.java index 5231431900..e316d40322 100644 --- a/Mage.Sets/src/mage/cards/m/MouthFeed.java +++ b/Mage.Sets/src/mage/cards/m/MouthFeed.java @@ -38,7 +38,7 @@ public class MouthFeed extends SplitCard { // to // Feed // Draw a card for each creature you control with power 3 or greater - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); Effect draw = new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filterCreaturesYouControlPower3orGreater)); getRightHalfCard().getSpellAbility().addEffect(draw); diff --git a/Mage.Sets/src/mage/cards/n/NeverReturn.java b/Mage.Sets/src/mage/cards/n/NeverReturn.java index 3fa5d9af01..fdcd525b9f 100644 --- a/Mage.Sets/src/mage/cards/n/NeverReturn.java +++ b/Mage.Sets/src/mage/cards/n/NeverReturn.java @@ -57,7 +57,7 @@ public class NeverReturn extends SplitCard { // Return // Exile target card from a graveyard. Create a 2/2 black Zombie creature token. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addEffect(new ExileTargetEffect()); getRightHalfCard().getSpellAbility().addTarget(new TargetCardInGraveyard()); getRightHalfCard().getSpellAbility().addEffect(new CreateTokenEffect(new ZombieToken())); diff --git a/Mage.Sets/src/mage/cards/o/OnwardVictory.java b/Mage.Sets/src/mage/cards/o/OnwardVictory.java index 4b260fb53e..51aa05a0aa 100644 --- a/Mage.Sets/src/mage/cards/o/OnwardVictory.java +++ b/Mage.Sets/src/mage/cards/o/OnwardVictory.java @@ -56,7 +56,7 @@ public class OnwardVictory extends SplitCard { // to // Victory // Target creature gains double strike until end of turn. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); Effect effect = new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn); getRightHalfCard().getSpellAbility().addEffect(effect); getRightHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent()); diff --git a/Mage.Sets/src/mage/cards/p/PrepareFight.java b/Mage.Sets/src/mage/cards/p/PrepareFight.java index d6bc341340..07fd0a8095 100644 --- a/Mage.Sets/src/mage/cards/p/PrepareFight.java +++ b/Mage.Sets/src/mage/cards/p/PrepareFight.java @@ -75,7 +75,7 @@ public class PrepareFight extends SplitCard { // to // Fight // Target creature you control fights target creature you don't control. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addEffect(new FightTargetsEffect()); getRightHalfCard().getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); Target target = new TargetCreaturePermanent(filter); diff --git a/Mage.Sets/src/mage/cards/r/RagsRiches.java b/Mage.Sets/src/mage/cards/r/RagsRiches.java index 2e80139033..b59cc838c8 100644 --- a/Mage.Sets/src/mage/cards/r/RagsRiches.java +++ b/Mage.Sets/src/mage/cards/r/RagsRiches.java @@ -32,7 +32,7 @@ public class RagsRiches extends SplitCard { // to // Riches // Each opponent chooses a creature he or she controls. You gain control of each of those creatures. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addEffect(new RichesEffect()); } diff --git a/Mage.Sets/src/mage/cards/r/ReduceRubble.java b/Mage.Sets/src/mage/cards/r/ReduceRubble.java index 59541ce56c..f415afa07e 100644 --- a/Mage.Sets/src/mage/cards/r/ReduceRubble.java +++ b/Mage.Sets/src/mage/cards/r/ReduceRubble.java @@ -58,7 +58,7 @@ public class ReduceRubble extends SplitCard { // Rubble // Up to three target lands don't untap during their controller's next untap step. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); Effect effect = new DontUntapInControllersNextUntapStepTargetEffect(); effect.setText("Up to three target lands don't untap during their controller's next untap step"); getRightHalfCard().getSpellAbility().addEffect(effect); diff --git a/Mage.Sets/src/mage/cards/s/SpringMind.java b/Mage.Sets/src/mage/cards/s/SpringMind.java index 7b14bbb9bb..52512b3167 100644 --- a/Mage.Sets/src/mage/cards/s/SpringMind.java +++ b/Mage.Sets/src/mage/cards/s/SpringMind.java @@ -27,6 +27,7 @@ */ package mage.cards.s; +import java.util.UUID; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.keyword.AftermathAbility; @@ -38,8 +39,6 @@ import mage.constants.SpellAbilityType; import mage.filter.StaticFilters; import mage.target.common.TargetCardInLibrary; -import java.util.UUID; - /** * * @author fireshoes @@ -56,7 +55,7 @@ public class SpringMind extends SplitCard { // Mind // Aftermath // Draw two cards. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2)); } diff --git a/Mage.Sets/src/mage/cards/s/StartFinish.java b/Mage.Sets/src/mage/cards/s/StartFinish.java index 1f467425ca..90f937e52c 100644 --- a/Mage.Sets/src/mage/cards/s/StartFinish.java +++ b/Mage.Sets/src/mage/cards/s/StartFinish.java @@ -62,7 +62,7 @@ public class StartFinish extends SplitCard { // Finish // Aftermath // As an additional cost to cast Finish, sacrifice a creature. Destroy target creature. - ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility()); + ((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true)); getRightHalfCard().getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature")))); getRightHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature (to destoy)"))); getRightHalfCard().getSpellAbility().addEffect(new DestroyTargetEffect("Destroy target creature")); diff --git a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java index 59dccbb040..35b374f513 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java @@ -31,14 +31,11 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.*; +import mage.abilities.effects.common.ExileSpellEffect; import mage.cards.Card; -import mage.cards.SplitCardHalf; import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeEvent; -import mage.game.stack.Spell; -import mage.players.Player; /** * Aftermath @@ -55,7 +52,7 @@ public class AftermathAbility extends SimpleStaticAbility { public AftermathAbility() { super(Zone.ALL, new AftermathCastFromGraveyard()); addEffect(new AftermathCantCastFromHand()); - addEffect(new AftermathExileAsResolvesFromGraveyard()); + addEffect(ExileSpellEffect.getInstance()); } public AftermathAbility(final AftermathAbility ability) { @@ -68,12 +65,8 @@ public class AftermathAbility extends SimpleStaticAbility { } @Override - public String getRule(boolean all) { - if (all) { - return "Aftermath (Cast this card only from your graveyard. Exile it afterwards.)"; - } else { - return "Aftermath"; - } + public String getRule() { + return "Aftermath (Cast this spell only from your graveyard. Then exile it.)"; } } @@ -81,7 +74,6 @@ class AftermathCastFromGraveyard extends AsThoughEffectImpl { public AftermathCastFromGraveyard() { super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit); - staticText = "Cast {this} from your graveyard"; } public AftermathCastFromGraveyard(final AftermathCastFromGraveyard effect) { @@ -98,10 +90,6 @@ class AftermathCastFromGraveyard extends AsThoughEffectImpl { return new AftermathCastFromGraveyard(this); } - private static String msb(UUID id) { - return Integer.toUnsignedString((int) id.getMostSignificantBits(), 16); - } - @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (objectId.equals(source.getSourceId()) @@ -153,75 +141,3 @@ class AftermathCantCastFromHand extends ContinuousRuleModifyingEffectImpl { return false; } } - -class AftermathExileAsResolvesFromGraveyard extends ReplacementEffectImpl { - - AftermathExileAsResolvesFromGraveyard() { - super(Duration.WhileOnStack, Outcome.Detriment); - this.staticText = "Exile it afterwards."; - } - - AftermathExileAsResolvesFromGraveyard(AftermathExileAsResolvesFromGraveyard effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ZONE_CHANGE; - } - - @Override - public boolean applies(GameEvent evt, Ability source, Game game) { - ZoneChangeEvent event = (ZoneChangeEvent) evt; - if (event.getFromZone() == Zone.STACK && event.getToZone() != Zone.EXILED) { - // Moving something from stack to somewhere else - - // Get the source id, getting the whole split card's ID, because - // that's the card that is changing zones in the event, but - // source.getSourceId is only the split card half. - // If branch so that we also support putting Aftermath on - // non-split cards for... whatever reason, in case somebody - // wants to do that in the future. - UUID sourceId = source.getSourceId(); - Card sourceCard = game.getCard(source.getSourceId()); - if (sourceCard != null && sourceCard instanceof SplitCardHalf) { - sourceCard = ((SplitCardHalf) sourceCard).getParentCard(); - sourceId = sourceCard.getId(); - } - - if (event.getTargetId() == sourceId) { - // Moving this spell from stack to yard - Spell spell = game.getStack().getSpell(source.getSourceId()); - if (spell != null && spell.getFromZone() == Zone.GRAVEYARD) { - // And this spell was cast from the graveyard, so we need to exile it - return true; - } - } - } - return false; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - UUID sourceId = source.getSourceId(); - Card sourceCard = game.getCard(source.getSourceId()); - if (sourceCard != null && sourceCard instanceof SplitCardHalf) { - sourceCard = ((SplitCardHalf) sourceCard).getParentCard(); - sourceId = sourceCard.getId(); - } - - if (sourceCard != null) { - Player player = game.getPlayer(sourceCard.getOwnerId()); - if (player != null) { - return player.moveCardToExileWithInfo(sourceCard, null, "", sourceId, game, ((ZoneChangeEvent) event).getFromZone(), true); - } - } - return false; - } - - @Override - public AftermathExileAsResolvesFromGraveyard copy() { - return new AftermathExileAsResolvesFromGraveyard(this); - } - -}