Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions Mage.Sets/src/mage/cards/w/WorldsWithinWorlds.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package mage.cards.w;

import java.util.UUID;

import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
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.TargetCardInHand;
import mage.filter.StaticFilters;

/**
*
* @author nandmp
*/
public final class WorldsWithinWorlds extends CardImpl {

public WorldsWithinWorlds(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{G}{U}");


// Exile all creatures. Each player may put any number of creature cards from their hand onto the battlefield. Then put all cards exiled this way into their owners' hands. Exile Worlds Within Worlds.
this.getSpellAbility().addEffect(new WorldsWithinWorldsEffect());
this.getSpellAbility().addEffect(new ExileSpellEffect());

}

private WorldsWithinWorlds(final WorldsWithinWorlds card) {
super(card);
}

@Override
public WorldsWithinWorlds copy() {
return new WorldsWithinWorlds(this);
}
}

class WorldsWithinWorldsEffect extends OneShotEffect {

private static final FilterCreatureCard filter = new FilterCreatureCard(
"put any number of creature cards from your hand onto the battlefield"
);

WorldsWithinWorldsEffect() {
super(Outcome.Benefit);
this.staticText = "Exile all creatures. Each player may put any number of creature cards from their hand onto the battlefield. "
+ "Then put all cards exiled this way into their owners' hands";
}

private WorldsWithinWorldsEffect(final WorldsWithinWorldsEffect effect) {
super(effect);
}

@Override
public WorldsWithinWorldsEffect copy() {
return new WorldsWithinWorldsEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}

Cards exiledCards = new CardsImpl();
for (Permanent creature : game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game
)) {
if (!controller.moveCards(creature, Zone.EXILED, source, game)) {
continue;
}
Card card = game.getCard(creature.getId());
if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
exiledCards.add(card);
}
}

Cards toBattlefield = new CardsImpl();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player == null) {
continue;
}
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
player.chooseTarget(Outcome.PutCreatureInPlay, player.getHand(), target, source, game);
toBattlefield.addAll(target.getTargets());
}
controller.moveCards(toBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null);

for (Card card : exiledCards.getCards(game)) {
Player owner = game.getPlayer(card.getOwnerId());
if (owner != null) {
owner.moveCards(card, Zone.HAND, source, game);
}
}

return true;
}
}
2 changes: 2 additions & 0 deletions Mage.Sets/src/mage/sets/MarvelSuperHeroes.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ private MarvelSuperHeroes() {
cards.add(new SetCardInfo("Wolverine, Fierce Fighter", 378, Rarity.RARE, mage.cards.w.WolverineFierceFighter.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("World War Hulk", 197, Rarity.RARE, mage.cards.w.WorldWarHulk.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("World War Hulk", 304, Rarity.RARE, mage.cards.w.WorldWarHulk.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Worlds Within Worlds", 241, Rarity.RARE, mage.cards.w.WorldsWithinWorlds.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Worlds Within Worlds", 426, Rarity.RARE, mage.cards.w.WorldsWithinWorlds.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Yellowjacket, Heartless Marauder", 123, Rarity.UNCOMMON, mage.cards.y.YellowjacketHeartlessMarauder.class));
}
}
Loading