mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Implemented Niv-Mizzet Reborn
This commit is contained in:
parent
1574fdc6a5
commit
90adde4feb
2 changed files with 145 additions and 0 deletions
144
Mage.Sets/src/mage/cards/n/NivMizzetReborn.java
Normal file
144
Mage.Sets/src/mage/cards/n/NivMizzetReborn.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
package mage.cards.n;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class NivMizzetReborn extends CardImpl {
|
||||
|
||||
public NivMizzetReborn(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}{R}{G}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
this.subtype.add(SubType.AVATAR);
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Niv-Mizzet Reborn enters the battlefield, reveal the top ten cards of your library. For each color pair, choose a card that's exactly those colors from among them. Put the chosen cards into your hand and the rest on the bottom of your library in a random order.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new NivMizzetRebornEffect()));
|
||||
}
|
||||
|
||||
private NivMizzetReborn(final NivMizzetReborn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NivMizzetReborn copy() {
|
||||
return new NivMizzetReborn(this);
|
||||
}
|
||||
}
|
||||
|
||||
class NivMizzetRebornEffect extends OneShotEffect {
|
||||
|
||||
private static enum Guild {
|
||||
G0("W", "U"), G1("W", "B"), G2("U", "B"), G3("U", "R"), G4("B", "R"),
|
||||
G5("B", "G"), G6("R", "G"), G7("R", "W"), G8("G", "W"), G9("G", "U");
|
||||
|
||||
private static final Map<String, String> nameMap = new HashMap();
|
||||
|
||||
static {
|
||||
nameMap.put("W", "white");
|
||||
nameMap.put("U", "blue");
|
||||
nameMap.put("B", "black");
|
||||
nameMap.put("R", "red");
|
||||
nameMap.put("G", "green");
|
||||
}
|
||||
|
||||
private final String color1;
|
||||
private final String color2;
|
||||
|
||||
private Guild(String color1, String color2) {
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
}
|
||||
|
||||
private TargetCard getTarget() {
|
||||
FilterCard filter = new FilterCard(getDescription());
|
||||
filter.add(new ColorPredicate(new ObjectColor(color1 + color2)));
|
||||
filter.add(Predicates.not(new ColorPredicate(new ObjectColor(getOtherColors()))));
|
||||
return new TargetCardInLibrary(filter);
|
||||
}
|
||||
|
||||
private String getDescription() {
|
||||
return "card that is exactly " + nameMap.get(color1) + " and " + nameMap.get(color2);
|
||||
}
|
||||
|
||||
private String getOtherColors() {
|
||||
String colors = color1 + color2;
|
||||
String otherColors = "";
|
||||
for (char c : "WUBRG".toCharArray()) {
|
||||
if (color1.charAt(0) == c || color2.charAt(0) == c) {
|
||||
otherColors += c;
|
||||
}
|
||||
}
|
||||
return otherColors;
|
||||
}
|
||||
}
|
||||
|
||||
NivMizzetRebornEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "reveal the top ten cards of your library. For each color pair, " +
|
||||
"choose a card that's exactly those colors from among them. " +
|
||||
"Put the chosen cards into your hand and the rest on the bottom of your library in a random order.";
|
||||
}
|
||||
|
||||
private NivMizzetRebornEffect(final NivMizzetRebornEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NivMizzetRebornEffect copy() {
|
||||
return new NivMizzetRebornEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 10));
|
||||
Cards cards2 = new CardsImpl();
|
||||
if (cards.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
player.revealCards(source, cards, game);
|
||||
for (Guild guild : Guild.values()) {
|
||||
TargetCard target = guild.getTarget();
|
||||
if (player.choose(outcome, cards, target, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
cards2.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
cards.removeAll(cards2);
|
||||
player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
||||
player.moveCards(cards2, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// I think this is my favorite card I've ever implemented
|
|
@ -135,6 +135,7 @@ public final class WarOfTheSpark extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Nahiri, Storm of Stone", 233, Rarity.UNCOMMON, mage.cards.n.NahiriStormOfStone.class));
|
||||
cards.add(new SetCardInfo("Neheb, Dreadhorde Champion", 140, Rarity.RARE, mage.cards.n.NehebDreadhordeChampion.class));
|
||||
cards.add(new SetCardInfo("Nissa's Triumph", 170, Rarity.UNCOMMON, mage.cards.n.NissasTriumph.class));
|
||||
cards.add(new SetCardInfo("Niv-Mizzet Reborn", 208, Rarity.MYTHIC, mage.cards.n.NivMizzetReborn.class));
|
||||
cards.add(new SetCardInfo("No Escape", 63, Rarity.COMMON, mage.cards.n.NoEscape.class));
|
||||
cards.add(new SetCardInfo("Ob Nixilis's Cruelty", 101, Rarity.COMMON, mage.cards.o.ObNixilissCruelty.class));
|
||||
cards.add(new SetCardInfo("Ob Nixilis, the Hate-Twisted", 100, Rarity.UNCOMMON, mage.cards.o.ObNixilisTheHateTwisted.class));
|
||||
|
|
Loading…
Reference in a new issue