mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge pull request #5408 from davidmfritz/cleartheland
Implementation of the card Clear the Land
This commit is contained in:
commit
d6b40d1654
2 changed files with 93 additions and 0 deletions
92
Mage.Sets/src/mage/cards/c/ClearTheLand.java
Normal file
92
Mage.Sets/src/mage/cards/c/ClearTheLand.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
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.game.Game;
|
||||
import mage.players.Library;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author davidmfritz
|
||||
*/
|
||||
public final class ClearTheLand extends CardImpl {
|
||||
|
||||
public ClearTheLand(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
|
||||
|
||||
// Each player reveals the top five cards of his or her library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.
|
||||
getSpellAbility().addEffect(new ClearTheLandEffect());
|
||||
}
|
||||
|
||||
public ClearTheLand(final ClearTheLand card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClearTheLand copy() {
|
||||
return new ClearTheLand(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ClearTheLandEffect extends OneShotEffect {
|
||||
|
||||
public ClearTheLandEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Each player reveals the top five cards of his or her library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.";
|
||||
}
|
||||
|
||||
public ClearTheLandEffect(final ClearTheLandEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClearTheLandEffect copy() {
|
||||
return new ClearTheLandEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
||||
boolean tapped = true;
|
||||
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (controller != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Library library = player.getLibrary();
|
||||
Cards cardsToReveal = new CardsImpl();
|
||||
cardsToReveal.addAll(library.getTopCards(game, 5));
|
||||
if (!cardsToReveal.isEmpty()) {
|
||||
player.revealCards(source, "Revealed cards for " + player.getName(), cardsToReveal, game);
|
||||
Cards cardsToPutOnBattlefield = new CardsImpl();
|
||||
Cards cardsToExile = new CardsImpl();
|
||||
for (Card card : cardsToReveal.getCards(game)) {
|
||||
if (card.isLand()) {
|
||||
cardsToPutOnBattlefield.add(card);
|
||||
} else {
|
||||
cardsToExile.add(card);
|
||||
}
|
||||
}
|
||||
player.moveCards(cardsToPutOnBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, tapped, false, true, null);
|
||||
player.moveCards(cardsToExile.getCards(game), Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -75,6 +75,7 @@ public final class MercadianMasques extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Cho-Manno, Revolutionary", 11, Rarity.RARE, mage.cards.c.ChoMannoRevolutionary.class));
|
||||
cards.add(new SetCardInfo("Cho-Manno's Blessing", 12, Rarity.COMMON, mage.cards.c.ChoMannosBlessing.class));
|
||||
cards.add(new SetCardInfo("Cinder Elemental", 183, Rarity.UNCOMMON, mage.cards.c.CinderElemental.class));
|
||||
cards.add(new SetCardInfo("Clear the Land", 235, Rarity.RARE, mage.cards.c.ClearTheLand.class));
|
||||
cards.add(new SetCardInfo("Close Quarters", 184, Rarity.UNCOMMON, mage.cards.c.CloseQuarters.class));
|
||||
cards.add(new SetCardInfo("Cloud Sprite", 67, Rarity.COMMON, mage.cards.c.CloudSprite.class));
|
||||
cards.add(new SetCardInfo("Coastal Piracy", 68, Rarity.UNCOMMON, mage.cards.c.CoastalPiracy.class));
|
||||
|
|
Loading…
Reference in a new issue