Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Andy Fries 2015-08-05 09:54:54 -07:00
commit 8412221585
159 changed files with 2070 additions and 2251 deletions

View file

@ -31,7 +31,6 @@
*
* Created on 15-Dec-2009, 10:54:01 PM
*/
package mage.client.table;
import java.awt.Color;
@ -122,7 +121,9 @@ public class TablesPanel extends javax.swing.JPanel {
private static final int[] defaultColumnsWidth = {35, 150, 120, 180, 80, 120, 80, 60, 60};
/** Creates new form TablesPanel */
/**
* Creates new form TablesPanel
*/
public TablesPanel() {
tableModel = new TableTableModel();
@ -146,8 +147,7 @@ public class TablesPanel extends javax.swing.JPanel {
chatPanel.setBorder(null);
chatPanel.setChatType(ChatPanel.ChatType.TABLES);
filterButtons = new JToggleButton[]
{btnStateWaiting, btnStateActive, btnStateFinished,
filterButtons = new JToggleButton[]{btnStateWaiting, btnStateActive, btnStateFinished,
btnTypeMatch, btnTypeTourneyConstructed, btnTypeTourneyLimited,
btnFormatBlock, btnFormatStandard, btnFormatModern, btnFormatLegacy, btnFormatVintage, btnFormatCommander, btnFormatTinyLeader, btnFormatLimited, btnFormatOther,
btnSkillBeginner, btnSkillCasual, btnSkillSerious};
@ -163,11 +163,9 @@ public class TablesPanel extends javax.swing.JPanel {
restoreSettings();
Action openTableAction;
openTableAction = new AbstractAction()
{
openTableAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e)
{
public void actionPerformed(ActionEvent e) {
int modelRow = Integer.valueOf(e.getActionCommand());
UUID tableId = (UUID) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 3);
UUID gameId = (UUID) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 2);
@ -241,11 +239,9 @@ public class TablesPanel extends javax.swing.JPanel {
};
Action closedTableAction;
closedTableAction = new AbstractAction()
{
closedTableAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e)
{
public void actionPerformed(ActionEvent e) {
int modelRow = Integer.valueOf(e.getActionCommand());
String action = (String) matchesModel.getValueAt(modelRow, MatchesTableModel.ACTION_COLUMN);
switch (action) {
@ -254,8 +250,7 @@ public class TablesPanel extends javax.swing.JPanel {
if (gameList != null && gameList.size() > 0) {
if (gameList.size() == 1) {
session.replayGame(gameList.get(0));
}
else {
} else {
gameChooser.show(gameList, MageFrame.getDesktop().getMousePosition());
}
}
@ -331,8 +326,7 @@ public class TablesPanel extends javax.swing.JPanel {
}
if (this.btnStateFinished.isSelected()) {
this.jSplitPane2.setDividerLocation(-1);
}
else {
} else {
location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2, null);
if (location != null && jSplitPane2 != null) {
jSplitPane2.setDividerLocation(Integer.parseInt(location));
@ -390,8 +384,7 @@ public class TablesPanel extends javax.swing.JPanel {
updateMatchesTask = new UpdateMatchesTask(session, roomId, this);
updateMatchesTask.execute();
}
}
else {
} else {
if (updateMatchesTask != null) {
updateMatchesTask.cancel(true);
}
@ -520,31 +513,31 @@ public class TablesPanel extends javax.swing.JPanel {
// format
List<RowFilter<Object, Object>> formatFilterList = new ArrayList<>();
if (btnFormatBlock.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Block", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Constructed.*Block", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatStandard.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Standard", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Constructed - Standard", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatModern.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Modern", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Constructed - Modern", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatLegacy.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Legacy", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Constructed - Legacy", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatVintage.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Vintage", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Constructed - Vintage", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatCommander.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Commander", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Commander|^Duel Commander", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatTinyLeader.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Tiny", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Tiny", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatLimited.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Limited", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Limited", TableTableModel.COLUMN_DECK_TYPE));
}
if (btnFormatOther.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("Pauper|Extended", TableTableModel.COLUMN_DECK_TYPE));
formatFilterList.add(RowFilter.regexFilter("^Constructed - Pauper|^Constructed - Extended|^Constructed - Historical|^Constructed - Super", TableTableModel.COLUMN_DECK_TYPE));
}
List<RowFilter<Object, Object>> skillFilterList = new ArrayList<>();
@ -595,10 +588,10 @@ public class TablesPanel extends javax.swing.JPanel {
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@ -1180,8 +1173,7 @@ public class TablesPanel extends javax.swing.JPanel {
private void btnStateFinishedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStateFinishedActionPerformed
if (this.btnStateFinished.isSelected()) {
this.jSplitPane2.setDividerLocation(-1);
}
else {
} else {
this.jSplitPane2.setDividerLocation(this.jPanel3.getHeight());
}
this.startTasks();
@ -1192,7 +1184,6 @@ public class TablesPanel extends javax.swing.JPanel {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JToggleButton btnFormatBlock;
private javax.swing.JToggleButton btnFormatCommander;
@ -1239,6 +1230,7 @@ public class TablesPanel extends javax.swing.JPanel {
}
class TableTableModel extends AbstractTableModel {
ImageIcon tourneyIcon = new javax.swing.ImageIcon(getClass().getResource("/tables/tourney_icon.png"));
ImageIcon matchIcon = new javax.swing.ImageIcon(getClass().getResource("/tables/match_icon.png"));
@ -1254,7 +1246,8 @@ class TableTableModel extends AbstractTableModel {
private final String[] columnNames = new String[]{"M/T", "Deck Type", "Owner / Players", "Game Type", "Info", "Status", "Created / Started", "Skill Level", "Action"};
private TableView[] tables = new TableView[0];
private static final DateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");;
private static final DateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
;
private Session session;
@ -1410,7 +1403,8 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
get();
} catch (InterruptedException | ExecutionException ex) {
logger.fatal("Update Tables Task error", ex);
} catch (CancellationException ex) {}
} catch (CancellationException ex) {
}
}
}
@ -1449,7 +1443,8 @@ class UpdatePlayersTask extends SwingWorker<Void, Collection<RoomUsersView>> {
get();
} catch (InterruptedException | ExecutionException ex) {
logger.fatal("Update Players Task error", ex);
} catch (CancellationException ex) {}
} catch (CancellationException ex) {
}
}
}
@ -1532,7 +1527,6 @@ class MatchesTableModel extends AbstractTableModel {
return matches[row].getTableId();
}
@Override
public String getColumnName(int columnIndex) {
String colName = "";
@ -1593,7 +1587,8 @@ class UpdateMatchesTask extends SwingWorker<Void, Collection<MatchView>> {
get();
} catch (InterruptedException | ExecutionException ex) {
logger.fatal("Update Matches Task error", ex);
} catch (CancellationException ex) {}
} catch (CancellationException ex) {
}
}
}

View file

@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 2;
public final static String MAGE_VERSION_MINOR_PATCH = "v4";
public final static String MAGE_VERSION_MINOR_PATCH = "v5";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -25,9 +25,11 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.view;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Modes;
@ -35,9 +37,14 @@ import mage.abilities.SpellAbility;
import mage.abilities.costs.mana.ManaCosts;
import mage.cards.Card;
import mage.cards.SplitCard;
import mage.constants.*;
import mage.constants.AbilityType;
import mage.constants.CardType;
import mage.constants.MageObjectType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
@ -47,15 +54,11 @@ import mage.game.stack.StackAbility;
import mage.target.Target;
import mage.target.Targets;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.game.Game;
/**
* @author BetaSteward_at_googlemail.com
*/
public class CardView extends SimpleCardView {
private static final long serialVersionUID = 1L;
protected UUID parentId;
@ -134,13 +137,42 @@ public class CardView extends SimpleCardView {
*
* @param card
* @param game
* @param controlled is the card view created for the card controller - used for morph / face down cards to know which player may see information for the card
* @param controlled is the card view created for the card controller - used
* for morph / face down cards to know which player may see information for
* the card
*/
public CardView(Card card, Game game, boolean controlled) {
this(card, game, controlled, false);
}
/**
*
* @param card
* @param game
* @param controlled is the card view created for the card controller - used
* for morph / face down cards to know which player may see information for
* the card
* @param showFaceDownCard if true and the card is not on the battelfield,
* also a face dwon card is shown in the view dwon cards will be shown
*/
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard) {
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null);
// no information available for face down cards as long it's not a controlled face down morph card
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
if (game != null && card.isFaceDown(game)) {
boolean showFaceUp = true;
if (game != null) {
if (card.isFaceDown(game)) {
showFaceUp = false;
if (!Zone.BATTLEFIELD.equals(game.getState().getZone(card.getId()))) {
if (showFaceDownCard) {
showFaceUp = true;
}
}
}
}
// boolean showFaceUp = game == null || !card.isFaceDown(game) || (!game.getState().getZone(card.getId()).equals(Zone.BATTLEFIELD) && showFaceDownCard);
if (!showFaceUp) {
this.fillEmpty(card, controlled);
if (card instanceof Spell) {
// special handling for casting of Morph cards
@ -151,8 +183,8 @@ public class CardView extends SimpleCardView {
}
this.power = "2";
this.toughness = "2";
this.rules.add("You may cast this card as a 2/2 face-down creature, with no text," +
" no name, no subtypes, and no mana cost by paying {3} rather than paying its mana cost.");
this.rules.add("You may cast this card as a 2/2 face-down creature, with no text,"
+ " no name, no subtypes, and no mana cost by paying {3} rather than paying its mana cost.");
return;
} else {
if (card instanceof Permanent) {
@ -240,7 +272,7 @@ public class CardView extends SimpleCardView {
this.color = card.getColor(game);
this.canTransform = card.canTransform();
this.flipCard = card.isFlipCard();
this.faceDown = game != null ? card.isFaceDown(game) : false;
this.faceDown = !showFaceUp;
if (card instanceof PermanentToken) {
this.isToken = true;
@ -533,8 +565,7 @@ public class CardView extends SimpleCardView {
}
/**
* Returns UUIDs for targets.
* Can be null if there is no target selected.
* Returns UUIDs for targets. Can be null if there is no target selected.
*
* @return
*/
@ -595,7 +626,8 @@ public class CardView extends SimpleCardView {
}
/**
* Stores the name of the original name, to provide it for a flipped or transformed or copying card
* Stores the name of the original name, to provide it for a flipped or
* transformed or copying card
*
* @return
*/

View file

@ -72,6 +72,12 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
}
}
public CardsView(Game game, Collection<? extends Card> cards, boolean showFaceDown) {
for (Card card : cards) {
this.put(card.getId(), new CardView(card, game, false, showFaceDown));
}
}
public CardsView(Collection<? extends Ability> abilities, Game game) {
for (Ability ability : abilities) {
MageObject sourceObject = null;

View file

@ -1,24 +1,23 @@
package mage.deck;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import mage.cards.decks.Deck;
import mage.constants.SetType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import mage.cards.decks.Deck;
import mage.constants.SetType;
/**
* This class represents a deck from any past standard.
*
* This class was originally made to work with the historical standard ruleset.
* Data taken from http://thattournament.website/historic-tournament.php
* (site changed, originally http://mtgt.nfshost.com/historic-tournament.php)
* Data taken from http://thattournament.website/historic-tournament.php (site
* changed, originally http://mtgt.nfshost.com/historic-tournament.php)
*
* If there are any questions or corrections, feel free to contact me.
*
@ -31,73 +30,52 @@ public class HistoricalStandard extends Constructed {
* Kamigawa/Ravnica standard, where rotation stabilized.
*/
protected static final String[][] standards = {
// 1st standard: The Dark, Fallen Empires, and 4th.
{"DRK", "FEM", "4ED"},
// 2nd standard: 4th, Fallen Empires, Ice Age, Chronicles, Homelands,
// Alliances, and Mirage.
{"FEM", "4ED", "ICE", "HML", "ALL", "MIR"},
// 3rd standard: 4th, Chronicles, Alliances, Mirage, Visions.
{"4ED", "ALL", "MIR", "VIS"},
// 4th Standard: Ice Age, Homelands, Alliances, Mirage, Visions, 5th,
// and Weatherlight.
{"ICE", "HML", "ALL", "MIR", "VIS", "5ED", "WTH"},
// 5th Standard: Mirage, Visions, 5th, Weatherlight, Tempest,
// Stronghold, and Exodus.
{"MIR", "VIS", "5ED", "WTH", "TMP", "STH", "EXO"},
// 6th Standard: 5th, Tempest, Stronghold, Exodus, Urza's Saga, Urza's
// Legacy, Urza's Destiny.
{"5ED", "TMP", "STH", "EXO", "USG", "ULG"},
// 7th Standard: Tempest, Stronghold, Exodus, Urza's Saga, Urza's
// Legacy, 6th, Urza's Destiny.
{"TMP", "STH", "EXO", "USG", "ULG", "6ED", "UDS"},
// 8th Standard: Urza's Saga, Urza's Legacy, 6th, Urza's Destiny,
// Mercadian Masques, Nemesis, Prophecy.
{"USG", "ULG", "6ED", "UDS", "MMQ", "NMS", "PCY"},
// 9th Standard
{"6ED", "MMQ", "NMS", "PCY", "INV", "PLS"},
// 10th Standard
{"7ED", "MMQ", "NMS", "PCY", "INV", "PLS", "APC"},
// 11th Standard
{"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"},
// 12th Standard
{"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "LGN"},
{"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
// 13th Standard
{"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "LGN"},
{"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
// 14th Standard
{"8ED", "ONS", "LGN", "LGN", "MRD", "DST", "5DN"},
{"8ED", "ONS", "LGN", "SCG", "MRD", "DST", "5DN"},
// 15th Standard
{"8ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
// 16th Standard
{"9ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
// 17th Standard
{"9ED", "CHK", "BOK", "SOK", "RAV", "GPT", "DIS", "CSP"},
// 18th Standard
{"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
// 19th Standard
{"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "PLC", "FUT"},
// 20th Standard
{"10E", "CSP", "TSP", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
// 21st Standard
{"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
};
@ -122,6 +100,7 @@ public class HistoricalStandard extends Constructed {
/**
* Overridden validate function. Changes the standard sets, then uses the
* regular validation function to test validity.
*
* @param deck - the deck to validate.
* @return
*/

View file

@ -1,25 +1,24 @@
package mage.deck;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import mage.cards.decks.Deck;
import mage.constants.SetType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.decks.Constructed;
import mage.cards.decks.Deck;
import mage.constants.SetType;
/**
* This class represents a deck conforming to the rules contained in the
subreddit /r/SuperStandard.
* subreddit /r/SuperStandard.
*
* This class was originally made to work with the historical standard ruleset.
* Data taken from http://thattournament.website/historic-tournament.php
* (site changed, originally thtp://mtgt.nfshost.com/historic-tournament.php)
* Data taken from http://thattournament.website/historic-tournament.php (site
* changed, originally thtp://mtgt.nfshost.com/historic-tournament.php)
*
* If there are any questions or corrections, feel free to contact me.
*
@ -33,37 +32,26 @@ public class SuperStandard extends Constructed {
* Data taken from http://thattournament.website/historic-tournament.php
*/
protected static final String[][] standards = {
// 11th Standard
{"7ED", "INV", "APC", "PLS", "ODY", "TOR", "JUD"},
// 12th Standard
{"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "LGN"},
{"7ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
// 13th Standard
{"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "LGN"},
{"8ED", "ODY", "TOR", "JUD", "ONS", "LGN", "SCG"},
// 14th Standard
{"8ED", "ONS", "LGN", "LGN", "MRD", "DST", "5DN"},
{"8ED", "ONS", "LGN", "SCG", "MRD", "DST", "5DN"},
// 15th Standard
{"8ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
// 16th Standard
{"9ED", "MRD", "DST", "5DN", "CHK", "BOK", "SOK"},
// 17th Standard
{"9ED", "CHK", "BOK", "SOK", "RAV", "GPT", "DIS", "CSP"},
// 18th Standard
{"9ED", "RAV", "GPT", "DIS", "CSP", "TSP", "TSB", "PLC", "FUT"},
// 19th Standard
{"10E", "RAV", "GPT", "DIS", "CSP", "TSP", "PLC", "FUT"},
// 20th Standard
{"10E", "CSP", "TSP", "PLC", "FUT", "LRW", "MOR", "SHM", "EVE"},
// 21st Standard
{"10E", "LRW", "MOR", "SHM", "EVE", "ALA", "CON", "ARB"}
};
@ -87,6 +75,7 @@ public class SuperStandard extends Constructed {
/**
* Overridden validate function. Changes the standard sets, then uses the
* regular validation function to test validity.
*
* @param deck - the deck to validate.
* @return
*/

View file

@ -431,6 +431,7 @@ public class HumanPlayer extends PlayerImpl {
if (!choosable.isEmpty()) {
options.put("choosable", (Serializable) choosable);
}
game.fireSelectTargetEvent(playerId, target.getMessage(), cards, required, options);
waitForResponse(game);
if (response.getUUID() != null) {

View file

@ -825,7 +825,9 @@ public class GameController implements GameCallback {
@Override
public void execute(UUID playerId) {
if (cards != null) {
getGameSession(playerId).target(question, new CardsView(game, cards.getCards(game)), targets, required, options);
Zone targetZone = (Zone) options.get("targetZone");
boolean showFaceDown = targetZone != null && targetZone.equals(Zone.PICK);
getGameSession(playerId).target(question, new CardsView(game, cards.getCards(game), showFaceDown), targets, required, options);
} else if (perms != null) {
CardsView permsView = new CardsView();
for (Permanent perm : perms) {

View file

@ -29,7 +29,7 @@ package mage.sets.alarareborn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;

View file

@ -32,7 +32,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
@ -58,7 +58,7 @@ public class DragonArch extends CardImpl {
this.expansionSetCode = "APC";
// {2}, {T}: You may put a multicolored creature card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCreatureOnBattlefieldEffect(filter),
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter),
new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -30,8 +30,8 @@ package mage.sets.apocalypse;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.TrampleAbility;

View file

@ -56,7 +56,7 @@ public class MaskOfIntolerance extends CardImpl {
// At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), TargetController.ANY, false);
this.addAbility(new ConditionalTriggeredAbility(ability, new MaskOfIntoleranceCondition(),
"At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her."));
"At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, {this} deals 3 damage to him or her."));
}
public MaskOfIntolerance(final MaskOfIntolerance card) {

View file

@ -28,6 +28,7 @@
package mage.sets.apocalypse;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -54,6 +55,7 @@ public class WildResearch extends CardImpl {
private static final FilterCard filterEnchantment = new FilterCard("enchantment card");
private static final FilterCard filterInstant = new FilterCard("instant card");
static {
filterEnchantment.add(new CardTypePredicate(CardType.ENCHANTMENT));
filterInstant.add(new CardTypePredicate(CardType.INSTANT));
@ -103,22 +105,23 @@ class WildResearchEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
Card card = controller.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
Cards cards = new CardsImpl();
cards.add(card);
player.revealCards("Wild Research", cards, game, true);
controller.revealCards(sourceObject.getIdName(), cards, game, true);
}
}
}
player.discardOne(true, source, game);
player.shuffleLibrary(game);
controller.discardOne(true, source, game);
controller.shuffleLibrary(game);
return true;
}
return false;

View file

@ -30,8 +30,8 @@ package mage.sets.avacynrestored;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilityPairedEffect;
import mage.abilities.keyword.SoulbondAbility;

View file

@ -34,7 +34,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.CountersCount;
import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.ManaEffect;
@ -72,10 +72,10 @@ public class PetalmaneBaku extends CardImpl {
Ability ability = new DynamicManaAbility(
new Mana(0, 0, 0, 0, 0, 0, 1),
new RemovedCountersForCostValue(),
new TapSourceCost(),
new ManaCostsImpl<>("{1}"),
"Add X mana of any one color to your mana pool",
true, new CountersCount(CounterType.KI));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance(),
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(),
"Remove X ki counters from {this}"));
this.addAbility(ability);
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
@ -39,7 +38,6 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -125,16 +123,15 @@ public class QuillmaneBaku extends CardImpl {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent != null) {
player.moveCardToHandWithInfo((Card) permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.moveCards(permanent, null, Zone.HAND, source, game);
}
return true;
}
return false;
}
}
}

View file

@ -27,8 +27,8 @@
*/
package mage.sets.bornofthegods;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
@ -44,7 +44,6 @@ import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterBasicLandCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
@ -59,7 +58,6 @@ public class Peregrination extends CardImpl {
super(ownerId, 132, "Peregrination", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{G}");
this.expansionSetCode = "BNG";
// Seach your library for up to two basic land cards, reveal those cards, and put one onto the battlefield tapped and the other into your hand. Shuffle your library, then scry 1.
this.getSpellAbility().addEffect(new PeregrinationEffect());
Effect effect = new ScryEffect(1);
@ -97,36 +95,39 @@ class PeregrinationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller == null || sourceObject == null) {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
Player player = game.getPlayer(source.getControllerId());
if (player.searchLibrary(target, game)) {
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Cards revealed = new CardsImpl();
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
Card card = controller.getLibrary().getCard(cardId, game);
revealed.add(card);
}
player.revealCards("Peregrination", revealed, game);
controller.revealCards(sourceObject.getIdName(), revealed, game);
if (target.getTargets().size() == 2) {
TargetCard target2 = new TargetCard(Zone.PICK, filter);
player.choose(Outcome.Benefit, revealed, target2, game);
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter);
controller.choose(Outcome.Benefit, revealed, target2, game);
Card card = revealed.get(target2.getFirstTarget(), game);
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
revealed.remove(card);
card = revealed.getCards(game).iterator().next();
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
}
else if (target.getTargets().size() == 1) {
controller.moveCards(card, null, Zone.HAND, source, game);
} else if (target.getTargets().size() == 1) {
Card card = revealed.getCards(game).iterator().next();
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
}
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return true;
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return false;
}

View file

@ -103,13 +103,13 @@ class SatyrWayfinderEffect extends OneShotEffect {
if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getName(), cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, filterPutInHand);
if (properCardFound &&
controller.chooseUse(outcome, "Put a land card into your hand?", source, game) &&
controller.choose(Outcome.DrawCard, cards, target, game)) {
if (properCardFound
&& controller.chooseUse(outcome, "Put a land card into your hand?", source, game)
&& controller.choose(Outcome.DrawCard, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.remove(card);
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
}
}

View file

@ -28,6 +28,7 @@
package mage.sets.coldsnap;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -92,18 +93,18 @@ class ScryingSheetsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.getLibrary().size() > 0) {
Card card = player.getLibrary().getFromTop(game);
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
CardsImpl cards = new CardsImpl();
cards.add(card);
player.lookAtCards("Scrying Sheets", cards, game);
controller.lookAtCards(sourceObject.getIdName(), cards, game);
if (card.getSupertype().contains("Snow")) {
if (player.chooseUse(outcome, new StringBuilder("Reveal ").append(card.getName()).append(" and put it into your hand?").toString(), source, game)) {
card = player.getLibrary().removeFromTop(game);
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
player.revealCards("Scrying Sheets", cards, game);
if (controller.chooseUse(outcome, "Reveal " + card.getLogName() + " and put it into your hand?", source, game)) {
controller.moveCards(card, null, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), cards, game);
}
}
}

View file

@ -113,20 +113,18 @@ class DesecratorHagEffect extends OneShotEffect {
}
}
if (cards.size() == 0) {
return false;
return true;
}
if (cards.size() > 1
&& you.choose(Outcome.DrawCard, cards, target, game)) {
if (target != null) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
return you.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
return you.moveCards(card, null, Zone.HAND, source, game);
}
}
} else {
for (Card card : cards.getCards(game)) {
return you.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
}
return you.moveCards(cards, null, Zone.HAND, source, game);
}
}
return false;

View file

@ -31,8 +31,8 @@ import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;

View file

@ -27,8 +27,8 @@
*/
package mage.sets.commander;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -57,7 +57,6 @@ public class KodamasReach extends CardImpl {
this.expansionSetCode = "CMD";
this.subtype.add("Arcane");
// Search your library for up to two basic land cards, reveal those cards, and put one onto the battlefield tapped and the other into your hand. Then shuffle your library.
this.getSpellAbility().addEffect(new KodamasReachEffect());
}
@ -92,41 +91,44 @@ class KodamasReachEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller == null || sourceObject == null) {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
Player player = game.getPlayer(source.getControllerId());
if (player.searchLibrary(target, game)) {
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Cards revealed = new CardsImpl();
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
Card card = controller.getLibrary().getCard(cardId, game);
revealed.add(card);
}
player.revealCards("Kodama's Reach", revealed, game);
controller.revealCards(sourceObject.getIdName(), revealed, game);
if (target.getTargets().size() == 2) {
TargetCard target2 = new TargetCard(Zone.PICK, filter);
player.choose(Outcome.Benefit, revealed, target2, game);
controller.choose(Outcome.Benefit, revealed, target2, game);
Card card = revealed.get(target2.getFirstTarget(), game);
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
revealed.remove(card);
}
card = revealed.getCards(game).iterator().next();
if (card != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
}
}
else if (target.getTargets().size() == 1) {
} else if (target.getTargets().size() == 1) {
Card card = revealed.getCards(game).iterator().next();
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
}
}
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return true;
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return false;
}

View file

@ -51,7 +51,6 @@ public class WhirlpoolWhelm extends CardImpl {
super(ownerId, 69, "Whirlpool Whelm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "CMD";
// Clash with an opponent, then return target creature to its owner's hand. If you win, you may put that creature on top of its owner's library instead.
this.getSpellAbility().addEffect(new WhirlpoolWhelmEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -93,9 +92,9 @@ class WhirlpoolWhelmEffect extends OneShotEffect {
topOfLibrary = controller.chooseUse(outcome, "Put " + creature.getLogName() + " to top of libraray instead?", source, game);
}
if (topOfLibrary) {
controller.moveCardToHandWithInfo(creature, source.getSourceId(), game, Zone.BATTLEFIELD);
} else {
controller.moveCardToLibraryWithInfo(creature, source.getSourceId(), game, Zone.BATTLEFIELD, true, true);
} else {
controller.moveCards(creature, null, Zone.HAND, source, game);
}
return true;
}

View file

@ -29,7 +29,7 @@ package mage.sets.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.HorsemanshipAbility;
import mage.cards.CardImpl;

View file

@ -32,8 +32,8 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
@ -111,12 +111,7 @@ class GraveSifterEffect extends OneShotEffect {
filter.add(new SubtypePredicate(typeChoice.getChoice()));
Target target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, filter);
player.chooseTarget(outcome, target, source, game);
for (UUID cardId: target.getTargets()) {
Card card = game.getCard(cardId);
if (card !=null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
}
}
player.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game);
}
}

View file

@ -28,14 +28,14 @@
package mage.sets.conflux;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetCardInYourGraveyard;
/**

View file

@ -28,25 +28,19 @@
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.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ReturnToHandTargetPermanentCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactCard;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetControlledPermanent;
/**
@ -65,7 +59,7 @@ public class MasterTransmuter extends CardImpl {
this.toughness = new MageInt(2);
// {U}, {tap}, Return an artifact you control to its owner's hand: You may put an artifact card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MasterTransmuterEffect(), new ManaCostsImpl("{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(new FilterArtifactCard("an artifact card")), new ManaCostsImpl("{U}"));
ability.addCost(new TapSourceCost());
ability.addCost(new ReturnToHandTargetPermanentCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact"))));
this.addAbility(ability);
@ -81,38 +75,3 @@ public class MasterTransmuter extends CardImpl {
return new MasterTransmuter(this);
}
}
class MasterTransmuterEffect extends OneShotEffect {
public MasterTransmuterEffect() {
super(Outcome.Benefit);
this.staticText = "You may put an artifact card from your hand onto the battlefield";
}
public MasterTransmuterEffect(final MasterTransmuterEffect effect) {
super(effect);
}
@Override
public MasterTransmuterEffect copy() {
return new MasterTransmuterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetCardInHand(new FilterArtifactCard("an artifact card from your hand"));
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.chooseUse(outcome, "Put an artifact from your hand to battlefield?", source, game)
&& controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
}
}
}
return false;
}
}

View file

@ -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.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
@ -42,6 +38,10 @@ import mage.abilities.keyword.VigilanceAbility;
import mage.cards.Card;
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.game.Game;
import mage.players.Player;
@ -108,7 +108,7 @@ public class SkywardEyeProphets extends CardImpl {
if (card.getCardType().contains(CardType.LAND)) {
return controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
} else {
return controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
}
}
return true;

View file

@ -89,7 +89,7 @@ class PulseOfTheFieldsReturnToHandEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null && player.getLife() > controller.getLife()) {
Card card = game.getCard(source.getSourceId());
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.STACK);
controller.moveCards(card, null, Zone.HAND, source, game);
return true;
}
}

View file

@ -89,7 +89,7 @@ class PulseOfTheGridReturnToHandEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null && player.getHand().size() > controller.getHand().size()) {
Card card = game.getCard(source.getSourceId());
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.STACK);
controller.moveCards(card, null, Zone.HAND, source, game);
return true;
}
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.darksteel;
import java.util.UUID;
@ -178,7 +177,7 @@ class SwordOfLightAndShadowReturnToHandTargetEffect extends OneShotEffect {
case GRAVEYARD:
Card card = game.getCard(targetId);
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
controller.moveCards(card, null, Zone.HAND, source, game);
} else {
result = false;
}

View file

@ -29,15 +29,15 @@ package mage.sets.dissension;
import java.util.UUID;
import mage.MageObject;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
@ -99,14 +99,16 @@ class RiseEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cardsToHand = new CardsImpl();
Card cardInGraveyard = game.getCard(getTargetPointer().getFirst(game, source));
if (cardInGraveyard != null) {
controller.moveCardToHandWithInfo(cardInGraveyard, source.getSourceId(), game, Zone.GRAVEYARD);
cardsToHand.add(cardInGraveyard);
}
Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (permanent != null) {
controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
cardsToHand.add(permanent);
}
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
return true;
}
return false;

View file

@ -117,7 +117,7 @@ class MelekIzzetParagonTriggeredAbility extends TriggeredAbilityImpl {
if (event.getZone() == Zone.LIBRARY) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null
&& spell.getControllerId().equals(super.getControllerId())
&& spell.getOwnerId().equals(super.getControllerId())
&& (spell.getCardType().contains(CardType.INSTANT)
|| spell.getCardType().contains(CardType.SORCERY))) {
for (Effect effect : this.getEffects()) {

View file

@ -28,15 +28,14 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
@ -55,7 +54,6 @@ public class MorgueBurst extends CardImpl {
super(ownerId, 86, "Morgue Burst", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{B}{R}");
this.expansionSetCode = "DGM";
// Return target creature card from your graveyard to your hand. Morgue Burst deals damage to target creature or player equal to the power of the card returned this way.
this.getSpellAbility().addEffect(new MorgueBurstEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
@ -93,7 +91,7 @@ class MorgueBurstEffect extends OneShotEffect {
if (card != null) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.HAND);
player.moveCards(card, null, Zone.HAND, source, game);
int damage = card.getPower().getValue();
Permanent creature = game.getPermanent(source.getTargets().get(1).getTargets().get(0));
if (creature != null) {

View file

@ -27,7 +27,7 @@
*/
package mage.sets.dragonsoftarkir;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.AsThoughEffectImpl;
@ -94,15 +94,14 @@ class CommuneWithLavaEffect extends OneShotEffect {
Card sourceCard = game.getCard(source.getSourceId());
if (controller != null) {
int amount = source.getManaCostsToPay().getX();
List<Card> cards = controller.getLibrary().getTopCards(game, amount);
Set<Card> cards = controller.getLibrary().getTopCards(game, amount);
controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard.getIdName());
for (Card card : cards) {
if (card != null) {
controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourceCard.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
ContinuousEffect effect = new CommuneWithLavaMayPlayEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
}
return true;
}

View file

@ -95,7 +95,7 @@ class FoulRenewalEffect extends OneShotEffect {
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
int xValue = card.getToughness().getValue() * -1;
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
controller.moveCards(card, null, Zone.HAND, source, game);
if (xValue != 0) {
ContinuousEffect effect = new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getTargets().get(1).getFirstTarget()));

View file

@ -60,7 +60,6 @@ import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
@ -119,11 +118,11 @@ class NarsetTranscendentEffect1 extends OneShotEffect {
if (card != null) {
CardsImpl cards = new CardsImpl();
cards.add(card);
controller.lookAtCards(sourceObject.getName(), cards, game);
controller.lookAtCards(sourceObject.getIdName(), cards, game);
if (!card.getCardType().contains(CardType.CREATURE) && !card.getCardType().contains(CardType.LAND)) {
if (controller.chooseUse(outcome, "Reveal " + card.getName() + " and put it into your hand?", source, game)) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.revealCards(sourceObject.getName(), cards, game);
if (controller.chooseUse(outcome, "Reveal " + card.getLogName() + " and put it into your hand?", source, game)) {
controller.moveCards(card, null, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), cards, game);
}
}
return true;
@ -142,6 +141,7 @@ class NarsetTranscendentTriggeredAbility extends DelayedTriggeredAbility {
private NarsetTranscendentTriggeredAbility(final NarsetTranscendentTriggeredAbility ability) {
super(ability);
}
@Override
public NarsetTranscendentTriggeredAbility copy() {
return new NarsetTranscendentTriggeredAbility(this);
@ -157,8 +157,8 @@ class NarsetTranscendentTriggeredAbility extends DelayedTriggeredAbility {
if (event.getPlayerId().equals(this.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getFromZone().equals(Zone.HAND)) {
if (spell.getCard() != null &&
spell.getCard().getCardType().contains(CardType.INSTANT) || spell.getCard().getCardType().contains(CardType.SORCERY)) {
if (spell.getCard() != null
&& spell.getCard().getCardType().contains(CardType.INSTANT) || spell.getCard().getCardType().contains(CardType.SORCERY)) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(spell.getId()));
}

View file

@ -34,6 +34,8 @@ import mage.abilities.common.ExploitCreatureTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ExploitAbility;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -99,9 +101,11 @@ class ProfanerOfTheDeadReturnEffect extends OneShotEffect {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerPredicate(TargetController.OPPONENT));
filter.add(new ToughnessPredicate(Filter.ComparisonType.LessThan, exploitedCreature.getToughness().getValue()));
Cards cardsToHand = new CardsImpl();
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
cardsToHand.add(permanent);
}
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
return true;
}
return false;

View file

@ -105,7 +105,7 @@ class VolcanicVisionReturnToHandTargetEffect extends OneShotEffect {
case GRAVEYARD:
Card card = game.getCard(targetId);
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
controller.moveCards(card, null, Zone.HAND, source, game);
int damage = card.getManaCost().convertedManaCost();
if (damage > 0) {
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {

View file

@ -25,9 +25,10 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.eightediton;
package mage.sets.eighthedition;
import java.util.UUID;
import mage.constants.Rarity;
/**
*

View file

@ -32,12 +32,13 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
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.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
@ -98,9 +99,11 @@ class ReturnToHandAllNamedPermanentsEffect extends OneShotEffect {
} else {
filter.add(new NamePredicate(permanent.getName()));
}
Cards cardsToHand = new CardsImpl();
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
controller.moveCardToHandWithInfo(perm, source.getSourceId(), game, Zone.BATTLEFIELD);
cardsToHand.add(perm);
}
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
return true;
}
return true;

View file

@ -30,17 +30,14 @@ package mage.sets.eventide;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
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.TargetController;
import mage.constants.Zone;
@ -49,9 +46,6 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
@ -62,12 +56,14 @@ public class MindwrackLiege extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures you control");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("red creatures you control");
private static final FilterCreatureCard filter3 = new FilterCreatureCard("a blue or red creature card");
static {
filter.add(new ColorPredicate(ObjectColor.BLUE));
filter.add(new ControllerPredicate(TargetController.YOU));
filter2.add(new ColorPredicate(ObjectColor.RED));
filter2.add(new ControllerPredicate(TargetController.YOU));
filter3.add(Predicates.or(new ColorPredicate(ObjectColor.BLUE), new ColorPredicate(ObjectColor.RED)));
}
public MindwrackLiege(UUID ownerId) {
@ -85,8 +81,7 @@ public class MindwrackLiege extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter2, true)));
// {UR}{UR}{UR}{UR}: You may put a blue or red creature card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new MindwrackLiegeEffect(), new ManaCostsImpl("{U/R}{U/R}{U/R}{U/R}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter3), new ManaCostsImpl("{U/R}{U/R}{U/R}{U/R}")));
}
public MindwrackLiege(final MindwrackLiege card) {
@ -98,48 +93,3 @@ public class MindwrackLiege extends CardImpl {
return new MindwrackLiege(this);
}
}
class MindwrackLiegeEffect extends OneShotEffect {
private static final String choiceText = "Put a blue or red creature card from your hand onto the battlefield?";
private static final FilterCreatureCard filter = new FilterCreatureCard("a blue or red creature card");
static {
filter.add(Predicates.or(
new ColorPredicate(ObjectColor.BLUE),
new ColorPredicate(ObjectColor.RED)));
}
public MindwrackLiegeEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "You may put a blue or red creature card from your hand onto the battlefield";
}
public MindwrackLiegeEffect(final MindwrackLiegeEffect effect) {
super(effect);
}
@Override
public MindwrackLiegeEffect copy() {
return new MindwrackLiegeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) {
return false;
}
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId());
return true;
}
}
return false;
}
}

View file

@ -27,6 +27,8 @@
*/
package mage.sets.eventide;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
@ -43,8 +45,6 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -56,7 +56,6 @@ public class SanityGrinding extends CardImpl {
super(ownerId, 29, "Sanity Grinding", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{U}{U}{U}");
this.expansionSetCode = "EVE";
// Chroma - Reveal the top ten cards of your library. For each blue mana symbol in the mana costs of the revealed cards, target opponent puts the top card of his or her library into his or her graveyard. Then put the cards you revealed this way on the bottom of your library in any order.
this.getSpellAbility().addEffect(new SanityGrindingEffect());
this.getSpellAbility().addTarget(new TargetOpponent());
@ -86,18 +85,15 @@ class SanityGrindingEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player targetOpponent = game.getPlayer(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
Cards revealed = new CardsImpl();
int amount;
if (controller == null) {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller == null || sourceObject == null) {
return false;
}
amount = (Math.min(10, controller.getLibrary().size()));
for (int i = 0; i < amount; i++) {
revealed.add(controller.getLibrary().removeFromTop(game));
}
controller.revealCards("Sanity Grinding", revealed, game);
Cards revealed = new CardsImpl();
revealed.addAll(controller.getLibrary().getTopCards(game, 10));
controller.revealCards(sourceObject.getIdName(), revealed, game);
Player targetOpponent = game.getPlayer(source.getFirstTarget());
if (targetOpponent != null) {
targetOpponent.moveCards(targetOpponent.getLibrary().getTopCards(game, new ChromaSanityGrindingCount(revealed).calculate(game, source, this)),
Zone.LIBRARY, Zone.GRAVEYARD, source, game);

View file

@ -30,7 +30,7 @@ package mage.sets.fatereforged;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;

View file

@ -149,8 +149,8 @@ class RenownedWeaponsmithEffect extends OneShotEffect {
Card card = game.getCard(target.getFirstTarget());
Cards revealed = new CardsImpl();
revealed.add(card);
controller.revealCards(sourceObject.getName(), revealed, game);
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.revealCards(sourceObject.getIdName(), revealed, game);
controller.moveCards(revealed, null, Zone.HAND, source, game);
}
}
controller.shuffleLibrary(game);

View file

@ -100,7 +100,7 @@ class SageEyeAvengersEffect extends OneShotEffect {
if (sourceObject != null && controller != null) {
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetCreature != null && targetCreature.getPower().getValue() < sourceObject.getPower().getValue()) {
controller.moveCardToHandWithInfo(targetCreature, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.moveCards(targetCreature, null, Zone.HAND, source, game);
}
return true;
}

View file

@ -207,7 +207,7 @@ class SoulfireGrandMasterCastFromHandReplacementEffect extends ReplacementEffect
if (sourceCard != null) {
Player player = game.getPlayer(sourceCard.getOwnerId());
if (player != null) {
player.moveCardToHandWithInfo(sourceCard, source.getSourceId(), game, Zone.STACK);
player.moveCards(sourceCard, null, Zone.HAND, source, game);
discard();
return true;
}
@ -215,6 +215,7 @@ class SoulfireGrandMasterCastFromHandReplacementEffect extends ReplacementEffect
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
@ -225,9 +226,9 @@ class SoulfireGrandMasterCastFromHandReplacementEffect extends ReplacementEffect
//Something hit the stack from the hand, see if its a spell with this ability.
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (spellId == null && // because this effect works only once, spellId has to be null here
zEvent.getFromZone() == Zone.HAND &&
zEvent.getToZone() == Zone.STACK &&
event.getPlayerId().equals(source.getControllerId())) {
zEvent.getFromZone() == Zone.HAND
&& zEvent.getToZone() == Zone.STACK
&& event.getPlayerId().equals(source.getControllerId())) {
MageObject object = game.getObject(event.getTargetId());
if (object instanceof Card) {
if (filter.match((Card) object, game)) {
@ -236,9 +237,9 @@ class SoulfireGrandMasterCastFromHandReplacementEffect extends ReplacementEffect
}
} else {
// the spell goes to graveyard now so move it to hand again
if (zEvent.getFromZone() == Zone.STACK &&
zEvent.getToZone() == Zone.GRAVEYARD &&
event.getTargetId().equals(spellId)) {
if (zEvent.getFromZone() == Zone.STACK
&& zEvent.getToZone() == Zone.GRAVEYARD
&& event.getTargetId().equals(spellId)) {
Spell spell = game.getStack().getSpell(spellId);
if (spell != null && !spell.isCountered()) {
return true;

View file

@ -33,6 +33,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect;
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;
@ -89,24 +91,26 @@ class SuddenReclamationEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cardsToHand = new CardsImpl();
Target target = new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"));
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
controller.chooseTarget(outcome, target, source, game)) {
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
cardsToHand.add(card);
}
}
target = new TargetCardInYourGraveyard(new FilterLandCard("land card from your graveyard"));
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
controller.chooseTarget(outcome, target, source, game)) {
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
cardsToHand.add(card);
}
}
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
return true;
}
return false;

View file

@ -120,7 +120,7 @@ class TasigurTheGoldenFangEffect extends OneShotEffect {
opponent.chooseTarget(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
controller.moveCards(card, null, Zone.HAND, source, game);
}
}
}

View file

@ -105,11 +105,11 @@ class TemurSabertoothEffect extends OneShotEffect {
if (controller != null) {
Target target = new TargetPermanent(1, 1, filter, true);
if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
if (controller.chooseUse(outcome, "Return another creature to hand?", source, game) &&
controller.chooseTarget(outcome, target, source, game)) {
if (controller.chooseUse(outcome, "Return another creature to hand?", source, game)
&& controller.chooseTarget(outcome, target, source, game)) {
Permanent toHand = game.getPermanent(target.getFirstTarget());
if (toHand != null) {
controller.moveCardToHandWithInfo(toHand, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.moveCards(toHand, null, Zone.HAND, source, game);
}
game.addEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), source);
}

View file

@ -31,8 +31,9 @@ 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.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -52,7 +53,6 @@ public class Recall extends CardImpl {
super(ownerId, 93, "Recall", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{X}{U}");
this.expansionSetCode = "5ED";
// Discard X cards, then return a card from your graveyard to your hand for each card discarded this way.
this.getSpellAbility().addEffect(new RecallEffect());
// Exile Recall.
@ -87,21 +87,16 @@ class RecallEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
// Discard X cards
int amount = source.getManaCostsToPay().getX();
int discarded = Math.min(amount, player.getHand().size());
player.discard(amount, false, source, game);
Cards cardsDiscarded = controller.discard(source.getManaCostsToPay().getX(), false, source, game);
if (!cardsDiscarded.isEmpty()) {
// then return a card from your graveyard to your hand for each card discarded this way
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(discarded, new FilterCard());
target.choose(Outcome.ReturnToHand, player.getId(), source.getSourceId(), game);
for (UUID targetId : target.getTargets()) {
Card card = game.getCard(targetId);
if (card != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
}
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(cardsDiscarded.size(), new FilterCard());
target.setNotTarget(true);
target.choose(Outcome.ReturnToHand, controller.getId(), source.getSourceId(), game);
controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game);
}
return true;

View file

@ -132,7 +132,7 @@ class LinessaZephyrMageEffect extends OneShotEffect {
if (target.choose(Outcome.ReturnToHand, targetPlayer.getId(), source.getSourceId(), game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
targetPlayer.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
targetPlayer.moveCards(permanent, null, Zone.HAND, source, game);
}
}
@ -144,7 +144,7 @@ class LinessaZephyrMageEffect extends OneShotEffect {
if (target.choose(Outcome.ReturnToHand, targetPlayer.getId(), source.getSourceId(), game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
targetPlayer.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
targetPlayer.moveCards(permanent, null, Zone.HAND, source, game);
}
}
@ -156,7 +156,7 @@ class LinessaZephyrMageEffect extends OneShotEffect {
if (target.choose(Outcome.ReturnToHand, targetPlayer.getId(), source.getSourceId(), game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
targetPlayer.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
targetPlayer.moveCards(permanent, null, Zone.HAND, source, game);
}
}
@ -168,7 +168,7 @@ class LinessaZephyrMageEffect extends OneShotEffect {
if (target.choose(Outcome.ReturnToHand, targetPlayer.getId(), source.getSourceId(), game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
targetPlayer.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
targetPlayer.moveCards(permanent, null, Zone.HAND, source, game);
}
}

View file

@ -103,18 +103,19 @@ class VenserShaperSavantEffect extends OneShotEffect {
if (controller != null) {
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent != null) {
return controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
return controller.moveCards(permanent, null, Zone.HAND, source, game);
}
/**
* 01.05.2007 If a spell is returned to its owner's hand, it's removed from
* the stack and thus will not resolve. The spell isn't countered; it just no longer exists.
* 01.05.2007 If a copy of a spell is returned to its owner's hand, it's moved there,
* then it will cease to exist as a state-based action.
* 01.05.2007 If Venser's enters-the-battlefield ability targets a spell cast with flashback,
* that spell will be exiled instead of returning to its owner's hand.
* 01.05.2007 If a spell is returned to its owner's hand, it's
* removed from the stack and thus will not resolve. The spell isn't
* countered; it just no longer exists. 01.05.2007 If a copy of a
* spell is returned to its owner's hand, it's moved there, then it
* will cease to exist as a state-based action. 01.05.2007 If
* Venser's enters-the-battlefield ability targets a spell cast with
* flashback, that spell will be exiled instead of returning to its
* owner's hand.
*/
Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source));
if (spell != null) {
Card card = null;
@ -123,7 +124,7 @@ class VenserShaperSavantEffect extends OneShotEffect {
}
game.getStack().remove(spell);
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.STACK);
controller.moveCards(card, null, Zone.HAND, source, game);
}
return true;
}

View file

@ -28,15 +28,15 @@
package mage.sets.gatecrash;
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;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -95,8 +95,8 @@ class DinrovaHorrorEffect extends OneShotEffect {
if (target != null) {
Player controller = game.getPlayer(target.getControllerId());
if (controller != null) {
controller.moveCardToHandWithInfo(target, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.discard(1, source, game);
controller.moveCards(target, null, Zone.HAND, source, game);
controller.discard(1, false, source, game);
return true;
}
}

View file

@ -29,11 +29,6 @@ package mage.sets.gatecrash;
import java.util.UUID;
import mage.MageObject;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
@ -50,7 +45,11 @@ import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
@ -71,8 +70,6 @@ public class DomriRade extends CardImpl {
this.expansionSetCode = "GTC";
this.subtype.add("Domri");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
// +1: Look at the top card of your library. If it's a creature card, you may reveal it and put it into your hand.
@ -127,8 +124,8 @@ class DomriRadeEffect1 extends OneShotEffect {
controller.lookAtCards(sourceObject.getName(), cards, game);
if (card.getCardType().contains(CardType.CREATURE)) {
if (controller.chooseUse(outcome, "Reveal " + card.getName() + " and put it into your hand?", source, game)) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.revealCards(sourceObject.getName(), cards, game);
controller.moveCards(card, null, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), cards, game);
}
}
return true;
@ -139,7 +136,9 @@ class DomriRadeEffect1 extends OneShotEffect {
}
class DomriRadeEmblem extends Emblem {
// "Creatures you control have double strike, trample, hexproof and haste."
public DomriRadeEmblem() {
this.setName("EMBLEM: Domri Rade");
FilterPermanent filter = new FilterControlledCreaturePermanent("Creatures");

View file

@ -0,0 +1,81 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.homelands;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LoneFox
*/
public class AnabaAncestor extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Another target Minotaur creature");
static {
filter.add(new SubtypePredicate("Minotaur"));
filter.add(new AnotherPredicate());
}
public AnabaAncestor(UUID ownerId) {
super(ownerId, 81, "Anaba Ancestor", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "HML";
this.subtype.add("Minotaur");
this.subtype.add("Spirit");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {T}: Another target Minotaur creature gets +1/+1 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(1, 1, Duration.EndOfTurn), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}
public AnabaAncestor(final AnabaAncestor card) {
super(card);
}
@Override
public AnabaAncestor copy() {
return new AnabaAncestor(this);
}
}

View file

@ -0,0 +1,74 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.homelands;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author LoneFox
*/
public class AnabaSpiritCrafter extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Minotaur creatures");
static {
filter.add(new SubtypePredicate("Minotaur"));
}
public AnabaSpiritCrafter(UUID ownerId) {
super(ownerId, 86, "Anaba Spirit Crafter", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.expansionSetCode = "HML";
this.subtype.add("Minotaur");
this.subtype.add("Shaman");
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// Minotaur creatures get +1/+0.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.WhileOnBattlefield, filter, false)));
}
public AnabaSpiritCrafter(final AnabaSpiritCrafter card) {
super(card);
}
@Override
public AnabaSpiritCrafter copy() {
return new AnabaSpiritCrafter(this);
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.homelands;
import java.util.UUID;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author LoneFox
*/
public class Didgeridoo extends CardImpl {
private static final FilterPermanentCard filter = new FilterPermanentCard("a Minotaur permanent card");
static {
filter.add(new SubtypePredicate("Minotaur"));
}
public Didgeridoo(UUID ownerId) {
super(ownerId, 130, "Didgeridoo", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "HML";
// {3}: You may put a Minotaur permanent card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new ManaCostsImpl("{3}")));
}
public Didgeridoo(final Didgeridoo card) {
super(card);
}
@Override
public Didgeridoo copy() {
return new Didgeridoo(this);
}
}

View file

@ -28,6 +28,7 @@
package mage.sets.iceage;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -54,7 +55,6 @@ public class DemonicConsultation extends CardImpl {
super(ownerId, 9, "Demonic Consultation", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}");
this.expansionSetCode = "ICE";
// Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card. Put that card into your hand and exile all other cards revealed this way.
this.getSpellAbility().addEffect(new DemonicConsultationEffect());
}
@ -87,13 +87,14 @@ class DemonicConsultationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
// Name a card.
Choice choice = new ChoiceImpl();
choice.setChoices(CardRepository.instance.getNames());
while (!player.choose(Outcome.Benefit, choice, game)) {
if (!player.canRespond()) {
while (!controller.choose(Outcome.Benefit, choice, game)) {
if (!controller.canRespond()) {
return false;
}
}
@ -101,32 +102,26 @@ class DemonicConsultationEffect extends OneShotEffect {
game.informPlayers("Card named: " + name);
// Exile the top six cards of your library,
int num = Math.min(6, player.getLibrary().size());
for (int i = 0; i < num; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
}
}
controller.moveCards(controller.getLibrary().getTopCards(game, 6), null, Zone.EXILED, source, game);
// then reveal cards from the top of your library until you reveal the named card.
Cards cards = new CardsImpl(Zone.LIBRARY);
while (player.getLibrary().size() > 0) {
Card card = player.getLibrary().removeFromTop(game);
Cards cardsToReaveal = new CardsImpl();
Card cardToHand = null;
while (controller.getLibrary().size() > 0) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
cardsToReaveal.add(card);
// Put that card into your hand
if (card.getName().equals(name)) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
cardToHand = card;
break;
}
// and exile all other cards revealed this way.
else {
player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
}
}
}
player.revealCards("Demonic Consultation", cards, game);
controller.moveCards(cardToHand, null, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game);
cardsToReaveal.remove(cardToHand);
controller.moveCards(cardsToReaveal, null, Zone.EXILED, source, game);
return true;
}
return false;

View file

@ -29,10 +29,6 @@ package mage.sets.innistrad;
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.condition.common.MorbidCondition;
import mage.abilities.effects.OneShotEffect;
@ -40,6 +36,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.common.FilterBasicLandCard;
import mage.game.Game;
import mage.players.Player;
@ -55,7 +55,6 @@ public class CaravanVigil extends CardImpl {
super(ownerId, 173, "Caravan Vigil", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{G}");
this.expansionSetCode = "ISD";
// Search your library for a basic land card, reveal it, put it into your hand, then shuffle your library.
// Morbid - You may put that card onto the battlefield instead of putting it into your hand if a creature died this turn.
this.getSpellAbility().addEffect(new CaravanVigilEffect());
@ -103,9 +102,9 @@ class CaravanVigilEffect extends OneShotEffect {
&& controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to put the card onto the battlefield instead?", source, game)) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
} else {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
}
controller.revealCards(sourceObject.getName(), cards, game);
controller.revealCards(sourceObject.getIdName(), cards, game);
}
}
controller.shuffleLibrary(game);

View file

@ -27,18 +27,18 @@
*/
package mage.sets.innistrad;
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.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -54,7 +54,6 @@ public class HereticsPunishment extends CardImpl {
super(ownerId, 147, "Heretic's Punishment", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}");
this.expansionSetCode = "ISD";
// {3}{R}: Choose target creature or player, then put the top three cards of your library into your graveyard. Heretic's Punishment deals damage to that creature or player equal to the highest converted mana cost among those cards.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new HereticsPunishmentEffect(), new ManaCostsImpl("{3}{R}"));
ability.addTarget(new TargetCreatureOrPlayer());
@ -87,7 +86,7 @@ class HereticsPunishmentEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int maxCost = 0;
List<Card> cardList = controller.getLibrary().getTopCards(game, 3);
Set<Card> cardList = controller.getLibrary().getTopCards(game, 3);
for (Card card : cardList) {
int test = card.getManaCost().convertedManaCost();
if (test > maxCost) {

View file

@ -50,7 +50,6 @@ public class Recoil extends CardImpl {
super(ownerId, 264, "Recoil", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{B}");
this.expansionSetCode = "INV";
// Return target permanent to its owner's hand. Then that player discards a card.
this.getSpellAbility().addEffect(new RecoilEffect());
this.getSpellAbility().addTarget(new TargetPermanent());
@ -86,14 +85,12 @@ class RecoilEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(source.getFirstTarget());
if (target != null) {
Player controller = game.getPlayer(target.getControllerId());
if (controller != null) {
controller.moveCardToHandWithInfo(target, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.discard(1, source, game);
if (target != null && controller != null) {
controller.moveCards(target, null, Zone.HAND, source, game);
controller.discard(1, false, source, game);
return true;
}
}
return false;
}
}

View file

@ -138,7 +138,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect {
}
if (opponent == null || !paid) {
if (game.getState().getZone(creature.getId()).equals(Zone.GRAVEYARD)) {
controller.moveCardToHandWithInfo(creature, source.getSourceId(), game, Zone.GRAVEYARD);
controller.moveCards(creature, null, Zone.HAND, source, game);
}
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.sets.journeyintonyx;
import java.util.LinkedList;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
@ -110,7 +109,7 @@ class BrainMaggotExileEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && opponent != null && sourcePermanent != null) {
if (!opponent.getHand().isEmpty()) {
opponent.revealCards(sourcePermanent.getName(), opponent.getHand(), game);
opponent.revealCards(sourcePermanent.getIdName(), opponent.getHand(), game);
FilterCard filter = new FilterNonlandCard("nonland card to exile");
TargetCard target = new TargetCard(Zone.HAND, filter);
@ -130,11 +129,10 @@ class BrainMaggotExileEffect extends OneShotEffect {
}
/**
* Returns the exiled card as source permanent leaves battlefield
* Uses no stack
* Returns the exiled card as source permanent leaves battlefield Uses no stack
*
* @author LevelX2
*/
class BrainMaggotReturnExiledCardAbility extends DelayedTriggeredAbility {
public BrainMaggotReturnExiledCardAbility() {
@ -194,12 +192,7 @@ class BrainMaggotReturnExiledCardEffect extends OneShotEffect {
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter));
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (exile != null && sourcePermanent != null) {
LinkedList<UUID> cards = new LinkedList<>(exile);
for (UUID cardId : cards) {
Card card = game.getCard(cardId);
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.EXILED);
}
exile.clear();
controller.moveCards(exile, null, Zone.HAND, source, game);
return true;
}
}

View file

@ -31,6 +31,8 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -52,12 +54,10 @@ public class Hubris extends CardImpl {
super(ownerId, 41, "Hubris", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "JOU";
// Return target creature and all Auras attached to it to their owners' hand.
this.getSpellAbility().addEffect(new HubrisReturnEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public Hubris(final Hubris card) {
@ -99,13 +99,9 @@ class HubrisReturnEffect extends OneShotEffect {
for (UUID targetId : targetPointer.getTargets(game, source)) {
Permanent creature = game.getPermanent(targetId);
if (creature != null) {
controller.moveCardToHandWithInfo(creature, source.getSourceId(), game, Zone.BATTLEFIELD);
for (UUID attachementId: creature.getAttachments()) {
Permanent attachment = game.getPermanent(attachementId);
if (attachment != null && filter.match(attachment, game)) {
controller.moveCardToHandWithInfo(attachment, source.getSourceId(), game, Zone.BATTLEFIELD);
}
}
Cards cardsToHand = new CardsImpl(creature.getAttachments());
cardsToHand.add(creature);
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
}
}
return true;

View file

@ -101,36 +101,30 @@ class NessianGameWardenEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (player == null || sourcePermanent == null) {
if (controller == null || sourcePermanent == null) {
return false;
}
Cards cards = new CardsImpl();
int count = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
count = Math.min(player.getLibrary().size(), count);
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
player.lookAtCards(sourcePermanent.getName(), cards, game);
cards.addAll(controller.getLibrary().getTopCards(game, count));
controller.lookAtCards(sourcePermanent.getIdName(), cards, game);
if (!cards.isEmpty()) {
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCreatureCard("creature card to put into your hand"));
if (target.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.DrawCard, cards, target, game)) {
if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(Outcome.DrawCard, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
player.revealCards(sourcePermanent.getName(), new CardsImpl(card), game);
controller.revealCards(sourcePermanent.getName(), new CardsImpl(card), game);
cards.remove(card);
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
}
}
}
player.putCardsOnBottomOfLibrary(cards, game, source, true);
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
}
}

View file

@ -33,6 +33,8 @@ import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -107,9 +109,11 @@ class ScourgeOfFleetsEffect extends OneShotEffect {
FilterPermanent creatureFilter = new FilterCreaturePermanent();
creatureFilter.add(new ControllerPredicate(TargetController.OPPONENT));
creatureFilter.add(new ToughnessPredicate(Filter.ComparisonType.LessThan, islands + 1));
Cards cardsToHand = new CardsImpl();
for (Permanent permanent : game.getBattlefield().getActivePermanents(creatureFilter, source.getControllerId(), source.getSourceId(), game)) {
controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
cardsToHand.add(permanent);
}
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
return true;
}
return false;

View file

@ -27,7 +27,7 @@
*/
package mage.sets.khansoftarkir;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
@ -49,7 +49,6 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
*
@ -102,12 +101,12 @@ class NarsetEnlightenedMasterExileEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null && sourceObject != null) {
List<Card> cards = player.getLibrary().getTopCards(game, 4);
Set<Card> cards = player.getLibrary().getTopCards(game, 4);
player.moveCards(cards, Zone.LIBRARY, Zone.EXILED, source, game);
for (Card card : cards) {
if (game.getState().getZone(card.getId()) == Zone.EXILED &&
!card.getCardType().contains(CardType.CREATURE) &&
!card.getCardType().contains(CardType.LAND)) {
if (game.getState().getZone(card.getId()) == Zone.EXILED
&& !card.getCardType().contains(CardType.CREATURE)
&& !card.getCardType().contains(CardType.LAND)) {
ContinuousEffect effect = new NarsetEnlightenedMasterCastFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);

View file

@ -30,8 +30,8 @@ package mage.sets.legends;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
import mage.abilities.effects.common.discard.DiscardHandTargetEffect;
import mage.abilities.keyword.FlyingAbility;

View file

@ -27,17 +27,18 @@
*/
package mage.sets.magic2010;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.cards.CardImpl;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
/**
*
@ -56,7 +57,7 @@ public class ElvishPiper extends CardImpl {
// {G}, {tap}: You may put a creature card from your hand onto the battlefield.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCreatureOnBattlefieldEffect(),
new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")),
new ManaCostsImpl("{G}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -27,13 +27,13 @@
*/
package mage.sets.magic2010;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import java.util.UUID;

View file

@ -25,11 +25,10 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.magic2011;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -93,41 +92,44 @@ class CultivateEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller == null || sourceObject == null) {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
Player player = game.getPlayer(source.getControllerId());
if (player.searchLibrary(target, game)) {
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Cards revealed = new CardsImpl();
for (UUID cardId: (List<UUID>)target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().getCard(cardId, game);
revealed.add(card);
}
player.revealCards("Cultivate", revealed, game);
controller.revealCards(sourceObject.getIdName(), revealed, game);
if (target.getTargets().size() == 2) {
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter);
player.choose(Outcome.Benefit, revealed, target2, game);
controller.choose(Outcome.Benefit, revealed, target2, game);
Card card = revealed.get(target2.getFirstTarget(), game);
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
revealed.remove(card);
}
card = revealed.getCards(game).iterator().next();
if (card != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
}
}
else if (target.getTargets().size() == 1) {
} else if (target.getTargets().size() == 1) {
Card card = revealed.getCards(game).iterator().next();
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
}
}
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return true;
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return false;
}

View file

@ -30,11 +30,12 @@ package mage.sets.magic2012;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreatureCard;
import java.util.UUID;
@ -50,7 +51,7 @@ public class QuicksilverAmulet extends CardImpl {
// {4}, {tap}: You may put a creature card from your hand onto the battlefield.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCreatureOnBattlefieldEffect(),
new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")),
new ManaCostsImpl("{4}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -34,12 +34,11 @@ import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -50,11 +49,7 @@ import mage.filter.FilterSpell;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCardInLibrary;
/**
@ -63,7 +58,8 @@ import mage.target.common.TargetCardInLibrary;
*/
public class GarrukCallerOfBeasts extends CardImpl {
private static final FilterCreatureCard filterGreenCreature = new FilterCreatureCard("a green creature card from your hand");
private static final FilterCreatureCard filterGreenCreature = new FilterCreatureCard("a green creature card");
static {
filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN));
}
@ -80,7 +76,7 @@ public class GarrukCallerOfBeasts extends CardImpl {
this.addAbility(new LoyaltyAbility(new RevealLibraryPutIntoHandEffect(5, new FilterCreatureCard("all creature cards"),true), 1));
// -3: You may put a green creature card from your hand onto the battlefield.
this.addAbility(new LoyaltyAbility(new GarrukCallerOfBeastsPutOntoBattlefieldEffect(), -3));
this.addAbility(new LoyaltyAbility(new PutPermanentOnBattlefieldEffect(filterGreenCreature), -3));
// -7: You get an emblem with "Whenever you cast a creature spell, you may search your library for a creature card, put it onto the battlefield, then shuffle your library.");
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new GarrukCallerOfBeastsEmblem()), -7));
@ -96,6 +92,7 @@ public class GarrukCallerOfBeasts extends CardImpl {
return new GarrukCallerOfBeasts(this);
}
}
/**
* Emblem: "Whenever you cast a creature spell, you may search your library for a creature card, put it onto the battlefield, then shuffle your library."
*/
@ -113,48 +110,3 @@ class GarrukCallerOfBeastsEmblem extends Emblem {
this.getAbilities().add(ability);
}
}
class GarrukCallerOfBeastsPutOntoBattlefieldEffect extends OneShotEffect {
private static final FilterCreatureCard filterGreenCreature = new FilterCreatureCard("a green creature card from your hand");
static {
filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN));
}
public GarrukCallerOfBeastsPutOntoBattlefieldEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "You may put a green creature card from your hand onto the battlefield";
}
public GarrukCallerOfBeastsPutOntoBattlefieldEffect(final GarrukCallerOfBeastsPutOntoBattlefieldEffect effect) {
super(effect);
}
@Override
public GarrukCallerOfBeastsPutOntoBattlefieldEffect copy() {
return new GarrukCallerOfBeastsPutOntoBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.getHand().count(filterGreenCreature, game) > 0) {
if (controller.chooseUse(Outcome.PutCreatureInPlay,
"Put a green creature card onto the battlefield?", source, game)) {
Target target = new TargetCardInHand(filterGreenCreature);
if (controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
}
}
}
}
return true;
}
return false;
}
}

View file

@ -27,7 +27,7 @@
*/
package mage.sets.magic2014;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
@ -106,7 +106,7 @@ class JaceMindseekerEffect extends OneShotEffect {
Cards cardsToCast = new CardsImpl();
Player targetOpponent = game.getPlayer(targetPointer.getFirst(game, source));
if (targetOpponent != null) {
List<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 5);
Set<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 5);
targetOpponent.moveCards(allCards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
for (Card card : allCards) {
if (filter.match(card, game)) {

View file

@ -108,19 +108,14 @@ class HushwingGryffEffect extends ContinuousRuleModifyingEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
Ability ability = (Ability) getValue("targetAbility");
if (ability != null && AbilityType.TRIGGERED.equals(ability.getAbilityType())) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.getCardType().contains(CardType.CREATURE)) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public HushwingGryffEffect copy() {
return new HushwingGryffEffect(this);

View file

@ -79,6 +79,7 @@ public class Quickling extends CardImpl {
return new Quickling(this);
}
}
class QuicklingEffect extends OneShotEffect {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature you control");
@ -108,7 +109,7 @@ class QuicklingEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
targetChosen = true;
controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.moveCards(permanent, null, Zone.HAND, source, game);
}
}

View file

@ -27,7 +27,7 @@
*/
package mage.sets.magicorigins;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -100,7 +100,7 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
Player targetOpponent = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (targetOpponent != null && sourceObject != null) {
List<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 7);
Set<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 7);
Cards cards = new CardsImpl(Zone.LIBRARY, allCards);
targetOpponent.revealCards(sourceObject.getIdName() + " - " + targetOpponent.getName() + "'s top library cards", cards, game);
for (Card card : allCards) {

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.masterseditioniii;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class AnabaAncestor extends mage.sets.homelands.AnabaAncestor {
public AnabaAncestor(UUID ownerId) {
super(ownerId);
this.cardNumber = 86;
this.expansionSetCode = "ME3";
this.rarity = Rarity.COMMON;
}
public AnabaAncestor(final AnabaAncestor card) {
super(card);
}
@Override
public AnabaAncestor copy() {
return new AnabaAncestor(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.masterseditioniii;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class AnabaSpiritCrafter extends mage.sets.homelands.AnabaSpiritCrafter {
public AnabaSpiritCrafter(UUID ownerId) {
super(ownerId);
this.cardNumber = 87;
this.expansionSetCode = "ME3";
this.rarity = Rarity.COMMON;
}
public AnabaSpiritCrafter(final AnabaSpiritCrafter card) {
super(card);
}
@Override
public AnabaSpiritCrafter copy() {
return new AnabaSpiritCrafter(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.masterseditioniii;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class Didgeridoo extends mage.sets.homelands.Didgeridoo {
public Didgeridoo(UUID ownerId) {
super(ownerId);
this.cardNumber = 194;
this.expansionSetCode = "ME3";
this.rarity = Rarity.UNCOMMON;
}
public Didgeridoo(final Didgeridoo card) {
super(card);
}
@Override
public Didgeridoo copy() {
return new Didgeridoo(this);
}
}

View file

@ -35,7 +35,7 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedEvent;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -50,7 +50,6 @@ public class CoastalPiracy extends CardImpl {
super(ownerId, 68, "Coastal Piracy", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
this.expansionSetCode = "MMQ";
// Whenever a creature you control deals combat damage to an opponent, you may draw a card.
this.addAbility(new CoastalPiracyTriggeredAbility());
}
@ -88,8 +87,8 @@ class CoastalPiracyTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedPlayerEvent) event).isCombatDamage()) &&
game.getOpponents(this.controllerId).contains(((DamagedPlayerEvent) event).getPlayerId())) {
if (((DamagedPlayerEvent) event).isCombatDamage()
&& game.getOpponents(this.controllerId).contains(((DamagedPlayerEvent) event).getPlayerId())) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null && creature.getControllerId().equals(controllerId)) {
return true;

View file

@ -57,7 +57,6 @@ public class ForbiddenCrypt extends CardImpl {
super(ownerId, 22, "Forbidden Crypt", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}");
this.expansionSetCode = "MIR";
// If you would draw a card, return a card from your graveyard to your hand instead. If you can't, you lose the game.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ForbiddenCryptDrawCardReplacementEffect()));
// If a card would be put into your graveyard from anywhere, exile that card instead.
@ -92,22 +91,23 @@ class ForbiddenCryptDrawCardReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
boolean cardReturned = false;
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard();
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
if (target.choose(Outcome.ReturnToHand, player.getId(), source.getSourceId(), game)) {
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
if (target.choose(Outcome.ReturnToHand, controller.getId(), source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
controller.moveCards(card, null, Zone.HAND, source, game);
cardReturned = true;
}
}
}
if (!cardReturned) {
game.informPlayers(new StringBuilder(player.getLogName()).append(" can't return a card from graveyard to hand.").toString());
player.lost(game);
game.informPlayers(controller.getLogName() + " can't return a card from graveyard to hand.");
controller.lost(game);
}
return true;
}

View file

@ -53,7 +53,6 @@ public class SpoilsOfTheVault extends CardImpl {
super(ownerId, 78, "Spoils of the Vault", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{B}");
this.expansionSetCode = "MRD";
// Name a card. Reveal cards from the top of your library until you reveal the named card, then put that card into your hand. Exile all other cards revealed this way, and you lose 1 life for each of the exiled cards.
this.getSpellAbility().addEffect(new NameACardEffect(NameACardEffect.TypeOfName.ALL));
this.getSpellAbility().addEffect(new SpoilsOfTheVaultEffect());
@ -69,7 +68,6 @@ public class SpoilsOfTheVault extends CardImpl {
}
}
class SpoilsOfTheVaultEffect extends OneShotEffect {
public SpoilsOfTheVaultEffect() {
@ -95,26 +93,23 @@ class SpoilsOfTheVaultEffect extends OneShotEffect {
return false;
}
Cards cards = new CardsImpl();
Cards cardsToReveal = new CardsImpl();
Cards cardsToExile = new CardsImpl();
while (controller.getLibrary().size() > 0) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
cardsToReveal.add(card);
if (card.getName().equals(cardName)) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
break;
}
else{
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
} else {
cardsToExile.add(card);
}
}
else{
break;
}
}
controller.revealCards(sourceObject.getName(), cards, game);
controller.loseLife(cards.size(), game);
controller.revealCards(sourceObject.getIdName(), cardsToReveal, game);
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game);
controller.loseLife(cardsToExile.size(), game);
return true;
}

View file

@ -28,6 +28,7 @@
package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -52,7 +53,6 @@ public class PetalsOfInsight extends CardImpl {
this.expansionSetCode = "MMA";
this.subtype.add("Arcane");
// Look at the top three cards of your library. You may put those cards on the bottom of your library in any order. If you do, return Petals of Insight to its owner's hand. Otherwise, draw three cards.
this.getSpellAbility().addEffect(new PetalsOfInsightEffect());
}
@ -85,33 +85,23 @@ class PetalsOfInsightEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller == null || sourceObject == null) {
return false;
}
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);
if (card != null) {
cards.add(card);
}
}
player.lookAtCards("Petals of Insight", cards, game);
if (player.chooseUse(outcome, "Put the cards on the bottom of your library in any order?", source, game)) {
player.putCardsOnBottomOfLibrary(cards, game, source, true);
cards.addAll(controller.getLibrary().getTopCards(game, 3));
controller.lookAtCards(sourceObject.getIdName(), cards, game);
if (controller.chooseUse(outcome, "Put the cards on the bottom of your library in any order?", source, game)) {
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
if (spellCard != null) {
player.moveCardToHandWithInfo(spellCard, source.getSourceId(), game, Zone.STACK);
controller.moveCards(spellCard, null, Zone.HAND, source, game);
}
} else {
for (UUID cardId: cards) {
Card card = game.getCard(cardId);
if (card != null) {
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
}
}
player.drawCards(3, game);
controller.drawCards(3, game);
}
return true;
}

View file

@ -34,6 +34,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
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;
@ -110,13 +112,15 @@ class AllSunsDawnEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cardsToHand = new CardsImpl();
for (Target target : source.getTargets()) {
UUID targetId = target.getFirstTarget();
Card card = game.getCard(targetId);
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true);
cardsToHand.add(card);
}
}
controller.moveCards(cardsToHand, null, Zone.HAND, source, game);
return true;
}
return false;

View file

@ -34,24 +34,15 @@ import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.PutCreatureOnBattlefieldEffect;
import mage.cards.Card;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
/**
*
@ -66,8 +57,10 @@ public class BelbesPortal extends CardImpl {
// As Belbe's Portal enters the battlefield, choose a creature type.
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.PutCreatureInPlay)));
// {3}, {tap}: You may put a creature card of the chosen type from your hand onto the battlefield.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BelbesPortalPutCreatureOnBattlefieldEffect(),
FilterCreatureCard filter = new FilterCreatureCard("a creature card of the chosen type");
filter.add(new ChosenSubtypePredicate(this.getId()));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(filter),
new ManaCostsImpl("{3}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
@ -82,48 +75,3 @@ public class BelbesPortal extends CardImpl {
return new BelbesPortal(this);
}
}
class BelbesPortalPutCreatureOnBattlefieldEffect extends OneShotEffect {
BelbesPortalPutCreatureOnBattlefieldEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "You may put a creature card of the chosen type from your hand onto the battlefield";
}
BelbesPortalPutCreatureOnBattlefieldEffect(final BelbesPortalPutCreatureOnBattlefieldEffect effect) {
super(effect);
}
@Override
public BelbesPortalPutCreatureOnBattlefieldEffect copy() {
return new BelbesPortalPutCreatureOnBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
String subtype = (String) game.getState().getValue(permanent.getId() + "_type");
if (subtype != null) {
Player player = game.getPlayer(source.getControllerId());
String choiceText = "Put a " + subtype.toLowerCase() + " creature card from your hand onto the battlefield?";
if (player != null) {
if (player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) {
FilterCreatureCard creatureTypeFilter = new FilterCreatureCard();
creatureTypeFilter.add(new SubtypePredicate(subtype));
TargetCardInHand target = new TargetCardInHand(creatureTypeFilter);
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
}
}
}
return true;
}
}
}
return false;
}
}

View file

@ -28,13 +28,13 @@
package mage.sets.ninthedition;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*

View file

@ -38,8 +38,8 @@ import mage.abilities.condition.common.CardsInControllerGraveCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.continuous.BecomesColorSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetCardColorSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -77,7 +77,7 @@ public class RepentantVampire extends CardImpl {
this.addAbility(new DiesAndDealtDamageThisTurnTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false));
// Threshold - As long as seven or more cards are in your graveyard, Repentant Vampire is white and has "{tap}: Destroy target black creature."
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new SetCardColorSourceEffect(ObjectColor.WHITE, Duration.WhileOnBattlefield),
new BecomesColorSourceEffect(ObjectColor.WHITE, Duration.WhileOnBattlefield),
new CardsInControllerGraveCondition(7),
"<i>Threshold</i> - As long as seven or more cards are in your graveyard, {this} is white"));
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost());

View file

@ -36,9 +36,9 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.CardsInControllerGraveCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.abilities.effects.common.continuous.BecomesColorSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.continuous.SetCardColorSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.keyword.VigilanceAbility;
@ -75,7 +75,7 @@ public class WaywardAngel extends CardImpl {
new CardsInControllerGraveCondition(7),
"<i>Threshold</i> - As long as seven or more cards are in your graveyard, {this} gets +3/+3,"));
ability.addEffect(new ConditionalContinuousEffect(
new SetCardColorSourceEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield),
new BecomesColorSourceEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield),
new CardsInControllerGraveCondition(7),
" is black,"));
ability.addEffect(new ConditionalContinuousEffect(

View file

@ -28,14 +28,13 @@
package mage.sets.onslaught;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.Game;
@ -55,7 +54,6 @@ public class ChainOfVapor extends CardImpl {
super(ownerId, 73, "Chain of Vapor", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{U}");
this.expansionSetCode = "ONS";
// Return target nonland permanent to its owner's hand. Then that permanent's controller may sacrifice a land. If the player does, he or she may copy this spell and may choose a new target for that copy.
this.getSpellAbility().addEffect(new ChainOfVaporEffect());
this.getSpellAbility().addTarget(new TargetNonlandPermanent());
@ -94,9 +92,7 @@ class ChainOfVaporEffect extends OneShotEffect {
}
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
if (!controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD)){
return false;
}
controller.moveCards(permanent, null, Zone.HAND, source, game);
Player player = game.getPlayer(permanent.getControllerId());
if (player.chooseUse(Outcome.ReturnToHand, "Sacrifice a land to copy this spell?", source, game)) {
TargetControlledPermanent target = new TargetControlledPermanent(new FilterControlledLandPermanent());
@ -123,9 +119,10 @@ class ChainOfVaporEffect extends OneShotEffect {
}
}
}
return true;
}
return true;
return false;
}
@Override

View file

@ -30,9 +30,9 @@ package mage.sets.onslaught;
import java.util.ArrayList;
import java.util.List;
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;
@ -55,7 +55,6 @@ public class WeirdHarvest extends CardImpl {
super(ownerId, 299, "Weird Harvest", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{G}{G}");
this.expansionSetCode = "ONS";
// Each player may search his or her library for up to X creature cards, reveal those cards, and put them into his or her hand. Then each player who searched his or her library this way shuffles it.
getSpellAbility().addEffect(new WeirdHarvestEffect());
}
@ -89,16 +88,17 @@ class WeirdHarvestEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
int xValue = source.getManaCostsToPay().getX();
if (xValue > 0) {
List<Player> usingPlayers = new ArrayList<>();
this.chooseAndSearchLibrary(usingPlayers, controller, xValue, source, game);
this.chooseAndSearchLibrary(usingPlayers, controller, xValue, source, sourceObject, game);
for (UUID playerId : controller.getInRange()) {
if (!playerId.equals(controller.getId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
this.chooseAndSearchLibrary(usingPlayers, player, xValue, source, game);
this.chooseAndSearchLibrary(usingPlayers, player, xValue, source, sourceObject, game);
}
}
}
@ -111,21 +111,15 @@ class WeirdHarvestEffect extends OneShotEffect {
return false;
}
private void chooseAndSearchLibrary(List<Player> usingPlayers, Player player, int xValue, Ability source, Game game) {
private void chooseAndSearchLibrary(List<Player> usingPlayers, Player player, int xValue, Ability source, MageObject sourceObject, Game game) {
if (player.chooseUse(Outcome.PutCardInPlay, "Search your library for up " + xValue + " creature cards and put them into your hand?", source, game)) {
usingPlayers.add(player);
TargetCardInLibrary target = new TargetCardInLibrary(0, xValue, new FilterCreatureCard());
if (player.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Cards cards = new CardsImpl();
for (UUID cardId: (List<UUID>)target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
cards.add(card);
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
}
}
player.revealCards("Weird Harvest", cards, game);
Cards cards = new CardsImpl(target.getTargets());
player.moveCards(cards, null, Zone.HAND, source, game);
player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game);
}
}
}

View file

@ -67,9 +67,6 @@ public class MaliciousAdvice extends CardImpl {
effect.setText("Tap X target artifacts, creatures, and/or lands");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(new ManacostVariableValue()));
// Correct number of targets will be set in adjustTargets
// I'm not sure if/why this needs to be here, but other such cards do have it...
this.getSpellAbility().addTarget(new TargetPermanent(filter));
}
@Override

View file

@ -64,7 +64,6 @@ class SkyshipWeatherlightEffect extends SearchEffect {
private static final FilterCard filter = new FilterCard("artifact and/or creature card");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
@ -134,8 +133,7 @@ class SkyshipWeatherlightEffect2 extends OneShotEffect {
if (sourceObject != null && controller != null) {
ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
if (exZone != null) {
Card card = exZone.getRandom(game);
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.EXILED);
controller.moveCards(exZone.getRandom(game), null, Zone.HAND, source, game);
}
return true;
}

View file

@ -57,6 +57,7 @@ import mage.target.TargetPermanent;
public class CloudstoneCurio extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("a nonartifact permanent");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
filter.add(new ControllerPredicate(TargetController.YOU));
@ -69,7 +70,6 @@ public class CloudstoneCurio extends CardImpl {
// Whenever a nonartifact permanent enters the battlefield under your control, you may return another permanent you control that shares a card type with it to its owner's hand.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new CloudstoneCurioEffect(), filter, true, SetTargetPointer.PERMANENT, "", true));
}
public CloudstoneCurio(final CloudstoneCurio card) {
@ -120,7 +120,7 @@ class CloudstoneCurioEffect extends OneShotEffect {
if (target.canChoose(controller.getId(), game) && controller.chooseTarget(outcome, target, source, game)) {
Permanent returningCreature = game.getPermanent(target.getFirstTarget());
if (returningCreature != null) {
controller.moveCardToHandWithInfo(returningCreature, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.moveCards(returningCreature, null, Zone.HAND, source, game);
}
}
}

View file

@ -28,10 +28,6 @@
package mage.sets.ravnica;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -40,8 +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.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -76,6 +75,7 @@ public class DarkConfidant extends CardImpl {
}
class DarkConfidantEffect extends OneShotEffect {
DarkConfidantEffect() {
super(Outcome.DrawCard);
this.staticText = "reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost";
@ -87,17 +87,16 @@ class DarkConfidantEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (player != null && sourcePermanent != null) {
if (player.getLibrary().size() > 0) {
Card card = player.getLibrary().removeFromTop(game);
if (controller != null && sourcePermanent != null) {
if (controller.getLibrary().size() > 0) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
Cards cards = new CardsImpl();
cards.add(card);
player.revealCards(sourcePermanent.getName(), cards, game);
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
player.loseLife(card.getManaCost().convertedManaCost(), game);
Cards cards = new CardsImpl(card);
controller.revealCards(sourcePermanent.getIdName(), cards, game);
controller.moveCards(card, null, Zone.HAND, source, game);
controller.loseLife(card.getManaCost().convertedManaCost(), game);
}
return true;

View file

@ -28,9 +28,6 @@
package mage.sets.returntoravnica;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -38,7 +35,9 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
@ -110,7 +109,7 @@ class FaerieImpostorEffect extends OneShotEffect {
if (permanent != null) {
targetChosen = true;
controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD);
controller.moveCards(permanent, null, Zone.HAND, source, game);
}
}

View file

@ -258,7 +258,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect {
for (UUID cardUuid : cardsToHand) {
Card card = cardsToHand.get(cardUuid, game);
if (card != null) {
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
player.moveCards(card, null, Zone.HAND, source, game);
}
}

View file

@ -29,18 +29,18 @@ package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.constants.*;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.TotemArmorAbility;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;

View file

@ -105,7 +105,7 @@ class ElderPineOfJukaiEffect extends OneShotEffect {
controller.revealCards(sourceObject.getName(), cards, game);
for (Card card : cards.getCards(game)) {
if (card.getCardType().contains(CardType.LAND)) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
controller.moveCards(card, null, Zone.HAND, source, game);
cards.remove(card);
}
}

Some files were not shown because too many files have changed in this diff Show more