updated Mistveil Plains implementation

This commit is contained in:
Evan Kranzler 2018-09-25 14:17:52 -04:00
parent b82df08a80
commit c303b5adf8
5 changed files with 128 additions and 133 deletions

View file

@ -1,7 +1,6 @@
package mage.cards.m;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -14,23 +13,22 @@ import mage.abilities.mana.WhiteManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class MistveilPlains extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control two or more white permanents");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
@ -50,7 +48,8 @@ public final class MistveilPlains extends CardImpl {
Zone.BATTLEFIELD,
new MistveilPlainsGraveyardToLibraryEffect(),
new ManaCostsImpl("{W}"),
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1));
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 1)
);
ability.addTarget(new TargetCardInYourGraveyard());
ability.addCost(new TapSourceCost());
this.addAbility(ability);
@ -85,10 +84,12 @@ class MistveilPlainsGraveyardToLibraryEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
return card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
}
Card card = game.getCard(source.getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
if (card == null || player == null ||
game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
return false;
}
return player.putCardsOnBottomOfLibrary(card, game, source, false);
}
}

View file

@ -1,9 +1,5 @@
package org.mage.test.player;
import java.io.Serializable;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.MageObject;
import mage.MageObjectReference;
import mage.ObjectColor;
@ -52,6 +48,12 @@ import mage.target.*;
import mage.target.common.*;
import org.junit.Assert;
import org.junit.Ignore;
import java.io.Serializable;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl.*;
/**
@ -1590,6 +1592,11 @@ public class TestPlayer implements Player {
return computerPlayer.removeFromGraveyard(card, game);
}
@Override
public boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder) {
return computerPlayer.putCardsOnBottomOfLibrary(card, game, source, anyOrder);
}
@Override
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
return computerPlayer.putCardsOnBottomOfLibrary(cards, game, source, anyOrder);

View file

@ -1,7 +1,5 @@
package org.mage.test.stub;
import java.io.Serializable;
import java.util.*;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.*;
@ -40,8 +38,10 @@ import mage.target.TargetAmount;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import java.io.Serializable;
import java.util.*;
/**
*
* @author Quercitron
*/
public class PlayerStub implements Player {
@ -882,6 +882,11 @@ public class PlayerStub implements Player {
return false;
}
@Override
public boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder) {
return false;
}
@Override
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
return false;

View file

@ -1,22 +1,9 @@
package mage.players;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.MageItem;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.Mode;
import mage.abilities.Modes;
import mage.abilities.SpellAbility;
import mage.abilities.TriggeredAbility;
import mage.abilities.*;
import mage.abilities.costs.AlternativeSourceCosts;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
@ -28,13 +15,7 @@ import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.decks.Deck;
import mage.choices.Choice;
import mage.constants.AbilityType;
import mage.constants.ManaType;
import mage.constants.Outcome;
import mage.constants.PlanarDieRoll;
import mage.constants.PlayerAction;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.Counter;
import mage.counters.Counters;
import mage.designations.Designation;
@ -56,8 +37,10 @@ import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
import mage.util.Copyable;
import java.io.Serializable;
import java.util.*;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public interface Player extends MageItem, Copyable<Player> {
@ -91,7 +74,6 @@ public interface Player extends MageItem, Copyable<Player> {
void setLife(int life, Game game, UUID sourceId);
/**
*
* @param amount amount of life loss
* @param game
* @param atCombat was the source combat damage
@ -289,7 +271,7 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Returns false in case player don't control the game.
*
* <p>
* Note: For effects like "You control target player during that player's
* next turn".
*
@ -299,7 +281,7 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Returns false in case you don't control the game.
*
* <p>
* Note: For effects like "You control target player during that player's
* next turn".
*
@ -360,7 +342,6 @@ public interface Player extends MageItem, Copyable<Player> {
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId);
/**
*
* @param target
* @param game
* @param targetPlayerId player whose library will be searched
@ -385,7 +366,6 @@ public interface Player extends MageItem, Copyable<Player> {
boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, MageObjectReference reference);
/**
*
* @param card the land card to play
* @param game
* @param ignoreTiming false - it won't be checked if the stack is empty and
@ -545,6 +525,8 @@ public interface Player extends MageItem, Copyable<Player> {
*/
boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder);
boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder);
/**
* Moves the card to the top x position of the library
*
@ -759,7 +741,6 @@ public interface Player extends MageItem, Copyable<Player> {
* @param game
* @param withName show the card name in the log
* @return
*
*/
boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName);

View file

@ -1,9 +1,5 @@
package mage.players;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Map.Entry;
import mage.ConditionalMana;
import mage.MageObject;
import mage.MageObjectReference;
@ -31,11 +27,6 @@ import mage.cards.SplitCard;
import mage.cards.decks.Deck;
import mage.choices.ChoiceImpl;
import mage.constants.*;
import static mage.constants.Zone.BATTLEFIELD;
import static mage.constants.Zone.EXILED;
import static mage.constants.Zone.GRAVEYARD;
import static mage.constants.Zone.HAND;
import static mage.constants.Zone.LIBRARY;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.counters.Counters;
@ -77,6 +68,11 @@ import mage.util.GameLog;
import mage.util.RandomUtil;
import org.apache.log4j.Logger;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Map.Entry;
public abstract class PlayerImpl implements Player, Serializable {
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
@ -878,6 +874,11 @@ public abstract class PlayerImpl implements Player, Serializable {
return true;
}
@Override
public boolean putCardsOnBottomOfLibrary(Card card, Game game, Ability source, boolean anyOrder) {
return putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, anyOrder);
}
@Override
public boolean putCardsOnBottomOfLibrary(Cards cardsToLibrary, Game game, Ability source, boolean anyOrder) {
if (!cardsToLibrary.isEmpty()) {