mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge origin/master
This commit is contained in:
commit
257092dc34
67 changed files with 234 additions and 224 deletions
|
@ -31,7 +31,6 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -104,7 +103,7 @@ class ArchitectsOfWillEffect extends OneShotEffect {
|
|||
|| controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(targetPlayer.getLibrary().size(), 3);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = targetPlayer.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -104,7 +104,7 @@ class SagesOfTheAnimaReplacementEffect extends ReplacementEffectImpl {
|
|||
FilterCard filter = new FilterCard();
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
Player player = game.getPlayer(event.getPlayerId());
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
if (player != null) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -91,7 +91,7 @@ class BrowseEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int cardsCount = Math.min(5, player.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -102,7 +102,7 @@ class SoldeviSageEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
Cards initialHand = player.getHand().copy();
|
||||
player.drawCards(3, game);
|
||||
Cards drawnCards = new CardsImpl(Zone.PICK);
|
||||
Cards drawnCards = new CardsImpl();
|
||||
for (UUID cardId : player.getHand()) {
|
||||
if (!initialHand.contains(cardId)) {
|
||||
drawnCards.add(cardId);
|
||||
|
|
|
@ -151,7 +151,7 @@ class KioraRevealEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
boolean creatureCardFound = false;
|
||||
boolean landCardFound = false;
|
||||
|
|
|
@ -154,7 +154,7 @@ class HeroesPodiumEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = source.getManaCostsToPay().getX();
|
||||
count = Math.min(player.getLibrary().size(), count);
|
||||
boolean legendaryIncluded = false;
|
||||
|
|
|
@ -97,7 +97,7 @@ class SatyrWayfinderEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
boolean properCardFound = cards.count(filterPutInHand, source.getControllerId(), source.getSourceId(), game) > 0;
|
||||
if (!cards.isEmpty()) {
|
||||
|
|
|
@ -29,18 +29,16 @@ package mage.sets.championsofkamigawa;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
@ -74,53 +72,37 @@ public class CranialExtraction extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
class CranialExtractionEffect extends OneShotEffect {
|
||||
class CranialExtractionEffect extends SearchTargetGraveyardHandLibraryForCardNameAndExileEffect {
|
||||
|
||||
public CranialExtractionEffect() {
|
||||
super(Outcome.Exile);
|
||||
staticText = "Name a nonland card. Search target player's graveyard, hand, and library for all cards with that name and exile them. Then that player shuffles his or her library";
|
||||
CranialExtractionEffect() {
|
||||
super(false, "target player's", "all cards with that name");
|
||||
}
|
||||
|
||||
public CranialExtractionEffect(final CranialExtractionEffect effect) {
|
||||
CranialExtractionEffect(final CranialExtractionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (player != null && controller != null) {
|
||||
Choice cardChoice = new ChoiceImpl();
|
||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||
cardChoice.clearChoice();
|
||||
cardChoice.setMessage("Name a nonland card");
|
||||
|
||||
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String cardName = cardChoice.getChoice();
|
||||
game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]");
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||
}
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]");
|
||||
}
|
||||
for (Card card: player.getHand().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true);
|
||||
}
|
||||
}
|
||||
for (Card card: player.getLibrary().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
}
|
||||
}
|
||||
controller.lookAtCards(sourceObject.getName() + " Hand", player.getHand(), game);
|
||||
controller.lookAtCards(sourceObject.getName() + " Library", new CardsImpl(Zone.PICK, player.getLibrary().getCards(game)), game);
|
||||
player.shuffleLibrary(game);
|
||||
super.applySearchAndExile(game, source, cardName, player.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -130,4 +112,8 @@ class CranialExtractionEffect extends OneShotEffect {
|
|||
return new CranialExtractionEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return "Name a nonland card. " + super.getText(mode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class AEthermagesTouchEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
|
||||
boolean properCardFound = false;
|
||||
int count = Math.min(player.getLibrary().size(), 4);
|
||||
|
|
|
@ -95,7 +95,7 @@ class LimDulsVaultEffect extends OneShotEffect {
|
|||
|
||||
boolean doAgain;
|
||||
do {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 5);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
@ -105,7 +105,7 @@ class LimDulsVaultEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
player.lookAtCards("Lim-Dul's Vault", cards, game);
|
||||
doAgain = player.chooseUse(outcome, "Pay 1 lfe and look at the next 5 cards?", source, game);
|
||||
doAgain = player.chooseUse(outcome, "Pay 1 life and look at the next 5 cards?", source, game);
|
||||
if (doAgain) {
|
||||
player.loseLife(1, game);
|
||||
} else {
|
||||
|
|
|
@ -27,11 +27,8 @@
|
|||
*/
|
||||
package mage.sets.commander2013;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -108,7 +105,7 @@ class UnexpectedlyAbsentEffect extends OneShotEffect {
|
|||
Player owner = game.getPlayer(permanent.getOwnerId());
|
||||
if (owner != null) {
|
||||
int xValue = Math.min(source.getManaCostsToPay().getX(), owner.getLibrary().size());
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
Deque<UUID> cardIds = new LinkedList<>();
|
||||
for (int i = 0; i < xValue; i++) {
|
||||
Card card = owner.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.conflux;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.DomainValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -39,6 +35,10 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -92,7 +92,7 @@ class WorldlyCounselEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = (new DomainValue()).calculate(game, source, this);
|
||||
count = Math.min(player.getLibrary().size(), count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
|
|
@ -29,10 +29,6 @@ package mage.sets.darkascension;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.OnEventTriggeredAbility;
|
||||
|
@ -43,6 +39,10 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.Predicate;
|
||||
|
@ -119,7 +119,7 @@ class CallToTheKindredEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 5);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -197,7 +197,7 @@ class JarOfEyeballsEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), countersRemoved);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
package mage.sets.darkascension;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -41,6 +36,11 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -93,7 +93,7 @@ class TrackersInstinctsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
|
||||
boolean creaturesFound = false;
|
||||
int count = Math.min(controller.getLibrary().size(), 4);
|
||||
|
|
|
@ -106,7 +106,7 @@ class ProteanHulkEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
Cards ProteanHulkSearch(Game game, Ability source) {
|
||||
Cards cardsPicked = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cardsPicked = new CardsImpl();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
GameEvent event = GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, source.getControllerId(), source.getControllerId(), source.getControllerId(), Integer.MAX_VALUE);
|
||||
|
|
|
@ -150,7 +150,7 @@ class PlungeIntoDarknessSearchEffect extends OneShotEffect {
|
|||
int xValue = cost.announceXValue(source, game);
|
||||
cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), false);
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), xValue);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -94,7 +94,7 @@ class ReversalOfFortuneEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (controller != null && opponent != null) {
|
||||
// Target opponent reveals his or her hand
|
||||
Cards revealedCards = new CardsImpl(Zone.HAND);
|
||||
Cards revealedCards = new CardsImpl();
|
||||
revealedCards.addAll(opponent.getHand());
|
||||
opponent.revealCards("Reveal", revealedCards, game);
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class OrcishLibrarianEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int cardsCount = Math.min(8, player.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
package mage.sets.innistrad;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -41,6 +36,11 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -94,7 +94,7 @@ class ForbiddenAlchemyEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int cardsCount = Math.min(4, player.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -112,7 +112,7 @@ class FlashOfInsightEffect extends OneShotEffect {
|
|||
int xValue;
|
||||
xValue = source.getManaCostsToPay().getX();
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), xValue);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -90,7 +90,7 @@ class BitterRevelationEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
int cardsCount = Math.min(4, player.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -106,7 +106,7 @@ class SeeTheUnwrittenEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
|
||||
int creatureCardsFound = 0;
|
||||
int count = Math.min(controller.getLibrary().size(), 8);
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
package mage.sets.limitedalpha;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
|
@ -95,7 +94,7 @@ class NaturalSelectionEffect extends OneShotEffect {
|
|||
if (player == null || you == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 3);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -31,10 +31,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -45,6 +41,10 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -102,7 +102,7 @@ class SphinxOfUthuunEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 5);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -89,7 +89,7 @@ class GlimpseTheFutureEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (controller != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int cardsCount = Math.min(3, controller.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -107,7 +107,7 @@ class AlhammarretHighArbiterEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards revealedCards = new CardsImpl(Zone.PICK);
|
||||
Cards revealedCards = new CardsImpl();
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
if (playerId != controller.getId()) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
|
|
|
@ -91,7 +91,7 @@ class AnimistsAwakeningEffect extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
int xValue = source.getManaCostsToPay().getX();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, xValue));
|
||||
if (cards.size() > 0) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class GatherThePackEffect extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
|
|
@ -87,7 +87,7 @@ class NightsnareDiscardEffect extends OneShotEffect {
|
|||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (player != null && controller != null) {
|
||||
if (!player.getHand().isEmpty()) {
|
||||
Cards revealedCards = new CardsImpl(Zone.HAND);
|
||||
Cards revealedCards = new CardsImpl();
|
||||
revealedCards.addAll(player.getHand());
|
||||
player.revealCards(sourceCard != null ? sourceCard.getIdName() : "Discard", revealedCards, game);
|
||||
// You may choose a nonland card from it.
|
||||
|
|
|
@ -101,7 +101,10 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
|
|||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (targetOpponent != null && sourceObject != null) {
|
||||
Set<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 7);
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY, allCards);
|
||||
Cards cards = new CardsImpl();
|
||||
for (Card card : allCards) {
|
||||
cards.add(card);
|
||||
}
|
||||
targetOpponent.revealCards(sourceObject.getIdName() + " - " + targetOpponent.getName() + "'s top library cards", cards, game);
|
||||
for (Card card : allCards) {
|
||||
if (filter.match(card, game)) {
|
||||
|
|
|
@ -30,16 +30,16 @@ package mage.sets.mirrodinbesieged;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -102,8 +102,8 @@ class MitoticManipulationEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cardsFound = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
Cards cardsFound = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 7);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -115,7 +115,7 @@ class ThievingSpriteEffect extends OneShotEffect {
|
|||
|
||||
Cards revealedCards = new CardsImpl();
|
||||
if (numberOfFaeries > 0 && targetPlayer.getHand().size() > numberOfFaeries) {
|
||||
Cards cardsInHand = new CardsImpl(Zone.PICK);
|
||||
Cards cardsInHand = new CardsImpl();
|
||||
cardsInHand.addAll(targetPlayer.getHand());
|
||||
|
||||
TargetCard target = new TargetCard(numberOfFaeries, Zone.PICK, new FilterCard());
|
||||
|
|
|
@ -128,7 +128,7 @@ class PsychicSurgeryEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(opponentId);
|
||||
|
||||
if (player != null && opponent != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 2);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = opponent.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
package mage.sets.newphyrexia;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -46,6 +41,11 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterSpell;
|
||||
|
@ -116,7 +116,7 @@ class ShrineOfPiercingVisionEffect extends OneShotEffect {
|
|||
}
|
||||
int count = permanent.getCounters().getCount(CounterType.CHARGE);
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
count = Math.min(player.getLibrary().size(), count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -29,16 +29,16 @@ package mage.sets.newphyrexia;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -113,7 +113,7 @@ class SurgicalExtractionEffect extends OneShotEffect {
|
|||
FilterCard filterNamedCard = new FilterCard("card named " + chosenCard.getName());
|
||||
filterNamedCard.add(new NamePredicate(chosenCard.getName()));
|
||||
|
||||
Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cardsInLibrary = new CardsImpl();
|
||||
cardsInLibrary.addAll(owner.getLibrary().getCards(game));
|
||||
|
||||
// cards in Graveyard
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.planechase2012;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
|
@ -42,6 +38,9 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterNonlandCard;
|
||||
import mage.game.Game;
|
||||
|
@ -101,7 +100,7 @@ class SilentBladeOniEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (opponent != null && controller != null) {
|
||||
Cards cardsInHand = new CardsImpl(Zone.PICK);
|
||||
Cards cardsInHand = new CardsImpl();
|
||||
cardsInHand.addAll(opponent.getHand());
|
||||
if (cardsInHand.size() > 0) {
|
||||
TargetCard target = new TargetCard(1, Zone.PICK, new FilterNonlandCard());
|
||||
|
|
|
@ -98,7 +98,7 @@ class MindleechMassEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (opponent != null && you != null) {
|
||||
Cards cardsInHand = new CardsImpl(Zone.PICK);
|
||||
Cards cardsInHand = new CardsImpl();
|
||||
cardsInHand.addAll(opponent.getHand());
|
||||
opponent.revealCards("Opponents hand", cardsInHand, game);
|
||||
if (cardsInHand.size() > 0
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.sets.returntoravnica;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
|
@ -100,7 +99,7 @@ class FiremindsForesightSearchEffect extends OneShotEffect {
|
|||
}
|
||||
int cardsCount;
|
||||
Cards cardToReveal = new CardsImpl();
|
||||
Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cardsInLibrary = new CardsImpl();
|
||||
cardsInLibrary.addAll(player.getLibrary().getCards(game));
|
||||
|
||||
for (int cmc=3; cmc > 0; cmc--) {
|
||||
|
|
|
@ -193,7 +193,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 3);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -34,19 +34,29 @@ import mage.abilities.common.CantBlockAbility;
|
|||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.FlippedCondition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.FlipSourceEffect;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CopyTokenEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -69,7 +79,7 @@ public class HomuraHumanAscendant extends CardImpl {
|
|||
// Homura, Human Ascendant can't block.
|
||||
this.addAbility(new CantBlockAbility());
|
||||
// When Homura dies, return it to the battlefield flipped.
|
||||
this.addAbility(new DiesTriggeredAbility(new FlipSourceEffect(new HomurasEssence2())));
|
||||
this.addAbility(new DiesTriggeredAbility(new HomuraReturnFlippedSourceEffect(new HomurasEssence2())));
|
||||
}
|
||||
|
||||
public HomuraHumanAscendant(final HomuraHumanAscendant card) {
|
||||
|
@ -82,8 +92,46 @@ public class HomuraHumanAscendant extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class HomurasEssence2 extends Token {
|
||||
class HomuraReturnFlippedSourceEffect extends OneShotEffect {
|
||||
|
||||
private final Token flipToken;
|
||||
|
||||
public HomuraReturnFlippedSourceEffect(Token flipToken) {
|
||||
super(Outcome.BecomeCreature);
|
||||
this.flipToken = flipToken;
|
||||
staticText = "return it to the battlefield flipped";
|
||||
}
|
||||
|
||||
public HomuraReturnFlippedSourceEffect(final HomuraReturnFlippedSourceEffect effect) {
|
||||
super(effect);
|
||||
this.flipToken = effect.flipToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) {
|
||||
ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), "");
|
||||
game.addEffect(effect, source);
|
||||
controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.flip(game); // not complete correct because it should enter the battlefield flipped
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomuraReturnFlippedSourceEffect copy() {
|
||||
return new HomuraReturnFlippedSourceEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class HomurasEssence2 extends Token {
|
||||
|
||||
HomurasEssence2() {
|
||||
super("Homura's Essence", "");
|
||||
|
@ -91,10 +139,15 @@ class HomurasEssence2 extends Token {
|
|||
cardType.add(CardType.ENCHANTMENT);
|
||||
color.setRed(true);
|
||||
// Creatures you control get +2/+2 and have flying and "{R}: This creature gets +1/+0 until end of turn."
|
||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false));
|
||||
ability.addEffect(new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield));
|
||||
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,0, Duration.EndOfTurn), new ManaCostsImpl("{R}"));
|
||||
ability.addEffect(new GainAbilityControlledEffect(gainedAbility, Duration.WhileOnBattlefield));
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield, filter, false));
|
||||
Effect effect = new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, filter);
|
||||
effect.setText("and have flying");
|
||||
ability.addEffect(effect);
|
||||
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}"));
|
||||
effect = new GainAbilityControlledEffect(gainedAbility, Duration.WhileOnBattlefield, filter);
|
||||
effect.setText("and \"{R}: This creature gets +1/+0 until end of turn.\"");
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ import mage.abilities.effects.SearchEffect;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -155,10 +154,10 @@ class KahoMinamoHistorianCastEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
TargetCardInExile target = new TargetCardInExile(new FilterCard(), CardUtil.getCardExileZoneId(game, source));
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, source.getManaCostsToPay().getX()));
|
||||
Cards cards = new CardsImpl(Zone.EXILED, game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)).getCards(filter, game));
|
||||
TargetCardInExile target = new TargetCardInExile(filter, CardUtil.getCardExileZoneId(game, source));
|
||||
Cards cards = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
|
||||
if (cards.size() > 0 && controller.choose(Outcome.PlayForFree, cards, target, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
|
@ -170,4 +169,4 @@ class KahoMinamoHistorianCastEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class CloneShellEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 4);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -95,7 +95,7 @@ class GenesisWaveEffect extends OneShotEffect {
|
|||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
int xValue = source.getManaCostsToPay().getX();
|
||||
int numberCards = Math.min(controller.getLibrary().size(), xValue);
|
||||
for (int i = 0; i < numberCards; i++) {
|
||||
|
|
|
@ -30,17 +30,15 @@ package mage.sets.scarsofmirrodin;
|
|||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
@ -72,55 +70,37 @@ public class Memoricide extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
class MemoricideEffect extends OneShotEffect {
|
||||
class MemoricideEffect extends SearchTargetGraveyardHandLibraryForCardNameAndExileEffect {
|
||||
|
||||
public MemoricideEffect() {
|
||||
super(Outcome.Exile);
|
||||
staticText = "Name a nonland card. Search target player's graveyard, hand, and library for any number of cards with that name and exile them. Then that player shuffles his or her library";
|
||||
MemoricideEffect() {
|
||||
super(true, "target player's", "any number of cards with that name");
|
||||
}
|
||||
|
||||
public MemoricideEffect(final MemoricideEffect effect) {
|
||||
MemoricideEffect(final MemoricideEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (player != null && controller != null) {
|
||||
Choice cardChoice = new ChoiceImpl();
|
||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||
cardChoice.clearChoice();
|
||||
cardChoice.setMessage("Name a nonland card");
|
||||
|
||||
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String cardName = cardChoice.getChoice();
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
game.informPlayers(sourceObject.getName() + " named card: [" + cardName + "]");
|
||||
}
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
card.moveToExile(null, "", source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
card.moveToExile(null, "", source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
card.moveToExile(null, "", source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
controller.lookAtCards("Memoricide Hand", player.getHand(), game);
|
||||
controller.lookAtCards("Memoricide Library", new CardsImpl(Zone.PICK, player.getLibrary().getCards(game)), game);
|
||||
player.shuffleLibrary(game);
|
||||
super.applySearchAndExile(game, source, cardName, player.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -130,4 +110,8 @@ class MemoricideEffect extends OneShotEffect {
|
|||
return new MemoricideEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return "Name a nonland card. " + super.getText(mode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class AncestralMemoriesEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (player != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int cardsCount = Math.min(7, player.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -27,10 +27,12 @@
|
|||
*/
|
||||
package mage.sets.shadowmoor;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
|
@ -93,7 +95,11 @@ class AdviceFromTheFaeEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null) {
|
||||
Cards cardsFromLibrary = new CardsImpl(Zone.LIBRARY, controller.getLibrary().getTopCards(game, 5));
|
||||
Set<Card> topCards = controller.getLibrary().getTopCards(game, 5);
|
||||
Cards cardsFromLibrary = new CardsImpl();
|
||||
for (Card card : topCards) {
|
||||
cardsFromLibrary.add(card);
|
||||
}
|
||||
controller.lookAtCards(mageObject.getIdName(), cardsFromLibrary, game);
|
||||
int max = 0;
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
|
|
|
@ -28,16 +28,16 @@
|
|||
package mage.sets.shardsofalara;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterLandCard;
|
||||
|
@ -93,7 +93,7 @@ class GiftOfTheGargantuanEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
boolean creatureCardFound = false;
|
||||
boolean landCardFound = false;
|
||||
int count = Math.min(player.getLibrary().size(), 4);
|
||||
|
|
|
@ -104,7 +104,7 @@ class RagManDiscardEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
Cards creatureCardsInHand = new CardsImpl(Zone.PICK);
|
||||
Cards creatureCardsInHand = new CardsImpl();
|
||||
for (UUID cardId : player.getHand()) {
|
||||
Card card = player.getHand().get(cardId, game);
|
||||
if (filter.match(card, game)) {
|
||||
|
|
|
@ -104,7 +104,7 @@ class DiscipleOfPhenaxEffect extends OneShotEffect {
|
|||
int devotion = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this);
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (devotion > 0 && targetPlayer != null) {
|
||||
Cards revealedCards = new CardsImpl(Zone.PICK);
|
||||
Cards revealedCards = new CardsImpl();
|
||||
int amount = Math.min(targetPlayer.getHand().size(), devotion);
|
||||
if (targetPlayer.getHand().size() > amount) {
|
||||
FilterCard filter = new FilterCard("card in target player's hand");
|
||||
|
|
|
@ -31,14 +31,14 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterEnchantmentPermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -112,7 +112,7 @@ class HarmonicConvergenceEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
|
||||
CardsImpl cards = new CardsImpl(Zone.PICK);
|
||||
CardsImpl cards = new CardsImpl();
|
||||
for (Permanent permanent : list) {
|
||||
cards.add(permanent);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
package mage.sets.urzaslegacy;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -43,7 +40,9 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
|
@ -103,7 +102,7 @@ public class RavenFamiliar extends CardImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 3);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
|
|
|
@ -116,7 +116,7 @@ class KrovikanSorcererEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
Cards initialHand = player.getHand().copy();
|
||||
player.drawCards(2, game);
|
||||
Cards drawnCards = new CardsImpl(Zone.PICK);
|
||||
Cards drawnCards = new CardsImpl();
|
||||
for (UUID cardId : player.getHand()) {
|
||||
if (!initialHand.contains(cardId)) {
|
||||
drawnCards.add(cardId);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.sets.weatherlight;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
|
@ -42,8 +43,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
|
@ -92,8 +91,8 @@ class DoomsdayEffect extends OneShotEffect {
|
|||
|
||||
if (player != null) {
|
||||
//Search your library and graveyard for five cards
|
||||
Cards allCards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards allCards = new CardsImpl();
|
||||
Cards cards = new CardsImpl();
|
||||
allCards.addAll(player.getLibrary().getCardList());
|
||||
allCards.addAll(player.getGraveyard());
|
||||
int number = Math.min(5, allCards.size());
|
||||
|
|
|
@ -112,7 +112,7 @@ class BalaGedThiefEffect extends OneShotEffect {
|
|||
|
||||
int numberOfAllies = game.getBattlefield().countAll(filter, you.getId(), game);
|
||||
|
||||
Cards cardsInHand = new CardsImpl(Zone.PICK);
|
||||
Cards cardsInHand = new CardsImpl();
|
||||
cardsInHand.addAll(targetPlayer.getHand());
|
||||
|
||||
int count = Math.min(cardsInHand.size(), numberOfAllies);
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -41,6 +37,10 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -98,7 +98,7 @@ class MerfolkWayfinderEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
Cards cardsToReveal = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 3);
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
|
@ -43,6 +39,10 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
|
@ -120,7 +120,7 @@ class SphinxOfJwarIsleEffect extends OneShotEffect {
|
|||
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
Cards cards = new CardsImpl(Zone.PICK);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
player.lookAtCards("Sphinx of Jwar Isle", cards, game);
|
||||
} else {
|
||||
|
|
|
@ -168,7 +168,7 @@ class SummoningTrapEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 7));
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY,
|
||||
|
|
|
@ -35,7 +35,6 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
@ -77,7 +76,7 @@ public class RevealTargetPlayerLibraryEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(player.getLibrary().getTopCards(game, amountCards.calculate(game, source, this)));
|
||||
player.revealCards(sourceObject.getIdName() + " - Top " + amountCards.toString() + "cards of " + targetPlayer.getName() + "\'s library", cards, game);
|
||||
return true;
|
||||
|
|
|
@ -131,7 +131,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
}
|
||||
int numberToReveal = this.numberCardsToReveal.calculate(game, source, this);
|
||||
if (numberToReveal > 0) {
|
||||
Cards revealedCards = new CardsImpl(Zone.HAND);
|
||||
Cards revealedCards = new CardsImpl();
|
||||
numberToReveal = Math.min(player.getHand().size(), numberToReveal);
|
||||
if (player.getHand().size() > numberToReveal) {
|
||||
TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in " + player.getLogName() + "'s hand"));
|
||||
|
|
|
@ -109,7 +109,7 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
|
|||
}
|
||||
|
||||
// cards in Library
|
||||
Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cardsInLibrary = new CardsImpl();
|
||||
cardsInLibrary.addAll(targetPlayer.getLibrary().getCards(game));
|
||||
cardsCount = (cardName.isEmpty() ? 0 : cardsInLibrary.count(filter, game));
|
||||
filter.setMessage("card named " + cardName + " in the library of " + targetPlayer.getLogName());
|
||||
|
|
|
@ -116,7 +116,7 @@ class HideawayExileEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
if (cards.size() > 0) {
|
||||
TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1);
|
||||
|
|
|
@ -38,7 +38,6 @@ import java.util.Map;
|
|||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
|
@ -53,7 +52,6 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
|
||||
private static Random rnd = new Random();
|
||||
private UUID ownerId;
|
||||
private Zone zone;
|
||||
|
||||
public CardsImpl() {
|
||||
}
|
||||
|
@ -70,21 +68,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
}
|
||||
}
|
||||
|
||||
public CardsImpl(Zone zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
public CardsImpl(Zone zone, Collection<Card> cards) {
|
||||
this(zone);
|
||||
for (Card card : cards) {
|
||||
this.add(card.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public CardsImpl(final CardsImpl cards) {
|
||||
this.addAll(cards);
|
||||
this.ownerId = cards.ownerId;
|
||||
this.zone = cards.zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,7 +112,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
if (this.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
UUID[] cards = this.toArray(new UUID[0]);
|
||||
UUID[] cards = this.toArray(new UUID[this.size()]);
|
||||
return game.getCard(cards[rnd.nextInt(cards.length)]);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ package mage.game;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.cards.CardsImpl;
|
||||
|
||||
/**
|
||||
|
@ -48,7 +47,7 @@ public class ExileZone extends CardsImpl implements Serializable {
|
|||
}
|
||||
|
||||
public ExileZone(UUID id, String name, boolean hidden) {
|
||||
super(Zone.EXILED);
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.hidden = hidden;
|
||||
|
|
|
@ -4,12 +4,11 @@ import java.util.UUID;
|
|||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Zone;
|
||||
|
||||
public class Graveyard extends CardsImpl {
|
||||
|
||||
public Graveyard() {
|
||||
super(Zone.GRAVEYARD);
|
||||
super();
|
||||
}
|
||||
|
||||
public Graveyard(final Graveyard graveyard) {
|
||||
|
|
|
@ -245,13 +245,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this(UUID.randomUUID());
|
||||
this.name = name;
|
||||
this.range = range;
|
||||
hand = new CardsImpl(Zone.HAND);
|
||||
hand = new CardsImpl();
|
||||
graveyard = new Graveyard();
|
||||
abilities = new AbilitiesImpl<>();
|
||||
counters = new Counters();
|
||||
manaPool = new ManaPool(playerId);
|
||||
library = new Library(playerId);
|
||||
sideboard = new CardsImpl(Zone.OUTSIDE);
|
||||
sideboard = new CardsImpl();
|
||||
}
|
||||
|
||||
protected PlayerImpl(UUID id) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
@ -91,9 +92,13 @@ public class TargetCardInLibrary extends TargetCard {
|
|||
cards = new ArrayList<>(targetPlayer.getLibrary().getTopCards(game, librarySearchLimit));
|
||||
}
|
||||
Collections.sort(cards, new CardNameComparator());
|
||||
Cards cardsId = new CardsImpl();
|
||||
for (Card card : cards) {
|
||||
cardsId.add(card);
|
||||
}
|
||||
while (!isChosen() && !doneChosing()) {
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
if (!player.chooseTarget(outcome, new CardsImpl(Zone.LIBRARY, cards), this, null, game)) {
|
||||
if (!player.chooseTarget(outcome, cardsId, this, null, game)) {
|
||||
return chosen;
|
||||
}
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
|
|
Loading…
Reference in a new issue