* Sudden Disappearance - Added missing tooltip text.

This commit is contained in:
LevelX2 2014-04-25 17:56:07 +02:00
parent 07bfebcd7d
commit 3842aeba7d
2 changed files with 29 additions and 16 deletions

View file

@ -27,23 +27,23 @@
*/ */
package mage.sets.darkascension; package mage.sets.darkascension;
import mage.constants.CardType; import java.util.List;
import mage.constants.Outcome; import java.util.UUID;
import mage.constants.Rarity;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromExileEffect; import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterNonlandPermanent; import mage.filter.common.FilterNonlandPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.List;
import java.util.UUID;
/** /**
* *
* @author BetaSteward * @author BetaSteward
@ -58,7 +58,7 @@ public class SuddenDisappearance extends CardImpl<SuddenDisappearance> {
// 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. // 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().addEffect(new SuddenDisappearanceEffect());
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer(true));
} }
@ -78,6 +78,7 @@ class SuddenDisappearanceEffect extends OneShotEffect<SuddenDisappearanceEffect>
public SuddenDisappearanceEffect() { public SuddenDisappearanceEffect() {
super(Outcome.Exile); super(Outcome.Exile);
staticText = "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";
} }
public SuddenDisappearanceEffect(final SuddenDisappearanceEffect effect) { public SuddenDisappearanceEffect(final SuddenDisappearanceEffect effect) {
@ -86,17 +87,22 @@ class SuddenDisappearanceEffect extends OneShotEffect<SuddenDisappearanceEffect>
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
List<Permanent> perms = game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game); Player controller = game.getPlayer(source.getControllerId());
if (perms.size() > 0) { if (controller != null) {
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game)) { List<Permanent> perms = game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game);
permanent.moveToExile(source.getSourceId(), "Sudden Disappearance", source.getSourceId(), game); if (perms.size() > 0) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game)) {
controller.moveCardToExileWithInfo(permanent, source.getSourceId(), "Sudden Disappearance", source.getSourceId(), game, Zone.BATTLEFIELD);
}
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(delayedAbility);
} }
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(delayedAbility);
return true; return true;
} }
return false; return false;
} }

View file

@ -11,6 +11,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*/ */
public class SuddenDisappearanceTest extends CardTestPlayerBase { public class SuddenDisappearanceTest extends CardTestPlayerBase {
/**
* Sudden Disappearance
* Sorcery {5}{W}
* 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
*/
@Test @Test
public void testCard() { public void testCard() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 6); addCard(Zone.BATTLEFIELD, playerA, "Plains", 6);