diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 2f252fce7f1..ae3f7ab1d66 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -594,7 +594,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { missingCards = CardRepository.instance.findCards(new CardCriteria()); LOGGER.info("Card pool load time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds")); beforeCall = System.currentTimeMillis(); - if (DownloadPictures.checkForNewCards(missingCards)) { + if (DownloadPictures.checkForMissingCardImages(missingCards)) { LOGGER.info("Card images checking time: " + ((System.currentTimeMillis() - beforeCall) / 1000 + " seconds")); UserRequestMessage message = new UserRequestMessage("New images available", "Card images are missing (" + missingCards.size() + "). Do you want to download the images?" + "

You can deactivate the image download check on application start in the preferences."); diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java index 357dc99d2db..fe676343a9c 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java @@ -43,7 +43,6 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.*; import javax.swing.DefaultComboBoxModel; -import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableCellRenderer; @@ -55,6 +54,7 @@ import mage.cards.Sets; import mage.cards.repository.CardCriteria; import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; +import mage.client.MageFrame; import mage.client.cards.*; import mage.client.constants.Constants.SortBy; import mage.client.deckeditor.table.TableModel; @@ -960,7 +960,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene filterCards(); } } else { - JOptionPane.showMessageDialog(null, "An expansion set must be selected to be able to generate a booster."); + MageFrame.getInstance().showMessage("An expansion set must be selected to be able to generate a booster."); } }//GEN-LAST:event_btnBoosterActionPerformed @@ -993,7 +993,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene if (currentView.cardsSize() > CardGrid.MAX_IMAGES) { jToggleCardView.setSelected(false); jToggleListView.setSelected(true); - JOptionPane.showMessageDialog(this, new StringBuilder("The card view can't be used for more than ").append(CardGrid.MAX_IMAGES).append(" cards.").toString()); + MageFrame.getInstance().showMessage("The card view can't be used for more than " + CardGrid.MAX_IMAGES + " cards."); } else { if (!(currentView instanceof CardGrid)) { toggleViewMode(); diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index a74eba61bad..b22e28db511 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -749,9 +749,9 @@ public final class GamePanel extends javax.swing.JPanel { if (change) { handCardsOfOpponentAvailable = !handCardsOfOpponentAvailable; if (handCardsOfOpponentAvailable) { - JOptionPane.showMessageDialog(null, "You control other player's turn. \nUse \"Switch Hand\" button to switch between cards in different hands."); + MageFrame.getInstance().showMessage("You control other player's turn. \nUse \"Switch Hand\" button to switch between cards in different hands."); } else { - JOptionPane.showMessageDialog(null, "You lost control on other player's turn."); + MageFrame.getInstance().showMessage("You lost control on other player's turn."); } } } else { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index e169dfc4258..74b1fdb0a58 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -49,6 +49,10 @@ public class TokensMtgImageSource implements CardImageSource { private static CardImageSource instance = new TokensMtgImageSource(); + private List tokensData; + + private final Object tokensDataSync = new Object(); + public static CardImageSource getInstance() { if (instance == null) { instance = new TokensMtgImageSource(); @@ -82,26 +86,27 @@ public class TokensMtgImageSource implements CardImageSource { } private static final String[] EMBLEMS = { - "Ajani", - "Chandra", - "Dack", - "Daretti", - "Domri", - "Elspeth", - "Garruk", - "Gideon", - "Jace", - "Kiora", - "Koth", - "Liliana", - "Narset", - "Nixilis", - "Sarkhan", - "Sorin", - "Tamiyo", - "Teferi", - "Venser", - }; + "Ajani", + "Arlinn", + "Chandra", + "Dack", + "Daretti", + "Dovin", + "Domri", + "Elspeth", + "Garruk", + "Gideon", + "Jace", + "Kiora", + "Koth", + "Liliana", + "Narset", + "Nixilis", + "Sarkhan", + "Sorin", + "Tamiyo", + "Teferi", + "Venser",}; private static final Map SET_NAMES_REPLACEMENT = new HashMap() { { @@ -119,7 +124,7 @@ public class TokensMtgImageSource implements CardImageSource { // handle emblems if (name.toLowerCase().contains("emblem")) { for (String emblem : EMBLEMS) { - if (name.toLowerCase().contains(emblem.toLowerCase())){ + if (name.toLowerCase().contains(emblem.toLowerCase())) { name = emblem + " Emblem"; break; } @@ -135,23 +140,23 @@ public class TokensMtgImageSource implements CardImageSource { // e.g. http://tokens.mtg.onl/tokens/ORI_010-Thopter.jpg -- token number 010 // We don't know these numbers, but we can take them from a file // with tokens information that can be downloaded from the site. - List tokensData = getTokensData(); + List newTokensData = getTokensData(); - if (tokensData.isEmpty()) { + if (newTokensData.isEmpty()) { return null; } - List matchedTokens = new ArrayList(); - for (TokenData token : tokensData) { + List matchedTokens = new ArrayList<>(); + for (TokenData token : newTokensData) { if (name.equalsIgnoreCase(token.getName()) && set.equalsIgnoreCase(token.getExpansionSetCode())) { matchedTokens.add(token); } } - - if (matchedTokens.isEmpty()) { - logger.info("Could not find data for token " + name + ", set " + set + "."); - return null; - } +// +// if (matchedTokens.isEmpty()) { +// logger.info("Could not find data for token " + name + ", set " + set + "."); +// return null; +// } TokenData tokenData; if (type == 0) { @@ -168,72 +173,66 @@ public class TokensMtgImageSource implements CardImageSource { } String url = "http://tokens.mtg.onl/tokens/" + tokenData.getExpansionSetCode().trim() + "_" - + tokenData.getNumber().trim() + "-" + tokenData.getName().trim()+ ".jpg"; + + tokenData.getNumber().trim() + "-" + tokenData.getName().trim() + ".jpg"; url = url.replace(' ', '-'); return url; } - private List tokensData; - - private final Object tokensDataSync = new Object(); - private List getTokensData() throws IOException { - if (tokensData == null) { - synchronized (tokensDataSync) { - if (tokensData == null) { - tokensData = new ArrayList(); + synchronized (tokensDataSync) { + if (tokensData == null) { + tokensData = new ArrayList<>(); - // get tokens data from resource file - InputStream inputStream = null; - try { - inputStream = this.getClass().getResourceAsStream("/tokens-mtg-onl-list.csv"); - List fileTokensData = parseTokensData(inputStream); - tokensData.addAll(fileTokensData); - } catch (Exception exception) { - logger.warn("Failed to get tokens description from resource file tokens-mtg-onl-list.csv", exception); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Exception e) { - logger.error("Input stream close failed:", e); + // get tokens data from resource file + InputStream inputStream = null; + try { + inputStream = this.getClass().getResourceAsStream("/tokens-mtg-onl-list.csv"); + List fileTokensData = parseTokensData(inputStream); + tokensData.addAll(fileTokensData); + } catch (Exception exception) { + logger.warn("Failed to get tokens description from resource file tokens-mtg-onl-list.csv", exception); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception e) { + logger.error("Input stream close failed:", e); + } + } + } + + // description on site may contain new information + // try to add it + try { + URL url = new URL("http://tokens.mtg.onl/data/SetsWithTokens.csv"); + inputStream = url.openStream(); + List siteTokensData = parseTokensData(inputStream); + + List newTokensData = new ArrayList<>(); + for (TokenData siteData : siteTokensData) { + boolean isNew = true; + for (TokenData fileData : tokensData) { + if (siteData.getName().equalsIgnoreCase(fileData.getName()) + && siteData.getNumber().equalsIgnoreCase(fileData.getNumber()) + && siteData.getExpansionSetCode().equalsIgnoreCase(fileData.getExpansionSetCode())) { + isNew = false; + break; } } + if (isNew) { + newTokensData.add(siteData); + } } - // description on site may contain new information - // try to add it - try { - URL url = new URL("http://tokens.mtg.onl/data/SetsWithTokens.csv"); - inputStream = url.openStream(); - List siteTokensData = parseTokensData(inputStream); - - List newTokensData = new ArrayList(); - for (TokenData siteData : siteTokensData) { - boolean isNew = true; - for (TokenData fileData : tokensData) { - if (siteData.getName().equalsIgnoreCase(fileData.getName()) - && siteData.getNumber().equalsIgnoreCase(fileData.getNumber()) - && siteData.getExpansionSetCode().equalsIgnoreCase(fileData.getExpansionSetCode())) { - isNew = false; - break; - } - } - if (isNew) { - newTokensData.add(siteData); - } - } - - tokensData.addAll(newTokensData); - } catch (Exception exception) { - logger.warn("Failed to get tokens description from tokens.mtg.onl", exception); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (Exception e) { - logger.error("Input stream close failed:", e); - } + tokensData.addAll(newTokensData); + } catch (Exception exception) { + logger.warn("Failed to get tokens description from tokens.mtg.onl", exception); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (Exception e) { + logger.error("Input stream close failed:", e); } } } @@ -244,7 +243,7 @@ public class TokensMtgImageSource implements CardImageSource { } private List parseTokensData(InputStream inputStream) throws IOException { - List tokensData = new ArrayList(); + List newTokensData = new ArrayList<>(); InputStreamReader inputReader = null; BufferedReader reader = null; @@ -266,8 +265,7 @@ public class TokensMtgImageSource implements CardImageSource { if (state == 2) { state = 0; } - } else { - if (state == 0) { + } else if (state == 0) { set = line.substring(0, 3); state = 1; } else { @@ -279,8 +277,7 @@ public class TokensMtgImageSource implements CardImageSource { String name = split[0].replace('‚', ','); String number = split[1]; TokenData token = new TokenData(name, number, set); - tokensData.add(token); - } + newTokensData.add(token); } line = reader.readLine(); @@ -302,7 +299,7 @@ public class TokensMtgImageSource implements CardImageSource { } } - return tokensData; + return newTokensData; } final class TokenData { @@ -334,12 +331,12 @@ public class TokensMtgImageSource implements CardImageSource { public Integer getTotalImages() { return -1; } - + @Override public Boolean isTokenSource() { return true; } - + @Override public void doPause(String httpImageUrl) { } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/CardDownloadData.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/CardDownloadData.java index dda5955bc82..4130addaf59 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/CardDownloadData.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/CardDownloadData.java @@ -10,6 +10,7 @@ public class CardDownloadData { private String name; private String downloadName; + private String fileName = ""; private String set; private String tokenSetCode; private String tokenDescriptor; @@ -32,6 +33,11 @@ public class CardDownloadData { this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, token, false, false); } + public CardDownloadData(String name, String set, String collectorId, boolean usesVariousArt, Integer type, String tokenSetCode, String tokenDescriptor, boolean token, String fileName) { + this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, token, false, false); + this.fileName = fileName; + } + public CardDownloadData(String name, String set, String collectorId, boolean usesVariousArt, Integer type, String tokenSetCode, String tokenDescriptor, boolean token, boolean twoFacedCard, boolean secondSide) { this.name = name; this.set = set; @@ -43,7 +49,7 @@ public class CardDownloadData { this.secondSide = secondSide; this.tokenSetCode = tokenSetCode; this.tokenDescriptor = tokenDescriptor; - + if (this.tokenDescriptor == null || this.tokenDescriptor.equalsIgnoreCase("")) { this.tokenDescriptor = lastDitchTokenDescriptor(); } @@ -60,6 +66,7 @@ public class CardDownloadData { this.usesVariousArt = card.usesVariousArt; this.tokenSetCode = card.tokenSetCode; this.tokenDescriptor = card.tokenDescriptor; + this.fileName = card.fileName; } @@ -118,6 +125,14 @@ public class CardDownloadData { return name; } + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + public void setName(String name) { this.name = name; } @@ -125,7 +140,7 @@ public class CardDownloadData { public String getSet() { return set; } - + public void setSet(String set) { this.set = set; } @@ -144,15 +159,15 @@ public class CardDownloadData { public void setTokenDescriptor(String tokenDescriptor) { this.tokenDescriptor = tokenDescriptor; - } - + } + private String lastDitchTokenDescriptor() { - String name = this.name.replaceAll("[^a-zA-Z0-9]", ""); - String descriptor = name + "...."; + String tmpName = this.name.replaceAll("[^a-zA-Z0-9]", ""); + String descriptor = tmpName + "...."; descriptor = descriptor.toUpperCase(); return descriptor; - } - + } + public boolean isToken() { return token; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index c76e2498f49..07ae2dd24f0 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -57,11 +57,11 @@ import org.mage.plugins.card.dl.sources.AltMtgOnlTokensImageSource; import org.mage.plugins.card.dl.sources.CardImageSource; import org.mage.plugins.card.dl.sources.GrabbagImageSource; import org.mage.plugins.card.dl.sources.MagicCardsImageSource; +import org.mage.plugins.card.dl.sources.MagidexImageSource; import org.mage.plugins.card.dl.sources.MtgOnlTokensImageSource; import org.mage.plugins.card.dl.sources.MythicspoilerComSource; import org.mage.plugins.card.dl.sources.TokensMtgImageSource; import org.mage.plugins.card.dl.sources.WizardCardsImageSource; -import org.mage.plugins.card.dl.sources.MagidexImageSource; import org.mage.plugins.card.properties.SettingsManager; import org.mage.plugins.card.utils.CardImageUtils; @@ -235,7 +235,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab dlg = new JOptionPane(p0, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[1]); } - public static boolean checkForNewCards(List allCards) { + public static boolean checkForMissingCardImages(List allCards) { AtomicBoolean missedCardTFiles = new AtomicBoolean(); allCards.parallelStream().forEach(card -> { if (!missedCardTFiles.get()) { @@ -279,7 +279,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab private void updateProgressText(int cardCount) { float mb = (cardCount * cardImageSource.getAverageSize()) / 1024; bar.setString(String.format(cardIndex == cardCount ? "%d of %d cards finished! Please close!" - : "%d of %d cards finished! Please wait! [%.1f Mb]", 0, cardCount, mb)); + : "%d of %d cards finished! Please wait! [%.1f Mb]", 0, cardCount, mb)); } private static String createDownloadName(CardInfo card) { @@ -309,57 +309,57 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab } int numberCardImages = allCards.size(); - + int numberWithoutTokens = 0; try { offlineMode = true; - allCards.parallelStream().forEach(card -> { - if (!card.getCardNumber().isEmpty() && !"0".equals(card.getCardNumber()) && !card.getSetCode().isEmpty() - && !ignoreUrls.contains(card.getSetCode())) { - String cardName = card.getName(); - boolean isType2 = type2SetsFilter.contains(card.getSetCode()); - CardDownloadData url = new CardDownloadData(cardName, card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard()); - if (url.getUsesVariousArt()) { - url.setDownloadName(createDownloadName(card)); - } + allCards.parallelStream().forEach(card -> { + if (!card.getCardNumber().isEmpty() && !"0".equals(card.getCardNumber()) && !card.getSetCode().isEmpty() + && !ignoreUrls.contains(card.getSetCode())) { + String cardName = card.getName(); + boolean isType2 = type2SetsFilter.contains(card.getSetCode()); + CardDownloadData url = new CardDownloadData(cardName, card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard()); + if (url.getUsesVariousArt()) { + url.setDownloadName(createDownloadName(card)); + } - url.setFlipCard(card.isFlipCard()); - url.setSplitCard(card.isSplitCard()); - url.setType2(isType2); + url.setFlipCard(card.isFlipCard()); + url.setSplitCard(card.isSplitCard()); + url.setType2(isType2); - allCardsUrls.add(url); - if (card.isDoubleFaced()) { - if (card.getSecondSideName() == null || card.getSecondSideName().trim().isEmpty()) { - throw new IllegalStateException("Second side card can't have empty name."); - } - url = new CardDownloadData(card.getSecondSideName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), true); - url.setType2(isType2); - allCardsUrls.add(url); - } - if (card.isFlipCard()) { - if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) { - throw new IllegalStateException("Flipped card can't have empty name."); - } - url = new CardDownloadData(card.getFlipCardName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard()); - url.setFlipCard(true); - url.setFlippedSide(true); - url.setType2(isType2); - allCardsUrls.add(url); - } - } else if (card.getCardNumber().isEmpty() || "0".equals(card.getCardNumber())) { - System.err.println("There was a critical error!"); - logger.error("Card has no collector ID and won't be sent to client: " + card); - } else if (card.getSetCode().isEmpty()) { - System.err.println("There was a critical error!"); - logger.error("Card has no set name and won't be sent to client:" + card); - } - }); + allCardsUrls.add(url); + if (card.isDoubleFaced()) { + if (card.getSecondSideName() == null || card.getSecondSideName().trim().isEmpty()) { + throw new IllegalStateException("Second side card can't have empty name."); + } + url = new CardDownloadData(card.getSecondSideName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), true); + url.setType2(isType2); + allCardsUrls.add(url); + } + if (card.isFlipCard()) { + if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) { + throw new IllegalStateException("Flipped card can't have empty name."); + } + url = new CardDownloadData(card.getFlipCardName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard()); + url.setFlipCard(true); + url.setFlippedSide(true); + url.setType2(isType2); + allCardsUrls.add(url); + } + } else if (card.getCardNumber().isEmpty() || "0".equals(card.getCardNumber())) { + System.err.println("There was a critical error!"); + logger.error("Card has no collector ID and won't be sent to client: " + card); + } else if (card.getSetCode().isEmpty()) { + System.err.println("There was a critical error!"); + logger.error("Card has no set name and won't be sent to client:" + card); + } + }); + numberWithoutTokens = allCards.size(); allCardsUrls.addAll(getTokenCardUrls()); } catch (Exception e) { logger.error(e); } - int numberTokenImages = allCardsUrls.size() - numberCardImages; - + int numberAllTokenImages = allCardsUrls.size() - numberWithoutTokens; /** * check to see which cards we already have @@ -372,21 +372,16 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab } }); - logger.info("Check download images (total cards: " + numberCardImages + ", total tokens: " + numberTokenImages + ") => Missing images: " + cardsToDownload.size()); - if (logger.isDebugEnabled()) { - for (CardDownloadData card : cardsToDownload) { - if (card.isToken()) { - logger.debug("Card to download: " + card.getName() + " (Token) "); - } else { - try { - logger.debug("Card to download: " + card.getName() + " (" + card.getSet() + ")"); - } catch (Exception e) { - logger.error(e); - } - } + int tokenImages = 0; + for (CardDownloadData card : cardsToDownload) { + logger.debug((card.isToken() ? "Token" : "Card") + " image to download: " + card.getName() + " (" + card.getSet() + ")"); + if (card.isToken()) { + tokenImages++; } } - + logger.info("Check download images (total card images: " + numberCardImages + ", total token images: " + numberAllTokenImages + ")"); + logger.info(" => Missing card images: " + (cardsToDownload.size() - tokenImages)); + logger.info(" => Missing token images: " + tokenImages); return new ArrayList<>(cardsToDownload); } @@ -413,24 +408,29 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab String[] params = line.split("\\|", -1); if (params.length >= 5) { int type = 0; + String fileName = ""; if (params[4] != null && !params[4].isEmpty()) { type = Integer.parseInt(params[4].trim()); } + if (params.length > 5 && params[5] != null && !params[5].isEmpty()) { + fileName = params[5].trim(); + } + if (params[1].toLowerCase().equals("generate") && params[2].startsWith("TOK:")) { String set = params[2].substring(4); CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true); list.add(card); } else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM:")) { String set = params[2].substring(7); - CardDownloadData card = new CardDownloadData("Emblem " + params[3], set, "0", false, type, "", "", true); + CardDownloadData card = new CardDownloadData("Emblem " + params[3], set, "0", false, type, "", "", true, fileName); list.add(card); } else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM-:")) { String set = params[2].substring(8); - CardDownloadData card = new CardDownloadData(params[3] + " Emblem", set, "0", false, type, "", "", true); + CardDownloadData card = new CardDownloadData(params[3] + " Emblem", set, "0", false, type, "", "", true, fileName); list.add(card); } else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM!:")) { String set = params[2].substring(8); - CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true); + CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true, fileName); list.add(card); } } else { @@ -531,20 +531,18 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab imageRef = cardImageSource.getSourceName() + imageRef; try { URL imageUrl = new URL(imageRef); - if (card != null) { - card.setToken(cardImageSource.isTokenSource()); - } + card.setToken(cardImageSource.isTokenSource()); Runnable task = new DownloadTask(card, imageUrl, fileName, cardImageSource.getTotalImages()); executor.execute(task); } catch (Exception ex) { } - } else if (card != null && cardImageSource.getTotalImages() == -1) { + } else if (cardImageSource.getTotalImages() == -1) { logger.info("Card not available on " + cardImageSource.getSourceName() + ": " + card.getName() + " (" + card.getSet() + ")"); synchronized (sync) { update(cardIndex + 1, cardsToDownload.size()); } } - } else if (url != null) { + } else { Runnable task = new DownloadTask(card, new URL(url), cardsToDownload.size()); executor.execute(task); } @@ -637,7 +635,11 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab } File existingFile = new File(imagePath.replaceFirst("\\w{3}.zip", "")); if (existingFile.exists()) { - new TFile(existingFile).cp_rp(outputFile); + try { + new TFile(existingFile).cp_rp(outputFile); + } catch (IOException e) { + logger.error("Error while copying file " + card.getName(), e); + } synchronized (sync) { update(cardIndex + 1, count); } @@ -728,7 +730,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab logger.error(e, e); } finally { if (temporaryFile != null) { - //temporaryFile.delete(); + temporaryFile.delete(); } } synchronized (sync) { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java index 34a2ede8113..759787d6186 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java @@ -167,7 +167,7 @@ public class CardImageUtils { String imageName; String type = card.getType() != 0 ? " " + Integer.toString(card.getType()) : ""; - String name = card.getName().replace(":", "").replace("//", "-"); + String name = card.getFileName().isEmpty() ? card.getName().replace(":", "").replace("//", "-") : card.getFileName(); if (card.getUsesVariousArt()) { imageName = name + "." + card.getCollectorId() + ".full.jpg"; diff --git a/Mage.Client/src/main/resources/card-pictures-tok.txt b/Mage.Client/src/main/resources/card-pictures-tok.txt index e3fbce26ad1..b242976bacb 100644 --- a/Mage.Client/src/main/resources/card-pictures-tok.txt +++ b/Mage.Client/src/main/resources/card-pictures-tok.txt @@ -29,9 +29,9 @@ |Generate|TOK:KLD|Thopter|1| |Generate|TOK:KLD|Thopter|2| |Generate|TOK:KLD|Thopter|3| -|Generate|EMBLEM!:KLD|Emblem Chandra, Torch of Defiance|| -|Generate|EMBLEM!:KLD|Emblem Nissa, Vital Force|| -|Generate|EMBLEM!:KLD|Emblem Dovin Baan|| +|Generate|EMBLEM!:KLD|Emblem Chandra|| +|Generate|EMBLEM!:KLD|Emblem Nissa|| +|Generate|EMBLEM!:KLD|Emblem Dovin|| |Generate|TOK:CN2|Assassin|| |Generate|TOK:CN2|Beast|| @@ -60,7 +60,7 @@ |Generate|TOK:EMA|Wall|| |Generate|TOK:EMA|Wurm|| |Generate|TOK:EMA|Zombie|| -|Generate|EMBLEM!:EMA|Emblem Dack Fayden|| +|Generate|EMBLEM!:EMA|Emblem Dack|| |Generate|TOK:EMN|Eldrazi Horror|| |Generate|TOK:EMN|Human|| @@ -70,8 +70,8 @@ |Generate|TOK:EMN|Zombie|2| |Generate|TOK:EMN|Zombie|3| |Generate|TOK:EMN|Zombie|4| -|Generate|EMBLEM!:EMN|Emblem Liliana, the Last Hope|| -|Generate|EMBLEM!:EMN|Emblem Tamiyo, Field Researcher|| +|Generate|EMBLEM!:EMN|Emblem Liliana|| +|Generate|EMBLEM!:EMN|Emblem Tamiyo|| |Generate|TOK:SOI|Angel|| |Generate|TOK:SOI|Clue|1| @@ -89,8 +89,8 @@ |Generate|TOK:SOI|Vampire Knight|| |Generate|TOK:SOI|Wolf|| |Generate|TOK:SOI|Zombie|| -|Generate|EMBLEM!:SOI|Emblem Arlinn, Embraced by the Moon|| -|Generate|EMBLEM!:SOI|Emblem Jace, Unraveler of Secrets|| +|Generate|EMBLEM!:SOI|Emblem Arlinn|| +|Generate|EMBLEM!:SOI|Emblem Jace|| |Generate|TOK:OGW|Angel|| |Generate|TOK:OGW|Elemental|1| @@ -123,7 +123,7 @@ |Generate|TOK:C15|Gold|| |Generate|TOK:C15|Knight|1| |Generate|TOK:C15|Knight|2| -|Generate|TOK:C15|Lightning Rager|| +|Generate|TOK:C15|Lightning Ranger|| |Generate|TOK:C15|Saproling|| |Generate|TOK:C15|Shapeshifter|| |Generate|TOK:C15|Snake|1| @@ -145,9 +145,9 @@ |Generate|TOK:BFZ|Kor Ally|| |Generate|TOK:BFZ|Octopus|| |Generate|TOK:BFZ|Plant|| -|Generate|EMBLEM!:BFZ|Emblem Gideon, Ally of Zendikar|| -|Generate|EMBLEM!:BFZ|Emblem Kiora, Master of the Depths|| -|Generate|EMBLEM!:BFZ|Emblem Ob Nixilis Reignited|| +|Generate|EMBLEM!:BFZ|Emblem Gideon|| +|Generate|EMBLEM!:BFZ|Emblem Kiora|| +|Generate|EMBLEM!:BFZ|Emblem Nixilis|| |Generate|TOK:DDP|Eldrazi Spawn|1| |Generate|TOK:DDP|Eldrazi Spawn|2| @@ -194,9 +194,9 @@ |Generate|TOK:ORI|Thopter|1| |Generate|TOK:ORI|Thopter|2| |Generate|TOK:ORI|Zombie|| -|Generate|EMBLEM!:ORI|Emblem Chandra, Roaring Flame|| -|Generate|EMBLEM!:ORI|Emblem Jace, Telepath Unbound|| -|Generate|EMBLEM!:ORI|Emblem Liliana, Defiant Necromancer|| +|Generate|EMBLEM!:ORI|Emblem Chandra|| +|Generate|EMBLEM!:ORI|Emblem Jace|| +|Generate|EMBLEM!:ORI|Emblem Liliana|| #|Generate|TOK:PTC|Angel|| #|Generate|TOK:PTC|Avatar|| @@ -356,7 +356,7 @@ |Generate|TOK:CNS|Squirrel|| |Generate|TOK:CNS|Wolf|| |Generate|TOK:CNS|Construct|| -|Generate|EMBLEM!:CNS|Emblem Dack Fayden|| +|Generate|EMBLEM!:CNS|Emblem Dack Fayden||Emblem Dack| |Generate|TOK:JOU|Sphinx|| |Generate|TOK:JOU|Zombie|| @@ -379,7 +379,7 @@ |Generate|TOK:BNG|Centaur|| |Generate|TOK:BNG|Wolf|| |Generate|TOK:BNG|Gold|| -|Generate|EMBLEM:BNG|Kiora, the Crashing Wave|| +|Generate|EMBLEM:BNG|Kiora, the Crashing Wave||Emblem Kiora| |Generate|TOK:THS|Cleric|| |Generate|TOK:THS|Soldier|1| @@ -393,7 +393,7 @@ |Generate|TOK:THS|Satyr|| |Generate|TOK:THS|Golem|1| |Generate|TOK:THS|Golem|2| -|Generate|EMBLEM-:THS|Elspeth, Suns Champion|| +|Generate|EMBLEM-:THS|Elspeth, Suns Champion||Emblem Elspeth| |Generate|TOK:M14|Sliver|1| |Generate|TOK:M14|Sliver|2| @@ -407,8 +407,8 @@ |Generate|TOK:M14|Beast|| |Generate|TOK:M14|Saproling|| |Generate|TOK:M14|Wolf|| -|Generate|EMBLEM:M14|Liliana of the Dark Realms|| -|Generate|EMBLEM:M14|Garruk, Caller of Beasts|| +|Generate|EMBLEM:M14|Liliana of the Dark Realms||Emblem Liliana| +|Generate|EMBLEM:M14|Garruk, Caller of Beasts||Emblem Garruk| |Generate|TOK:DDL|Griffin|| |Generate|TOK:DDL|Beast|| @@ -428,7 +428,7 @@ |Generate|TOK:MMA|Treefolk Shaman|| |Generate|TOK:MMA|Faerie Rogue|| |Generate|TOK:MMA|Worm|| -|Generate|EMBLEM:MMA|Elspeth, Knight Errant|| +|Generate|EMBLEM:MMA|Elspeth, Knight Errant||Emblem Elspeth| |Generate|TOK:DGM|Elemental|| |Generate|TOK:DGM|Bird|| @@ -443,7 +443,7 @@ |Generate|TOK:GTC|Soldier|1| |Generate|TOK:GTC|Soldier|2| |Generate|TOK:GTC|Spirit|| -|Generate|EMBLEM:GTC|Domri Rade|| +|Generate|EMBLEM:GTC|Domri Rade||Emblem Domri| |Generate|TOK:RTR|Bird|| |Generate|TOK:RTR|Knight|1| @@ -462,7 +462,7 @@ |Generate|TOK:DDJ|Saproling|| -|Generate|EMBLEM-:M13|Liliana of the Dark Realms|| +|Generate|EMBLEM-:M13|Liliana of the Dark Realms||Emblem Liliana| |Generate|TOK:M13|Cat|| |Generate|TOK:M13|Goat|| |Generate|TOK:M13|Soldier|| @@ -475,7 +475,7 @@ |Generate|TOK:M13|Saproling|| |Generate|TOK:M13|Wurm|| -|Generate|EMBLEM:AVR|Tamiyo, the Moon Sage|| +|Generate|EMBLEM:AVR|Tamiyo, the Moon Sage||Emblem Tamiyo| |Generate|TOK:AVR|Angel|1| |Generate|TOK:AVR|Angel|2| |Generate|TOK:AVR|Angel|3| @@ -488,12 +488,12 @@ |Generate|TOK:AVR|Demon|3| |Generate|TOK:AVR|Zombie|| -|Generate|EMBLEM:DDI|Venser, the Sojourner|| -|Generate|EMBLEM:DDI|Koth of the Hammer|| +|Generate|EMBLEM:DDI|Venser, the Sojourner||Emblem Venser| +|Generate|EMBLEM:DDI|Koth of the Hammer||Emblem Koth| |Generate|TOK:DKA|Human|| |Generate|TOK:DKA|Vampire|| -|Generate|EMBLEM:DKA|Sorin, Lord of Innistrad| +|Generate|EMBLEM:DKA|Sorin, Lord of Innistrad||Emblem Sorin| |Generate|TOK:ISD|Angel|| |Generate|TOK:ISD|Spirit|| diff --git a/Mage.Client/src/main/resources/tokens-mtg-onl-list.csv b/Mage.Client/src/main/resources/tokens-mtg-onl-list.csv index 2a64a370e06..1d2ea50d5c9 100644 --- a/Mage.Client/src/main/resources/tokens-mtg-onl-list.csv +++ b/Mage.Client/src/main/resources/tokens-mtg-onl-list.csv @@ -1,7 +1,7 @@ -Token name, Number, Color, P/T, Promo, Type, Artist, Text +Token name, Number, Color, P/T, Promo, Type, Artist, Text + +UGL - Unglued (1998-08-11) -UGL - Unglued (1998-08-11) - Pegasus, 89, W, 1|1, -, Creature - Pegasus, Mark Zug, Flying Soldier, 90, W, 1|1, -, Creature - Soldier, Daren Bader, - Zombie, 91, B, 2|2, -, Creature - Zombie, Christopher Rush, - @@ -9,27 +9,27 @@ Goblin, 92, R, 1|1, -, Creature - Goblin, Pete Venters, - Sheep, 93, G, 1|1, -, Creature - Sheep, Kev Walker, - Squirrel, 94, G, 1|1, -, Creature - Squirrel, Ron Spencer, - -ATH - Anthologies (1998-11-01) - +ATH - Anthologies (1998-11-01) + Pegasus, 89, W, 1|1, -, Creature - Pegasus, Mark Zug, Flying Goblin, 92, R, 1|1, -, Creature - Goblin, Pete Venters, - -INV - Invasion (2000-10-02) - +INV - Invasion (2000-10-02) + Bird, T1, U, 1|1, Player Rewards, Creature - Bird, Michael Sutfin, Flying Elephant, T2, G, 3|3, Player Rewards, Creature - Elephant, Terese Nielsen, - Saproling, T3, G, 1|1, Player Rewards, Creature - Saproling, Jeff Laubenstein, - -PLS - Planeshift (2001-02-05) - +PLS - Planeshift (2001-02-05) + Spirit, T1, W, 1|1, Player Rewards, Creature - Spirit, John Matson, Flying -APC - Apocalypse (2001-06-04) - +APC - Apocalypse (2001-06-04) + Goblin Soldier, T1, R W, 1|1, Player Rewards, Creature - Goblin Soldier, Ron Spears, - -ODY - Odyssey (2001-10-01) - +ODY - Odyssey (2001-10-01) + Bear, T1, G, 2|2, Player Rewards, Creature - Bear, Heather Hudson, - Beast, T2, G, 4|4, Player Rewards, Creature - Beast, Larry Elmore, - Elephant, T3, G, 3|3, Player Rewards, Creature - Elephant, Arnie Swekel, - @@ -37,46 +37,46 @@ Squirrel, T4, G, 1|1, Player Rewards, Creature - Squirrel, Ron Spencer, - Wurm, T5, G, 6|6, Player Rewards, Creature - Wurm, Alan Pollack, - Zombie, T6, B, 2|2, Player Rewards, Creature - Zombie, Dana Knutson, - -ONS - Onslaught (2002-10-07) - +ONS - Onslaught (2002-10-07) + Bear, T1, G, 2|2, Player Rewards, Creature - Bear, Glen Angus, - Dragon, T2, R, 5|5, Player Rewards, Creature - Dragon, Glen Angus, Flying Insect, T3, G, 1|1, Player Rewards, Creature - Insect, Anthony S. Waters, - Soldier, T4, W, 1|1, Player Rewards, Creature - Soldier, Ron Spencer, - -LGN - Legions (2003-02-03) - +LGN - Legions (2003-02-03) + Goblin, T1, R, 1|1, Player Rewards, Creature - Goblin, Darrell Riche, - Sliver, T2, -, 1|1, Player Rewards, Creature - Sliver, Tony Szczudlo, - -SCG - Scourge (2003-05-26) - +SCG - Scourge (2003-05-26) + Angel, T1, W, 4|4, Player Rewards, Creature - Angel, Scott M. Fischer, Flying -8ED - Eighth Edition (2003-07-28) - -Rukh, T1, R, 4|4, Player Rewards, Creature - Rukh, Edward P. Beard‚ Jr., Flying +8ED - Eighth Edition (2003-07-28) + +Rukh, T1, R, 4|4, Player Rewards, Creature - Rukh, Edward P. Beard� Jr., Flying + +MRD - Mirrodin (2003-10-02) -MRD - Mirrodin (2003-10-02) - Demon, T1, B, *|*, Player Rewards, Creature - Demon, Pete Venters, - Myr, T2, -, 1|1, Player Rewards, Creature - Myr, Wayne England, - Pentavite, T3, -, 1|1, Player Rewards, Artifact Creature - Pentavite, Greg Staples, - -DST - Darksteel (2004-02-06) - -Beast, T1, G, 3|3, Player Rewards, Creature - Beast, Edward P. Beard‚ Jr., - +DST - Darksteel (2004-02-06) + +Beast, T1, G, 3|3, Player Rewards, Creature - Beast, Edward P. Beard� Jr., - + +CHK - Champions of Kamigawa (2004-10-01) -CHK - Champions of Kamigawa (2004-10-01) - Spirit, T1, -, 1|1, Player Rewards, Creature - Spirit, Hugh Jamieson, - -CSP - Coldsnap (2006-07-21) - -Marit Lage, T1, B, 20|20, Pre-Release, Creature - Avatar, Stephan Martiniere, Flying‚ indestructible +CSP - Coldsnap (2006-07-21) + +Marit Lage, T1, B, 20|20, Pre-Release, Creature - Avatar, Stephan Martiniere, Flying� indestructible + +10E - Tenth Edition (2007-07-13) -10E - Tenth Edition (2007-07-13) - Soldier, 1, W, 1|1, -, Creature - Soldier, Parente, - Zombie, 2, B, 2|2, -, Creature - Zombie, Carl Critchlow, - Dragon, 3, R, 5|5, -, Creature - Dragon, Jim Pavelec, Flying @@ -84,8 +84,8 @@ Goblin, 4, R, 1|1, -, Creature - Goblin, Dave Kendall, - Saproling, 5, G, 1|1, -, Creature - Saproling, Cyril Van Der Haegen, - Wasp, 6, -, 1|1, -, Artifact Creature - Insect, Ron Spencer, Flying -LRW - Lorwyn (2007-10-12) - +LRW - Lorwyn (2007-10-12) + Avatar, 1, W, *|*, -, Creature - Avatar, Vance Kovacs, This creature's power and toughness are each equal to your life total. Elemental, 2, W, 4|4, -, Creature - Elemental, Anthony S. Waters, Flying Kithkin Soldier, 3, W, 1|1, -, Creature - Kithkin Soldier, Greg Hildebrandt, - @@ -98,20 +98,20 @@ Elf Warrior, 9, G, 1|1, -, Creature - Elf Warrior, Dominick Domingo, - Wolf, 10, G, 2|2, -, Creature - Wolf, Pete Venters, - Shapeshifter, 11, -, 1|1, -, Creature - Shapeshifter, Franz Vohwinkel, Changeling -EVG - Duel Decks: Elves vs. Goblins (2007-11-16) - +EVG - Duel Decks: Elves vs. Goblins (2007-11-16) + Elemental, T1, G, 7|7, -, Creature - Elemental, Anthony S. Waters, Trample Elf Warrior, T2, G, 1|1, -, Creature - Elf Warrior, Dominick Domingo, - Goblin, T3, R, 1|1, -, Creature - Goblin, Dave Kendall, - -MOR - Morningtide (2008-02-01) - +MOR - Morningtide (2008-02-01) + Giant Warrior, 1, W, 5|5, -, Creature - Giant Warrior, Steve Ellis, - Faerie Rogue, 2, B, 1|1, -, Creature - Faerie Rogue, Jim Nelson, Flying Treefolk Shaman, 3, G, 2|5, -, Creature - Treefolk Shaman, Richard Sardinha, - -SHM - Shadowmoor (2008-05-02) - +SHM - Shadowmoor (2008-05-02) + Kithkin Soldier, 1, W, 1|1, -, Creature - Kithkin Soldier, Randy Gallegos, - Spirit, 2, W, 1|1, -, Creature - Spirit, Jeremy Enecio, Flying Rat, 3, B, 1|1, -, Creature - Rat, Carl Critchlow, - @@ -125,8 +125,8 @@ Giant Warrior, 10, R G, 4|4, -, Creature - Giant Warrior, Trevor Hairsine, Haste Goblin Warrior, 11, R G, 1|1, -, Creature - Goblin Warrior, Dave Allsop, - Elf Warrior, 12, G W, 1|1, -, Creature - Elf Warrior, Carl Frank, - -EVE - Eventide (2008-07-25) - +EVE - Eventide (2008-07-25) + Goat, 1, W, -, -, Creature - Goat, Terese Nielsen, - Bird, 2, U, 1|1, -, Creature - Bird, Heather Hudson, Flying Beast, 3, G, 3|3, -, Creature - Beast, William O'Connor, - @@ -135,8 +135,8 @@ Elemental, 5, U R, 5|5, -, Creature - Elemental, Randy Gallegos, Flying Worm, 6, B G, 1|1, -, Creature - Worm, Chuck Lukacs, - Goblin Soldier, 7, R W, 1|1, -, Creature - Goblin Soldier, Jeff Miracola, - -ALA - Shards of Alara (2008-10-03) - +ALA - Shards of Alara (2008-10-03) + Soldier, 1, W, 1|1, -, Creature - Soldier, Alan Pollack, - Homunculus, 2, U, -, -, Artifact Creature - Homunculus, Howard Lyon, - Thopter, 3, U, 1|1, -, Artifact Creature - Thopter, Andrew Murray, Flying @@ -148,30 +148,30 @@ Ooze, 8, G, *|*, -, Creature - Ooze, Anthony S. Waters, - Saproling, 9, G, 1|1, -, Creature - Saproling, Trevor Claxton, - Beast, 10, R G W, 8|8, -, Creature - Beast, Parente, - -DD2 - Duel Decks: Jace vs. Chandra (2008-11-07) - +DD2 - Duel Decks: Jace vs. Chandra (2008-11-07) + Elemental Shaman, T1, R, 3|1, -, Creature - Elemental Shaman, Jim Pavelec, - -CFX - Conflux (2009-02-06) - +CFX - Conflux (2009-02-06) + Angel, 1, W, 4|4, -, Creature - Angel, Cyril Van Der Haegen, Flying Elemental, 2, R, 3|1, -, Creature - Elemental, Vance Kovacs, - -DDC - Duel Decks: Divine vs. Demonic (2009-04-10) - +DDC - Duel Decks: Divine vs. Demonic (2009-04-10) + Spirit, T1, W, 1|1, -, Creature - Spirit, Luca Zontini, Flying Demon, T2, B, *|*, -, Creature - Demon, Pete Venters, Flying Thrull, T3, B, -, -, Creature - Thrull, Veronique Meignaud, - -ARB - Alara Reborn (2009-04-30) - +ARB - Alara Reborn (2009-04-30) + Bird Soldier, 1, W, 1|1, -, Creature - Bird Soldier, Matt Cavotta, Flying Lizard, 2, G, 2|2, -, Creature - Lizard, Anthony S. Waters, - -Dragon, 3, R G, 1|1, -, Creature - Dragon, Jaime Jones, Flying‚ devour 2 +Dragon, 3, R G, 1|1, -, Creature - Dragon, Jaime Jones, Flying� devour 2 Zombie Wizard, 4, U B, 1|1, -, Creature - Zombie Wizard, Dave Allsop, - -M10 - Magic 2010 (2009-07-17) - +M10 - Magic 2010 (2009-07-17) + Avatar, 1, W, *|*, -, Creature - Avatar, Vance Kovacs, This creature's power and toughness are each equal to your life total. Soldier, 2, W, 1|1, -, Creature - Soldier, Parente, - Zombie, 3, B, 2|2, -, Creature - Zombie, Bud Cook, - @@ -181,8 +181,8 @@ Insect, 6, G, 1|1, -, Creature - Insect, Ron Spencer, - Wolf, 7, G, 2|2, -, Creature - Wolf, Lars Grant-West, - Gargoyle, 8, -, 3|4, -, Artifact Creature - Gargoyle, Paul Bonner, Flying -ZEN - Zendikar (2009-10-02) - +ZEN - Zendikar (2009-10-02) + Angel, 1, W, 4|4, -, Creature - Angel, Adi Granov, Flying Bird, 2, W, 1|1, -, Creature - Bird, Howard Lyon, Flying Kor Soldier, 3, W, 1|1, -, Creature - Kor Soldier, Daren Bader, - @@ -190,19 +190,19 @@ Illusion, 4, U, 2|2, -, Creature - Illusion, Cyril Van Der Haegen, - Merfolk, 5, U, 1|1, -, Creature - Merfolk, Warren Mahy, - Vampire, 6, B, *|*, -, Creature - Vampire, Kekai Kotaki, - Zombie Giant, 7, B, 5|5, -, Creature - Zombie Giant, Igor Kieryluk, - -Elemental, 8, R, 7|1, -, Creature - Elemental, Anthony Francisco, Trample‚ haste +Elemental, 8, R, 7|1, -, Creature - Elemental, Anthony Francisco, Trample� haste Beast, 9, G, 4|4, -, Creature - Beast, Steve Prescott, - Snake, 10, G, 1|1, -, Creature - Snake, Austin Hsu, - Wolf, 11, G, 2|2, -, Creature - Wolf, Daren Bader, - -DDD - Duel Decks: Garruk vs. Liliana (2009-10-30) - +DDD - Duel Decks: Garruk vs. Liliana (2009-10-30) + Beast, T1, G, 3|3, -, Creature - Beast, John Donahue, - Beast, T2, G, 4|4, -, Creature - Beast, Steve Prescott, - Elephant, T3, G, 3|3, -, Creature - Elephant, Arnie Swekel, - -WWK - Worldwake (2010-02-05) - +WWK - Worldwake (2010-02-05) + Soldier Ally, 1, W, 1|1, -, Creature - Soldier Ally, Kekai Kotaki, - Dragon, 2, R, 5|5, -, Creature - Dragon, Raymond Swanland, Flying Ogre, 3, R, 3|3, -, Creature - Ogre, Paul Bonner, - @@ -210,14 +210,14 @@ Elephant, 4, G, 3|3, -, Creature - Elephant, Lars Grant-West, - Plant, 5, G, -, -, Creature - Plant, Daren Bader, - Construct, 6, -, 6|12, -, Artifact Creature - Construct, Jung Park, Trample -DDE - Duel Decks: Phyrexia vs. the Coalition (2010-03-19) - -Hornet, T1, -, 1|1, -, Artifact Creature - Insect, Ron Spencer, Flying‚ haste +DDE - Duel Decks: Phyrexia vs. the Coalition (2010-03-19) + +Hornet, T1, -, 1|1, -, Artifact Creature - Insect, Ron Spencer, Flying� haste Minion, T2, B, *|*, -, Creature - Minion, Dave Kendall, - Saproling, T3, G, 1|1, -, Creature - Saproling, Warren Mahy, - -ROE - Rise of the Eldrazi (2010-04-23) - +ROE - Rise of the Eldrazi (2010-04-23) + Eldrazi Spawn, 1a, -, -, -, Creature - Eldrazi Spawn, Aleksi Briclot, Sacrifice this creature: Add {1} to your mana pool. Eldrazi Spawn, 1b, -, -, -, Creature - Eldrazi Spawn, Mark Tedin, Sacrifice this creature: Add {1} to your mana pool. Eldrazi Spawn, 1c, -, -, -, Creature - Eldrazi Spawn, Veronique Meignaud, Sacrifice this creature: Add {1} to your mana pool. @@ -226,21 +226,21 @@ Hellion, 3, R, 4|4, -, Creature - Hellion, Anthony Francisco, - Ooze, 4, G, *|*, -, Creature - Ooze, Daniel Ljunggren, - Tuktuk The Returned, 5, -, 5|5, -, Legendary Artifact Creature - Goblin Golem, Franz Vohwinkel, - -M11 - Magic 2011 (2010-07-16) - +M11 - Magic 2011 (2010-07-16) + Avatar, 1, W, *|*, -, Creature - Avatar, Vance Kovacs, This creature's power and toughness are each equal to your life total. Bird, 2, W, 3|3, -, Creature - Bird, Paul Bonner, Flying Zombie, 3, B, 2|2, -, Creature - Zombie, Bud Cook, - Beast, 4, G, 3|3, -, Creature - Beast, John Donahue, - -Ooze, 5, G, 2|2, -, Creature - Ooze, Raymond Swanland, When this creature dies‚ put two 1/1 green Ooze creature tokens onto the battlefield. +Ooze, 5, G, 2|2, -, Creature - Ooze, Raymond Swanland, When this creature dies� put two 1/1 green Ooze creature tokens onto the battlefield. Ooze, 6, G, 1|1, -, Creature - Ooze, Raymond Swanland, - -DDF - Duel Decks: Elspeth vs. Tezzeret (2010-09-03) - +DDF - Duel Decks: Elspeth vs. Tezzeret (2010-09-03) + Soldier, T1, W, 1|1, -, Creature - Soldier, Parente, - -SOM - Scars of Mirrodin (2010-10-01) - +SOM - Scars of Mirrodin (2010-10-01) + Cat, 1, W, 2|2, -, Creature - Cat, Scott Chou, - Soldier, 2, W, 1|1, -, Creature - Soldier, Goran Josic, - Goblin, 3, R, 1|1, -, Creature - Goblin, Goran Josic, - @@ -252,8 +252,8 @@ Wurm, 8, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Deathtouch Wurm, 9, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Lifelink Poison Counter, -, -, -, -, Emblem, -, - -MBS - Mirrodin Besieged (2011-02-04) - +MBS - Mirrodin Besieged (2011-02-04) + Germ, 1, B, -, -, Creature - Germ, Igor Kieryluk, - Zombie, 2, B, 2|2, -, Creature - Zombie, Dave Kendall, - Golem, 3, -, 9|9, -, Artifact Creature - Golem, Svetlin Velinov, - @@ -261,20 +261,20 @@ Horror, 4, -, *|*, -, Artifact Creature - Horror, Scott Chou, - Thopter, 5, -, 1|1, -, Artifact Creature - Thopter, Volkan Baga, Flying Poison Counter, -, -, -, -, Emblem, -, - -DDG - Duel Decks: Knights vs. Dragons (2011-04-01) - +DDG - Duel Decks: Knights vs. Dragons (2011-04-01) + Goblin, T1, R, 1|1, -, Creature - Goblin, Brandon Kitkouski, - -NPH - New Phyrexia (2011-05-13) - +NPH - New Phyrexia (2011-05-13) + Beast, 1, G, 3|3, -, Creature - Beast, Dave Allsop, - Goblin, 2, R, 1|1, -, Creature - Goblin, Jaime Jones, - Golem, 3, -, 3|3, -, Artifact Creature - Golem, Volkan Baga, - Myr, 4, -, 1|1, -, Artifact Creature - Myr, Matt Stewart, - Poison Counter, -, -, -, -, Emblem, -, - -M12 - Magic 2012 (2011-07-15) - +M12 - Magic 2012 (2011-07-15) + Bird, 1, W, 3|3, -, Creature - Bird, Paul Bonner, Flying Soldier, 2, W, 1|1, -, Creature - Soldier, Parente, - Zombie, 3, B, 2|2, -, Creature - Zombie, Carl Critchlow, - @@ -283,13 +283,13 @@ Saproling, 5, G, 1|1, -, Creature - Saproling, Cyril Van Der Haegen, - Wurm, 6, G, 6|6, -, Creature - Wurm, Anthony Francisco, - Pentavite, 7, -, 1|1, -, Artifact Creature - Pentavite, Greg Staples, Flying -DDH - Duel Decks: Ajani vs. Nicol Bolas (2011-09-02) - +DDH - Duel Decks: Ajani vs. Nicol Bolas (2011-09-02) + Griffin, T1, W, 2|2, -, Creature - Griffin, Jim Nelson, Flying Saproling, T2, G, 1|1, -, Creature - Saproling, Cyril Van Der Haegen, - -ISD - Innistrad (2011-09-30) - +ISD - Innistrad (2011-09-30) + Angel, 1, W, 4|4, -, Creature - Angel, Winona Nelson, Flying Spirit, 2, W, 1|1, -, Creature - Spirit, Kev Walker, Flying Homunculus, 3, U, 2|2, -, Creature - Homunculus, Johann Bodin, - @@ -304,24 +304,24 @@ Spider, 11, G, 1|2, -, Creature - Spider, Daniel Ljunggren, Reach Wolf, 12, G, 2|2, -, Creature - Wolf, David Palumbo, - Wolf, T12, G, 2|2, Judge, Creature - Wolf, David Palumbo, - -DKA - Dark Ascension (2012-02-03) - +DKA - Dark Ascension (2012-02-03) + Human, 1, W, 1|1, -, Creature - Human, John Stanko, - Vampire, 2, B, 1|1, -, Creature - Vampire, Peter Mohrbacher, Lifelink Sorin Emblem, 3, -, -, -, Emblem - Sorin, Michael Komrack, Creatures you control get +1/+0. -DDI - Duel Decks: Venser vs. Koth (2012-03-30) - -Koth Emblem, E1, -, -, -, Emblem - Koth, Eric Deschamps, Mountains you control have Tap: This land deals 1 damage to target creature or player.' -Venser Emblem, E2, -, -, -, Emblem - Venser, Eric Deschamps, Whenever you cast a spell‚ exile target permanent. +DDI - Duel Decks: Venser vs. Koth (2012-03-30) + +Koth Emblem, E1, -, -, -, Emblem - Koth, Eric Deschamps, Mountains you control have Tap: This land deals 1 damage to target creature or player.' +Venser Emblem, E2, -, -, -, Emblem - Venser, Eric Deschamps, Whenever you cast a spell� exile target permanent. + +FNM - Friday Night Magic (2012-04-01) -FNM - Friday Night Magic (2012-04-01) - Human, T1a, W, 1|1, Full Moon, Creature - Human, Lars Grant-West, - Wolf, T1b, G, 2|2, Full Moon, Creature - Wolf, Lars Grant-West, - -AVR - Avacyn Restored (2012-05-04) - +AVR - Avacyn Restored (2012-05-04) + Angel, 1, W, 4|4, -, Creature - Angel, Anthony Palumbo, Flying Human, 2, W, 1|1, -, Creature - Human, Michael C. Hayes, - Spirit, 3, W, 1|1, -, Creature - Spirit, Ryan Yee, Flying @@ -329,14 +329,14 @@ Spirit, 4, U, 1|1, -, Creature - Spirit, Dan Scott, Flying Demon, 5, B, 5|5, -, Creature - Demon, Kev Walker, Flying Zombie, 6, B, 2|2, -, Creature - Zombie, Lucas Graciano, - Human, 7, R, 1|1, -, Creature - Human, Ryan Pancoast, Haste -Tamiyo Emblem, 8, -, -, -, Emblem - Tamiyo, Eric Deschamps, You have no maximum hand size. Whenever a card is put into your graveyard from anywhere‚ you may return it to your hand. +Tamiyo Emblem, 8, -, -, -, Emblem - Tamiyo, Eric Deschamps, You have no maximum hand size. Whenever a card is put into your graveyard from anywhere� you may return it to your hand. Angel, T1, W, 4|4, Pre-Release, Creature - Angel, James Ryman, Flying Angel, T1F, W, 4|4, Pre-Release, Creature - Angel, James Ryman, Flying Demon, T5, B, 5|5, Pre-Release, Creature - Demon, Karl Kopinski, Flying Demon, T5F, B, 5|5, Pre-Release, Creature - Demon, Karl Kopinski, Flying -M13 - Magic 2013 (2012-07-13) - +M13 - Magic 2013 (2012-07-13) + Goblin, 1, R, 1|1, League, Creature - Goblin, Jim Nelson, - Cat, 1, W, 2|2, -, Creature - Cat, Jesper Ejsing, - Goat, 2, W, -, -, Creature - Goat, Adam Paquette, - @@ -350,18 +350,18 @@ Saproling, 9, G, 1|1, -, Creature - Saproling, Brad Rigney, - Wurm, 10, G, 6|6, -, Creature - Wurm, Anthony Francisco, - Liliana Emblem, 11, -, -, -, Emblem - Liliana, D. Alexander Gregory, Swamps you control have Tap: Add {B}{B}{B}{B} to your mana pool.' -DDJ - Duel Decks: Izzet vs. Golgari (2012-09-07) - +DDJ - Duel Decks: Izzet vs. Golgari (2012-09-07) + Saproling, T1, G, 1|1, -, Creature - Saproling, Brad Rigney, - -RTR - Return to Ravnica (2012-10-05) - +RTR - Return to Ravnica (2012-10-05) + Centaur, 1, G, 3|3, Judge, Creature - Centaur, James Ryman, - Knight, 1, W, 2|2, League, Creature - Knight, Lucas Graciano, Vigilance Bird, 1, W, 1|1, -, Creature - Bird, James Ryman, Flying Knight, 2, W, 2|2, -, Creature - Knight, Matt Stewart, Vigilance Soldier, 3, W, 1|1, -, Creature - Soldier, Steve Prescott, - -Assassin, 4, B, 1|1, -, Creature - Assassin, Svetlin Velinov, Whenever this creature deals combat damage to a player‚ that player loses the game. +Assassin, 4, B, 1|1, -, Creature - Assassin, Svetlin Velinov, Whenever this creature deals combat damage to a player� that player loses the game. Dragon, 5, R, 6|6, -, Creature - Dragon, Mark Zug, Flying Goblin, 6, R, 1|1, -, Creature - Goblin, Christopher Moeller, - Centaur, 7, G, 3|3, -, Creature - Centaur, Slawomir Maniak, - @@ -371,29 +371,29 @@ Saproling, 10, G, 1|1, -, Creature - Saproling, Raoul Vitale, - Wurm, 11, G, 5|5, -, Creature - Wurm, Anthony Palumbo, Trample Elemental, 12, G W, 8|8, -, Creature - Elemental, Yeong-Hao Han, Vigilance -GTC - Gatecrash (2013-02-01) - +GTC - Gatecrash (2013-02-01) + Soldier, 1, R W, 1|1, League, Creature - Soldier, Zoltan Boros, Haste Angel, 1, W, 4|4, -, Creature - Angel, Steve Argyle, Flying Rat, 2, B, 1|1, -, Creature - Rat, Nils Hamm, - Frog Lizard, 3, G, 3|3, -, Creature - Frog Lizard, Jack Wang, - -Cleric, 4, W B, 1|1, -, Creature - Cleric, Jason Chan, {3}{W}{B}{B}‚ {T}‚ Sacrifice this creature: Return a card named Deathpact Angel from your graveyard to the battlefield. +Cleric, 4, W B, 1|1, -, Creature - Cleric, Jason Chan, {3}{W}{B}{B}� {T}� Sacrifice this creature: Return a card named Deathpact Angel from your graveyard to the battlefield. Horror, 5, U B, 1|1, -, Creature - Horror, Adam Paquette, Flying Soldier, 6, R W, 1|1, -, Creature - Soldier, David Palumbo, Haste Spirit, 7, W B, 1|1, -, Creature - Spirit, Cliff Childs, Flying -Domri Emblem, 8, -, -, -, Emblem - Domri, Tyler Jacobson, Creatures you control have double strike‚ trample‚ hexproof‚ and haste. +Domri Emblem, 8, -, -, -, Emblem - Domri, Tyler Jacobson, Creatures you control have double strike� trample� hexproof� and haste. + +DDK - Duel Decks: Sorin vs. Tibalt (2013-03-15) -DDK - Duel Decks: Sorin vs. Tibalt (2013-03-15) - Spirit, T1, W, 1|1, -, Creature - Spirit, Ryan Yee, Flying -DGM - Dragon's Maze (2013-05-03) - +DGM - Dragon's Maze (2013-05-03) + Bird, 1, W, 1|1, League, Creature - Bird, Martina Pilcerova, Flying Elemental, 1, G W, *|*, -, Creature - Elemental, Mark Winters, This creature's power and toughness are each equal to the number of creatures you control. -MMA - Modern Masters (2013-06-07) - +MMA - Modern Masters (2013-06-07) + Giant Warrior, 1, W, 5|5, -, Creature - Giant Warrior, Svetlin Velinov, - Kithkin Soldier, 2, W, 1|1, -, Creature - Kithkin Soldier, Randy Gallegos, - Soldier, 3, W, 1|1, -, Creature - Soldier, Goran Josic, - @@ -409,10 +409,10 @@ Saproling, 12, G, 1|1, -, Creature - Saproling, Warren Mahy, - Treefolk Shaman, 13, G, 2|5, -, Creature - Treefolk Shaman, Zack Stella, - Faerie Rogue, 14, U B, 1|1, -, Creature - Faerie Rogue, E. M. Gist, Flying Worm, 15, B G, 1|1, -, Creature - Worm, Chuck Lukacs, - -Elspeth Emblem, 16, -, -, -, Emblem - Elspeth, Volkan Baga, Artifacts‚ creatures‚ enchantments‚ and lands you control have indestructible. +Elspeth Emblem, 16, -, -, -, Emblem - Elspeth, Volkan Baga, Artifacts� creatures� enchantments� and lands you control have indestructible. + +M14 - Magic 2014 Core Set (2013-07-19) -M14 - Magic 2014 Core Set (2013-07-19) - Sliver, 1, -, 1|1, -, Creature - Sliver, Igor Kieryluk, - Angel, 1, W, 4|4, -, Creature - Angel, James Ryman, Flying Cat, 3, W, 2|2, -, Creature - Cat, Jesper Ejsing, - @@ -425,16 +425,16 @@ Beast, 9, G, 3|3, -, Creature - Beast, John Donahue, - Saproling, 10, G, 1|1, -, Creature - Saproling, Brad Rigney, - Wolf, 11, G, 2|2, -, Creature - Wolf, Lars Grant-West, - Liliana Emblem, 12, -, -, -, Emblem - Liliana, D. Alexander Gregory, Swamps you control have Tap: Add {B}{B}{B}{B} to your mana pool.' -Garruk Emblem, 13, -, -, -, Emblem - Garruk, Karl Kopinski, Whenever you cast a creature spell‚ you may search your library for a creature card‚ put it onto the battlefield‚ then shuffle your library. +Garruk Emblem, 13, -, -, -, Emblem - Garruk, Karl Kopinski, Whenever you cast a creature spell� you may search your library for a creature card� put it onto the battlefield� then shuffle your library. Sliver, T1, -, 1|1, League, Creature - Sliver, Vincent Proce, - -DDL - Duel Decks: Heroes vs. Monsters (2013-09-06) - +DDL - Duel Decks: Heroes vs. Monsters (2013-09-06) + Griffin, T1, W, 2|2, -, Creature - Griffin, Johann Bodin, Flying Beast, T2, G, 3|3, -, Creature - Beast, Jesper Ejsing, - -THS - Theros (2013-09-27) - +THS - Theros (2013-09-27) + Golem, 1, -, 3|3, Judge, Enchantment Artifact Creature - Golem, Yeong-Hao Han, - Soldier, 1, W, 1|1, League, Creature - Soldier, Johann Bodin, - Cleric, 1, W, 2|1, -, Enchantment Creature - Cleric, Johann Bodin, - @@ -449,8 +449,8 @@ Satyr, 9, R G, 2|2, -, Creature - Satyr, Johann Bodin, - Golem, 10, -, 3|3, -, Enchantment Artifact Creature - Golem, Yeong-Hao Han, - Elspeth Emblem, 11, -, -, -, Emblem - Elspeth, Eric Deschamps, Creatures you control get +2/+2 and have flying. -BNG - Born of the Gods (2014-02-07) - +BNG - Born of the Gods (2014-02-07) + Soldier, 1, W, 1|1, League, Enchantment Creature - Soldier, Ryan Barger, - Bird, 1, W, 1|1, -, Creature - Bird, Clint Cearly, Flying Cat Soldier, 2, W, 1|1, -, Creature - Cat Soldier, Scott Chou, Vigilance @@ -462,14 +462,14 @@ Elemental, 7, R, 3|1, -, Enchantment Creature - Elemental, Greg Staples, - Centaur, 8, G, 3|3, -, Enchantment Creature - Centaur, Ryan Barger, - Wolf, 9, G, 2|2, -, Creature - Wolf, Raoul Vitale, - Gold, 10, -, -, -, Artifact, Richard Wright, Sacrifice this artifact: Add one mana of any color to your mana pool. -Kiora Emblem, 11, -, -, -, Emblem - Kiora, Scott M. Fischer, At the beginning of your end step‚ put a 9/9 blue Kraken creature token onto the battlefield. +Kiora Emblem, 11, -, -, -, Emblem - Kiora, Scott M. Fischer, At the beginning of your end step� put a 9/9 blue Kraken creature token onto the battlefield. -DDM - Duel Decks: Jace vs. Vraska (2014-03-14) - -Assassin, T1, B, 1|1, -, Creature - Assassin, Svetlin Velinov, Whenever this creature deals combat damage to a player‚ that player loses the game. +DDM - Duel Decks: Jace vs. Vraska (2014-03-14) + +Assassin, T1, B, 1|1, -, Creature - Assassin, Svetlin Velinov, Whenever this creature deals combat damage to a player� that player loses the game. + +JOU - Journey into Nyx (2014-05-02) -JOU - Journey into Nyx (2014-05-02) - Minotaur, 1, R, 2|3, League, Creature - Minotaur, Scott Murphy, - Sphinx, 1, U, 4|4, -, Creature - Sphinx, Jesper Ejsing, Flying Zombie, 2, B, *|*, -, Creature - Zombie, Zack Stella, - @@ -478,15 +478,15 @@ Hydra, 4, G, *|*, -, Creature - Hydra, Steve Prescott, - Spider, 5, G, 1|3, -, Enchantment Creature - Spider, Yohann Schepacz, Reach Snake, 6, G B, 1|1, -, Enchantment Creature - Snake, Greg Staples, Deathtouch -MD1 - Modern Event Deck 2014 (2014-05-30) - +MD1 - Modern Event Deck 2014 (2014-05-30) + Soldier, 1, W, 1|1, -, Creature - Soldier, Goran Josic, - Spirit, 2, W, 1|1, -, Creature - Spirit, Kev Walker, Flying Myr, 3, -, 1|1, -, Artifact Creature - Myr, Matt Stewart, - -Elspeth Emblem, 4, -, -, -, Emblem - Elspeth, Volkan Baga, Artifacts‚ creatures‚ enchantments‚ and lands you control have indestructible. +Elspeth Emblem, 4, -, -, -, Emblem - Elspeth, Volkan Baga, Artifacts� creatures� enchantments� and lands you control have indestructible. + +CNS - Conspiracy (2014-06-06) -CNS - Conspiracy (2014-06-06) - Spirit, 1, W, 1|1, -, Creature - Spirit, Jeff Simpson, Flying Demon, 2, B, *|*, -, Creature - Demon, Evan Shipard, Flying Zombie, 3, B, 2|2, -, Creature - Zombie, Lucas Graciano, - @@ -495,10 +495,10 @@ Elephant, 5, G, 3|3, -, Creature - Elephant, Lars Grant-West, - Squirrel, 6, G, 1|1, -, Creature - Squirrel, Daniel Ljunggren, - Wolf, 7, G, 2|2, -, Creature - Wolf, Raoul Vitale, - Construct, 8, -, 1|1, -, Artifact Creature - Construct, Adam Paquette, Defender -Dack Emblem, 9, -, -, -, Emblem - Dack, Eric Deschamps, Whenever you cast a spell that targets one or more permanents‚ gain control of those permanents. +Dack Emblem, 9, -, -, -, Emblem - Dack, Eric Deschamps, Whenever you cast a spell that targets one or more permanents� gain control of those permanents. + +M15 - Magic 2015 Core Set (2014-07-18) -M15 - Magic 2015 Core Set (2014-07-18) - Wolf, 001, G, 1|1, Pre-Release, Creature - Wolf, David Palumbo, - Sliver, 001, -, 1|1, -, Creature - Sliver, Igor Kieryluk, - Squid, 001, U, 1|1, League, Creature - Squid, Richard Wright, Islandwalk @@ -510,18 +510,18 @@ Zombie, 006, B, 2|2, -, Creature - Zombie, Lucas Graciano, - Dragon, 007, R, 2|2, -, Creature - Dragon, Jack Wang, Flying {R}: This creature gets +1/+0 until end of turn. Goblin, 008, R, 1|1, -, Creature - Goblin, Karl Kopinski, - Beast, 009, G, 3|3, -, Creature - Beast, Dave Kendall, - -Insect, 010, G, 1|1, -, Creature - Insect, Martina Pilcerova, Flying‚ deathtouch +Insect, 010, G, 1|1, -, Creature - Insect, Martina Pilcerova, Flying� deathtouch Treefolk Warrior, 011, G, *|*, -, Creature - Treefolk Warrior, Todd Lockwood, This creature's power and toughness are each equal to the number of Forests you control. -Land Mine, 012, -, -, -, Artifact, Kev Walker, {R}‚ Sacrifice this artifact: This artifact deals 2 damage to target attacking creature without flying. -Ajani Emblem, 013, -, -, -, Emblem - Ajani, Chris Rahn, If a source would deal damage to you or a planeswalker you control‚ prevent all but 1 of that damage. -Garruk Emblem, 014, -, -, -, Emblem - Garruk, Tyler Jacobson, Whenever a creature attacks you‚ it gets +5/+5 and gains trample until end of turn. +Land Mine, 012, -, -, -, Artifact, Kev Walker, {R}� Sacrifice this artifact: This artifact deals 2 damage to target attacking creature without flying. +Ajani Emblem, 013, -, -, -, Emblem - Ajani, Chris Rahn, If a source would deal damage to you or a planeswalker you control� prevent all but 1 of that damage. +Garruk Emblem, 014, -, -, -, Emblem - Garruk, Tyler Jacobson, Whenever a creature attacks you� it gets +5/+5 and gains trample until end of turn. + +DDN - Duel Decks: Speed vs. Cunning (2014-09-05) -DDN - Duel Decks: Speed vs. Cunning (2014-09-05) - Goblin, 082, R, 1|1, -, Creature - Goblin, Karl Kopinski, - -KTK - Khans of Tarkir (2014-09-26) - +KTK - Khans of Tarkir (2014-09-26) + Warrior, 001, W, 1|1, League, Creature - Warrior, Winona Nelson, - Bird, 001, W, 3|4, -, Creature - Bird, Mark Zug, Flying Spirit, 002, W, 1|1, -, Creature - Spirit, Mike Sass, Flying @@ -534,11 +534,11 @@ Bear, 008, G, 4|4, -, Creature - Bear, Kev Walker, - Snake, 009, G, 1|1, -, Creature - Snake, Lars Grant-West, - Spirit Warrior, 010, B G, *|*, -, Creature - Spirit Warrior, Ryan Alexander Lee, - Morph, 011, -, 2|2, -, Creature, Raymond Swanland, (You can cover a face-down creature with this reminder card. A card with morph can be turned face up any time for its morph cost.) -Sarkhan Emblem, 012, -, -, -, Emblem - Sarkhan, Daarken, At the beginning of your draw step‚ draw two additional cards. At the beginning of your end step‚ discard your hand. -Sorin Emblem, 013, -, -, -, Emblem - Sorin, Cynthia Sheppard, At the beginning of each opponent's upkeep‚ that player sacrifices a creature. +Sarkhan Emblem, 012, -, -, -, Emblem - Sarkhan, Daarken, At the beginning of your draw step� draw two additional cards. At the beginning of your end step� discard your hand. +Sorin Emblem, 013, -, -, -, Emblem - Sorin, Cynthia Sheppard, At the beginning of each opponent's upkeep� that player sacrifices a creature. + +C14 - Commander 2014 (2014-11-07) -C14 - Commander 2014 (2014-11-07) - Angel, 001, W, 4|4, -, Creature - Angel, Anthony Palumbo, Flying Cat, 002, W, 2|2, -, Creature - Cat, Scott Chou, - Goat, 003, W, -, -, Creature - Goat, Adam Paquette, - @@ -546,9 +546,9 @@ Kor Soldier, 004, W, 1|1, -, Creature - Kor Soldier, Daren Bader, - Pegasus, 005, W, 1|1, -, Creature - Pegasus, Greg Hildebrandt, Flying Soldier, 006, W, 1|1, -, Creature - Soldier, Goran Josic, - Spirit, 007, W, 1|1, -, Creature - Spirit, Ryan Yee, Flying -Fish, 008, U, 3|3, -, Creature - Fish, Dan Scott, When this creature dies‚ put a 6/6 blue Whale creature token onto the battlefield with "When this creature dies‚ put a 9/9 blue Kraken creature token onto the battlefield." +Fish, 008, U, 3|3, -, Creature - Fish, Dan Scott, When this creature dies� put a 6/6 blue Whale creature token onto the battlefield with "When this creature dies� put a 9/9 blue Kraken creature token onto the battlefield." Kraken, 009, U, 9|9, -, Creature - Kraken, Dan Scott, - -Whale, 010, U, 6|6, -, Creature - Whale, Dan Scott, When this creature dies‚ put a 9/9 blue Kraken creature token onto the battlefield. +Whale, 010, U, 6|6, -, Creature - Whale, Dan Scott, When this creature dies� put a 9/9 blue Kraken creature token onto the battlefield. Zombie, 011, U, *|*, -, Creature - Zombie, Dave Kendall, - Demon, 012, B, *|*, -, Creature - Demon, Pete Venters, Flying Demon, 013, B, 5|5, -, Creature - Demon, Kev Walker, Flying @@ -573,47 +573,47 @@ Tuktuk The Returned, 031, -, 5|5, -, Legendary Artifact Creature - Goblin Golem, Wurm, 032, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Deathtouch Wurm, 033, -, 3|3, -, Artifact Creature - Wurm, Raymond Swanland, Lifelink Teferi Emblem, 034, -, -, -, Emblem - Teferi, Tyler Jacobson, You may activate loyalty abilities of planeswalkers you control on any player's turn any time you could cast an instant. -Nixilis Emblem, 035, -, -, -, Emblem - Nixilis, Daarken, {1}{B}‚ Sacrifice a creature: You gain X life and draw X cards‚ where X is the sacrificed creature's power. -Daretti Emblem, 036, -, -, -, Emblem - Daretti, Dan Scott, Whenever an artifact is put into your graveyard from the battlefield‚ return that card to the battlefield at the beginning of the next end step. +Nixilis Emblem, 035, -, -, -, Emblem - Nixilis, Daarken, {1}{B}� Sacrifice a creature: You gain X life and draw X cards� where X is the sacrificed creature's power. +Daretti Emblem, 036, -, -, -, Emblem - Daretti, Dan Scott, Whenever an artifact is put into your graveyard from the battlefield� return that card to the battlefield at the beginning of the next end step. + +DD3_EVG - Duel Decks Anthology� Elves vs. Goblins (2014-12-05) -DD3_EVG - Duel Decks Anthology‚ Elves vs. Goblins (2014-12-05) - Elemental, 001, G, 7|7, -, Creature - Elemental, Anthony S. Waters, Trample Elf Warrior, 002, G, 1|1, -, Creature - Elf Warrior, Dominick Domingo, - Goblin, 003, R, 1|1, -, Creature - Goblin, Dave Kendall, - -DD3_JVC - Duel Decks Anthology‚ Jace vs. Chandra (2014-12-05) - +DD3_JVC - Duel Decks Anthology� Jace vs. Chandra (2014-12-05) + Elemental Shaman, 004, R, 3|1, -, Creature - Elemental Shaman, Jim Pavelec, - -DD3_DVD - Duel Decks Anthology‚ Divine vs. Demonic (2014-12-05) - +DD3_DVD - Duel Decks Anthology� Divine vs. Demonic (2014-12-05) + Spirit, 005, W, 1|1, -, Creature - Spirit, Luca Zontini, Flying Demon, 006, B, *|*, -, Creature - Demon, Pete Venters, Flying Thrull, 007, B, -, -, Creature - Thrull, Veronique Meignaud, - -DD3_GVL - Duel Decks Anthology‚ Garruk vs. Liliana (2014-12-05) - +DD3_GVL - Duel Decks Anthology� Garruk vs. Liliana (2014-12-05) + Beast, 008, G, 3|3, -, Creature - Beast, John Donahue, - Beast, 009, G, 4|4, -, Creature - Beast, Steve Prescott, - Elephant, 010, G, 3|3, -, Creature - Elephant, Arnie Swekel, - Bat, 011, B, 1|1, -, Creature - Bat, Wayne Reynolds, Flying -FRF - Fate Reforged (2015-01-23) - +FRF - Fate Reforged (2015-01-23) + Monk, 001, W, 1|1, -, Creature - Monk, Steven Belledin, Prowess Monk, 001T, W, 1|1, League, Creature - Monk, Magali Villeneuve, Prowess Spirit, 002, W, 1|1, -, Creature - Spirit, Aaron Miller, Flying Warrior, 003, B, 2|1, -, Creature - Warrior, Zoltan Boros, - Manifest, 004, -, 2|2, -, Creature, Raymond Swanland, (You can cover a face-down manifested creature with this reminder card. A manifested creature card can be turned face up any time for its mana cost. A face-down card can also be turned face up for its morph cost.) -DDO - Duel Decks: Elspeth vs. Kiora (2015-02-27) - +DDO - Duel Decks: Elspeth vs. Kiora (2015-02-27) + Soldier, 066, W, 1|1, -, Creature - Soldier, Svetlin Velinov, - Kraken, 067, U, 9|9, -, Creature - Kraken, Dan Scott, - -DTK - Dragons of Tarkir (2015-03-27) - +DTK - Dragons of Tarkir (2015-03-27) + Warrior, 001, W, 1|1, -, Creature - Warrior, Aaron Miller, - Djinn Monk, 002, U, 2|2, -, Creature - Djinn Monk, Izzy, Flying Zombie, 003, B, 2|2, -, Creature - Zombie, Vincent Proce, - @@ -623,8 +623,8 @@ Goblin, 006, R, 1|1, -, Creature - Goblin, Mike Bierek, - Morph, 007, -, 2|2, -, Creature, Raymond Swanland, (You can cover a face-down creature with this reminder card. A card with morph can be turned face up any time for its morph cost.) Narset Emblem, 008, -, -, -, Emblem - Narset, Magali Villeneuve, Your opponents can't cast noncreature spells. -MM2 - Modern Masters 2015 Edition (2015-05-22) - +MM2 - Modern Masters 2015 Edition (2015-05-22) + Eldrazi Spawn, 001, -, -, -, Creature - Eldrazi Spawn, Aleksi Briclot, Sacrifice this creature: Add {1} to your mana pool. Eldrazi Spawn, 002, -, -, -, Creature - Eldrazi Spawn, Mark Tedin, Sacrifice this creature: Add {1} to your mana pool. Eldrazi Spawn, 003, -, -, -, Creature - Eldrazi Spawn, Veronique Meignaud, Sacrifice this creature: Add {1} to your mana pool. @@ -642,33 +642,33 @@ Worm, 014, B G, 1|1, -, Creature - Worm, Chuck Lukacs, - Golem, 015, -, 3|3, -, Artifact Creature - Golem, Nic Klein, - Myr, 016, -, 1|1, -, Artifact Creature - Myr, Ryan Pancoast, - -ORI - Magic Origins (2015-07-17) - +ORI - Magic Origins (2015-07-17) + Angel, 001, W, 4|4, -, Creature - Angel, Cyril Van Der Haegen, Flying Knight, 002, W, 2|2, -, Creature - Knight, Matt Stewart, Vigilance Soldier, 003, W, 1|1, -, Creature - Soldier, Steve Prescott, - Demon, 004, B, 5|5, -, Creature - Demon, Kev Walker, Flying Zombie, 005, B, 2|2, -, Creature - Zombie, Lucas Graciano, - Goblin, 006, R, 1|1, -, Creature - Goblin, Brandon Kitkouski, - -Ashaya‚ the Awoken World, 007, G, 4|4, -, Legendary Creature - Elemental, Raymond Swanland, - +Ashaya� the Awoken World, 007, G, 4|4, -, Legendary Creature - Elemental, Raymond Swanland, - Elemental, 008, G, 2|2, -, Creature - Elemental, Marco Nelor, - Elf Warrior, 009, G, 1|1, -, Creature - Elf Warrior, William O'Connor, - Thopter, 010, -, 1|1, -, Artifact Creature - Thopter, Adam Paquette, Flying Thopter, 011, -, 1|1, -, Artifact Creature - Thopter, Svetlin Velinov, Flying -Jace Emblem, 012, -, -, -, Emblem - Jace, Jaime Jones, Whenever you cast a spell‚ target opponent puts the top five cards of his or her library into his or her graveyard. -Liliana Emblem, 013, -, -, -, Emblem - Liliana, Karla Ortiz, Whenever a creature dies‚ return it to the battlefield under your control at the beginning of the next end step. -Chandra Emblem, 014, -, -, -, Emblem - Chandra, Eric Deschamps, At the beginning of your upkeep‚ this emblem deals 3 damage to you. +Jace Emblem, 012, -, -, -, Emblem - Jace, Jaime Jones, Whenever you cast a spell� target opponent puts the top five cards of his or her library into his or her graveyard. +Liliana Emblem, 013, -, -, -, Emblem - Liliana, Karla Ortiz, Whenever a creature dies� return it to the battlefield under your control at the beginning of the next end step. +Chandra Emblem, 014, -, -, -, Emblem - Chandra, Eric Deschamps, At the beginning of your upkeep� this emblem deals 3 damage to you. + +DDP - Duel Decks: Zendikar vs. Eldrazi (2015-08-28) -DDP - Duel Decks: Zendikar vs. Eldrazi (2015-08-28) - Eldrazi Spawn, 076, -, -, -, Creature - Eldrazi Spawn, Aleksi Briclot, Sacrifice this creature: Add {1} to your mana pool. Eldrazi Spawn, 077, -, -, -, Creature - Eldrazi Spawn, Veronique Meignaud, Sacrifice this creature: Add {1} to your mana pool. Eldrazi Spawn, 078, -, -, -, Creature - Eldrazi Spawn, Mark Tedin, Sacrifice this creature: Add {1} to your mana pool. Hellion, 079, R, 4|4, -, Creature - Hellion, Anthony Francisco, - Plant, 080, G, -, -, Creature - Plant, Daren Bader, - -BFZ - Battle for Zendikar (2015-10-09) - +BFZ - Battle for Zendikar (2015-10-09) + Eldrazi, 001, -, 10|10, -, Creature - Eldrazi, Jack Wang, - Eldrazi Scion, 002, -, 1|1, -, Creature - Eldrazi Scion, Izzy, Sacrifice this creature: Add {1} to your mana pool. Eldrazi Scion, 003, -, 1|1, -, Creature - Eldrazi Scion, Winona Nelson, Sacrifice this creature: Add {1} to your mana pool. @@ -678,14 +678,14 @@ Kor Ally, 006, W, 1|1, -, Creature - Kor Ally, Jeremy Wilson, - Octopus, 007, U, 8|8, -, Creature - Octopus, Craig J Spearing, - Dragon, 008, R, 5|5, -, Creature - Dragon, Raymond Swanland, Flying Plant, 009, G, 1|1, -, Creature - Plant, Sam Burley, - -Elemental, 009, R, 3|1, -, Creature - Elemental, Victor Adame Minguez, Trample‚ Haste +Elemental, 009, R, 3|1, -, Creature - Elemental, Victor Adame Minguez, Trample� Haste Elemental, 011, G R, 5|5, -, Creature - Elemental, Brad Rigney, - Gideon Emblem, 012, -, -, -, Emblem - Gideon, Eric Deschamps, - Nixilis Emblem, 013, -, -, -, Emblem - Nixilis, Chris Rahn, - Kiora Emblem, 014, -, -, -, Emblem - Kiora, Jason Chan, - -C15 - Commander 2015 (2015-11-13) - +C15 - Commander 2015 (2015-11-13) + Shapeshifter, 001, -, 1|1, -, Creature - Shapeshifter, Franz Vohwinkel, Changeling Angel, 002, W, 4|4, -, Creature - Angel, Cyril Van Der Haegen, Flying Cat, 003, W, 2|2, -, Creature - Cat, Jesper Ejsing, - @@ -696,7 +696,7 @@ Germ, 007, B, -, -, Creature - Germ, Igor Kieryluk, - Zombie, 008, B, 2|2, -, Creature - Zombie, Lucas Graciano, - Dragon, 009, R, 5|5, -, Creature - Dragon, Jim Pavelec, Flying Elemental Shaman, 010, R, 3|1, -, Creature - Elemental Shaman, Jim Pavelec, - -Lightning Rager, 011, R, 5|1, -, Creature - Elemental, Svetlin Velinov, Trample‚ Haste At the beginning of your end step‚ sacrifice this creature. +Lightning Ranger, 011, R, 5|1, -, Creature - Elemental, Svetlin Velinov, Trample� Haste At the beginning of your end step� sacrifice this creature. Bear, 012, G, 2|2, -, Creature - Bear, Heather Hudson, - Beast, 013, G, 4|4, -, Creature - Beast, Svetlin Velinov, - Elephant, 014, G, 3|3, -, Creature - Elephant, Lars Grant-West, - @@ -708,5 +708,40 @@ Wolf, 019, G, 2|2, -, Creature - Wolf, David Palumbo, - Elemental, 020, U R, 5|5, -, Creature - Elemental, Randy Gallegos, Flying Snake, 021, G U, 1|1, -, Creature - Snake, Christopher Moeller, - Spirit, 022, W B, 1|1, -, Creature - Spirit, Cliff Childs, Flying -Spirit, 023, -, *|*, -, Enchantment Creature - Spirit, Adam Paquette, This creature's power and toughness are each equal to the number of experience counters you have. +Spirit, 023, W B, *|*, -, Enchantment Creature - Spirit, Adam Paquette, This creature's power and toughness are each equal to the number of experience counters you have. Gold, 024, -, -, -, Artifact, Richard Wright, Sacrifice this artifact: Add one mana of any color to your mana pool. + +OGW - Oath of the Gatewatch (2016-01-22) + +Eldrazi Scion, 001, -, 1|1, -, Creature - Eldrazi Scion, Izzy, Sacrifice this creature: Add {1} to your mana pool. +Eldrazi Scion, 002, -, 1|1, -, Creature - Eldrazi Scion, Craig J Spearing, Sacrifice this creature: Add {1} to your mana pool. +Eldrazi Scion, 003, -, 1|1, -, Creature - Eldrazi Scion, Svetlin Velinov, Sacrifice this creature: Add {1} to your mana pool. +Eldrazi Scion, 004, -, 1|1, -, Creature - Eldrazi Scion, Izzy, Sacrifice this creature: Add {1} to your mana pool. +Eldrazi Scion, 005, -, 1|1, -, Creature - Eldrazi Scion, Winona Nelson, Sacrifice this creature: Add {1} to your mana pool. +Eldrazi Scion, 006, -, 1|1, -, Creature - Eldrazi Scion, Svetlin Velinov, Sacrifice this creature: Add {1} to your mana pool. +Angel, 007, W, 3|3, -, Creature - Angel, Anastasia Ovchinnikova, Flying +Zombie, 008, B, 2|2, -, Creature - Zombie, Kev Walker, - +Elemental, 009, R, 3|1, -, Creature - Elemental, Raymond Swanland, - +Elemental, 010, G, *|*, -, Creature - Elemental, Vincent Proce, - +Plant, 011, G, -, -, Creature - Plant, Daren Bader, - + +SOI - Shadows over Innistrad (2016-04-08) + +Angel, 001, W, 4|4, -, Creature - Angel, Magali Villeneuve, Flying +Human Soldier, 002, W, 1|1, -, Creature - Human Soldier, Deruchenko Alexander, - +Spirit, 003, W, 1|1, -, Creature - Spirit, Jason A. Engle, Flying +Vampire Knight, 004, B, 1|1, -, Creature - Vampire Knight, Deruchenko Alexander, Lifelink +Zombie, 005, B, 2|2, -, Creature - Zombie, Craig J Spearing, - +Devil, 006, R, 1|1, -, Creature - Devil, Wayne England, When this creature dies� it deals 1 damage to target creature or player. +Insect, 007, G, 1|1, -, Creature - Insect, Christopher Moeller, - +Ooze, 008, G, 3|3, -, Creature - Ooze, Nils Hamm, - +Wolf, 009, G, 2|2, -, Creature - Wolf, Aaron Miller, - +Human Cleric, 010, W B, 1|1, -, Creature - Human Cleric, Min Yum, - +Clue, 011, -, -, -, Artifact - Clue, John Avon, {2}‚ Sacrifice this Artifact: Draw a card. +Clue, 012, -, -, -, Artifact - Clue, Noah Bradley, {2}‚ Sacrifice this Artifact: Draw a card. +Clue, 013, -, -, -, Artifact - Clue, Zezhou Chen, {2}‚ Sacrifice this Artifact: Draw a card. +Clue, 014, -, -, -, Artifact - Clue, Cliff Childs, {2}‚ Sacrifice this Artifact: Draw a card. +Clue, 015, -, -, -, Artifact - Clue, James Paick, {2}‚ Sacrifice this Artifact: Draw a card. +Clue, 016, -, -, -, Artifact - Clue, Franz Vohwinkel, {2}‚ Sacrifice this Artifact: Draw a card. +Jace Emblem, 017, -, -, -, Emblem - Jace, Tyler Jacobson, Whenever an opponent casts his or her first spell each turn� counter that spell. +Arlinn Emblem, 018, -, -, -, Emblem - Arlinn, Winona Nelson, Creatures you control have haste and '{T}: This creature deals damage equal to its power to target creature or player.' diff --git a/Mage.Common/src/mage/view/CardsView.java b/Mage.Common/src/mage/view/CardsView.java index f36ba02d9b5..4d8518493d7 100644 --- a/Mage.Common/src/mage/view/CardsView.java +++ b/Mage.Common/src/mage/view/CardsView.java @@ -36,7 +36,6 @@ import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.Effect; import mage.cards.Card; -import mage.constants.CardType; import mage.constants.Zone; import mage.game.Game; import mage.game.GameState; @@ -112,19 +111,13 @@ public class CardsView extends LinkedHashMap { case COMMAND: sourceObject = game.getObject(ability.getSourceId()); if (sourceObject instanceof Emblem) { - Card planeswalkerCard = game.getCard(((Emblem) sourceObject).getSourceId()); - if (planeswalkerCard != null) { - if (!planeswalkerCard.getCardType().contains(CardType.PLANESWALKER)) { - if (planeswalkerCard.getSecondCardFace() != null) { - planeswalkerCard = planeswalkerCard.getSecondCardFace(); - } - } - abilityView = new AbilityView(ability, "Emblem " + planeswalkerCard.getName(), new CardView(new EmblemView((Emblem) sourceObject, planeswalkerCard))); - abilityView.setName("Emblem " + planeswalkerCard.getName()); - abilityView.setExpansionSetCode(planeswalkerCard.getExpansionSetCode()); - } else { - throw new IllegalArgumentException("Source card for emblem not found."); - } +// Card sourceCard = (Card) ((Emblem) sourceObject).getSourceObject(); +// if (sourceCard == null) { +// throw new IllegalArgumentException("Source card for emblem not found."); +// } + abilityView = new AbilityView(ability, sourceObject.getName(), new CardView(new EmblemView((Emblem) sourceObject))); + abilityView.setName(((Emblem) sourceObject).getName()); + // abilityView.setExpansionSetCode(sourceCard.getExpansionSetCode()); } break; } diff --git a/Mage.Common/src/mage/view/EmblemView.java b/Mage.Common/src/mage/view/EmblemView.java index 1681f05de90..807bd0c1f52 100644 --- a/Mage.Common/src/mage/view/EmblemView.java +++ b/Mage.Common/src/mage/view/EmblemView.java @@ -24,7 +24,7 @@ public class EmblemView implements CommandObjectView, Serializable { } else { expansionSetCode = emblem.getExpansionSetCodeForImage(); } - + rules = emblem.getAbilities().getRules(sourceCard.getName()); } diff --git a/Mage.Common/src/mage/view/GameView.java b/Mage.Common/src/mage/view/GameView.java index bc12e6cb692..5ee494809da 100644 --- a/Mage.Common/src/mage/view/GameView.java +++ b/Mage.Common/src/mage/view/GameView.java @@ -36,7 +36,6 @@ import java.util.UUID; import mage.MageObject; import mage.abilities.costs.Cost; import mage.cards.Card; -import mage.constants.CardType; import mage.constants.PhaseStep; import mage.constants.TurnPhase; import mage.constants.Zone; @@ -81,10 +80,10 @@ public class GameView implements Serializable { private final PhaseStep step; private final UUID activePlayerId; private String activePlayerName = ""; - private String priorityPlayerName = ""; + private String priorityPlayerName; private final int turn; private boolean special = false; - private final boolean isPlayer; + private final boolean isPlayer; // false = watching user private final int spellsCastCurrentTurn; private final boolean rollbackTurnsAllowed; @@ -127,20 +126,10 @@ public class GameView implements Serializable { stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, token.getName(), new CardView(token))); checkPaid(stackObject.getId(), (StackAbility) stackObject); } else if (object instanceof Emblem) { - Card sourceCard = game.getCard(((Emblem) object).getSourceId()); - CardView cardView; - if (sourceCard != null) { - if (!sourceCard.getCardType().contains(CardType.PLANESWALKER)) { - if (sourceCard.getSecondCardFace() != null) { - sourceCard = sourceCard.getSecondCardFace(); - } - } - ((StackAbility) stackObject).setName("Emblem " + sourceCard.getName()); - ((StackAbility) stackObject).setExpansionSetCode(sourceCard.getExpansionSetCode()); - cardView = new CardView(new EmblemView(((Emblem) object), sourceCard)); - } else { - cardView = new CardView(new EmblemView((Emblem) object)); - } + CardView cardView = new CardView(new EmblemView((Emblem) object)); + // Card sourceCard = (Card) ((Emblem) object).getSourceObject(); + ((StackAbility) stackObject).setName(((Emblem) object).getName()); + // ((StackAbility) stackObject).setExpansionSetCode(sourceCard.getExpansionSetCode()); stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, object.getName(), cardView)); checkPaid(stackObject.getId(), ((StackAbility) stackObject)); @@ -187,18 +176,22 @@ public class GameView implements Serializable { } else { this.activePlayerName = ""; } + Player priorityPlayer = null; if (state.getPriorityPlayerId() != null) { - this.priorityPlayerName = state.getPlayer(state.getPriorityPlayerId()).getName(); + priorityPlayer = state.getPlayer(state.getPriorityPlayerId()); + this.priorityPlayerName = priorityPlayer != null ? priorityPlayer.getName() : ""; } else { this.priorityPlayerName = ""; } for (CombatGroup combatGroup : state.getCombat().getGroups()) { combat.add(new CombatGroupView(combatGroup, game)); } - if (isPlayer) { - // has only to be set for active palyer with priority (e.g. pay mana by delve or Quenchable Fire special action) - if (createdForPlayer != null && createdForPlayerId != null && createdForPlayerId.equals(state.getPriorityPlayerId())) { - this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId(), createdForPlayer.isInPayManaMode()).size() > 0; + if (isPlayer) { // no watcher + // has only to be set for active player with priority (e.g. pay mana by delve or Quenchable Fire special action) + if (priorityPlayer != null && createdForPlayer != null && createdForPlayerId != null && createdForPlayer.isGameUnderControl() + && (createdForPlayerId.equals(priorityPlayer.getId()) // player controls the turn + || createdForPlayer.getPlayersUnderYourControl().contains(priorityPlayer.getId()))) { // player controls active players turn + this.special = state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).size() > 0; } } else { this.special = false; diff --git a/Mage.Common/src/mage/view/PlayerView.java b/Mage.Common/src/mage/view/PlayerView.java index 9627c470a5d..86f87c0a704 100644 --- a/Mage.Common/src/mage/view/PlayerView.java +++ b/Mage.Common/src/mage/view/PlayerView.java @@ -35,7 +35,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; import mage.cards.Card; -import mage.constants.CardType; import mage.counters.Counters; import mage.game.ExileZone; import mage.game.Game; @@ -139,17 +138,7 @@ public class PlayerView implements Serializable { if (commandObject instanceof Emblem) { Emblem emblem = (Emblem) commandObject; if (emblem.getControllerId().equals(this.playerId)) { - Card sourceCard = game.getCard(((CommandObject) emblem).getSourceId()); - if (sourceCard != null) { - if (!sourceCard.getCardType().contains(CardType.PLANESWALKER)) { - if (sourceCard.getSecondCardFace() != null) { - sourceCard = sourceCard.getSecondCardFace(); - } - } - commandList.add(new EmblemView(emblem, sourceCard)); - } else { - commandList.add(new EmblemView(emblem)); - } + commandList.add(new EmblemView(emblem)); } } else if (commandObject instanceof Commander) { Commander commander = (Commander) commandObject; diff --git a/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java b/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java index 1b41a76423b..e2181c83b2c 100644 --- a/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java +++ b/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java @@ -87,7 +87,8 @@ public class MomirDuel extends GameImpl { for (UUID playerId : state.getPlayerList(startingPlayerId)) { Player player = getPlayer(playerId); if (player != null) { - addEmblem(new MomirEmblem(), ability, playerId); + CardInfo cardInfo = CardRepository.instance.findCard("Momir Vig, Simic Visionary"); + addEmblem(new MomirEmblem(), cardInfo.getCard(), playerId); } } getState().addAbility(ability, null); @@ -122,8 +123,8 @@ public class MomirDuel extends GameImpl { class MomirEmblem extends Emblem { public MomirEmblem() { - setName("Momir Vig, Simic Visionary"); - //TODO: setExpansionSetCodeForImage(???); + setName("Emblem Momir Vig, Simic Visionary"); + setExpansionSetCodeForImage("DIS"); // {X}, Discard a card: Put a token into play as a copy of a random creature card with converted mana cost X. Play this ability only any time you could play a sorcery and only once each turn. LimitedTimesPerTurnActivatedAbility ability = new LimitedTimesPerTurnActivatedAbility(Zone.COMMAND, new MomirEffect(), new VariableManaCost()); ability.addCost(new DiscardCardCost()); diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index 57d9ff37537..06ed16d14d8 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -107,7 +107,7 @@ public class ChatManager { } private boolean containsSwearing(String message) { - if (message != null && message.toLowerCase().matches("^.*(anal|asshole|balls|bastard|bitch|blowjob|cock|crap|cunt|cum|damn|dick|dildo|douche|fag|fuck|idiot|moron|piss|prick|pussy|rape|rapist|sex|screw|shit|slut|vagina).*$")) { + if (message != null && message.toLowerCase().matches("^.*(anal|asshole|balls|bastard|bitch|blowjob|cock|crap|cunt|cum|damn|dick|dildo|douche|fag|fuck|idiot|moron|penis|piss|prick|pussy|rape|rapist|sex|screw|shit|slut|vagina).*$")) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/Aboroth.java b/Mage.Sets/src/mage/cards/a/Aboroth.java index fa27e6a3dd8..f1ccef6cbb1 100644 --- a/Mage.Sets/src/mage/cards/a/Aboroth.java +++ b/Mage.Sets/src/mage/cards/a/Aboroth.java @@ -1,96 +1,96 @@ -/* - * 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.cards.a; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.costs.Cost; -import mage.abilities.costs.CostImpl; -import mage.abilities.keyword.CumulativeUpkeepAbility; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; - -/** - * - * @author Styxo - */ -public class Aboroth extends CardImpl { - - public Aboroth(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); - - this.subtype.add("Elemental"); - this.power = new MageInt(9); - this.toughness = new MageInt(9); - - // Cumulative upkeep-Put a -1/-1 counter on Aboroth. - this.addAbility(new CumulativeUpkeepAbility(new AborothCost())); - } - - public Aboroth(final Aboroth card) { - super(card); - } - - @Override - public Aboroth copy() { - return new Aboroth(this); - } -} - -class AborothCost extends CostImpl { - - public AborothCost() { - this.text = "Put a -1/-1 counter on Aboroth"; - } - - @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(sourceId); - if (permanent != null) { - permanent.addCounters(CounterType.M1M1.createInstance(), game); - this.paid = true; - return true; - } - return false; - } - - @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return true; - } - - @Override - public AborothCost copy() { - return new AborothCost(); - } -} +/* + * 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.cards.a; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.CostImpl; +import mage.abilities.keyword.CumulativeUpkeepAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Styxo + */ +public class Aboroth extends CardImpl { + + public Aboroth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); + + this.subtype.add("Elemental"); + this.power = new MageInt(9); + this.toughness = new MageInt(9); + + // Cumulative upkeep-Put a -1/-1 counter on Aboroth. + this.addAbility(new CumulativeUpkeepAbility(new AborothCost())); + } + + public Aboroth(final Aboroth card) { + super(card); + } + + @Override + public Aboroth copy() { + return new Aboroth(this); + } +} + +class AborothCost extends CostImpl { + + public AborothCost() { + this.text = "Put a -1/-1 counter on Aboroth"; + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(sourceId); + if (permanent != null) { + permanent.addCounters(CounterType.M1M1.createInstance(), ability, game); + this.paid = true; + return true; + } + return false; + } + + @Override + public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + return true; + } + + @Override + public AborothCost copy() { + return new AborothCost(); + } +} diff --git a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java index b133f28691d..1f326963767 100644 --- a/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java +++ b/Mage.Sets/src/mage/cards/a/AetherbornMarauder.java @@ -119,7 +119,7 @@ class AetherbornMarauderEffect extends OneShotEffect { } if (numberToMove > 0) { fromPermanent.removeCounters(CounterType.P1P1.createInstance(numberToMove), game); - sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), game); + sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/a/AjaniSteadfast.java b/Mage.Sets/src/mage/cards/a/AjaniSteadfast.java index 2e665a43e95..23794e9046c 100644 --- a/Mage.Sets/src/mage/cards/a/AjaniSteadfast.java +++ b/Mage.Sets/src/mage/cards/a/AjaniSteadfast.java @@ -72,7 +72,7 @@ public class AjaniSteadfast extends CardImpl { } public AjaniSteadfast(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{W}"); this.subtype.add("Ajani"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -117,7 +117,7 @@ public class AjaniSteadfast extends CardImpl { class AjaniSteadfastEmblem extends Emblem { public AjaniSteadfastEmblem() { - setName("EMBLEM: Ajani Steadfast"); + setName("Emblem Ajani"); this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new AjaniSteadfastPreventEffect())); this.setExpansionSetCodeForImage("M15"); } diff --git a/Mage.Sets/src/mage/cards/a/AngelheartVial.java b/Mage.Sets/src/mage/cards/a/AngelheartVial.java index 8a0c9c80d01..b118f117a08 100644 --- a/Mage.Sets/src/mage/cards/a/AngelheartVial.java +++ b/Mage.Sets/src/mage/cards/a/AngelheartVial.java @@ -132,7 +132,7 @@ class AngelheartVialEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.addCounters(CounterType.CHARGE.createInstance((Integer) this.getValue("damageAmount")), game); + permanent.addCounters(CounterType.CHARGE.createInstance((Integer) this.getValue("damageAmount")), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/a/AnimationModule.java b/Mage.Sets/src/mage/cards/a/AnimationModule.java index 25df14a5af3..aec546a8a0b 100644 --- a/Mage.Sets/src/mage/cards/a/AnimationModule.java +++ b/Mage.Sets/src/mage/cards/a/AnimationModule.java @@ -147,7 +147,7 @@ class AnimationModuleEffect extends OneShotEffect { if (permanent.getCounters(game).size() == 1) { for (Counter counter : permanent.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName()); - permanent.addCounters(newCounter, game); + permanent.addCounters(newCounter, source, game); } } else { @@ -162,7 +162,7 @@ class AnimationModuleEffect extends OneShotEffect { for (Counter counter : permanent.getCounters(game).values()) { if (counter.getName().equals(choice.getChoice())) { Counter newCounter = new Counter(counter.getName()); - permanent.addCounters(newCounter, game); + permanent.addCounters(newCounter, source, game); break; } } diff --git a/Mage.Sets/src/mage/cards/a/Anthroplasm.java b/Mage.Sets/src/mage/cards/a/Anthroplasm.java index ebacf0a3c65..886ef47a3ae 100644 --- a/Mage.Sets/src/mage/cards/a/Anthroplasm.java +++ b/Mage.Sets/src/mage/cards/a/Anthroplasm.java @@ -101,7 +101,7 @@ class AnthroplasmEffect extends OneShotEffect { //Remove all +1/+1 counters permanent.removeCounters(permanent.getCounters(game).get(CounterType.P1P1.getName()), game); //put X +1/+1 counters - permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), game); + permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/a/ApocalypseHydra.java b/Mage.Sets/src/mage/cards/a/ApocalypseHydra.java index 51ea9d66d84..0c34f7fcff8 100644 --- a/Mage.Sets/src/mage/cards/a/ApocalypseHydra.java +++ b/Mage.Sets/src/mage/cards/a/ApocalypseHydra.java @@ -103,9 +103,9 @@ class ApocalypseHydraEffect extends OneShotEffect { int amount = spellAbility.getManaCostsToPay().getX(); if (amount > 0) { if (amount < 5) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } else { - permanent.addCounters(CounterType.P1P1.createInstance(amount * 2), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount * 2), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/a/ArbiterOfTheIdeal.java b/Mage.Sets/src/mage/cards/a/ArbiterOfTheIdeal.java index 606c62b0d0b..260d14a40c2 100644 --- a/Mage.Sets/src/mage/cards/a/ArbiterOfTheIdeal.java +++ b/Mage.Sets/src/mage/cards/a/ArbiterOfTheIdeal.java @@ -125,7 +125,7 @@ class ArbiterOfTheIdealEffect extends OneShotEffect { card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId()); Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { - permanent.addCounters(new Counter("Manifestation"), game); + permanent.addCounters(new Counter("Manifestation"), source, game); ContinuousEffect effect = new AddCardTypeTargetEffect(CardType.ENCHANTMENT, Duration.Custom); effect.setTargetPointer(new FixedTarget(permanent.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/a/ArlinnEmbracedByTheMoon.java b/Mage.Sets/src/mage/cards/a/ArlinnEmbracedByTheMoon.java index f900c462fbf..3f47888a3f0 100644 --- a/Mage.Sets/src/mage/cards/a/ArlinnEmbracedByTheMoon.java +++ b/Mage.Sets/src/mage/cards/a/ArlinnEmbracedByTheMoon.java @@ -63,7 +63,7 @@ public class ArlinnEmbracedByTheMoon extends CardImpl { private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control"); public ArlinnEmbracedByTheMoon(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},""); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, ""); this.subtype.add("Arlinn"); this.color.setRed(true); this.color.setGreen(true); @@ -105,7 +105,7 @@ class ArlinnEmbracedByTheMoonEmblem extends Emblem { // "Creatures you control have haste and '{T}: This creature deals damage equal to its power to target creature or player.'" public ArlinnEmbracedByTheMoonEmblem() { - this.setName("EMBLEM: Arlinn, Embraced by the Moon"); + this.setName("Emblem Arlinn"); FilterPermanent filter = new FilterControlledCreaturePermanent("Creatures"); GainAbilityControlledEffect effect = new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfGame, filter); effect.setText("Creatures you control have haste"); diff --git a/Mage.Sets/src/mage/cards/a/ArsenalThresher.java b/Mage.Sets/src/mage/cards/a/ArsenalThresher.java index 2aabfa47fee..e42500465a1 100644 --- a/Mage.Sets/src/mage/cards/a/ArsenalThresher.java +++ b/Mage.Sets/src/mage/cards/a/ArsenalThresher.java @@ -108,7 +108,7 @@ class ArsenalThresherEffect extends OneShotEffect { } if (arsenalThresher != null) { controller.revealCards(arsenalThresher.getIdName(), cards, game); - arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), game); + arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java index b58a764ec27..54ef0caba2f 100644 --- a/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java +++ b/Mage.Sets/src/mage/cards/a/AurraSingBaneOfJedi.java @@ -1,171 +1,171 @@ -/* - * 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.cards.a; - -import java.util.List; -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.LoyaltyAbility; -import mage.abilities.common.LeavesBattlefieldAllTriggeredAbility; -import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DamageControllerEffect; -import mage.abilities.effects.common.DamageTargetEffect; -import mage.abilities.effects.common.GetEmblemTargetPlayerEffect; -import mage.abilities.effects.common.SetPlayerLifeAllEffect; -import mage.abilities.effects.common.discard.DiscardControllerEffect; -import mage.abilities.effects.common.discard.DiscardHandAllEffect; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.TargetController; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.permanent.TokenPredicate; -import mage.game.Game; -import mage.game.command.Emblem; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.TargetPlayer; -import mage.target.common.TargetCreaturePermanent; - -/** - * - * @author Styxo - */ -public class AurraSingBaneOfJedi extends CardImpl { - - public AurraSingBaneOfJedi(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{R}"); - this.subtype.add("Aurra"); - - this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); - - // +1:You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you. - Ability ability = new LoyaltyAbility(new AurraSingBaneOfJediEffect(), +1); - ability.addTarget(new TargetCreaturePermanent()); - this.addAbility(ability); - - // -4:Target player gets an emblem wiht "Whenever a nontoken creature you control leave the battlefied, discard a card.". - ability = new LoyaltyAbility(new GetEmblemTargetPlayerEffect(new AurraSingBaneOfJediEmblem()), -4); - ability.addTarget(new TargetPlayer()); - this.addAbility(ability); - - // -6:Each player discards his or her hand and sacrificies all creatures he or she controls. Each player's life total becomes 1." - ability = new LoyaltyAbility(new DiscardHandAllEffect(), -6); - ability.addEffect(new SacrificeAllEffect()); - Effect effect = new SetPlayerLifeAllEffect(1, TargetController.ANY); - ability.addEffect(effect); - this.addAbility(ability); - } - - public AurraSingBaneOfJedi(final AurraSingBaneOfJedi card) { - super(card); - } - - @Override - public AurraSingBaneOfJedi copy() { - return new AurraSingBaneOfJedi(this); - } -} - -class AurraSingBaneOfJediEffect extends OneShotEffect { - - public AurraSingBaneOfJediEffect() { - super(Outcome.Damage); - staticText = "You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you"; - } - - public AurraSingBaneOfJediEffect(final AurraSingBaneOfJediEffect effect) { - super(effect); - } - - @Override - public AurraSingBaneOfJediEffect copy() { - return new AurraSingBaneOfJediEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + "?", source, game)) { - new DamageTargetEffect(2).apply(game, source); - } else { - new DamageControllerEffect(1).apply(game, source); - } - return true; - } - return false; - } -} - -class SacrificeAllEffect extends OneShotEffect { - - SacrificeAllEffect() { - super(Outcome.DestroyPermanent); - staticText = "and sacrificies all creatures he or she controls"; - } - - SacrificeAllEffect(final SacrificeAllEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - List permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getId(), game); - for (Permanent p : permanents) { - p.sacrifice(source.getSourceId(), game); - } - return true; - } - - @Override - public SacrificeAllEffect copy() { - return new SacrificeAllEffect(this); - } -} - -class AurraSingBaneOfJediEmblem extends Emblem { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a nontoken creature you control"); - - static { - filter.add(Predicates.not(new TokenPredicate())); - } - - // Whenever a nontoken creature you control leave the battlefied, discard a card." - public AurraSingBaneOfJediEmblem() { - this.setName("Emblem - Aurra"); - getAbilities().add(new LeavesBattlefieldAllTriggeredAbility(Zone.COMMAND, new DiscardControllerEffect(1), filter, false)); - } -} +/* + * 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.cards.a; + +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.LeavesBattlefieldAllTriggeredAbility; +import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageControllerEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.GetEmblemTargetPlayerEffect; +import mage.abilities.effects.common.SetPlayerLifeAllEffect; +import mage.abilities.effects.common.discard.DiscardControllerEffect; +import mage.abilities.effects.common.discard.DiscardHandAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.command.Emblem; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Styxo + */ +public class AurraSingBaneOfJedi extends CardImpl { + + public AurraSingBaneOfJedi(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{R}"); + this.subtype.add("Aurra"); + + this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); + + // +1:You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you. + Ability ability = new LoyaltyAbility(new AurraSingBaneOfJediEffect(), +1); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // -4:Target player gets an emblem wiht "Whenever a nontoken creature you control leave the battlefied, discard a card.". + ability = new LoyaltyAbility(new GetEmblemTargetPlayerEffect(new AurraSingBaneOfJediEmblem()), -4); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + + // -6:Each player discards his or her hand and sacrificies all creatures he or she controls. Each player's life total becomes 1." + ability = new LoyaltyAbility(new DiscardHandAllEffect(), -6); + ability.addEffect(new SacrificeAllEffect()); + Effect effect = new SetPlayerLifeAllEffect(1, TargetController.ANY); + ability.addEffect(effect); + this.addAbility(ability); + } + + public AurraSingBaneOfJedi(final AurraSingBaneOfJedi card) { + super(card); + } + + @Override + public AurraSingBaneOfJedi copy() { + return new AurraSingBaneOfJedi(this); + } +} + +class AurraSingBaneOfJediEffect extends OneShotEffect { + + public AurraSingBaneOfJediEffect() { + super(Outcome.Damage); + staticText = "You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you"; + } + + public AurraSingBaneOfJediEffect(final AurraSingBaneOfJediEffect effect) { + super(effect); + } + + @Override + public AurraSingBaneOfJediEffect copy() { + return new AurraSingBaneOfJediEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (controller.chooseUse(outcome, "Deal 2 damage to " + game.getPermanent(getTargetPointer().getFirst(game, source)).getName() + "?", source, game)) { + new DamageTargetEffect(2).apply(game, source); + } else { + new DamageControllerEffect(1).apply(game, source); + } + return true; + } + return false; + } +} + +class SacrificeAllEffect extends OneShotEffect { + + SacrificeAllEffect() { + super(Outcome.DestroyPermanent); + staticText = "and sacrificies all creatures he or she controls"; + } + + SacrificeAllEffect(final SacrificeAllEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + List permanents = game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getId(), game); + for (Permanent p : permanents) { + p.sacrifice(source.getSourceId(), game); + } + return true; + } + + @Override + public SacrificeAllEffect copy() { + return new SacrificeAllEffect(this); + } +} + +class AurraSingBaneOfJediEmblem extends Emblem { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a nontoken creature you control"); + + static { + filter.add(Predicates.not(new TokenPredicate())); + } + + // Whenever a nontoken creature you control leave the battlefied, discard a card." + public AurraSingBaneOfJediEmblem() { + this.setName("Emblem Aurra Sing, Bane of Jedi"); + getAbilities().add(new LeavesBattlefieldAllTriggeredAbility(Zone.COMMAND, new DiscardControllerEffect(1), filter, false)); + } +} diff --git a/Mage.Sets/src/mage/cards/a/AzorsElocutors.java b/Mage.Sets/src/mage/cards/a/AzorsElocutors.java index c987aac8c3a..2c40818eaf8 100644 --- a/Mage.Sets/src/mage/cards/a/AzorsElocutors.java +++ b/Mage.Sets/src/mage/cards/a/AzorsElocutors.java @@ -127,7 +127,7 @@ class AzorsElocutorsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.addCounters(new Counter("filibuster"), game); + permanent.addCounters(new Counter("filibuster"), source, game); if (permanent.getCounters(game).getCount("filibuster") > 4) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { diff --git a/Mage.Sets/src/mage/cards/b/BecomeImmense.java b/Mage.Sets/src/mage/cards/b/BecomeImmense.java index 5a6c8347a63..3f60e9f9628 100644 --- a/Mage.Sets/src/mage/cards/b/BecomeImmense.java +++ b/Mage.Sets/src/mage/cards/b/BecomeImmense.java @@ -43,13 +43,12 @@ import mage.target.common.TargetCreaturePermanent; public class BecomeImmense extends CardImpl { public BecomeImmense(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{5}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{G}"); - - // Delve + // Delve (Each card you exile from your graveyard while casting this spell pays for {1}.) this.addAbility(new DelveAbility()); // Target creature gets +6/+6 until end of turn - this.getSpellAbility().addEffect(new BoostTargetEffect(6,6,Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new BoostTargetEffect(6, 6, Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage.Sets/src/mage/cards/b/Bioshift.java b/Mage.Sets/src/mage/cards/b/Bioshift.java index 764a3b8b11f..70ef879b1ff 100644 --- a/Mage.Sets/src/mage/cards/b/Bioshift.java +++ b/Mage.Sets/src/mage/cards/b/Bioshift.java @@ -117,7 +117,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { int amountToMove = controller.getAmount(0, amountCounters, "How many counters do you want to move?", game); if (amountToMove > 0) { fromPermanent.removeCounters(CounterType.P1P1.createInstance(amountToMove), game); - toPermanent.addCounters(CounterType.P1P1.createInstance(amountToMove), game); + toPermanent.addCounters(CounterType.P1P1.createInstance(amountToMove), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BlackSunsZenith.java b/Mage.Sets/src/mage/cards/b/BlackSunsZenith.java index 6f58173e48c..4208641b3a2 100644 --- a/Mage.Sets/src/mage/cards/b/BlackSunsZenith.java +++ b/Mage.Sets/src/mage/cards/b/BlackSunsZenith.java @@ -81,7 +81,7 @@ class BlackSunsZenithEffect extends OneShotEffect { int amount = source.getManaCostsToPay().getX(); for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { - permanent.addCounters(CounterType.M1M1.createInstance(amount), game); + permanent.addCounters(CounterType.M1M1.createInstance(amount), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/b/BladeOfTheBloodchief.java b/Mage.Sets/src/mage/cards/b/BladeOfTheBloodchief.java index 624d296b9bc..8d0d3b24980 100644 --- a/Mage.Sets/src/mage/cards/b/BladeOfTheBloodchief.java +++ b/Mage.Sets/src/mage/cards/b/BladeOfTheBloodchief.java @@ -130,9 +130,9 @@ class BladeOfTheBloodchiefEffect extends OneShotEffect { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); if (creature != null) { if (creature.hasSubtype("Vampire", game)) { - creature.addCounters(CounterType.P1P1.createInstance(2), game); + creature.addCounters(CounterType.P1P1.createInstance(2), source, game); } else { - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/b/BloodTyrant.java b/Mage.Sets/src/mage/cards/b/BloodTyrant.java index 624f4195d6c..effe6402bf9 100644 --- a/Mage.Sets/src/mage/cards/b/BloodTyrant.java +++ b/Mage.Sets/src/mage/cards/b/BloodTyrant.java @@ -148,7 +148,7 @@ class BloodTyrantEffect extends OneShotEffect { } Permanent bloodTyrant = game.getPermanent(source.getSourceId()); if (bloodTyrant != null && counters > 0) { - bloodTyrant.addCounters(CounterType.P1P1.createInstance(counters), game); + bloodTyrant.addCounters(CounterType.P1P1.createInstance(counters), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java b/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java index 04878a3ceb5..51a89786fd3 100644 --- a/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java +++ b/Mage.Sets/src/mage/cards/b/BloodsporeThrinax.java @@ -107,7 +107,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl { if (sourceCreature != null && creature != null) { int amount = sourceCreature.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { - creature.addCounters(CounterType.P1P1.createInstance(amount), game); + creature.addCounters(CounterType.P1P1.createInstance(amount), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/b/BlowflyInfestation.java b/Mage.Sets/src/mage/cards/b/BlowflyInfestation.java index 78cf0a3a4df..ae4980f72cd 100644 --- a/Mage.Sets/src/mage/cards/b/BlowflyInfestation.java +++ b/Mage.Sets/src/mage/cards/b/BlowflyInfestation.java @@ -111,7 +111,7 @@ class BlowflyInfestationEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { - creature.addCounters(CounterType.M1M1.createInstance(), game); + creature.addCounters(CounterType.M1M1.createInstance(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/b/BombSquad.java b/Mage.Sets/src/mage/cards/b/BombSquad.java index 330b313a708..6e9784a89c3 100644 --- a/Mage.Sets/src/mage/cards/b/BombSquad.java +++ b/Mage.Sets/src/mage/cards/b/BombSquad.java @@ -201,7 +201,7 @@ class BombSquadBeginningEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getSourceId()); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { - permanent.addCounters(CounterType.FUSE.createInstance(), game); + permanent.addCounters(CounterType.FUSE.createInstance(), source, game); game.informPlayers(new StringBuilder(card.getName()).append(" puts a fuse counter on ").append(permanent.getName()).toString()); } diff --git a/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java b/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java index 00f7cba2171..f111acdb0a9 100644 --- a/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java +++ b/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java @@ -119,7 +119,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/c/CankerAbomination.java b/Mage.Sets/src/mage/cards/c/CankerAbomination.java index a2e2e610f27..08b82a72916 100644 --- a/Mage.Sets/src/mage/cards/c/CankerAbomination.java +++ b/Mage.Sets/src/mage/cards/c/CankerAbomination.java @@ -103,7 +103,7 @@ class CankerAbominationEffect extends OneShotEffect { game.informPlayers(cankerAbomination.getName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName()); int amount = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), opponent.getId(), game).size(); if (amount > 0) { - cankerAbomination.addCounters(CounterType.M1M1.createInstance(amount), game); + cankerAbomination.addCounters(CounterType.M1M1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/Cannibalize.java b/Mage.Sets/src/mage/cards/c/Cannibalize.java index 0e5a1fe0997..8ec6596b608 100644 --- a/Mage.Sets/src/mage/cards/c/Cannibalize.java +++ b/Mage.Sets/src/mage/cards/c/Cannibalize.java @@ -100,7 +100,7 @@ class CannibalizeEffect extends OneShotEffect { controller.moveCardToExileWithInfo(creature, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); exileDone = true; } else { - creature.addCounters(CounterType.P1P1.createInstance(2), game); + creature.addCounters(CounterType.P1P1.createInstance(2), source, game); game.informPlayers("Added two +1/+1 counters on " + creature.getLogName()); } count++; diff --git a/Mage.Sets/src/mage/cards/c/CarnifexDemon.java b/Mage.Sets/src/mage/cards/c/CarnifexDemon.java index 1174e92e8d4..988d798c4f3 100644 --- a/Mage.Sets/src/mage/cards/c/CarnifexDemon.java +++ b/Mage.Sets/src/mage/cards/c/CarnifexDemon.java @@ -93,7 +93,7 @@ class CarnifexDemonEffect extends OneShotEffect { if (p != null) { for (Permanent t : game.getBattlefield().getAllActivePermanents()) { if (t.getCardType().contains(CardType.CREATURE) && !t.getId().equals(source.getSourceId())) - t.addCounters(CounterType.M1M1.createInstance(), game); + t.addCounters(CounterType.M1M1.createInstance(), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java b/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java index fe25c84c28f..82b9def82df 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java +++ b/Mage.Sets/src/mage/cards/c/ChandraRoaringFlame.java @@ -56,7 +56,7 @@ import mage.target.common.TargetCreaturePermanent; public class ChandraRoaringFlame extends CardImpl { public ChandraRoaringFlame(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},""); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, ""); this.subtype.add("Chandra"); this.color.setRed(true); @@ -120,7 +120,7 @@ class ChandraRoaringFlameEmblemEffect extends OneShotEffect { } } for (Player opponent : opponentsEmblem) { - game.addEmblem(new ChandraRoaringFlameEmblem(), source, opponent.getId()); + game.addEmblem(new ChandraRoaringFlameEmblem(), source.getSourceObject(game), opponent.getId()); } } return false; @@ -134,7 +134,8 @@ class ChandraRoaringFlameEmblemEffect extends OneShotEffect { class ChandraRoaringFlameEmblem extends Emblem { public ChandraRoaringFlameEmblem() { - setName("EMBLEM: Chandra, Roaring Flame"); + setName("Emblem Chandra"); + setExpansionSetCodeForImage("ORI"); Effect effect = new DamageTargetEffect(3); effect.setText("this emblem deals 3 damage to you"); this.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND, effect, TargetController.YOU, false, true)); diff --git a/Mage.Sets/src/mage/cards/c/ChandraTorchOfDefiance.java b/Mage.Sets/src/mage/cards/c/ChandraTorchOfDefiance.java index 2f1a1f0d077..36d0bc9a566 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraTorchOfDefiance.java +++ b/Mage.Sets/src/mage/cards/c/ChandraTorchOfDefiance.java @@ -63,7 +63,7 @@ import mage.target.common.TargetCreaturePermanent; public class ChandraTorchOfDefiance extends CardImpl { public ChandraTorchOfDefiance(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{R}{R}"); this.subtype.add("Chandra"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -142,7 +142,7 @@ class ChandraTorchOfDefianceEmblem extends Emblem { // You get an emblem with "Whenever you cast a spell, this emblem deals 5 damage to target creature or player." public ChandraTorchOfDefianceEmblem() { - this.setName("Emblem - Chandra, Torch of Defiance"); + this.setName("Emblem Chandra"); Effect effect = new DamageTargetEffect(5); effect.setText("this emblem deals 5 damage to target creature or player"); Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, new FilterSpell("a spell"), false, false); diff --git a/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java b/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java index 50f5e6b82cc..3b83b66ce6c 100644 --- a/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java +++ b/Mage.Sets/src/mage/cards/c/ChargingCinderhorn.java @@ -121,7 +121,7 @@ class ChargingCinderhornDamageTargetEffect extends OneShotEffect{ public boolean apply(Game game, Ability source) { Permanent chargingCinderhoof = game.getPermanent(source.getSourceId()); if (chargingCinderhoof != null) { - chargingCinderhoof.addCounters(CounterType.FURY.createInstance(), game); + chargingCinderhoof.addCounters(CounterType.FURY.createInstance(), source, game); } else { chargingCinderhoof = game.getPermanentOrLKIBattlefield(source.getSourceId()); } diff --git a/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java b/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java index 06e57ba5dfc..c08a79536b4 100644 --- a/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java +++ b/Mage.Sets/src/mage/cards/c/ChorusOfTheConclave.java @@ -200,7 +200,7 @@ class ChorusOfTheConclaveReplacementEffect2 extends ReplacementEffectImpl { String key = event.getSourceId().toString() + (game.getState().getZoneChangeCounter(event.getSourceId()) - 1); int xValue = spellX.get(key); if (xValue > 0) { - creature.addCounters(CounterType.P1P1.createInstance(xValue), game); + creature.addCounters(CounterType.P1P1.createInstance(xValue), source, game); game.informPlayers(sourceObject.getLogName() + ": " + creature.getLogName() + " enters the battlefield with " + xValue + " +1/+1 counter" + (xValue > 1 ? "s" : "") + " on it"); } spellX.remove(key); diff --git a/Mage.Sets/src/mage/cards/c/CollectiveEffort.java b/Mage.Sets/src/mage/cards/c/CollectiveEffort.java index b148fd8847f..8df3f87cde7 100644 --- a/Mage.Sets/src/mage/cards/c/CollectiveEffort.java +++ b/Mage.Sets/src/mage/cards/c/CollectiveEffort.java @@ -131,7 +131,7 @@ class CollectiveEffortEffect extends OneShotEffect { Player target = game.getPlayer(source.getFirstTarget()); if (target != null) { for (Permanent p : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), target.getId(), game)) { - p.addCounters(CounterType.P1P1.createInstance(), game); + p.addCounters(CounterType.P1P1.createInstance(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CommonBond.java b/Mage.Sets/src/mage/cards/c/CommonBond.java index 96f3ac7a27e..bbb2f1887f5 100644 --- a/Mage.Sets/src/mage/cards/c/CommonBond.java +++ b/Mage.Sets/src/mage/cards/c/CommonBond.java @@ -84,12 +84,12 @@ class CommonBondEffect extends OneShotEffect { int affectedTargets = 0; Permanent permanent = game.getPermanent(source.getTargets().get(0).getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(1), game); + permanent.addCounters(CounterType.P1P1.createInstance(1), source, game); affectedTargets ++; } permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(1), game); + permanent.addCounters(CounterType.P1P1.createInstance(1), source, game); affectedTargets ++; } return affectedTargets > 0; diff --git a/Mage.Sets/src/mage/cards/c/ContagionEngine.java b/Mage.Sets/src/mage/cards/c/ContagionEngine.java index 22a5d4e7e10..a87d50e3f44 100644 --- a/Mage.Sets/src/mage/cards/c/ContagionEngine.java +++ b/Mage.Sets/src/mage/cards/c/ContagionEngine.java @@ -96,7 +96,7 @@ class ContagionEngineEffect extends OneShotEffect { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), targetPlayer.getId(), game)) { - creature.addCounters(CounterType.M1M1.createInstance(), game); + creature.addCounters(CounterType.M1M1.createInstance(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CradleOfVitality.java b/Mage.Sets/src/mage/cards/c/CradleOfVitality.java index bf359ed8330..2343978634a 100644 --- a/Mage.Sets/src/mage/cards/c/CradleOfVitality.java +++ b/Mage.Sets/src/mage/cards/c/CradleOfVitality.java @@ -129,7 +129,7 @@ class CradleOfVitalityEffect extends OneShotEffect { Integer amount = (Integer) getValue("amount"); for (UUID uuid : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(uuid); - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); affectedTargets ++; } return affectedTargets > 0; diff --git a/Mage.Sets/src/mage/cards/c/CryptbornHorror.java b/Mage.Sets/src/mage/cards/c/CryptbornHorror.java index b2e4c21d088..24be98a363c 100644 --- a/Mage.Sets/src/mage/cards/c/CryptbornHorror.java +++ b/Mage.Sets/src/mage/cards/c/CryptbornHorror.java @@ -91,7 +91,7 @@ class CryptbornHorrorEffect extends OneShotEffect { if (permanent != null) { int oll = new OpponentsLostLifeCount().calculate(game, source, this); if (oll > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(oll), game); + permanent.addCounters(CounterType.P1P1.createInstance(oll), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java index 65d67df7184..38a2568b0c5 100644 --- a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java +++ b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java @@ -29,24 +29,19 @@ package mage.cards.c; import java.util.HashMap; import java.util.HashSet; -import java.util.List; -import java.util.Map; import java.util.Set; import java.util.UUID; -import mage.MageObject; import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility; -import mage.abilities.condition.Condition; +import mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility; import mage.abilities.condition.common.IsStepCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalActivatedAbility; -import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.RemoveAllCountersTargetEffect; @@ -62,17 +57,15 @@ import mage.constants.WatcherScope; import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.filter.predicate.permanent.CounterPredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetLandPermanent; import mage.target.targetpointer.FixedTarget; -import mage.util.CardUtil; import mage.watchers.Watcher; /** @@ -80,9 +73,9 @@ import mage.watchers.Watcher; * @author MTGfan */ public class CyclopeanTomb extends CardImpl { - + private static final FilterLandPermanent filter = new FilterLandPermanent(); - + static { filter.add(Predicates.not(new SubtypePredicate("Swamp"))); } @@ -97,9 +90,7 @@ public class CyclopeanTomb extends CardImpl { ability.addEffect(new BecomeSwampEffect(Duration.Custom, false, true, "Swamp")); this.addAbility(ability, new CyclopeanTombCounterWatcher()); // When Cyclopean Tomb is put into a graveyard from the battlefield, at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with Cyclopean Tomb but that a mire counter has not been removed from with Cyclopean Tomb. - Effect effect = new CreateDelayedTriggeredAbilityEffect(new CyclopeanTombDelayedTriggeredAbility()); - effect.setText("at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}."); - this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(effect)); + this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new CyclopeanTombCreateTriggeredEffect())); } public CyclopeanTomb(final CyclopeanTomb card) { @@ -113,16 +104,16 @@ public class CyclopeanTomb extends CardImpl { } class BecomeSwampEffect extends BecomesBasicLandTargetEffect { - + public BecomeSwampEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) { super(duration, chooseLandType, loseOther, landNames); - staticText = "That land is a Swamp for as long as it has a mire counter on it."; + staticText = "That land is a Swamp for as long as it has a mire counter on it"; } - + public BecomeSwampEffect(final BecomeSwampEffect effect) { super(effect); } - + @Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); @@ -135,36 +126,42 @@ class BecomeSwampEffect extends BecomesBasicLandTargetEffect { } return true; } - + @Override public BecomeSwampEffect copy() { return new BecomeSwampEffect(this); } } -class CyclopeanTombDelayedTriggeredAbility extends DelayedTriggeredAbility { +class CyclopeanTombCreateTriggeredEffect extends OneShotEffect { - CyclopeanTombDelayedTriggeredAbility() { - super(new CyclopeanTombEffect(), Duration.OneUse, true, false); + public CyclopeanTombCreateTriggeredEffect() { + super(Outcome.Benefit); + this.staticText = "At the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}"; } - CyclopeanTombDelayedTriggeredAbility(CyclopeanTombDelayedTriggeredAbility ability) { - super(ability); + public CyclopeanTombCreateTriggeredEffect(final CyclopeanTombCreateTriggeredEffect effect) { + super(effect); } @Override - public CyclopeanTombDelayedTriggeredAbility copy() { - return new CyclopeanTombDelayedTriggeredAbility(this); + public CyclopeanTombCreateTriggeredEffect copy() { + return new CyclopeanTombCreateTriggeredEffect(this); } @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - return event.getPlayerId().equals(this.controllerId); + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Permanent tomb = game.getPermanentOrLKIBattlefield(source.getSourceId()); // we need to set the correct source object + DelayedTriggeredAbility ability = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(new CyclopeanTombEffect(), Duration.EndOfGame, false); + ability.setSourceObject(tomb, game); + ability.setControllerId(source.getControllerId()); + ability.setSourceId(source.getSourceId()); + game.addDelayedTriggeredAbility(ability); + return true; + } + return false; } } @@ -172,9 +169,9 @@ class CyclopeanTombEffect extends OneShotEffect { public CyclopeanTombEffect() { super(Outcome.Benefit); - this.staticText = "at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}."; + this.staticText = "At the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with {this} but that a mire counter has not been removed from with {this}"; } - + public CyclopeanTombEffect(final CyclopeanTombEffect effect) { super(effect); } @@ -187,121 +184,52 @@ class CyclopeanTombEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if(controller != null){ - new ChooseLandEffect().apply(game, source); - Effect effect = new RemoveAllCountersTargetEffect(CounterType.MIRE); - effect.setTargetPointer(new FixedTarget((UUID) game.getState().getValue(source.getSourceId().toString() + "_land"))); - effect.apply(game, source); - //CyclopianTombEffect and CyclopeanTombDelayedTriggeredAbility will maintain a loop - //as long as there are one or more mire counters left to be removed - new ConditionalOneShotEffect(new CreateDelayedTriggeredAbilityEffect(new CyclopeanTombDelayedTriggeredAbility(), false), new CyclopeanTombCounterCondition()).apply(game, source); - return true; - } - return false; - } -} - -class CyclopeanTombCounterCondition implements Condition { - - private static final FilterLandPermanent mireFilter = new FilterLandPermanent(); - - static { - mireFilter.add(new CounterPredicate(CounterType.MIRE)); - } - - public CyclopeanTombCounterCondition() { - } - - @Override - public boolean apply(Game game, Ability source) { - - List permanents = game.getBattlefield().getAllActivePermanents(mireFilter, game); - Permanent cyclopeanTombInstance = game.getPermanentOrLKIBattlefield(source.getSourceId()); + MageObjectReference mor = new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game); CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getName()); - - for(Permanent land : permanents) { - if(watcher.landMiredByCyclopeanTombInstance(land, cyclopeanTombInstance, game)) { - return land.getCounters(game).getCount(CounterType.MIRE) > 0; + if (controller != null && watcher != null) { + + Set landRef = watcher.landMiredByCyclopeanTombInstance(mor, game); + if (landRef == null || landRef.isEmpty()) { // no lands got mire counter from that instance + return true; } - } - return false; - } -} - -class ChooseLandEffect extends OneShotEffect { - - public ChooseLandEffect() { - super(Outcome.Neutral); - this.staticText = "choose a land that a mire counter was put onto with Cyclopean Tomb but that a mire counter has not been removed from with Cyclopean Tomb"; - } - - public ChooseLandEffect(final ChooseLandEffect effect) { - super(effect); - } - - @Override - public ChooseLandEffect copy() { - return new ChooseLandEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - - Player controller = game.getPlayer(source.getControllerId()); - MageObject mageObject = game.getPermanentEntering(source.getSourceId()); - - if (mageObject == null) { - mageObject = game.getObject(source.getSourceId()); - } - - FilterLandPermanent filter = new FilterLandPermanent(); - filter.add(new LandIdPredicate(source)); - - if(controller != null && mageObject != null){ + FilterLandPermanent filter = new FilterLandPermanent("a land with a mire counter added from the Cyclopean Tomb instance (" + landRef.size() + " left)"); + Set idPref = new HashSet<>(); + for (MageObjectReference ref : landRef) { + Permanent land = ref.getPermanent(game); + if (land != null) { + idPref.add(new PermanentIdPredicate(land.getId())); + } + } + filter.add(Predicates.or(idPref)); TargetLandPermanent target = new TargetLandPermanent(1, 1, filter, true); /*Player must choose a land each upkeep. Using the message are above the player hand where frequent interactions * take place is the most logical way to prompt for this scenario. A new constructor added to provide a not optional * option for any cards like this where the player must choose a target in such the way this card requires. - */ - if (controller.chooseTarget(Outcome.Neutral, target, source, game, false)) { + */ + if (controller.chooseTarget(Outcome.Neutral, target, source, game)) { Permanent chosenLand = game.getPermanent(target.getFirstTarget()); - if(chosenLand != null) { - game.getState().setValue(mageObject.getId() + "_land", target.getFirstTarget()); - if (mageObject instanceof Permanent) { - ((Permanent) mageObject).addInfo("chosen land", CardUtil.addToolTipMarkTags("Chosen player: " + chosenLand.getLogName()), game); - } - return true; + if (chosenLand != null) { + Effect effect = new RemoveAllCountersTargetEffect(CounterType.MIRE); + effect.setTargetPointer(new FixedTarget(chosenLand, game)); + effect.apply(game, source); + landRef.remove(new MageObjectReference(chosenLand, game)); } } + + return true; } return false; } } -class LandIdPredicate implements Predicate { - - public Ability source; - - public LandIdPredicate(Ability source) { - this.source = source; - } - - @Override - public boolean apply(Permanent input, Game game) { - Permanent cyclopeanTombInstance = game.getPermanentOrLKIBattlefield(source.getSourceId()); - CyclopeanTombCounterWatcher watcher = (CyclopeanTombCounterWatcher) game.getState().getWatchers().get(CyclopeanTombCounterWatcher.class.getName()); - return watcher.landMiredByCyclopeanTombInstance(input, cyclopeanTombInstance, game); - } -} - class CyclopeanTombCounterWatcher extends Watcher { - + public HashMap> counterData = new HashMap<>(); - + public CyclopeanTombCounterWatcher() { super(CyclopeanTombCounterWatcher.class.getName(), WatcherScope.GAME); } - + public CyclopeanTombCounterWatcher(final CyclopeanTombCounterWatcher watcher) { super(watcher); for (MageObjectReference mageObjectReference : watcher.counterData.keySet()) { @@ -310,7 +238,7 @@ class CyclopeanTombCounterWatcher extends Watcher { counterData.put(mageObjectReference, miredLands); } } - + @Override public CyclopeanTombCounterWatcher copy() { return new CyclopeanTombCounterWatcher(this); @@ -318,27 +246,32 @@ class CyclopeanTombCounterWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.COUNTER_ADDED || event.getType() == GameEvent.EventType.COUNTERS_ADDED) { - MageObjectReference cylopeanTombInstance = new MageObjectReference(/*ID needs to go here*/, game); - Set miredLands = counterData.get(cylopeanTombInstance); - if (miredLands != null) { + if (event.getType() == GameEvent.EventType.COUNTERS_ADDED && event.getData().equals(CounterType.MIRE.getName()) && event.getAmount() > 0) { + Permanent tomb = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (tomb != null) { + MageObjectReference cylopeanTombInstance = new MageObjectReference(tomb, game); + Set miredLands; + if (counterData.containsKey(cylopeanTombInstance)) { + miredLands = counterData.get(cylopeanTombInstance); + } else { + miredLands = new HashSet<>(); + counterData.put(cylopeanTombInstance, miredLands); + } miredLands.add(new MageObjectReference(event.getTargetId(), game)); - } else { - miredLands = new HashSet<>(); - miredLands.add(new MageObjectReference(event.getTargetId(), game)); - counterData.put(cylopeanTombInstance, miredLands); } + } } - + @Override public void reset() { super.reset(); - counterData.clear(); } - public boolean landMiredByCyclopeanTombInstance(Permanent land, Permanent cylopeanTombInstance, Game game) { - Set miredLands = counterData.get(new MageObjectReference(cylopeanTombInstance, game)); - return miredLands != null && miredLands.contains(new MageObjectReference(land, game)); + public Set landMiredByCyclopeanTombInstance(MageObjectReference mor, Game game) { + if (counterData.containsKey(mor)) { + return counterData.get(mor); + } + return null; } } diff --git a/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java b/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java index ec2f756f22f..f4414962077 100644 --- a/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java +++ b/Mage.Sets/src/mage/cards/c/CytoplastRootKin.java @@ -115,7 +115,7 @@ class CytoplastRootKinEffect extends OneShotEffect { && !sourcePermanent.getId().equals(targetPermanent.getId()) && targetPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { targetPermanent.removeCounters(CounterType.P1P1.createInstance(), game); - sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/DackFayden.java b/Mage.Sets/src/mage/cards/d/DackFayden.java index 1e034e1a7ad..42c2af272a6 100644 --- a/Mage.Sets/src/mage/cards/d/DackFayden.java +++ b/Mage.Sets/src/mage/cards/d/DackFayden.java @@ -67,7 +67,7 @@ import mage.target.common.TargetArtifactPermanent; public class DackFayden extends CardImpl { public DackFayden(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{1}{U}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{U}{R}"); this.subtype.add("Dack"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); @@ -107,7 +107,7 @@ public class DackFayden extends CardImpl { class DackFaydenEmblem extends Emblem { DackFaydenEmblem() { - this.setName("EMBLEM: Dack Fayden"); + this.setName("Emblem Dack"); this.getAbilities().add(new DackFaydenEmblemTriggeredAbility()); } } diff --git a/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java b/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java index 6f4b22641d2..ff830a1e69b 100644 --- a/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java +++ b/Mage.Sets/src/mage/cards/d/DaghatarTheAdamant.java @@ -114,7 +114,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (toPermanent != null) { fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game); - toPermanent.addCounters(CounterType.P1P1.createInstance(), game); + toPermanent.addCounters(CounterType.P1P1.createInstance(), source, game); game.informPlayers(sourceObject.getLogName() + ": Moved a +1/+1 counter from " + fromPermanent.getLogName() +" to " + toPermanent.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java b/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java index bf94a11a65a..ef03ad53ff1 100644 --- a/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java +++ b/Mage.Sets/src/mage/cards/d/DarettiScrapSavant.java @@ -68,7 +68,7 @@ import mage.target.targetpointer.FixedTarget; public class DarettiScrapSavant extends CardImpl { public DarettiScrapSavant(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{R}"); this.subtype.add("Daretti"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); @@ -176,7 +176,6 @@ class DarettiScrapSavantEmblem extends Emblem { // You get an emblem with "Whenever an artifact is put into your graveyard from the battlefield, return that card to the battlefield at the beginning of the next end step." public DarettiScrapSavantEmblem() { - this.setName("Emblem - Daretti"); this.getAbilities().add(new DarettiScrapSavantTriggeredAbility()); } } diff --git a/Mage.Sets/src/mage/cards/d/DarkIntimations.java b/Mage.Sets/src/mage/cards/d/DarkIntimations.java index 66a16f93fe9..4b9e9da87f2 100644 --- a/Mage.Sets/src/mage/cards/d/DarkIntimations.java +++ b/Mage.Sets/src/mage/cards/d/DarkIntimations.java @@ -232,7 +232,7 @@ class DarkIntimationsReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { - creature.addCounters(CounterType.LOYALTY.createInstance(), game); + creature.addCounters(CounterType.LOYALTY.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/DearlyDeparted.java b/Mage.Sets/src/mage/cards/d/DearlyDeparted.java index 3e23f61bee5..802c1caed25 100644 --- a/Mage.Sets/src/mage/cards/d/DearlyDeparted.java +++ b/Mage.Sets/src/mage/cards/d/DearlyDeparted.java @@ -103,7 +103,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { - target.addCounters(CounterType.P1P1.createInstance(), game); + target.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java b/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java index 2b00b17fe9e..e0533acbce8 100644 --- a/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java +++ b/Mage.Sets/src/mage/cards/d/DebtToTheDeathless.java @@ -28,13 +28,14 @@ package mage.cards.d; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; import mage.game.Game; +import mage.players.Player; /** * @@ -43,13 +44,10 @@ import mage.game.Game; public class DebtToTheDeathless extends CardImpl { public DebtToTheDeathless(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{W}{W}{B}{B}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{W}{W}{B}{B}"); // Each opponent loses two times X life. You gain life equal to the life lost this way. this.getSpellAbility().addEffect(new DebtToTheDeathlessEffect()); - - } public DebtToTheDeathless(final DebtToTheDeathless card) { @@ -80,12 +78,19 @@ class DebtToTheDeathlessEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int damage = 0; - int xValue = source.getManaCostsToPay().getX(); - for (UUID opponentId: game.getOpponents(source.getControllerId())) { - damage += game.getPlayer(opponentId).damage(xValue * 2, source.getSourceId(), game, false, true); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int lifeLost = 0; + int xValue = source.getManaCostsToPay().getX(); + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + lifeLost += opponent.loseLife(xValue * 2, game, false); + } + } + controller.gainLife(lifeLost, game); + return true; } - game.getPlayer(source.getControllerId()).gainLife(damage, game); - return true; + return false; } } diff --git a/Mage.Sets/src/mage/cards/d/DeepglowSkate.java b/Mage.Sets/src/mage/cards/d/DeepglowSkate.java index 597440d8c6e..e41dcc62239 100644 --- a/Mage.Sets/src/mage/cards/d/DeepglowSkate.java +++ b/Mage.Sets/src/mage/cards/d/DeepglowSkate.java @@ -98,7 +98,7 @@ class DeepglowSkateEffect extends OneShotEffect { if (permanent != null) { for (Counter counter : permanent.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName(), counter.getCount()); - permanent.addCounters(newCounter, game); + permanent.addCounters(newCounter, source, game); didOne = true; } } diff --git a/Mage.Sets/src/mage/cards/d/DefyDeath.java b/Mage.Sets/src/mage/cards/d/DefyDeath.java index add843dce7e..b8427e4c9cf 100644 --- a/Mage.Sets/src/mage/cards/d/DefyDeath.java +++ b/Mage.Sets/src/mage/cards/d/DefyDeath.java @@ -87,7 +87,7 @@ class DefyDeathEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null && permanent.hasSubtype("Angel", game)) { - permanent.addCounters(CounterType.P1P1.createInstance(2), game); + permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/d/Delay.java b/Mage.Sets/src/mage/cards/d/Delay.java index 8cc3940f097..262845b5deb 100644 --- a/Mage.Sets/src/mage/cards/d/Delay.java +++ b/Mage.Sets/src/mage/cards/d/Delay.java @@ -100,7 +100,7 @@ class DelayEffect extends OneShotEffect { boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class); UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getLogName(), source.getSourceId(), game, Zone.HAND, true)) { - card.addCounters(CounterType.TIME.createInstance(3), game); + card.addCounters(CounterType.TIME.createInstance(3), source, game); if (!hasSuspend) { game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source); } diff --git a/Mage.Sets/src/mage/cards/d/DelifsCube.java b/Mage.Sets/src/mage/cards/d/DelifsCube.java index e692f06ff92..265415b85d9 100644 --- a/Mage.Sets/src/mage/cards/d/DelifsCube.java +++ b/Mage.Sets/src/mage/cards/d/DelifsCube.java @@ -112,7 +112,7 @@ class DelifsCubeEffect extends OneShotEffect{ public boolean apply(Game game, Ability source) { Permanent perm = game.getPermanent(cubeId); if (perm == null) return false; - perm.addCounters(CounterType.CUBE.createInstance(), game); + perm.addCounters(CounterType.CUBE.createInstance(), source, game); return true; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java b/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java index 9a12814cbfd..1a6db47f339 100644 --- a/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java +++ b/Mage.Sets/src/mage/cards/d/DescentIntoMadness.java @@ -111,7 +111,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null && controller != null) { - sourcePermanent.addCounters(CounterType.DESPAIR.createInstance(), game); + sourcePermanent.addCounters(CounterType.DESPAIR.createInstance(), source, game); } if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); diff --git a/Mage.Sets/src/mage/cards/d/DesecrationDemon.java b/Mage.Sets/src/mage/cards/d/DesecrationDemon.java index c3550fa3091..4e33319d83a 100644 --- a/Mage.Sets/src/mage/cards/d/DesecrationDemon.java +++ b/Mage.Sets/src/mage/cards/d/DesecrationDemon.java @@ -110,7 +110,7 @@ class DesecrationDemonEffect extends OneShotEffect { permanent.sacrifice(source.getSourceId(), game); game.informPlayers(opponent.getLogName() + " sacrifices " + permanent.getLogName() + " to tap " + descrationDemon.getLogName() + ". A +1/+1 counter was put on it"); descrationDemon.tap(game); - descrationDemon.addCounters(CounterType.P1P1.createInstance(), game); + descrationDemon.addCounters(CounterType.P1P1.createInstance(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/d/DiregrafColossus.java b/Mage.Sets/src/mage/cards/d/DiregrafColossus.java index a02bbb46e5c..4281ccec0b4 100644 --- a/Mage.Sets/src/mage/cards/d/DiregrafColossus.java +++ b/Mage.Sets/src/mage/cards/d/DiregrafColossus.java @@ -109,7 +109,7 @@ class DiregrafColossusEffect extends OneShotEffect { int amount = 0; amount += player.getGraveyard().count(filter, game); if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/d/DomriRade.java b/Mage.Sets/src/mage/cards/d/DomriRade.java index d64cb310d6c..13751716963 100644 --- a/Mage.Sets/src/mage/cards/d/DomriRade.java +++ b/Mage.Sets/src/mage/cards/d/DomriRade.java @@ -66,7 +66,7 @@ import mage.target.common.TargetCreaturePermanent; public class DomriRade extends CardImpl { public DomriRade(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{1}{R}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{R}{G}"); this.subtype.add("Domri"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); @@ -79,7 +79,7 @@ public class DomriRade extends CardImpl { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(); target.setTargetTag(1); ability2.addTarget(target); - + FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature to fight"); filter.add(new AnotherTargetPredicate(2)); TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter); @@ -145,7 +145,7 @@ class DomriRadeEmblem extends Emblem { // "Creatures you control have double strike, trample, hexproof and haste." public DomriRadeEmblem() { - this.setName("EMBLEM: Domri Rade"); + this.setName("Emblem Domri"); FilterPermanent filter = new FilterControlledCreaturePermanent("Creatures"); GainAbilityControlledEffect effect = new GainAbilityControlledEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfGame, filter); Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect); diff --git a/Mage.Sets/src/mage/cards/d/DovinBaan.java b/Mage.Sets/src/mage/cards/d/DovinBaan.java index a7c8db198e2..6979c1b5385 100644 --- a/Mage.Sets/src/mage/cards/d/DovinBaan.java +++ b/Mage.Sets/src/mage/cards/d/DovinBaan.java @@ -1,158 +1,158 @@ -/* - * 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.cards.d; - -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.LoyaltyAbility; -import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; -import mage.abilities.effects.Effect; -import mage.abilities.effects.RestrictionUntapNotMoreThanEffect; -import mage.abilities.effects.common.DrawCardSourceControllerEffect; -import mage.abilities.effects.common.GainLifeEffect; -import mage.abilities.effects.common.GetEmblemEffect; -import mage.abilities.effects.common.continuous.BoostTargetEffect; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.filter.common.FilterControlledPermanent; -import mage.game.Game; -import mage.game.command.Emblem; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.players.Player; -import mage.target.common.TargetCreaturePermanent; - -/** - * - * @author emerald000 - */ -public class DovinBaan extends CardImpl { - - public DovinBaan(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{U}"); - this.subtype.add("Dovin"); - - this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); - - // +1: Until your next turn, up to one target creature gets -3/-0 and its activated abilities can't be activated. - Effect effect = new BoostTargetEffect(-3, 0, Duration.UntilYourNextTurn); - effect.setText("Until your next turn, up to one target creature gets -3/-0"); - Ability ability = new LoyaltyAbility(effect, 1); - ability.addTarget(new TargetCreaturePermanent(0, 1)); - ability.addEffect(new DovinBaanCantActivateAbilitiesEffect()); - this.addAbility(ability); - - // -1: You gain 2 life and draw a card. - ability = new LoyaltyAbility(new GainLifeEffect(2), -1); - effect = new DrawCardSourceControllerEffect(1); - effect.setText("and draw a card"); - ability.addEffect(effect); - this.addAbility(ability); - - // -7: You get an emblem with "Your opponents can't untap more than two permanents during their untap steps." - this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new DovinBaanEmblem()), -7)); - } - - public DovinBaan(final DovinBaan card) { - super(card); - } - - @Override - public DovinBaan copy() { - return new DovinBaan(this); - } -} - -class DovinBaanCantActivateAbilitiesEffect extends ContinuousRuleModifyingEffectImpl { - - DovinBaanCantActivateAbilitiesEffect() { - super(Duration.UntilYourNextTurn, Outcome.UnboostCreature); - staticText = "and its activated abilities can't be activated"; - } - - DovinBaanCantActivateAbilitiesEffect(final DovinBaanCantActivateAbilitiesEffect effect) { - super(effect); - } - - @Override - public DovinBaanCantActivateAbilitiesEffect copy() { - return new DovinBaanCantActivateAbilitiesEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == EventType.ACTIVATE_ABILITY; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return event.getSourceId().equals(this.getTargetPointer().getFirst(game, source)); - } -} - -class DovinBaanEmblem extends Emblem { - - DovinBaanEmblem() { - this.setName("EMBLEM: Dovin Baan"); - Ability ability = new SimpleStaticAbility(Zone.COMMAND, new DovinBaanCantUntapEffect()); - this.getAbilities().add(ability); - } -} - -class DovinBaanCantUntapEffect extends RestrictionUntapNotMoreThanEffect { - - DovinBaanCantUntapEffect() { - super(Duration.WhileOnBattlefield, 2, new FilterControlledPermanent()); - staticText = "Your opponents can't untap more than two permanents during their untap steps."; - } - - DovinBaanCantUntapEffect(final DovinBaanCantUntapEffect effect) { - super(effect); - } - - @Override - public boolean applies(Player player, Ability source, Game game) { - return game.getOpponents(source.getControllerId()).contains(player.getId()); - } - - @Override - public DovinBaanCantUntapEffect copy() { - return new DovinBaanCantUntapEffect(this); - } -} +/* + * 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.cards.d; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.RestrictionUntapNotMoreThanEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.GetEmblemEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.command.Emblem; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author emerald000 + */ +public class DovinBaan extends CardImpl { + + public DovinBaan(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{U}"); + this.subtype.add("Dovin"); + + this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); + + // +1: Until your next turn, up to one target creature gets -3/-0 and its activated abilities can't be activated. + Effect effect = new BoostTargetEffect(-3, 0, Duration.UntilYourNextTurn); + effect.setText("Until your next turn, up to one target creature gets -3/-0"); + Ability ability = new LoyaltyAbility(effect, 1); + ability.addTarget(new TargetCreaturePermanent(0, 1)); + ability.addEffect(new DovinBaanCantActivateAbilitiesEffect()); + this.addAbility(ability); + + // -1: You gain 2 life and draw a card. + ability = new LoyaltyAbility(new GainLifeEffect(2), -1); + effect = new DrawCardSourceControllerEffect(1); + effect.setText("and draw a card"); + ability.addEffect(effect); + this.addAbility(ability); + + // -7: You get an emblem with "Your opponents can't untap more than two permanents during their untap steps." + this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new DovinBaanEmblem()), -7)); + } + + public DovinBaan(final DovinBaan card) { + super(card); + } + + @Override + public DovinBaan copy() { + return new DovinBaan(this); + } +} + +class DovinBaanCantActivateAbilitiesEffect extends ContinuousRuleModifyingEffectImpl { + + DovinBaanCantActivateAbilitiesEffect() { + super(Duration.UntilYourNextTurn, Outcome.UnboostCreature); + staticText = "and its activated abilities can't be activated"; + } + + DovinBaanCantActivateAbilitiesEffect(final DovinBaanCantActivateAbilitiesEffect effect) { + super(effect); + } + + @Override + public DovinBaanCantActivateAbilitiesEffect copy() { + return new DovinBaanCantActivateAbilitiesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == EventType.ACTIVATE_ABILITY; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getSourceId().equals(this.getTargetPointer().getFirst(game, source)); + } +} + +class DovinBaanEmblem extends Emblem { + + DovinBaanEmblem() { + this.setName("Emblem Dovin"); + Ability ability = new SimpleStaticAbility(Zone.COMMAND, new DovinBaanCantUntapEffect()); + this.getAbilities().add(ability); + } +} + +class DovinBaanCantUntapEffect extends RestrictionUntapNotMoreThanEffect { + + DovinBaanCantUntapEffect() { + super(Duration.WhileOnBattlefield, 2, new FilterControlledPermanent()); + staticText = "Your opponents can't untap more than two permanents during their untap steps."; + } + + DovinBaanCantUntapEffect(final DovinBaanCantUntapEffect effect) { + super(effect); + } + + @Override + public boolean applies(Player player, Ability source, Game game) { + return game.getOpponents(source.getControllerId()).contains(player.getId()); + } + + @Override + public DovinBaanCantUntapEffect copy() { + return new DovinBaanCantUntapEffect(this); + } +} diff --git a/Mage.Sets/src/mage/cards/d/DustOfMoments.java b/Mage.Sets/src/mage/cards/d/DustOfMoments.java index 9e9a3273a42..658d0dc24bf 100644 --- a/Mage.Sets/src/mage/cards/d/DustOfMoments.java +++ b/Mage.Sets/src/mage/cards/d/DustOfMoments.java @@ -29,7 +29,6 @@ package mage.cards.d; import java.util.List; import java.util.UUID; - import mage.MageObject; import mage.abilities.Ability; import mage.abilities.Mode; @@ -53,12 +52,12 @@ import mage.players.Player; /** * * @author Gal Lerman - + * */ public class DustOfMoments extends CardImpl { public DustOfMoments(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); // Choose one - Remove two time counters from each permanent and each suspended card this.getSpellAbility().addEffect(new RemoveCountersEffect()); @@ -78,171 +77,172 @@ public class DustOfMoments extends CardImpl { return new DustOfMoments(this); } + //TODO: PermanentImpl.getCounters() and CardImpl.getCounters(game) don't return the same value for the same Card + //TODO: This means I can't use a Card generic for Permanents and Exiled cards and use Card.getCounters(game) + //TODO: This is the reason i've copy pasted some logic in DustOfMomentsEffect + //TODO: After this issue is fixed/explained i'll refactor the code + public abstract static class DustOfMomentsEffect extends OneShotEffect { - //TODO: PermanentImpl.getCounters() and CardImpl.getCounters(game) don't return the same value for the same Card - //TODO: This means I can't use a Card generic for Permanents and Exiled cards and use Card.getCounters(game) - //TODO: This is the reason i've copy pasted some logic in DustOfMomentsEffect - //TODO: After this issue is fixed/explained i'll refactor the code - public abstract static class DustOfMomentsEffect extends OneShotEffect { + private final Counter counter; + private final Filter permFilter; + private final Filter exiledFilter; - private final Counter counter; - private final Filter permFilter; - private final Filter exiledFilter; + public DustOfMomentsEffect() { + super(Outcome.Benefit); + this.counter = new Counter(CounterType.TIME.getName(), 2); + this.permFilter = new FilterCard("permanent and each suspended card"); + permFilter.add(new CounterPredicate(CounterType.TIME)); - public DustOfMomentsEffect() { - super(Outcome.Benefit); - this.counter = new Counter(CounterType.TIME.getName(), 2); - this.permFilter = new FilterCard("permanent and each suspended card"); - permFilter.add(new CounterPredicate(CounterType.TIME)); - - this.exiledFilter = new FilterCard("permanent and each suspended card"); - exiledFilter.add(new CardCounterPredicate(CounterType.TIME)); - setText(); - } - - public DustOfMomentsEffect(final DustOfMomentsEffect effect) { - super(effect); - this.counter = effect.counter.copy(); - this.permFilter = effect.permFilter.copy(); - this.exiledFilter = effect.exiledFilter.copy(); - } - - @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) { - updatePermanents(game, controller, sourceObject); - updateSuspended(game, controller, sourceObject); - return true; - } - return false; - } - - private void updateSuspended(final Game game, final Player controller, final MageObject sourceObject) { - final List exiledCards = game.getExile().getAllCards(game); - execute(game, controller, sourceObject, exiledCards); - } - - private void updatePermanents(final Game game, final Player controller, final MageObject sourceObject) { - List permanents = game.getBattlefield().getAllActivePermanents(); - executeP(game, controller, sourceObject, permanents); - } - - private void executeP(final Game game, final Player controller, final MageObject sourceObject, final List cards) { - if (cards == null || cards.isEmpty()) { - return; - } - for (Permanent card : cards) { - if (permFilter.match(card, game)) { - final String counterName = counter.getName(); - if (shouldRemoveCounters()) { - final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); - final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); - final Counter modifiedCounter = new Counter(counterName, countersToRemove); - card.removeCounters(modifiedCounter, game); - } else { - card.addCounters(counter, game); - } - if (!game.isSimulation()) - game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") - .append(controller.getLogName()).append(getActionStr()).append("s") - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) - .append(" counter on ").append(card.getName()).toString()); - } - } - } - - private void execute(final Game game, final Player controller, final MageObject sourceObject, final List cards) { - if (cards == null || cards.isEmpty()) { - return; - } - for (Card card : cards) { - if (exiledFilter.match(card, game)) { - final String counterName = counter.getName(); - if (shouldRemoveCounters()) { - final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); - final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); - final Counter modifiedCounter = new Counter(counterName, countersToRemove); - card.removeCounters(modifiedCounter, game); - } else { - card.addCounters(counter, game); - } - if (!game.isSimulation()) - game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") - .append(controller.getLogName()).append(getActionStr()).append("s ") - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) - .append(" counter on ").append(card.getName()).toString()); + this.exiledFilter = new FilterCard("permanent and each suspended card"); + exiledFilter.add(new CardCounterPredicate(CounterType.TIME)); + setText(); + } + + public DustOfMomentsEffect(final DustOfMomentsEffect effect) { + super(effect); + this.counter = effect.counter.copy(); + this.permFilter = effect.permFilter.copy(); + this.exiledFilter = effect.exiledFilter.copy(); + } + + @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) { + updatePermanents(source, game, controller, sourceObject); + updateSuspended(source, game, controller, sourceObject); + return true; + } + return false; + } + + private void updateSuspended(final Ability source, final Game game, final Player controller, final MageObject sourceObject) { + final List exiledCards = game.getExile().getAllCards(game); + execute(source, game, controller, sourceObject, exiledCards); + } + + private void updatePermanents(final Ability source, final Game game, final Player controller, final MageObject sourceObject) { + List permanents = game.getBattlefield().getAllActivePermanents(); + executeP(source, game, controller, sourceObject, permanents); + } + + private void executeP(final Ability source, final Game game, final Player controller, final MageObject sourceObject, final List cards) { + if (cards == null || cards.isEmpty()) { + return; + } + for (Permanent card : cards) { + if (permFilter.match(card, game)) { + final String counterName = counter.getName(); + if (shouldRemoveCounters()) { + final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); + final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); + final Counter modifiedCounter = new Counter(counterName, countersToRemove); + card.removeCounters(modifiedCounter, game); + } else { + card.addCounters(counter, source, game); + } + if (!game.isSimulation()) { + game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") + .append(controller.getLogName()).append(getActionStr()).append("s") + .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(" counter on ").append(card.getName()).toString()); + } + } + } + } + + private void execute(final Ability source, final Game game, final Player controller, final MageObject sourceObject, final List cards) { + if (cards == null || cards.isEmpty()) { + return; + } + for (Card card : cards) { + if (exiledFilter.match(card, game)) { + final String counterName = counter.getName(); + if (shouldRemoveCounters()) { + final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); + final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); + final Counter modifiedCounter = new Counter(counterName, countersToRemove); + card.removeCounters(modifiedCounter, game); + } else { + card.addCounters(counter, source, game); + } + if (!game.isSimulation()) { + game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") + .append(controller.getLogName()).append(getActionStr()).append("s ") + .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(" counter on ").append(card.getName()).toString()); + } + } + } + } + + protected abstract boolean shouldRemoveCounters(); + + protected abstract String getActionStr(); + + private void setText() { + StringBuilder sb = new StringBuilder(); + sb.append(getActionStr()); + if (counter.getCount() > 1) { + sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); + } else { + sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); + } + sb.append(permFilter.getMessage()); + staticText = sb.toString(); } - } } - protected abstract boolean shouldRemoveCounters(); + public static class AddCountersEffect extends DustOfMomentsEffect { - protected abstract String getActionStr(); + public AddCountersEffect() { + super(); + } - private void setText() { - StringBuilder sb = new StringBuilder(); - sb.append(getActionStr()); - if (counter.getCount() > 1) { - sb.append(Integer.toString(counter.getCount())).append(" ").append(counter.getName().toLowerCase()).append(" counters on each "); - } else { - sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each "); - } - sb.append(permFilter.getMessage()); - staticText = sb.toString(); - } - } + public AddCountersEffect(final DustOfMomentsEffect effect) { + super(effect); + } - public static class AddCountersEffect extends DustOfMomentsEffect { + @Override + protected boolean shouldRemoveCounters() { + return false; + } - public AddCountersEffect() { - super(); + @Override + protected String getActionStr() { + return "add"; + } + + @Override + public Effect copy() { + return new AddCountersEffect(this); + } } - public AddCountersEffect(final DustOfMomentsEffect effect) { - super(effect); - } + public static class RemoveCountersEffect extends DustOfMomentsEffect { - @Override - protected boolean shouldRemoveCounters() { - return false; - } + public RemoveCountersEffect() { + super(); + } - @Override - protected String getActionStr() { - return "add"; - } + public RemoveCountersEffect(final DustOfMomentsEffect effect) { + super(effect); + } - @Override - public Effect copy() { - return new AddCountersEffect(this); - } - } + @Override + protected boolean shouldRemoveCounters() { + return true; + } - public static class RemoveCountersEffect extends DustOfMomentsEffect { + @Override + protected String getActionStr() { + return "remove"; + } - public RemoveCountersEffect() { - super(); + @Override + public Effect copy() { + return new RemoveCountersEffect(this); + } } - - public RemoveCountersEffect(final DustOfMomentsEffect effect) { - super(effect); - } - - @Override - protected boolean shouldRemoveCounters() { - return true; - } - - @Override - protected String getActionStr() { - return "remove"; - } - - @Override - public Effect copy() { - return new RemoveCountersEffect(this); - } - } } diff --git a/Mage.Sets/src/mage/cards/e/EbonPraetor.java b/Mage.Sets/src/mage/cards/e/EbonPraetor.java index 399d059a122..380093fd8a3 100644 --- a/Mage.Sets/src/mage/cards/e/EbonPraetor.java +++ b/Mage.Sets/src/mage/cards/e/EbonPraetor.java @@ -115,7 +115,7 @@ class EbonPraetorEffect extends OneShotEffect { Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0); Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sacrificedCreature.hasSubtype("Thrull", game) && sourceCreature != null) { - sourceCreature.addCounters(CounterType.P1P0.createInstance(), game); + sourceCreature.addCounters(CounterType.P1P0.createInstance(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/e/ElderCathar.java b/Mage.Sets/src/mage/cards/e/ElderCathar.java index 55540eb8273..65045ba6936 100644 --- a/Mage.Sets/src/mage/cards/e/ElderCathar.java +++ b/Mage.Sets/src/mage/cards/e/ElderCathar.java @@ -96,9 +96,9 @@ class ElderCatharAddCountersTargetEffect extends OneShotEffect { if (permanent != null) { if (counter != null) { if (permanent.hasSubtype("Human", game)) { - permanent.addCounters(counter2.copy(), game); + permanent.addCounters(counter2.copy(), source, game); } else { - permanent.addCounters(counter.copy(), game); + permanent.addCounters(counter.copy(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/e/ElspethKnightErrant.java b/Mage.Sets/src/mage/cards/e/ElspethKnightErrant.java index 3379988d341..2fc1cf28108 100644 --- a/Mage.Sets/src/mage/cards/e/ElspethKnightErrant.java +++ b/Mage.Sets/src/mage/cards/e/ElspethKnightErrant.java @@ -60,7 +60,7 @@ import mage.target.common.TargetCreaturePermanent; public class ElspethKnightErrant extends CardImpl { public ElspethKnightErrant(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{W}"); this.subtype.add("Elspeth"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -100,7 +100,7 @@ public class ElspethKnightErrant extends CardImpl { class ElspethKnightErrantEmblem extends Emblem { public ElspethKnightErrantEmblem() { - this.setName("EMBLEM: Elspeth, Knight-Errant"); + this.setName("Emblem Elspeth"); FilterControlledPermanent filter = new FilterControlledPermanent("Artifacts, creatures, enchantments, and lands you control"); filter.add(Predicates.or( new CardTypePredicate(CardType.ARTIFACT), diff --git a/Mage.Sets/src/mage/cards/e/ElspethSunsChampion.java b/Mage.Sets/src/mage/cards/e/ElspethSunsChampion.java index e926146b8a8..b6c4e56f8d0 100644 --- a/Mage.Sets/src/mage/cards/e/ElspethSunsChampion.java +++ b/Mage.Sets/src/mage/cards/e/ElspethSunsChampion.java @@ -62,7 +62,7 @@ public class ElspethSunsChampion extends CardImpl { } public ElspethSunsChampion(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{4}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{W}{W}"); this.subtype.add("Elspeth"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -91,7 +91,7 @@ class ElspethSunsChampionEmblem extends Emblem { private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures"); public ElspethSunsChampionEmblem() { - this.setName("EMBLEM: Elspeth, Sun's Champion"); + this.setName("Emblem Elspeth"); Ability ability = new SimpleStaticAbility(Zone.COMMAND, new BoostControlledEffect(2, 2, Duration.EndOfGame, filter, false)); ability.addEffect(new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.EndOfGame, filter)); this.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/e/EnlistedWurm.java b/Mage.Sets/src/mage/cards/e/EnlistedWurm.java index 1dc6dd3ef0a..107552e08f7 100644 --- a/Mage.Sets/src/mage/cards/e/EnlistedWurm.java +++ b/Mage.Sets/src/mage/cards/e/EnlistedWurm.java @@ -28,11 +28,11 @@ package mage.cards.e; import java.util.UUID; -import mage.constants.CardType; import mage.MageInt; import mage.abilities.keyword.CascadeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; /** * @@ -41,14 +41,13 @@ import mage.cards.CardSetInfo; public class EnlistedWurm extends CardImpl { public EnlistedWurm(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{W}"); this.subtype.add("Wurm"); - - this.power = new MageInt(5); this.toughness = new MageInt(5); + // Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.) this.addAbility(new CascadeAbility()); } diff --git a/Mage.Sets/src/mage/cards/e/Epochrasite.java b/Mage.Sets/src/mage/cards/e/Epochrasite.java index 226e1530814..c29abb4ae69 100644 --- a/Mage.Sets/src/mage/cards/e/Epochrasite.java +++ b/Mage.Sets/src/mage/cards/e/Epochrasite.java @@ -108,7 +108,7 @@ class EpochrasiteEffect extends OneShotEffect { if (game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.GRAVEYARD, true); - card.addCounters(CounterType.TIME.createInstance(3), game); + card.addCounters(CounterType.TIME.createInstance(3), source, game); game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source); } return true; diff --git a/Mage.Sets/src/mage/cards/e/EternityVessel.java b/Mage.Sets/src/mage/cards/e/EternityVessel.java index 6bd16250fec..17a29203802 100644 --- a/Mage.Sets/src/mage/cards/e/EternityVessel.java +++ b/Mage.Sets/src/mage/cards/e/EternityVessel.java @@ -86,7 +86,7 @@ class EternityVesselEffect extends OneShotEffect { if (vessel != null && controller != null) { int amount = controller.getLife(); if (amount > 0) { - vessel.addCounters(CounterType.CHARGE.createInstance(amount), game); + vessel.addCounters(CounterType.CHARGE.createInstance(amount), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/e/EverlastingTorment.java b/Mage.Sets/src/mage/cards/e/EverlastingTorment.java index 7f35dc3dbd1..322dffbe1a9 100644 --- a/Mage.Sets/src/mage/cards/e/EverlastingTorment.java +++ b/Mage.Sets/src/mage/cards/e/EverlastingTorment.java @@ -105,7 +105,7 @@ class DamageDealtAsIfSourceHadWitherEffect extends ReplacementEffectImpl { Counter counter = CounterType.M1M1.createInstance(damageAmount); Permanent creatureDamaged = game.getPermanent(event.getTargetId()); if (creatureDamaged != null) { - creatureDamaged.addCounters(counter, game); + creatureDamaged.addCounters(counter, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/e/EvolutionaryEscalation.java b/Mage.Sets/src/mage/cards/e/EvolutionaryEscalation.java index 322929d6315..d20c9560633 100644 --- a/Mage.Sets/src/mage/cards/e/EvolutionaryEscalation.java +++ b/Mage.Sets/src/mage/cards/e/EvolutionaryEscalation.java @@ -96,7 +96,7 @@ class EvolutionaryEscalationEffect extends OneShotEffect { for (Target target: source.getTargets()) { Permanent targetPermanent = game.getPermanent(target.getFirstTarget()); if (targetPermanent != null) { - targetPermanent.addCounters(counter.copy(), game); + targetPermanent.addCounters(counter.copy(), source, game); addedCounters = true; } } diff --git a/Mage.Sets/src/mage/cards/e/EyeOfDoom.java b/Mage.Sets/src/mage/cards/e/EyeOfDoom.java index 385b27f0d30..6a665a99c2e 100644 --- a/Mage.Sets/src/mage/cards/e/EyeOfDoom.java +++ b/Mage.Sets/src/mage/cards/e/EyeOfDoom.java @@ -123,7 +123,7 @@ class EyeOfDoomEffect extends OneShotEffect { } while (!player.getId().equals(game.getActivePlayerId())); for (Permanent permanent: permanents) { - permanent.addCounters(CounterType.DOOM.createInstance(), game); + permanent.addCounters(CounterType.DOOM.createInstance(), source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java b/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java index 18ed147a15d..1aee5113fc1 100644 --- a/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java +++ b/Mage.Sets/src/mage/cards/e/EzuriClawOfProgress.java @@ -119,7 +119,7 @@ class EzuriClawOfProgressEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int amount = controller.getCounters().getCount(CounterType.EXPERIENCE); - target.addCounters(CounterType.P1P1.createInstance(amount), game); + target.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/f/FalkenrathAristocrat.java b/Mage.Sets/src/mage/cards/f/FalkenrathAristocrat.java index b308c249b75..cda6109e116 100644 --- a/Mage.Sets/src/mage/cards/f/FalkenrathAristocrat.java +++ b/Mage.Sets/src/mage/cards/f/FalkenrathAristocrat.java @@ -106,7 +106,7 @@ class FalkenrathAristocratEffect extends OneShotEffect { Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0); Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sacrificedCreature.hasSubtype("Human", game) && sourceCreature != null) { - sourceCreature.addCounters(CounterType.P1P1.createInstance(), game); + sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FalkenrathTorturer.java b/Mage.Sets/src/mage/cards/f/FalkenrathTorturer.java index 4ace0b705fd..c8df4157620 100644 --- a/Mage.Sets/src/mage/cards/f/FalkenrathTorturer.java +++ b/Mage.Sets/src/mage/cards/f/FalkenrathTorturer.java @@ -102,7 +102,7 @@ class FalkenrathTorturerEffect extends OneShotEffect { Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0); Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sacrificedCreature.hasSubtype("Human", game) && sourceCreature != null) { - sourceCreature.addCounters(CounterType.P1P1.createInstance(), game); + sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/f/FateTransfer.java b/Mage.Sets/src/mage/cards/f/FateTransfer.java index 1fe35829165..523ac5aa641 100644 --- a/Mage.Sets/src/mage/cards/f/FateTransfer.java +++ b/Mage.Sets/src/mage/cards/f/FateTransfer.java @@ -103,7 +103,7 @@ class FateTransferEffect extends OneShotEffect { Permanent copyCreature = creatureToMoveCountersFrom.copy(); for (Counter counter : copyCreature.getCounters(game).values()) { creatureToMoveCountersFrom.removeCounters(counter, game); - creatureToMoveCountersTo.addCounters(counter, game); + creatureToMoveCountersTo.addCounters(counter, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FearsomeAwakening.java b/Mage.Sets/src/mage/cards/f/FearsomeAwakening.java index 9ce372bf4b3..656b8a555da 100644 --- a/Mage.Sets/src/mage/cards/f/FearsomeAwakening.java +++ b/Mage.Sets/src/mage/cards/f/FearsomeAwakening.java @@ -86,7 +86,7 @@ class FearsomeAwakeningEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null && permanent.hasSubtype("Dragon", game)) { - permanent.addCounters(CounterType.P1P1.createInstance(2), game); + permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FleshBlood.java b/Mage.Sets/src/mage/cards/f/FleshBlood.java index 778430ffd6a..59f370b415e 100644 --- a/Mage.Sets/src/mage/cards/f/FleshBlood.java +++ b/Mage.Sets/src/mage/cards/f/FleshBlood.java @@ -104,7 +104,7 @@ class FleshEffect extends OneShotEffect { if (power > 0) { Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (targetCreature != null) { - targetCreature.addCounters(CounterType.P1P1.createInstance(power), game); + targetCreature.addCounters(CounterType.P1P1.createInstance(power), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java index f5d6849fe35..d13001fa770 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenAncient.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenAncient.java @@ -149,7 +149,7 @@ public class ForgottenAncient extends CardImpl { //Move all the counters for each chosen creature for(CounterMovement cm: counterMovements) { sourcePermanent.removeCounters(CounterType.P1P1.createInstance(cm.counters), game); - game.getPermanent(cm.target).addCounters(CounterType.P1P1.createInstance(cm.counters), game); + game.getPermanent(cm.target).addCounters(CounterType.P1P1.createInstance(cm.counters), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/f/FulfillContract.java b/Mage.Sets/src/mage/cards/f/FulfillContract.java index c46c84ed0f4..3c5fb1f093e 100644 --- a/Mage.Sets/src/mage/cards/f/FulfillContract.java +++ b/Mage.Sets/src/mage/cards/f/FulfillContract.java @@ -1,114 +1,114 @@ -/* - * 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.cards.f; - -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.filter.predicate.permanent.CounterPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetCreaturePermanent; - -/** - * - * @author Styxo - */ -public class FulfillContract extends CardImpl { - - private static final FilterCreaturePermanent filterBountyCreature = new FilterCreaturePermanent("creature with a bounty counter on it"); - private static final FilterControlledCreaturePermanent filterRogueOrHunter = new FilterControlledCreaturePermanent("Rogue or Hunter you control"); - - static { - filterBountyCreature.add(new CounterPredicate(CounterType.BOUNTY)); - filterRogueOrHunter.add(Predicates.or(new SubtypePredicate("Rogue"), new SubtypePredicate("Hunter"))); - } - - public FulfillContract(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B/R}{B/R}"); - - // Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control. - this.getSpellAbility().addEffect(new FulfillContractEffect()); - this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterBountyCreature)); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filterRogueOrHunter)); - - } - - public FulfillContract(final FulfillContract card) { - super(card); - } - - @Override - public FulfillContract copy() { - return new FulfillContract(this); - } -} - -class FulfillContractEffect extends OneShotEffect { - - public FulfillContractEffect() { - super(Outcome.Benefit); - this.staticText = "Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control"; - } - - public FulfillContractEffect(final FulfillContractEffect effect) { - super(effect); - } - - @Override - public FulfillContractEffect copy() { - return new FulfillContractEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - Permanent permanentToDestroy = game.getPermanent(getTargetPointer().getFirst(game, source)); - Permanent permanentToPutCounter = game.getPermanent(getTargetPointer().getTargets(game, source).get(1)); - if (controller != null) { - if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(), game, false)) { - if (permanentToPutCounter != null) { - permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(), game); - } - } - return true; - } - return false; - } -} +/* + * 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.cards.f; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Styxo + */ +public class FulfillContract extends CardImpl { + + private static final FilterCreaturePermanent filterBountyCreature = new FilterCreaturePermanent("creature with a bounty counter on it"); + private static final FilterControlledCreaturePermanent filterRogueOrHunter = new FilterControlledCreaturePermanent("Rogue or Hunter you control"); + + static { + filterBountyCreature.add(new CounterPredicate(CounterType.BOUNTY)); + filterRogueOrHunter.add(Predicates.or(new SubtypePredicate("Rogue"), new SubtypePredicate("Hunter"))); + } + + public FulfillContract(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B/R}{B/R}"); + + // Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control. + this.getSpellAbility().addEffect(new FulfillContractEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterBountyCreature)); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filterRogueOrHunter)); + + } + + public FulfillContract(final FulfillContract card) { + super(card); + } + + @Override + public FulfillContract copy() { + return new FulfillContract(this); + } +} + +class FulfillContractEffect extends OneShotEffect { + + public FulfillContractEffect() { + super(Outcome.Benefit); + this.staticText = "Destroy target creature with a bounty counter on it. If that creature is destroyed this way, you may put a +1/+1 counter on target Rogue or Hunter you control"; + } + + public FulfillContractEffect(final FulfillContractEffect effect) { + super(effect); + } + + @Override + public FulfillContractEffect copy() { + return new FulfillContractEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanentToDestroy = game.getPermanent(getTargetPointer().getFirst(game, source)); + Permanent permanentToPutCounter = game.getPermanent(source.getTargets().get(1).getFirstTarget()); + if (controller != null) { + if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(), game, false)) { + if (permanentToPutCounter != null) { + permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(), source, game); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/g/GarrukApexPredator.java b/Mage.Sets/src/mage/cards/g/GarrukApexPredator.java index f8a8c845427..435922722e8 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukApexPredator.java +++ b/Mage.Sets/src/mage/cards/g/GarrukApexPredator.java @@ -75,7 +75,7 @@ public class GarrukApexPredator extends CardImpl { } public GarrukApexPredator(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{5}{B}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{5}{B}{G}"); this.subtype.add("Garruk"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); @@ -166,7 +166,7 @@ class GarrukApexPredatorBeastToken extends Token { class GarrukApexPredatorEmblem extends Emblem { public GarrukApexPredatorEmblem() { - setName("EMBLEM: Garruk, Apex Predator"); + setName("Emblem Garruk"); Effect effect = new BoostTargetEffect(5, 5, Duration.EndOfTurn); effect.setText("it gets +5/+5"); Ability ability = new AttackedByCreatureTriggeredAbility(Zone.COMMAND, effect, false, SetTargetPointer.PERMANENT); diff --git a/Mage.Sets/src/mage/cards/g/GarrukCallerOfBeasts.java b/Mage.Sets/src/mage/cards/g/GarrukCallerOfBeasts.java index 0f4b81bcb7b..76d3456416f 100644 --- a/Mage.Sets/src/mage/cards/g/GarrukCallerOfBeasts.java +++ b/Mage.Sets/src/mage/cards/g/GarrukCallerOfBeasts.java @@ -63,7 +63,7 @@ public class GarrukCallerOfBeasts extends CardImpl { } public GarrukCallerOfBeasts(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{4}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}"); this.subtype.add("Garruk"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -102,7 +102,7 @@ class GarrukCallerOfBeastsEmblem extends Emblem { } public GarrukCallerOfBeastsEmblem() { - this.setName("EMBLEM: Garruk, Caller of Beasts"); + this.setName("Emblem Garruk"); Effect effect = new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterCreatureCard("creature card")), false, true, Outcome.PutCreatureInPlay); Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, filter, true, false); this.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java b/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java index aebc017e86e..931d1d875d6 100644 --- a/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java +++ b/Mage.Sets/src/mage/cards/g/GemstoneCaverns.java @@ -149,7 +149,7 @@ class GemstoneCavernsEffect extends OneShotEffect { if (card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId())) { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { - permanent.addCounters(CounterType.LUCK.createInstance(), game); + permanent.addCounters(CounterType.LUCK.createInstance(), source, game); Cost cost = new ExileFromHandCost(new TargetCardInHand()); if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) { cost.pay(source, game, source.getSourceId(), source.getControllerId(), true, null); diff --git a/Mage.Sets/src/mage/cards/g/GideonAllyOfZendikar.java b/Mage.Sets/src/mage/cards/g/GideonAllyOfZendikar.java index 2b592171c8e..b2ac452716d 100644 --- a/Mage.Sets/src/mage/cards/g/GideonAllyOfZendikar.java +++ b/Mage.Sets/src/mage/cards/g/GideonAllyOfZendikar.java @@ -55,7 +55,7 @@ import mage.game.permanent.token.Token; public class GideonAllyOfZendikar extends CardImpl { public GideonAllyOfZendikar(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{W}"); this.subtype.add("Gideon"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -87,7 +87,7 @@ public class GideonAllyOfZendikar extends CardImpl { class GideonAllyOfZendikarEmblem extends Emblem { public GideonAllyOfZendikarEmblem() { - this.setName("EMBLEM: Gideon, Ally of Zendikar"); + this.setName("Emblem Gideon"); BoostControlledEffect effect = new BoostControlledEffect(1, 1, Duration.EndOfGame); Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect); this.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/g/GildedDrake.java b/Mage.Sets/src/mage/cards/g/GildedDrake.java index e8e30802c14..be6951537f4 100644 --- a/Mage.Sets/src/mage/cards/g/GildedDrake.java +++ b/Mage.Sets/src/mage/cards/g/GildedDrake.java @@ -61,7 +61,7 @@ public class GildedDrake extends CardImpl { } public GildedDrake(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add("Drake"); this.power = new MageInt(3); @@ -105,20 +105,22 @@ class GildedDrakeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent sourceObject = game.getPermanent(source.getSourceId()); - Permanent targetPermanent; + Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (targetPointer.getFirst(game, source) != null) { - targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); - if (targetPermanent != null) { - ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true); - effect.setTargetPointer(targetPointer); - game.addEffect(effect, source); - return true; + Permanent sourceObject = game.getPermanent(source.getSourceId()); + if (sourceObject != null) { + if (targetPointer.getFirst(game, source) != null) { + Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); + if (targetPermanent != null) { + ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true); + effect.setTargetPointer(targetPointer); + game.addEffect(effect, source); + return true; + } } + sourceObject.sacrifice(source.getSourceId(), game); } - sourceObject.sacrifice(source.getSourceId(), game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GilderBairn.java b/Mage.Sets/src/mage/cards/g/GilderBairn.java index 24881249dd0..bab59c1fbd0 100644 --- a/Mage.Sets/src/mage/cards/g/GilderBairn.java +++ b/Mage.Sets/src/mage/cards/g/GilderBairn.java @@ -99,7 +99,7 @@ class GilderBairnEffect extends OneShotEffect { } for (Counter counter : target.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName(), counter.getCount()); - target.addCounters(newCounter, game); + target.addCounters(newCounter, source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GlisteningOil.java b/Mage.Sets/src/mage/cards/g/GlisteningOil.java index 418cbf6cb7e..1c5d0e20aae 100644 --- a/Mage.Sets/src/mage/cards/g/GlisteningOil.java +++ b/Mage.Sets/src/mage/cards/g/GlisteningOil.java @@ -102,7 +102,7 @@ class GlisteningOilEffect extends OneShotEffect { if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); if (creature != null) { - creature.addCounters(CounterType.M1M1.createInstance(), game); + creature.addCounters(CounterType.M1M1.createInstance(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/g/GolgariGraveTroll.java b/Mage.Sets/src/mage/cards/g/GolgariGraveTroll.java index f5c56b1d72e..65ff855217c 100644 --- a/Mage.Sets/src/mage/cards/g/GolgariGraveTroll.java +++ b/Mage.Sets/src/mage/cards/g/GolgariGraveTroll.java @@ -107,7 +107,7 @@ class GolgariGraveTrollEffect extends OneShotEffect { if (permanent != null && player != null) { int amount = player.getGraveyard().count(filter, game); if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/g/GraveBetrayal.java b/Mage.Sets/src/mage/cards/g/GraveBetrayal.java index 0a481720e2a..38962392468 100644 --- a/Mage.Sets/src/mage/cards/g/GraveBetrayal.java +++ b/Mage.Sets/src/mage/cards/g/GraveBetrayal.java @@ -146,7 +146,7 @@ class GraveBetrayalEffect extends OneShotEffect { Zone currentZone = game.getState().getZone(card.getId()); if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), source.getControllerId())) { Permanent creature = game.getPermanent(card.getId()); - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); ContinuousEffect effect = new GraveBetrayalContiniousEffect(); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/cards/g/GriefTyrant.java b/Mage.Sets/src/mage/cards/g/GriefTyrant.java index 0d929898712..180849399b7 100644 --- a/Mage.Sets/src/mage/cards/g/GriefTyrant.java +++ b/Mage.Sets/src/mage/cards/g/GriefTyrant.java @@ -97,7 +97,7 @@ class GriefTyrantEffect extends OneShotEffect { Permanent griefTyrant = game.getPermanentOrLKIBattlefield(source.getSourceId()); int countersOnGriefTyrant = griefTyrant.getCounters(game).getCount(CounterType.M1M1); if (targetCreature != null) { - targetCreature.addCounters(CounterType.M1M1.createInstance(countersOnGriefTyrant), game); + targetCreature.addCounters(CounterType.M1M1.createInstance(countersOnGriefTyrant), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java b/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java index b23018a721b..3bb99f31695 100644 --- a/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java +++ b/Mage.Sets/src/mage/cards/g/GwafaHazidProfiteer.java @@ -109,7 +109,7 @@ class GwafaHazidProfiteerEffect1 extends OneShotEffect { Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null) { Player controller = game.getPlayer(targetCreature.getControllerId()); - targetCreature.addCounters(CounterType.BRIBERY.createInstance(), game); + targetCreature.addCounters(CounterType.BRIBERY.createInstance(), source, game); if (controller != null) { controller.drawCards(1, game); } diff --git a/Mage.Sets/src/mage/cards/h/HallOfGemstone.java b/Mage.Sets/src/mage/cards/h/HallOfGemstone.java new file mode 100644 index 00000000000..c2ed8244ebc --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HallOfGemstone.java @@ -0,0 +1,159 @@ +/* + * 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.cards.h; + +import java.util.UUID; +import mage.MageObject; +import mage.Mana; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUntapTriggeredAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ManaEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.util.CardUtil; + +/** + * + * @author LevelX2 + */ +public class HallOfGemstone extends CardImpl { + + public HallOfGemstone(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}"); + + this.supertype.add("World"); + + // At the beginning of each player's upkeep, that player chooses a color. Until end of turn, lands tapped for mana produce mana of the chosen color instead of any other color. + this.addAbility(new BeginningOfUntapTriggeredAbility(new HallOfGemstoneEffect(), TargetController.ANY, false)); + + } + + public HallOfGemstone(final HallOfGemstone card) { + super(card); + } + + @Override + public HallOfGemstone copy() { + return new HallOfGemstone(this); + } +} + +class HallOfGemstoneEffect extends ReplacementEffectImpl { + + HallOfGemstoneEffect() { + super(Duration.EndOfTurn, Outcome.Neutral); + staticText = "that player chooses a color. Until end of turn, lands tapped for mana produce mana of the chosen color instead of any other color"; + } + + HallOfGemstoneEffect(final HallOfGemstoneEffect effect) { + super(effect); + } + + @Override + public HallOfGemstoneEffect copy() { + return new HallOfGemstoneEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + MageObject mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (player != null && mageObject != null) { + ChoiceColor choice = new ChoiceColor(); + while (!choice.isChosen()) { + player.choose(outcome, choice, game); + if (!player.canRespond()) { + return; + } + } + if (!game.isSimulation()) { + game.informPlayers(mageObject.getLogName() + ": " + player.getLogName() + " has chosen " + choice.getChoice()); + } + game.getState().setValue(mageObject.getId() + "_color", choice.getColor()); + if (mageObject instanceof Permanent) { + ((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game); + } + } + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + ObjectColor colorChosen = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); + if (colorChosen != null) { + ManaEvent manaEvent = (ManaEvent) event; + Mana mana = manaEvent.getMana(); + int amount = mana.count(); + switch (colorChosen.getColoredManaSymbol()) { + case W: + mana.setToMana(Mana.WhiteMana(amount)); + break; + case U: + mana.setToMana(Mana.BlueMana(amount)); + break; + case B: + mana.setToMana(Mana.BlackMana(amount)); + break; + case R: + mana.setToMana(Mana.RedMana(amount)); + break; + case G: + mana.setToMana(Mana.GreenMana(amount)); + break; + } + } + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + return permanent != null && permanent.getCardType().contains(CardType.LAND); + } +} diff --git a/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java b/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java index c58d41be45c..c0fe849904e 100644 --- a/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java +++ b/Mage.Sets/src/mage/cards/h/HamletbackGoliath.java @@ -131,7 +131,7 @@ class HamletbackGoliathEffect extends OneShotEffect { creature = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.BATTLEFIELD); } if (creature != null && sourceObject != null) { - sourceObject.addCounters(CounterType.P1P1.createInstance(creature.getPower().getValue()), game); + sourceObject.addCounters(CounterType.P1P1.createInstance(creature.getPower().getValue()), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/Hankyu.java b/Mage.Sets/src/mage/cards/h/Hankyu.java index 5a45860556b..a787698b2a5 100644 --- a/Mage.Sets/src/mage/cards/h/Hankyu.java +++ b/Mage.Sets/src/mage/cards/h/Hankyu.java @@ -106,7 +106,7 @@ class HankyuAddCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent equipment = game.getPermanent(this.effectGivingEquipmentId); if (equipment != null) { - equipment.addCounters(CounterType.AIM.createInstance(), game); + equipment.addCounters(CounterType.AIM.createInstance(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/h/HarshJudgment.java b/Mage.Sets/src/mage/cards/h/HarshJudgment.java new file mode 100755 index 00000000000..75aefc378c5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HarshJudgment.java @@ -0,0 +1,134 @@ +/* + * 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.cards.h; + +import java.util.UUID; + +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.RedirectionEffect; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.ChooseColorEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterInPlay; +import mage.filter.common.FilterInstantOrSorceryCard; +import mage.game.Game; +import mage.game.events.DamagePlayerEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; +import mage.target.TargetPlayer; + +/** + * + * @author anonymous + */ +public class HarshJudgment extends CardImpl { + + public HarshJudgment(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}"); + + + // As Harsh Judgment enters the battlefield, choose a color. + this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit))); + + // If an instant or sorcery spell of the chosen color would deal damage to you, it deals that damage to its controller instead. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HarshJudgmentEffect())); + } + + public HarshJudgment(final HarshJudgment card) { + super(card); + } + + @Override + public HarshJudgment copy() { + return new HarshJudgment(this); + } +} + +class HarshJudgmentEffect extends RedirectionEffect { + + private static final FilterInstantOrSorceryCard instantOrSorceryFilter = new FilterInstantOrSorceryCard(); + + public HarshJudgmentEffect() { + super(Duration.WhileOnBattlefield); + staticText = "If an instant or sorcery spell of the chosen color would deal damage to you, it deals that damage to its controller instead"; + } + + public HarshJudgmentEffect(final HarshJudgmentEffect effect) { + super(effect); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if(event.getTargetId().equals(source.getControllerId())) { + Spell spell = null; + StackObject stackObject = game.getStack().getStackObject(event.getSourceId()); + if (stackObject == null) { + stackObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK); + } + if (stackObject instanceof Spell) { + spell = (Spell) stackObject; + } + //Checks if damage is from a sorcery or instants and spell is of chosen color + Permanent permanent = game.getPermanent(source.getSourceId()); + ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color"); + if (spell != null && instantOrSorceryFilter.match(spell.getCard(), game) && spell.getColor(game).contains(color)) { + TargetPlayer target = new TargetPlayer(); + target.add(spell.getControllerId(), game); + redirectTarget = target; + return true; + } + } + return false; + } + + @Override + public HarshJudgmentEffect copy() { + return new HarshJudgmentEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/h/HatchetBully.java b/Mage.Sets/src/mage/cards/h/HatchetBully.java index 6a1e5e78a5e..84787a811af 100644 --- a/Mage.Sets/src/mage/cards/h/HatchetBully.java +++ b/Mage.Sets/src/mage/cards/h/HatchetBully.java @@ -56,7 +56,7 @@ import mage.target.common.TargetCreatureOrPlayer; public class HatchetBully extends CardImpl { public HatchetBully(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.subtype.add("Goblin"); this.subtype.add("Warrior"); @@ -104,7 +104,7 @@ class HatchetBullyCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.M1M1.createInstance(), game); + permanent.addCounters(CounterType.M1M1.createInstance(), ability, game); this.paid = true; } return paid; @@ -117,7 +117,7 @@ class HatchetBullyCost extends CostImpl { } class HatchetBullyEffect extends OneShotEffect { - + public HatchetBullyEffect() { super(Outcome.Damage); staticText = "{this} deals 2 damage to target creature or player"; diff --git a/Mage.Sets/src/mage/cards/i/ImmaculateMagistrate.java b/Mage.Sets/src/mage/cards/i/ImmaculateMagistrate.java index 1ef151fd9fb..d1041acc7d8 100644 --- a/Mage.Sets/src/mage/cards/i/ImmaculateMagistrate.java +++ b/Mage.Sets/src/mage/cards/i/ImmaculateMagistrate.java @@ -103,7 +103,7 @@ class ImmaculateMagistrateEffect extends OneShotEffect { if (permanent != null) { int count = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); if (count > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(count), game); + permanent.addCounters(CounterType.P1P1.createInstance(count), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/i/IncreasingSavagery.java b/Mage.Sets/src/mage/cards/i/IncreasingSavagery.java index 2ff7bf31bd1..830f108161d 100644 --- a/Mage.Sets/src/mage/cards/i/IncreasingSavagery.java +++ b/Mage.Sets/src/mage/cards/i/IncreasingSavagery.java @@ -91,7 +91,7 @@ class IncreasingSavageryEffect extends OneShotEffect { } Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/i/IncrementalBlight.java b/Mage.Sets/src/mage/cards/i/IncrementalBlight.java index 150a56932e0..9c2401a85d7 100644 --- a/Mage.Sets/src/mage/cards/i/IncrementalBlight.java +++ b/Mage.Sets/src/mage/cards/i/IncrementalBlight.java @@ -105,7 +105,7 @@ class IncrementalBlightEffect extends OneShotEffect { i++; Permanent creature = game.getPermanent(target.getFirstTarget()); if (creature != null) { - creature.addCounters(CounterType.M1M1.createInstance(i), game); + creature.addCounters(CounterType.M1M1.createInstance(i), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/i/IncrementalGrowth.java b/Mage.Sets/src/mage/cards/i/IncrementalGrowth.java index 9e72dd90b73..cdea73d6e6f 100644 --- a/Mage.Sets/src/mage/cards/i/IncrementalGrowth.java +++ b/Mage.Sets/src/mage/cards/i/IncrementalGrowth.java @@ -106,7 +106,7 @@ class IncrementalGrowthEffect extends OneShotEffect { i++; Permanent creature = game.getPermanent(target.getFirstTarget()); if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(i), game); + creature.addCounters(CounterType.P1P1.createInstance(i), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/i/InsatiableRakghoul.java b/Mage.Sets/src/mage/cards/i/InsatiableRakghoul.java index f71b9c7658c..64f7ca19ff9 100644 --- a/Mage.Sets/src/mage/cards/i/InsatiableRakghoul.java +++ b/Mage.Sets/src/mage/cards/i/InsatiableRakghoul.java @@ -91,7 +91,7 @@ class InsatiableRakghoulEffect extends OneShotEffect { if (watcher != null && watcher.conditionMet()) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(1), game); + permanent.addCounters(CounterType.P1P1.createInstance(1), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/j/JaceTelepathUnbound.java b/Mage.Sets/src/mage/cards/j/JaceTelepathUnbound.java index f3525e7d143..c6fd34c9e08 100644 --- a/Mage.Sets/src/mage/cards/j/JaceTelepathUnbound.java +++ b/Mage.Sets/src/mage/cards/j/JaceTelepathUnbound.java @@ -67,7 +67,7 @@ import mage.target.targetpointer.FixedTarget; public class JaceTelepathUnbound extends CardImpl { public JaceTelepathUnbound(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},""); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, ""); this.subtype.add("Jace"); this.color.setBlue(true); @@ -207,7 +207,7 @@ class JaceTelepathUnboundEmblem extends Emblem { // You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard". public JaceTelepathUnboundEmblem() { - this.setName("Emblem - Jace"); + this.setName("Emblem Jace"); Effect effect = new PutTopCardOfLibraryIntoGraveTargetEffect(5); effect.setText("target opponent puts the top five cards of his or her library into his or her graveyard"); Ability ability = new SpellCastControllerTriggeredAbility(Zone.COMMAND, effect, new FilterSpell("a spell"), false, false); diff --git a/Mage.Sets/src/mage/cards/j/JaceUnravelerOfSecrets.java b/Mage.Sets/src/mage/cards/j/JaceUnravelerOfSecrets.java index c14b482cd28..947f4259387 100644 --- a/Mage.Sets/src/mage/cards/j/JaceUnravelerOfSecrets.java +++ b/Mage.Sets/src/mage/cards/j/JaceUnravelerOfSecrets.java @@ -59,7 +59,7 @@ import mage.watchers.common.SpellsCastWatcher; public class JaceUnravelerOfSecrets extends CardImpl { public JaceUnravelerOfSecrets(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{U}{U}"); this.subtype.add("Jace"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); @@ -99,7 +99,8 @@ public class JaceUnravelerOfSecrets extends CardImpl { class JaceUnravelerOfSecretsEmblem extends Emblem { public JaceUnravelerOfSecretsEmblem() { - this.setName("EMBLEM: Jace, Unraveler of Secrets"); + this.setName("Emblem Jace"); + setExpansionSetCodeForImage("SOI"); Effect effect = new CounterTargetEffect(); effect.setText("counter that spell"); this.getAbilities().add(new JaceUnravelerOfSecretsTriggeredAbility(effect, false)); diff --git a/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java b/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java index fc6cb51c7a7..7781c9216fb 100644 --- a/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java +++ b/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java @@ -118,7 +118,7 @@ class JhoiraOfTheGhituSuspendEffect extends OneShotEffect { UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.HAND, true)) { - card.addCounters(CounterType.TIME.createInstance(4), game); + card.addCounters(CounterType.TIME.createInstance(4), source, game); if (!hasSuspend) { game.addEffect(new GainSuspendEffect(new MageObjectReference(card, game)), source); } diff --git a/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java b/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java index ec2bc2cdc5c..e0335333e96 100644 --- a/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java +++ b/Mage.Sets/src/mage/cards/j/JhoirasTimebug.java @@ -106,7 +106,7 @@ class JhoirasTimebugEffect extends OneShotEffect { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null && permanent.getCounters(game).containsKey(CounterType.TIME)) { if (controller.chooseUse(Outcome.Benefit, "Add a time counter? (Otherwise remove one)", source, game)) { - permanent.addCounters(CounterType.TIME.createInstance(), game); + permanent.addCounters(CounterType.TIME.createInstance(), source, game); } else { permanent.removeCounters(CounterType.TIME.createInstance(), game); @@ -116,7 +116,7 @@ class JhoirasTimebugEffect extends OneShotEffect { Card card = game.getExile().getCard(this.getTargetPointer().getFirst(game, source), game); if (card != null) { if (controller.chooseUse(Outcome.Detriment, "Add a time counter? (Otherwise remove one)", source, game)) { - card.addCounters(CounterType.TIME.createInstance(), game); + card.addCounters(CounterType.TIME.createInstance(), source, game); } else { card.removeCounters(CounterType.TIME.createInstance(), game); diff --git a/Mage.Sets/src/mage/cards/k/KalonianHydra.java b/Mage.Sets/src/mage/cards/k/KalonianHydra.java index 48053dcd7c1..366914ba046 100644 --- a/Mage.Sets/src/mage/cards/k/KalonianHydra.java +++ b/Mage.Sets/src/mage/cards/k/KalonianHydra.java @@ -109,7 +109,7 @@ class KalonianHydraEffect extends OneShotEffect { for (Permanent permanent : permanents) { int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (existingCounters > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game); + permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/k/KavuPredator.java b/Mage.Sets/src/mage/cards/k/KavuPredator.java index 27c4a4c70a5..e9ca37dbe99 100644 --- a/Mage.Sets/src/mage/cards/k/KavuPredator.java +++ b/Mage.Sets/src/mage/cards/k/KavuPredator.java @@ -131,7 +131,7 @@ class KavuPredatorEffect extends OneShotEffect { if (permanent != null) { Integer gainedLife = (Integer) this.getValue("gainedLife"); if (gainedLife != null) { - permanent.addCounters(CounterType.P1P1.createInstance(gainedLife.intValue()), game); + permanent.addCounters(CounterType.P1P1.createInstance(gainedLife.intValue()), source, game); Player player = game.getPlayer(source.getControllerId()); if (player != null) { game.informPlayers(new StringBuilder(player.getLogName()).append(" puts ").append(gainedLife).append(" +1/+1 counter on ").append(permanent.getName()).toString()); diff --git a/Mage.Sets/src/mage/cards/k/KioraMasterOfTheDepths.java b/Mage.Sets/src/mage/cards/k/KioraMasterOfTheDepths.java index 43217f7a055..8aba71ab02e 100644 --- a/Mage.Sets/src/mage/cards/k/KioraMasterOfTheDepths.java +++ b/Mage.Sets/src/mage/cards/k/KioraMasterOfTheDepths.java @@ -67,7 +67,7 @@ import mage.target.common.TargetLandPermanent; public class KioraMasterOfTheDepths extends CardImpl { public KioraMasterOfTheDepths(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{G}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{G}{U}"); this.subtype.add("Kiora"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -203,7 +203,7 @@ class KioraMasterOfTheDepthsEmblem extends Emblem { private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures"); public KioraMasterOfTheDepthsEmblem() { - this.setName("EMBLEM: Kiora, Master of the Depths"); + this.setName("Emblem Kiora"); Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.COMMAND, new KioraFightEffect(), filter, true, SetTargetPointer.PERMANENT, diff --git a/Mage.Sets/src/mage/cards/k/KioraTheCrashingWave.java b/Mage.Sets/src/mage/cards/k/KioraTheCrashingWave.java index cefdd5ffc43..2c1e964fead 100644 --- a/Mage.Sets/src/mage/cards/k/KioraTheCrashingWave.java +++ b/Mage.Sets/src/mage/cards/k/KioraTheCrashingWave.java @@ -68,7 +68,7 @@ public class KioraTheCrashingWave extends CardImpl { } public KioraTheCrashingWave(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{G}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{G}{U}"); this.subtype.add("Kiora"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(2)); @@ -164,7 +164,7 @@ class KioraPreventionEffect extends PreventionEffectImpl { class KioraEmblem extends Emblem { public KioraEmblem() { - this.setName("EMBLEM: Kiora, the Crashing Wave"); + this.setName("Emblem Kiora"); Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new KioraKrakenToken()), TargetController.YOU, null, false); this.getAbilities().add(ability); } diff --git a/Mage.Sets/src/mage/cards/k/KothOfTheHammer.java b/Mage.Sets/src/mage/cards/k/KothOfTheHammer.java index 70fe2b0978c..474930fc33b 100644 --- a/Mage.Sets/src/mage/cards/k/KothOfTheHammer.java +++ b/Mage.Sets/src/mage/cards/k/KothOfTheHammer.java @@ -77,7 +77,7 @@ public class KothOfTheHammer extends CardImpl { } public KothOfTheHammer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{R}{R}"); this.subtype.add("Koth"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); @@ -122,7 +122,7 @@ class KothOfTheHammerEmblem extends Emblem { // "Mountains you control have '{T}: This land deals 1 damage to target creature or player.'" public KothOfTheHammerEmblem() { - this.setName("EMBLEM: Koth of the Hammer"); + this.setName("Emblem Koth"); this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new KothOfTheHammerThirdEffect())); } } diff --git a/Mage.Sets/src/mage/cards/k/KreshTheBloodbraided.java b/Mage.Sets/src/mage/cards/k/KreshTheBloodbraided.java index 54263f8010a..18404963335 100644 --- a/Mage.Sets/src/mage/cards/k/KreshTheBloodbraided.java +++ b/Mage.Sets/src/mage/cards/k/KreshTheBloodbraided.java @@ -89,7 +89,7 @@ class KreshTheBloodbraidedEffect extends OneShotEffect { if (permanent != null && kreshTheBloodbraided != null) { int amount = permanent.getPower().getValue(); if (amount > 0) { - kreshTheBloodbraided.addCounters(CounterType.P1P1.createInstance(amount), game); + kreshTheBloodbraided.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LeechBonder.java b/Mage.Sets/src/mage/cards/l/LeechBonder.java index 7395e9002c0..13b67c6d822 100644 --- a/Mage.Sets/src/mage/cards/l/LeechBonder.java +++ b/Mage.Sets/src/mage/cards/l/LeechBonder.java @@ -129,7 +129,7 @@ class LeechBonderEffect extends OneShotEffect { if (counterType != null) { Counter counter = counterType.createInstance(); fromPermanent.removeCounters(counter, game); - toPermanent.addCounters(counter, game); + toPermanent.addCounters(counter, source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/l/LieutenantsOfTheGuard.java b/Mage.Sets/src/mage/cards/l/LieutenantsOfTheGuard.java index 9f48fb32916..457d525a3cc 100644 --- a/Mage.Sets/src/mage/cards/l/LieutenantsOfTheGuard.java +++ b/Mage.Sets/src/mage/cards/l/LieutenantsOfTheGuard.java @@ -97,7 +97,7 @@ class LieutenantsOfTheGuardDilemmaEffect extends CouncilsDilemmaVoteEffect { //Strength Votes //If strength received zero votes or the permanent is no longer on the battlefield, do not attempt to put P1P1 counters on it. if (voteOneCount > 0 && permanent != null) - permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), game); + permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), source, game); //Numbers Votes if (voteTwoCount > 0) { diff --git a/Mage.Sets/src/mage/cards/l/LightningStorm.java b/Mage.Sets/src/mage/cards/l/LightningStorm.java index 363c602f6f0..9c856fcada2 100644 --- a/Mage.Sets/src/mage/cards/l/LightningStorm.java +++ b/Mage.Sets/src/mage/cards/l/LightningStorm.java @@ -140,7 +140,7 @@ class LightningStormAddCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { - spell.addCounters(CounterType.CHARGE.createInstance(2), game); + spell.addCounters(CounterType.CHARGE.createInstance(2), source, game); return spell.chooseNewTargets(game, ((ActivatedAbilityImpl) source).getActivatorId(), false, false, null); } return false; diff --git a/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java b/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java index 12c83e1da92..ac433f8daa2 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java +++ b/Mage.Sets/src/mage/cards/l/LilianaDefiantNecromancer.java @@ -74,7 +74,7 @@ public class LilianaDefiantNecromancer extends CardImpl { UUID ability2Id; public LilianaDefiantNecromancer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},""); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, ""); this.subtype.add("Liliana"); this.color.setBlack(true); @@ -128,7 +128,7 @@ class LilianaDefiantNecromancerEmblem extends Emblem { // You get an emblem with "Whenever a creature you control dies, return it to the battlefield under your control at the beginning of the next end step." public LilianaDefiantNecromancerEmblem() { - this.setName("Emblem - Liliana"); + this.setName("Emblem Liliana"); Ability ability = new DiesCreatureTriggeredAbility(Zone.COMMAND, new LilianaDefiantNecromancerEmblemEffect(), false, filter, true); this.getAbilities().add(ability); } diff --git a/Mage.Sets/src/mage/cards/l/LilianaOfTheDarkRealms.java b/Mage.Sets/src/mage/cards/l/LilianaOfTheDarkRealms.java index 67f89a5159c..96ec14246ab 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaOfTheDarkRealms.java +++ b/Mage.Sets/src/mage/cards/l/LilianaOfTheDarkRealms.java @@ -72,7 +72,7 @@ public class LilianaOfTheDarkRealms extends CardImpl { } public LilianaOfTheDarkRealms(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{B}"); this.subtype.add("Liliana"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); @@ -155,7 +155,7 @@ class LilianaOfTheDarkRealmsEmblem extends Emblem { } public LilianaOfTheDarkRealmsEmblem() { - this.setName("EMBLEM: Liliana of the Dark Realms"); + this.setName("Emblem Liliana"); SimpleManaAbility manaAbility = new SimpleManaAbility(Zone.BATTLEFIELD, Mana.BlackMana(4), new TapSourceCost()); Ability ability = new SimpleStaticAbility(Zone.COMMAND, new GainAbilityControlledEffect(manaAbility, Duration.WhileOnBattlefield, filter)); this.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/l/LilianaTheLastHope.java b/Mage.Sets/src/mage/cards/l/LilianaTheLastHope.java index e4b75f42aad..47a5ea95603 100644 --- a/Mage.Sets/src/mage/cards/l/LilianaTheLastHope.java +++ b/Mage.Sets/src/mage/cards/l/LilianaTheLastHope.java @@ -64,7 +64,7 @@ import mage.target.common.TargetCreaturePermanent; public class LilianaTheLastHope extends CardImpl { public LilianaTheLastHope(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{1}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{B}{B}"); this.subtype.add("Liliana"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); @@ -131,10 +131,11 @@ class LilianaTheLastHopeEffect extends OneShotEffect { return true; } } + class LilianaTheLastHopeEmblem extends Emblem { public LilianaTheLastHopeEmblem() { - this.setName("EMBLEM: Liliana, the Last Hope"); + this.setName("Emblem Liliana"); Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new ZombieToken(), new LilianaZombiesCount()), TargetController.YOU, null, false); this.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/l/LivingArmor.java b/Mage.Sets/src/mage/cards/l/LivingArmor.java index 868354f3088..4add97b25a4 100644 --- a/Mage.Sets/src/mage/cards/l/LivingArmor.java +++ b/Mage.Sets/src/mage/cards/l/LivingArmor.java @@ -89,7 +89,7 @@ public class LivingArmor extends CardImpl { Permanent creature = game.getPermanent(source.getTargets().getFirstTarget()); if (creature != null) { int amount = creature.getConvertedManaCost(); - creature.addCounters(new BoostCounter(0, 1, amount), game); + creature.addCounters(new BoostCounter(0, 1, amount), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LoamingShaman.java b/Mage.Sets/src/mage/cards/l/LoamingShaman.java index 8b50e4e2ce1..85430feb223 100644 --- a/Mage.Sets/src/mage/cards/l/LoamingShaman.java +++ b/Mage.Sets/src/mage/cards/l/LoamingShaman.java @@ -35,6 +35,8 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; @@ -51,7 +53,7 @@ import mage.target.common.TargetCardInGraveyard; public class LoamingShaman extends CardImpl { public LoamingShaman(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); this.subtype.add("Centaur"); this.subtype.add("Shaman"); @@ -95,12 +97,8 @@ class LoamingShamanEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { - for (UUID targetCard : source.getTargets().get(1).getTargets()) { - Card card = targetPlayer.getGraveyard().get(targetCard, game); - if (card != null) { - card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); - } - } + Cards cards = new CardsImpl(source.getTargets().get(1).getTargets()); + targetPlayer.moveCards(cards, Zone.LIBRARY, source, game); targetPlayer.shuffleLibrary(source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/l/LockjawSnapper.java b/Mage.Sets/src/mage/cards/l/LockjawSnapper.java index acbba6f4135..a37b5850ef3 100644 --- a/Mage.Sets/src/mage/cards/l/LockjawSnapper.java +++ b/Mage.Sets/src/mage/cards/l/LockjawSnapper.java @@ -99,7 +99,7 @@ class LockjawSnapperEffect extends OneShotEffect { } for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != null) { - creature.addCounters(CounterType.M1M1.createInstance(), game); + creature.addCounters(CounterType.M1M1.createInstance(), source, game); applied = true; } } diff --git a/Mage.Sets/src/mage/cards/l/LongRoadHome.java b/Mage.Sets/src/mage/cards/l/LongRoadHome.java index 93020099d55..5f39b599ece 100644 --- a/Mage.Sets/src/mage/cards/l/LongRoadHome.java +++ b/Mage.Sets/src/mage/cards/l/LongRoadHome.java @@ -189,7 +189,7 @@ class LongRoadHomeEntersBattlefieldEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); discard(); // use only once } return false; diff --git a/Mage.Sets/src/mage/cards/m/MasterBiomancer.java b/Mage.Sets/src/mage/cards/m/MasterBiomancer.java index e4e5bc9373d..7ca2e92b1cd 100644 --- a/Mage.Sets/src/mage/cards/m/MasterBiomancer.java +++ b/Mage.Sets/src/mage/cards/m/MasterBiomancer.java @@ -107,7 +107,7 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl { if (sourceCreature != null && creature != null) { int power = sourceCreature.getPower().getValue(); if (power > 0) { - creature.addCounters(CounterType.P1P1.createInstance(power), game); + creature.addCounters(CounterType.P1P1.createInstance(power), source, game); } ContinuousEffect effect = new AddCardSubTypeTargetEffect("Mutant", Duration.Custom); effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1)); diff --git a/Mage.Sets/src/mage/cards/m/MayaelsAria.java b/Mage.Sets/src/mage/cards/m/MayaelsAria.java index 5cdb5b921ca..966ac022bcc 100644 --- a/Mage.Sets/src/mage/cards/m/MayaelsAria.java +++ b/Mage.Sets/src/mage/cards/m/MayaelsAria.java @@ -97,7 +97,7 @@ class MayaelsAriaEffect extends OneShotEffect { filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 4)); if (game.getState().getBattlefield().countAll(filter, controller.getId(), game) > 0) { for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); } } game.applyEffects(); // needed because otehrwise the +1/+1 counters wouldn't be taken into account diff --git a/Mage.Sets/src/mage/cards/m/Meadowboon.java b/Mage.Sets/src/mage/cards/m/Meadowboon.java index 20c6432fd41..e25b5cd2dbd 100644 --- a/Mage.Sets/src/mage/cards/m/Meadowboon.java +++ b/Mage.Sets/src/mage/cards/m/Meadowboon.java @@ -91,7 +91,7 @@ class MeadowboonEffect extends OneShotEffect { Player target = game.getPlayer(source.getFirstTarget()); if (target != null) { for (Permanent p : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), target.getId(), game)) { - p.addCounters(CounterType.P1P1.createInstance(), game); + p.addCounters(CounterType.P1P1.createInstance(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/m/MessengerJays.java b/Mage.Sets/src/mage/cards/m/MessengerJays.java index 936c5845aea..dbbbd2172f6 100644 --- a/Mage.Sets/src/mage/cards/m/MessengerJays.java +++ b/Mage.Sets/src/mage/cards/m/MessengerJays.java @@ -99,7 +99,7 @@ class MessengerJaysDilemmaEffect extends CouncilsDilemmaVoteEffect { //Feathers Votes //If feathers received zero votes or the permanent is no longer on the battlefield, do not attempt to put P1P1 counter on it. if (voteOneCount > 0 && permanent != null) - permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), game); + permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), source, game); //Quill Votes //Only let the controller loot the appropriate amount of cards if it was voted for. diff --git a/Mage.Sets/src/mage/cards/m/MiraculousRecovery.java b/Mage.Sets/src/mage/cards/m/MiraculousRecovery.java index 6c120a48140..900e9535133 100644 --- a/Mage.Sets/src/mage/cards/m/MiraculousRecovery.java +++ b/Mage.Sets/src/mage/cards/m/MiraculousRecovery.java @@ -90,7 +90,7 @@ class MiraculousRecoveryEffect extends OneShotEffect { // targetPointer can't be used because target moved from graveyard to battlefield Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/n/NantukoCultivator.java b/Mage.Sets/src/mage/cards/n/NantukoCultivator.java index 986756da522..cd2fc28ffd2 100644 --- a/Mage.Sets/src/mage/cards/n/NantukoCultivator.java +++ b/Mage.Sets/src/mage/cards/n/NantukoCultivator.java @@ -91,7 +91,7 @@ class NantukoCultivatorEffect extends OneShotEffect { } Permanent permanent = game.getPermanent(source.getSourceId()); if(permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(count), game); + permanent.addCounters(CounterType.P1P1.createInstance(count), source, game); } player.drawCards(count, game); } diff --git a/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java b/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java index 9dea85ae55a..2565deb3f8c 100644 --- a/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java +++ b/Mage.Sets/src/mage/cards/n/NarsetTranscendent.java @@ -65,7 +65,7 @@ import mage.target.targetpointer.FixedTarget; public class NarsetTranscendent extends CardImpl { public NarsetTranscendent(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{U}"); this.subtype.add("Narset"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(6)); @@ -226,7 +226,7 @@ class NarsetTranscendentEmblem extends Emblem { public NarsetTranscendentEmblem() { - this.setName("EMBLEM: Narset Transcendent"); + this.setName("Emblem Narset"); this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new NarsetTranscendentCantCastEffect())); } diff --git a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java index 9a39d462141..e00bef79a60 100644 --- a/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java +++ b/Mage.Sets/src/mage/cards/n/NayaSoulbeast.java @@ -154,7 +154,7 @@ class NayaSoulbeastReplacementEffect extends ReplacementEffectImpl { Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent != null && object instanceof Integer) { int amount = ((Integer) object); - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/n/NecromanticSummons.java b/Mage.Sets/src/mage/cards/n/NecromanticSummons.java index 9ac60153b86..37488529406 100644 --- a/Mage.Sets/src/mage/cards/n/NecromanticSummons.java +++ b/Mage.Sets/src/mage/cards/n/NecromanticSummons.java @@ -93,7 +93,7 @@ class NecromanticSummoningEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(2), game); + permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/n/NightDealings.java b/Mage.Sets/src/mage/cards/n/NightDealings.java index 20f6004ebaf..0e9aad970a3 100644 --- a/Mage.Sets/src/mage/cards/n/NightDealings.java +++ b/Mage.Sets/src/mage/cards/n/NightDealings.java @@ -143,7 +143,7 @@ public class NightDealings extends CardImpl { if (damageAmount != null) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.addCounters(CounterType.THEFT.createInstance(damageAmount), game); + permanent.addCounters(CounterType.THEFT.createInstance(damageAmount), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NissaVitalForce.java b/Mage.Sets/src/mage/cards/n/NissaVitalForce.java index 63ac479e12e..1d7efabcce1 100644 --- a/Mage.Sets/src/mage/cards/n/NissaVitalForce.java +++ b/Mage.Sets/src/mage/cards/n/NissaVitalForce.java @@ -67,7 +67,7 @@ public class NissaVitalForce extends CardImpl { } public NissaVitalForce(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{G}{G}"); this.subtype.add("Nissa"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); @@ -114,9 +114,9 @@ class NissaVitalForceEmblem extends Emblem { // You get an emblem with "Whenever a land enters the battlefield under your control, you may draw a card." public NissaVitalForceEmblem() { - this.setName("Emblem - Nissa, Vital Force"); - Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.COMMAND, new DrawCardSourceControllerEffect(1), new FilterControlledLandPermanent("a land"), + this.setName("Emblem Nissa"); + Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.COMMAND, new DrawCardSourceControllerEffect(1), new FilterControlledLandPermanent("a land"), true, null, true); - getAbilities().add(ability); + getAbilities().add(ability); } } diff --git a/Mage.Sets/src/mage/cards/n/NovijenHeartOfProgress.java b/Mage.Sets/src/mage/cards/n/NovijenHeartOfProgress.java index 083f8ebb8b6..7c38281d694 100644 --- a/Mage.Sets/src/mage/cards/n/NovijenHeartOfProgress.java +++ b/Mage.Sets/src/mage/cards/n/NovijenHeartOfProgress.java @@ -97,7 +97,7 @@ class NovijenHeartOfProgressEffect extends OneShotEffect { if (controller != null && sourceObject != null) { for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { if (permanent.getTurnsOnBattlefield() == 0) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); game.informPlayers(sourceObject.getLogName()+ ": " + controller.getLogName() + " puts a +1/+1 counter on " + permanent.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/o/OathOfGideon.java b/Mage.Sets/src/mage/cards/o/OathOfGideon.java index 36896055922..8a401481565 100644 --- a/Mage.Sets/src/mage/cards/o/OathOfGideon.java +++ b/Mage.Sets/src/mage/cards/o/OathOfGideon.java @@ -106,7 +106,7 @@ class OathOfGideonReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { - creature.addCounters(CounterType.LOYALTY.createInstance(), game); + creature.addCounters(CounterType.LOYALTY.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java b/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java index f0530b90f4d..5ad73cae2df 100644 --- a/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java +++ b/Mage.Sets/src/mage/cards/o/ObNixilisOfTheBlackOath.java @@ -62,7 +62,7 @@ import mage.target.common.TargetControlledCreaturePermanent; public class ObNixilisOfTheBlackOath extends CardImpl { public ObNixilisOfTheBlackOath(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{B}{B}"); this.subtype.add("Nixilis"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); @@ -131,9 +131,8 @@ class ObNixilisOfTheBlackOathEffect1 extends OneShotEffect { class ObNixilisOfTheBlackOathEmblem extends Emblem { // You get an emblem with "{1}{B}, Sacrifice a creature: You gain X life and draw X cards, where X is the sacrificed creature's power." - public ObNixilisOfTheBlackOathEmblem() { - this.setName("EMBLEM: Ob Nixilis of the Black Oath"); + this.setName("Emblem Nixilis"); DynamicValue xValue = new SacrificeCostCreaturesPower(); Effect effect = new GainLifeEffect(xValue); effect.setText("You gain X life"); diff --git a/Mage.Sets/src/mage/cards/o/ObNixilisReignited.java b/Mage.Sets/src/mage/cards/o/ObNixilisReignited.java index d5e94d21830..0ff4300421c 100644 --- a/Mage.Sets/src/mage/cards/o/ObNixilisReignited.java +++ b/Mage.Sets/src/mage/cards/o/ObNixilisReignited.java @@ -54,7 +54,7 @@ import mage.target.common.TargetOpponent; public class ObNixilisReignited extends CardImpl { public ObNixilisReignited(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{B}{B}"); this.subtype.add("Nixilis"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); @@ -94,7 +94,7 @@ public class ObNixilisReignited extends CardImpl { class ObNixilisReignitedEmblem extends Emblem { public ObNixilisReignitedEmblem() { - setName("EMBLEM: Ob Nixilis Reignited"); + setName("Emblem Nixilis"); this.getAbilities().add(new ObNixilisEmblemTriggeredAbility(new LoseLifeSourceControllerEffect(2), false)); this.setExpansionSetCodeForImage("BFZ"); diff --git a/Mage.Sets/src/mage/cards/o/ObiWanKenobi.java b/Mage.Sets/src/mage/cards/o/ObiWanKenobi.java index ca6232defeb..23803932888 100644 --- a/Mage.Sets/src/mage/cards/o/ObiWanKenobi.java +++ b/Mage.Sets/src/mage/cards/o/ObiWanKenobi.java @@ -1,112 +1,113 @@ -/* - * 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.cards.o; - -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.LoyaltyAbility; -import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.GetEmblemEffect; -import mage.abilities.effects.common.TapTargetEffect; -import mage.abilities.effects.common.continuous.BoostControlledEffect; -import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; -import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; -import mage.abilities.effects.common.continuous.GainProtectionFromColorTargetEffect; -import mage.abilities.keyword.FirstStrikeAbility; -import mage.abilities.keyword.LifelinkAbility; -import mage.abilities.keyword.VigilanceAbility; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Zone; -import mage.game.command.Emblem; -import mage.target.common.TargetCreaturePermanent; - -/** - * - * @author Styxo - */ -public class ObiWanKenobi extends CardImpl { - - public ObiWanKenobi(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{W}{U}"); - this.subtype.add("Obi-Wan"); - - this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); - - // +1:Up to one target creature you control gains vigilance and protection from color of your choice until end of turn. - Effect effect = new GainAbilityTargetEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn); - effect.setText("Up to one target creature you control gains vigilance"); - Ability ability = new LoyaltyAbility(effect, +1); - effect = new GainProtectionFromColorTargetEffect(Duration.EndOfTurn); - effect.setText("and protection from color of your choice until end of turn"); - ability.addEffect(effect); - ability.addTarget(new TargetCreaturePermanent(0, 1)); - this.addAbility(ability); - - // -1:Tap up to three target creatures. - ability = new LoyaltyAbility(new TapTargetEffect(), -1); - ability.addTarget(new TargetCreaturePermanent(0, 3)); - this.addAbility(ability); - - // -7:You get emblem with "Creatures you control get +1/+1 and have vigilance, first strike, and lifelink." - this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new ObiWanKenobiEmblem()), -7)); - - } - - public ObiWanKenobi(final ObiWanKenobi card) { - super(card); - } - - @Override - public ObiWanKenobi copy() { - return new ObiWanKenobi(this); - } -} - -class ObiWanKenobiEmblem extends Emblem { - - // Creatures you control get +1/+1 and have vigilance, first strike, and lifelink - public ObiWanKenobiEmblem() { - this.setName("Emblem - Obi-Wan"); - Ability ability = new SimpleStaticAbility(Zone.COMMAND, new BoostControlledEffect(1, 1, Duration.EndOfGame)); - Effect effect = new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfGame); - effect.setText("and have vigilance,"); - ability.addEffect(effect); - effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield); - effect.setText("first strike,"); - ability.addEffect(effect); - effect = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.WhileOnBattlefield); - effect.setText("and lifelink."); - ability.addEffect(effect); - getAbilities().add(ability); - } -} +/* + * 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.cards.o; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.GetEmblemEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.continuous.GainProtectionFromColorTargetEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; +import mage.game.command.Emblem; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Styxo + */ +public class ObiWanKenobi extends CardImpl { + + public ObiWanKenobi(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{W}{U}"); + this.subtype.add("Obi-Wan"); + + this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); + + // +1:Up to one target creature you control gains vigilance and protection from color of your choice until end of turn. + Effect effect = new GainAbilityTargetEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn); + effect.setText("Up to one target creature you control gains vigilance"); + Ability ability = new LoyaltyAbility(effect, +1); + effect = new GainProtectionFromColorTargetEffect(Duration.EndOfTurn); + effect.setText("and protection from color of your choice until end of turn"); + ability.addEffect(effect); + ability.addTarget(new TargetCreaturePermanent(0, 1)); + this.addAbility(ability); + + // -1:Tap up to three target creatures. + ability = new LoyaltyAbility(new TapTargetEffect(), -1); + ability.addTarget(new TargetCreaturePermanent(0, 3)); + this.addAbility(ability); + + // -7:You get emblem with "Creatures you control get +1/+1 and have vigilance, first strike, and lifelink." + this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new ObiWanKenobiEmblem()), -7)); + + } + + public ObiWanKenobi(final ObiWanKenobi card) { + super(card); + } + + @Override + public ObiWanKenobi copy() { + return new ObiWanKenobi(this); + } +} + +class ObiWanKenobiEmblem extends Emblem { + + // Creatures you control get +1/+1 and have vigilance, first strike, and lifelink + public ObiWanKenobiEmblem() { + this.setName("Emblem Obi-Wan Kenobi"); + this.setExpansionSetCodeForImage("SWS"); + Ability ability = new SimpleStaticAbility(Zone.COMMAND, new BoostControlledEffect(1, 1, Duration.EndOfGame)); + Effect effect = new GainAbilityControlledEffect(VigilanceAbility.getInstance(), Duration.EndOfGame); + effect.setText("and have vigilance"); + ability.addEffect(effect); + effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield); + effect.setText(", first strike"); + ability.addEffect(effect); + effect = new GainAbilityControlledEffect(LifelinkAbility.getInstance(), Duration.WhileOnBattlefield); + effect.setText("and lifelink."); + ability.addEffect(effect); + getAbilities().add(ability); + } +} diff --git a/Mage.Sets/src/mage/cards/o/OonasBlackguard.java b/Mage.Sets/src/mage/cards/o/OonasBlackguard.java index 3083b5abef5..6cce1b2edaa 100644 --- a/Mage.Sets/src/mage/cards/o/OonasBlackguard.java +++ b/Mage.Sets/src/mage/cards/o/OonasBlackguard.java @@ -121,7 +121,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/o/OpalPalace.java b/Mage.Sets/src/mage/cards/o/OpalPalace.java index 3e4ff98dee2..09c48fda378 100644 --- a/Mage.Sets/src/mage/cards/o/OpalPalace.java +++ b/Mage.Sets/src/mage/cards/o/OpalPalace.java @@ -167,7 +167,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl { if (permanent != null) { Integer castCount = (Integer) game.getState().getValue(permanent.getId() + "_castCount"); if (castCount != null && castCount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(castCount), game); + permanent.addCounters(CounterType.P1P1.createInstance(castCount), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/o/OranRiefHydra.java b/Mage.Sets/src/mage/cards/o/OranRiefHydra.java index 3e028a904ab..3c38d42aadd 100644 --- a/Mage.Sets/src/mage/cards/o/OranRiefHydra.java +++ b/Mage.Sets/src/mage/cards/o/OranRiefHydra.java @@ -144,9 +144,9 @@ class OranRiefHydraEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (land != null && sourcePermanent != null) { if (land.hasSubtype("Forest", game)) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(2), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(2), source, game); } else { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/o/OranRiefTheVastwood.java b/Mage.Sets/src/mage/cards/o/OranRiefTheVastwood.java index 1b2ff06c539..a55dcfb3dce 100644 --- a/Mage.Sets/src/mage/cards/o/OranRiefTheVastwood.java +++ b/Mage.Sets/src/mage/cards/o/OranRiefTheVastwood.java @@ -95,7 +95,7 @@ class OranRiefTheVastwoodEffect extends OneShotEffect { filter.add(new ColorPredicate(ObjectColor.GREEN)); for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (permanent.getTurnsOnBattlefield() == 0) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/o/OrchardElemental.java b/Mage.Sets/src/mage/cards/o/OrchardElemental.java index b53fc6c72b2..80b08929440 100644 --- a/Mage.Sets/src/mage/cards/o/OrchardElemental.java +++ b/Mage.Sets/src/mage/cards/o/OrchardElemental.java @@ -95,7 +95,7 @@ class OrchardElementalDilemmaEffect extends CouncilsDilemmaVoteEffect { //Sprout Votes //If sprout received zero votes or the permanent is no longer on the battlefield, do not attempt to put P1P1 counter on it. if (voteOneCount > 0 && permanent != null) - permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount * 2), game); + permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount * 2), source, game); //Harvest Votes if (voteTwoCount > 0) { diff --git a/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java b/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java index a37b2a7f22e..f9120163a9e 100644 --- a/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java +++ b/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java @@ -117,7 +117,7 @@ class OrzhovAdvokistEffect extends OneShotEffect { for (UUID creatureId : creatures) { Permanent creature = game.getPermanent(creatureId); if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(2), game); + creature.addCounters(CounterType.P1P1.createInstance(2), source, game); } } for (UUID playerId : players) { diff --git a/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java b/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java index 9be41228273..0523be13eab 100644 --- a/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java +++ b/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java @@ -184,7 +184,7 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); discard(); // use only once } return false; diff --git a/Mage.Sets/src/mage/cards/p/PardicDragon.java b/Mage.Sets/src/mage/cards/p/PardicDragon.java index 0f540eae199..d80d1646489 100644 --- a/Mage.Sets/src/mage/cards/p/PardicDragon.java +++ b/Mage.Sets/src/mage/cards/p/PardicDragon.java @@ -114,7 +114,7 @@ class PardicDragonEffect extends OneShotEffect { Card sourceCard = game.getCard(source.getSourceId()); if (opponent != null && sourceCard != null) { if (opponent.chooseUse(outcome, new StringBuilder("Put a time counter on ").append(sourceCard.getName()).append("?").toString(), source, game)) { - sourceCard.addCounters(CounterType.TIME.createInstance(), game); + sourceCard.addCounters(CounterType.TIME.createInstance(), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PatronOfTheValiant.java b/Mage.Sets/src/mage/cards/p/PatronOfTheValiant.java index 5b6aeedba87..ae91a31980f 100644 --- a/Mage.Sets/src/mage/cards/p/PatronOfTheValiant.java +++ b/Mage.Sets/src/mage/cards/p/PatronOfTheValiant.java @@ -102,7 +102,7 @@ class PatronOfTheValiantEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { for(Permanent permanent: game.getState().getBattlefield().getAllActivePermanents(filter , controller.getId(), game)) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); game.informPlayers(sourceObject.getName() + ": Put a +1/+1 counter on " + permanent.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/p/PhylacteryLich.java b/Mage.Sets/src/mage/cards/p/PhylacteryLich.java index 392a6f47914..e3de400aa76 100644 --- a/Mage.Sets/src/mage/cards/p/PhylacteryLich.java +++ b/Mage.Sets/src/mage/cards/p/PhylacteryLich.java @@ -141,7 +141,7 @@ class PhylacteryLichEffect extends OneShotEffect { if (player.choose(Outcome.Neutral, target, source.getSourceId(), game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.addCounters(new Counter("phylactery"), game); + permanent.addCounters(new Counter("phylactery"), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java b/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java index 162b436ea65..240eb09f6b8 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianHydra.java @@ -105,7 +105,7 @@ class PhyrexianHydraEffect extends PreventionEffectImpl { } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.addCounters(CounterType.M1M1.createInstance(damage), game); + permanent.addCounters(CounterType.M1M1.createInstance(damage), source, game); } return retValue; } diff --git a/Mage.Sets/src/mage/cards/p/Phytohydra.java b/Mage.Sets/src/mage/cards/p/Phytohydra.java index 0a62331ae13..f1686ecceb8 100644 --- a/Mage.Sets/src/mage/cards/p/Phytohydra.java +++ b/Mage.Sets/src/mage/cards/p/Phytohydra.java @@ -86,7 +86,7 @@ class PhytohydraEffect extends ReplacementEffectImpl { DamageCreatureEvent damageEvent = (DamageCreatureEvent) event; Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - p.addCounters(CounterType.P1P1.createInstance(damageEvent.getAmount()), game); + p.addCounters(CounterType.P1P1.createInstance(damageEvent.getAmount()), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PrimalInstinct.java b/Mage.Sets/src/mage/cards/p/PrimalInstinct.java index 1e424e4e95a..199f85b0d64 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalInstinct.java +++ b/Mage.Sets/src/mage/cards/p/PrimalInstinct.java @@ -81,10 +81,10 @@ class PrimalInstictEffect extends OneShotEffect { if (controller != null) { Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (target != null) { - target.addCounters(CounterType.P1P1.createInstance(), game); + target.addCounters(CounterType.P1P1.createInstance(), source, game); int addCounterCount = target.getCounters(game).getCount(CounterType.P1P1); game.informPlayers("Counters " + addCounterCount); - target.addCounters(CounterType.P1P1.createInstance(addCounterCount), game); + target.addCounters(CounterType.P1P1.createInstance(addCounterCount), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/p/PrimordialHydra.java b/Mage.Sets/src/mage/cards/p/PrimordialHydra.java index 705defb2f96..767c394a4c8 100644 --- a/Mage.Sets/src/mage/cards/p/PrimordialHydra.java +++ b/Mage.Sets/src/mage/cards/p/PrimordialHydra.java @@ -104,7 +104,7 @@ class PrimordialHydraDoubleEffect extends OneShotEffect { if (sourcePermanent != null) { int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(amount), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PyrrhicRevival.java b/Mage.Sets/src/mage/cards/p/PyrrhicRevival.java index fde0fddb3f0..cd0a150db05 100644 --- a/Mage.Sets/src/mage/cards/p/PyrrhicRevival.java +++ b/Mage.Sets/src/mage/cards/p/PyrrhicRevival.java @@ -95,7 +95,7 @@ class PyrrhicRevivalEffect extends OneShotEffect { if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), card.getOwnerId(), false)) { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { - permanent.addCounters(CounterType.M1M1.createInstance(), game); + permanent.addCounters(CounterType.M1M1.createInstance(), source, game); } result = true; } diff --git a/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java b/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java index be5b3d81cbf..01f79cbdc39 100644 --- a/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java +++ b/Mage.Sets/src/mage/cards/q/QuestForUlasTemple.java @@ -107,7 +107,7 @@ class QuestForUlasTempleEffect extends OneShotEffect { controller.revealCards(sourcePermanent.getName(), cards, game); Permanent questForUlasTemple = game.getPermanent(source.getSourceId()); if (questForUlasTemple != null) { - questForUlasTemple.addCounters(CounterType.QUEST.createInstance(), game); + questForUlasTemple.addCounters(CounterType.QUEST.createInstance(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/r/Recuperate.java b/Mage.Sets/src/mage/cards/r/Recuperate.java index 2306ee8326d..7d0c69e8749 100644 --- a/Mage.Sets/src/mage/cards/r/Recuperate.java +++ b/Mage.Sets/src/mage/cards/r/Recuperate.java @@ -29,18 +29,18 @@ package mage.cards.r; import java.util.UUID; import mage.abilities.Mode; -import mage.abilities.effects.common.GainLifeTargetEffect; +import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.PreventDamageToTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.target.TargetPlayer; import mage.target.common.TargetCreaturePermanent; /** * * @author LoneFox + * @author DimitarK */ public class Recuperate extends CardImpl { @@ -48,8 +48,7 @@ public class Recuperate extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{W}"); // Choose one - You gain 6 life; - this.getSpellAbility().addEffect(new GainLifeTargetEffect(6)); - this.getSpellAbility().addTarget(new TargetPlayer()); + this.getSpellAbility().addEffect(new GainLifeEffect(6)); // or prevent the next 6 damage that would be dealt to target creature this turn. Mode mode = new Mode(); mode.getEffects().add(new PreventDamageToTargetEffect(Duration.EndOfTurn, 6)); diff --git a/Mage.Sets/src/mage/cards/s/SageOfFables.java b/Mage.Sets/src/mage/cards/s/SageOfFables.java index fe352e21534..df9d74c49be 100644 --- a/Mage.Sets/src/mage/cards/s/SageOfFables.java +++ b/Mage.Sets/src/mage/cards/s/SageOfFables.java @@ -115,7 +115,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java b/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java index a0efd13ed5c..e2d398855d6 100644 --- a/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java +++ b/Mage.Sets/src/mage/cards/s/SarkhanTheDragonspeaker.java @@ -65,7 +65,7 @@ import mage.target.common.TargetCreaturePermanent; public class SarkhanTheDragonspeaker extends CardImpl { public SarkhanTheDragonspeaker(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{R}{R}"); this.subtype.add("Sarkhan"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -166,7 +166,7 @@ class SarkhanTheDragonspeakerEffect extends ContinuousEffectImpl { class SarkhanTheDragonspeakerEmblem extends Emblem { SarkhanTheDragonspeakerEmblem() { - setName("EMBLEM: Sarkhan, the Dragonspeaker"); + setName("Emblem Sarkhan"); this.setExpansionSetCodeForImage("KTK"); this.getAbilities().add(new BeginningOfDrawTriggeredAbility(Zone.COMMAND, new DrawCardSourceControllerEffect(2), TargetController.YOU, false)); diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index 5eeac87a739..645a1bf1bd1 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -316,7 +316,7 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); } discard(); return false; diff --git a/Mage.Sets/src/mage/cards/s/ScaleBlessing.java b/Mage.Sets/src/mage/cards/s/ScaleBlessing.java index 59663bd7c3c..e354df9011f 100644 --- a/Mage.Sets/src/mage/cards/s/ScaleBlessing.java +++ b/Mage.Sets/src/mage/cards/s/ScaleBlessing.java @@ -99,7 +99,7 @@ class ScaleBlessingEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { for(Permanent permanent: game.getState().getBattlefield().getAllActivePermanents(filter , controller.getId(), game)) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); game.informPlayers(sourceObject.getName() + ": Put a +1/+1 counter on " + permanent.getLogName()); } } diff --git a/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java b/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java index 57b09dbc31e..5f2227cf53c 100644 --- a/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java +++ b/Mage.Sets/src/mage/cards/s/ScarscaleRitual.java @@ -51,7 +51,7 @@ import mage.target.common.TargetControlledCreaturePermanent; public class ScarscaleRitual extends CardImpl { public ScarscaleRitual(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U/B}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U/B}"); // As an additional cost to cast Scarscale Ritual, put a -1/-1 counter on a creature you control. this.getSpellAbility().addCost(new ScarscaleRitualCost()); @@ -98,7 +98,7 @@ class ScarscaleRitualCost extends CostImpl { controller.chooseTarget(Outcome.UnboostCreature, target, ability, game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.M1M1.createInstance(), game); + permanent.addCounters(CounterType.M1M1.createInstance(), ability, game); game.informPlayers(controller.getLogName() + " puts a -1/-1 counter on " + permanent.getLogName()); this.paid = true; } diff --git a/Mage.Sets/src/mage/cards/s/ScavengingOoze.java b/Mage.Sets/src/mage/cards/s/ScavengingOoze.java index 9befe21d9ef..edf2930bc95 100644 --- a/Mage.Sets/src/mage/cards/s/ScavengingOoze.java +++ b/Mage.Sets/src/mage/cards/s/ScavengingOoze.java @@ -99,7 +99,7 @@ class ScavengingOozeEffect extends OneShotEffect { if (card.getCardType().contains(CardType.CREATURE)) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); } controller.gainLife(1, game); } diff --git a/Mage.Sets/src/mage/cards/s/SelvalasEnforcer.java b/Mage.Sets/src/mage/cards/s/SelvalasEnforcer.java index 82156b2a8ae..ab944114f6e 100644 --- a/Mage.Sets/src/mage/cards/s/SelvalasEnforcer.java +++ b/Mage.Sets/src/mage/cards/s/SelvalasEnforcer.java @@ -100,7 +100,7 @@ class SelvalasEnforcerEffect extends OneShotEffect { if (parley > 0) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(parley), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(parley), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/s/ShelteringAncient.java b/Mage.Sets/src/mage/cards/s/ShelteringAncient.java index 6398a7176a1..8060c9eef27 100644 --- a/Mage.Sets/src/mage/cards/s/ShelteringAncient.java +++ b/Mage.Sets/src/mage/cards/s/ShelteringAncient.java @@ -55,14 +55,14 @@ import mage.target.common.TargetCreaturePermanent; public class ShelteringAncient extends CardImpl { public ShelteringAncient(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); this.subtype.add("Treefolk"); this.power = new MageInt(5); this.toughness = new MageInt(5); // Trample this.addAbility(TrampleAbility.getInstance()); - + // Cumulative upkeep-Put a +1/+1 counter on a creature an opponent controls. this.addAbility(new CumulativeUpkeepAbility(new ShelteringAncientCost())); } @@ -78,12 +78,13 @@ public class ShelteringAncient extends CardImpl { } class ShelteringAncientCost extends CostImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + static { filter.add(new ControllerPredicate(TargetController.OPPONENT)); } - + ShelteringAncientCost() { this.text = "Put a +1/+1 counter on a creature an opponent controls"; } @@ -96,7 +97,7 @@ class ShelteringAncientCost extends CostImpl { if (target.choose(Outcome.BoostCreature, controllerId, sourceId, game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), ability, game); this.paid = true; return true; } diff --git a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java index 02cfa17aa04..0e6b52f7722 100644 --- a/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java +++ b/Mage.Sets/src/mage/cards/s/ShimatsuTheBloodcloaked.java @@ -122,7 +122,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl { return false; } } - creature.addCounters(CounterType.P1P1.createInstance(sacrificedCreatures), game); + creature.addCounters(CounterType.P1P1.createInstance(sacrificedCreatures), source, game); } } return false; diff --git a/Mage.Sets/src/mage/cards/s/ShowOfDominance.java b/Mage.Sets/src/mage/cards/s/ShowOfDominance.java index 73351f7643b..bd5725252e4 100644 --- a/Mage.Sets/src/mage/cards/s/ShowOfDominance.java +++ b/Mage.Sets/src/mage/cards/s/ShowOfDominance.java @@ -1,136 +1,136 @@ -/* - * 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.cards.s; - -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.effects.ContinuousEffect; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; -import mage.abilities.effects.common.counter.AddCountersTargetEffect; -import mage.abilities.keyword.TrampleAbility; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.counters.CounterType; -import mage.filter.Filter; -import mage.filter.FilterPermanent; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.PowerPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.Target; -import mage.target.TargetPermanent; -import mage.target.targetpointer.FixedTarget; - -/** - * - * @author Styxo - */ -public class ShowOfDominance extends CardImpl { - - public ShowOfDominance(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{G}"); - - // Put four +1/+1 counters on the creature with the highest power. If two or more creatures are tied for the greatest power, you choose one of them. That creature gains trample. - this.getSpellAbility().addEffect(new ShowOfDominanceEffect()); - } - - public ShowOfDominance(final ShowOfDominance card) { - super(card); - } - - @Override - public ShowOfDominance copy() { - return new ShowOfDominance(this); - } -} - -class ShowOfDominanceEffect extends OneShotEffect { - - public ShowOfDominanceEffect() { - super(Outcome.BoostCreature); - this.staticText = "Put four +1/+1 counters on the creature with the highest power. If two or more creatures are tied for the greatest power, you choose one of them. That creature gains trample until end of turn"; - } - - public ShowOfDominanceEffect(final ShowOfDominanceEffect effect) { - super(effect); - } - - @Override - public ShowOfDominanceEffect copy() { - return new ShowOfDominanceEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - int highestPower = Integer.MIN_VALUE; - Permanent selectedCreature = null; - for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), controller.getId(), game)) { - if (highestPower < permanent.getPower().getValue()) { - highestPower = permanent.getPower().getValue(); - selectedCreature = permanent; - } else if (highestPower == permanent.getPower().getValue()) { - highestPower = permanent.getToughness().getValue(); - selectedCreature = null; - } - } - if (highestPower != Integer.MIN_VALUE) { - if (selectedCreature == null) { - FilterPermanent filter = new FilterCreaturePermanent("creature with power " + highestPower); - filter.add(new PowerPredicate(Filter.ComparisonType.Equal, highestPower)); - Target target = new TargetPermanent(1, 1, filter, true); - if (controller.chooseTarget(outcome, target, source, game)) { - selectedCreature = game.getPermanent(target.getFirstTarget()); - } - } - if (selectedCreature != null) { - FixedTarget target = new FixedTarget(selectedCreature.getId()); - - Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(4)); - effect.setTargetPointer(target); - effect.apply(game, source); - - ContinuousEffect continuousEffect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); - continuousEffect.setTargetPointer(target); - game.addEffect(continuousEffect, source); - return true; - } - } - return true; - } - return false; - } - -} +/* + * 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.cards.s; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.filter.Filter; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author Styxo + */ +public class ShowOfDominance extends CardImpl { + + public ShowOfDominance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}"); + + // Put four +1/+1 counters on the creature with the highest power. If two or more creatures are tied for the greatest power, you choose one of them. That creature gains trample. + this.getSpellAbility().addEffect(new ShowOfDominanceEffect()); + } + + public ShowOfDominance(final ShowOfDominance card) { + super(card); + } + + @Override + public ShowOfDominance copy() { + return new ShowOfDominance(this); + } +} + +class ShowOfDominanceEffect extends OneShotEffect { + + public ShowOfDominanceEffect() { + super(Outcome.BoostCreature); + this.staticText = "Put four +1/+1 counters on the creature with the highest power. If two or more creatures are tied for the greatest power, you choose one of them. That creature gains trample until end of turn"; + } + + public ShowOfDominanceEffect(final ShowOfDominanceEffect effect) { + super(effect); + } + + @Override + public ShowOfDominanceEffect copy() { + return new ShowOfDominanceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int highestPower = Integer.MIN_VALUE; + Permanent selectedCreature = null; + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), controller.getId(), game)) { + if (highestPower < permanent.getPower().getValue()) { + highestPower = permanent.getPower().getValue(); + selectedCreature = permanent; + } else if (highestPower == permanent.getPower().getValue()) { + highestPower = permanent.getPower().getValue(); + selectedCreature = null; + } + } + if (highestPower != Integer.MIN_VALUE) { + if (selectedCreature == null) { + FilterPermanent filter = new FilterCreaturePermanent("creature with power " + highestPower); + filter.add(new PowerPredicate(Filter.ComparisonType.Equal, highestPower)); + Target target = new TargetPermanent(1, 1, filter, true); + if (controller.chooseTarget(outcome, target, source, game)) { + selectedCreature = game.getPermanent(target.getFirstTarget()); + } + } + if (selectedCreature != null) { + FixedTarget target = new FixedTarget(selectedCreature.getId()); + + Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(4)); + effect.setTargetPointer(target); + effect.apply(game, source); + + ContinuousEffect continuousEffect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); + continuousEffect.setTargetPointer(target); + game.addEffect(continuousEffect, source); + return true; + } + } + return true; + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/cards/s/SimicFluxmage.java b/Mage.Sets/src/mage/cards/s/SimicFluxmage.java index 4eac0373d49..3e2ada4c333 100644 --- a/Mage.Sets/src/mage/cards/s/SimicFluxmage.java +++ b/Mage.Sets/src/mage/cards/s/SimicFluxmage.java @@ -104,7 +104,7 @@ class MoveCounterFromSourceToTargetEffect extends OneShotEffect { Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); if (targetPermanent != null) { sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), game); - targetPermanent.addCounters(CounterType.P1P1.createInstance(), game); + targetPermanent.addCounters(CounterType.P1P1.createInstance(), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/SimicGuildmage.java b/Mage.Sets/src/mage/cards/s/SimicGuildmage.java index c0f7afab4b2..5b84b88ce18 100644 --- a/Mage.Sets/src/mage/cards/s/SimicGuildmage.java +++ b/Mage.Sets/src/mage/cards/s/SimicGuildmage.java @@ -140,7 +140,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { return false; } fromPermanent.removeCounters(CounterType.P1P1.createInstance(1), game); - toPermanent.addCounters(CounterType.P1P1.createInstance(1), game); + toPermanent.addCounters(CounterType.P1P1.createInstance(1), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SithLord.java b/Mage.Sets/src/mage/cards/s/SithLord.java index 1d943531b2c..ad00c69e3f3 100644 --- a/Mage.Sets/src/mage/cards/s/SithLord.java +++ b/Mage.Sets/src/mage/cards/s/SithLord.java @@ -89,7 +89,7 @@ public class SithLord extends CardImpl { if (permanent != null) { int oll = new OpponentsLostLifeCount().calculate(game, source, this); if (oll > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(oll), game); + permanent.addCounters(CounterType.P1P1.createInstance(oll), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/s/SolidarityOfHeroes.java b/Mage.Sets/src/mage/cards/s/SolidarityOfHeroes.java index 13211a9dbfe..607937f2690 100644 --- a/Mage.Sets/src/mage/cards/s/SolidarityOfHeroes.java +++ b/Mage.Sets/src/mage/cards/s/SolidarityOfHeroes.java @@ -94,7 +94,7 @@ class SolidarityOfHeroesEffect extends OneShotEffect { if (permanent != null) { int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (existingCounters > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game); + permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java b/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java index 704aee8dc5a..0a36d49a39f 100644 --- a/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java +++ b/Mage.Sets/src/mage/cards/s/SorinLordOfInnistrad.java @@ -98,6 +98,7 @@ public class SorinLordOfInnistrad extends CardImpl { } class VampireToken extends Token { + VampireToken() { super("Vampire", "1/1 black Vampire creature token with lifelink"); cardType.add(CardType.CREATURE); @@ -112,7 +113,7 @@ class VampireToken extends Token { class SorinLordOfInnistradEmblem extends Emblem { public SorinLordOfInnistradEmblem() { - this.setName("EMBLEM: Sorin, Lord of Innistrad"); + this.setName("Emblem Sorin"); BoostControlledEffect effect = new BoostControlledEffect(1, 0, Duration.EndOfGame); Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect); this.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/s/SorinSolemnVisitor.java b/Mage.Sets/src/mage/cards/s/SorinSolemnVisitor.java index 4f909edb837..0514b3ec455 100644 --- a/Mage.Sets/src/mage/cards/s/SorinSolemnVisitor.java +++ b/Mage.Sets/src/mage/cards/s/SorinSolemnVisitor.java @@ -58,7 +58,7 @@ import mage.game.permanent.token.Token; public class SorinSolemnVisitor extends CardImpl { public SorinSolemnVisitor(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{W}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{B}"); this.subtype.add("Sorin"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -97,7 +97,7 @@ public class SorinSolemnVisitor extends CardImpl { class SorinSolemnVisitorEmblem extends Emblem { public SorinSolemnVisitorEmblem() { - this.setName("EMBLEM: Sorin, Solemn Visitor"); + this.setName("Emblem Sorin"); Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND, new SacrificeEffect(new FilterCreaturePermanent(), 1, "that player"), TargetController.OPPONENT, false, true); this.getAbilities().add(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SoulExchange.java b/Mage.Sets/src/mage/cards/s/SoulExchange.java index cce04c25064..fcb574390c6 100644 --- a/Mage.Sets/src/mage/cards/s/SoulExchange.java +++ b/Mage.Sets/src/mage/cards/s/SoulExchange.java @@ -102,7 +102,7 @@ class SoulExchangeEffect extends OneShotEffect{ for (Permanent exiled : ((ExileTargetCost) c).getPermanents()) { if (exiled != null){ if(exiled.getSubtype(game).contains("Thrull")){ - game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), game); + game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), source, game); return true; } } else return false; diff --git a/Mage.Sets/src/mage/cards/s/SoulsMight.java b/Mage.Sets/src/mage/cards/s/SoulsMight.java index 5b0a4f329a5..c10e2043bbf 100644 --- a/Mage.Sets/src/mage/cards/s/SoulsMight.java +++ b/Mage.Sets/src/mage/cards/s/SoulsMight.java @@ -84,7 +84,7 @@ class SoulsMightEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null && permanent.getPower().getValue() > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(permanent.getPower().getValue()), game); + permanent.addCounters(CounterType.P1P1.createInstance(permanent.getPower().getValue()), source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java b/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java index ecee7c871ae..9e60f2460f6 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java +++ b/Mage.Sets/src/mage/cards/s/SphinxBoneWand.java @@ -97,7 +97,7 @@ class SphinxBoneWandEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - sourcePermanent.addCounters(CounterType.CHARGE.createInstance(), game); + sourcePermanent.addCounters(CounterType.CHARGE.createInstance(), source, game); int amount = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); Permanent permanent = game.getPermanent(source.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/s/SpikeCannibal.java b/Mage.Sets/src/mage/cards/s/SpikeCannibal.java index 892cf944793..c64be493329 100644 --- a/Mage.Sets/src/mage/cards/s/SpikeCannibal.java +++ b/Mage.Sets/src/mage/cards/s/SpikeCannibal.java @@ -113,7 +113,7 @@ class SpikeCannibalEffect extends OneShotEffect { if (countersRemoved > 0) { if (sourcePermanent != null) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(countersRemoved), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(countersRemoved), source, game); return true; } } diff --git a/Mage.Sets/src/mage/cards/s/StrengthOfTheTajuru.java b/Mage.Sets/src/mage/cards/s/StrengthOfTheTajuru.java index 648d97afb4f..60ec52d794d 100644 --- a/Mage.Sets/src/mage/cards/s/StrengthOfTheTajuru.java +++ b/Mage.Sets/src/mage/cards/s/StrengthOfTheTajuru.java @@ -99,7 +99,7 @@ class StrengthOfTheTajuruAddCountersTargetEffect extends OneShotEffect { for (UUID uuid : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(uuid); if (permanent != null) { - permanent.addCounters(counter.copy(), game); + permanent.addCounters(counter.copy(), source, game); affectedTargets ++; } } diff --git a/Mage.Sets/src/mage/cards/s/SzadekLordOfSecrets.java b/Mage.Sets/src/mage/cards/s/SzadekLordOfSecrets.java index a70b62b7310..9ce46cab504 100644 --- a/Mage.Sets/src/mage/cards/s/SzadekLordOfSecrets.java +++ b/Mage.Sets/src/mage/cards/s/SzadekLordOfSecrets.java @@ -98,7 +98,7 @@ class SzadekLordOfSecretsEffect extends ReplacementEffectImpl { if (damageEvent.isCombatDamage()) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(damageEvent.getAmount()), game); + permanent.addCounters(CounterType.P1P1.createInstance(damageEvent.getAmount()), source, game); if (damagedPlayer != null) { damagedPlayer.moveCards(damagedPlayer.getLibrary().getTopCards(game, damageEvent.getAmount()), Zone.GRAVEYARD, source, game); } diff --git a/Mage.Sets/src/mage/cards/t/TalusPaladin.java b/Mage.Sets/src/mage/cards/t/TalusPaladin.java index b107239bb84..55890323695 100644 --- a/Mage.Sets/src/mage/cards/t/TalusPaladin.java +++ b/Mage.Sets/src/mage/cards/t/TalusPaladin.java @@ -147,7 +147,7 @@ class TalusPaladinEffect extends OneShotEffect { if (!player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { return false; } - taluspPaladin.addCounters(CounterType.P1P1.createInstance(), game); + taluspPaladin.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/t/TamiyoFieldResearcher.java b/Mage.Sets/src/mage/cards/t/TamiyoFieldResearcher.java index 66f1445b8da..9c5dbd9ec9e 100644 --- a/Mage.Sets/src/mage/cards/t/TamiyoFieldResearcher.java +++ b/Mage.Sets/src/mage/cards/t/TamiyoFieldResearcher.java @@ -85,7 +85,7 @@ public class TamiyoFieldResearcher extends CardImpl { } public TamiyoFieldResearcher(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{1}{G}{W}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{G}{W}{U}"); this.subtype.add("Tamiyo"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -152,7 +152,7 @@ class TamiyoFieldResearcherEffect1 extends OneShotEffect { } class TamiyoFieldResearcherDelayedTriggeredAbility extends DelayedTriggeredAbility { - + private int startingTurn; private List creatures; @@ -160,7 +160,7 @@ class TamiyoFieldResearcherDelayedTriggeredAbility extends DelayedTriggeredAbili super(new DrawCardSourceControllerEffect(1), Duration.Custom, false); this.creatures = creatures; this.startingTurn = startingTurn; - } + } public TamiyoFieldResearcherDelayedTriggeredAbility(final TamiyoFieldResearcherDelayedTriggeredAbility ability) { super(ability); @@ -183,7 +183,7 @@ class TamiyoFieldResearcherDelayedTriggeredAbility extends DelayedTriggeredAbili } return false; } - + @Override public boolean isInactive(Game game) { return game.getActivePlayerId().equals(getControllerId()) && game.getTurnNum() != startingTurn; @@ -205,7 +205,7 @@ class TamiyoFieldResearcherEmblem extends Emblem { public TamiyoFieldResearcherEmblem() { - this.setName("EMBLEM: Tamiyo, Field Researcher"); + this.setName("Emblem Tamiyo"); this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new TamiyoFieldResearcherCastingEffect())); } diff --git a/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java b/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java index 563c8a5ffb3..a9f4b970bed 100644 --- a/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java +++ b/Mage.Sets/src/mage/cards/t/TamiyoTheMoonSage.java @@ -65,7 +65,7 @@ import mage.target.TargetPlayer; public class TamiyoTheMoonSage extends CardImpl { public TamiyoTheMoonSage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{3}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{U}{U}"); this.subtype.add("Tamiyo"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); @@ -132,7 +132,7 @@ class TappedCreaturesControlledByTargetCount implements DynamicValue { class TamiyoTheMoonSageEmblem extends Emblem { public TamiyoTheMoonSageEmblem() { - this.setName("EMBLEM: Tamiyo, the Moon Sage"); + this.setName("Emblem Tamiyo"); Ability ability = new SimpleStaticAbility(Zone.COMMAND, new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Duration.EndOfGame, HandSizeModification.SET)); this.getAbilities().add(ability); Effect effect = new ReturnToHandTargetEffect(); diff --git a/Mage.Sets/src/mage/cards/t/TeferiTemporalArchmage.java b/Mage.Sets/src/mage/cards/t/TeferiTemporalArchmage.java index 7a2df275ac1..5926cc3ef18 100644 --- a/Mage.Sets/src/mage/cards/t/TeferiTemporalArchmage.java +++ b/Mage.Sets/src/mage/cards/t/TeferiTemporalArchmage.java @@ -53,7 +53,7 @@ import mage.target.TargetPermanent; public class TeferiTemporalArchmage extends CardImpl { public TeferiTemporalArchmage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{4}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{U}{U}"); this.subtype.add("Teferi"); this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); @@ -89,7 +89,7 @@ class TeferiTemporalArchmageEmblem extends Emblem { // "You may activate loyalty abilities of planeswalkers you control on any player's turn any time you could cast an instant." public TeferiTemporalArchmageEmblem() { - this.setName("EMBLEM: Teferi, Temporal Archmage"); + this.setName("Emblem Teferi"); this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new ActivateAbilitiesAnyTimeYouCouldCastInstantEffect(LoyaltyAbility.class, "loyalty abilities of planeswalkers you control on any player's turn"))); } } diff --git a/Mage.Sets/src/mage/cards/t/TemptWithGlory.java b/Mage.Sets/src/mage/cards/t/TemptWithGlory.java index afabcf1221d..088abe7079b 100644 --- a/Mage.Sets/src/mage/cards/t/TemptWithGlory.java +++ b/Mage.Sets/src/mage/cards/t/TemptWithGlory.java @@ -48,8 +48,7 @@ import mage.players.Player; public class TemptWithGlory extends CardImpl { public TemptWithGlory(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{5}{W}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{W}"); // Tempting offer - Put a +1/+1 counter on each creature you control. Each opponent may put a +1/+1 counter on each creature he or she controls. For each opponent who does, put a +1/+1 counter on each creature you control. this.getSpellAbility().addEffect(new TemptWithGloryEffect()); @@ -88,20 +87,20 @@ class TemptWithGloryEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - addCounterToEachCreature(controller.getId(), counter, game); + addCounterToEachCreature(controller.getId(), counter, source, game); int opponentsAddedCounters = 0; for (UUID playerId : game.getOpponents(controller.getId())) { Player opponent = game.getPlayer(playerId); if (opponent != null) { if (opponent.chooseUse(outcome, "Put a +1/+1 counter on each creature you control?", source, game)) { opponentsAddedCounters++; - addCounterToEachCreature(playerId, counter, game); + addCounterToEachCreature(playerId, counter, source, game); game.informPlayers(opponent.getLogName() + " added a +1/+1 counter on each of its creatures"); } } } if (opponentsAddedCounters > 0) { - addCounterToEachCreature(controller.getId(), CounterType.P1P1.createInstance(opponentsAddedCounters), game); + addCounterToEachCreature(controller.getId(), CounterType.P1P1.createInstance(opponentsAddedCounters), source, game); } return true; } @@ -109,9 +108,9 @@ class TemptWithGloryEffect extends OneShotEffect { return false; } - private void addCounterToEachCreature(UUID playerId, Counter counter, Game game) { - for(Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, playerId, game)) { - permanent.addCounters(counter, game); + private void addCounterToEachCreature(UUID playerId, Counter counter, Ability source, Game game) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) { + permanent.addCounters(counter, source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/TestOfFaith.java b/Mage.Sets/src/mage/cards/t/TestOfFaith.java index ee02a6e1706..79939e1d9a0 100644 --- a/Mage.Sets/src/mage/cards/t/TestOfFaith.java +++ b/Mage.Sets/src/mage/cards/t/TestOfFaith.java @@ -111,7 +111,7 @@ class TestOfFaithPreventDamageTargetEffect extends PreventionEffectImpl { if (prevented > 0) { Permanent targetPermanent = game.getPermanent(source.getTargets().getFirstTarget()); if (targetPermanent != null) { - targetPermanent.addCounters(CounterType.P1P1.createInstance(prevented), game); + targetPermanent.addCounters(CounterType.P1P1.createInstance(prevented), source, game); game.informPlayers(new StringBuilder("Test of Faith: Prevented ").append(prevented).append(" damage ").toString()); game.informPlayers("Test of Faith: Adding " + prevented + " +1/+1 counters to " + targetPermanent.getName()); } diff --git a/Mage.Sets/src/mage/cards/t/TezzeretTheSchemer.java b/Mage.Sets/src/mage/cards/t/TezzeretTheSchemer.java index 0ace6c6e49a..bbe00c398d5 100644 --- a/Mage.Sets/src/mage/cards/t/TezzeretTheSchemer.java +++ b/Mage.Sets/src/mage/cards/t/TezzeretTheSchemer.java @@ -27,6 +27,7 @@ */ package mage.cards.t; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.BeginningOfCombatTriggeredAbility; @@ -58,8 +59,6 @@ import mage.game.permanent.token.Token; import mage.target.common.TargetArtifactPermanent; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; - /** * @author JRHerlehy */ @@ -108,7 +107,7 @@ class TezzeretTheSchemerEmblem extends Emblem { } public TezzeretTheSchemerEmblem() { - this.setName("EMBLEM: Tezzeret The Schemer"); + this.setName("Emblem Tezzeret"); Effect effect = new AddCardTypeTargetEffect(CardType.CREATURE, Duration.EndOfGame); effect.setText("target artifact you control becomes an artifact creature"); diff --git a/Mage.Sets/src/mage/cards/t/TheBattleOfEndor.java b/Mage.Sets/src/mage/cards/t/TheBattleOfEndor.java index 5e3bc4ce7ca..2fe6ccc4fed 100644 --- a/Mage.Sets/src/mage/cards/t/TheBattleOfEndor.java +++ b/Mage.Sets/src/mage/cards/t/TheBattleOfEndor.java @@ -104,7 +104,7 @@ class TheBattleOfEndorEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) { - permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), game); + permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TheMimeoplasm.java b/Mage.Sets/src/mage/cards/t/TheMimeoplasm.java index 3280bbff18c..58bac081731 100644 --- a/Mage.Sets/src/mage/cards/t/TheMimeoplasm.java +++ b/Mage.Sets/src/mage/cards/t/TheMimeoplasm.java @@ -114,7 +114,7 @@ class TheMimeoplasmEffect extends OneShotEffect { controller.moveCards(cardsToExile, Zone.EXILED, source, game); CopyEffect copyEffect = new CopyEffect(Duration.Custom, cardToCopy, source.getSourceId()); game.addEffect(copyEffect, source); - permanent.addCounters(CounterType.P1P1.createInstance(cardForCounters.getPower().getValue()), game); + permanent.addCounters(CounterType.P1P1.createInstance(cardForCounters.getPower().getValue()), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java b/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java index 16923349001..a5522f915b1 100644 --- a/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java +++ b/Mage.Sets/src/mage/cards/t/ThiefOfBlood.java @@ -109,7 +109,7 @@ class ThiefOfBloodEffect extends OneShotEffect { if (countersRemoved > 0) { Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId()); if (sourcePermanent != null) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(countersRemoved), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(countersRemoved), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java index 83010ba113a..30901e7944b 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtGorger.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtGorger.java @@ -101,7 +101,7 @@ class ThoughtGorgerEffectEnters extends OneShotEffect { Permanent thoughtGorger = game.getPermanent(source.getSourceId()); if (player != null && player.getHand().size() > 0 && thoughtGorger != null ) { int cardsInHand = player.getHand().size(); - thoughtGorger.addCounters(CounterType.P1P1.createInstance(cardsInHand), game); + thoughtGorger.addCounters(CounterType.P1P1.createInstance(cardsInHand), source, game); player.discard(cardsInHand, false, source, game); return true; } diff --git a/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java b/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java index b1163774fc4..0d616d07a1c 100644 --- a/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java +++ b/Mage.Sets/src/mage/cards/t/ThrasiosTritonHero.java @@ -27,7 +27,6 @@ */ package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -46,6 +45,8 @@ import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author LevelX2 @@ -111,7 +112,7 @@ class ThrasiosTritonHeroEffect extends OneShotEffect { cards.add(card); controller.revealCards(sourceObject.getName(), cards, game); if (card.getCardType().contains(CardType.LAND)) { - controller.moveCards(card, Zone.BATTLEFIELD, source, game); + controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); } else { controller.drawCards(1, game); } diff --git a/Mage.Sets/src/mage/cards/t/Timecrafting.java b/Mage.Sets/src/mage/cards/t/Timecrafting.java index 900936a5680..4161428ed9f 100644 --- a/Mage.Sets/src/mage/cards/t/Timecrafting.java +++ b/Mage.Sets/src/mage/cards/t/Timecrafting.java @@ -139,12 +139,12 @@ class TimecraftingAddEffect extends OneShotEffect { int xValue = source.getManaCostsToPay().getX(); Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - permanent.addCounters(CounterType.TIME.createInstance(xValue), game); + permanent.addCounters(CounterType.TIME.createInstance(xValue), source, game); } else { Card card = game.getExile().getCard(this.getTargetPointer().getFirst(game, source), game); if (card != null) { - card.addCounters(CounterType.TIME.createInstance(xValue), game); + card.addCounters(CounterType.TIME.createInstance(xValue), source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/u/UlashtTheHateSeed.java b/Mage.Sets/src/mage/cards/u/UlashtTheHateSeed.java index 4aff34b85df..d2eee0d242f 100644 --- a/Mage.Sets/src/mage/cards/u/UlashtTheHateSeed.java +++ b/Mage.Sets/src/mage/cards/u/UlashtTheHateSeed.java @@ -125,7 +125,7 @@ class UlashtTheHateSeedEffect extends OneShotEffect { int amount = game.getBattlefield().count(filterRed, source.getSourceId(), source.getControllerId(), game); amount += game.getBattlefield().count(filterGreen, source.getSourceId(), source.getControllerId(), game); if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java b/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java index e2a41bdde06..fc02cbf2418 100644 --- a/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java +++ b/Mage.Sets/src/mage/cards/u/UnbreathingHorde.java @@ -106,7 +106,7 @@ class UnbreathingHordeEffect1 extends OneShotEffect { int amount = game.getBattlefield().countAll(filter1, source.getControllerId(), game); amount += player.getGraveyard().count(filter2, game); if (amount > 0) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/u/UrgeToFeed.java b/Mage.Sets/src/mage/cards/u/UrgeToFeed.java index 44070b65149..b474079cbc3 100644 --- a/Mage.Sets/src/mage/cards/u/UrgeToFeed.java +++ b/Mage.Sets/src/mage/cards/u/UrgeToFeed.java @@ -101,7 +101,7 @@ class UrgeToFeedEffect extends OneShotEffect { Permanent vampire = game.getPermanent(vampireId); if (vampire != null) { vampire.tap(game); - vampire.addCounters(CounterType.P1P1.createInstance(), game); + vampire.addCounters(CounterType.P1P1.createInstance(), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/v/VastwoodHydra.java b/Mage.Sets/src/mage/cards/v/VastwoodHydra.java index 7b4ffb7cf5c..b3245f78645 100644 --- a/Mage.Sets/src/mage/cards/v/VastwoodHydra.java +++ b/Mage.Sets/src/mage/cards/v/VastwoodHydra.java @@ -109,7 +109,7 @@ class VastwoodHydraDistributeEffect extends OneShotEffect { for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); + permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/v/VeneratedTeacher.java b/Mage.Sets/src/mage/cards/v/VeneratedTeacher.java index edcb65747a3..b67db7ef5d8 100644 --- a/Mage.Sets/src/mage/cards/v/VeneratedTeacher.java +++ b/Mage.Sets/src/mage/cards/v/VeneratedTeacher.java @@ -91,7 +91,7 @@ class VeneratedTeacherEffect extends OneShotEffect { for (Permanent permanent : permanents) { for (Ability ability : permanent.getAbilities()) { if (ability instanceof LevelUpAbility) { - permanent.addCounters(CounterType.LEVEL.createInstance(2), game); + permanent.addCounters(CounterType.LEVEL.createInstance(2), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java b/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java index 2f134772ffa..8ae6f18af80 100644 --- a/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java +++ b/Mage.Sets/src/mage/cards/v/VenserTheSojourner.java @@ -153,7 +153,7 @@ class VenserTheSojournerEffect extends OneShotEffect { class VenserTheSojournerEmblem extends Emblem { public VenserTheSojournerEmblem() { - this.setName("EMBLEM: Venser, the Sojourner"); + this.setName("Emblem Venser"); Ability ability = new VenserTheSojournerSpellCastTriggeredAbility(new ExileTargetEffect(), false); Target target = new TargetPermanent(); ability.addTarget(target); diff --git a/Mage.Sets/src/mage/cards/v/Vigor.java b/Mage.Sets/src/mage/cards/v/Vigor.java index cfa175d0796..e523da56cad 100644 --- a/Mage.Sets/src/mage/cards/v/Vigor.java +++ b/Mage.Sets/src/mage/cards/v/Vigor.java @@ -99,7 +99,7 @@ class VigorReplacementEffect extends ReplacementEffectImpl { event.setAmount(0); Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(preventedDamage), game); + permanent.addCounters(CounterType.P1P1.createInstance(preventedDamage), source, game); } game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), preventedDamage)); return true; diff --git a/Mage.Sets/src/mage/cards/v/VigorMortis.java b/Mage.Sets/src/mage/cards/v/VigorMortis.java index 23a130a0a93..7bf05119abe 100644 --- a/Mage.Sets/src/mage/cards/v/VigorMortis.java +++ b/Mage.Sets/src/mage/cards/v/VigorMortis.java @@ -90,7 +90,7 @@ class VigorMortisAddCounterEffect extends OneShotEffect { // targetPointer can't be used because target moved from graveyard to battlefield Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(), game); + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/v/VorelOfTheHullClade.java b/Mage.Sets/src/mage/cards/v/VorelOfTheHullClade.java index b416d62f551..ed574cb2eaa 100644 --- a/Mage.Sets/src/mage/cards/v/VorelOfTheHullClade.java +++ b/Mage.Sets/src/mage/cards/v/VorelOfTheHullClade.java @@ -108,7 +108,7 @@ class VorelOfTheHullCladeEffect extends OneShotEffect { } for (Counter counter : target.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName(), counter.getCount()); - target.addCounters(newCounter, game); + target.addCounters(newCounter, source, game); } return true; } diff --git a/Mage.Sets/src/mage/cards/w/WanderingMage.java b/Mage.Sets/src/mage/cards/w/WanderingMage.java index 794307264ee..649bf7cf2dc 100644 --- a/Mage.Sets/src/mage/cards/w/WanderingMage.java +++ b/Mage.Sets/src/mage/cards/w/WanderingMage.java @@ -57,7 +57,7 @@ import mage.target.common.TargetCreaturePermanent; * @author fireshoes */ public class WanderingMage extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Cleric or Wizard"); static { @@ -67,7 +67,7 @@ public class WanderingMage extends CardImpl { } public WanderingMage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{U}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}"); this.subtype.add("Human"); this.subtype.add("Cleric"); this.subtype.add("Wizard"); @@ -75,20 +75,20 @@ public class WanderingMage extends CardImpl { this.toughness = new MageInt(3); // {W}, Pay 1 life: Prevent the next 2 damage that would be dealt to target creature this turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 2), new ManaCostsImpl("{W}")); ability.addCost(new PayLifeCost(1)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); - + // {U}: Prevent the next 1 damage that would be dealt to target Cleric or Wizard creature this turn. - ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 1), new ManaCostsImpl("{U}")); ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); - + // {B}, Put a -1/-1 counter on a creature you control: Prevent the next 2 damage that would be dealt to target player this turn. - ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 2), new ManaCostsImpl("{B}")); ability.addCost(new WanderingMageCost()); ability.addTarget(new TargetPlayer()); @@ -127,7 +127,7 @@ class WanderingMageCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget()); if (permanent != null) { - permanent.addCounters(CounterType.M1M1.createInstance(), game); + permanent.addCounters(CounterType.M1M1.createInstance(), ability, game); this.paid = true; } return paid; diff --git a/Mage.Sets/src/mage/cards/w/WildPair.java b/Mage.Sets/src/mage/cards/w/WildPair.java index 9fc7e793595..9adad2f38bd 100644 --- a/Mage.Sets/src/mage/cards/w/WildPair.java +++ b/Mage.Sets/src/mage/cards/w/WildPair.java @@ -40,11 +40,13 @@ import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SetTargetPointer; +import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.Filter; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.IntComparePredicate; +import mage.filter.predicate.other.OwnerPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.stack.Spell; @@ -58,12 +60,18 @@ import mage.watchers.common.CastFromHandWatcher; */ public class WildPair extends CardImpl { + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature"); + + static { + filter.add(new OwnerPredicate(TargetController.YOU)); + } + public WildPair(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}{G}"); // Whenever a creature enters the battlefield, if you cast it from your hand, you may search your library for a creature card with the same total power and toughness and put it onto the battlefield. If you do, shuffle your library. this.addAbility(new ConditionalTriggeredAbility( - new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new WildPairEffect(), new FilterCreaturePermanent("a creature"), true, SetTargetPointer.PERMANENT, ""), + new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new WildPairEffect(), filter, true, SetTargetPointer.PERMANENT, ""), new CastFromHandTargetCondition(), "Whenever a creature enters the battlefield, if you cast it from your hand, you may search your library for a creature card with the same total power and toughness and put it onto the battlefield. If you do, shuffle your library." ), new CastFromHandWatcher()); diff --git a/Mage.Sets/src/mage/cards/w/WookieeMystic.java b/Mage.Sets/src/mage/cards/w/WookieeMystic.java index 912191075c4..f19f4df0c28 100644 --- a/Mage.Sets/src/mage/cards/w/WookieeMystic.java +++ b/Mage.Sets/src/mage/cards/w/WookieeMystic.java @@ -148,7 +148,7 @@ class WookieeMysticWatcher extends Watcher { if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { if (creatures.contains(event.getSourceId())) { Permanent creature = game.getPermanent(event.getSourceId()); - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); creatures.remove(event.getSourceId()); } } diff --git a/Mage.Sets/src/mage/cards/w/WorldheartPhoenix.java b/Mage.Sets/src/mage/cards/w/WorldheartPhoenix.java index 9c8ade93985..7d65b64cee2 100644 --- a/Mage.Sets/src/mage/cards/w/WorldheartPhoenix.java +++ b/Mage.Sets/src/mage/cards/w/WorldheartPhoenix.java @@ -141,7 +141,7 @@ public class WorldheartPhoenix extends CardImpl { && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { // TODO: No perfect solution because there could be other effects that allow to cast the card for this mana cost if (spellAbility.getManaCosts().getText().equals("{W}{U}{B}{R}{G}")) { - permanent.addCounters(CounterType.P1P1.createInstance(2), game); + permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); } } } diff --git a/Mage.Sets/src/mage/cards/y/YaheenisExpertise.java b/Mage.Sets/src/mage/cards/y/YahennisExpertise.java similarity index 88% rename from Mage.Sets/src/mage/cards/y/YaheenisExpertise.java rename to Mage.Sets/src/mage/cards/y/YahennisExpertise.java index 0c21a325020..ae48c89b0d3 100644 --- a/Mage.Sets/src/mage/cards/y/YaheenisExpertise.java +++ b/Mage.Sets/src/mage/cards/y/YahennisExpertise.java @@ -49,9 +49,9 @@ import mage.target.common.TargetCardInHand; * * @author fireshoes */ -public class YaheenisExpertise extends CardImpl { +public class YahennisExpertise extends CardImpl { - public YaheenisExpertise(UUID ownerId, CardSetInfo setInfo) { + public YahennisExpertise(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}"); @@ -59,20 +59,20 @@ public class YaheenisExpertise extends CardImpl { getSpellAbility().addEffect(new BoostAllEffect(-3, -3, Duration.EndOfTurn)); // You may cast a card with converted mana cost 3 or less from your hand without paying its mana cost. - getSpellAbility().addEffect(new YaheenisExpertiseCastEffect()); + getSpellAbility().addEffect(new YahennisExpertiseCastEffect()); } - public YaheenisExpertise(final YaheenisExpertise card) { + public YahennisExpertise(final YahennisExpertise card) { super(card); } @Override - public YaheenisExpertise copy() { - return new YaheenisExpertise(this); + public YahennisExpertise copy() { + return new YahennisExpertise(this); } } -class YaheenisExpertiseCastEffect extends OneShotEffect { +class YahennisExpertiseCastEffect extends OneShotEffect { private static final FilterCard filter = new FilterCard("card with converted mana cost 3 or less from your hand"); @@ -80,18 +80,18 @@ class YaheenisExpertiseCastEffect extends OneShotEffect { filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 4)); } - public YaheenisExpertiseCastEffect() { + public YahennisExpertiseCastEffect() { super(Outcome.PlayForFree); this.staticText = "you may cast a card with converted mana cost 3 or less from your hand without paying its mana cost"; } - public YaheenisExpertiseCastEffect(final YaheenisExpertiseCastEffect effect) { + public YahennisExpertiseCastEffect(final YahennisExpertiseCastEffect effect) { super(effect); } @Override - public YaheenisExpertiseCastEffect copy() { - return new YaheenisExpertiseCastEffect(this); + public YahennisExpertiseCastEffect copy() { + return new YahennisExpertiseCastEffect(this); } @Override diff --git a/Mage.Sets/src/mage/cards/y/YodaJediMaster.java b/Mage.Sets/src/mage/cards/y/YodaJediMaster.java index a65baec0071..e07fb2e615d 100644 --- a/Mage.Sets/src/mage/cards/y/YodaJediMaster.java +++ b/Mage.Sets/src/mage/cards/y/YodaJediMaster.java @@ -143,7 +143,7 @@ class YodaEmblem extends Emblem { // You get an emblem with "Hexproof, you and your creatures have." public YodaEmblem() { - this.setName("Emblem - Yoda"); + this.setName("Emblem Yoda, Jedi Master"); Effect effect = new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.EndOfGame); effect.setText("Hexproof, you"); Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect); diff --git a/Mage.Sets/src/mage/cards/z/ZamWesell.java b/Mage.Sets/src/mage/cards/z/ZamWesell.java index e34c81f96da..23351edfc4e 100644 --- a/Mage.Sets/src/mage/cards/z/ZamWesell.java +++ b/Mage.Sets/src/mage/cards/z/ZamWesell.java @@ -1,115 +1,116 @@ -/* - * 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.cards.z; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.CastSourceTriggeredAbility; -import mage.abilities.effects.common.CopyEffect; -import mage.abilities.effects.common.RevealHandTargetEffect; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.filter.common.FilterCreatureCard; -import mage.game.Game; -import mage.players.Player; -import mage.target.TargetCard; -import mage.target.common.TargetOpponent; - -/** - * - * @author Styxo - */ -public class ZamWesell extends CardImpl { - - public ZamWesell(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{U}"); - this.supertype.add("Legendary"); - this.subtype.add("Shapeshifter"); - this.subtype.add("Hunter"); - this.power = new MageInt(2); - this.toughness = new MageInt(2); - - // When you cast Zam Wessel, target opponent reveals his or her hand. You may choose a creature card from it and have Zam Wessel enter the battlefield as a copy of that creature card. - Ability ability = new CastSourceTriggeredAbility(new RevealHandTargetEffect()); - ability.addTarget(new TargetOpponent()); - this.addAbility(ability); - } - - public ZamWesell(final ZamWesell card) { - super(card); - } - - @Override - public ZamWesell copy() { - return new ZamWesell(this); - } -} - -class ZamWesselEffect extends OneShotEffect { - - public ZamWesselEffect() { - super(Outcome.Benefit); - this.staticText = "You may choose a creature card from it and have {this} enter the battlefield as a copy of that creature card"; - } - - public ZamWesselEffect(final ZamWesselEffect effect) { - super(effect); - } - - @Override - public ZamWesselEffect copy() { - return new ZamWesselEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); - if (targetPlayer != null) { - TargetCard targetCard = new TargetCard(0, 1, Zone.HAND, new FilterCreatureCard()); - controller.choose(outcome, targetPlayer.getHand(), targetCard, game); - Card copyFromCard = game.getCard(targetCard.getFirstTarget()); - if (copyFromCard != null) { - game.informPlayers(controller.getLogName() + " chooses to copy " + copyFromCard.getName()); - CopyEffect copyEffect = new CopyEffect(Duration.Custom, copyFromCard, source.getSourceId()); - game.addEffect(copyEffect, source); - } - } - return true; - } - return false; - } -} +/* + * 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.cards.z; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.effects.common.CopyEffect; +import mage.abilities.effects.common.RevealHandTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetOpponent; + +/** + * + * @author Styxo + */ +public class ZamWesell extends CardImpl { + + public ZamWesell(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); + this.supertype.add("Legendary"); + this.subtype.add("Shapeshifter"); + this.subtype.add("Hunter"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When you cast Zam Wessel, target opponent reveals his or her hand. You may choose a creature card from it and have Zam Wessel enter the battlefield as a copy of that creature card. + Ability ability = new CastSourceTriggeredAbility(new RevealHandTargetEffect()); + ability.addEffect(new ZamWesselEffect()); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + public ZamWesell(final ZamWesell card) { + super(card); + } + + @Override + public ZamWesell copy() { + return new ZamWesell(this); + } +} + +class ZamWesselEffect extends OneShotEffect { + + public ZamWesselEffect() { + super(Outcome.Benefit); + this.staticText = "You may choose a creature card from it and have {this} enter the battlefield as a copy of that creature card"; + } + + public ZamWesselEffect(final ZamWesselEffect effect) { + super(effect); + } + + @Override + public ZamWesselEffect copy() { + return new ZamWesselEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (targetPlayer != null) { + TargetCard targetCard = new TargetCard(0, 1, Zone.HAND, new FilterCreatureCard()); + controller.choose(outcome, targetPlayer.getHand(), targetCard, game); + Card copyFromCard = game.getCard(targetCard.getFirstTarget()); + if (copyFromCard != null) { + game.informPlayers(controller.getLogName() + " chooses to copy " + copyFromCard.getName()); + CopyEffect copyEffect = new CopyEffect(Duration.Custom, copyFromCard, source.getSourceId()); + game.addEffect(copyEffect, source); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java b/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java index dd4999e810b..c107228c59a 100644 --- a/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java +++ b/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java @@ -112,7 +112,7 @@ class ZameckGuildmageEntersBattlefieldEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); if (target != null) { - target.addCounters(CounterType.P1P1.createInstance(), game); + target.addCounters(CounterType.P1P1.createInstance(), source, game); } return false; } diff --git a/Mage.Sets/src/mage/sets/AetherRevolt.java b/Mage.Sets/src/mage/sets/AetherRevolt.java index ce57ddc72b8..9f4004ab055 100644 --- a/Mage.Sets/src/mage/sets/AetherRevolt.java +++ b/Mage.Sets/src/mage/sets/AetherRevolt.java @@ -1,95 +1,95 @@ -/* - * 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; - -import mage.cards.ExpansionSet; -import mage.cards.repository.CardCriteria; -import mage.cards.repository.CardInfo; -import mage.cards.repository.CardRepository; -import mage.constants.Rarity; -import mage.constants.SetType; - -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author fireshoes - */ -public class AetherRevolt extends ExpansionSet { - - private static final AetherRevolt fINSTANCE = new AetherRevolt(); - - public static AetherRevolt getInstance() { - return fINSTANCE; - } - - protected final List savedSpecialLand = new ArrayList<>(); - - private AetherRevolt() { - super("Aether Revolt", "AER", ExpansionSet.buildDate(2017, 1, 20), SetType.EXPANSION); - this.blockName = "Kaladesh"; - this.hasBoosters = true; - this.hasBasicLands = false; - this.numBoosterLands = 1; - this.numBoosterCommon = 10; - this.numBoosterUncommon = 3; - this.numBoosterRare = 1; - this.ratioBoosterMythic = 8; - this.maxCardNumberInBooster = 184; - this.ratioBoosterSpecialLand = 144; - this.parentSet = Kaladesh.getInstance(); - cards.add(new SetCardInfo("Ajani Unyielding", 127, Rarity.MYTHIC, mage.cards.a.AjaniUnyielding.class)); - cards.add(new SetCardInfo("Ajani, Valiant Protector", 185, Rarity.MYTHIC, mage.cards.a.AjaniValiantProtector.class)); - cards.add(new SetCardInfo("Consulate Crackdown", 11, Rarity.RARE, mage.cards.c.ConsulateCrackdown.class)); - cards.add(new SetCardInfo("Dark Intimations", 128, Rarity.RARE, mage.cards.d.DarkIntimations.class)); - cards.add(new SetCardInfo("Disallow", 31, Rarity.RARE, mage.cards.d.Disallow.class)); - cards.add(new SetCardInfo("Heart of Kiran", 153, Rarity.MYTHIC, mage.cards.h.HeartOfKiran.class)); - cards.add(new SetCardInfo("Oath of Ajani", 131, Rarity.RARE, mage.cards.o.OathOfAjani.class)); - cards.add(new SetCardInfo("Pia's Revolution", 91, Rarity.RARE, mage.cards.p.PiasRevolution.class)); - cards.add(new SetCardInfo("Quicksmith Rebel", 93, Rarity.RARE, mage.cards.q.QuicksmithRebel.class)); - cards.add(new SetCardInfo("Quicksmith Spy", 41, Rarity.RARE, mage.cards.q.QuicksmithSpy.class)); - cards.add(new SetCardInfo("Tezzeret the Schemer", 137, Rarity.MYTHIC, mage.cards.t.TezzeretTheSchemer.class)); - cards.add(new SetCardInfo("Tezzeret, Master of Metal", 190, Rarity.MYTHIC, mage.cards.t.TezzeretMasterOfMetal.class)); - cards.add(new SetCardInfo("Trophy Mage", 48, Rarity.UNCOMMON, mage.cards.t.TrophyMage.class)); - cards.add(new SetCardInfo("Yaheeni's Expertise", 75, Rarity.RARE, mage.cards.y.YaheenisExpertise.class)); - } - - @Override - public List getSpecialLand() { - if (savedSpecialLand.isEmpty()) { - CardCriteria criteria = new CardCriteria(); - criteria.setCodes("MPS"); - criteria.minCardNumber(31); - criteria.maxCardNumber(54); - savedSpecialLand.addAll(CardRepository.instance.findCards(criteria)); - } - - return new ArrayList<>(savedSpecialLand); - } -} +/* + * 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; + +import mage.cards.ExpansionSet; +import mage.cards.repository.CardCriteria; +import mage.cards.repository.CardInfo; +import mage.cards.repository.CardRepository; +import mage.constants.Rarity; +import mage.constants.SetType; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author fireshoes + */ +public class AetherRevolt extends ExpansionSet { + + private static final AetherRevolt fINSTANCE = new AetherRevolt(); + + public static AetherRevolt getInstance() { + return fINSTANCE; + } + + protected final List savedSpecialLand = new ArrayList<>(); + + private AetherRevolt() { + super("Aether Revolt", "AER", ExpansionSet.buildDate(2017, 1, 20), SetType.EXPANSION); + this.blockName = "Kaladesh"; + this.hasBoosters = true; + this.hasBasicLands = false; + this.numBoosterLands = 1; + this.numBoosterCommon = 10; + this.numBoosterUncommon = 3; + this.numBoosterRare = 1; + this.ratioBoosterMythic = 8; + this.maxCardNumberInBooster = 184; + this.ratioBoosterSpecialLand = 144; + this.parentSet = Kaladesh.getInstance(); + cards.add(new SetCardInfo("Ajani Unyielding", 127, Rarity.MYTHIC, mage.cards.a.AjaniUnyielding.class)); + cards.add(new SetCardInfo("Ajani, Valiant Protector", 185, Rarity.MYTHIC, mage.cards.a.AjaniValiantProtector.class)); + cards.add(new SetCardInfo("Consulate Crackdown", 11, Rarity.RARE, mage.cards.c.ConsulateCrackdown.class)); + cards.add(new SetCardInfo("Dark Intimations", 128, Rarity.RARE, mage.cards.d.DarkIntimations.class)); + cards.add(new SetCardInfo("Disallow", 31, Rarity.RARE, mage.cards.d.Disallow.class)); + cards.add(new SetCardInfo("Heart of Kiran", 153, Rarity.MYTHIC, mage.cards.h.HeartOfKiran.class)); + cards.add(new SetCardInfo("Oath of Ajani", 131, Rarity.RARE, mage.cards.o.OathOfAjani.class)); + cards.add(new SetCardInfo("Pia's Revolution", 91, Rarity.RARE, mage.cards.p.PiasRevolution.class)); + cards.add(new SetCardInfo("Quicksmith Rebel", 93, Rarity.RARE, mage.cards.q.QuicksmithRebel.class)); + cards.add(new SetCardInfo("Quicksmith Spy", 41, Rarity.RARE, mage.cards.q.QuicksmithSpy.class)); + cards.add(new SetCardInfo("Tezzeret the Schemer", 137, Rarity.MYTHIC, mage.cards.t.TezzeretTheSchemer.class)); + cards.add(new SetCardInfo("Tezzeret, Master of Metal", 190, Rarity.MYTHIC, mage.cards.t.TezzeretMasterOfMetal.class)); + cards.add(new SetCardInfo("Trophy Mage", 48, Rarity.UNCOMMON, mage.cards.t.TrophyMage.class)); + cards.add(new SetCardInfo("Yaheeni's Expertise", 75, Rarity.RARE, mage.cards.y.YahennisExpertise.class)); + } + + @Override + public List getSpecialLand() { + if (savedSpecialLand.isEmpty()) { + CardCriteria criteria = new CardCriteria(); + criteria.setCodes("MPS"); + criteria.minCardNumber(31); + criteria.maxCardNumber(54); + savedSpecialLand.addAll(CardRepository.instance.findCards(criteria)); + } + + return new ArrayList<>(savedSpecialLand); + } +} diff --git a/Mage.Sets/src/mage/sets/GameDay.java b/Mage.Sets/src/mage/sets/GameDay.java index 06f22c782f4..e6a35ebcb33 100644 --- a/Mage.Sets/src/mage/sets/GameDay.java +++ b/Mage.Sets/src/mage/sets/GameDay.java @@ -103,7 +103,7 @@ public class GameDay extends ExpansionSet { cards.add(new SetCardInfo("Trostani's Summoner", 27, Rarity.UNCOMMON, mage.cards.t.TrostanisSummoner.class)); cards.add(new SetCardInfo("Unsubstantiate", 53, Rarity.UNCOMMON, mage.cards.u.Unsubstantiate.class)); cards.add(new SetCardInfo("Utter End", 38, Rarity.RARE, mage.cards.u.UtterEnd.class)); - cards.add(new SetCardInfo("Yaheeni's Expertise", 58, Rarity.RARE, mage.cards.y.YaheenisExpertise.class)); + cards.add(new SetCardInfo("Yahenni's Expertise", 58, Rarity.RARE, mage.cards.y.YahennisExpertise.class)); cards.add(new SetCardInfo("Zameck Guildmage", 25, Rarity.UNCOMMON, mage.cards.z.ZameckGuildmage.class)); cards.add(new SetCardInfo("Zombie Apocalypse", 14, Rarity.RARE, mage.cards.z.ZombieApocalypse.class)); } diff --git a/Mage.Sets/src/mage/sets/Invasion.java b/Mage.Sets/src/mage/sets/Invasion.java index 6e957b1e81c..ab3764fa8e4 100644 --- a/Mage.Sets/src/mage/sets/Invasion.java +++ b/Mage.Sets/src/mage/sets/Invasion.java @@ -150,6 +150,7 @@ public class Invasion extends ExpansionSet { cards.add(new SetCardInfo("Goblin Spy", 145, Rarity.UNCOMMON, mage.cards.g.GoblinSpy.class)); cards.add(new SetCardInfo("Hanna, Ship's Navigator", 249, Rarity.RARE, mage.cards.h.HannaShipsNavigator.class)); cards.add(new SetCardInfo("Harrow", 189, Rarity.COMMON, mage.cards.h.Harrow.class)); + cards.add(new SetCardInfo("Harsh Judgment", 19, Rarity.RARE, mage.cards.h.HarshJudgment.class)); cards.add(new SetCardInfo("Hate Weaver", 108, Rarity.UNCOMMON, mage.cards.h.HateWeaver.class)); cards.add(new SetCardInfo("Heroes' Reunion", 250, Rarity.UNCOMMON, mage.cards.h.HeroesReunion.class)); cards.add(new SetCardInfo("Holy Day", 20, Rarity.COMMON, mage.cards.h.HolyDay.class)); diff --git a/Mage.Sets/src/mage/sets/MasterpieceSeries.java b/Mage.Sets/src/mage/sets/MasterpieceSeries.java index ef002104b38..04d363bf72d 100644 --- a/Mage.Sets/src/mage/sets/MasterpieceSeries.java +++ b/Mage.Sets/src/mage/sets/MasterpieceSeries.java @@ -50,19 +50,28 @@ public class MasterpieceSeries extends ExpansionSet { this.hasBoosters = false; this.hasBasicLands = false; cards.add(new SetCardInfo("Aether Vial", 6, Rarity.MYTHIC, mage.cards.a.AetherVial.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Arcbound Ravager", 31, Rarity.MYTHIC, mage.cards.a.ArcboundRavager.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Black Vise", 32, Rarity.MYTHIC, mage.cards.b.BlackVise.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Cataclysmic Gearhulk", 1, Rarity.MYTHIC, mage.cards.c.CataclysmicGearhulk.class, new CardGraphicInfo( FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Chalice of the Void", 33, Rarity.MYTHIC, mage.cards.c.ChaliceOfTheVoid.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Champion's Helm", 7, Rarity.MYTHIC, mage.cards.c.ChampionsHelm.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Chromatic Lantern", 8, Rarity.MYTHIC, mage.cards.c.ChromaticLantern.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Chrome Mox", 9, Rarity.MYTHIC, mage.cards.c.ChromeMox.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Cloudstone Curio", 10, Rarity.MYTHIC, mage.cards.c.CloudstoneCurio.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); - cards.add(new SetCardInfo("Combustible Gearhulk", 2, Rarity.MYTHIC, mage.cards.c.CombustibleGearhulk.class)); + cards.add(new SetCardInfo("Combustible Gearhulk", 2, Rarity.MYTHIC, mage.cards.c.CombustibleGearhulk.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Crucible of Worlds", 11, Rarity.MYTHIC, mage.cards.c.CrucibleOfWorlds.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Defense Grid", 34, Rarity.MYTHIC, mage.cards.d.DefenseGrid.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Duplicant", 35, Rarity.MYTHIC, mage.cards.d.Duplicant.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Engineered Explosives", 36, Rarity.MYTHIC, mage.cards.e.EngineeredExplosives.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Ensnaring Bridge", 37, Rarity.MYTHIC, mage.cards.e.EnsnaringBridge.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Extraplanar Lens", 38, Rarity.MYTHIC, mage.cards.e.ExtraplanarLens.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Gauntlet of Power", 12, Rarity.MYTHIC, mage.cards.g.GauntletOfPower.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Grindstone", 39, Rarity.MYTHIC, mage.cards.g.Grindstone.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Hangarback Walker", 13, Rarity.MYTHIC, mage.cards.h.HangarbackWalker.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Lightning Greaves", 14, Rarity.MYTHIC, mage.cards.l.LightningGreaves.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, @@ -70,11 +79,16 @@ public class MasterpieceSeries extends ExpansionSet { cards.add(new SetCardInfo("Lotus Petal", 15, Rarity.MYTHIC, mage.cards.l.LotusPetal.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Mana Crypt", 16, Rarity.MYTHIC, mage.cards.m.ManaCrypt.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Mana Vault", 17, Rarity.MYTHIC, mage.cards.m.ManaVault.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Meekstone", 40, Rarity.MYTHIC, mage.cards.m.Meekstone.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Mind's Eye", 18, Rarity.MYTHIC, mage.cards.m.MindsEye.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Mox Opal", 19, Rarity.MYTHIC, mage.cards.m.MoxOpal.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); - cards.add(new SetCardInfo("Noxious Gearhulk", 3, Rarity.MYTHIC, mage.cards.n.NoxiousGearhulk.class)); + cards.add(new SetCardInfo("Noxious Gearhulk", 3, Rarity.MYTHIC, mage.cards.n.NoxiousGearhulk.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Oblivion Stone", 41, Rarity.MYTHIC, mage.cards.o.OblivionStone.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Ornithopter", 42, Rarity.MYTHIC, mage.cards.o.Ornithopter.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Painter's Servant", 20, Rarity.MYTHIC, mage.cards.p.PaintersServant.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Pithing Needle", 44, Rarity.MYTHIC, mage.cards.p.PithingNeedle.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Platinum Angel", 46, Rarity.MYTHIC, mage.cards.p.PlatinumAngel.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Rings of Brighthearth", 21, Rarity.MYTHIC, mage.cards.r.RingsOfBrighthearth.class, new CardGraphicInfo( FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Scroll Rack", 22, Rarity.MYTHIC, mage.cards.s.ScrollRack.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); @@ -82,16 +96,24 @@ public class MasterpieceSeries extends ExpansionSet { cards.add(new SetCardInfo("Solemn Simulacrum", 25, Rarity.MYTHIC, mage.cards.s.SolemnSimulacrum.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Sol Ring", 24, Rarity.MYTHIC, mage.cards.s.SolRing.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Sphere of Resistance", 47, Rarity.MYTHIC, mage.cards.s.SphereOfResistance.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Staff of Domination", 48, Rarity.MYTHIC, mage.cards.s.StaffOfDomination.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Static Orb", 26, Rarity.MYTHIC, mage.cards.s.StaticOrb.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Steel Overseer", 27, Rarity.MYTHIC, mage.cards.s.SteelOverseer.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Sundering Titan", 49, Rarity.MYTHIC, mage.cards.s.SunderingTitan.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Sword of Body and Mind", 50, Rarity.MYTHIC, mage.cards.s.SwordOfBodyAndMind.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Sword of Feast and Famine", 28, Rarity.MYTHIC, mage.cards.s.SwordOfFeastAndFamine.class, new CardGraphicInfo( FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Sword of Fire and Ice", 29, Rarity.MYTHIC, mage.cards.s.SwordOfFireAndIce.class, new CardGraphicInfo( FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Sword of Light and Shadow", 30, Rarity.MYTHIC, mage.cards.s.SwordOfLightAndShadow.class, new CardGraphicInfo( FrameStyle.KLD_INVENTION, false))); - cards.add(new SetCardInfo("Torrential Gearhulk", 4, Rarity.MYTHIC, mage.cards.t.TorrentialGearhulk.class)); + cards.add(new SetCardInfo("Sword of War and Peace", 51, Rarity.MYTHIC, mage.cards.s.SwordOfWarAndPeace.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Torrential Gearhulk", 4, Rarity.MYTHIC, mage.cards.t.TorrentialGearhulk.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Trinisphere", 52, Rarity.MYTHIC, mage.cards.t.Trinisphere.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Vedalken Shackles", 53, Rarity.MYTHIC, mage.cards.v.VedalkenShackles.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); cards.add(new SetCardInfo("Verdurous Gearhulk", 5, Rarity.MYTHIC, mage.cards.v.VerdurousGearhulk.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); + cards.add(new SetCardInfo("Wurmcoil Engine", 54, Rarity.MYTHIC, mage.cards.w.WurmcoilEngine.class, new CardGraphicInfo(FrameStyle.KLD_INVENTION, false))); } } diff --git a/Mage.Sets/src/mage/sets/Mirage.java b/Mage.Sets/src/mage/sets/Mirage.java index 0c65e99c618..0ebe8750cf6 100644 --- a/Mage.Sets/src/mage/sets/Mirage.java +++ b/Mage.Sets/src/mage/sets/Mirage.java @@ -147,6 +147,7 @@ public class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Gravebane Zombie", 25, Rarity.COMMON, mage.cards.g.GravebaneZombie.class)); cards.add(new SetCardInfo("Grave Servitude", 24, Rarity.COMMON, mage.cards.g.GraveServitude.class)); cards.add(new SetCardInfo("Grinning Totem", 268, Rarity.RARE, mage.cards.g.GrinningTotem.class)); + cards.add(new SetCardInfo("Hall of Gemstone", 119, Rarity.RARE, mage.cards.h.HallOfGemstone.class)); cards.add(new SetCardInfo("Hammer of Bogardan", 181, Rarity.RARE, mage.cards.h.HammerOfBogardan.class)); cards.add(new SetCardInfo("Harbinger of Night", 26, Rarity.RARE, mage.cards.h.HarbingerOfNight.class)); cards.add(new SetCardInfo("Harmattan Efreet", 69, Rarity.UNCOMMON, mage.cards.h.HarmattanEfreet.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java index 48124877b2f..8595a113a24 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java @@ -1,6 +1,5 @@ package org.mage.test.cards.abilities.keywords; - import mage.constants.PhaseStep; import mage.constants.Zone; import org.junit.Assert; @@ -12,22 +11,21 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * @author BetaSteward */ public class CascadeTest extends CardTestPlayerBase { - + /* * Maelstrom Nexus {WUBRG} * Enchantment - * The first spell you cast each turn has cascade. (When you cast your first - * spell, exile cards from the top of your library until you exile a nonland - * card that costs less. You may cast it without paying its mana cost. Put + * The first spell you cast each turn has cascade. (When you cast your first + * spell, exile cards from the top of your library until you exile a nonland + * card that costs less. You may cast it without paying its mana cost. Put * the exiled cards on the bottom in a random order.) * * Predatory Advantage {3RG} * Enchantment - * At the beginning of each opponent's end step, if that player didn't cast - * a creature spell this turn, put a 2/2 green Lizard creature token onto + * At the beginning of each opponent's end step, if that player didn't cast + * a creature spell this turn, put a 2/2 green Lizard creature token onto * the battlefield. - */ - + */ // test that Predatory Advantage gains Cascade when cast @Test public void testGainsCascade() { @@ -36,16 +34,16 @@ public class CascadeTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Maelstrom Nexus"); addCard(Zone.HAND, playerA, "Predatory Advantage"); addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Predatory Advantage"); - + setStopAt(2, PhaseStep.END_TURN); execute(); - + assertPermanentCount(playerA, "Predatory Advantage", 1); assertPermanentCount(playerA, "Sejiri Merfolk", 1); assertPermanentCount(playerA, "Lizard", 1); - + } // test that 2nd spell cast (Nacatl Outlander) does not gain Cascade @@ -59,18 +57,18 @@ public class CascadeTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Nacatl Outlander"); addCard(Zone.LIBRARY, playerA, "Arbor Elf"); addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Predatory Advantage"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Nacatl Outlander"); - + setStopAt(1, PhaseStep.END_TURN); execute(); - + assertPermanentCount(playerA, "Predatory Advantage", 1); assertPermanentCount(playerA, "Sejiri Merfolk", 1); assertPermanentCount(playerA, "Nacatl Outlander", 1); assertPermanentCount(playerA, "Arbor Elf", 0); - + } // test that player does not lose if all cards are exiled by cascade @@ -81,7 +79,7 @@ public class CascadeTest extends CardTestPlayerBase { // won't trigger. @Test public void testEmptyLibraryCascasde() { - + playerA.getLibrary().clear(); addCard(Zone.LIBRARY, playerA, "Plains", 10); @@ -127,7 +125,41 @@ public class CascadeTest extends CardTestPlayerBase { // the 2 lands go back to library Assert.assertEquals("The 2 lands went back to library", 2, playerA.getLibrary().size()); Assert.assertTrue("Player A is still in game", playerA.isInGame()); - + + } + + /** + * Whenever Enlisted wurm is returned to hand, or was cast previously by an + * opponent's Gonti, after it is returned to my hand, it will not let me + * cast it. + */ + @Test + public void testRecastCascadeCard() { + + playerA.getLibrary().clear(); + addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2); + + addCard(Zone.BATTLEFIELD, playerA, "Plains", 6); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 6); + + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + // Cascade + addCard(Zone.HAND, playerA, "Enlisted Wurm"); // Creature {4}{G}{W} + + addCard(Zone.BATTLEFIELD, playerB, "Island", 1); + addCard(Zone.HAND, playerB, "Unsummon"); // Instant {U} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Enlisted Wurm"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Unsummon", "Enlisted Wurm"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Enlisted Wurm"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerB, "Unsummon", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 2); + assertPermanentCount(playerA, "Enlisted Wurm", 1); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java index 24c886f8d0f..3b78c927817 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java @@ -10,44 +10,50 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * @author BetaSteward */ public class EpharaGodOfThePolisTest extends CardTestPlayerBase { + /* * Ephara, God of the Polis * Legendary Enchantment Creature — God 6/5, 2WU (4) * Indestructible - * As long as your devotion to white and blue is less than seven, Ephara + * As long as your devotion to white and blue is less than seven, Ephara * isn't a creature. - * At the beginning of each upkeep, if you had another creature enter the + * At the beginning of each upkeep, if you had another creature enter the * battlefield under your control last turn, draw a card. * - */ - + */ // test that an extra card is drawn @Test public void testDrawCard() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); - addCard(Zone.BATTLEFIELD, playerA, "Ephara, God of the Polis"); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + addCard(Zone.BATTLEFIELD, playerA, "Island", 3); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + addCard(Zone.HAND, playerA, "Ephara, God of the Polis"); addCard(Zone.HAND, playerA, "Goblin Roughrider"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goblin Roughrider"); - - setStopAt(3, PhaseStep.UPKEEP); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ephara, God of the Polis"); + + setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); - - this.assertHandCount(playerA, 1); - + + this.assertHandCount(playerA, 2); + } - + // test that an extra card is not drawn @Test public void testNotDrawCard() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); - addCard(Zone.BATTLEFIELD, playerA, "Ephara, God of the Polis"); - - setStopAt(3, PhaseStep.UPKEEP); + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + addCard(Zone.HAND, playerA, "Ephara, God of the Polis"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ephara, God of the Polis"); + setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); - - this.assertHandCount(playerA, 0); - + + this.assertHandCount(playerA, 1); + this.assertPermanentCount(playerA, "Ephara, God of the Polis", 1); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameTest.java b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameTest.java index eed2602fe61..12794c92806 100644 --- a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameTest.java @@ -32,6 +32,7 @@ import mage.constants.MultiplayerAttackOption; import mage.constants.PhaseStep; import mage.constants.RangeOfInfluence; import mage.constants.Zone; +import mage.counters.CounterType; import mage.game.FreeForAll; import mage.game.Game; import mage.game.GameException; @@ -141,4 +142,59 @@ public class PlayerLeftGameTest extends CardTestMultiPlayerBase { assertPermanentCount(playerA, "Rootwater Commando", 0); // Goes to graveyard becuase player C left assertPermanentCount(playerA, "Rootwater Commando", 0); // Returned back to player A } + + /** + * Xmage throws an error involving an emblem unable to find the initial + * source if it has a proc. To reproduce, a Planeswalker was taken from an + * original player's control, such as using Scrambleverse to shuffle Jace, + * Unraveler of Secrets, to a second player and then the second player uses + * Jace's ability to create an emblem ("Whenever an opponent casts his or + * her first spell each turn, counter that spell."). Then the original + * player concedes the game and removes the Planeswalker. Once it becomes an + * opponent of the original player's turn and that opponent plays a spell, + * Xmage throws an error and rollsback the turn. + * + * I don't have the actual error report on my due to negligence, but what I + * can recollect is that the error message was along the lines of "The + * emblem cannot find the original source. This turn will be rolled back". + * This error message will always appear when an opponent tries to play a + * spell. Player order: A -> D -> C -> B + */ + @Test + public void TestOtherPlayerPlaneswalkerCreatedEmblem() { + // +1: Scry 1, then draw a card. + // -2: Return target creature to its owner's hand. + // -8: You get an emblem with "Whenever an opponent casts his or her first spell each turn, counter that spell." + addCard(Zone.BATTLEFIELD, playerC, "Jace, Unraveler of Secrets"); + addCounters(1, PhaseStep.DRAW, playerC, "Jace, Unraveler of Secrets", CounterType.LOYALTY, 8); + + addCard(Zone.BATTLEFIELD, playerA, "Island", 6); + // Enchant permanent (Target a permanent as you cast this. This card enters the battlefield attached to that permanent.) + // You control enchanted permanent. + addCard(Zone.HAND, playerA, "Confiscate"); // Enchantment Aura + + addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); + addCard(Zone.HAND, playerB, "Silvercoat Lion"); + + addCard(Zone.BATTLEFIELD, playerD, "Silvercoat Lion"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Confiscate", "Jace, Unraveler of Secrets"); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-8: You get an emblem with"); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Blind with Anger", "Rootwater Commando"); + attack(2, playerD, "Silvercoat Lion", playerC); + + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion"); + + setStopAt(3, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerC, 0); + assertPermanentCount(playerC, 0); + assertGraveyardCount(playerA, "Confiscate", 1); + assertPermanentCount(playerA, "Jace, Unraveler of Secrets", 0); // Removed from game because player C left the game + assertEmblemCount(playerA, 1); + assertGraveyardCount(playerB, "Silvercoat Lion", 1); + } + } diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 0f2da26c6bf..e86fc599951 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -460,7 +460,7 @@ public class TestPlayer implements Player { for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { if (permanent.getName().equals(groups[0])) { Counter counter = new Counter(groups[1], Integer.parseInt(groups[2])); - permanent.addCounters(counter, game); + permanent.addCounters(counter, null, game); break; } } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 223c6205779..bb8b1497fdf 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -1172,10 +1172,11 @@ public abstract class AbilityImpl implements Ability { public void setSourceObject(MageObject sourceObject, Game game) { if (sourceObject == null) { this.sourceObject = game.getObject(sourceId); + this.sourceObjectZoneChangeCounter = game.getState().getZoneChangeCounter(sourceId); } else { this.sourceObject = sourceObject; + this.sourceObjectZoneChangeCounter = this.sourceObject.getZoneChangeCounter(game); } - this.sourceObjectZoneChangeCounter = game.getState().getZoneChangeCounter(sourceId); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/TurnFaceUpAbility.java b/Mage/src/main/java/mage/abilities/common/TurnFaceUpAbility.java index 61a38ad8cb5..1d0a8af4dd0 100644 --- a/Mage/src/main/java/mage/abilities/common/TurnFaceUpAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TurnFaceUpAbility.java @@ -107,7 +107,7 @@ class TurnFaceUpEffect extends OneShotEffect { if (sourcePermanent != null) { if (sourcePermanent.turnFaceUp(game, source.getControllerId())) { if (megamorph) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game); + sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); } game.getState().setValue(source.getSourceId().toString() + "TurnFaceUpX", source.getManaCostsToPay().getX()); return true; diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java index 1c522fa402d..b5d98d44f1e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java @@ -72,7 +72,7 @@ public class PutCountersSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - this.paid = permanent.addCounters(counter, game);; + this.paid = permanent.addCounters(counter, null, game);; } return paid; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/AmplifyEffect.java b/Mage/src/main/java/mage/abilities/effects/common/AmplifyEffect.java index 1a210a2ce6e..c396579f056 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/AmplifyEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/AmplifyEffect.java @@ -115,7 +115,7 @@ public class AmplifyEffect extends ReplacementEffectImpl { Cards cards = new CardsImpl(); cards.addAll(target.getTargets()); int amountCounters = cards.size() * amplifyFactor.getFactor(); - sourceCreature.addCounters(CounterType.P1P1.createInstance(amountCounters), game); + sourceCreature.addCounters(CounterType.P1P1.createInstance(amountCounters), source, game); controller.revealCards(sourceCreature.getIdName(), cards, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java index 1f060e3720e..fdadf86629b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DevourEffect.java @@ -133,7 +133,7 @@ public class DevourEffect extends ReplacementEffectImpl { } else { amountCounters = devouredCreatures * devourFactor.getFactor(); } - creature.addCounters(CounterType.P1P1.createInstance(amountCounters), game); + creature.addCounters(CounterType.P1P1.createInstance(amountCounters), source, game); game.getState().setValue(creature.getId().toString() + "devoured", cardSubtypes); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldWithXCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldWithXCountersEffect.java index 896fc88c98e..10c5ef292c9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldWithXCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldWithXCountersEffect.java @@ -75,7 +75,7 @@ public class EntersBattlefieldWithXCountersEffect extends OneShotEffect { if (amount > 0) { Counter counterToAdd = counter.copy(); counterToAdd.add(amount - counter.getCount()); - permanent.addCounters(counterToAdd, game); + permanent.addCounters(counterToAdd, source, game); } } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java index 88e26acdc4e..cd7c4dd6b34 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemEffect.java @@ -24,8 +24,7 @@ * 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.abilities.effects.common; import mage.MageObject; @@ -37,7 +36,7 @@ import mage.game.command.Emblem; /** * - * @author nantuko + * @author nantuko */ public class GetEmblemEffect extends OneShotEffect { @@ -65,7 +64,7 @@ public class GetEmblemEffect extends OneShotEffect { if (sourceObject == null) { return false; } - game.addEmblem(emblem, source); + game.addEmblem(emblem, sourceObject, source); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java index b449b8928e6..7f5daf38497 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/GetEmblemTargetPlayerEffect.java @@ -24,8 +24,7 @@ * 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.abilities.effects.common; import mage.MageObject; @@ -71,7 +70,7 @@ public class GetEmblemTargetPlayerEffect extends OneShotEffect { if (toPlayer == null) { return false; } - game.addEmblem(emblem, source, toPlayer.getId()); + game.addEmblem(emblem, sourceObject, toPlayer.getId()); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java index 9e8e2f14028..5394ae01370 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RecruiterEffect.java @@ -44,7 +44,7 @@ import mage.target.common.TargetCardInLibrary; */ public class RecruiterEffect extends OneShotEffect { - private static FilterCard filter; + private final FilterCard filter; public RecruiterEffect(FilterCard filter) { super(Outcome.Benefit); @@ -64,7 +64,7 @@ public class RecruiterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if(controller != null) { + if (controller != null) { TargetCardInLibrary targetCards = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter); Cards cards = new CardsImpl(); if (controller.searchLibrary(targetCards, game)) { @@ -73,7 +73,7 @@ public class RecruiterEffect extends OneShotEffect { controller.revealCards(staticText, cards, game); controller.shuffleLibrary(source, game); - if(cards.size() > 0) { + if (cards.size() > 0) { controller.putCardsOnTopOfLibrary(cards, game, source, true); } return true; @@ -83,10 +83,10 @@ public class RecruiterEffect extends OneShotEffect { @Override public String getText(Mode mode) { - if(staticText != null && !staticText.isEmpty()) { + if (staticText != null && !staticText.isEmpty()) { return staticText; } - return "search your library for any number of " + filter.getMessage() + - " and reveal those cards. Shuffle your library, then put them on top of it in any order."; + return "search your library for any number of " + filter.getMessage() + + " and reveal those cards. Shuffle your library, then put them on top of it in any order."; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealHandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealHandTargetEffect.java index ab40f84db8f..089e36ef35b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealHandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealHandTargetEffect.java @@ -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.abilities.effects.common; import mage.MageObject; @@ -43,11 +42,11 @@ import mage.players.Player; public class RevealHandTargetEffect extends OneShotEffect { private final TargetController targetController; - + public RevealHandTargetEffect() { this(TargetController.OPPONENT); } - + public RevealHandTargetEffect(TargetController targetController) { super(Outcome.Discard); this.targetController = targetController; @@ -64,7 +63,7 @@ public class RevealHandTargetEffect extends OneShotEffect { Player player = game.getPlayer(source.getFirstTarget()); MageObject sourceObject = game.getObject(source.getSourceId()); if (player != null && sourceObject != null) { - player.revealCards(sourceObject.getName(), player.getHand(), game); + player.revealCards(sourceObject.getIdName(), player.getHand(), game); return true; } return false; @@ -74,7 +73,7 @@ public class RevealHandTargetEffect extends OneShotEffect { public RevealHandTargetEffect copy() { return new RevealHandTargetEffect(this); } - + private String getText() { StringBuilder sb = new StringBuilder("Target "); switch (targetController) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java index 88fbd03cc98..9458a18b49b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainProtectionFromColorTargetEffect.java @@ -63,7 +63,7 @@ public class GainProtectionFromColorTargetEffect extends GainAbilityTargetEffect public GainProtectionFromColorTargetEffect(final GainProtectionFromColorTargetEffect effect) { super(effect); - choice = effect.choice; + this.choice = effect.choice.copy(); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java index 709eb78698a..0dc24e8709b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAllEffect.java @@ -66,7 +66,7 @@ public class AddCountersAllEffect extends OneShotEffect { if (controller != null && sourceObject != null) { if (counter != null) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.addCounters(counter.copy(), game); + permanent.addCounters(counter.copy(), source, game); if (!game.isSimulation()) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + permanent.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java index c50a023a5a9..a96dfea05f9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java @@ -83,7 +83,7 @@ public class AddCountersAttachedEffect extends OneShotEffect { if (attachedTo != null && counter != null) { Counter newCounter = counter.copy(); newCounter.add(amount.calculate(game, source, this)); - attachedTo.addCounters(newCounter, game); + attachedTo.addCounters(newCounter, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index 0ea83b7f345..99f46c8f7a1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -103,7 +103,7 @@ public class AddCountersSourceEffect extends OneShotEffect { countersToAdd--; } newCounter.add(countersToAdd); - card.addCounters(newCounter, game); + card.addCounters(newCounter, source, game); if (informPlayers && !game.isSimulation()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { @@ -128,7 +128,7 @@ public class AddCountersSourceEffect extends OneShotEffect { } newCounter.add(countersToAdd); int before = permanent.getCounters(game).getCount(newCounter.getName()); - permanent.addCounters(newCounter, game); + permanent.addCounters(newCounter, source, game); if (informPlayers && !game.isSimulation()) { int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before; Player player = game.getPlayer(source.getControllerId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 00567000649..05587f40fbc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -97,7 +97,7 @@ public class AddCountersTargetEffect extends OneShotEffect { } newCounter.add(calculated); int before = permanent.getCounters(game).getCount(counter.getName()); - permanent.addCounters(newCounter, game); + permanent.addCounters(newCounter, source, game); int numberAdded = permanent.getCounters(game).getCount(counter.getName()) - before; affectedTargets++; if (!game.isSimulation()) { @@ -114,7 +114,7 @@ public class AddCountersTargetEffect extends OneShotEffect { + counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + player.getLogName()); } } else if (card != null) { - card.addCounters(counter, game); + card.addCounters(counter, source, game); if (!game.isSimulation()) { game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(" ").append(counter.getName()) .append(" counter to ").append(card.getName()) diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java index a053016e00b..c3d0461a1a2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddPlusOneCountersAttachedEffect.java @@ -70,7 +70,7 @@ public class AddPlusOneCountersAttachedEffect extends OneShotEffect { if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(amount), game); + creature.addCounters(CounterType.P1P1.createInstance(amount), source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java index 6c1e8525bcb..6d84a0614f8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddRemoveAllTimeSuspentCountersEffect.java @@ -29,7 +29,6 @@ package mage.abilities.effects.common.counter; import java.util.ArrayList; import java.util.List; - import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; @@ -51,11 +50,11 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect { private final boolean removeCounter; private final String actionStr; - public AddRemoveAllTimeSuspentCountersEffect(Counter counter, Filter filter, boolean removeCounter) { + public AddRemoveAllTimeSuspentCountersEffect(Counter counter, Filter filter, boolean removeCounter) { super(Outcome.Benefit); this.counter = counter; this.filter = filter; - this.removeCounter= removeCounter; + this.removeCounter = removeCounter; actionStr = removeCounter ? " removes " : " puts "; setText(); } @@ -74,38 +73,39 @@ public class AddRemoveAllTimeSuspentCountersEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { if (counter != null) { - List permanents = new ArrayList(game.getBattlefield().getAllActivePermanents()); - execute(game, controller, sourceObject, permanents, removeCounter); + List permanents = new ArrayList<>(game.getBattlefield().getAllActivePermanents()); + execute(game, controller, sourceObject, source, permanents, removeCounter); final List exiledCards = game.getExile().getAllCards(game); - execute(game, controller, sourceObject, exiledCards, removeCounter); + execute(game, controller, sourceObject, source, exiledCards, removeCounter); } return true; - } + } return false; } - private void execute(final Game game, final Player controller, final MageObject sourceObject, final List cards, final boolean removeCounter) { - for (Card card : cards) { - if (filter.match(card, game)) { - final String counterName = counter.getName(); - if (removeCounter) { - final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); - final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); - final Counter modifiedCounter = new Counter(counterName, countersToRemove); - card.removeCounters(modifiedCounter, game); - } else { - card.addCounters(counter, game); + private void execute(final Game game, final Player controller, final MageObject sourceObject, Ability source, final List cards, final boolean removeCounter) { + for (Card card : cards) { + if (filter.match(card, game)) { + final String counterName = counter.getName(); + if (removeCounter) { + final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); + final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); + final Counter modifiedCounter = new Counter(counterName, countersToRemove); + card.removeCounters(modifiedCounter, game); + } else { + card.addCounters(counter, source, game); + } + if (!game.isSimulation()) { + game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") + .append(controller.getLogName()).append(actionStr) + .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) + .append(" counter on ").append(card.getName()).toString()); + } } - if (!game.isSimulation()) - game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ") - .append(controller.getLogName()).append(actionStr) - .append(counter.getCount()).append(" ").append(counterName.toLowerCase()) - .append(" counter on ").append(card.getName()).toString()); } } - } - private void setText() { + private void setText() { StringBuilder sb = new StringBuilder(); final String actionsStr2 = removeCounter ? "remove " : " put "; sb.append(actionsStr2); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java index d0135d2cd52..0f74a9fb4cb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -79,7 +79,7 @@ public class DistributeCountersEffect extends OneShotEffect { for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { - permanent.addCounters(counterType.createInstance(multiTarget.getTargetAmount(target)), game); + permanent.addCounters(counterType.createInstance(multiTarget.getTargetAmount(target)), source, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java index 775777223c8..4979d2ca0f3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/MoveCountersTargetsEffect.java @@ -68,7 +68,7 @@ public class MoveCountersTargetsEffect extends OneShotEffect { Permanent addTargetCreature = game.getPermanent(targetPointer.getTargets(game, source).get(1)); if (removeTargetCreature != null && addTargetCreature != null && removeTargetCreature.getCounters(game).getCount(counterType) >= amount) { removeTargetCreature.removeCounters(counterType.createInstance(amount), game); - addTargetCreature.addCounters(counterType.createInstance(amount), game); + addTargetCreature.addCounters(counterType.createInstance(amount), source, game); if (!game.isSimulation()) { game.informPlayers("Moved " + amount + " " + counterType.getName() + " counter" + (amount > 1 ? "s" : "") + " from " + removeTargetCreature.getLogName() + " to " + addTargetCreature.getLogName()); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index 7ae35237b81..89f4ff24cdb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -79,7 +79,7 @@ public class ProliferateEffect extends OneShotEffect { if (permanent.getCounters(game).size() == 1) { for (Counter counter : permanent.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName()); - permanent.addCounters(newCounter, game); + permanent.addCounters(newCounter, source, game); } } else { Choice choice = new ChoiceImpl(true); @@ -93,7 +93,7 @@ public class ProliferateEffect extends OneShotEffect { for (Counter counter : permanent.getCounters(game).values()) { if (counter.getName().equals(choice.getChoice())) { Counter newCounter = new Counter(counter.getName()); - permanent.addCounters(newCounter, game); + permanent.addCounters(newCounter, source, game); break; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/BloodthirstAbility.java b/Mage/src/main/java/mage/abilities/keyword/BloodthirstAbility.java index 0b8f4d29c61..b57e67959e4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BloodthirstAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BloodthirstAbility.java @@ -71,7 +71,7 @@ class BloodthirstEffect extends OneShotEffect { if (watcher != null && watcher.conditionMet()) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java b/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java index e6593bc0453..77bebff2ef2 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EvolveAbility.java @@ -166,7 +166,7 @@ class EvolveEffect extends OneShotEffect { if (triggeringCreature != null) { Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sourceCreature != null && EvolveAbility.isPowerOrThoughnessGreater(sourceCreature, triggeringCreature)) { - sourceCreature.addCounters(CounterType.P1P1.createInstance(), game); + sourceCreature.addCounters(CounterType.P1P1.createInstance(), source, game); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EVOLVED_CREATURE, sourceCreature.getId(), source.getSourceId(), source.getControllerId())); } return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java b/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java index 5fe9c105880..ed94c7720a0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FabricateAbility.java @@ -93,7 +93,7 @@ class FabricateEffect extends OneShotEffect { "Create " + CardUtil.numberToText(value, "a") + " 1/1 token" + (value > 1 ? "s" : ""), source, game)) { - ((Card) sourceObject).addCounters(CounterType.P1P1.createInstance(value), game); + ((Card) sourceObject).addCounters(CounterType.P1P1.createInstance(value), source, game); } else { new ServoToken().putOntoBattlefield(value, game, source.getSourceId(), controller.getId()); diff --git a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java index c60b3c4bb04..937501a4ea4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java @@ -173,7 +173,7 @@ class GraftDistributeCounterEffect extends OneShotEffect { Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { sourcePermanent.removeCounters(CounterType.P1P1.getName(), 1, game); - targetCreature.addCounters(CounterType.P1P1.createInstance(1), game); + targetCreature.addCounters(CounterType.P1P1.createInstance(1), source, game); if (!game.isSimulation()) { game.informPlayers("Moved one +1/+1 counter from " + sourcePermanent.getLogName() + " to " + targetCreature.getLogName()); } diff --git a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java index 62800ca7842..bcac6e5cd64 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java @@ -159,7 +159,7 @@ class ModularDistributeCounterEffect extends OneShotEffect { if (sourcePermanent != null && targetArtifact != null && player != null) { int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (numberOfCounters > 0) { - targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), game); + targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java index 7c8df41fc84..725d15424b1 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SunburstAbility.java @@ -98,7 +98,7 @@ class SunburstEffect extends OneShotEffect { } if (counter != null) { - permanent.addCounters(counter, game); + permanent.addCounters(counter, source, game); if (!game.isSimulation()) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { diff --git a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java index b3dc8dd964d..5de5b130a53 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SuspendAbility.java @@ -293,7 +293,7 @@ class SuspendExileEffect extends OneShotEffect { if (suspend == Integer.MAX_VALUE) { suspend = source.getManaCostsToPay().getX(); } - card.addCounters(CounterType.TIME.createInstance(suspend), game); + card.addCounters(CounterType.TIME.createInstance(suspend), source, game); if (!game.isSimulation()) { game.informPlayers(controller.getLogName() + " suspends (" + suspend + ") " + card.getLogName()); } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java index eb0a9ec4a36..3f9cfbfcaf4 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java @@ -105,7 +105,7 @@ class UnleashReplacementEffect extends ReplacementEffectImpl { if (!game.isSimulation()) { game.informPlayers(controller.getLogName() + " unleashes " + creature.getName()); } - creature.addCounters(CounterType.P1P1.createInstance(), game); + creature.addCounters(CounterType.P1P1.createInstance(), source, game); } } return false; diff --git a/Mage/src/main/java/mage/cards/Card.java b/Mage/src/main/java/mage/cards/Card.java index c6546aa53d0..672bdd9f4d6 100644 --- a/Mage/src/main/java/mage/cards/Card.java +++ b/Mage/src/main/java/mage/cards/Card.java @@ -157,9 +157,9 @@ public interface Card extends MageObject { Counters getCounters(GameState state); - boolean addCounters(Counter counter, Game game); + boolean addCounters(Counter counter, Ability source, Game game); - boolean addCounters(Counter counter, Game game, ArrayList appliedEffects); + boolean addCounters(Counter counter, Ability source, Game game, ArrayList appliedEffects); void removeCounters(String name, int amount, Game game); diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index d5965330f5e..9d5fed00577 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -502,7 +502,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { Counters countersToAdd = game.getEnterWithCounters(permanent.getId()); if (countersToAdd != null) { for (Counter counter : countersToAdd.values()) { - permanent.addCounters(counter, game); + permanent.addCounters(counter, null, game); } game.setEnterWithCounters(permanent.getId(), null); } @@ -619,14 +619,15 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } @Override - public boolean addCounters(Counter counter, Game game) { - return addCounters(counter, game, null); + public boolean addCounters(Counter counter, Ability source, Game game) { + return addCounters(counter, source, game, null); } @Override - public boolean addCounters(Counter counter, Game game, ArrayList appliedEffects) { + public boolean addCounters(Counter counter, Ability source, Game game, ArrayList appliedEffects) { boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, getControllerOrOwner(), counter.getName(), counter.getCount()); + UUID sourceId = (source == null ? null : source.getSourceId()); + GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, sourceId, getControllerOrOwner(), counter.getName(), counter.getCount()); countersEvent.setAppliedEffects(appliedEffects); if (!game.replaceEvent(countersEvent)) { int amount = countersEvent.getAmount(); @@ -634,18 +635,18 @@ public abstract class CardImpl extends MageObjectImpl implements Card { for (int i = 0; i < amount; i++) { Counter eventCounter = counter.copy(); eventCounter.remove(eventCounter.getCount() - 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, getControllerOrOwner(), counter.getName(), 1); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, sourceId, getControllerOrOwner(), counter.getName(), 1); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { getCounters(game).addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, getControllerOrOwner(), counter.getName(), 1)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, sourceId, getControllerOrOwner(), counter.getName(), 1)); } else { finalAmount--; returnCode = false; } } if (finalAmount > 0) { - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, getControllerOrOwner(), counter.getName(), amount)); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, sourceId, getControllerOrOwner(), counter.getName(), amount)); } } else { returnCode = false; diff --git a/Mage/src/main/java/mage/cards/MeldCard.java b/Mage/src/main/java/mage/cards/MeldCard.java index 3faa8b51ae4..bbf2faef5d9 100644 --- a/Mage/src/main/java/mage/cards/MeldCard.java +++ b/Mage/src/main/java/mage/cards/MeldCard.java @@ -29,8 +29,8 @@ package mage.cards; import java.util.ArrayList; import java.util.UUID; +import mage.abilities.Ability; import mage.constants.CardType; -import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.Counter; import mage.game.Game; @@ -133,17 +133,17 @@ public abstract class MeldCard extends CardImpl { } @Override - public boolean addCounters(Counter counter, Game game, ArrayList appliedEffects) { + public boolean addCounters(Counter counter, Ability source, Game game, ArrayList appliedEffects) { if (this.isMelded()) { - return super.addCounters(counter, game, appliedEffects); + return super.addCounters(counter, source, game, appliedEffects); } else { // can this really happen? boolean returnState = true; if (hasTopHalf(game)) { - returnState |= topHalfCard.addCounters(counter, game, appliedEffects); + returnState |= topHalfCard.addCounters(counter, source, game, appliedEffects); } if (hasBottomHalf(game)) { - returnState |= bottomHalfCard.addCounters(counter, game, appliedEffects); + returnState |= bottomHalfCard.addCounters(counter, source, game, appliedEffects); } return returnState; } @@ -176,12 +176,12 @@ public abstract class MeldCard extends CardImpl { Permanent permanent = game.getPermanent(objectId); return permanent != null && permanent.removeFromZone(game, fromZone, sourceId); } - boolean topRemoved = hasTopHalf(game) && topHalfCard.removeFromZone(game, fromZone, sourceId); + boolean topRemoved = hasTopHalf(game) && topHalfCard.removeFromZone(game, fromZone, sourceId); if (!topRemoved) { // The top half isn't being moved with the pair anymore. halves.remove(topHalfCard); } - boolean bottomRemoved = hasBottomHalf(game) && bottomHalfCard.removeFromZone(game, fromZone, sourceId); + boolean bottomRemoved = hasBottomHalf(game) && bottomHalfCard.removeFromZone(game, fromZone, sourceId); if (!bottomRemoved) { // The bottom half isn't being moved with the pair anymore. halves.remove(bottomHalfCard); diff --git a/Mage/src/main/java/mage/game/Game.java b/Mage/src/main/java/mage/game/Game.java index db89016b244..8670aab12b1 100644 --- a/Mage/src/main/java/mage/game/Game.java +++ b/Mage/src/main/java/mage/game/Game.java @@ -364,9 +364,9 @@ public interface Game extends MageItem, Serializable { void addEffect(ContinuousEffect continuousEffect, Ability source); - void addEmblem(Emblem emblem, Ability source); + void addEmblem(Emblem emblem, MageObject sourceObject, Ability source); - void addEmblem(Emblem emblem, Ability source, UUID toPlayerId); + void addEmblem(Emblem emblem, MageObject sourceObject, UUID toPlayerId); void addCommander(Commander commander); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 6b129cde356..56ce273b395 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1426,19 +1426,21 @@ public abstract class GameImpl implements Game, Serializable { } @Override - public void addEmblem(Emblem emblem, Ability source) { - addEmblem(emblem, source, null); + public void addEmblem(Emblem emblem, MageObject sourceObject, Ability source) { + addEmblem(emblem, sourceObject, source.getControllerId()); } + /** + * + * @param emblem + * @param sourceObject + * @param toPlayerId controller and owner of the emblem + */ @Override - public void addEmblem(Emblem emblem, Ability source, UUID toPlayerId) { + public void addEmblem(Emblem emblem, MageObject sourceObject, UUID toPlayerId) { Emblem newEmblem = emblem.copy(); - newEmblem.setSourceId(source.getSourceId()); - if (toPlayerId == null) { - newEmblem.setControllerId(source.getControllerId()); - } else { - newEmblem.setControllerId(toPlayerId); - } + newEmblem.setSourceObject(sourceObject); + newEmblem.setControllerId(toPlayerId); newEmblem.assignNewId(); newEmblem.getAbilities().newId(); for (Ability ability : newEmblem.getAbilities()) { diff --git a/Mage/src/main/java/mage/game/command/CommandObject.java b/Mage/src/main/java/mage/game/command/CommandObject.java index eba4d6ea50e..04be1ceed60 100644 --- a/Mage/src/main/java/mage/game/command/CommandObject.java +++ b/Mage/src/main/java/mage/game/command/CommandObject.java @@ -24,24 +24,26 @@ * 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.game.command; +import java.util.UUID; import mage.MageObject; -import java.util.UUID; - /** -* -* @author Viserion, nantuko -*/ + * + * @author Viserion, nantuko + */ public interface CommandObject extends MageObject { UUID getSourceId(); + UUID getControllerId(); + void assignNewId(); + MageObject getSourceObject(); + @Override CommandObject copy(); } diff --git a/Mage/src/main/java/mage/game/command/Commander.java b/Mage/src/main/java/mage/game/command/Commander.java index b89cbc22b5d..d31721b97b7 100644 --- a/Mage/src/main/java/mage/game/command/Commander.java +++ b/Mage/src/main/java/mage/game/command/Commander.java @@ -47,11 +47,11 @@ import mage.util.GameLog; public class Commander implements CommandObject { - private final Card card; + private final Card sourceObject; private final Abilities abilites = new AbilitiesImpl<>(); public Commander(Card card) { - this.card = card; + this.sourceObject = card; abilites.add(new CastCommanderAbility(card)); for (Ability ability : card.getAbilities()) { if (!(ability instanceof SpellAbility)) { @@ -62,21 +62,22 @@ public class Commander implements CommandObject { } private Commander(Commander copy) { - this.card = copy.card; + this.sourceObject = copy.sourceObject; } - public Card getCard() { - return card; + @Override + public Card getSourceObject() { + return sourceObject; } @Override public UUID getSourceId() { - return card.getId(); + return sourceObject.getId(); } @Override public UUID getControllerId() { - return card.getOwnerId(); + return sourceObject.getOwnerId(); } @Override @@ -90,12 +91,12 @@ public class Commander implements CommandObject { @Override public String getName() { - return card.getName(); + return sourceObject.getName(); } @Override public String getIdName() { - return card.getName() + " [" + card.getId().toString().substring(0, 3) + "]"; + return sourceObject.getName() + " [" + sourceObject.getId().toString().substring(0, 3) + "]"; } @Override @@ -110,22 +111,22 @@ public class Commander implements CommandObject { @Override public List getCardType() { - return card.getCardType(); + return sourceObject.getCardType(); } @Override public List getSubtype(Game game) { - return card.getSubtype(game); + return sourceObject.getSubtype(game); } @Override public boolean hasSubtype(String subtype, Game game) { - return card.hasSubtype(subtype, game); + return sourceObject.hasSubtype(subtype, game); } @Override public List getSupertype() { - return card.getSupertype(); + return sourceObject.getSupertype(); } @Override @@ -144,42 +145,42 @@ public class Commander implements CommandObject { @Override public ObjectColor getColor(Game game) { - return card.getColor(game); + return sourceObject.getColor(game); } - + @Override public ObjectColor getFrameColor(Game game) { - return card.getFrameColor(game); + return sourceObject.getFrameColor(game); } @Override public FrameStyle getFrameStyle() { - return card.getFrameStyle(); + return sourceObject.getFrameStyle(); } @Override public ManaCosts getManaCost() { - return card.getManaCost(); + return sourceObject.getManaCost(); } @Override public int getConvertedManaCost() { - return card.getConvertedManaCost(); + return sourceObject.getConvertedManaCost(); } @Override public MageInt getPower() { - return card.getPower(); + return sourceObject.getPower(); } @Override public MageInt getToughness() { - return card.getToughness(); + return sourceObject.getToughness(); } - + @Override public int getStartingLoyalty() { - return card.getStartingLoyalty(); + return sourceObject.getStartingLoyalty(); } @Override @@ -201,27 +202,27 @@ public class Commander implements CommandObject { @Override public UUID getId() { - return card.getId(); + return sourceObject.getId(); } @Override public String getImageName() { - return card.getImageName(); + return sourceObject.getImageName(); } @Override public int getZoneChangeCounter(Game game) { - return card.getZoneChangeCounter(game); + return sourceObject.getZoneChangeCounter(game); } @Override public void updateZoneChangeCounter(Game game, ZoneChangeEvent event) { - card.updateZoneChangeCounter(game, event); + sourceObject.updateZoneChangeCounter(game, event); } @Override public void setZoneChangeCounter(int value, Game game) { - card.setZoneChangeCounter(value, game); + sourceObject.setZoneChangeCounter(value, game); } } diff --git a/Mage/src/main/java/mage/game/command/Emblem.java b/Mage/src/main/java/mage/game/command/Emblem.java index cfe9fa14c23..8501b2ea729 100644 --- a/Mage/src/main/java/mage/game/command/Emblem.java +++ b/Mage/src/main/java/mage/game/command/Emblem.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import mage.MageInt; +import mage.MageObject; import mage.ObjectColor; import mage.abilities.Abilities; import mage.abilities.AbilitiesImpl; @@ -38,6 +39,7 @@ import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.cards.Card; import mage.cards.FrameStyle; import mage.constants.CardType; import mage.game.Game; @@ -53,13 +55,13 @@ public class Emblem implements CommandObject { private static ObjectColor emptyColor = new ObjectColor(); private static ManaCosts emptyCost = new ManaCostsImpl(); - private String name; + private String name = ""; private UUID id; private UUID controllerId; - private UUID sourceId; + private MageObject sourceObject; private FrameStyle frameStyle; private Abilities abilites = new AbilitiesImpl<>(); - private String expansionSetCodeForImage = null; + private String expansionSetCodeForImage = ""; public Emblem() { this.id = UUID.randomUUID(); @@ -70,8 +72,9 @@ public class Emblem implements CommandObject { this.name = emblem.name; this.frameStyle = emblem.frameStyle; this.controllerId = emblem.controllerId; - this.sourceId = emblem.sourceId; + this.sourceObject = emblem.sourceObject; this.abilites = emblem.abilites.copy(); + this.expansionSetCodeForImage = emblem.expansionSetCodeForImage; } @Override @@ -84,9 +87,29 @@ public class Emblem implements CommandObject { this.id = UUID.randomUUID(); } + public void setSourceObject(MageObject sourceObject) { + this.sourceObject = sourceObject; + if (sourceObject instanceof Card) { + if (name.isEmpty()) { + name = ((Card) sourceObject).getSubtype(null).toString(); + } + if (expansionSetCodeForImage.isEmpty()) { + expansionSetCodeForImage = ((Card) sourceObject).getExpansionSetCode(); + } + } + } + + @Override + public MageObject getSourceObject() { + return sourceObject; + } + @Override public UUID getSourceId() { - return this.sourceId; + if (sourceObject != null) { + return sourceObject.getId(); + } + return null; } @Override @@ -99,10 +122,6 @@ public class Emblem implements CommandObject { this.abilites.setControllerId(controllerId); } - public void setSourceId(UUID sourceId) { - this.sourceId = sourceId; - } - @Override public String getName() { return name; @@ -162,8 +181,8 @@ public class Emblem implements CommandObject { public ObjectColor getColor(Game game) { return emptyColor; } - - @Override + + @Override public ObjectColor getFrameColor(Game game) { return emptyColor; } @@ -187,7 +206,7 @@ public class Emblem implements CommandObject { public MageInt getToughness() { return MageInt.EmptyMageInt; } - + @Override public int getStartingLoyalty() { return 0; diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index 8adf4f1e775..ee8e2306e44 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -344,8 +344,8 @@ public class GameEvent implements Serializable { return new GameEvent(type, targetId, null, playerId); } - public static GameEvent getEvent(EventType type, UUID targetId, UUID playerId, String data, int amount) { - GameEvent event = getEvent(type, targetId, playerId); + public static GameEvent getEvent(EventType type, UUID targetId, UUID sourceId, UUID playerId, String data, int amount) { + GameEvent event = getEvent(type, targetId, sourceId, playerId); event.setAmount(amount); event.setData(data); return event; diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 0e61767678e..6f292279d14 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -787,7 +787,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { return 0; } for (Counter counter : markedDamage) { - addCounters(counter, game); + addCounters(counter, null, game); } markedDamage.clear(); return 0; @@ -832,7 +832,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { markDamage(CounterType.M1M1.createInstance(actualDamage)); } else { // deal damage immediately - addCounters(CounterType.M1M1.createInstance(actualDamage), game); + addCounters(CounterType.M1M1.createInstance(actualDamage), null, game); } } else { this.damage += actualDamage; diff --git a/Mage/src/main/java/mage/game/permanent/token/GoblinTokenWithHaste.java b/Mage/src/main/java/mage/game/permanent/token/GoblinTokenWithHaste.java index 2e77c7a3441..f008d38c6e3 100644 --- a/Mage/src/main/java/mage/game/permanent/token/GoblinTokenWithHaste.java +++ b/Mage/src/main/java/mage/game/permanent/token/GoblinTokenWithHaste.java @@ -41,5 +41,6 @@ public class GoblinTokenWithHaste extends GoblinToken { public GoblinTokenWithHaste() { super(); addAbility(HasteAbility.getInstance()); + this.description = "1/1 red Goblin creature token with haste"; } } diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index db9ef64e6c2..ada5635bef9 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -851,13 +851,13 @@ public class Spell extends StackObjImpl implements Card { } @Override - public boolean addCounters(Counter counter, Game game) { - return card.addCounters(counter, game); + public boolean addCounters(Counter counter, Ability source, Game game) { + return card.addCounters(counter, source, game); } @Override - public boolean addCounters(Counter counter, Game game, ArrayList appliedEffects) { - return card.addCounters(counter, game, appliedEffects); + public boolean addCounters(Counter counter, Ability source, Game game, ArrayList appliedEffects) { + return card.addCounters(counter, source, game, appliedEffects); } @Override diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 86f053fa9d0..c74ad682b1b 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -570,6 +570,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (!player.hasLeft() && !player.hasLost()) { player.setGameUnderYourControl(false); player.setTurnControlledBy(this.getId()); + game.informPlayers(getLogName() + " controlls the turn of " + player.getLogName()); } DelayedTriggeredAbility ability = new AtTheEndOfTurnStepPostDelayedTriggeredAbility(new LoseControlOnOtherPlayersControllerEffect(this.getLogName(), player.getLogName())); ability.setSourceId(getId()); @@ -1849,24 +1850,24 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean addCounters(Counter counter, Game game) { boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(EventType.ADD_COUNTERS, playerId, playerId, counter.getName(), counter.getCount()); + GameEvent countersEvent = GameEvent.getEvent(EventType.ADD_COUNTERS, playerId, null, playerId, counter.getName(), counter.getCount()); if (!game.replaceEvent(countersEvent)) { int amount = countersEvent.getAmount(); int finalAmount = amount; for (int i = 0; i < amount; i++) { Counter eventCounter = counter.copy(); eventCounter.remove(amount - 1); - GameEvent event = GameEvent.getEvent(EventType.ADD_COUNTER, playerId, playerId, counter.getName(), 1); + GameEvent event = GameEvent.getEvent(EventType.ADD_COUNTER, playerId, null, playerId, counter.getName(), 1); if (!game.replaceEvent(event)) { getCounters().addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, playerId, playerId, counter.getName(), 1)); + game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, playerId, null, playerId, counter.getName(), 1)); } else { finalAmount--; returnCode = false; } } if (finalAmount > 0) { - game.fireEvent(GameEvent.getEvent(EventType.COUNTERS_ADDED, playerId, playerId, counter.getName(), amount)); + game.fireEvent(GameEvent.getEvent(EventType.COUNTERS_ADDED, playerId, null, playerId, counter.getName(), amount)); } } else { returnCode = false; diff --git a/Mage/src/main/java/mage/target/common/TargetCardInHand.java b/Mage/src/main/java/mage/target/common/TargetCardInHand.java index 179764de7cc..7a545c7ae40 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInHand.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInHand.java @@ -24,8 +24,7 @@ * 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.target.common; import java.util.HashSet; @@ -60,6 +59,7 @@ public class TargetCardInHand extends TargetCard { public TargetCardInHand(int minNumTargets, int maxNumTargets, FilterCard filter) { super(minNumTargets, maxNumTargets, Zone.HAND, filter); + setNotTarget(true); } public TargetCardInHand(final TargetCardInHand target) { diff --git a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java index 4d83aad72f6..ac22810bb81 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java @@ -69,6 +69,7 @@ public class TargetCardInLibrary extends TargetCard { // with a certain card type or color, that player isn’t required to find some or all of those cards // even if they’re present in that zone. this.setRequired(!filter.hasPredicates()); + this.setNotTarget(true); this.librarySearchLimit = Integer.MAX_VALUE; } diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index fcdbe1f0854..c79962848af 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -28608,7 +28608,7 @@ Heron's Grace Champion|Game Day|54|R|{2}{G}{W}|Creature - Human Knight|3|3|Flash Essence Extraction|Game Day|55|U|{1}{B}{B}|Instant|||Essence Extraction deals 3 damage to target creature and you gain 3 life.| Cultivator of Blades|Game Day|56|R|{3}{G}{G}|Creature - Elf Artificer|1|1|Fabricate 2$Whenever Cultivator of Blades attacks, you may have other attacking creatures get +X/+X until end of turn, where X is Cultivator of Blades's power.| Trophy Mage|Game Day|57|U|{2}{U}|Creature - Human Wizard|2|2|When Trophy Mage enters the battlefield, you may search your library for an artifact card with converted mana cost 3, reveal it, put it into your hand, then shuffle your library.| -Yaheeni's Expertise|Aether Revolt|58|R|{2}{B}{B}|Sorcery|||All creatures get -3/-3 until end of turn.$You may cast a card with converted mana cost 3 or less from your hand without paying its mana cost.| +Yahenni's Expertise|Aether Revolt|58|R|{2}{B}{B}|Sorcery|||All creatures get -3/-3 until end of turn.$You may cast a card with converted mana cost 3 or less from your hand without paying its mana cost.| Garruk Relentless|Innistrad|181a|M|{3}{G}|Planeswalker - Garruk|||When Garruk Relentless has two or fewer loyalty counters on him, transform him.$0: Garruk Relentless deals 3 damage to target creature. That creature deals damage equal to its power to him.$0: Put a 2/2 green Wolf creature token onto the battlefield.| Garruk, the Veil-Cursed|Innistrad|181b|M||Planeswalker - Garruk|||+1: Put a 1/1 black Wolf creature token with deathtouch onto the battlefield.$-1: Sacrifice a creature. If you do, search your library for a creature card, reveal it, put it into your hand, then shuffle your library.$-3: Creatures you control gain trample and get +X/+X until end of turn, where X is the number of creature cards in your graveyard.| Stand|Invasion|292a|U|{W}|Instant|||Prevent the next 2 damage that would be dealt to target creature this turn.$| @@ -29944,6 +29944,7 @@ Guardian of the Great Conduit|Kaladesh|271|U|{3}{G}|Creature - Elemental|2|4|Re Terrain Elemental|Kaladesh|272|C|{1}{G}|Creature - Elemental|3|2|| Verdant Crescendo|Kaladesh|273|R|{3}{G}|Sorcery|||Search your library for a basic land card and put it onto the battlefield tapped. Search your library and graveyard for a card named Nissa, Nature's Artisan, reveal it, and put it into your hand. Then shuffle your library.| Woodland Stream|Kaladesh|274|C||Land|||Woodland Stream enters the battlefield tapped.${t}: Add {G} or {U} to your mana pool.|Cataclysmic Gearhulk|Masterpiece Series|1|M|{3}{W}{W}|Artifact Creature - Construct|4|5|Vigilance$When Cataclysmic Gearhulk enters the battlefield, each player chooses an artifact, a creature, an enchantment, and a planeswalker from among the nonland permanents he or she controls, the sacrifices the rest.| +Cataclysmic Gearhulk|Masterpiece Series|1|M|{3}{W}{W}|Artifact Creature - Construct|4|5|Vigilance$When Cataclysmic Gearhulk enters the battlefield, each player chooses an artifact, a creature, an enchantment, and a planeswalker from among the nonland permanents he or she controls, then sacrifices the rest.| Combustible Gearhulk|Masterpiece Series|2|M|{4}{R}{R}|Artifact Creature - Construct|6|6|First strike$When Combustible Gearhulk enters the battlefield, target opponent may have you draw three cards. If the player doesn't, put the top three cards of your library into your graveyard, then Combustible Gearhulk deals damage to that player equal to the total converted mana cost of those cards.| Noxious Gearhulk|Masterpiece Series|3|M|{4}{B}{B}|Artifact Creature - Construct|5|4|Menace$When Noxious Gearhulk enters the battlefield, you may destroy another target creature. If a creature is destroyed this way, you gain life equal to its toughness.| Torrential Gearhulk|Masterpiece Series|4|M|{4}{U}{U}|Artifact Creature - Construct|5|6|Flash$When Torrential Gearhulk enters the battlefield, you may cast target instant card from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead.| @@ -29973,6 +29974,28 @@ Steel Overseer|Masterpiece Series|27|M|{2}|Artifact Creature - Construct|1|1|{ta Sword of Feast and Famine|Masterpiece Series|28|M|{3}|Artifact - Equipment|||Equipped creature gets +2/+2 and has protection from black and from green.$Whenever equipped creature deals combat damage to a player, that player discards a card and you untap all lands you control.$Equip {2}| Sword of Fire and Ice|Masterpiece Series|29|M|{3}|Artifact - Equipment|||Equipped creature gets +2/+2 and has protection from red and from blue.$Whenever equipped creature deals combat damage to a player, Sword of Fire and Ice deals 2 damage to target creature or player and you draw a card.$Equip {2}| Sword of Light and Shadow|Masterpiece Series|30|M|{3}|Artifact - Equipment|||Equipped creature gets +2/+2 and has protection from white and from black.$Whenever equipped creature deals combat damage to a player, you gain 3 life and you may return up to one target creature card from your graveyard to your hand.$Equip {2}| +Arcbound Ravager|Masterpiece Series|31|M|{2}|Artifact Creature - Beast|0|0|Sacrifice an artifact: Put a +1/+1 counter on Arcbound Ravager.$Modular 1.| +Black Vise|Masterpiece Series|32|M|{1}|Artifact|||As Black Vise enters the battlefield, choose an opponent.$At the beginning of the chosen player's upkeep, Black Vise deals X damage to that player, where X is the number of cards in his or her hand minus 4.| +Chalice of the Void|Masterpiece Series|33|M|{X}{X}|Artifact|||Chalice of the Void enters the battlefield with X charge counters on it.$Whenever a player casts a spell with converted mana cost equal to the number of charge counters on Chalice of the Void, counter that spell.| +Defense Grid|Masterpiece Series|34|M|{2}|Artifact|||Each spell costs {3} more to cast except during its controller's turn.| +Duplicant|Masterpiece Series|35|M|{6}|Artifact Creature|2|4|Imprint — When Duplicant enters the battlefield, you may exile target nontoken creature.$As long as a card exiled with Duplicant is a creature card, Duplicant has the power, toughness, and creature types of the land creature card exiled with Duplicant. It's still a Shapeshifter.| +Engineered Explosives|Masterpiece Series|36|M|{X}|Artifact|||Sunburst${2}, Sacrifice Engineered Explosives: Destroy each nonland permanent with converted mana cost equal to the number of charge counters on Engineered Explosives.| +Ensnaring Bridge|Masterpiece Series|37|M|{3}|Artifact|||Creatures with power greater than the number of cards in your hand can't attack.| +Extraplanar Lens|Masterpiece Series|38|M|{3}|Artifact|||Imprint — When Extraplanar Lens enters the battlefield, you may exile target land you control.$Whenever a land with the same name as the exiled card is tapped for mana, its controller adds one mana to his or her mana pool of any type that land produced.| +Grindstone|Masterpiece Series|39|M|{1}|Artifact|||{3}, {T}: Target player puts the top two cards of his or her library into his or her graveyard. If both cards share a color, repeat this process.| +Meekstone|Masterpiece Series|40|M|{1}|Artifact|||Creatures with power 3 or greater don't untap during their controllers' untap steps.| +Oblivion Stone|Masterpiece Series|41|M|{3}|Artifact|||{4}, {T}: Put a fate counter on target permanent.${5}, {T}, Sacrifice Oblivion Stone: Destroy each nonland permanent without a fate counter on it, then remove all fate counters from all permanents.| +Ornithopter|Masterpiece Series|42|M|{0}|Artifact Creature - Thopter|0|2|Flying| +Pithing Needle|Masterpiece Series|44|M|{1}|Artifact|||As Pithing Needle enters the battlefield, name a card.$Activated abilities of sources with the chosen name can't be activated unless they're mana abilities.| +Platinum Angel|Masterpiece Series|46|M|{7}|Artifact Creature - Angel|4|4|Flying$You can't lose the game and your opponents can't win the game.| +Sphere of Resistance|Masterpiece Series|47|M|{2}|Artifact|||Spells cost {1} more to cast.| +Staff of Domination|Masterpiece Series|48|M|{3}|Artifact|||{1}: Untap Staff of Domination.${2}, {T}: You gain 1 life.${3}, {T}: Untap target creature.${4}, {T}: Tap target creature.${5}, {T}: Draw a card.| +Sundering Titan|Masterpiece Series|49|M|{8}|Artifact Creature - Golem|7|10|When Sundering Titan enters the battlefield or leaves the battlefield, choose a land of each basic land type, then destroy those lands.| +Sword of Body and Mind|Masterpiece Series|50|M|{3}|Artifact|||Equipped creature gets +2/+2 and has protection from green and from blue.$Whenever equipped creature deals combat damage to a player, you creature a 2/2 green Wolf creature token and that player puts the top ten cards of his or her library into his or her graveyard.$Equip {2}| +Sword of War and Peace|Masterpiece Series|51|M|{3}|Artifact|||Equipped creature gets +2/+2 and has protection from red and from white.$Whenever equipped creature deals combat damage to a player, Sword of War and Peace deals damage to that player equal to the number of cards in his or her hand and you gain 1 life for each card in your hand.$Equip {2}| +Trinisphere|Masterpiece Series|52|M|{3}|Artifact|||As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast.| +Vedalken Shackles|Masterpiece Series|53|M|{3}|Artifact|||You may choose not to untap Vedalken Shackles during your untap step.${2}, {T}: Gain control of target creature with power less than or equal to the number of Islands you control for as long as Vedalken Shackles remains tapped.| +Wurmcoil Engine|Masterpiece Series|54|M|{6}|Artifact Creature - Wurm|6|6|Deathtouch, lifelink$When Wurmcoil Engine dies, create a 3/3 colorless Wurm artifact creature token with deathtouch and a 3/3 colorless Wurm artifact creature token with lifelink.| Duelist's Heritage|Commander 2016|1|R|{2}{W}|Enchantment|||Whenever one or more creatures attack, you may have target attacking creature gain double strike until end of turn.| Entrapment Maneuver|Commander 2016|2|R|{3}{W}|Instant|||Target player sacrifices an attacking creature. You create X 1/1 white Soldier creature tokens, where X is that creature's toughness.| Orzhov Advokist|Commander 2016|3|U|{2}{W}|Creature - Human Advisor|1|4|At the beginning of your upkeep, each player may put two +1/+1 counters on a creature he or she controls. If a player does, creatures that player controls can't attack you or a planeswalker you control until your next turn.| @@ -30331,7 +30354,7 @@ Disallow|Aether Revolt|31|R|{1}{U}{U}|Instant|||Counter target spell, activated Quicksmith Spy|Aether Revolt|41|R|{3}{U}|Creature - Human Artificer|2|3|When Quicksmith Spy enters the battlefield, target artifact you control gains "{T}: Draw a card" for as long as you control Quicksmith Spy.| Trophy Mage|Aether Revolt|48|U|{2}{U}|Creature - Human Wizard|2|2|When Trophy Mage enters the battlefield, you may search your library for an artifact card with converted mana cost 3, reveal it, put it into your hand, then shuffle your library.| Battle at the Bridge|Aether Revolt|53|R|{X}{B}|Sorcery|||Improvise (Your artifacts can help cast this spell. Each artifact you tap after you're done activating mana abilities pays for {1}.)$Target creature gets -X/-X until end of turn. You gain X life.| -Yaheeni's Expertise|Aether Revolt|75|R|{2}{B}{B}|Sorcery|||All creatures get -3/-3 until end of turn.$You may cast a card with converted mana cost 3 or less from your hand without paying its mana cost.| +Yahenni's Expertise|Aether Revolt|75|R|{2}{B}{B}|Sorcery|||All creatures get -3/-3 until end of turn.$You may cast a card with converted mana cost 3 or less from your hand without paying its mana cost.| Pia's Revolution|Aether Revolt|91|R|{2}{R}|Enchantment|||Whenever a nontoken artifact is put into your graveyard from the battlefield, return that card to your hand unless target opponent has Pia's Revolution deal 3 damage to him or her.| Quicksmith Rebel|Aether Revolt|93|R|{3}{R}|Creature - Human Artificer|3|2|When Quicksmith Rebel enters the battlefield, target artifact you control gains "{T}: This artifact deals 2 damage to target creature or player" for as long as you control Quicksmith Rebel.| Ajani Unyielding|Aether Revolt|127|M|{4}{G}{W}|Planeswalker - Ajani|||+2: Reveal the top three cards of your library. Put all nonland permanent cards revealed this way into your hand and the rest on the bottom of your library in any order.$-2: Exile target creature. Its controller gains life equal to its power.$-9: Put five +1/+1 counters on each creature you control and five loyalty counters on each other planeswalker you control.|