From a625af0b167a5c40becd8a045a4925081c2de26f Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 10:22:59 +0200 Subject: [PATCH 01/34] * Fixed a null pointer exception bug of table password protection. --- Mage/src/mage/game/match/MatchOptions.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage/src/mage/game/match/MatchOptions.java b/Mage/src/mage/game/match/MatchOptions.java index 9b554e4caf3..237a7f5a49a 100644 --- a/Mage/src/mage/game/match/MatchOptions.java +++ b/Mage/src/mage/game/match/MatchOptions.java @@ -60,6 +60,7 @@ public class MatchOptions implements Serializable { public MatchOptions(String name, String gameType) { this.name = name; this.gameType = gameType; + this.password = ""; } public String getName() { From f96c88f4cd0c7dfa69fbe661a42ef2f406cb6444 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 10:23:28 +0200 Subject: [PATCH 02/34] * Vile Requiem - Fixed bug that no targets could be choosen. --- Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java b/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java index 25ed25f6c5e..db8038ce633 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java +++ b/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java @@ -75,11 +75,11 @@ public class VileRequiem extends CardImpl { // {1}{B}, Sacrifice Vile Requiem: Destroy up to X target nonblack creatures, where X is the number of verse counters on Vile Requiem. They can't be regenerated. Effect effect = new DestroyTargetEffect(true); effect.setText("Destroy up to X target nonblack creatures, where X is the number of verse counters on {this}. They can't be regenerated"); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}")); - originalId = ability.getOriginalId(); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}")); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetCreaturePermanent(0,0,filter, false)); this.addAbility(ability); + originalId = ability.getOriginalId(); } @@ -99,6 +99,7 @@ public class VileRequiem extends CardImpl { public VileRequiem(final VileRequiem card) { super(card); + this.originalId = card.originalId; } @Override From b206983e75a64b9f93051f9561ffeeebeb9c395c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 12:34:29 +0200 Subject: [PATCH 03/34] * Fixed that deck elements visible state of JoinTablePanel was set wrongly. --- .../src/main/java/mage/client/dialog/JoinTableDialog.java | 2 +- .../src/main/java/mage/client/table/TablesPanel.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java index e6d491b0edb..5413b8fc176 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java @@ -59,7 +59,7 @@ public class JoinTableDialog extends MageDialog { this.tableId = tableId; this.isTournament = isTournament; this.newPlayerPanel.setPlayerName(MageFrame.getSession().getUserName()); - this.newPlayerPanel.showDeckElements(isLimited); + this.newPlayerPanel.showDeckElements(!isLimited); this.setModal(true); this.setLocation(100, 100); this.setVisible(true); diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 4f1bc40d513..5c46245c291 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -252,8 +252,8 @@ public class TablesPanel extends javax.swing.JPanel { private void saveDividerLocations() { // save panel sizes and divider locations. Rectangle rec = MageFrame.getDesktop().getBounds(); - StringBuilder sb = new StringBuilder(Double.toString(rec.getWidth())).append("x").append(Double.toString(rec.getHeight())); - PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb.toString()); + String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight()); + PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb); PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation())); PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPane2.getDividerLocation())); PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, Integer.toString(chatPanel.getSplitDividerLocation())); @@ -263,9 +263,9 @@ public class TablesPanel extends javax.swing.JPanel { Rectangle rec = MageFrame.getDesktop().getBounds(); if (rec != null) { String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null); - StringBuilder sb = new StringBuilder(Double.toString(rec.getWidth())).append("x").append(Double.toString(rec.getHeight())); + String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight()); // use divider positions only if screen size is the same as it was the time the settings were saved - if (size != null && size.equals(sb.toString())) { + if (size != null && size.equals(sb)) { String location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, null); if (location != null && jSplitPane1 != null) { jSplitPane1.setDividerLocation(Integer.parseInt(location)); From 03337221c991c647a0436ac1e5ec08c2645b2ab7 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 12:35:24 +0200 Subject: [PATCH 04/34] * Fixed draft start handling to prevent unneccessary waiting check start thread. --- .../mage/server/draft/DraftController.java | 27 ++++++++++--------- Mage/src/mage/game/draft/Draft.java | 4 +++ Mage/src/mage/game/draft/DraftImpl.java | 11 ++++++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/draft/DraftController.java b/Mage.Server/src/main/java/mage/server/draft/DraftController.java index 87a7bb501a9..b39e18f19f9 100644 --- a/Mage.Server/src/main/java/mage/server/draft/DraftController.java +++ b/Mage.Server/src/main/java/mage/server/draft/DraftController.java @@ -149,19 +149,9 @@ public class DraftController { return false; } - private synchronized void startDraft() { - for (final Entry entry: draftSessions.entrySet()) { - if (!entry.getValue().init()) { - logger.fatal("Unable to initialize client for playerId " + entry.getKey()); - //TODO: generate client error message - return; - } - } - draft.start(); - } - - private void checkStart() { - if (allJoined()) { + private synchronized void checkStart() { + if (!draft.isStarted() && allJoined()) { + draft.setStarted(); ThreadExecutor.getInstance().getCallExecutor().execute( new Runnable() { @Override @@ -172,6 +162,17 @@ public class DraftController { } } + private void startDraft() { + for (final Entry entry: draftSessions.entrySet()) { + if (!entry.getValue().init()) { + logger.fatal("Unable to initialize client for playerId " + entry.getKey()); + //TODO: generate client error message + return; + } + } + draft.start(); + } + private boolean allJoined() { if (!draft.allJoined()) { return false; diff --git a/Mage/src/mage/game/draft/Draft.java b/Mage/src/mage/game/draft/Draft.java index 0c03a555206..12aef514840 100644 --- a/Mage/src/mage/game/draft/Draft.java +++ b/Mage/src/mage/game/draft/Draft.java @@ -56,6 +56,9 @@ public interface Draft extends MageItem, Serializable { int getCardNum(); boolean addPick(UUID playerId, UUID cardId); void start(); + boolean isStarted(); + void setStarted(); + boolean allJoined(); void leave(UUID playerId); void autoPick(UUID playerId); @@ -68,4 +71,5 @@ public interface Draft extends MageItem, Serializable { boolean isAbort(); void setAbort(boolean abort); + } diff --git a/Mage/src/mage/game/draft/DraftImpl.java b/Mage/src/mage/game/draft/DraftImpl.java index 79f52948fbb..7528bb29bbe 100644 --- a/Mage/src/mage/game/draft/DraftImpl.java +++ b/Mage/src/mage/game/draft/DraftImpl.java @@ -64,6 +64,7 @@ public abstract class DraftImpl implements Draft { protected int[] times = {75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5}; protected boolean abort = false; + protected boolean started = false; protected transient TableEventSource tableEventSource = new TableEventSource(); protected transient PlayerQueryEventSource playerQueryEventSource = new PlayerQueryEventSource(); @@ -340,4 +341,14 @@ public abstract class DraftImpl implements Draft { this.abort = abort; } + @Override + public boolean isStarted() { + return started; + } + + @Override + public void setStarted() { + started = true; + } + } From 746796ba05e56eb1fca52ce081e0254aea8676ec Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 12:36:13 +0200 Subject: [PATCH 05/34] * Added log message for identifying cause of #602. --- Mage/src/mage/abilities/effects/ContinuousEffects.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mage/src/mage/abilities/effects/ContinuousEffects.java b/Mage/src/mage/abilities/effects/ContinuousEffects.java index 8d291fa63b0..aed6eb9fc9e 100644 --- a/Mage/src/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/mage/abilities/effects/ContinuousEffects.java @@ -826,6 +826,10 @@ public class ContinuousEffects implements Serializable { layer = filterLayeredEffects(layerEffects, Layer.PTChangingEffects_7); for (ContinuousEffect effect: layer) { HashSet abilities = layeredEffects.getAbility(effect.getId()); + if (abilities == null) { // Added because of #602 - can be removed if cause is removed + logger.error("Effect not connected to an ability: " + effect.toString()); + continue; + } for (Ability ability : abilities) { effect.apply(Layer.PTChangingEffects_7, SubLayer.SetPT_7b, ability, game); } From 63cd1318559c0522fcdebc76ad25a6d075079389 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 12:37:10 +0200 Subject: [PATCH 06/34] * Added context information for restore call to be able to set add info if restore can#t be executed. --- .../src/mage/abilities/costs/mana/ManaCostsImpl.java | 2 +- .../abilities/keyword/CumulativeUpkeepAbility.java | 2 +- Mage/src/mage/game/Game.java | 2 +- Mage/src/mage/game/GameImpl.java | 8 ++++---- Mage/src/mage/players/PlayerImpl.java | 12 ++++++------ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Mage/src/mage/abilities/costs/mana/ManaCostsImpl.java b/Mage/src/mage/abilities/costs/mana/ManaCostsImpl.java index 6eabaf70262..e2cc69ce2a6 100644 --- a/Mage/src/mage/abilities/costs/mana/ManaCostsImpl.java +++ b/Mage/src/mage/abilities/costs/mana/ManaCostsImpl.java @@ -144,7 +144,7 @@ public class ManaCostsImpl extends ArrayList implements M game.removeBookmark(bookmark); return true; } - game.restoreState(bookmark); + game.restoreState(bookmark, ability.getRule()); return false; } diff --git a/Mage/src/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/mage/abilities/keyword/CumulativeUpkeepAbility.java index 1b111f5538c..227e9ac9f36 100644 --- a/Mage/src/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -131,7 +131,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { return true; } else{ - game.restoreState(bookmark); + game.restoreState(bookmark, source.getRule()); } } permanent.sacrifice(source.getSourceId(), game); diff --git a/Mage/src/mage/game/Game.java b/Mage/src/mage/game/Game.java index 24769cad465..147f8199da1 100644 --- a/Mage/src/mage/game/Game.java +++ b/Mage/src/mage/game/Game.java @@ -264,7 +264,7 @@ public interface Game extends MageItem, Serializable { //game transaction methods void saveState(boolean bookmark); int bookmarkState(); - void restoreState(int bookmark); + void restoreState(int bookmark, String context); void removeBookmark(int bookmark); int getSavedStateSize(); boolean isSaveGame(); diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index 5bb82a891ec..3431ac7632f 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -510,11 +510,11 @@ public abstract class GameImpl implements Game, Serializable { } @Override - public void restoreState(int bookmark) { + public void restoreState(int bookmark, String context) { if (!simulation && !this.hasEnded()) { // if player left or game is over no undo is possible - this could lead to wrong winner if (bookmark != 0) { if (!savedStates.contains(bookmark - 1)) { - throw new UnsupportedOperationException("It was not possible to do the requested undo operation (bookmark " + (bookmark -1) + " does not exist)"); + throw new UnsupportedOperationException("It was not possible to do the requested undo operation (bookmark " + (bookmark -1) + " does not exist) context: " + context); } int stateNum = savedStates.get(bookmark - 1); removeBookmark(bookmark); @@ -1032,7 +1032,7 @@ public abstract class GameImpl implements Game, Serializable { if (player != null) { int bookmark = player.getStoredBookmark(); if (bookmark != -1) { - restoreState(bookmark); + restoreState(bookmark, "undo"); player.setStoredBookmark(-1); fireUpdatePlayersEvent(); } @@ -1122,7 +1122,7 @@ public abstract class GameImpl implements Game, Serializable { logger.fatal("Game exception gameId: " + getId(), ex); ex.printStackTrace(); this.fireErrorEvent("Game exception occurred: ", ex); - restoreState(bookmark); + restoreState(bookmark, ""); bookmark = 0; continue; } diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index f27dbfcaf2f..102bc3f1c7b 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -837,7 +837,7 @@ public abstract class PlayerImpl implements Player, Serializable { resetStoredBookmark(game); return true; } - game.restoreState(bookmark); + game.restoreState(bookmark, ability.getRule()); } } return false; @@ -881,7 +881,7 @@ public abstract class PlayerImpl implements Player, Serializable { return true; } } - game.restoreState(bookmark); + game.restoreState(bookmark, ability.getRule()); } return false; } @@ -900,7 +900,7 @@ public abstract class PlayerImpl implements Player, Serializable { resetStoredBookmark(game); return true; } - game.restoreState(bookmark); + game.restoreState(bookmark, ability.getRule()); } } else { int bookmark = game.bookmarkState(); @@ -910,7 +910,7 @@ public abstract class PlayerImpl implements Player, Serializable { resetStoredBookmark(game); return true; } - game.restoreState(bookmark); + game.restoreState(bookmark, ability.getRule()); } return false; } @@ -928,7 +928,7 @@ public abstract class PlayerImpl implements Player, Serializable { return true; } } - game.restoreState(bookmark); + game.restoreState(bookmark, action.getRule()); } return false; } @@ -998,7 +998,7 @@ public abstract class PlayerImpl implements Player, Serializable { return true; } } - game.restoreState(bookmark); + game.restoreState(bookmark, source.getRule()); return false; } From 499b548a148a651c9b285450dc44bb107dad123d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 18:56:37 +0200 Subject: [PATCH 07/34] * Some changes to chat handling to fix unintended empty line. --- .../main/java/mage/client/chat/ChatPanel.java | 10 +++-- .../mage/client/components/ColorPane.java | 39 +++++++++---------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java index d67c3f1a063..aaf2a916297 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java @@ -230,9 +230,10 @@ public class ChatPanel extends javax.swing.JPanel { if (username != null && !username.isEmpty()) { text.append(getColoredText(userColor, username + userSeparator)); } - text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.PAY) + "
")); - + text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.PAY))); this.txtConversation.append(text.toString()); + this.txtConversation.requestFocusInWindow(); + this.txtMessage.requestFocusInWindow(); } private String getColoredText(String color, String text) { @@ -279,8 +280,9 @@ public class ChatPanel extends javax.swing.JPanel { public void useExtendedView(VIEW_MODE extendedViewMode) { this.extendedViewMode = extendedViewMode; this.txtConversation.setExtBackgroundColor(new Color(0, 0, 0, 100)); - this.txtConversation.setBackground(new Color(0, 0, 0, 0)); - this.txtConversation.setForeground(new Color(255, 255, 255)); + // this.txtConversation.setBackground(new Color(0, 0, 0, 0)); + // this.txtConversation.setForeground(new Color(255, 255, 255)); + this.txtConversation.setSelectionColor(Color.LIGHT_GRAY); this.jScrollPaneTxt.setOpaque(false); this.jScrollPaneTxt.getViewport().setOpaque(false); } diff --git a/Mage.Client/src/main/java/mage/client/components/ColorPane.java b/Mage.Client/src/main/java/mage/client/components/ColorPane.java index 0c0ff506aa4..bb77d498e90 100644 --- a/Mage.Client/src/main/java/mage/client/components/ColorPane.java +++ b/Mage.Client/src/main/java/mage/client/components/ColorPane.java @@ -1,7 +1,16 @@ package mage.client.components; -import javax.swing.*; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Graphics; +import static javafx.scene.paint.Color.color; +import javax.swing.JEditorPane; +import javax.swing.JPanel; +import javax.swing.JTextPane; +import javax.swing.text.AttributeSet; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyleContext; import javax.swing.text.html.HTMLDocument; import javax.swing.text.html.HTMLEditorKit; @@ -10,14 +19,14 @@ import javax.swing.text.html.HTMLEditorKit; * * @author nantuko */ -public class ColorPane extends JTextPane { +public class ColorPane extends JEditorPane { HTMLEditorKit kit = new HTMLEditorKit(); - HTMLDocument doc = new HTMLDocument(); + HTMLDocument doc = new HTMLDocument(); public ColorPane() { this.setEditorKit(kit); - this.setDocument(doc); + this.setDocument(doc); } /** * This method solves the known issue with Nimbus LAF background transparency and background color. @@ -36,26 +45,14 @@ public class ColorPane extends JTextPane { super.setText(string); //To change body of generated methods, choose Tools | Templates. } - public void append(String s) { + public void append(String text) { try { setEditable(true); - kit.insertHTML(doc, doc.getLength(), s, 0, 0, null); + kit.insertHTML(doc, doc.getLength(), text, 0, 0, null); + setEditable(false); int len = getDocument().getLength(); setCaretPosition(len); - setEditable(false); - -// -// -// StyleContext sc = StyleContext.getDefaultStyleContext(); -// AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, color); -// -// int len = getDocument().getLength(); -// -// setCaretPosition(len); -// setCharacterAttributes(aset, false); -// replaceSelection(s); -// -// + } catch (Exception e) { e.printStackTrace(); } From bdd163080d0f4a450c5c05beb1a215f9cadfaf62 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 12 Oct 2014 22:37:39 +0200 Subject: [PATCH 08/34] * Draft - Show draft time and draft progress. Show game threads and ma games. Fixed a problem with AI player and password. --- .../src/main/java/mage/client/chat/ChatPanel.java | 11 +++++++---- .../mage/client/dialog/NewTournamentDialog.form | 15 ++++++++++++++- .../mage/client/dialog/NewTournamentDialog.java | 12 ++++++++++-- .../main/java/mage/client/table/TablesPanel.java | 1 - .../mage/client/tournament/TournamentPanel.java | 13 +++++++------ Mage.Common/src/mage/view/RoomUsersView.java | 14 +++++++++++++- Mage.Common/src/mage/view/TournamentView.java | 10 ++++++++++ .../BoosterDraftEliminationTournament.java | 2 +- .../main/java/mage/server/TableController.java | 2 +- .../main/java/mage/server/game/GamesRoomImpl.java | 6 +++++- Mage/src/mage/game/tournament/Tournament.java | 2 ++ Mage/src/mage/game/tournament/TournamentImpl.java | 9 ++++++++- 12 files changed, 78 insertions(+), 19 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java index aaf2a916297..695db98429f 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java @@ -283,8 +283,8 @@ public class ChatPanel extends javax.swing.JPanel { // this.txtConversation.setBackground(new Color(0, 0, 0, 0)); // this.txtConversation.setForeground(new Color(255, 255, 255)); this.txtConversation.setSelectionColor(Color.LIGHT_GRAY); - this.jScrollPaneTxt.setOpaque(false); - this.jScrollPaneTxt.getViewport().setOpaque(false); + this.jScrollPaneTxt.setOpaque(!chatType.equals(ChatType.TABLES)); + this.jScrollPaneTxt.getViewport().setOpaque(!chatType.equals(ChatType.TABLES)); } public void setSplitDividerLocation(int location) { @@ -310,8 +310,11 @@ public class ChatPanel extends javax.swing.JPanel { this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]); JTableHeader th = jTablePlayers.getTableHeader(); TableColumnModel tcm = th.getColumnModel(); - tcm.getColumn(0).setHeaderValue(new StringBuilder("Players").append(" (").append(this.players.length).append(")").toString()); - tcm.getColumn(2).setHeaderValue(new StringBuilder("Games").append(" (").append(roomUserInfo.getNumberActiveGames()).append(")").toString()); + tcm.getColumn(0).setHeaderValue("Players (" + this.players.length + ")"); + tcm.getColumn(2).setHeaderValue( + "Games (" + roomUserInfo.getNumberActiveGames() + + (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " T:" + roomUserInfo.getNumberGameThreads():"") + + " max: " + roomUserInfo.getNumberMaxGames() + ")"); th.repaint(); this.fireTableDataChanged(); } diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form index 2b2ea027583..2f7ffaa1d29 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form @@ -212,21 +212,26 @@ + + + + + - + @@ -284,6 +289,9 @@ + + + @@ -311,9 +319,13 @@ + + + + @@ -403,6 +415,7 @@ + diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index 89e6ae1619d..b4397b1d5de 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -170,13 +170,17 @@ public class NewTournamentDialog extends MageDialog { lblName.setText("Name:"); lbTimeLimit.setText("Time Limit:"); + lbTimeLimit.setToolTipText("The time a player has for the whole match. If a player runs out of time during a game, he loses the complete match. "); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cbTimeLimit, org.jdesktop.beansbinding.ObjectProperty.create(), lbTimeLimit, org.jdesktop.beansbinding.BeanProperty.create("labelFor")); bindingGroup.addBinding(binding); - lblPassword.setText("Password:"); + cbTimeLimit.setToolTipText("The time a player has for the whole match. If a player runs out of time during a game, he loses the complete match. "); - txtPassword.setToolTipText("Players have to enter this password to be able to enter the created table."); + lblPassword.setText("Password:"); + lblPassword.setToolTipText("Players have to enter the password to be able to join this table."); + + txtPassword.setToolTipText("Players have to enter the password to be able to join this table."); lblTournamentType.setText("Tournament Type:"); @@ -205,6 +209,7 @@ public class NewTournamentDialog extends MageDialog { lblNumWins.setText("Wins:"); + spnNumWins.setToolTipText("To win a match a player has to win this number of games."); spnNumWins.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { spnNumWinsnumPlayersChanged(evt); @@ -221,7 +226,9 @@ public class NewTournamentDialog extends MageDialog { }); lblNumRounds.setText("Number of Swiss Rounds:"); + lblNumRounds.setToolTipText("The number of rounds the swiss tournament has in total.
\nThe tournaments ends after that number of rounds or
\nif there are less than two players left in the tournament."); + spnNumRounds.setToolTipText("The number of rounds the swiss tournament has in total.
\nThe tournaments ends after that number of rounds or
\nif there are less than two players left in the tournament."); spnNumRounds.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { spnNumRoundsnumPlayersChanged(evt); @@ -272,6 +279,7 @@ public class NewTournamentDialog extends MageDialog { ); cbAllowSpectators.setText("Allow spectators"); + cbAllowSpectators.setToolTipText("Allow other players to watch the games of this table."); lblPlayer1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N lblPlayer1.setText("Player 1 (You)"); diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 5c46245c291..82623154538 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -83,7 +83,6 @@ import mage.remote.Session; import mage.view.MatchView; import mage.view.RoomUsersView; import mage.view.TableView; -import mage.view.UsersView; import org.apache.log4j.Logger; /** diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java index 4da305ff202..cbb5465c023 100644 --- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java +++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java @@ -213,18 +213,19 @@ public class TournamentPanel extends javax.swing.JPanel { } switch (tournament.getTournamentState()) { case "Constructing": - String constructionTime = ""; + String timeLeft = ""; if (tournament.getStepStartTime() != null) { - constructionTime = Format.getDuration(tournament.getConstructionTime() - (tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000); + timeLeft = Format.getDuration(tournament.getConstructionTime() - (tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000); } - txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(constructionTime).append(")").toString()); + txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(timeLeft).append(")").toString()); break; case "Dueling": - String duelingTime = ""; + case "Drafting": + String usedTime = ""; if (tournament.getStepStartTime() != null) { - duelingTime = Format.getDuration((tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000); + usedTime = Format.getDuration((tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000); } - txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(duelingTime).append(")").toString()); + txtTournamentState.setText(tournament.getTournamentState() + " (" + usedTime + ") " + tournament.getRunningInfo()); break; default: txtTournamentState.setText(tournament.getTournamentState()); diff --git a/Mage.Common/src/mage/view/RoomUsersView.java b/Mage.Common/src/mage/view/RoomUsersView.java index d9385b31636..1b69f77f35a 100644 --- a/Mage.Common/src/mage/view/RoomUsersView.java +++ b/Mage.Common/src/mage/view/RoomUsersView.java @@ -39,12 +39,16 @@ public class RoomUsersView implements Serializable { private static final long serialVersionUID = 1L; private final int numberActiveGames; + private final int numberGameThreads; + private final int numberMaxGames; private final List usersView; - public RoomUsersView(List usersView, int numberActiveGames) { + public RoomUsersView(List usersView, int numberActiveGames, int numberGameThreads, int numberMaxGames) { this.numberActiveGames = numberActiveGames; + this.numberGameThreads = numberGameThreads; + this.numberMaxGames = numberMaxGames; this.usersView = usersView; } @@ -53,6 +57,14 @@ public class RoomUsersView implements Serializable { return numberActiveGames; } + public int getNumberGameThreads() { + return numberGameThreads; + } + + public int getNumberMaxGames() { + return numberMaxGames; + } + public List getUsersView() { return usersView; } diff --git a/Mage.Common/src/mage/view/TournamentView.java b/Mage.Common/src/mage/view/TournamentView.java index ad07273a02c..ae6ca94a64a 100644 --- a/Mage.Common/src/mage/view/TournamentView.java +++ b/Mage.Common/src/mage/view/TournamentView.java @@ -57,6 +57,7 @@ public class TournamentView implements Serializable { private final List rounds = new ArrayList<>(); private final List players = new ArrayList<>(); + private final String runningInfo; public TournamentView(Tournament tournament) { @@ -77,6 +78,11 @@ public class TournamentView implements Serializable { serverTime = new Date(); tournamentState = tournament.getTournamentState(); + if (tournament.getTournamentState().equals("Drafting") && tournament.getDraft() != null) { + runningInfo = "booster/card: " + tournament.getDraft().getBoosterNum() +"/" + (tournament.getDraft().getCardNum() -1); + } else { + runningInfo = ""; + } for (TournamentPlayer player: tournament.getPlayers()) { players.add(new TournamentPlayerView(player)); } @@ -132,5 +138,9 @@ public class TournamentView implements Serializable { public Date getServerTime() { return serverTime; } + + public String getRunningInfo() { + return runningInfo; + } } diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java index f375a816eb6..dd833badda2 100644 --- a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java @@ -55,7 +55,7 @@ public class BoosterDraftEliminationTournament extends TournamentSingleEliminati } protected void draft() { - Draft draft = new BoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); + draft = new BoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); for (TournamentPlayer player: players.values()) { draft.addPlayer(player.getPlayer()); player.setState(TournamentPlayerState.DRAFTING); diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index 3e993a826ba..f987b539c89 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -249,7 +249,7 @@ public class TableController { return false; } // check password - if (!table.getMatch().getOptions().getPassword().isEmpty()) { + if (!table.getMatch().getOptions().getPassword().isEmpty() && playerType.equals("Human")) { if (!table.getMatch().getOptions().getPassword().equals(password)) { user.showUserMessage("Join Table", "Wrong password."); return false; diff --git a/Mage.Server/src/main/java/mage/server/game/GamesRoomImpl.java b/Mage.Server/src/main/java/mage/server/game/GamesRoomImpl.java index de9495f36a6..9c669e6af5f 100644 --- a/Mage.Server/src/main/java/mage/server/game/GamesRoomImpl.java +++ b/Mage.Server/src/main/java/mage/server/game/GamesRoomImpl.java @@ -129,7 +129,11 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable { Collections.sort(users, new UserNameSorter()); List roomUserInfo = new ArrayList<>(); - roomUserInfo.add(new RoomUsersView(users, GameManager.getInstance().getNumberActiveGames())); + roomUserInfo.add(new RoomUsersView(users, + GameManager.getInstance().getNumberActiveGames(), + ThreadExecutor.getInstance().getActiveThreads(ThreadExecutor.getInstance().getGameExecutor()), + ConfigSettings.getInstance().getMaxGameThreads() + )); roomUsersView = roomUserInfo; } diff --git a/Mage/src/mage/game/tournament/Tournament.java b/Mage/src/mage/game/tournament/Tournament.java index 046afbe0a93..9f4abe7a861 100644 --- a/Mage/src/mage/game/tournament/Tournament.java +++ b/Mage/src/mage/game/tournament/Tournament.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.UUID; import mage.cards.ExpansionSet; import mage.cards.decks.Deck; +import mage.game.draft.Draft; import mage.game.events.Listener; import mage.game.events.PlayerQueryEvent; import mage.game.events.TableEvent; @@ -93,4 +94,5 @@ public interface Tournament { void cleanUpOnTournamentEnd(); boolean isAbort(); void setAbort(boolean abort); + Draft getDraft(); } diff --git a/Mage/src/mage/game/tournament/TournamentImpl.java b/Mage/src/mage/game/tournament/TournamentImpl.java index 7dd636b8d62..e92f50ee41c 100644 --- a/Mage/src/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/mage/game/tournament/TournamentImpl.java @@ -41,6 +41,7 @@ import mage.cards.Card; import mage.cards.ExpansionSet; import mage.cards.decks.Deck; import mage.constants.TournamentPlayerState; +import mage.game.draft.Draft; import mage.game.draft.DraftCube; import mage.game.events.Listener; import mage.game.events.PlayerQueryEvent; @@ -77,9 +78,11 @@ public abstract class TournamentImpl implements Tournament { protected Date stepStartTime; protected boolean abort; protected String tournamentState; - + protected Draft draft; + public TournamentImpl(TournamentOptions options) { this.options = options; + draft = null; startTime = new Date(); abort = false; } @@ -501,5 +504,9 @@ public abstract class TournamentImpl implements Tournament { this.stepStartTime = stepStartTime; } + @Override + public Draft getDraft() { + return draft; + } } From d03966738e2fdf724f0a00baa695fd3cde5e9f7a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 13 Oct 2014 08:39:40 +0200 Subject: [PATCH 09/34] * Some changes to logging. --- Mage.Server/src/main/java/mage/server/TableController.java | 3 +-- Mage/src/mage/players/PlayerImpl.java | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index f987b539c89..370f64a4c52 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -608,10 +608,9 @@ public class TableController { // log about game started - logger.info("GAME started [" + match.getName() +"] "+ creator + " - " + opponent.toString()); + logger.info("GAME started " + match.getGame().getId() + " [" + match.getName() +"] "+ creator + " - " + opponent.toString()); logger.debug("- matchId: " + match.getId() + " [" + match.getName() + "]"); if (match.getGame() != null) { - logger.debug("- gameId: " + match.getGame().getId()); logger.debug("- chatId: " + GameManager.getInstance().getChatId(match.getGame().getId())); } else { logger.debug("- no valid game object"); diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 102bc3f1c7b..5e089b1b9c9 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -1632,11 +1632,8 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public void concede(Game game) { - logger.debug(this.getName() + (" concedes gameId:" +game.getId())); game.gameOver(playerId); - logger.debug("Before lost " + this.getName()); lost(game); - logger.debug("After lost " + this.getName()); this.left = true; } From 7c9ed6dc707a53644b490393e0bf0f4d574a8ea3 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 13 Oct 2014 17:24:19 +0200 Subject: [PATCH 10/34] * Some chnages to trace of restriction effects. --- .../sets/theros/AshiokNightmareWeaver.java | 2 + Mage/src/mage/util/trace/TraceUtil.java | 76 ++++++++++++------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/Mage.Sets/src/mage/sets/theros/AshiokNightmareWeaver.java b/Mage.Sets/src/mage/sets/theros/AshiokNightmareWeaver.java index 138cb5ec08e..de5dde0e8f1 100644 --- a/Mage.Sets/src/mage/sets/theros/AshiokNightmareWeaver.java +++ b/Mage.Sets/src/mage/sets/theros/AshiokNightmareWeaver.java @@ -172,10 +172,12 @@ class AshiokNightmareWeaverPutIntoPlayEffect extends OneShotEffect { if (player.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null && player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId())) { + // why is this change of controller neccessary? Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) { permanent.changeControllerId(source.getControllerId(), game); } + ContinuousEffectImpl effect = new AshiokNightmareWeaverAddTypeEffect(); effect.setTargetPointer(new FixedTarget(card.getId())); game.addEffect(effect, source); diff --git a/Mage/src/mage/util/trace/TraceUtil.java b/Mage/src/mage/util/trace/TraceUtil.java index 2299f092731..241354b567b 100644 --- a/Mage/src/mage/util/trace/TraceUtil.java +++ b/Mage/src/mage/util/trace/TraceUtil.java @@ -1,5 +1,8 @@ package mage.util.trace; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.StaticAbility; @@ -123,48 +126,69 @@ public class TraceUtil { } private static void traceCombat(Game game, Permanent attacker, Permanent blocker) { - String uuid = "[" + UUID.randomUUID() + "] "; - log.error(uuid+"Tracing game state..."); + String prefix = "> "; + log.error(prefix+"Tracing game state..."); if (blocker != null) { - log.error(uuid+blocker.getLogName() + " could block " + attacker.getLogName()); + log.error(prefix+blocker.getLogName() + " could block " + attacker.getLogName()); } - log.error(uuid); - log.error(uuid+"Attacker abilities: "); + log.error(prefix); + log.error(prefix+"Attacker abilities: "); for (Ability ability : attacker.getAbilities()) { - log.error(uuid+" " + ability.toString() + ", id=" + ability.getId()); + log.error(prefix+" " + ability.toString() + ", id=" + ability.getId()); } if (blocker != null) { - log.error(uuid+"Blocker abilities: "); + log.error(prefix+"Blocker abilities: "); for (Ability ability : blocker.getAbilities()) { - log.error(uuid+" " + ability.toString() + ", id=" + ability.getId()); + log.error(prefix+" " + ability.toString() + ", id=" + ability.getId()); } } - log.error(uuid); - log.error(uuid+"Flying ability id: " + FlyingAbility.getInstance().getId()); - log.error(uuid+"Reach ability id: " + ReachAbility.getInstance().getId()); - log.error(uuid+"Intimidate ability id: " + IntimidateAbility.getInstance().getId()); - log.error(uuid); + log.error(prefix); + log.error(prefix+"Flying ability id: " + FlyingAbility.getInstance().getId()); + log.error(prefix+"Reach ability id: " + ReachAbility.getInstance().getId()); + log.error(prefix+"Intimidate ability id: " + IntimidateAbility.getInstance().getId()); + log.error(prefix); - log.error(uuid+"Restriction effects:"); - Ability ability = attacker.getAbilities().size() > 0 ? attacker.getAbilities().get(0) : null; - ContinuousEffectsList restrictionEffects = (ContinuousEffectsList) game.getContinuousEffects().getRestrictionEffects(); - for (RestrictionEffect effect : restrictionEffects) { - log.error(uuid+" " + effect); - log.error(uuid+" id=" + effect.getId()); - log.error(uuid+" applies to attacker=" + effect.applies(attacker, ability, game)); - if (blocker != null) { - log.error(uuid+" applies to blocker=" + effect.applies(blocker, ability, game)); + log.error(prefix+"Restriction effects:"); + log.error(prefix+" Applied to ATTACKER:"); + HashMap> attackerResEffects = game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game); + for (Map.Entry> entry : attackerResEffects.entrySet()) { + log.error(prefix+" " + entry.getKey()); + log.error(prefix+" id=" + entry.getKey().getId()); + for (Ability ability: entry.getValue()) { + log.error(prefix+" ability=" + ability); } } - - traceForPermanent(game, attacker, uuid, restrictionEffects); + log.error(prefix+" Applied to BLOCKER:"); if (blocker != null) { - traceForPermanent(game, blocker, uuid, restrictionEffects); + HashMap> blockerResEffects = game.getContinuousEffects().getApplicableRestrictionEffects(blocker, game); + for (Map.Entry> entry : blockerResEffects.entrySet()) { + log.error(prefix+" " + entry.getKey()); + log.error(prefix+" id=" + entry.getKey().getId()); + for (Ability ability: entry.getValue()) { + log.error(prefix+" ability=" + ability); + } + } + } + ContinuousEffectsList restrictionEffects = (ContinuousEffectsList) game.getContinuousEffects().getRestrictionEffects(); + log.error(prefix); + log.error(prefix+" List of all restriction effects:"); + for (RestrictionEffect effect : restrictionEffects) { + log.error(prefix+" " + effect); + log.error(prefix+" id=" + effect.getId()); } - log.error(uuid); + log.error(prefix); + log.error(prefix+" Trace Attacker:"); + traceForPermanent(game, attacker, prefix, restrictionEffects); + if (blocker != null) { + log.error(prefix); + log.error(prefix+" Trace Blocker:"); + traceForPermanent(game, blocker, prefix, restrictionEffects); + } + + log.error(prefix); } private static void traceForPermanent(Game game, Permanent permanent, String uuid, ContinuousEffectsList restrictionEffects) { From dce9ea978e136d0e2b70d04515a7f9c51303f18e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 13 Oct 2014 17:24:53 +0200 Subject: [PATCH 11/34] * Fixed a minor problem of tooltip rule text generation. --- .../effects/common/continious/BoostTargetEffect.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java index ee18316ed7a..cda82266d4c 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java @@ -121,7 +121,10 @@ public class BoostTargetEffect extends ContinuousEffectImpl { } sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" get "); } else { - sb.append("Target ").append(target.getTargetName()).append(" gets "); + if (!target.getTargetName().toUpperCase().startsWith("ANOTHER")) { + sb.append("Target "); + } + sb.append(target.getTargetName()).append(" gets "); } String p = power.toString(); if(!p.startsWith("-")) { From 81408b3649aa43b79b2a669021370205d0031f6c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 13 Oct 2014 23:41:08 +0200 Subject: [PATCH 12/34] * Fixed Miracle handling (fixes #447). --- .../sets/avacynrestored/BanishingStroke.java | 2 +- .../avacynrestored/BlessingsOfNature.java | 2 +- .../avacynrestored/BonfireOfTheDamned.java | 2 +- .../sets/avacynrestored/DevastationTide.java | 2 +- .../sets/avacynrestored/EntreatTheAngels.java | 2 +- .../sets/avacynrestored/ReforgeTheSoul.java | 3 +- .../avacynrestored/RevengeOfTheHunted.java | 3 +- .../sets/avacynrestored/TemporalMastery.java | 2 +- .../mage/sets/avacynrestored/Terminus.java | 2 +- .../sets/avacynrestored/ThunderousWrath.java | 3 +- .../mage/sets/avacynrestored/Vanishment.java | 2 +- .../cards/abilities/keywords/MiracleTest.java | 59 ++++++++ .../java/org/mage/test/player/TestPlayer.java | 25 ++++ .../abilities/keyword/MiracleAbility.java | 131 +++++++++++++++--- Mage/src/mage/game/GameImpl.java | 1 - Mage/src/mage/game/events/GameEvent.java | 1 + .../CardsDrawnDuringDrawStepWatcher.java | 6 +- .../mage/watchers/common/MiracleWatcher.java | 37 +---- 18 files changed, 222 insertions(+), 63 deletions(-) diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BanishingStroke.java b/Mage.Sets/src/mage/sets/avacynrestored/BanishingStroke.java index 82bba6e34d3..7bdba959e61 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/BanishingStroke.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/BanishingStroke.java @@ -66,7 +66,7 @@ public class BanishingStroke extends CardImpl { this.getSpellAbility().addTarget(new TargetPermanent(filter)); // Miracle {W} - this.addAbility(new MiracleAbility(new ManaCostsImpl("{W}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{W}"))); } public BanishingStroke(final BanishingStroke card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java b/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java index 1d69edee486..825dcf3bbe0 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java @@ -58,7 +58,7 @@ public class BlessingsOfNature extends CardImpl { this.getSpellAbility().addEffect(new BlessingsOfNatureEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(4)); - this.addAbility(new MiracleAbility(new ManaCostsImpl("{G}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{G}"))); } public BlessingsOfNature(final BlessingsOfNature card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BonfireOfTheDamned.java b/Mage.Sets/src/mage/sets/avacynrestored/BonfireOfTheDamned.java index 1722ce7af19..a6dd492b038 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/BonfireOfTheDamned.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/BonfireOfTheDamned.java @@ -61,7 +61,7 @@ public class BonfireOfTheDamned extends CardImpl { this.getSpellAbility().addTarget(new TargetPlayer()); // Miracle {X}{R} - this.addAbility(new MiracleAbility(new ManaCostsImpl("{X}{R}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{X}{R}"))); } public BonfireOfTheDamned(final BonfireOfTheDamned card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java b/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java index 14d2abb323b..acf1beb6b5a 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DevastationTide.java @@ -58,7 +58,7 @@ public class DevastationTide extends CardImpl { this.getSpellAbility().addEffect(new DevastationTideEffect()); // Miracle {1}{U} - this.addAbility(new MiracleAbility(new ManaCostsImpl("{1}{U}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{1}{U}"))); } public DevastationTide(final DevastationTide card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/EntreatTheAngels.java b/Mage.Sets/src/mage/sets/avacynrestored/EntreatTheAngels.java index a05892648f6..74dd5e3eb93 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/EntreatTheAngels.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/EntreatTheAngels.java @@ -55,7 +55,7 @@ public class EntreatTheAngels extends CardImpl { this.getSpellAbility().addEffect(new CreateTokenEffect(new AngelToken(), new ManacostVariableValue())); // Miracle {X}{W}{W} - this.addAbility(new MiracleAbility(new ManaCostsImpl("{X}{W}{W}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{X}{W}{W}"))); } public EntreatTheAngels(final EntreatTheAngels card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/ReforgeTheSoul.java b/Mage.Sets/src/mage/sets/avacynrestored/ReforgeTheSoul.java index b753c2eef96..54a2e758d1c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/ReforgeTheSoul.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/ReforgeTheSoul.java @@ -55,7 +55,8 @@ public class ReforgeTheSoul extends CardImpl { // Each player discards his or her hand, then draws seven cards. this.getSpellAbility().addEffect(new ReforgeTheSoulEffect()); - this.addAbility(new MiracleAbility(new ManaCostsImpl("{1}{R}"))); + // Miracle {1}{R} + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{1}{R}"))); } public ReforgeTheSoul(final ReforgeTheSoul card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RevengeOfTheHunted.java b/Mage.Sets/src/mage/sets/avacynrestored/RevengeOfTheHunted.java index 9364ac48e6b..066adf5b3ee 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/RevengeOfTheHunted.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/RevengeOfTheHunted.java @@ -65,7 +65,8 @@ public class RevengeOfTheHunted extends CardImpl { effect.setText("and all creatures able to block it this turn do so"); this.getSpellAbility().addEffect(effect); - this.addAbility(new MiracleAbility(new ManaCostsImpl("{G}"))); + // Miracle {G} + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{G}"))); } public RevengeOfTheHunted(final RevengeOfTheHunted card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TemporalMastery.java b/Mage.Sets/src/mage/sets/avacynrestored/TemporalMastery.java index 15fd7a5a88f..ca81dfff8d8 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/TemporalMastery.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/TemporalMastery.java @@ -53,7 +53,7 @@ public class TemporalMastery extends CardImpl { this.getSpellAbility().addEffect(ExileSpellEffect.getInstance()); // Miracle {1}{U} - this.addAbility(new MiracleAbility(new ManaCostsImpl("{1}{U}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{1}{U}"))); } public TemporalMastery(final TemporalMastery card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Terminus.java b/Mage.Sets/src/mage/sets/avacynrestored/Terminus.java index c2f3a78c30e..b8478b43880 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Terminus.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Terminus.java @@ -58,7 +58,7 @@ public class Terminus extends CardImpl { // Put all creatures on the bottom of their owners' libraries. this.getSpellAbility().addEffect(new TerminusEffect()); - this.addAbility(new MiracleAbility(new ManaCostsImpl("{W}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{W}"))); } public Terminus(final Terminus card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/ThunderousWrath.java b/Mage.Sets/src/mage/sets/avacynrestored/ThunderousWrath.java index 2d8b68067bf..72a6ae13818 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/ThunderousWrath.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/ThunderousWrath.java @@ -52,7 +52,8 @@ public class ThunderousWrath extends CardImpl { this.getSpellAbility().addEffect(new DamageTargetEffect(5)); this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); - this.addAbility(new MiracleAbility(new ManaCostsImpl("{R}"))); + // Miracle {R} + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{R}"))); } public ThunderousWrath(final ThunderousWrath card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Vanishment.java b/Mage.Sets/src/mage/sets/avacynrestored/Vanishment.java index 90592e9875e..ab23c8cdca4 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Vanishment.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Vanishment.java @@ -54,7 +54,7 @@ public class Vanishment extends CardImpl { this.getSpellAbility().addTarget(new TargetNonlandPermanent()); // Miracle {U} - this.addAbility(new MiracleAbility(new ManaCostsImpl("{U}"))); + this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{U}"))); } public Vanishment(final Vanishment card) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MiracleTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MiracleTest.java index 6fd48851a56..720ef177069 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MiracleTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MiracleTest.java @@ -17,7 +17,9 @@ public class MiracleTest extends CardTestPlayerBase { public void testMiracleCost() { addCard(Zone.BATTLEFIELD, playerA, "Island", 2); addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + // Put all creatures on the bottom of their owners' libraries. addCard(Zone.LIBRARY, playerA, "Terminus"); + // Draw a card. addCard(Zone.HAND, playerA, "Think Twice"); skipInitShuffling(); @@ -55,4 +57,61 @@ public class MiracleTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Elite Vanguard", 0); } + /** + * Test that you can cast a card by miracle if you don't put it back to library before casting + */ + @Test + public void testMiracleWillWorkFromHand() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + addCard(Zone.LIBRARY, playerA, "Plains"); + addCard(Zone.LIBRARY, playerA, "Forest"); + addCard(Zone.LIBRARY, playerA, "Thunderous Wrath"); // must be the top most card + addCard(Zone.HAND, playerA, "Brainstorm"); + skipInitShuffling(); + + castSpell(1, PhaseStep.UPKEEP, playerA, "Brainstorm"); + addTarget(playerA, "Forest"); + addTarget(playerA, "Plains"); + addTarget(playerA, playerB); + + setStopAt(1, PhaseStep.DRAW); + execute(); + + assertGraveyardCount(playerA, "Brainstorm", 1); + assertHandCount(playerA, "Thunderous Wrath", 0); + assertGraveyardCount(playerA, "Thunderous Wrath", 1); + assertHandCount(playerA, 0); + // check Thunderous Wrath was played + assertLife(playerA, 20); + assertLife(playerB, 15); + + } + + /** + * Test that you can't cast a card by miracle if you put it back to library before casting + */ + @Test + public void testMiracleWontWorkFromLibrary() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + addCard(Zone.LIBRARY, playerA, "Plains"); + addCard(Zone.LIBRARY, playerA, "Forest"); + addCard(Zone.LIBRARY, playerA, "Thunderous Wrath"); + addCard(Zone.HAND, playerA, "Brainstorm"); + skipInitShuffling(); + + castSpell(1, PhaseStep.UPKEEP, playerA, "Brainstorm"); + addTarget(playerA, "Thunderous Wrath"); + addTarget(playerA, "Plains"); + addTarget(playerA, playerB); + + setStopAt(1, PhaseStep.DRAW); + execute(); + + // check Thunderous Wrath was not played + assertLife(playerA, 20); + assertLife(playerB, 20); + + } } 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 afee79f6c91..b369533c5b2 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 @@ -64,8 +64,10 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import mage.abilities.mana.ManaAbility; +import mage.cards.Card; import mage.constants.Zone; import mage.target.TargetSource; +import mage.target.common.TargetCardInHand; /** * @@ -395,6 +397,29 @@ public class TestPlayer extends ComputerPlayer { } } + if (target instanceof TargetCardInHand) { + for (String targetDefinition: targets) { + String[] targetList = targetDefinition.split("\\^"); + boolean targetFound = false; + for (String targetName: targetList) { + for (Card card: this.getHand().getCards(((TargetCardInHand)target).getFilter(), game)) { + if (card.getName().equals(targetName) || (card.getName()+"-"+card.getExpansionSetCode()).equals(targetName)) { + if (((TargetCardInHand)target).canTarget(source.getControllerId(), card.getId(), source, game) && !target.getTargets().contains(card.getId())) { + target.add(card.getId(), game); + targetFound = true; + break; + } + } + } + } + if (targetFound) { + targets.remove(targetDefinition); + return true; + } + } + + } + } return super.chooseTarget(outcome, target, source, game); } diff --git a/Mage/src/mage/abilities/keyword/MiracleAbility.java b/Mage/src/mage/abilities/keyword/MiracleAbility.java index 0181d23f33a..63802ad6514 100644 --- a/Mage/src/mage/abilities/keyword/MiracleAbility.java +++ b/Mage/src/mage/abilities/keyword/MiracleAbility.java @@ -28,9 +28,21 @@ package mage.abilities.keyword; -import mage.constants.Zone; -import mage.abilities.StaticAbility; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.costs.mana.ManaCosts; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; +import mage.watchers.common.MiracleWatcher; /** * 702.92. Miracle @@ -48,28 +60,52 @@ import mage.abilities.costs.Cost; * If you don't want to cast it at that time (or you can't cast it, perhaps because * there are no legal targets available), you won't be able to cast it later for the miracle cost. * + * RULINGS: + * You still draw the card, whether you use the miracle ability or not. Any ability that + * triggers whenever you draw a card, for example, will trigger. If you don't cast the card + * using its miracle ability, it will remain in your hand. * - * @author noxx + * You can reveal and cast a card with miracle on any turn, not just your own, if it's the + * first card you've drawn that turn. + * + * You don't have to reveal a drawn card with miracle if you don't wish to cast it at that time. + * + * You can cast a card for its miracle cost only as the miracle triggered ability resolves. + * If you don't want to cast it at that time (or you can't cast it, perhaps because there are + * no legal targets available), you won't be able to cast it later for the miracle cost. + * + * You cast the card with miracle during the resolution of the triggered ability. Ignore any timing + * restrictions based on the card's type. + * + * It's important to reveal a card with miracle before it is mixed with the other cards in your hand. + * + * Multiple card draws are always treated as a sequence of individual card draws. For example, if + * you haven't drawn any cards yet during a turn and cast a spell that instructs you to draw three + * cards, you'll draw them one at a time. Only the first card drawn this way may be revealed and cast + * using its miracle ability. + * + * If the card with miracle leaves your hand before the triggered ability resolves, you won't be able + * to cast it using its miracle ability. + * + * You draw your opening hand before any turn begins. Cards you draw for your opening hand + * can't be cast using miracle. + * + * @author noxx, LevelX2 */ -public class MiracleAbility extends StaticAbility { - - private static final String staticRule = " (You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)"; +public class MiracleAbility extends TriggeredAbilityImpl { + private static final String staticRule = " (You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)"; private String ruleText; - - public MiracleAbility(Cost cost) { - super(Zone.BATTLEFIELD, null); - addCost(cost); - ruleText = "Miracle" + cost.getText() + staticRule; + + public MiracleAbility(Card card, ManaCosts miracleCosts) { + super(Zone.HAND, new MiracleEffect(miracleCosts), true); + card.addWatcher(new MiracleWatcher()); + ruleText = "Miracle " + miracleCosts.getText() + staticRule; } - public MiracleAbility(MiracleAbility miracleAbility) { - super(miracleAbility); - } - - @Override - public String getRule() { - return ruleText; + public MiracleAbility(final MiracleAbility ability) { + super(ability); + this.ruleText = ability.ruleText; } @Override @@ -77,4 +113,63 @@ public class MiracleAbility extends StaticAbility { return new MiracleAbility(this); } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType().equals(EventType.MIRACLE_CARD_REVEALED) && event.getSourceId().equals(getSourceId())) { + // Refer to the card at the zone it is now (hand) + FixedTarget fixedTarget = new FixedTarget(event.getSourceId()); + fixedTarget.init(game, this); + getEffects().get(0).setTargetPointer(fixedTarget); + return true; + } + return false; + } + + @Override + public String getRule() { + return ruleText; + } +} + +class MiracleEffect extends OneShotEffect { + + private final ManaCosts miracleCosts; + + public MiracleEffect(ManaCosts miracleCosts) { + super(Outcome.Benefit); + this.staticText = "cast this card for it's miracle cost"; + this.miracleCosts = miracleCosts; + } + + public MiracleEffect(final MiracleEffect effect) { + super(effect); + this.miracleCosts = effect.miracleCosts; + } + + @Override + public MiracleEffect copy() { + return new MiracleEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + // use target pointer here, so it's the same card that triggered the event (not gone back to library e.g.) + Card card = game.getCard(getTargetPointer().getFirst(game, source)); + if (controller != null && card != null) { + ManaCosts costRef = card.getSpellAbility().getManaCostsToPay(); + // replace with the new cost + costRef.clear(); + costRef.add(miracleCosts); + controller.cast(card.getSpellAbility(), game, false); + + // Reset the casting costs (in case the player cancels cast and plays the card later) + costRef.clear(); + for (ManaCost manaCost : card.getSpellAbility().getManaCosts()) { + costRef.add(manaCost); + } + return true; + } + return false; + } } diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index 3431ac7632f..3ff934624b5 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -834,7 +834,6 @@ public abstract class GameImpl implements Game, Serializable { } state.getWatchers().add(new MorbidWatcher()); state.getWatchers().add(new CastSpellLastTurnWatcher()); - state.getWatchers().add(new MiracleWatcher()); state.getWatchers().add(new SoulbondWatcher()); state.getWatchers().add(new PlayerLostLifeWatcher()); state.getWatchers().add(new BlockedAttackerWatcher()); diff --git a/Mage/src/mage/game/events/GameEvent.java b/Mage/src/mage/game/events/GameEvent.java index 207b1ca28e1..750a24654f8 100644 --- a/Mage/src/mage/game/events/GameEvent.java +++ b/Mage/src/mage/game/events/GameEvent.java @@ -81,6 +81,7 @@ public class GameEvent { //player events ZONE_CHANGE, DRAW_CARD, DREW_CARD, + MIRACLE_CARD_REVEALED, DISCARDED_CARD, CYCLE_CARD, CYCLED_CARD, CLASH, CLASHED, diff --git a/Mage/src/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java b/Mage/src/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java index 04918b46c72..6341c7b6404 100644 --- a/Mage/src/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java +++ b/Mage/src/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java @@ -70,9 +70,9 @@ public class CardsDrawnDuringDrawStepWatcher extends Watcher { if (playerId != null) { Integer amount = amountOfCardsDrawnThisTurn.get(playerId); if (amount == null) { - amount = Integer.valueOf(1); + amount = 1; } else { - amount = Integer.valueOf(amount + 1); + amount++; } amountOfCardsDrawnThisTurn.put(playerId, amount); } @@ -82,7 +82,7 @@ public class CardsDrawnDuringDrawStepWatcher extends Watcher { public int getAmountCardsDrawn(UUID playerId) { Integer amount = amountOfCardsDrawnThisTurn.get(playerId); if (amount != null) { - return amount.intValue(); + return amount; } return 0; } diff --git a/Mage/src/mage/watchers/common/MiracleWatcher.java b/Mage/src/mage/watchers/common/MiracleWatcher.java index 63677fd33b4..d844aef8eeb 100644 --- a/Mage/src/mage/watchers/common/MiracleWatcher.java +++ b/Mage/src/mage/watchers/common/MiracleWatcher.java @@ -32,23 +32,18 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; -import mage.constants.Outcome; -import mage.constants.WatcherScope; -import mage.constants.Zone; import mage.abilities.Ability; -import mage.abilities.costs.mana.ManaCost; -import mage.abilities.costs.mana.ManaCosts; import mage.abilities.keyword.MiracleAbility; import mage.cards.Card; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.Outcome; +import mage.constants.WatcherScope; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; import mage.watchers.Watcher; - - /** * Counts amount of cards drawn this turn by players. * Asks players about Miracle ability to be activated if it the first card drawn this turn. @@ -80,9 +75,9 @@ public class MiracleWatcher extends Watcher { if (playerId != null) { Integer amount = amountOfCardsDrawnThisTurn.get(playerId); if (amount == null) { - amount = Integer.valueOf(1); + amount = 1; } else { - amount = Integer.valueOf(amount + 1); + amount++; } amountOfCardsDrawnThisTurn.put(playerId, amount); if (amount == 1) { @@ -99,30 +94,12 @@ public class MiracleWatcher extends Watcher { if (ability instanceof MiracleAbility) { Player controller = game.getPlayer(ability.getControllerId()); if (controller != null) { - // FIXME: I don't like that I need to call it manually - // it's the place for bugs - game.getContinuousEffects().costModification(ability, game); - ManaCosts manaCostsToPay = ability.getManaCostsToPay(); - Cards cards = new CardsImpl(Zone.PICK); + Cards cards = new CardsImpl(); cards.add(card); controller.lookAtCards("Miracle", cards, game); - if (controller.chooseUse(Outcome.Benefit, "Use Miracle " + manaCostsToPay.getText() + "?", game)) { + if (controller.chooseUse(Outcome.Benefit, "Reveal card to be able to use Miracle?", game)) { controller.revealCards("Miracle", cards, game); - - ManaCosts costRef = card.getSpellAbility().getManaCostsToPay(); - // replace with the new cost - costRef.clear(); - for (ManaCost manaCost : manaCostsToPay) { - costRef.add(manaCost); - } - controller.cast(card.getSpellAbility(), game, false); - - // Reset the casting costs (in case the player cancels cast and plays the card later) - costRef.clear(); - for (ManaCost manaCost : card.getSpellAbility().getManaCosts()) { - costRef.add(manaCost); - } - + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MIRACLE_CARD_REVEALED, card.getId(), card.getId(),controller.getId())); break; } } From e34d428d9744925e5bba23a38554f6afaf00cbd9 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 00:30:33 +0200 Subject: [PATCH 13/34] * Fixed a bug of BecomesCreatureTargetEffect that to the target permanent the subtypes were not applied always. --- .../BecomesCreatureTargetEffect.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java index e0dd46db9f5..9793785326d 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java @@ -82,17 +82,17 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { + permanent.getSubtype().clear(); + if (token.getSubtype().size() > 0) { + permanent.getSubtype().addAll(token.getSubtype()); + } if (type == null) { - permanent.getSubtype().clear(); - if (token.getSubtype().size() > 0) { - permanent.getSubtype().addAll(token.getSubtype()); - } - } else { - if (token.getCardType().size() > 0) { - for (CardType t : token.getCardType()) { - if (!permanent.getCardType().contains(t)) { - permanent.getCardType().add(t); - } + permanent.getCardType().clear(); + } + if (token.getCardType().size() > 0) { + for (CardType t : token.getCardType()) { + if (!permanent.getCardType().contains(t)) { + permanent.getCardType().add(t); } } } From 1e20d00f41e00989d2d99ec1423f6ac86af07980 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 00:32:12 +0200 Subject: [PATCH 14/34] * Vastwood Animist - Fixed a bug that the activated ability was not correctly implemented as a P/T setting effect (fixes #600). --- .../mage/sets/worldwake/VastwoodAnimist.java | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java b/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java index dc3844e5a12..3c37e7ec132 100644 --- a/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java +++ b/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java @@ -28,27 +28,29 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect; -import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; import mage.game.permanent.token.Token; import mage.target.common.TargetControlledPermanent; + + /** * * @author jeffwadsworth @@ -69,7 +71,7 @@ public class VastwoodAnimist extends CardImpl { this.toughness = new MageInt(1); // {tap}: Target land you control becomes an X/X Elemental creature until end of turn, where X is the number of Allies you control. It's still a land. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new ElementalLandToken(), "land", Duration.EndOfTurn), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new VastwoodAnimistEffect(), new TapSourceCost()); ability.addTarget(new TargetControlledPermanent(filter)); this.addAbility(ability); } @@ -84,21 +86,45 @@ public class VastwoodAnimist extends CardImpl { } } -class ElementalLandToken extends Token { +class VastwoodAnimistEffect extends OneShotEffect { final static FilterControlledPermanent filterAllies = new FilterControlledPermanent("allies you control"); - static { filterAllies.add(new SubtypePredicate("Ally")); } - ElementalLandToken() { + public VastwoodAnimistEffect() { + super(Outcome.Benefit); + this.staticText = "Target land you control becomes an X/X Elemental creature until end of turn, where X is the number of Allies you control. It's still a land."; + } + + public VastwoodAnimistEffect(final VastwoodAnimistEffect effect) { + super(effect); + } + + @Override + public VastwoodAnimistEffect copy() { + return new VastwoodAnimistEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int amount = new PermanentsOnBattlefieldCount(filterAllies).calculate(game, source, this); + ContinuousEffect effect = new BecomesCreatureTargetEffect(new VastwoodAnimistElementalToken(amount), "land", Duration.EndOfTurn); + effect.setTargetPointer(targetPointer); + game.addEffect(effect, source); + return false; + } +} + +class VastwoodAnimistElementalToken extends Token { + + + VastwoodAnimistElementalToken(int amount) { super("", "X/X Elemental creature, where X is the number of Allies you control"); cardType.add(CardType.CREATURE); subtype.add("Elemental"); - power = new MageInt(0); - toughness = new MageInt(0); - DynamicValue controlledAllies = new PermanentsOnBattlefieldCount(filterAllies); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(controlledAllies, controlledAllies, Duration.WhileOnBattlefield))); + power = new MageInt(amount); + toughness = new MageInt(amount); } } From aa5c0cb3879dac290799909b9805017ad785fceb Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 08:02:00 +0200 Subject: [PATCH 15/34] * Brigid, Hero of Kinsbaile - Fixed that the damage ability had no correct source reference. --- .../src/mage/sets/lorwyn/BrigidHeroOfKinsbaile.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/sets/lorwyn/BrigidHeroOfKinsbaile.java b/Mage.Sets/src/mage/sets/lorwyn/BrigidHeroOfKinsbaile.java index 0a0e1e2acee..11aa4151c27 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/BrigidHeroOfKinsbaile.java +++ b/Mage.Sets/src/mage/sets/lorwyn/BrigidHeroOfKinsbaile.java @@ -28,9 +28,6 @@ package mage.sets.lorwyn; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -38,7 +35,9 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; @@ -70,7 +69,7 @@ public class BrigidHeroOfKinsbaile extends CardImpl { // First strike this.addAbility(FirstStrikeAbility.getInstance()); - // {tap}: Brigid, Hero of Kinsbaile deals 2 damage to each attacking or blocking creature target player controls. + // {t}: Brigid, Hero of Kinsbaile deals 2 damage to each attacking or blocking creature target player controls. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BrigidHeroOfKinsbaileEffect(), new TapSourceCost()); ability.addTarget(new TargetPlayer()); this.addAbility(ability); @@ -114,7 +113,7 @@ class BrigidHeroOfKinsbaileEffect extends OneShotEffect { if (targetPlayer != null) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, targetPlayer.getId(), game)) { if (creature != null) { - creature.damage(2, id, game, false, false); + creature.damage(2, source.getSourceId(), game, false, true); } } return true; From a4087b5e4d690ce133fd3318cefc78255d3912fa Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 08:11:45 +0200 Subject: [PATCH 16/34] * Academy Rector - minor changes. --- .../mage/sets/urzasdestiny/AcademyRector.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/sets/urzasdestiny/AcademyRector.java b/Mage.Sets/src/mage/sets/urzasdestiny/AcademyRector.java index a132577fea6..36715d6c2a3 100644 --- a/Mage.Sets/src/mage/sets/urzasdestiny/AcademyRector.java +++ b/Mage.Sets/src/mage/sets/urzasdestiny/AcademyRector.java @@ -96,21 +96,19 @@ class AcademyRectorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - boolean applied = false; - Player you = game.getPlayer(source.getControllerId()); - if (you != null) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { TargetCardInLibrary target = new TargetCardInLibrary(filter); target.setNotTarget(true); - you.searchLibrary(target, game); + controller.searchLibrary(target, game); Card targetCard = game.getCard(target.getFirstTarget()); - if (targetCard == null) { - applied = false; - } else{ - applied = you.putOntoBattlefieldWithInfo(targetCard, game, Zone.LIBRARY, source.getSourceId()); - you.shuffleLibrary(game); + if (targetCard != null) { + controller.putOntoBattlefieldWithInfo(targetCard, game, Zone.LIBRARY, source.getSourceId()); } + controller.shuffleLibrary(game); + return true; } - return applied; + return false; } @Override From fd3b8f4c2988890722103c006d7c60445aa98314 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 15:29:21 +0200 Subject: [PATCH 17/34] * F4/F5/F7 can also be used now without having priority. --- Mage.Client/src/main/java/mage/client/game/GamePanel.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 47be2717d5d..cd7df66a148 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -1378,25 +1378,25 @@ public final class GamePanel extends javax.swing.JPanel { } private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) { - if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) { + if (feedbackPanel != null) { session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId); } } private void btnUntilEndOfTurnActionPerformed(java.awt.event.ActionEvent evt) { - if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) { + if (feedbackPanel != null) { session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId); } } private void btnUntilNextMainPhaseActionPerformed(java.awt.event.ActionEvent evt) { - if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) { + if (feedbackPanel != null) { session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId); } } private void btnPassPriorityUntilNextYourTurnActionPerformed(java.awt.event.ActionEvent evt) { - if (feedbackPanel != null && FeedbackMode.SELECT.equals(feedbackPanel.getMode())) { + if (feedbackPanel != null) { session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId); } } From d6139f1095696eaf9b5941ec39557023921f7807 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 15:30:19 +0200 Subject: [PATCH 18/34] * Fixed handling of CleanUp step if abilities trigger in that step (e.g. discard card with Madness).. --- Mage/src/mage/game/turn/CleanupStep.java | 12 +++++++++--- Mage/src/mage/game/turn/EndPhase.java | 7 +++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Mage/src/mage/game/turn/CleanupStep.java b/Mage/src/mage/game/turn/CleanupStep.java index 14d9c3d1cb5..26e1fcf9262 100644 --- a/Mage/src/mage/game/turn/CleanupStep.java +++ b/Mage/src/mage/game/turn/CleanupStep.java @@ -1,4 +1,4 @@ -/* + /* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -58,14 +58,20 @@ public class CleanupStep extends Step { game.getState().setPriorityPlayerId(activePlayer.getId()); //20091005 - 514.1 if (activePlayer.isInGame()) { - activePlayer.discardToMax(game); - activePlayer.setGameUnderYourControl(true); + activePlayer.discardToMax(game); } //20100423 - 514.2 game.getBattlefield().endOfTurn(activePlayerId, game); game.getState().removeEotEffects(game); } + @Override + public void endStep(Game game, UUID activePlayerId) { + Player activePlayer = game.getPlayer(activePlayerId); + activePlayer.setGameUnderYourControl(true); + super.endStep(game, activePlayerId); + } + @Override public CleanupStep copy() { return new CleanupStep(this); diff --git a/Mage/src/mage/game/turn/EndPhase.java b/Mage/src/mage/game/turn/EndPhase.java index 131188676f8..5c9a427fbd1 100644 --- a/Mage/src/mage/game/turn/EndPhase.java +++ b/Mage/src/mage/game/turn/EndPhase.java @@ -57,7 +57,14 @@ public class EndPhase extends Phase { if (currentStep.getType() == PhaseStep.CLEANUP) { game.getTurn().setEndTurnRequested(false); // so triggers trigger again currentStep.beginStep(game, activePlayerId); + // 514.3a At this point, the game checks to see if any state-based actions would be performed + // and/or any triggered abilities are waiting to be put onto the stack (including those that + // trigger "at the beginning of the next cleanup step"). If so, those state-based actions are + // performed, then those triggered abilities are put on the stack, then the active player gets + // priority. Players may cast spells and activate abilities. Once the stack is empty and all players + // pass in succession, another cleanup step begins if (game.checkStateAndTriggered()) { + game.playPriority(activePlayerId, true); playStep(game); } currentStep.endStep(game, activePlayerId); From 2a4c8cb6deb20bb8de4c5606b3953edfb97e7d0a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 15:31:23 +0200 Subject: [PATCH 19/34] * Madness - Reworked Madness completely to be more rule accurate. --- .../abilities/keyword/MadnessAbility.java | 239 +++++++----------- .../abilities/keyword/MiracleAbility.java | 10 +- Mage/src/mage/game/events/GameEvent.java | 1 + Mage/src/mage/players/PlayerImpl.java | 2 +- 4 files changed, 100 insertions(+), 152 deletions(-) diff --git a/Mage/src/mage/abilities/keyword/MadnessAbility.java b/Mage/src/mage/abilities/keyword/MadnessAbility.java index 8dd4630351a..434ead3efab 100644 --- a/Mage/src/mage/abilities/keyword/MadnessAbility.java +++ b/Mage/src/mage/abilities/keyword/MadnessAbility.java @@ -1,26 +1,21 @@ package mage.abilities.keyword; -import java.util.UUID; -import mage.MageObject; import mage.abilities.Ability; -import mage.abilities.Mode; import mage.abilities.StaticAbility; import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.costs.Cost; import mage.abilities.costs.mana.ManaCost; -import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.costs.mana.ManaCosts; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.ReplacementEffectImpl; import mage.cards.Card; -import mage.constants.AsThoughEffectType; import mage.constants.Duration; import mage.constants.Outcome; -import mage.constants.WatcherScope; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.events.ZoneChangeEvent; import mage.players.Player; -import mage.watchers.Watcher; /** * 702.33. Madness @@ -36,23 +31,22 @@ import mage.watchers.Watcher; * * 702.33b. Casting a spell using its madness ability follows the rules for paying alternative costs in rules 601.2b and 601.2e-g. * - * @author magenoxx_at_gmail.com + * @author LevelX2 */ + public class MadnessAbility extends StaticAbility { - private Cost madnessCost; + private String rule; - public MadnessAbility(Card card, Cost cost) { - super(Zone.STACK, null); - this.madnessCost = cost; - card.addAbility(new SimpleStaticAbility(Zone.EXILED, new MadnessPlayEffect(cost))); - card.addAbility(new MadnessTriggeredAbility()); - card.addWatcher(new MadnessCleanUpWatcher()); + @SuppressWarnings("unchecked") + public MadnessAbility(Card card, ManaCosts madnessCost) { + super(Zone.HAND, new MadnessReplacementEffect((ManaCosts)madnessCost)); + card.addAbility(new MadnessTriggeredAbility((ManaCosts)madnessCost)); + rule = "Madness " + madnessCost.getText() + " (If you discard this card, you may cast it for its madness cost instead of putting it into your graveyard.)"; } public MadnessAbility(final MadnessAbility ability) { super(ability); - this.madnessCost = ability.madnessCost; } @Override @@ -62,34 +56,25 @@ public class MadnessAbility extends StaticAbility { @Override public String getRule() { - StringBuilder sbRule = new StringBuilder("Madness "); - sbRule.append(madnessCost.getText()); - return sbRule.toString(); + return rule; } } -/** - * - * This effect asks player about exiled card to be cast by its madness cost. - * It checks: - * 1. That card is in Exile zone - * 2. It is being cast by owner - * 3. It has been discarded so it contains 'madness' mark stored in game state - * - */ -class MadnessPlayEffect extends AsThoughEffectImpl { - private Cost cost; - - public MadnessPlayEffect(Cost cost) { - super(AsThoughEffectType.CAST_AS_INSTANT, Duration.EndOfGame, Outcome.Benefit); - staticText = null; - this.cost = cost; +class MadnessReplacementEffect extends ReplacementEffectImpl { + + public MadnessReplacementEffect(ManaCosts madnessCost) { + super(Duration.EndOfGame, Outcome.Benefit); + staticText = "Madness " + madnessCost.getText() + " (If you discard this card, you may cast it for its madness cost instead of putting it into your graveyard.)"; } - public MadnessPlayEffect(final MadnessPlayEffect effect) { + public MadnessReplacementEffect(final MadnessReplacementEffect effect) { super(effect); - this.cost = effect.cost; + } + + @Override + public MadnessReplacementEffect copy() { + return new MadnessReplacementEffect(this); } @Override @@ -98,48 +83,41 @@ class MadnessPlayEffect extends AsThoughEffectImpl { } @Override - public MadnessPlayEffect copy() { - return new MadnessPlayEffect(this); - } - - @Override - public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { - if (sourceId.equals(source.getSourceId())) { - Card card = game.getCard(source.getSourceId()); - if (card != null && card.getOwnerId().equals(source.getControllerId()) && game.getState().getZone(source.getSourceId()) == Zone.EXILED) { - Object object = game.getState().getValue("madness_" + card.getId()); - if (object != null && object.equals(true)) { - Object alfreadyConfirmed = game.getState().getValue("madness_ok_" + card.getId()); - if (alfreadyConfirmed != null) { - return true; - } - Player player = game.getPlayer(card.getOwnerId()); - String message = "Cast " + card.getName() + " by its madness cost?"; - if (player != null && player.chooseUse(Outcome.Benefit, message, game)) { - Cost costToPay = cost.copy(); - card.getSpellAbility().getManaCostsToPay().clear(); - card.getSpellAbility().getManaCostsToPay().add((ManaCost)costToPay); - game.getState().setValue("madness_ok_" + card.getId(), true); - return true; - } + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Card card = game.getCard(event.getTargetId()); + if (card != null) { + if (controller.chooseUse(outcome, "Move " + card.getLogName() + " to exile to cast it by Madness?", game)) { + controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone()); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MADNESS_CARD_EXILED, card.getId(), card.getId(),controller.getId())); + return true; } } } return false; } + + + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId()) && + ((ZoneChangeEvent) event).getFromZone() == Zone.HAND && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD; + } + } /** - * - * This triggered ability along with effect exiles card with Madness abilities whenever it gets discarded. - * It also marks it with "madness" mark storing unique value to game state - * that will be used to check that card can be cast from exile zone. + * Checks for the MADNESS_CARD_EXILED event to ask the player + * if he wants to cast the card by it's Madness costs. + * If not, the card goes to the graveyard. */ class MadnessTriggeredAbility extends TriggeredAbilityImpl { - - MadnessTriggeredAbility() { - super(Zone.GRAVEYARD, new MadnessExileEffect(), true); - this.setRuleVisible(false); + + MadnessTriggeredAbility(ManaCosts madnessCost ) { + super(Zone.EXILED, new MadnessCastEffect(madnessCost), true); + this.setRuleVisible(false); } MadnessTriggeredAbility(final MadnessTriggeredAbility ability) { @@ -153,104 +131,73 @@ class MadnessTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DISCARDED_CARD) { - MageObject mageObject = game.getCard(event.getTargetId()); - if (mageObject != null && this.getSourceId().equals(mageObject.getId()) && mageObject instanceof Card) { - Card card = (Card) mageObject; - Player controller = game.getPlayer(event.getPlayerId()); - if (controller != null) { - for (Ability madness : card.getAbilities()) { - if (madness instanceof MadnessAbility) { - return true; - } - } + return event.getType() == GameEvent.EventType.MADNESS_CARD_EXILED && event.getTargetId().equals(getSourceId()); + } + + @Override + public boolean resolve(Game game) { + if (!super.resolve(game)) { + Card card = game.getCard(getSourceId()); + if (card != null) { + Player owner = game.getPlayer(card.getOwnerId()); + if (owner != null) { + // if cast was not successfull, the card is moved to graveyard + owner.moveCardToGraveyardWithInfo(card, getSourceId(), game, Zone.EXILED); } - } + } + return false; } - return false; + return true; } @Override public String getRule() { - return "If you discard this card, you may cast it for its madness cost instead of putting it into your graveyard"; + return "When this card is exiled this way, " + super.getRule(); } } -class MadnessExileEffect extends OneShotEffect { - - public MadnessExileEffect() { +class MadnessCastEffect extends OneShotEffect { + + private final ManaCosts madnessCost; + + public MadnessCastEffect(ManaCosts madnessCost) { super(Outcome.Benefit); + this.madnessCost = madnessCost; + staticText = "cast it by paying " + madnessCost.getText() + " rather than paying its mana cost. If that player doesn’t, he or she puts this card into his or her graveyard."; } - public MadnessExileEffect(final MadnessExileEffect effect) { + public MadnessCastEffect(final MadnessCastEffect effect) { super(effect); + this.madnessCost = effect.madnessCost; } @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); + Player owner = null; Card card = game.getCard(source.getSourceId()); - if (player != null && card != null) { - Object object = game.getState().getValue("madness exile"); - if (object == null || !(object instanceof UUID)) { - object = UUID.randomUUID(); - game.getState().setValue("madness exile", object); + if (card != null) { + owner = game.getPlayer(card.getOwnerId()); + } + if (owner != null && card != null) { + ManaCosts costRef = card.getSpellAbility().getManaCostsToPay(); + // replace with the new cost + costRef.clear(); + costRef.add(madnessCost); + boolean result = owner.cast(card.getSpellAbility(), game, false); + // Reset the casting costs (in case the player cancels cast and plays the card later) + // TODO: CHeck if this is neccessary + costRef.clear(); + for (ManaCost manaCost : card.getSpellAbility().getManaCosts()) { + costRef.add(manaCost); } - card.moveToExile((UUID)object, "Madness", card.getId(), game); - card.addInfo("madness", "This card is being cast using madness cost"); - game.getState().setValue("madness_" + card.getId(), true); - return true; + return result; + } return false; } @Override - public String getText(Mode mode) { - return null; - } - - @Override - public MadnessExileEffect copy() { - return new MadnessExileEffect(this); + public MadnessCastEffect copy() { + return new MadnessCastEffect(this); } } - -/** - * Whenever phase is changed, this watcher returns all cards exiled by madness to graveyard and informs players about it. - */ -class MadnessCleanUpWatcher extends Watcher { - - public MadnessCleanUpWatcher() { - super("MadnessPlayWasCanceled", WatcherScope.GAME); - } - - public MadnessCleanUpWatcher(final MadnessCleanUpWatcher watcher) { - super(watcher); - } - - @Override - public MadnessCleanUpWatcher copy() { - return new MadnessCleanUpWatcher(this); - } - - @Override - public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.PHASE_CHANGED) { - for (Card card : game.getExile().getAllCards(game)) { - Object object = game.getState().getValue("madness_" + card.getId()); - if (object != null && object.equals(true)) { - game.informPlayers("Madness cost wasn't payed. " + card.getName() + " was put to its owner's graveyard."); - // reset - game.getState().setValue("madness_" + card.getId(), null); - game.getState().setValue("madness_ok_" + card.getId(), null); - card.moveToZone(Zone.GRAVEYARD, sourceId, game, true); - } - } - } - } - - @Override - public void reset() { - super.reset(); - } -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/keyword/MiracleAbility.java b/Mage/src/mage/abilities/keyword/MiracleAbility.java index 63802ad6514..66bad7c3932 100644 --- a/Mage/src/mage/abilities/keyword/MiracleAbility.java +++ b/Mage/src/mage/abilities/keyword/MiracleAbility.java @@ -30,7 +30,6 @@ package mage.abilities.keyword; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.costs.Cost; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.effects.OneShotEffect; @@ -97,8 +96,9 @@ public class MiracleAbility extends TriggeredAbilityImpl { private static final String staticRule = " (You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)"; private String ruleText; + @SuppressWarnings("unchecked") public MiracleAbility(Card card, ManaCosts miracleCosts) { - super(Zone.HAND, new MiracleEffect(miracleCosts), true); + super(Zone.HAND, new MiracleEffect((ManaCosts)miracleCosts), true); card.addWatcher(new MiracleWatcher()); ruleText = "Miracle " + miracleCosts.getText() + staticRule; } @@ -133,9 +133,9 @@ public class MiracleAbility extends TriggeredAbilityImpl { class MiracleEffect extends OneShotEffect { - private final ManaCosts miracleCosts; + private final ManaCosts miracleCosts; - public MiracleEffect(ManaCosts miracleCosts) { + public MiracleEffect(ManaCosts miracleCosts) { super(Outcome.Benefit); this.staticText = "cast this card for it's miracle cost"; this.miracleCosts = miracleCosts; @@ -157,7 +157,7 @@ class MiracleEffect extends OneShotEffect { // use target pointer here, so it's the same card that triggered the event (not gone back to library e.g.) Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (controller != null && card != null) { - ManaCosts costRef = card.getSpellAbility().getManaCostsToPay(); + ManaCosts costRef = card.getSpellAbility().getManaCostsToPay(); // replace with the new cost costRef.clear(); costRef.add(miracleCosts); diff --git a/Mage/src/mage/game/events/GameEvent.java b/Mage/src/mage/game/events/GameEvent.java index 750a24654f8..682aa689023 100644 --- a/Mage/src/mage/game/events/GameEvent.java +++ b/Mage/src/mage/game/events/GameEvent.java @@ -82,6 +82,7 @@ public class GameEvent { ZONE_CHANGE, DRAW_CARD, DREW_CARD, MIRACLE_CARD_REVEALED, + MADNESS_CARD_EXILED, DISCARDED_CARD, CYCLE_CARD, CYCLED_CARD, CLASH, CLASHED, diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 5e089b1b9c9..7b35bd14ad3 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -988,7 +988,7 @@ public abstract class PlayerImpl implements Player, Serializable { game.getStack().push(new StackAbility(ability, playerId)); } if (ability.activate(game, false)) { - if (ability.getRuleVisible()) { + if (ability.isUsesStack() || ability.getRuleVisible()) { game.informPlayers(ability.getGameLogMessage(game)); } if (!ability.isUsesStack()) { From 47c8b73595f342280f5ff60025f207591d5ab5b0 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 14 Oct 2014 17:25:29 +0200 Subject: [PATCH 20/34] * Added 5 cards. --- .../mage/sets/commander/ChampionsHelm.java | 79 ++++++++++++ .../commander2013/RoonOfTheHiddenRealm.java | 33 +++-- .../src/mage/sets/lorwyn/GalepowderMage.java | 52 ++++++++ .../mage/sets/onslaught/CoverOfDarkness.java | 100 +++++++++++++++ .../mage/sets/onslaught/SharedTriumph.java | 100 +++++++++++++++ .../sets/urzaslegacy/EngineeredPlague.java | 47 +------ .../sets/venservskoth/GalepowderMage.java | 121 ++++++++++++++++++ .../common/EquippedHasSupertypeCondition.java | 78 +++++++++++ .../decorator/ConditionalContinousEffect.java | 4 +- .../common/ChooseCreatureTypeEffect.java | 82 ++++++++++++ 10 files changed, 638 insertions(+), 58 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/commander/ChampionsHelm.java create mode 100644 Mage.Sets/src/mage/sets/lorwyn/GalepowderMage.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/CoverOfDarkness.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/SharedTriumph.java create mode 100644 Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java create mode 100644 Mage/src/mage/abilities/condition/common/EquippedHasSupertypeCondition.java create mode 100644 Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java diff --git a/Mage.Sets/src/mage/sets/commander/ChampionsHelm.java b/Mage.Sets/src/mage/sets/commander/ChampionsHelm.java new file mode 100644 index 00000000000..faf97eebde3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/ChampionsHelm.java @@ -0,0 +1,79 @@ +/* + * 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.commander; + +import java.util.UUID; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.EquippedHasSupertypeCondition; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.common.continious.BoostEquippedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.HexproofAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public class ChampionsHelm extends CardImpl { + + private static final String staticText = "As long as equipped creature is legendary, it has hexproof"; + + public ChampionsHelm(UUID ownerId) { + super(ownerId, 244, "Champion's Helm", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "CMD"; + this.subtype.add("Equipment"); + + // Equipped creature gets +2/+2. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2))); + + // As long as equipped creature is legendary, it has hexproof. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( + new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.EQUIPMENT), + new EquippedHasSupertypeCondition("Legendary"), staticText))); + + // Equip {1} + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1))); + } + + public ChampionsHelm(final ChampionsHelm card) { + super(card); + } + + @Override + public ChampionsHelm copy() { + return new ChampionsHelm(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/RoonOfTheHiddenRealm.java b/Mage.Sets/src/mage/sets/commander2013/RoonOfTheHiddenRealm.java index 1879f7174ec..fa7744a63f9 100644 --- a/Mage.Sets/src/mage/sets/commander2013/RoonOfTheHiddenRealm.java +++ b/Mage.Sets/src/mage/sets/commander2013/RoonOfTheHiddenRealm.java @@ -29,6 +29,7 @@ package mage.sets.commander2013; import java.util.UUID; import mage.MageInt; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; @@ -48,6 +49,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.players.Player; import mage.target.common.TargetCreaturePermanent; /** @@ -114,21 +116,26 @@ class RoonOfTheHiddenRealmEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (getTargetPointer().getFirst(game, source) != null) { - Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - Card card = game.getCard(getTargetPointer().getFirst(game, source)); - if (permanent != null) { - if (permanent.moveToExile(source.getSourceId(), "Roon of the Hidden Realm", source.getSourceId(), game)) { - if (card != null) { - AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD)); - delayedAbility.setSourceId(source.getSourceId()); - delayedAbility.setControllerId(card.getOwnerId()); - game.addDelayedTriggeredAbility(delayedAbility); - return true; + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (controller != null && sourceObject != null) { + if (getTargetPointer().getFirst(game, source) != null) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + Card card = game.getCard(getTargetPointer().getFirst(game, source)); + if (permanent != null) { + UUID exileId = UUID.randomUUID(); + if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getName(), source.getSourceId(), game, Zone.BATTLEFIELD)) { + if (card != null) { + AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD)); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(card.getOwnerId()); + game.addDelayedTriggeredAbility(delayedAbility); + } } } - } - } + } + return true; + } return false; } } diff --git a/Mage.Sets/src/mage/sets/lorwyn/GalepowderMage.java b/Mage.Sets/src/mage/sets/lorwyn/GalepowderMage.java new file mode 100644 index 00000000000..fb82068a660 --- /dev/null +++ b/Mage.Sets/src/mage/sets/lorwyn/GalepowderMage.java @@ -0,0 +1,52 @@ +/* + * 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.lorwyn; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class GalepowderMage extends mage.sets.venservskoth.GalepowderMage { + + public GalepowderMage(UUID ownerId) { + super(ownerId); + this.cardNumber = 15; + this.expansionSetCode = "LRW"; + } + + public GalepowderMage(final GalepowderMage card) { + super(card); + } + + @Override + public GalepowderMage copy() { + return new GalepowderMage(this); + } +} diff --git a/Mage.Sets/src/mage/sets/onslaught/CoverOfDarkness.java b/Mage.Sets/src/mage/sets/onslaught/CoverOfDarkness.java new file mode 100644 index 00000000000..708e53427aa --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/CoverOfDarkness.java @@ -0,0 +1,100 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.ChooseCreatureTypeEffect; +import mage.abilities.effects.common.continious.GainAbilityAllEffect; +import mage.abilities.keyword.FearAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class CoverOfDarkness extends CardImpl { + + public CoverOfDarkness(UUID ownerId) { + super(ownerId, 133, "Cover of Darkness", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); + this.expansionSetCode = "ONS"; + + this.color.setBlack(true); + + // As Cover of Darkness enters the battlefield, choose a creature type. + this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.AddAbility))); + // Creatures of the chosen type have fear. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(FearAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCoverOfDarkness()))); + } + + public CoverOfDarkness(final CoverOfDarkness card) { + super(card); + } + + @Override + public CoverOfDarkness copy() { + return new CoverOfDarkness(this); + } +} + +class FilterCoverOfDarkness extends FilterCreaturePermanent { + + public FilterCoverOfDarkness() { + super("All creatures of the chosen type"); + } + + public FilterCoverOfDarkness(final FilterCoverOfDarkness filter) { + super(filter); + } + + @Override + public FilterCoverOfDarkness copy() { + return new FilterCoverOfDarkness(this); + } + + @Override + public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { + if (super.match(permanent, sourceId, playerId, game)) { + String subtype = (String) game.getState().getValue(sourceId + "_type"); + if (subtype != null && !subtype.equals("") && permanent.hasSubtype(subtype)) { + return true; + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/onslaught/SharedTriumph.java b/Mage.Sets/src/mage/sets/onslaught/SharedTriumph.java new file mode 100644 index 00000000000..03c59838338 --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/SharedTriumph.java @@ -0,0 +1,100 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.ChooseCreatureTypeEffect; +import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class SharedTriumph extends CardImpl { + + public SharedTriumph(UUID ownerId) { + super(ownerId, 53, "Shared Triumph", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); + this.expansionSetCode = "ONS"; + + this.color.setWhite(true); + + // As Shared Triumph enters the battlefield, choose a creature type. + this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature))); + + // Creatures of the chosen type get +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, new FilterSharedTriumph(), false))); + } + + public SharedTriumph(final SharedTriumph card) { + super(card); + } + + @Override + public SharedTriumph copy() { + return new SharedTriumph(this); + } +} + +class FilterSharedTriumph extends FilterCreaturePermanent { + + public FilterSharedTriumph() { + super("Creatures of the chosen type"); + } + + public FilterSharedTriumph(final FilterSharedTriumph filter) { + super(filter); + } + + @Override + public FilterSharedTriumph copy() { + return new FilterSharedTriumph(this); + } + + @Override + public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) { + if(super.match(permanent, sourceId, playerId, game)){ + String subtype = (String) game.getState().getValue(sourceId + "_type"); + if(subtype != null && !subtype.equals("") && permanent.hasSubtype(subtype)){ + return true; + } + } + return false; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java b/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java index 84cf567d016..8be3ac4571d 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java @@ -34,6 +34,7 @@ import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ChooseCreatureTypeEffect; import mage.abilities.effects.common.continious.BoostAllEffect; import mage.cards.CardImpl; import mage.cards.repository.CardRepository; @@ -43,6 +44,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import mage.util.CardUtil; /** * @@ -57,7 +59,7 @@ public class EngineeredPlague extends CardImpl { this.color.setBlack(true); // As Engineered Plague enters the battlefield, choose a creature type. - this.addAbility(new AsEntersBattlefieldAbility(new EngineeredPlagueEntersBattlefieldEffect(), "choose a creature type")); + this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.UnboostCreature))); // All creatures of the chosen type get -1/-1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(-1, -1, Duration.WhileOnBattlefield, new FilterEngineeredPlague(), false))); } @@ -71,43 +73,6 @@ public class EngineeredPlague extends CardImpl { return new EngineeredPlague(this); } - class EngineeredPlagueEntersBattlefieldEffect extends OneShotEffect { - - public EngineeredPlagueEntersBattlefieldEffect() { - super(Outcome.Benefit); - staticText = "As {this} enters the battlefield, choose a creature type"; - } - - public EngineeredPlagueEntersBattlefieldEffect(final EngineeredPlagueEntersBattlefieldEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getPermanent(source.getSourceId()); - if (player != null && permanent != null) { - Choice typeChoice = new ChoiceImpl(true); - typeChoice.setMessage("Choose creature type"); - typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); - while (!player.choose(Outcome.Detriment, typeChoice, game)) { - if (!player.isInGame()) { - return false; - } } - game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice()); - game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString()); - permanent.addInfo("chosen type", "Chosen type: " + typeChoice.getChoice() + ""); - } - return false; - } - - @Override - public EngineeredPlagueEntersBattlefieldEffect copy() { - return new EngineeredPlagueEntersBattlefieldEffect(this); - } - - } - class FilterEngineeredPlague extends FilterCreaturePermanent { public FilterEngineeredPlague() { @@ -133,11 +98,7 @@ public class EngineeredPlague extends CardImpl { } return false; } - - - + } - } - diff --git a/Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java b/Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java new file mode 100644 index 00000000000..96dd4b72b4b --- /dev/null +++ b/Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java @@ -0,0 +1,121 @@ +/* + * 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.venservskoth; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnFromExileEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class GalepowderMage extends CardImpl { + + public GalepowderMage(UUID ownerId) { + super(ownerId, 12, "Galepowder Mage", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}"); + this.expansionSetCode = "DDI"; + this.subtype.add("Kithkin"); + this.subtype.add("Wizard"); + + this.color.setWhite(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Whenever Galepowder Mage attacks, exile another target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step. + this.addAbility(new AttacksTriggeredAbility(new GalepowderMageEffect(), false)); + } + + public GalepowderMage(final GalepowderMage card) { + super(card); + } + + @Override + public GalepowderMage copy() { + return new GalepowderMage(this); + } +} + +class GalepowderMageEffect extends OneShotEffect { + + public GalepowderMageEffect() { + super(Outcome.Benefit); + this.staticText = "exile another target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step"; + } + + public GalepowderMageEffect(final GalepowderMageEffect effect) { + super(effect); + } + + @Override + public GalepowderMageEffect copy() { + return new GalepowderMageEffect(this); + } + + @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) { + if (getTargetPointer().getFirst(game, source) != null) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + Card card = game.getCard(getTargetPointer().getFirst(game, source)); + if (permanent != null) { + UUID exileId = UUID.randomUUID(); + if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getName(), source.getSourceId(), game, Zone.BATTLEFIELD)) { + if (card != null) { + AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD)); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(card.getOwnerId()); + game.addDelayedTriggeredAbility(delayedAbility); + } + } + } + } + return true; + } + return false; + } +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/condition/common/EquippedHasSupertypeCondition.java b/Mage/src/mage/abilities/condition/common/EquippedHasSupertypeCondition.java new file mode 100644 index 00000000000..006e45fd68a --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/EquippedHasSupertypeCondition.java @@ -0,0 +1,78 @@ +/* + * 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.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ + +public class EquippedHasSupertypeCondition implements Condition { + + private String superType; + private String[] superTypes; // scope = Any + + public EquippedHasSupertypeCondition(String subType) { + this.superType = subType; + } + + public EquippedHasSupertypeCondition(String... subTypes) { + this.superTypes = subTypes; + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); + if (permanent != null && permanent.getAttachedTo() != null) { + Permanent attachedTo = game.getBattlefield().getPermanent(permanent.getAttachedTo()); + if (attachedTo == null) { + attachedTo = (Permanent) game.getLastKnownInformation(permanent.getAttachedTo(), Zone.BATTLEFIELD); + } + if (attachedTo != null) { + if (superType != null) { + if (attachedTo.getSupertype().contains(this.superType)) { + return true; + } + } else { + for (String s : superTypes) { + if (attachedTo.getSupertype().contains(s)) { + return true; + } + } + } + } + } + return false; + } +} diff --git a/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java b/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java index 958cf7ecd69..c97cdb8df36 100644 --- a/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java +++ b/Mage/src/mage/abilities/decorator/ConditionalContinousEffect.java @@ -48,9 +48,9 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl { public ConditionalContinousEffect(final ConditionalContinousEffect effect) { super(effect); - this.effect = (ContinuousEffect) effect.effect.copy(); + this.effect = effect.effect.copy(); if (effect.otherwiseEffect != null) { - this.otherwiseEffect = (ContinuousEffect) effect.otherwiseEffect.copy(); + this.otherwiseEffect = effect.otherwiseEffect.copy(); } this.condition = effect.condition; this.baseCondition = effect.baseCondition; diff --git a/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java b/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java new file mode 100644 index 00000000000..db9a3f80798 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ChooseCreatureTypeEffect.java @@ -0,0 +1,82 @@ +/* + * 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.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.repository.CardRepository; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.util.CardUtil; + +/** + * + * @author LevelX2 + */ + +public class ChooseCreatureTypeEffect extends OneShotEffect { + + public ChooseCreatureTypeEffect(Outcome outcome) { + super(outcome); + staticText = "choose a creature type"; + } + + public ChooseCreatureTypeEffect(final ChooseCreatureTypeEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (controller != null && permanent != null) { + Choice typeChoice = new ChoiceImpl(true); + typeChoice.setMessage("Choose creature type"); + typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); + while (!controller.choose(outcome, typeChoice, game)) { + if (!controller.isInGame()) { + return false; + } + } + game.informPlayers(permanent.getName() + ": " + controller.getName() + " has chosen " + typeChoice.getChoice()); + game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice()); + permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice())); + } + return false; + } + + @Override + public ChooseCreatureTypeEffect copy() { + return new ChooseCreatureTypeEffect(this); + } + +} From f25d6930e01df6716d57e1f007c840eab666fcc2 Mon Sep 17 00:00:00 2001 From: emerald000 Date: Wed, 15 Oct 2014 00:36:49 -0400 Subject: [PATCH 21/34] Added Snapback, Active Volcano and Ancestral Knowledge. --- .../src/mage/sets/legends/ActiveVolcano.java | 82 +++++++++++ .../src/mage/sets/timespiral/Snapback.java | 76 ++++++++++ .../sets/weatherlight/AncestralKnowledge.java | 136 ++++++++++++++++++ 3 files changed, 294 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/legends/ActiveVolcano.java create mode 100644 Mage.Sets/src/mage/sets/timespiral/Snapback.java create mode 100644 Mage.Sets/src/mage/sets/weatherlight/AncestralKnowledge.java diff --git a/Mage.Sets/src/mage/sets/legends/ActiveVolcano.java b/Mage.Sets/src/mage/sets/legends/ActiveVolcano.java new file mode 100644 index 00000000000..22694511c81 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/ActiveVolcano.java @@ -0,0 +1,82 @@ +/* + * 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.legends; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Mode; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; + +/** + * + * @author emerald000 + */ +public class ActiveVolcano extends CardImpl { + + private static final FilterPermanent filterBlue = new FilterPermanent("blue permanent"); + private static final FilterLandPermanent filterIsland = new FilterLandPermanent("Island"); + static { + filterBlue.add(new ColorPredicate(ObjectColor.BLUE)); + filterIsland.add(new SubtypePredicate("Island")); + } + + public ActiveVolcano(UUID ownerId) { + super(ownerId, 130, "Active Volcano", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}"); + this.expansionSetCode = "LEG"; + + this.color.setRed(true); + + // Choose one - Destroy target blue permanent; + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filterBlue)); + + // or return target Island to its owner's hand. + Mode mode = new Mode(); + mode.getEffects().add(new ReturnToHandTargetEffect()); + mode.getTargets().add(new TargetPermanent(filterIsland)); + this.getSpellAbility().addMode(mode); + } + + public ActiveVolcano(final ActiveVolcano card) { + super(card); + } + + @Override + public ActiveVolcano copy() { + return new ActiveVolcano(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/Snapback.java b/Mage.Sets/src/mage/sets/timespiral/Snapback.java new file mode 100644 index 00000000000..5304bd4332b --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/Snapback.java @@ -0,0 +1,76 @@ +/* + * 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.timespiral; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.costs.AlternativeCostSourceAbility; +import mage.abilities.costs.common.ExileFromHandCost; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterOwnedCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardIdPredicate; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.common.TargetCardInHand; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author emerald000 + */ +public class Snapback extends CardImpl { + + public Snapback(UUID ownerId) { + super(ownerId, 78, "Snapback", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}"); + this.expansionSetCode = "TSP"; + + this.color.setBlue(true); + + // You may exile a blue card from your hand rather than pay Snapback's mana cost. + FilterOwnedCard filterCardInHand = new FilterOwnedCard("a blue card from your hand"); + filterCardInHand.add(new ColorPredicate(ObjectColor.BLUE)); + filterCardInHand.add(Predicates.not(new CardIdPredicate(this.getId()))); + this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(filterCardInHand)))); + + // Return target creature to its owner's hand. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); + } + + public Snapback(final Snapback card) { + super(card); + } + + @Override + public Snapback copy() { + return new Snapback(this); + } +} diff --git a/Mage.Sets/src/mage/sets/weatherlight/AncestralKnowledge.java b/Mage.Sets/src/mage/sets/weatherlight/AncestralKnowledge.java new file mode 100644 index 00000000000..0ac56df31ba --- /dev/null +++ b/Mage.Sets/src/mage/sets/weatherlight/AncestralKnowledge.java @@ -0,0 +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.sets.weatherlight; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ShuffleLibrarySourceEffect; +import mage.abilities.keyword.CumulativeUpkeepAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; + +/** + * + * @author emerald000 + */ +public class AncestralKnowledge extends CardImpl { + + public AncestralKnowledge(UUID ownerId) { + super(ownerId, 32, "Ancestral Knowledge", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + this.expansionSetCode = "WTH"; + + this.color.setBlue(true); + + // Cumulative upkeep {1} + this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl<>("{1}"))); + + // When Ancestral Knowledge enters the battlefield, look at the top ten cards of your library, then exile any number of them and put the rest back on top of your library in any order. + this.addAbility(new EntersBattlefieldTriggeredAbility(new AncestralKnowledgeEffect())); + + // When Ancestral Knowledge leaves the battlefield, shuffle your library. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new ShuffleLibrarySourceEffect(), false)); + } + + public AncestralKnowledge(final AncestralKnowledge card) { + super(card); + } + + @Override + public AncestralKnowledge copy() { + return new AncestralKnowledge(this); + } +} + +class AncestralKnowledgeEffect extends OneShotEffect { + + AncestralKnowledgeEffect() { + super(Outcome.Benefit); + this.staticText = "look at the top ten cards of your library, then exile any number of them and put the rest back on top of your library in any order"; + } + + AncestralKnowledgeEffect(final AncestralKnowledgeEffect effect) { + super(effect); + } + + @Override + public AncestralKnowledgeEffect copy() { + return new AncestralKnowledgeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + int numCards = Math.min(10, player.getLibrary().size()); + if (numCards > 0) { + Cards cards = new CardsImpl(); + for (int i = 0; i < numCards; i++) { + cards.add(player.getLibrary().removeFromTop(game)); + } + TargetCard target = new TargetCard(0, numCards, Zone.LIBRARY, new FilterCard("cards to exile")); + player.choose(Outcome.Exile, cards, target, game); + for (UUID cardId : target.getTargets()) { + Card card = cards.get(cardId, game); + if (card != null) { + player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY); + cards.remove(card); + } + } + while (cards.size() > 1) { + target = new TargetCard(1, Zone.LIBRARY, new FilterCard("card to put on top of library (last put is first drawn)")); + player.choose(Outcome.Benefit, cards, target, game); + Card card = cards.get(target.getFirstTarget(), game); + player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); + cards.remove(card); + } + if (cards.size() == 1) { + Card card = cards.get(cards.iterator().next(), game); + if (card != null) { + player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false); + } + } + } + return true; + } + return false; + } +} From a8d61169adef0fadeecac84e42f8bffa13b59ffa Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 15 Oct 2014 11:38:35 +0200 Subject: [PATCH 22/34] * Masako the Humorless - Fixed that the thought as ability also worked unintended for creatures of opponents. --- .../src/mage/sets/championsofkamigawa/MasakoTheHumorless.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MasakoTheHumorless.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MasakoTheHumorless.java index f40d242140f..ce450653de3 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/MasakoTheHumorless.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MasakoTheHumorless.java @@ -100,7 +100,7 @@ class BlockTappedEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { - Permanent permanent = game.getPermanent(source.getSourceId()); + Permanent permanent = game.getPermanent(sourceId); if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { return true; } From 746e135f2153ef1f0bdb555a171681a139fd7f64 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 15 Oct 2014 16:26:30 +0200 Subject: [PATCH 23/34] * Some minor fixes. --- .../src/mage/sets/urzaslegacy/EngineeredPlague.java | 7 ------- .../src/mage/sets/venservskoth/GalepowderMage.java | 13 ++++++++++++- Mage/src/mage/game/tournament/TournamentImpl.java | 10 ++-------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java b/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java index 8be3ac4571d..37c7fca82ca 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/EngineeredPlague.java @@ -30,21 +30,14 @@ package mage.sets.urzaslegacy; import java.util.UUID; import mage.constants.*; -import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ChooseCreatureTypeEffect; import mage.abilities.effects.common.continious.BoostAllEffect; import mage.cards.CardImpl; -import mage.cards.repository.CardRepository; -import mage.choices.Choice; -import mage.choices.ChoiceImpl; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.util.CardUtil; /** * diff --git a/Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java b/Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java index 96dd4b72b4b..c75cda64f59 100644 --- a/Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java +++ b/Mage.Sets/src/mage/sets/venservskoth/GalepowderMage.java @@ -42,9 +42,12 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; /** * @@ -52,6 +55,12 @@ import mage.players.Player; */ public class GalepowderMage extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature"); + + static { + filter.add(new AnotherPredicate()); + } + public GalepowderMage(UUID ownerId) { super(ownerId, 12, "Galepowder Mage", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.expansionSetCode = "DDI"; @@ -65,7 +74,9 @@ public class GalepowderMage extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); // Whenever Galepowder Mage attacks, exile another target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step. - this.addAbility(new AttacksTriggeredAbility(new GalepowderMageEffect(), false)); + Ability ability = new AttacksTriggeredAbility(new GalepowderMageEffect(), false); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); } public GalepowderMage(final GalepowderMage card) { diff --git a/Mage/src/mage/game/tournament/TournamentImpl.java b/Mage/src/mage/game/tournament/TournamentImpl.java index e92f50ee41c..9650bfe57df 100644 --- a/Mage/src/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/mage/game/tournament/TournamentImpl.java @@ -392,17 +392,11 @@ public abstract class TournamentImpl implements Tournament { if (options.getLimitedOptions().getDraftCube() != null) { DraftCube cube = options.getLimitedOptions().getDraftCube(); for (int i = 0; i < options.getLimitedOptions().getNumberBoosters(); i++) { - List booster = cube.createBooster(); - for (Card card: booster) { - player.getDeck().getSideboard().add(card); - } + player.getDeck().getSideboard().addAll(cube.createBooster()); } } else { for (ExpansionSet set: sets) { - List booster = set.createBooster(); - for (Card card: booster) { - player.getDeck().getSideboard().add(card); - } + player.getDeck().getSideboard().addAll(set.createBooster()); } } } From 2c171e32b953efff3330735fbf257e46a6c46cf8 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 08:17:03 +0200 Subject: [PATCH 24/34] * Goblin Charbelcher - Fixed a bug, that the return cards to library step looped endless. --- .../src/mage/sets/mirrodin/GoblinCharbelcher.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/Mage.Sets/src/mage/sets/mirrodin/GoblinCharbelcher.java b/Mage.Sets/src/mage/sets/mirrodin/GoblinCharbelcher.java index eea8507f2f4..6de8c2341c5 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/GoblinCharbelcher.java +++ b/Mage.Sets/src/mage/sets/mirrodin/GoblinCharbelcher.java @@ -131,18 +131,8 @@ class GoblinCharbelcherEffect extends OneShotEffect { if (targetPlayer != null) { targetPlayer.damage(damage, source.getSourceId(), game, false, true); } - } - - TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on the bottom of your library")); - while (player.isInGame() && cards.size() > 1) { - player.choose(Outcome.Neutral, cards, target, game); - Card card = cards.get(target.getFirstTarget(), game); - if (card != null) { - player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, true); - } - target.clearChosen(); - } - + } + player.putCardsOnBottomOfLibrary(cards, game, source, true); return true; } } From e20a5f68e68cde5e360d057c671125a9f7e8fa67 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 08:17:19 +0200 Subject: [PATCH 25/34] * Helm of the Ghastlord - Fixed that the triggered ability only worked for combat damage instead correctly for all kind of damage. --- Mage.Sets/src/mage/sets/shadowmoor/HelmOfTheGhastlord.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/shadowmoor/HelmOfTheGhastlord.java b/Mage.Sets/src/mage/sets/shadowmoor/HelmOfTheGhastlord.java index 22386d31817..d19b66be247 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/HelmOfTheGhastlord.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/HelmOfTheGhastlord.java @@ -30,7 +30,7 @@ package mage.sets.shadowmoor; import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; -import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.EnchantedCreatureColorCondition; import mage.abilities.decorator.ConditionalContinousEffect; @@ -71,11 +71,11 @@ public class HelmOfTheGhastlord extends CardImpl { this.addAbility(ability); // As long as enchanted creature is blue, it gets +1/+1 and has "Whenever this creature deals damage to an opponent, draw a card." SimpleStaticAbility blueAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostEnchantedEffect(1, 1), new EnchantedCreatureColorCondition(ObjectColor.BLUE), "As long as enchanted creature is blue, it gets +1/+1")); - blueAbility.addEffect(new ConditionalContinousEffect(new GainAbilityAttachedEffect(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1),false), AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLUE), "and has \"Whenever this creature deals damage to an opponent, draw a card.\"")); + blueAbility.addEffect(new ConditionalContinousEffect(new GainAbilityAttachedEffect(new DealsDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1),false), AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLUE), "and has \"Whenever this creature deals damage to an opponent, draw a card.\"")); this.addAbility(blueAbility); // As long as enchanted creature is black, it gets +1/+1 and has "Whenever this creature deals damage to an opponent, that player discards a card." SimpleStaticAbility blackAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostEnchantedEffect(1, 1), new EnchantedCreatureColorCondition(ObjectColor.BLACK), "As long as enchanted creature is black, it gets +1/+1")); - blackAbility.addEffect(new ConditionalContinousEffect(new GainAbilityAttachedEffect(new DealsCombatDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1), false, true), AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLACK), "and has \"Whenever this creature deals damage to an opponent, that player discards a card.\"")); + blackAbility.addEffect(new ConditionalContinousEffect(new GainAbilityAttachedEffect(new DealsDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1), false, true), AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLACK), "and has \"Whenever this creature deals damage to an opponent, that player discards a card.\"")); this.addAbility(blackAbility); } From 1b7001798da113ca91505645909b7ebec95d202c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 09:31:36 +0200 Subject: [PATCH 26/34] * Renamed ControlsPermanentCondition to PermanentsOnTheBattlefieldCondition. --- .../src/mage/sets/alarareborn/BantSureblade.java | 6 +++--- .../src/mage/sets/alarareborn/EsperStormblade.java | 6 +++--- .../src/mage/sets/alarareborn/GrixisGrimblade.java | 6 +++--- .../src/mage/sets/alarareborn/JundHackblade.java | 6 +++--- .../src/mage/sets/alarareborn/NayaHushblade.java | 6 +++--- .../src/mage/sets/avacynrestored/ScrollOfAvacyn.java | 4 ++-- .../sets/avacynrestored/ScrollOfGriselbrand.java | 4 ++-- .../sets/betrayersofkamigawa/HorobisWhisper.java | 4 ++-- .../mage/sets/betrayersofkamigawa/MarkOfTheOni.java | 4 ++-- .../sets/championsofkamigawa/GutwrencherOni.java | 4 ++-- .../sets/championsofkamigawa/KondasHatamoto.java | 6 +++--- .../sets/championsofkamigawa/OrochiEggwatcher.java | 4 ++-- .../sets/championsofkamigawa/VillainousOgre.java | 6 +++--- .../src/mage/sets/commander/DuergarHedgeMage.java | 8 ++++---- .../src/mage/sets/commander/GwyllionHedgeMage.java | 8 ++++---- Mage.Sets/src/mage/sets/commander/Invigorate.java | 4 ++-- .../src/mage/sets/commander2013/Ophiomancer.java | 4 ++-- .../mage/sets/commander2013/TempleOfTheFalseGod.java | 4 ++-- .../src/mage/sets/conflux/CliffrunnerBehemoth.java | 12 +++++------- Mage.Sets/src/mage/sets/conflux/EmberWeaver.java | 12 +++++------- .../src/mage/sets/conflux/MirrorSigilSergeant.java | 4 ++-- Mage.Sets/src/mage/sets/conflux/RhoxMeditant.java | 4 ++-- .../src/mage/sets/conflux/SedraxisAlchemist.java | 4 ++-- Mage.Sets/src/mage/sets/conflux/ToxicIguanar.java | 4 ++-- .../mage/sets/dragonsmaze/OpalLakeGatekeepers.java | 4 ++-- .../src/mage/sets/dragonsmaze/SaruliGatekeepers.java | 4 ++-- .../mage/sets/dragonsmaze/SmeltWardGatekeepers.java | 4 ++-- .../mage/sets/dragonsmaze/SunspireGatekeepers.java | 4 ++-- .../mage/sets/dragonsmaze/UbulSarGatekeepers.java | 4 ++-- Mage.Sets/src/mage/sets/eventide/HagHedgeMage.java | 8 ++++---- .../src/mage/sets/eventide/NoggleHedgeMage.java | 8 ++++---- .../src/mage/sets/eventide/SelkieHedgeMage.java | 8 ++++---- Mage.Sets/src/mage/sets/fallenempires/Seasinger.java | 4 ++-- Mage.Sets/src/mage/sets/gatecrash/Biovisionary.java | 4 ++-- .../src/mage/sets/gatecrash/HellkiteTyrant.java | 4 ++-- Mage.Sets/src/mage/sets/gatecrash/WayOfTheThief.java | 4 ++-- .../src/mage/sets/innistrad/AngelicOverseer.java | 6 +++--- .../src/mage/sets/innistrad/ClifftopRetreat.java | 4 ++-- .../src/mage/sets/innistrad/HinterlandHarbor.java | 4 ++-- .../src/mage/sets/innistrad/IsolatedChapel.java | 4 ++-- .../src/mage/sets/innistrad/OliviaVoldaren.java | 4 ++-- Mage.Sets/src/mage/sets/innistrad/SulfurFalls.java | 4 ++-- .../src/mage/sets/innistrad/WoodlandCemetery.java | 4 ++-- Mage.Sets/src/mage/sets/judgment/Anger.java | 4 ++-- Mage.Sets/src/mage/sets/judgment/Brawn.java | 4 ++-- Mage.Sets/src/mage/sets/judgment/Filth.java | 4 ++-- Mage.Sets/src/mage/sets/judgment/Valor.java | 4 ++-- Mage.Sets/src/mage/sets/judgment/Wonder.java | 4 ++-- .../src/mage/sets/lorwyn/DauntlessDourbark.java | 4 ++-- .../src/mage/sets/magic2010/DragonskullSummit.java | 4 ++-- .../src/mage/sets/magic2010/DrownedCatacomb.java | 4 ++-- .../src/mage/sets/magic2010/GlacialFortress.java | 4 ++-- Mage.Sets/src/mage/sets/magic2010/RootboundCrag.java | 4 ++-- Mage.Sets/src/mage/sets/magic2010/SunpetalGrove.java | 4 ++-- Mage.Sets/src/mage/sets/magic2012/GriffinRider.java | 6 +++--- Mage.Sets/src/mage/sets/magic2013/HarborBandit.java | 4 ++-- .../src/mage/sets/magic2013/PrizedElephant.java | 4 ++-- Mage.Sets/src/mage/sets/magic2014/AngelicAccord.java | 3 +-- Mage.Sets/src/mage/sets/magic2014/FesteringNewt.java | 4 ++-- .../src/mage/sets/magic2014/HauntedPlateMail.java | 4 ++-- .../src/mage/sets/magic2014/MaraudingMaulhorn.java | 4 ++-- .../src/mage/sets/magic2014/WoodbornBehemoth.java | 4 ++-- .../src/mage/sets/magic2015/AeronautTinkerer.java | 4 ++-- .../src/mage/sets/magic2015/JorubaiMurkLurker.java | 4 ++-- Mage.Sets/src/mage/sets/magic2015/KirdChieftain.java | 4 ++-- .../src/mage/sets/magic2015/ScrapyardMongrel.java | 6 +++--- .../src/mage/sets/magic2015/StatuteOfDenial.java | 4 ++-- .../src/mage/sets/mercadianmasques/SnuffOut.java | 6 +++--- .../mage/sets/modernmasters/KithkinGreatheart.java | 6 +++--- .../src/mage/sets/modernmasters/Peppersmoke.java | 7 +++---- Mage.Sets/src/mage/sets/nemesis/Massacre.java | 4 ++-- Mage.Sets/src/mage/sets/nemesis/ReverentSilence.java | 4 ++-- Mage.Sets/src/mage/sets/nemesis/SkyshroudCutter.java | 4 ++-- Mage.Sets/src/mage/sets/nemesis/Submerge.java | 4 ++-- Mage.Sets/src/mage/sets/ninthedition/KirdApe.java | 4 ++-- .../src/mage/sets/planechase2012/TaintedIsle.java | 6 +++--- .../src/mage/sets/returntoravnica/ArmoryGuard.java | 4 ++-- .../mage/sets/returntoravnica/OgreJailbreaker.java | 6 +++--- .../mage/sets/scarsofmirrodin/BlackcleaveCliffs.java | 4 ++-- .../mage/sets/scarsofmirrodin/CopperlineGorge.java | 4 ++-- .../mage/sets/scarsofmirrodin/DarkslickShores.java | 4 ++-- .../mage/sets/scarsofmirrodin/RazorvergeThicket.java | 4 ++-- .../mage/sets/scarsofmirrodin/SeachromeCoast.java | 4 ++-- .../src/mage/sets/shadowmoor/AshenmoorCohort.java | 6 +++--- .../src/mage/sets/shadowmoor/BallynockCohort.java | 6 +++--- .../src/mage/sets/shadowmoor/BriarberryCohort.java | 6 +++--- .../src/mage/sets/shadowmoor/CrabappleCohort.java | 4 ++-- .../src/mage/sets/shadowmoor/MistveilPlains.java | 4 ++-- .../src/mage/sets/shadowmoor/MudbrawlerCohort.java | 4 ++-- Mage.Sets/src/mage/sets/tempest/SpiritMirror.java | 6 ++++-- .../src/mage/sets/theros/ChroniclerOfHeroes.java | 4 ++-- Mage.Sets/src/mage/sets/theros/LagonnaBandElder.java | 4 ++-- .../src/mage/sets/timespiral/NantukoShaman.java | 4 ++-- Mage.Sets/src/mage/sets/torment/TaintedField.java | 6 +++--- Mage.Sets/src/mage/sets/torment/TaintedPeak.java | 6 +++--- Mage.Sets/src/mage/sets/torment/TaintedWood.java | 6 +++--- .../src/mage/sets/worldwake/DragonmasterOutcast.java | 4 ++-- Mage.Sets/src/mage/sets/worldwake/LoamLion.java | 4 ++-- Mage.Sets/src/mage/sets/worldwake/NemesisTrap.java | 4 ++-- Mage.Sets/src/mage/sets/worldwake/SejiriMerfolk.java | 6 +++--- .../src/mage/sets/worldwake/ShorelineSalvager.java | 4 ++-- Mage.Sets/src/mage/sets/worldwake/SummitApes.java | 4 ++-- Mage.Sets/src/mage/sets/zendikar/RoilElemental.java | 4 ++-- .../common/DefendingPlayerControlsCondition.java | 2 +- .../condition/common/NoCreatureCondition.java | 3 ++- ...java => PermanentsOnTheBattlefieldCondition.java} | 10 +++++----- .../continious/BoostSourceWhileControlsEffect.java | 4 ++-- 107 files changed, 255 insertions(+), 258 deletions(-) rename Mage/src/mage/abilities/condition/common/{ControlsPermanentCondition.java => PermanentsOnTheBattlefieldCondition.java} (88%) diff --git a/Mage.Sets/src/mage/sets/alarareborn/BantSureblade.java b/Mage.Sets/src/mage/sets/alarareborn/BantSureblade.java index bf408b11011..8118b290655 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/BantSureblade.java +++ b/Mage.Sets/src/mage/sets/alarareborn/BantSureblade.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -73,11 +73,11 @@ public class BantSureblade extends CardImpl { // As long as you control another multicolored permanent, Bant Sureblade gets +1/+1 and has first strike. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( new BoostSourceEffect(1,1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "As long as you control another multicolored permanent, {this} gets +1/+1")); ability.addEffect(new ConditionalContinousEffect( new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "and has first strike")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/alarareborn/EsperStormblade.java b/Mage.Sets/src/mage/sets/alarareborn/EsperStormblade.java index afbfcbdea61..485d840ac60 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/EsperStormblade.java +++ b/Mage.Sets/src/mage/sets/alarareborn/EsperStormblade.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -73,11 +73,11 @@ public class EsperStormblade extends CardImpl { // As long as you control another multicolored permanent, Esper Stormblade gets +1/+1 and has flying. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( new BoostSourceEffect(1,1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "As long as you control another multicolored permanent, {this} gets +1/+1")); ability.addEffect(new ConditionalContinousEffect( new GainAbilitySourceEffect(FlyingAbility.getInstance()), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "and has flying")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/alarareborn/GrixisGrimblade.java b/Mage.Sets/src/mage/sets/alarareborn/GrixisGrimblade.java index 1cbdd8bec61..85483242e13 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/GrixisGrimblade.java +++ b/Mage.Sets/src/mage/sets/alarareborn/GrixisGrimblade.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -73,11 +73,11 @@ public class GrixisGrimblade extends CardImpl { // As long as you control another multicolored permanent, Grixis Grimblade gets +1/+1 and has deathtouch. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( new BoostSourceEffect(1,1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "As long as you control another multicolored permanent, {this} gets +1/+1")); ability.addEffect(new ConditionalContinousEffect( new GainAbilitySourceEffect(DeathtouchAbility.getInstance()), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "and has deathtouch")); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/alarareborn/JundHackblade.java b/Mage.Sets/src/mage/sets/alarareborn/JundHackblade.java index 9061a7b7c6b..dc72e0e8bdd 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/JundHackblade.java +++ b/Mage.Sets/src/mage/sets/alarareborn/JundHackblade.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -73,11 +73,11 @@ public class JundHackblade extends CardImpl { // As long as you control another multicolored permanent, Jund Hackblade gets +1/+1 and has haste. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( new BoostSourceEffect(1,1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "As long as you control another multicolored permanent, {this} gets +1/+1")); ability.addEffect(new ConditionalContinousEffect( new GainAbilitySourceEffect(HasteAbility.getInstance()), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "and has haste")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/alarareborn/NayaHushblade.java b/Mage.Sets/src/mage/sets/alarareborn/NayaHushblade.java index 106f1d23899..ada26b80a05 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/NayaHushblade.java +++ b/Mage.Sets/src/mage/sets/alarareborn/NayaHushblade.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -73,11 +73,11 @@ public class NayaHushblade extends CardImpl { // As long as you control another multicolored permanent, Naya Hushblade gets +1/+1 and has shroud. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( new BoostSourceEffect(1,1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "As long as you control another multicolored permanent, Naya Hushblade gets +1/+1")); ability.addEffect(new ConditionalContinousEffect( new GainAbilitySourceEffect(ShroudAbility.getInstance()), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), " and has shroud")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfAvacyn.java b/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfAvacyn.java index cf175210e1c..0bc49e5abe6 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfAvacyn.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfAvacyn.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalOneShotEffect; @@ -62,7 +62,7 @@ public class ScrollOfAvacyn extends CardImpl { // {1}, Sacrifice Scroll of Avacyn: Draw a card. If you control an Angel, you gain 5 life. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(1)); ability.addCost(new SacrificeSourceCost()); - ability.addEffect(new ConditionalOneShotEffect(new GainLifeEffect(5), new ControlsPermanentCondition(filter), "If you control an Angel, you gain 5 life")); + ability.addEffect(new ConditionalOneShotEffect(new GainLifeEffect(5), new PermanentsOnTheBattlefieldCondition(filter), "If you control an Angel, you gain 5 life")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfGriselbrand.java b/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfGriselbrand.java index 0fcbb157607..70f96fb3686 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfGriselbrand.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/ScrollOfGriselbrand.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalOneShotEffect; @@ -63,7 +63,7 @@ public class ScrollOfGriselbrand extends CardImpl { // {1}, Sacrifice Scroll of Griselbrand: Target opponent discards a card. If you control a Demon, that player loses 3 life. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new GenericManaCost(1)); ability.addCost(new SacrificeSourceCost()); - ability.addEffect(new ConditionalOneShotEffect(new LoseLifeTargetEffect(3), new ControlsPermanentCondition(filter), "If you control a Demon, that player loses 3 life")); + ability.addEffect(new ConditionalOneShotEffect(new LoseLifeTargetEffect(3), new PermanentsOnTheBattlefieldCondition(filter), "If you control a Demon, that player loses 3 life")); ability.addTarget(new TargetOpponent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/HorobisWhisper.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/HorobisWhisper.java index 65fe73ab763..3806f606cc6 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/HorobisWhisper.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/HorobisWhisper.java @@ -29,7 +29,7 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; import mage.ObjectColor; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.ExileFromGraveCost; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; @@ -70,7 +70,7 @@ public class HorobisWhisper extends CardImpl { // If you control a Swamp, destroy target nonblack creature. this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new DestroyTargetEffect(), - new ControlsPermanentCondition(filterCondition),"If you control a Swamp, destroy target nonblack creature")); + new PermanentsOnTheBattlefieldCondition(filterCondition),"If you control a Swamp, destroy target nonblack creature")); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterTarget) ); // Splice onto Arcane-Exile four cards from your graveyard. diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfTheOni.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfTheOni.java index 534880282ce..772b6ddbebf 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfTheOni.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfTheOni.java @@ -37,7 +37,7 @@ import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.continious.ControlEnchantedEffect; @@ -79,7 +79,7 @@ public class MarkOfTheOni extends CardImpl { this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new SacrificeSourceEffect(), TargetController.ANY, - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 1), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.FEWER_THAN, 1), false)); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GutwrencherOni.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GutwrencherOni.java index 644fac41c15..50342b72519 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GutwrencherOni.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GutwrencherOni.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.discard.DiscardControllerEffect; import mage.abilities.keyword.TrampleAbility; @@ -71,7 +71,7 @@ public class GutwrencherOni extends CardImpl { // At the beginning of your upkeep, discard a card if you don't control an Ogre. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ConditionalOneShotEffect( new DiscardControllerEffect(1), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.EQUAL_TO, 0), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.EQUAL_TO, 0), "discard a card if you don't control an Ogre"), TargetController.YOU, false)); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KondasHatamoto.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KondasHatamoto.java index f34a8ca5244..3706c8dea32 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KondasHatamoto.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KondasHatamoto.java @@ -34,7 +34,7 @@ import mage.constants.Duration; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -72,9 +72,9 @@ public class KondasHatamoto extends CardImpl{ this.addAbility(new BushidoAbility(1)); - ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new BoostSourceEffect(1, 2, Duration.WhileOnBattlefield), new ControlsPermanentCondition(filter), rule1); + ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new BoostSourceEffect(1, 2, Duration.WhileOnBattlefield), new PermanentsOnTheBattlefieldCondition(filter), rule1); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1)); - ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), new ControlsPermanentCondition(filter), rule2); + ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), new PermanentsOnTheBattlefieldCondition(filter), rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiEggwatcher.java b/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiEggwatcher.java index f9d5c7c40aa..98d296b18a3 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiEggwatcher.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/OrochiEggwatcher.java @@ -37,7 +37,7 @@ import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -75,7 +75,7 @@ public class OrochiEggwatcher extends CardImpl { ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SnakeToken()),new ManaCostsImpl("{2}{G}")); ability.addCost(new TapSourceCost()); ability.addEffect(new ConditionalOneShotEffect(new FlipSourceEffect(new ShidakoBroodmistress()), - new ControlsPermanentCondition(new FilterControlledCreaturePermanent(),ControlsPermanentCondition.CountType.MORE_THAN, 9),"If you control ten or more creatures, flip {this}")); + new PermanentsOnTheBattlefieldCondition(new FilterControlledCreaturePermanent(),PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 9),"If you control ten or more creatures, flip {this}")); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java b/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java index d946680c46e..469f36767b7 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/VillainousOgre.java @@ -32,7 +32,7 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.common.CantBlockAbility; import mage.abilities.costs.mana.ColoredManaCost; import mage.abilities.decorator.ConditionalGainActivatedAbility; @@ -68,11 +68,11 @@ public class VillainousOgre extends CardImpl { this.addAbility(new CantBlockAbility()); // As long as you control a Demon, Villainous Ogre has "{B}: Regenerate Villainous Ogre. - this.addAbility( new ConditionalGainActivatedAbility( + this.addAbility(new ConditionalGainActivatedAbility( Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ColoredManaCost(ColoredManaSymbol.B), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), rule)); } diff --git a/Mage.Sets/src/mage/sets/commander/DuergarHedgeMage.java b/Mage.Sets/src/mage/sets/commander/DuergarHedgeMage.java index 499da8d474a..18745746c5d 100644 --- a/Mage.Sets/src/mage/sets/commander/DuergarHedgeMage.java +++ b/Mage.Sets/src/mage/sets/commander/DuergarHedgeMage.java @@ -31,8 +31,8 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; @@ -75,12 +75,12 @@ public class DuergarHedgeMage extends CardImpl { this.toughness = new MageInt(2); // When Duergar Hedge-Mage enters the battlefield, if you control two or more Mountains, you may destroy target artifact. - Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), true), new ControlsPermanentCondition(filter, CountType.MORE_THAN, 1), rule1); + Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule1); ability.addTarget(new TargetArtifactPermanent()); this.addAbility(ability); // When Duergar Hedge-Mage enters the battlefield, if you control two or more Plains, you may destroy target enchantment. - Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), true), new ControlsPermanentCondition(filter2, CountType.MORE_THAN, 1), rule2); + Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2); ability2.addTarget(new TargetPermanent(filter3)); this.addAbility(ability2); diff --git a/Mage.Sets/src/mage/sets/commander/GwyllionHedgeMage.java b/Mage.Sets/src/mage/sets/commander/GwyllionHedgeMage.java index 4cd919d4de3..bf359f45427 100644 --- a/Mage.Sets/src/mage/sets/commander/GwyllionHedgeMage.java +++ b/Mage.Sets/src/mage/sets/commander/GwyllionHedgeMage.java @@ -31,8 +31,8 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; @@ -77,11 +77,11 @@ public class GwyllionHedgeMage extends CardImpl { this.toughness = new MageInt(2); // When Gwyllion Hedge-Mage enters the battlefield, if you control two or more Plains, you may put a 1/1 white Kithkin Soldier creature token onto the battlefield. - Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KithkinToken()), true), new ControlsPermanentCondition(filter, CountType.MORE_THAN, 1), rule1); + Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KithkinToken()), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule1); this.addAbility(ability); // When Gwyllion Hedge-Mage enters the battlefield, if you control two or more Swamps, you may put a -1/-1 counter on target creature. - Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.M1M1.createInstance()), true), new ControlsPermanentCondition(filter2, CountType.MORE_THAN, 1), rule2); + Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.M1M1.createInstance()), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2); ability2.addTarget(new TargetPermanent(filter3)); this.addAbility(ability2); diff --git a/Mage.Sets/src/mage/sets/commander/Invigorate.java b/Mage.Sets/src/mage/sets/commander/Invigorate.java index a19f651258c..20182939c53 100644 --- a/Mage.Sets/src/mage/sets/commander/Invigorate.java +++ b/Mage.Sets/src/mage/sets/commander/Invigorate.java @@ -28,7 +28,7 @@ package mage.sets.commander; import java.util.UUID; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.common.GainLifeOpponentCost; import mage.abilities.effects.common.continious.BoostTargetEffect; @@ -59,7 +59,7 @@ public class Invigorate extends CardImpl { this.color.setGreen(true); // If you control a Forest, rather than pay Invigorate's mana cost, you may have an opponent gain 3 life. - this.addAbility(new AlternativeCostSourceAbility(new GainLifeOpponentCost(3), new ControlsPermanentCondition(filter))); + this.addAbility(new AlternativeCostSourceAbility(new GainLifeOpponentCost(3), new PermanentsOnTheBattlefieldCondition(filter))); // Target creature gets +4/+4 until end of turn. this.getSpellAbility().addEffect(new BoostTargetEffect(4,4,Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); diff --git a/Mage.Sets/src/mage/sets/commander2013/Ophiomancer.java b/Mage.Sets/src/mage/sets/commander2013/Ophiomancer.java index 5ed13e25b94..a0b94d37f2b 100644 --- a/Mage.Sets/src/mage/sets/commander2013/Ophiomancer.java +++ b/Mage.Sets/src/mage/sets/commander2013/Ophiomancer.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.DeathtouchAbility; @@ -62,7 +62,7 @@ public class Ophiomancer extends CardImpl { // At the beginning of each upkeep, if you control no Snakes, put a 1/1 black Snake creature token with deathtouch onto the battlefield. this.addAbility(new ConditionalTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new OphiomancerSnakeToken()), TargetController.ANY, false), - new ControlsPermanentCondition(new FilterCreaturePermanent("Snake", "no Snakes"), ControlsPermanentCondition.CountType.EQUAL_TO, 0), + new PermanentsOnTheBattlefieldCondition(new FilterCreaturePermanent("Snake", "no Snakes"), PermanentsOnTheBattlefieldCondition.CountType.EQUAL_TO, 0), "At the beginning of each upkeep, if you control no Snakes, put a 1/1 black Snake creature token with deathtouch onto the battlefield.")); } diff --git a/Mage.Sets/src/mage/sets/commander2013/TempleOfTheFalseGod.java b/Mage.Sets/src/mage/sets/commander2013/TempleOfTheFalseGod.java index b25dd7c53f5..b417a862006 100644 --- a/Mage.Sets/src/mage/sets/commander2013/TempleOfTheFalseGod.java +++ b/Mage.Sets/src/mage/sets/commander2013/TempleOfTheFalseGod.java @@ -29,7 +29,7 @@ package mage.sets.commander2013; import java.util.UUID; import mage.Mana; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.ActivateIfConditionManaAbility; @@ -56,7 +56,7 @@ public class TempleOfTheFalseGod extends CardImpl { Zone.BATTLEFIELD, new BasicManaEffect(Mana.ColorlessMana(2)), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 4))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 4))); } public TempleOfTheFalseGod(final TempleOfTheFalseGod card) { diff --git a/Mage.Sets/src/mage/sets/conflux/CliffrunnerBehemoth.java b/Mage.Sets/src/mage/sets/conflux/CliffrunnerBehemoth.java index d0ece9234ef..b41b0c80609 100644 --- a/Mage.Sets/src/mage/sets/conflux/CliffrunnerBehemoth.java +++ b/Mage.Sets/src/mage/sets/conflux/CliffrunnerBehemoth.java @@ -34,7 +34,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.HasteAbility; @@ -70,19 +70,17 @@ public class CliffrunnerBehemoth extends CardImpl { this.toughness = new MageInt(3); // Cliffrunner Behemoth has haste as long as you control a red permanent. - this.addAbility( - new SimpleStaticAbility( + this.addAbility(new SimpleStaticAbility( Zone.BATTLEFIELD, new ConditionalContinousEffect( new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield), - new ControlsPermanentCondition(redPermanentFilter), "{this} has haste as long as you control a red permanent"))); + new PermanentsOnTheBattlefieldCondition(redPermanentFilter), "{this} has haste as long as you control a red permanent"))); // Cliffrunner Behemoth has lifelink as long as you control a white permanent. - this.addAbility( - new SimpleStaticAbility( + this.addAbility(new SimpleStaticAbility( Zone.BATTLEFIELD, new ConditionalContinousEffect( new GainAbilitySourceEffect(LifelinkAbility.getInstance(), Duration.WhileOnBattlefield), - new ControlsPermanentCondition(whitePermanentFilter), "{this} has lifelink as long as you control a white permanent"))); + new PermanentsOnTheBattlefieldCondition(whitePermanentFilter), "{this} has lifelink as long as you control a white permanent"))); } public CliffrunnerBehemoth(final CliffrunnerBehemoth card) { diff --git a/Mage.Sets/src/mage/sets/conflux/EmberWeaver.java b/Mage.Sets/src/mage/sets/conflux/EmberWeaver.java index bdcf34d419e..1cea474b929 100644 --- a/Mage.Sets/src/mage/sets/conflux/EmberWeaver.java +++ b/Mage.Sets/src/mage/sets/conflux/EmberWeaver.java @@ -34,7 +34,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -67,18 +67,16 @@ public class EmberWeaver extends CardImpl { this.addAbility(ReachAbility.getInstance()); // As long as you control a red permanent, Ember Weaver gets +1/+0 and has first strike. - this.addAbility( - new SimpleStaticAbility( + this.addAbility(new SimpleStaticAbility( Zone.BATTLEFIELD, new ConditionalContinousEffect( new BoostSourceEffect(1, 0, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(redPermanentFilter), "{this} gets +1/+0 as long as you control a red permanent"))); - this.addAbility( - new SimpleStaticAbility( + new PermanentsOnTheBattlefieldCondition(redPermanentFilter), "{this} gets +1/+0 as long as you control a red permanent"))); + this.addAbility(new SimpleStaticAbility( Zone.BATTLEFIELD, new ConditionalContinousEffect( new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield), - new ControlsPermanentCondition(redPermanentFilter), "{this} has first strike as long as you control a red permanent"))); + new PermanentsOnTheBattlefieldCondition(redPermanentFilter), "{this} has first strike as long as you control a red permanent"))); } diff --git a/Mage.Sets/src/mage/sets/conflux/MirrorSigilSergeant.java b/Mage.Sets/src/mage/sets/conflux/MirrorSigilSergeant.java index 5d6e8ac2248..60a2f1ab718 100644 --- a/Mage.Sets/src/mage/sets/conflux/MirrorSigilSergeant.java +++ b/Mage.Sets/src/mage/sets/conflux/MirrorSigilSergeant.java @@ -34,7 +34,7 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.TrampleAbility; @@ -81,7 +81,7 @@ public class MirrorSigilSergeant extends CardImpl { // At the beginning of your upkeep, if you control a blue permanent, you may put a token that's a copy of Mirror-Sigil Sergeant onto the battlefield. TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new MirrorSigilSergeantEffect(), TargetController.YOU, true); - this.addAbility(new ConditionalTriggeredAbility(ability, new ControlsPermanentCondition(filter), rule)); + this.addAbility(new ConditionalTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(filter), rule)); } diff --git a/Mage.Sets/src/mage/sets/conflux/RhoxMeditant.java b/Mage.Sets/src/mage/sets/conflux/RhoxMeditant.java index b9210218d8a..6f88dc56ac6 100644 --- a/Mage.Sets/src/mage/sets/conflux/RhoxMeditant.java +++ b/Mage.Sets/src/mage/sets/conflux/RhoxMeditant.java @@ -32,7 +32,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; @@ -67,7 +67,7 @@ public class RhoxMeditant extends CardImpl { // When Rhox Meditant enters the battlefield, if you control a green permanent, draw a card. TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1), false); - this.addAbility(new ConditionalTriggeredAbility(ability, new ControlsPermanentCondition(filter), rule)); + this.addAbility(new ConditionalTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(filter), rule)); } diff --git a/Mage.Sets/src/mage/sets/conflux/SedraxisAlchemist.java b/Mage.Sets/src/mage/sets/conflux/SedraxisAlchemist.java index 1e39a5b60bf..aa99ca8316a 100644 --- a/Mage.Sets/src/mage/sets/conflux/SedraxisAlchemist.java +++ b/Mage.Sets/src/mage/sets/conflux/SedraxisAlchemist.java @@ -32,7 +32,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.cards.CardImpl; @@ -69,7 +69,7 @@ public class SedraxisAlchemist extends CardImpl { // When Sedraxis Alchemist enters the battlefield, if you control a blue permanent, return target nonland permanent to its owner's hand. TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), false); ability.addTarget(new TargetNonlandPermanent()); - this.addAbility(new ConditionalTriggeredAbility(ability, new ControlsPermanentCondition(filter), rule)); + this.addAbility(new ConditionalTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(filter), rule)); } diff --git a/Mage.Sets/src/mage/sets/conflux/ToxicIguanar.java b/Mage.Sets/src/mage/sets/conflux/ToxicIguanar.java index 64f7876bd38..ee0600dc3c5 100644 --- a/Mage.Sets/src/mage/sets/conflux/ToxicIguanar.java +++ b/Mage.Sets/src/mage/sets/conflux/ToxicIguanar.java @@ -35,7 +35,7 @@ import mage.constants.Zone; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.DeathtouchAbility; @@ -67,7 +67,7 @@ public class ToxicIguanar extends CardImpl { // Toxic Iguanar has deathtouch as long as you control a green permanent. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), "{this} has deathtouch as long as you control a green permanent"))); + new PermanentsOnTheBattlefieldCondition(filter), "{this} has deathtouch as long as you control a green permanent"))); } public ToxicIguanar(final ToxicIguanar card) { diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/OpalLakeGatekeepers.java b/Mage.Sets/src/mage/sets/dragonsmaze/OpalLakeGatekeepers.java index 0d74f24ca5d..8b2a73f4daf 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/OpalLakeGatekeepers.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/OpalLakeGatekeepers.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; @@ -65,7 +65,7 @@ public class OpalLakeGatekeepers extends CardImpl { // When Opal Lake Gatekeepers enters the battlefield, if you control two or more Gates, you may draw a card. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 1), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 1), "When Opal Lake Gatekeepers enters the battlefield, if you control two or more Gates, you may draw a card.")); } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/SaruliGatekeepers.java b/Mage.Sets/src/mage/sets/dragonsmaze/SaruliGatekeepers.java index ba8e8e7ed56..03f0c6cf691 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/SaruliGatekeepers.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/SaruliGatekeepers.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; @@ -65,7 +65,7 @@ public class SaruliGatekeepers extends CardImpl { // When Saruli Gatekeepers enters the battlefield, if you control two or more Gates, gain 7 life. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new GainLifeEffect(7)), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 1), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 1), "When {this} enters the battlefield, if you control two or more Gates, gain 7 life.")); } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/SmeltWardGatekeepers.java b/Mage.Sets/src/mage/sets/dragonsmaze/SmeltWardGatekeepers.java index bdc4be9873d..c0d67192955 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/SmeltWardGatekeepers.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/SmeltWardGatekeepers.java @@ -37,7 +37,7 @@ import mage.constants.TargetController; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.UntapTargetEffect; import mage.abilities.effects.common.continious.GainAbilityTargetEffect; @@ -78,7 +78,7 @@ public class SmeltWardGatekeepers extends CardImpl { // When Smelt-Ward Gatekeepers enters the battlefield, if you control two or more Gates, gain control of target creature an opponent controls until end of turn. Untap that creature. That creature gains haste until end of turn. Ability ability = new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new GainControlTargetEffect(Duration.EndOfTurn)), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 1), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 1), "When {this} enters the battlefield, if you control two or more Gates, gain control of target creature an opponent controls until end of turn. Untap that creature. That creature gains haste until end of turn."); ability.addEffect(new UntapTargetEffect()); ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn)); diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/SunspireGatekeepers.java b/Mage.Sets/src/mage/sets/dragonsmaze/SunspireGatekeepers.java index ea368ba0329..177715be74a 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/SunspireGatekeepers.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/SunspireGatekeepers.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; @@ -66,7 +66,7 @@ public class SunspireGatekeepers extends CardImpl { // When Sunspire Gatekeepers enter the battlefield, if you control two or more Gates, put a 2/2 white Knight creature token with vigilance onto the battlefield. this.addAbility(new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KnightToken())), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 1), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 1), "When {this} enter the battlefield, if you control two or more Gates, put a 2/2 white Knight creature token with vigilance onto the battlefield.")); } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/UbulSarGatekeepers.java b/Mage.Sets/src/mage/sets/dragonsmaze/UbulSarGatekeepers.java index 19369524ce1..30bfb8151cc 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/UbulSarGatekeepers.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/UbulSarGatekeepers.java @@ -35,7 +35,7 @@ import mage.constants.TargetController; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; @@ -74,7 +74,7 @@ public class UbulSarGatekeepers extends CardImpl { // Whenever Ubul Sar Gatekeepers enters the battlefield, if you control two or more Gates, target creature an opponent controls gets -2/-2 until end of turn. Ability ability = new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.M1M1.createInstance(2))), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 1), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 1), "Whenever {this} enters the battlefield, if you control two or more Gates, target creature an opponent controls gets -2/-2 until end of turn."); Target target = new TargetCreaturePermanent(targetFilter); ability.addTarget(target); diff --git a/Mage.Sets/src/mage/sets/eventide/HagHedgeMage.java b/Mage.Sets/src/mage/sets/eventide/HagHedgeMage.java index cd3974496a3..2a1fd1bad6b 100644 --- a/Mage.Sets/src/mage/sets/eventide/HagHedgeMage.java +++ b/Mage.Sets/src/mage/sets/eventide/HagHedgeMage.java @@ -31,8 +31,8 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.effects.common.PutOnLibraryTargetEffect; @@ -74,12 +74,12 @@ public class HagHedgeMage extends CardImpl { this.toughness = new MageInt(2); // When Hag Hedge-Mage enters the battlefield, if you control two or more Swamps, you may have target player discard a card. - Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(1), true), new ControlsPermanentCondition(filter, CountType.MORE_THAN, 1), rule, true); + Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(1), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule, true); ability.addTarget(new TargetPlayer()); this.addAbility(ability); // When Hag Hedge-Mage enters the battlefield, if you control two or more Forests, you may put target card from your graveyard on top of your library. - Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new PutOnLibraryTargetEffect(true), true), new ControlsPermanentCondition(filter2, CountType.MORE_THAN, 1), rule2, true); + Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new PutOnLibraryTargetEffect(true), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2, true); ability2.addTarget(new TargetCardInYourGraveyard()); this.addAbility(ability2); } diff --git a/Mage.Sets/src/mage/sets/eventide/NoggleHedgeMage.java b/Mage.Sets/src/mage/sets/eventide/NoggleHedgeMage.java index d480462a00c..fa635a9577a 100644 --- a/Mage.Sets/src/mage/sets/eventide/NoggleHedgeMage.java +++ b/Mage.Sets/src/mage/sets/eventide/NoggleHedgeMage.java @@ -31,8 +31,8 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.TapTargetEffect; @@ -75,12 +75,12 @@ public class NoggleHedgeMage extends CardImpl { this.toughness = new MageInt(2); // When Noggle Hedge-Mage enters the battlefield, if you control two or more Islands, you may tap two target permanents. - Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), true), new ControlsPermanentCondition(filter, CountType.MORE_THAN, 1), rule, true); + Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule, true); ability.addTarget(new TargetPermanent(2, new FilterPermanent())); this.addAbility(ability); // When Noggle Hedge-Mage enters the battlefield, if you control two or more Mountains, you may have Noggle Hedge-Mage deal 2 damage to target player. - Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2), true), new ControlsPermanentCondition(filter2, CountType.MORE_THAN, 1), rule2, true); + Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2, true); ability2.addTarget(new TargetPlayer()); this.addAbility(ability2); } diff --git a/Mage.Sets/src/mage/sets/eventide/SelkieHedgeMage.java b/Mage.Sets/src/mage/sets/eventide/SelkieHedgeMage.java index 83d28b2b5fb..4b93e395876 100644 --- a/Mage.Sets/src/mage/sets/eventide/SelkieHedgeMage.java +++ b/Mage.Sets/src/mage/sets/eventide/SelkieHedgeMage.java @@ -31,8 +31,8 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; @@ -78,11 +78,11 @@ public class SelkieHedgeMage extends CardImpl { this.toughness = new MageInt(2); // When Selkie Hedge-Mage enters the battlefield, if you control two or more Forests, you may gain 3 life. - Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(3), true), new ControlsPermanentCondition(filter, CountType.MORE_THAN, 1), rule1); + Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(3), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule1); this.addAbility(ability); // When Selkie Hedge-Mage enters the battlefield, if you control two or more Islands, you may return target tapped creature to its owner's hand. - Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true), new ControlsPermanentCondition(filter2, CountType.MORE_THAN, 1), rule2); + Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2); ability2.addTarget(new TargetPermanent(filter3)); this.addAbility(ability2); diff --git a/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java b/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java index 064446f0908..f7ef595c04c 100644 --- a/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java +++ b/Mage.Sets/src/mage/sets/fallenempires/Seasinger.java @@ -35,7 +35,7 @@ import mage.abilities.Ability; import mage.abilities.StateTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SkipUntapOptionalAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.SourceTappedCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalContinousEffect; @@ -89,7 +89,7 @@ public class Seasinger extends CardImpl { // {tap}: Gain control of target creature whose controller controls an Island for as long as you control Seasinger and Seasinger remains tapped. ConditionalContinousEffect effect = new ConditionalContinousEffect( new GainControlTargetEffect(Duration.Custom), - new ControlsPermanentCondition(seasinger, ControlsPermanentCondition.CountType.EQUAL_TO, 1, SourceTappedCondition.getInstance()), rule); + new PermanentsOnTheBattlefieldCondition(seasinger, PermanentsOnTheBattlefieldCondition.CountType.EQUAL_TO, 1, SourceTappedCondition.getInstance()), rule); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost()); creatureWhoseControllerControlsIsland.add(new ControllerControlsIslandPredicate()); ability.addTarget(new TargetCreaturePermanent(creatureWhoseControllerControlsIsland)); diff --git a/Mage.Sets/src/mage/sets/gatecrash/Biovisionary.java b/Mage.Sets/src/mage/sets/gatecrash/Biovisionary.java index c9f05343b94..e9dd54a5c45 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/Biovisionary.java +++ b/Mage.Sets/src/mage/sets/gatecrash/Biovisionary.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.effects.common.WinGameSourceControllerEffect; import mage.cards.CardImpl; import mage.constants.TargetController; @@ -69,7 +69,7 @@ public class Biovisionary extends CardImpl { this.addAbility(new BeginningOfEndStepTriggeredAbility( Zone.BATTLEFIELD, new WinGameSourceControllerEffect(), TargetController.ANY, - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 3), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 3), false)); } diff --git a/Mage.Sets/src/mage/sets/gatecrash/HellkiteTyrant.java b/Mage.Sets/src/mage/sets/gatecrash/HellkiteTyrant.java index 985024196dd..e203ec44bb0 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/HellkiteTyrant.java +++ b/Mage.Sets/src/mage/sets/gatecrash/HellkiteTyrant.java @@ -41,7 +41,7 @@ import mage.abilities.Ability; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffectImpl; @@ -85,7 +85,7 @@ public class HellkiteTyrant extends CardImpl { TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect(), TargetController.YOU, false); this.addAbility(new ConditionalTriggeredAbility( ability, - new ControlsPermanentCondition(new FilterArtifactPermanent(), ControlsPermanentCondition.CountType.MORE_THAN,19), + new PermanentsOnTheBattlefieldCondition(new FilterArtifactPermanent(), PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN,19), "At the beginning of your upkeep, if you control twenty or more artifacts, you win the game.")); } diff --git a/Mage.Sets/src/mage/sets/gatecrash/WayOfTheThief.java b/Mage.Sets/src/mage/sets/gatecrash/WayOfTheThief.java index cfd9f8fa541..18aa6476475 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/WayOfTheThief.java +++ b/Mage.Sets/src/mage/sets/gatecrash/WayOfTheThief.java @@ -36,7 +36,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalRestrictionEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; @@ -81,7 +81,7 @@ public class WayOfTheThief extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(2, 2, Duration.WhileOnBattlefield))); // Enchanted creature is unblockable as long as you control a Gate. - Effect effect = new ConditionalRestrictionEffect(new UnblockableAttachedEffect(AttachmentType.AURA), new ControlsPermanentCondition(filter)); + Effect effect = new ConditionalRestrictionEffect(new UnblockableAttachedEffect(AttachmentType.AURA), new PermanentsOnTheBattlefieldCondition(filter)); effect.setText(rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } diff --git a/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java b/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java index 8bfd572a361..c3c7485301a 100644 --- a/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java +++ b/Mage.Sets/src/mage/sets/innistrad/AngelicOverseer.java @@ -34,7 +34,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.*; @@ -69,9 +69,9 @@ public class AngelicOverseer extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // As long as you control a Human, Angelic Overseer has hexproof and is indestructible. - ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new GainAbilitySourceEffect(HexproofAbility.getInstance()), new ControlsPermanentCondition(filter), rule1); + ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new GainAbilitySourceEffect(HexproofAbility.getInstance()), new PermanentsOnTheBattlefieldCondition(filter), rule1); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect1); - ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance()), new ControlsPermanentCondition(filter), rule2); + ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance()), new PermanentsOnTheBattlefieldCondition(filter), rule2); ability.addEffect(effect2); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/innistrad/ClifftopRetreat.java b/Mage.Sets/src/mage/sets/innistrad/ClifftopRetreat.java index 0318fb7fade..09624bc15c5 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ClifftopRetreat.java +++ b/Mage.Sets/src/mage/sets/innistrad/ClifftopRetreat.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class ClifftopRetreat extends CardImpl { super(ownerId, 238, "Clifftop Retreat", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "ISD"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Mountain or a Plains"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new RedManaAbility()); diff --git a/Mage.Sets/src/mage/sets/innistrad/HinterlandHarbor.java b/Mage.Sets/src/mage/sets/innistrad/HinterlandHarbor.java index 6bb10001575..561a084575e 100644 --- a/Mage.Sets/src/mage/sets/innistrad/HinterlandHarbor.java +++ b/Mage.Sets/src/mage/sets/innistrad/HinterlandHarbor.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class HinterlandHarbor extends CardImpl { super(ownerId, 241, "Hinterland Harbor", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "ISD"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tapped unless you control a Forest or an Island"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new GreenManaAbility()); diff --git a/Mage.Sets/src/mage/sets/innistrad/IsolatedChapel.java b/Mage.Sets/src/mage/sets/innistrad/IsolatedChapel.java index eed27558551..33df2c88372 100644 --- a/Mage.Sets/src/mage/sets/innistrad/IsolatedChapel.java +++ b/Mage.Sets/src/mage/sets/innistrad/IsolatedChapel.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class IsolatedChapel extends CardImpl { super(ownerId, 242, "Isolated Chapel", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "ISD"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Plains or a Swamp"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new WhiteManaAbility()); diff --git a/Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.java b/Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.java index 3f132f3fc41..1fc3e04bd95 100644 --- a/Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.java +++ b/Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.java @@ -33,7 +33,7 @@ import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.DamageTargetEffect; @@ -92,7 +92,7 @@ public class OliviaVoldaren extends CardImpl { this.addAbility(ability); // {3}{B}{B}: Gain control of target Vampire for as long as you control Olivia Voldaren. - ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainControlTargetEffect(Duration.Custom), new ControlsPermanentCondition(filter2), rule); + ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainControlTargetEffect(Duration.Custom), new PermanentsOnTheBattlefieldCondition(filter2), rule); Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{3}{B}{B}")); ability2.addTarget(new TargetCreaturePermanent(vampireFilter)); this.addAbility(ability2); diff --git a/Mage.Sets/src/mage/sets/innistrad/SulfurFalls.java b/Mage.Sets/src/mage/sets/innistrad/SulfurFalls.java index 1d50aa33e9b..ad8db38c968 100644 --- a/Mage.Sets/src/mage/sets/innistrad/SulfurFalls.java +++ b/Mage.Sets/src/mage/sets/innistrad/SulfurFalls.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class SulfurFalls extends CardImpl { super(ownerId, 248, "Sulfur Falls", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "ISD"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Island or a Mountain"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new BlueManaAbility()); diff --git a/Mage.Sets/src/mage/sets/innistrad/WoodlandCemetery.java b/Mage.Sets/src/mage/sets/innistrad/WoodlandCemetery.java index 6a71944da07..d4860fa47dd 100644 --- a/Mage.Sets/src/mage/sets/innistrad/WoodlandCemetery.java +++ b/Mage.Sets/src/mage/sets/innistrad/WoodlandCemetery.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class WoodlandCemetery extends CardImpl { super(ownerId, 249, "Woodland Cemetery", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "ISD"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Swamp or a Forest"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new BlackManaAbility()); diff --git a/Mage.Sets/src/mage/sets/judgment/Anger.java b/Mage.Sets/src/mage/sets/judgment/Anger.java index e6271a72dd0..81fdd767897 100644 --- a/Mage.Sets/src/mage/sets/judgment/Anger.java +++ b/Mage.Sets/src/mage/sets/judgment/Anger.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.common.continious.GainAbilityControlledEffect; @@ -76,7 +76,7 @@ public class Anger extends CardImpl { ContinuousEffect effect = new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()); ConditionalContinousEffect angerEffect = new ConditionalContinousEffect(effect, - new ControlsPermanentCondition(filter), ruleText); + new PermanentsOnTheBattlefieldCondition(filter), ruleText); this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, angerEffect)); } diff --git a/Mage.Sets/src/mage/sets/judgment/Brawn.java b/Mage.Sets/src/mage/sets/judgment/Brawn.java index f2ea3ca2e3d..50100cc27fc 100644 --- a/Mage.Sets/src/mage/sets/judgment/Brawn.java +++ b/Mage.Sets/src/mage/sets/judgment/Brawn.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.common.continious.GainAbilityControlledEffect; @@ -76,7 +76,7 @@ public class Brawn extends CardImpl { ContinuousEffect effect = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()); ConditionalContinousEffect brawnEffect = new ConditionalContinousEffect(effect, - new ControlsPermanentCondition(filter), ruleText); + new PermanentsOnTheBattlefieldCondition(filter), ruleText); this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, brawnEffect)); } diff --git a/Mage.Sets/src/mage/sets/judgment/Filth.java b/Mage.Sets/src/mage/sets/judgment/Filth.java index a3643c40adf..c99c8df4db8 100644 --- a/Mage.Sets/src/mage/sets/judgment/Filth.java +++ b/Mage.Sets/src/mage/sets/judgment/Filth.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.common.continious.GainAbilityControlledEffect; @@ -76,7 +76,7 @@ public class Filth extends CardImpl { ContinuousEffect effect = new GainAbilityControlledEffect(new SwampwalkAbility(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()); ConditionalContinousEffect filthEffect = new ConditionalContinousEffect(effect, - new ControlsPermanentCondition(filter), ruleText); + new PermanentsOnTheBattlefieldCondition(filter), ruleText); this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, filthEffect)); } diff --git a/Mage.Sets/src/mage/sets/judgment/Valor.java b/Mage.Sets/src/mage/sets/judgment/Valor.java index 6328fe12062..eb003c5d450 100644 --- a/Mage.Sets/src/mage/sets/judgment/Valor.java +++ b/Mage.Sets/src/mage/sets/judgment/Valor.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.common.continious.GainAbilityControlledEffect; @@ -76,7 +76,7 @@ public class Valor extends CardImpl { ContinuousEffect effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()); ConditionalContinousEffect valorEffect = new ConditionalContinousEffect(effect, - new ControlsPermanentCondition(filter), ruleText); + new PermanentsOnTheBattlefieldCondition(filter), ruleText); this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, valorEffect)); } diff --git a/Mage.Sets/src/mage/sets/judgment/Wonder.java b/Mage.Sets/src/mage/sets/judgment/Wonder.java index 4c58417cdfd..d505cb2e7b2 100644 --- a/Mage.Sets/src/mage/sets/judgment/Wonder.java +++ b/Mage.Sets/src/mage/sets/judgment/Wonder.java @@ -31,7 +31,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.common.continious.GainAbilityControlledEffect; @@ -77,7 +77,7 @@ public class Wonder extends CardImpl { ContinuousEffect effect = new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent()); ConditionalContinousEffect wonderEffect = new ConditionalContinousEffect(effect, - new ControlsPermanentCondition(filter), ruleText); + new PermanentsOnTheBattlefieldCondition(filter), ruleText); this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, wonderEffect)); } diff --git a/Mage.Sets/src/mage/sets/lorwyn/DauntlessDourbark.java b/Mage.Sets/src/mage/sets/lorwyn/DauntlessDourbark.java index 9d3655e7b6f..25b0210bf59 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/DauntlessDourbark.java +++ b/Mage.Sets/src/mage/sets/lorwyn/DauntlessDourbark.java @@ -30,7 +30,7 @@ package mage.sets.lorwyn; import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; @@ -81,7 +81,7 @@ public class DauntlessDourbark extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(amount, Duration.EndOfGame))); // Dauntless Dourbark has trample as long as you control another Treefolk. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield), new ControlsPermanentCondition(filter2), rule))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield), new PermanentsOnTheBattlefieldCondition(filter2), rule))); } diff --git a/Mage.Sets/src/mage/sets/magic2010/DragonskullSummit.java b/Mage.Sets/src/mage/sets/magic2010/DragonskullSummit.java index f484646a6aa..ca4766f0ca4 100644 --- a/Mage.Sets/src/mage/sets/magic2010/DragonskullSummit.java +++ b/Mage.Sets/src/mage/sets/magic2010/DragonskullSummit.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class DragonskullSummit extends CardImpl { super(ownerId, 223, "Dragonskull Summit", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "M10"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tapped unless you control a Swamp or a Mountain"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new BlackManaAbility()); diff --git a/Mage.Sets/src/mage/sets/magic2010/DrownedCatacomb.java b/Mage.Sets/src/mage/sets/magic2010/DrownedCatacomb.java index fa1f3de0134..9da65b9fd21 100644 --- a/Mage.Sets/src/mage/sets/magic2010/DrownedCatacomb.java +++ b/Mage.Sets/src/mage/sets/magic2010/DrownedCatacomb.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class DrownedCatacomb extends CardImpl { super(ownerId, 224, "Drowned Catacomb", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "M10"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Island or a Swamp"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new BlackManaAbility()); diff --git a/Mage.Sets/src/mage/sets/magic2010/GlacialFortress.java b/Mage.Sets/src/mage/sets/magic2010/GlacialFortress.java index ee4ccc27b30..1d37ef3b106 100644 --- a/Mage.Sets/src/mage/sets/magic2010/GlacialFortress.java +++ b/Mage.Sets/src/mage/sets/magic2010/GlacialFortress.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class GlacialFortress extends CardImpl { super(ownerId, 226, "Glacial Fortress", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "M10"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Plains or an Island"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new BlueManaAbility()); diff --git a/Mage.Sets/src/mage/sets/magic2010/RootboundCrag.java b/Mage.Sets/src/mage/sets/magic2010/RootboundCrag.java index 75fd974ae4f..96832e222fe 100644 --- a/Mage.Sets/src/mage/sets/magic2010/RootboundCrag.java +++ b/Mage.Sets/src/mage/sets/magic2010/RootboundCrag.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class RootboundCrag extends CardImpl { super(ownerId, 227, "Rootbound Crag", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "M10"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Mountain or a Forest"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new RedManaAbility()); diff --git a/Mage.Sets/src/mage/sets/magic2010/SunpetalGrove.java b/Mage.Sets/src/mage/sets/magic2010/SunpetalGrove.java index a0116a5ac70..a7f324714c4 100644 --- a/Mage.Sets/src/mage/sets/magic2010/SunpetalGrove.java +++ b/Mage.Sets/src/mage/sets/magic2010/SunpetalGrove.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class SunpetalGrove extends CardImpl { super(ownerId, 228, "Sunpetal Grove", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "M10"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0)); String abilityText = "tap it unless you control a Forest or a Plains"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new GreenManaAbility()); diff --git a/Mage.Sets/src/mage/sets/magic2012/GriffinRider.java b/Mage.Sets/src/mage/sets/magic2012/GriffinRider.java index 026a6cd896d..b3d97a4de7d 100644 --- a/Mage.Sets/src/mage/sets/magic2012/GriffinRider.java +++ b/Mage.Sets/src/mage/sets/magic2012/GriffinRider.java @@ -34,7 +34,7 @@ import mage.constants.Duration; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -70,9 +70,9 @@ public class GriffinRider extends CardImpl { this.toughness = new MageInt(1); // As long as you control a Griffin creature, Griffin Rider gets +3/+3 and has flying. - ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new BoostSourceEffect(3, 3, Duration.WhileOnBattlefield), new ControlsPermanentCondition(filterGriffinCard), rule1); + ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new BoostSourceEffect(3, 3, Duration.WhileOnBattlefield), new PermanentsOnTheBattlefieldCondition(filterGriffinCard), rule1); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1)); - ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance()), new ControlsPermanentCondition(filterGriffinCard), rule2); + ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance()), new PermanentsOnTheBattlefieldCondition(filterGriffinCard), rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/sets/magic2013/HarborBandit.java b/Mage.Sets/src/mage/sets/magic2013/HarborBandit.java index 4d2bd82eb1c..df78f5d9734 100644 --- a/Mage.Sets/src/mage/sets/magic2013/HarborBandit.java +++ b/Mage.Sets/src/mage/sets/magic2013/HarborBandit.java @@ -35,7 +35,7 @@ import mage.constants.Zone; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.combat.UnblockableSourceEffect; @@ -68,7 +68,7 @@ public class HarborBandit extends CardImpl { this.toughness = new MageInt(2); // Harbor Bandit gets +1/+1 as long as you control an Island. - ConditionalContinousEffect effect = new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), new ControlsPermanentCondition(filter), rule); + ConditionalContinousEffect effect = new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), new PermanentsOnTheBattlefieldCondition(filter), rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); // {1}{U}: Harbor Bandit is unblockable this turn. diff --git a/Mage.Sets/src/mage/sets/magic2013/PrizedElephant.java b/Mage.Sets/src/mage/sets/magic2013/PrizedElephant.java index ea85d7705f4..8c1e40d15ef 100644 --- a/Mage.Sets/src/mage/sets/magic2013/PrizedElephant.java +++ b/Mage.Sets/src/mage/sets/magic2013/PrizedElephant.java @@ -35,7 +35,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; @@ -72,7 +72,7 @@ public class PrizedElephant extends CardImpl { // Prized Elephant gets +1/+1 as long as you control a Forest. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), rule))); + new PermanentsOnTheBattlefieldCondition(filter), rule))); // {G}: Prized Elephant gains trample until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{G}")); diff --git a/Mage.Sets/src/mage/sets/magic2014/AngelicAccord.java b/Mage.Sets/src/mage/sets/magic2014/AngelicAccord.java index e4e6abb89af..f7d1ba7717d 100644 --- a/Mage.Sets/src/mage/sets/magic2014/AngelicAccord.java +++ b/Mage.Sets/src/mage/sets/magic2014/AngelicAccord.java @@ -87,7 +87,6 @@ class YouGainedLifeCondition extends IntCompareCondition { @Override public String toString() { - StringBuilder sb = new StringBuilder("if you gained 4 or more life this turn "); - return sb.toString(); + return "if you gained 4 or more life this turn "; } } diff --git a/Mage.Sets/src/mage/sets/magic2014/FesteringNewt.java b/Mage.Sets/src/mage/sets/magic2014/FesteringNewt.java index 019d3085526..460436c13f8 100644 --- a/Mage.Sets/src/mage/sets/magic2014/FesteringNewt.java +++ b/Mage.Sets/src/mage/sets/magic2014/FesteringNewt.java @@ -32,7 +32,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.condition.LockedInCondition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostTargetEffect; @@ -71,7 +71,7 @@ public class FesteringNewt extends CardImpl { Effect effect = new ConditionalContinousEffect( new BoostTargetEffect(-4,-4, Duration.EndOfTurn), new BoostTargetEffect(-1,-1, Duration.EndOfTurn), - new LockedInCondition(new ControlsPermanentCondition(filterBogbrewWitch)), + new LockedInCondition(new PermanentsOnTheBattlefieldCondition(filterBogbrewWitch)), "target creature an opponent controls gets -1/-1 until end of turn. That creature gets -4/-4 instead if you control a creature named Bogbrew Witch"); Ability ability = new DiesTriggeredAbility(effect); ability.addTarget(new TargetCreaturePermanent(filterCreature)); diff --git a/Mage.Sets/src/mage/sets/magic2014/HauntedPlateMail.java b/Mage.Sets/src/mage/sets/magic2014/HauntedPlateMail.java index 95b3b673c84..13d2923be24 100644 --- a/Mage.Sets/src/mage/sets/magic2014/HauntedPlateMail.java +++ b/Mage.Sets/src/mage/sets/magic2014/HauntedPlateMail.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -68,7 +68,7 @@ public class HauntedPlateMail extends CardImpl { Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new HauntedPlateMailToken(),"", Duration.EndOfTurn), new ManaCostsImpl("{0}"), - new ControlsPermanentCondition(new FilterCreaturePermanent(), ControlsPermanentCondition.CountType.EQUAL_TO, 0), + new PermanentsOnTheBattlefieldCondition(new FilterCreaturePermanent(), PermanentsOnTheBattlefieldCondition.CountType.EQUAL_TO, 0), "{0}: Until end of turn, Haunted Plate Mail becomes a 4/4 Spirit artifact creature that's no longer an Equipment. Activate this ability only if you control no creatures."); this.addAbility(ability); // Equip {4} diff --git a/Mage.Sets/src/mage/sets/magic2014/MaraudingMaulhorn.java b/Mage.Sets/src/mage/sets/magic2014/MaraudingMaulhorn.java index f790bffcd0f..257d0a29e54 100644 --- a/Mage.Sets/src/mage/sets/magic2014/MaraudingMaulhorn.java +++ b/Mage.Sets/src/mage/sets/magic2014/MaraudingMaulhorn.java @@ -30,7 +30,7 @@ package mage.sets.magic2014; import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalRequirementEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.combat.AttacksIfAbleSourceEffect; @@ -65,7 +65,7 @@ public class MaraudingMaulhorn extends CardImpl { // Marauding Maulhorn attacks each combat if able unless you control a creature named Advocate of the Beast. Effect effect = new ConditionalRequirementEffect( new AttacksIfAbleSourceEffect(Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 1)); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.FEWER_THAN, 1)); effect.setText("{this} attacks each combat if able unless you control a creature named Advocate of the Beast"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); diff --git a/Mage.Sets/src/mage/sets/magic2014/WoodbornBehemoth.java b/Mage.Sets/src/mage/sets/magic2014/WoodbornBehemoth.java index 9c758cd0f7d..7dca53f0986 100644 --- a/Mage.Sets/src/mage/sets/magic2014/WoodbornBehemoth.java +++ b/Mage.Sets/src/mage/sets/magic2014/WoodbornBehemoth.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -59,7 +59,7 @@ public class WoodbornBehemoth extends CardImpl { this.toughness = new MageInt(4); // As long as you control eight or more lands, Woodborn Behemoth gets +4/+4 and has trample. - ControlsPermanentCondition eightOrMoreLandCondition = new ControlsPermanentCondition(new FilterLandPermanent(), ControlsPermanentCondition.CountType.MORE_THAN,7); + PermanentsOnTheBattlefieldCondition eightOrMoreLandCondition = new PermanentsOnTheBattlefieldCondition(new FilterLandPermanent(), PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN,7); ConditionalContinousEffect effect1 = new ConditionalContinousEffect( new BoostSourceEffect(4,4, Duration.WhileOnBattlefield), eightOrMoreLandCondition, "As long as you control eight or more lands, {this} gets +4/+4"); diff --git a/Mage.Sets/src/mage/sets/magic2015/AeronautTinkerer.java b/Mage.Sets/src/mage/sets/magic2015/AeronautTinkerer.java index 5123f88353f..58e5d2df3f2 100644 --- a/Mage.Sets/src/mage/sets/magic2015/AeronautTinkerer.java +++ b/Mage.Sets/src/mage/sets/magic2015/AeronautTinkerer.java @@ -30,7 +30,7 @@ package mage.sets.magic2015; import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.FlyingAbility; @@ -60,7 +60,7 @@ public class AeronautTinkerer extends CardImpl { this.toughness = new MageInt(3); // Aeronaut Tinkerer has flying as long as you control an artifact. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield), new ControlsPermanentCondition(new FilterControlledArtifactPermanent()), rule))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield), new PermanentsOnTheBattlefieldCondition(new FilterControlledArtifactPermanent()), rule))); } diff --git a/Mage.Sets/src/mage/sets/magic2015/JorubaiMurkLurker.java b/Mage.Sets/src/mage/sets/magic2015/JorubaiMurkLurker.java index cf5d47c8fb0..62459c2d69f 100644 --- a/Mage.Sets/src/mage/sets/magic2015/JorubaiMurkLurker.java +++ b/Mage.Sets/src/mage/sets/magic2015/JorubaiMurkLurker.java @@ -32,7 +32,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; @@ -72,7 +72,7 @@ public class JorubaiMurkLurker extends CardImpl { // Jorubai Murk Lurker gets +1/+1 as long as you control a Swamp. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), rule))); + new PermanentsOnTheBattlefieldCondition(filter), rule))); // {1}{B}: Target creature gains lifelink until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, diff --git a/Mage.Sets/src/mage/sets/magic2015/KirdChieftain.java b/Mage.Sets/src/mage/sets/magic2015/KirdChieftain.java index cd62c560fc4..dd9e4a67146 100644 --- a/Mage.Sets/src/mage/sets/magic2015/KirdChieftain.java +++ b/Mage.Sets/src/mage/sets/magic2015/KirdChieftain.java @@ -32,7 +32,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.Effect; @@ -74,7 +74,7 @@ public class KirdChieftain extends CardImpl { // Kird Chieftain gets +1/+1 as long as you control a Forest. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), rule))); + new PermanentsOnTheBattlefieldCondition(filter), rule))); // {4}{G}: Target creature gets +2/+2 and gains trample until end of turn. Effect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn); diff --git a/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java b/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java index 9d7902002e2..43e8b3efdeb 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java +++ b/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; @@ -67,11 +67,11 @@ public class ScrapyardMongrel extends CardImpl { // As long as you control an artifact, Scrapyard Mongrel gets +2/+0 and has trample. Effect boostEffect = new ConditionalContinousEffect( new BoostSourceEffect(2, 0, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "As long as you control an artifact, {this} gets +2/+0"); Effect gainAbilityEffect = new ConditionalContinousEffect( new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "and has trample"); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, boostEffect); ability.addEffect(gainAbilityEffect); diff --git a/Mage.Sets/src/mage/sets/magic2015/StatuteOfDenial.java b/Mage.Sets/src/mage/sets/magic2015/StatuteOfDenial.java index 076f7b28d7e..fdb45e8d656 100644 --- a/Mage.Sets/src/mage/sets/magic2015/StatuteOfDenial.java +++ b/Mage.Sets/src/mage/sets/magic2015/StatuteOfDenial.java @@ -29,7 +29,7 @@ package mage.sets.magic2015; import java.util.UUID; import mage.ObjectColor; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -64,7 +64,7 @@ public class StatuteOfDenial extends CardImpl { this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new DrawDiscardControllerEffect(1,1), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0, true), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0, true), "If you control a blue creature, draw a card, then discard a card")); } diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/SnuffOut.java b/Mage.Sets/src/mage/sets/mercadianmasques/SnuffOut.java index 486fc568896..544bd5b175a 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/SnuffOut.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/SnuffOut.java @@ -29,8 +29,8 @@ package mage.sets.mercadianmasques; import java.util.UUID; import mage.ObjectColor; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.common.DestroyTargetEffect; @@ -67,7 +67,7 @@ public class SnuffOut extends CardImpl { // If you control a Swamp, you may pay 4 life rather than pay Snuff Out's mana cost. this.addAbility(new AlternativeCostSourceAbility( new PayLifeCost(4), - new ControlsPermanentCondition(filterSwamp, CountType.MORE_THAN, 0), null)); + new PermanentsOnTheBattlefieldCondition(filterSwamp, CountType.MORE_THAN, 0), null)); // // Destroy target nonblack creature. It can't be regenerated. this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); diff --git a/Mage.Sets/src/mage/sets/modernmasters/KithkinGreatheart.java b/Mage.Sets/src/mage/sets/modernmasters/KithkinGreatheart.java index c6f1908ec1f..0acf0e2a114 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/KithkinGreatheart.java +++ b/Mage.Sets/src/mage/sets/modernmasters/KithkinGreatheart.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; @@ -72,12 +72,12 @@ public class KithkinGreatheart extends CardImpl { // As long as you control a Giant, Kithkin Greatheart gets +1/+1 and has first strike. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( new BoostSourceEffect(1,1, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), "As long as you control a Giant, Kithkin Greatheart gets +1/+1")); this.addAbility(ability); ConditionalContinousEffect effect2 = new ConditionalContinousEffect( new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), - new ControlsPermanentCondition(filter), + new PermanentsOnTheBattlefieldCondition(filter), rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); diff --git a/Mage.Sets/src/mage/sets/modernmasters/Peppersmoke.java b/Mage.Sets/src/mage/sets/modernmasters/Peppersmoke.java index 109546973d2..58c3fb2d3aa 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/Peppersmoke.java +++ b/Mage.Sets/src/mage/sets/modernmasters/Peppersmoke.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continious.BoostTargetEffect; @@ -61,9 +61,8 @@ public class Peppersmoke extends CardImpl { // Target creature gets -1/-1 until end of turn. If you control a Faerie, draw a card. this.getSpellAbility().addEffect(new BoostTargetEffect(-1,-1,Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - this.getSpellAbility().addEffect( - new ConditionalOneShotEffect(new DrawCardSourceControllerEffect(1), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0), + this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new DrawCardSourceControllerEffect(1), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0), "If you control a Faerie, draw a card")); } diff --git a/Mage.Sets/src/mage/sets/nemesis/Massacre.java b/Mage.Sets/src/mage/sets/nemesis/Massacre.java index faf750ff22e..33ad481b15a 100644 --- a/Mage.Sets/src/mage/sets/nemesis/Massacre.java +++ b/Mage.Sets/src/mage/sets/nemesis/Massacre.java @@ -30,7 +30,7 @@ package mage.sets.nemesis; import java.util.UUID; import mage.abilities.condition.CompoundCondition; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.OpponentControlsPermanentCondition; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.effects.common.continious.BoostAllEffect; @@ -64,7 +64,7 @@ public class Massacre extends CardImpl { // If an opponent controls a Plains and you control a Swamp, you may cast Massacre without paying its mana cost. Condition condition = new CompoundCondition("If an opponent controls a Plains and you control a Swamp", new OpponentControlsPermanentCondition(filterPlains), - new ControlsPermanentCondition(filterSwamp)); + new PermanentsOnTheBattlefieldCondition(filterSwamp)); this.addAbility(new AlternativeCostSourceAbility(null, condition)); // All creatures get -2/-2 until end of turn. this.getSpellAbility().addEffect(new BoostAllEffect(-2, -2, Duration.EndOfTurn)); diff --git a/Mage.Sets/src/mage/sets/nemesis/ReverentSilence.java b/Mage.Sets/src/mage/sets/nemesis/ReverentSilence.java index 3de42626287..468f367f5e6 100644 --- a/Mage.Sets/src/mage/sets/nemesis/ReverentSilence.java +++ b/Mage.Sets/src/mage/sets/nemesis/ReverentSilence.java @@ -28,7 +28,7 @@ package mage.sets.nemesis; import java.util.UUID; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.common.GainLifePlayersCost; import mage.abilities.effects.common.DestroyAllEffect; @@ -58,7 +58,7 @@ public class ReverentSilence extends CardImpl { this.color.setGreen(true); // If you control a Forest, rather than pay Reverent Silence's mana cost, you may have each other player gain 6 life. - this.addAbility(new AlternativeCostSourceAbility(new GainLifePlayersCost(6), new ControlsPermanentCondition(filter))); + this.addAbility(new AlternativeCostSourceAbility(new GainLifePlayersCost(6), new PermanentsOnTheBattlefieldCondition(filter))); // Destroy all enchantments. this.getSpellAbility().addEffect(new DestroyAllEffect(new FilterEnchantmentPermanent("enchantments"))); diff --git a/Mage.Sets/src/mage/sets/nemesis/SkyshroudCutter.java b/Mage.Sets/src/mage/sets/nemesis/SkyshroudCutter.java index e5e81b83a13..e37fb51cafc 100644 --- a/Mage.Sets/src/mage/sets/nemesis/SkyshroudCutter.java +++ b/Mage.Sets/src/mage/sets/nemesis/SkyshroudCutter.java @@ -29,7 +29,7 @@ package mage.sets.nemesis; import java.util.UUID; import mage.MageInt; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.common.GainLifePlayersCost; import mage.cards.CardImpl; @@ -60,7 +60,7 @@ public class SkyshroudCutter extends CardImpl { this.toughness = new MageInt(2); // If you control a Forest, rather than pay Skyshroud Cutter's mana cost, you may have each other player gain 5 life. - this.addAbility(new AlternativeCostSourceAbility(new GainLifePlayersCost(6), new ControlsPermanentCondition(filter))); + this.addAbility(new AlternativeCostSourceAbility(new GainLifePlayersCost(6), new PermanentsOnTheBattlefieldCondition(filter))); } public SkyshroudCutter(final SkyshroudCutter card) { diff --git a/Mage.Sets/src/mage/sets/nemesis/Submerge.java b/Mage.Sets/src/mage/sets/nemesis/Submerge.java index 8ef5f6a34af..550759243cc 100644 --- a/Mage.Sets/src/mage/sets/nemesis/Submerge.java +++ b/Mage.Sets/src/mage/sets/nemesis/Submerge.java @@ -30,7 +30,7 @@ package mage.sets.nemesis; import java.util.UUID; import mage.abilities.condition.CompoundCondition; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.OpponentControlsPermanentCondition; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.effects.common.PutOnLibraryTargetEffect; @@ -64,7 +64,7 @@ public class Submerge extends CardImpl { // If an opponent controls a Forest and you control an Island, you may cast Submerge without paying its mana cost. Condition condition = new CompoundCondition("If an opponent controls a Forest and you control an Island", new OpponentControlsPermanentCondition(filterForest), - new ControlsPermanentCondition(filterIsland)); + new PermanentsOnTheBattlefieldCondition(filterIsland)); this.addAbility(new AlternativeCostSourceAbility(null, condition)); // Put target creature on top of its owner's library. this.getSpellAbility().addEffect(new PutOnLibraryTargetEffect(true)); diff --git a/Mage.Sets/src/mage/sets/ninthedition/KirdApe.java b/Mage.Sets/src/mage/sets/ninthedition/KirdApe.java index 8bcf1ae38d6..0dac720ac21 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/KirdApe.java +++ b/Mage.Sets/src/mage/sets/ninthedition/KirdApe.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; @@ -67,7 +67,7 @@ public class KirdApe extends CardImpl { // Kird Ape gets +1/+2 as long as you control a Forest. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostSourceEffect(1, 2, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), rule))); + new PermanentsOnTheBattlefieldCondition(filter), rule))); } public KirdApe(final KirdApe card) { diff --git a/Mage.Sets/src/mage/sets/planechase2012/TaintedIsle.java b/Mage.Sets/src/mage/sets/planechase2012/TaintedIsle.java index 3b25242e181..d6506757e79 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/TaintedIsle.java +++ b/Mage.Sets/src/mage/sets/planechase2012/TaintedIsle.java @@ -32,7 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; import mage.Mana; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.ActivateIfConditionManaAbility; @@ -64,12 +64,12 @@ public class TaintedIsle extends CardImpl { Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlueMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); this.addAbility(new ActivateIfConditionManaAbility( Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlackMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/ArmoryGuard.java b/Mage.Sets/src/mage/sets/returntoravnica/ArmoryGuard.java index 1e642bdc4c6..80384646a09 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/ArmoryGuard.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/ArmoryGuard.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.VigilanceAbility; @@ -67,7 +67,7 @@ public class ArmoryGuard extends CardImpl { this.toughness = new MageInt(5); // Armory Guard has vigilance as long as you control a Gate. - ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), new ControlsPermanentCondition(filter), rule); + ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), new PermanentsOnTheBattlefieldCondition(filter), rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/OgreJailbreaker.java b/Mage.Sets/src/mage/sets/returntoravnica/OgreJailbreaker.java index 5366c84cb7b..936e9903681 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/OgreJailbreaker.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/OgreJailbreaker.java @@ -33,7 +33,7 @@ import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.keyword.DefenderAbility; import mage.cards.CardImpl; @@ -77,7 +77,7 @@ public class OgreJailbreaker extends CardImpl { class OgreJailbreakerEffect extends AsThoughEffectImpl { private static final FilterPermanent filter = new FilterPermanent(); - private ControlsPermanentCondition gateCondition; + private PermanentsOnTheBattlefieldCondition gateCondition; static { filter.add(new SubtypePredicate("Gate")); } @@ -85,7 +85,7 @@ class OgreJailbreakerEffect extends AsThoughEffectImpl { public OgreJailbreakerEffect() { super(AsThoughEffectType.ATTACK, Duration.WhileOnBattlefield, Outcome.Benefit); staticText = "{this} can attack as though it didn't have defender as long as you control a Gate"; - gateCondition = new ControlsPermanentCondition(filter); + gateCondition = new PermanentsOnTheBattlefieldCondition(filter); } public OgreJailbreakerEffect(final OgreJailbreakerEffect effect) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/BlackcleaveCliffs.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/BlackcleaveCliffs.java index 496b9790feb..33beef31b35 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/BlackcleaveCliffs.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/BlackcleaveCliffs.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -54,7 +54,7 @@ public class BlackcleaveCliffs extends CardImpl { super(ownerId, 224, "Blackcleave Cliffs", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "SOM"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 4)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.FEWER_THAN, 4)); String abilityText = "tapped unless you control fewer than 3 lands"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new BlackManaAbility()); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperlineGorge.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperlineGorge.java index b6fb27079ce..7a0f5ed0907 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperlineGorge.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperlineGorge.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -55,7 +55,7 @@ public class CopperlineGorge extends CardImpl { this.expansionSetCode = "SOM"; // Copperline Gorge enters the battlefield tapped unless you control two or fewer other lands. - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 4)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.FEWER_THAN, 4)); String abilityText = "tapped unless you control two or fewer other lands"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new RedManaAbility()); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarkslickShores.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarkslickShores.java index 55bc1003959..87298ec8a78 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/DarkslickShores.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/DarkslickShores.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -60,7 +60,7 @@ public class DarkslickShores extends CardImpl { this.expansionSetCode = "SOM"; // Darkslick Shores enters the battlefield tapped unless you control two or fewer other lands. - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 3)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.FEWER_THAN, 3)); String abilityText = "tapped unless you control two or fewer other lands"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/RazorvergeThicket.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/RazorvergeThicket.java index 69072cf1b65..ae33a638f33 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/RazorvergeThicket.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/RazorvergeThicket.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -54,7 +54,7 @@ public class RazorvergeThicket extends CardImpl { super(ownerId, 228, "Razorverge Thicket", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "SOM"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 4)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.FEWER_THAN, 4)); String abilityText = "tap it unless you control fewer than 3 lands"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new GreenManaAbility()); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/SeachromeCoast.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/SeachromeCoast.java index f5a963803b8..2aca41fbcf8 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/SeachromeCoast.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/SeachromeCoast.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.InvertCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.TapSourceEffect; @@ -54,7 +54,7 @@ public class SeachromeCoast extends CardImpl { super(ownerId, 229, "Seachrome Coast", Rarity.RARE, new CardType[]{CardType.LAND}, null); this.expansionSetCode = "SOM"; - Condition controls = new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 4)); + Condition controls = new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.FEWER_THAN, 4)); String abilityText = "tap it unless you control fewer than 3 lands"; this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(new TapSourceEffect(), controls, abilityText), abilityText)); this.addAbility(new WhiteManaAbility()); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorCohort.java b/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorCohort.java index 6cba5c8f22a..bcc10add1fa 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorCohort.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorCohort.java @@ -32,8 +32,8 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; @@ -71,7 +71,7 @@ public class AshenmoorCohort extends CardImpl { this.toughness = new MageInt(3); // Ashenmoor Cohort gets +1/+1 as long as you control another black creature. - Condition condition = new ControlsPermanentCondition(filter, CountType.MORE_THAN, 0); + Condition condition = new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 0); ConditionalContinousEffect effect = new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), condition, rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/BallynockCohort.java b/Mage.Sets/src/mage/sets/shadowmoor/BallynockCohort.java index 6f4bf4f80d4..a046af17fec 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/BallynockCohort.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/BallynockCohort.java @@ -32,8 +32,8 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; @@ -76,7 +76,7 @@ public class BallynockCohort extends CardImpl { this.addAbility(FirstStrikeAbility.getInstance()); // Ballynock Cohort gets +1/+1 as long as you control another white creature. - Condition condition = new ControlsPermanentCondition(filter, CountType.MORE_THAN, 0); + Condition condition = new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 0); Effect effect = new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), condition, rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/BriarberryCohort.java b/Mage.Sets/src/mage/sets/shadowmoor/BriarberryCohort.java index e9dc148a2c9..f6853fa8b76 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/BriarberryCohort.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/BriarberryCohort.java @@ -32,8 +32,8 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; -import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition.CountType; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; @@ -76,7 +76,7 @@ public class BriarberryCohort extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Briarberry Cohort gets +1/+1 as long as you control another blue creature. - Condition condition = new ControlsPermanentCondition(filter, CountType.MORE_THAN, 0); + Condition condition = new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 0); Effect effect = new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), condition, rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/CrabappleCohort.java b/Mage.Sets/src/mage/sets/shadowmoor/CrabappleCohort.java index 1d4f9ffcde4..17d0cb98359 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/CrabappleCohort.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/CrabappleCohort.java @@ -32,7 +32,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; @@ -71,7 +71,7 @@ public class CrabappleCohort extends CardImpl { this.toughness = new MageInt(4); // Crabapple Cohort gets +1/+1 as long as you control another green creature. - Condition condition = new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0); + Condition condition = new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0); Effect effect = new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), condition, rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/MistveilPlains.java b/Mage.Sets/src/mage/sets/shadowmoor/MistveilPlains.java index 6563b2ef9bd..fc1eb123a75 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/MistveilPlains.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/MistveilPlains.java @@ -36,7 +36,7 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.EntersBattlefieldTappedAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; @@ -75,7 +75,7 @@ public class MistveilPlains extends CardImpl { Zone.BATTLEFIELD, new MistveilPlainsGraveyardToLibraryEffect(), new ManaCostsImpl("{W}"), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 1)); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 1)); ability.addTarget(new TargetCardInYourGraveyard()); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerCohort.java b/Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerCohort.java index 1ccb7812214..eb46333be78 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerCohort.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerCohort.java @@ -32,7 +32,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; @@ -74,7 +74,7 @@ public class MudbrawlerCohort extends CardImpl { // Haste this.addAbility(HasteAbility.getInstance()); // Mudbrawler Cohort gets +1/+1 as long as you control another red creature. - Condition condition = new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0); + Condition condition = new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0); Effect effect = new ConditionalContinousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield), condition, rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } diff --git a/Mage.Sets/src/mage/sets/tempest/SpiritMirror.java b/Mage.Sets/src/mage/sets/tempest/SpiritMirror.java index 785cbb7e852..ae520abb0f3 100644 --- a/Mage.Sets/src/mage/sets/tempest/SpiritMirror.java +++ b/Mage.Sets/src/mage/sets/tempest/SpiritMirror.java @@ -33,7 +33,7 @@ import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.condition.InvertCondition; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; @@ -45,6 +45,7 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.NamePredicate; +import mage.filter.predicate.permanent.TokenPredicate; import mage.game.permanent.token.Token; import mage.target.TargetPermanent; @@ -58,6 +59,7 @@ public class SpiritMirror extends CardImpl { static { filter.add(new NamePredicate("Reflection")); + filter.add(new TokenPredicate()); } public SpiritMirror(UUID ownerId) { @@ -69,7 +71,7 @@ public class SpiritMirror extends CardImpl { // At the beginning of your upkeep, if there are no Reflection tokens on the battlefield, put a 2/2 white Reflection creature token onto the battlefield. this.addAbility(new ConditionalTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new ReflectionToken()), TargetController.YOU, false), - new InvertCondition(new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0)), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.EQUAL_TO, 0, false), "At the beginning of your upkeep, if there are no Reflection tokens on the battlefield, put a 2/2 white Reflection creature token onto the battlefield")); // {0}: Destroy target Reflection. diff --git a/Mage.Sets/src/mage/sets/theros/ChroniclerOfHeroes.java b/Mage.Sets/src/mage/sets/theros/ChroniclerOfHeroes.java index 91a48d742d2..ef0c8281c70 100644 --- a/Mage.Sets/src/mage/sets/theros/ChroniclerOfHeroes.java +++ b/Mage.Sets/src/mage/sets/theros/ChroniclerOfHeroes.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -102,7 +102,7 @@ class ChroniclerOfHeroesEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0).apply(game, source)) { + if (new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0).apply(game, source)) { controller.drawCards(1, game); } return true; diff --git a/Mage.Sets/src/mage/sets/theros/LagonnaBandElder.java b/Mage.Sets/src/mage/sets/theros/LagonnaBandElder.java index c04cdb57641..f0b713f6d62 100644 --- a/Mage.Sets/src/mage/sets/theros/LagonnaBandElder.java +++ b/Mage.Sets/src/mage/sets/theros/LagonnaBandElder.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; @@ -58,7 +58,7 @@ public class LagonnaBandElder extends CardImpl { // When Lagonna-Band Elder enters the battlefield, if you control an enchantment, you gain 3 life. Ability ability = new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new GainLifeEffect(3), false), - new ControlsPermanentCondition(new FilterEnchantmentPermanent(), ControlsPermanentCondition.CountType.MORE_THAN, 0), + new PermanentsOnTheBattlefieldCondition(new FilterEnchantmentPermanent(), PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0), "When Lagonna-Band Elder enters the battlefield, if you control an enchantment, you gain 3 life"); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/timespiral/NantukoShaman.java b/Mage.Sets/src/mage/sets/timespiral/NantukoShaman.java index 3ae4aa4e459..5a36955d15b 100644 --- a/Mage.Sets/src/mage/sets/timespiral/NantukoShaman.java +++ b/Mage.Sets/src/mage/sets/timespiral/NantukoShaman.java @@ -33,7 +33,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -66,7 +66,7 @@ public class NantukoShaman extends CardImpl { // When Nantuko Shaman enters the battlefield, if you control no tapped lands, draw a card. Ability ability = new ConditionalTriggeredAbility( new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.EQUAL_TO, 0), + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.EQUAL_TO, 0), "When {this} enters the battlefield, if you control no tapped lands, draw a card"); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/torment/TaintedField.java b/Mage.Sets/src/mage/sets/torment/TaintedField.java index 2a6909f1766..28b855578ff 100644 --- a/Mage.Sets/src/mage/sets/torment/TaintedField.java +++ b/Mage.Sets/src/mage/sets/torment/TaintedField.java @@ -32,7 +32,7 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.Mana; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.ActivateIfConditionManaAbility; @@ -65,12 +65,12 @@ public class TaintedField extends CardImpl { Zone.BATTLEFIELD, new BasicManaEffect(Mana.WhiteMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); this.addAbility(new ActivateIfConditionManaAbility( Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlackMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); } public TaintedField(final TaintedField card) { diff --git a/Mage.Sets/src/mage/sets/torment/TaintedPeak.java b/Mage.Sets/src/mage/sets/torment/TaintedPeak.java index 646b9f6cc62..9400904e836 100644 --- a/Mage.Sets/src/mage/sets/torment/TaintedPeak.java +++ b/Mage.Sets/src/mage/sets/torment/TaintedPeak.java @@ -32,7 +32,7 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.Mana; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.ActivateIfConditionManaAbility; @@ -65,12 +65,12 @@ public class TaintedPeak extends CardImpl { Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlackMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); this.addAbility(new ActivateIfConditionManaAbility( Zone.BATTLEFIELD, new BasicManaEffect(Mana.RedMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); } diff --git a/Mage.Sets/src/mage/sets/torment/TaintedWood.java b/Mage.Sets/src/mage/sets/torment/TaintedWood.java index a8bde9f846b..5464ac6f40f 100644 --- a/Mage.Sets/src/mage/sets/torment/TaintedWood.java +++ b/Mage.Sets/src/mage/sets/torment/TaintedWood.java @@ -32,7 +32,7 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.Mana; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.ActivateIfConditionManaAbility; @@ -65,12 +65,12 @@ public class TaintedWood extends CardImpl { Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlackMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); this.addAbility(new ActivateIfConditionManaAbility( Zone.BATTLEFIELD, new BasicManaEffect(Mana.GreenMana), new TapSourceCost(), - new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0))); + new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0))); } public TaintedWood(final TaintedWood card) { diff --git a/Mage.Sets/src/mage/sets/worldwake/DragonmasterOutcast.java b/Mage.Sets/src/mage/sets/worldwake/DragonmasterOutcast.java index 7dbac5f469c..736fe6d5cc3 100644 --- a/Mage.Sets/src/mage/sets/worldwake/DragonmasterOutcast.java +++ b/Mage.Sets/src/mage/sets/worldwake/DragonmasterOutcast.java @@ -35,7 +35,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.FlyingAbility; @@ -69,7 +69,7 @@ public class DragonmasterOutcast extends CardImpl { // At the beginning of your upkeep, if you control six or more lands, put a 5/5 red Dragon creature token with flying onto the battlefield. TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new DragonToken(), 1), TargetController.YOU, false); - this.addAbility(new ConditionalTriggeredAbility(ability, new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 5), "At the beginning of your upkeep, if you control six or more lands, put a 5/5 red Dragon creature token with flying onto the battlefield.")); + this.addAbility(new ConditionalTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 5), "At the beginning of your upkeep, if you control six or more lands, put a 5/5 red Dragon creature token with flying onto the battlefield.")); } public DragonmasterOutcast(final DragonmasterOutcast card) { diff --git a/Mage.Sets/src/mage/sets/worldwake/LoamLion.java b/Mage.Sets/src/mage/sets/worldwake/LoamLion.java index 57333f482d7..87033b94331 100644 --- a/Mage.Sets/src/mage/sets/worldwake/LoamLion.java +++ b/Mage.Sets/src/mage/sets/worldwake/LoamLion.java @@ -34,7 +34,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; @@ -66,7 +66,7 @@ public class LoamLion extends CardImpl { // Loam Lion gets +1/+2 as long as you control a Forest. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostSourceEffect(1, 2, Duration.WhileOnBattlefield), - new ControlsPermanentCondition(filter), rule))); + new PermanentsOnTheBattlefieldCondition(filter), rule))); } public LoamLion(final LoamLion card) { diff --git a/Mage.Sets/src/mage/sets/worldwake/NemesisTrap.java b/Mage.Sets/src/mage/sets/worldwake/NemesisTrap.java index ca392d71b71..3dcee36c39c 100644 --- a/Mage.Sets/src/mage/sets/worldwake/NemesisTrap.java +++ b/Mage.Sets/src/mage/sets/worldwake/NemesisTrap.java @@ -34,7 +34,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; @@ -74,7 +74,7 @@ public class NemesisTrap extends CardImpl { this.color.setBlack(true); // If a white creature is attacking, you may pay {B}{B} rather than pay Nemesis Trap's mana cost. - this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{B}{B}"), new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 0, false))); + this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{B}{B}"), new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 0, false))); // Exile target attacking creature. Put a token that's a copy of that creature onto the battlefield. Exile it at the beginning of the next end step. this.getSpellAbility().addEffect(new NemesisTrapEffect()); diff --git a/Mage.Sets/src/mage/sets/worldwake/SejiriMerfolk.java b/Mage.Sets/src/mage/sets/worldwake/SejiriMerfolk.java index 326e540dae2..01b823fc61a 100644 --- a/Mage.Sets/src/mage/sets/worldwake/SejiriMerfolk.java +++ b/Mage.Sets/src/mage/sets/worldwake/SejiriMerfolk.java @@ -32,7 +32,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.FirstStrikeAbility; @@ -67,9 +67,9 @@ public class SejiriMerfolk extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(1); - ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new GainAbilitySourceEffect(LifelinkAbility.getInstance()), new ControlsPermanentCondition(filter), rule1); + ConditionalContinousEffect effect1 = new ConditionalContinousEffect(new GainAbilitySourceEffect(LifelinkAbility.getInstance()), new PermanentsOnTheBattlefieldCondition(filter), rule1); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1)); - ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), new ControlsPermanentCondition(filter), rule2); + ConditionalContinousEffect effect2 = new ConditionalContinousEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance()), new PermanentsOnTheBattlefieldCondition(filter), rule2); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2)); } diff --git a/Mage.Sets/src/mage/sets/worldwake/ShorelineSalvager.java b/Mage.Sets/src/mage/sets/worldwake/ShorelineSalvager.java index 856bef67724..961a60b198b 100644 --- a/Mage.Sets/src/mage/sets/worldwake/ShorelineSalvager.java +++ b/Mage.Sets/src/mage/sets/worldwake/ShorelineSalvager.java @@ -33,7 +33,7 @@ import mage.constants.Rarity; import mage.constants.TargetController; import mage.MageInt; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; @@ -65,7 +65,7 @@ public class ShorelineSalvager extends CardImpl { this.toughness = new MageInt(3); // Whenever Shoreline Salvager deals combat damage to a player, if you control an Island, you may draw a card. - this.addAbility(new ConditionalTriggeredAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), true), new ControlsPermanentCondition(filter), rule, true)); + this.addAbility(new ConditionalTriggeredAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), true), new PermanentsOnTheBattlefieldCondition(filter), rule, true)); } public ShorelineSalvager(final ShorelineSalvager card) { diff --git a/Mage.Sets/src/mage/sets/worldwake/SummitApes.java b/Mage.Sets/src/mage/sets/worldwake/SummitApes.java index 1e8936a6908..546108fb96f 100644 --- a/Mage.Sets/src/mage/sets/worldwake/SummitApes.java +++ b/Mage.Sets/src/mage/sets/worldwake/SummitApes.java @@ -33,7 +33,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.combat.CantBeBlockedByOneEffect; import mage.cards.CardImpl; @@ -65,7 +65,7 @@ public class SummitApes extends CardImpl { // As long as you control a Mountain, Summit Apes can't be blocked except by two or more creatures. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new ConditionalContinousEffect(new CantBeBlockedByOneEffect(2), new ControlsPermanentCondition(filter), rule))); + new ConditionalContinousEffect(new CantBeBlockedByOneEffect(2), new PermanentsOnTheBattlefieldCondition(filter), rule))); } public SummitApes(final SummitApes card) { diff --git a/Mage.Sets/src/mage/sets/zendikar/RoilElemental.java b/Mage.Sets/src/mage/sets/zendikar/RoilElemental.java index 00336ecd7a1..626c41c2993 100644 --- a/Mage.Sets/src/mage/sets/zendikar/RoilElemental.java +++ b/Mage.Sets/src/mage/sets/zendikar/RoilElemental.java @@ -33,7 +33,7 @@ import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.LandfallAbility; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.common.continious.GainControlTargetEffect; import mage.abilities.keyword.FlyingAbility; @@ -68,7 +68,7 @@ public class RoilElemental extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Landfall - Whenever a land enters the battlefield under your control, you may gain control of target creature for as long as you control Roil Elemental. - ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainControlTargetEffect(Duration.Custom), new ControlsPermanentCondition(filter), rule); + ConditionalContinousEffect effect = new ConditionalContinousEffect(new GainControlTargetEffect(Duration.Custom), new PermanentsOnTheBattlefieldCondition(filter), rule); Ability ability = new LandfallAbility(Zone.BATTLEFIELD, effect, true); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); diff --git a/Mage/src/mage/abilities/condition/common/DefendingPlayerControlsCondition.java b/Mage/src/mage/abilities/condition/common/DefendingPlayerControlsCondition.java index 1cd344175f7..cdf1639eacf 100644 --- a/Mage/src/mage/abilities/condition/common/DefendingPlayerControlsCondition.java +++ b/Mage/src/mage/abilities/condition/common/DefendingPlayerControlsCondition.java @@ -39,7 +39,7 @@ import mage.game.Game; */ public class DefendingPlayerControlsCondition implements Condition { - private FilterPermanent filter; + private final FilterPermanent filter; public DefendingPlayerControlsCondition(FilterPermanent filter) { this.filter = filter; diff --git a/Mage/src/mage/abilities/condition/common/NoCreatureCondition.java b/Mage/src/mage/abilities/condition/common/NoCreatureCondition.java index 4490b4c1427..5feb30398f1 100644 --- a/Mage/src/mage/abilities/condition/common/NoCreatureCondition.java +++ b/Mage/src/mage/abilities/condition/common/NoCreatureCondition.java @@ -36,7 +36,8 @@ import mage.game.Game; * @author nantuko */ public class NoCreatureCondition implements Condition { - private static NoCreatureCondition fInstance = new NoCreatureCondition(); + + private static final NoCreatureCondition fInstance = new NoCreatureCondition(); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); diff --git a/Mage/src/mage/abilities/condition/common/ControlsPermanentCondition.java b/Mage/src/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java similarity index 88% rename from Mage/src/mage/abilities/condition/common/ControlsPermanentCondition.java rename to Mage/src/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java index 5ea028b9fef..1f30c2ede3e 100644 --- a/Mage/src/mage/abilities/condition/common/ControlsPermanentCondition.java +++ b/Mage/src/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java @@ -43,7 +43,7 @@ import mage.game.Game; * @author nantuko * @author maurer.it_at_gmail.com */ -public class ControlsPermanentCondition implements Condition { +public class PermanentsOnTheBattlefieldCondition implements Condition { public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO }; private FilterPermanent filter; @@ -59,7 +59,7 @@ public class ControlsPermanentCondition implements Condition { * * @param filter */ - public ControlsPermanentCondition(FilterPermanent filter) { + public PermanentsOnTheBattlefieldCondition(FilterPermanent filter) { this(filter, CountType.MORE_THAN, 0); } @@ -72,11 +72,11 @@ public class ControlsPermanentCondition implements Condition { * @param type * @param count */ - public ControlsPermanentCondition ( FilterPermanent filter, CountType type, int count ) { + public PermanentsOnTheBattlefieldCondition ( FilterPermanent filter, CountType type, int count ) { this(filter, type, count, true); } - public ControlsPermanentCondition ( FilterPermanent filter, CountType type, int count, boolean onlyControlled ) { + public PermanentsOnTheBattlefieldCondition ( FilterPermanent filter, CountType type, int count, boolean onlyControlled ) { this.filter = filter; this.type = type; this.count = count; @@ -94,7 +94,7 @@ public class ControlsPermanentCondition implements Condition { * @param count * @param conditionToDecorate */ - public ControlsPermanentCondition ( FilterPermanent filter, CountType type, int count, Condition conditionToDecorate ) { + public PermanentsOnTheBattlefieldCondition ( FilterPermanent filter, CountType type, int count, Condition conditionToDecorate ) { this(filter, type, count); this.condition = conditionToDecorate; } diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostSourceWhileControlsEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostSourceWhileControlsEffect.java index d466a0ed9a4..24ecd5dc89e 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostSourceWhileControlsEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostSourceWhileControlsEffect.java @@ -33,7 +33,7 @@ import mage.constants.Layer; import mage.constants.Outcome; import mage.constants.SubLayer; import mage.abilities.Ability; -import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.effects.WhileConditionContiniousEffect; import mage.filter.FilterPermanent; import mage.game.Game; @@ -50,7 +50,7 @@ public class BoostSourceWhileControlsEffect extends WhileConditionContiniousEffe private final String filterDescription; public BoostSourceWhileControlsEffect(FilterPermanent filter, int power, int toughness) { - super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, new ControlsPermanentCondition(filter), Outcome.BoostCreature); + super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, new PermanentsOnTheBattlefieldCondition(filter), Outcome.BoostCreature); this.power = power; this.toughness = toughness; this.filterDescription = filter.getMessage(); From 4e5a3ebaeebbbb8cebc237e5800be467d3bdaf98 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 14:56:53 +0200 Subject: [PATCH 27/34] Added Sarcomancy, minor changes to some cards. --- .../sets/avacynrestored/RainOfThorns.java | 20 +---- .../src/mage/sets/gatecrash/ClanDefiance.java | 6 -- .../src/mage/sets/mirage/AmberPrison.java | 6 +- .../src/mage/sets/planarchaos/FuryCharm.java | 8 +- .../src/mage/sets/tempest/Sarcomancy.java | 76 +++++++++++++++++++ .../mage/sets/vintagemasters/Sarcomancy.java | 54 +++++++++++++ 6 files changed, 139 insertions(+), 31 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/tempest/Sarcomancy.java create mode 100644 Mage.Sets/src/mage/sets/vintagemasters/Sarcomancy.java diff --git a/Mage.Sets/src/mage/sets/avacynrestored/RainOfThorns.java b/Mage.Sets/src/mage/sets/avacynrestored/RainOfThorns.java index c6ba5c1c061..49b9f343cc0 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/RainOfThorns.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/RainOfThorns.java @@ -55,6 +55,8 @@ public class RainOfThorns extends CardImpl { // Choose one or more - Destroy target artifact; destroy target enchantment; and/or destroy target land. this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addTarget(new TargetArtifactPermanent()); + this.getSpellAbility().getModes().setMaxModes(1); + this.getSpellAbility().getModes().setMaxModes(3); Mode mode1 = new Mode(); mode1.getEffects().add(new DestroyTargetEffect()); @@ -65,24 +67,6 @@ public class RainOfThorns extends CardImpl { mode2.getEffects().add(new DestroyTargetEffect()); mode2.getTargets().add(new TargetPermanent(new FilterLandPermanent())); this.getSpellAbility().addMode(mode2); - - Mode mode3 = new Mode(); - mode3.getEffects().add(new DestroyTargetEffect("Destroy target artifact, then destroy target enchantment")); - mode3.getTargets().add(new TargetArtifactPermanent()); - mode3.getTargets().add(new TargetPermanent(new FilterEnchantment())); - this.getSpellAbility().addMode(mode3); - - Mode mode4 = new Mode(); - mode4.getEffects().add(new DestroyTargetEffect("Destroy target artifact, then destroy target land")); - mode4.getTargets().add(new TargetArtifactPermanent()); - mode4.getTargets().add(new TargetPermanent(new FilterLandPermanent())); - this.getSpellAbility().addMode(mode4); - - Mode mode5 = new Mode(); - mode5.getEffects().add(new DestroyTargetEffect("Destroy target enchantment, then destroy target land")); - mode5.getTargets().add(new TargetPermanent(new FilterEnchantment())); - mode5.getTargets().add(new TargetPermanent(new FilterLandPermanent())); - this.getSpellAbility().addMode(mode5); } public RainOfThorns(final RainOfThorns card) { diff --git a/Mage.Sets/src/mage/sets/gatecrash/ClanDefiance.java b/Mage.Sets/src/mage/sets/gatecrash/ClanDefiance.java index d2e06d4ea2d..8e6cf9da7fd 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ClanDefiance.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ClanDefiance.java @@ -92,10 +92,4 @@ public class ClanDefiance extends CardImpl { return new ClanDefiance(this); } - @Override - public List getRules() { - List rules = new ArrayList(); - rules.add("Choose one or more - Clan Defiance deals X damage to target creature with flying; Clan Defiance deals X damage to target creature without flying; and/or Clan Defiance deals X damage to target player."); - return rules; - } } diff --git a/Mage.Sets/src/mage/sets/mirage/AmberPrison.java b/Mage.Sets/src/mage/sets/mirage/AmberPrison.java index 2654cf216a5..428ff3fbf21 100644 --- a/Mage.Sets/src/mage/sets/mirage/AmberPrison.java +++ b/Mage.Sets/src/mage/sets/mirage/AmberPrison.java @@ -79,7 +79,6 @@ public class AmberPrison extends CardImpl { ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); this.addAbility(new AmberPrisonUntapTriggeredAbility()); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AmberPrisonRestrictionEffect())); } @@ -179,10 +178,7 @@ class AmberPrisonUntapTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.UNTAPPED) && event.getTargetId().equals(this.getSourceId())) { - return true; - } - return false; + return event.getType().equals(GameEvent.EventType.UNTAPPED) && event.getTargetId().equals(this.getSourceId()); } } diff --git a/Mage.Sets/src/mage/sets/planarchaos/FuryCharm.java b/Mage.Sets/src/mage/sets/planarchaos/FuryCharm.java index 2bac20a4a3e..e4ce5832d95 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/FuryCharm.java +++ b/Mage.Sets/src/mage/sets/planarchaos/FuryCharm.java @@ -83,8 +83,12 @@ public class FuryCharm extends CardImpl { this.getSpellAbility().addTarget(new TargetArtifactPermanent()); // or target creature gets +1/+1 and gains trample until end of turn; Mode mode = new Mode(); - mode.getEffects().add(new BoostTargetEffect(1,1, Duration.EndOfTurn)); - mode.getEffects().add(new GainAbilityTargetEffect(TrampleAbility.getInstance(),Duration.EndOfTurn)); + Effect effect = new BoostTargetEffect(1,1, Duration.EndOfTurn); + effect.setText("target creature gets +1/+1"); + mode.getEffects().add(effect); + effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(),Duration.EndOfTurn); + effect.setText("and gains trample until end of turn"); + mode.getEffects().add(effect); mode.getTargets().add(new TargetCreaturePermanent()); this.getSpellAbility().getModes().addMode(mode); // or remove two time counters from target permanent or suspended card. diff --git a/Mage.Sets/src/mage/sets/tempest/Sarcomancy.java b/Mage.Sets/src/mage/sets/tempest/Sarcomancy.java new file mode 100644 index 00000000000..8cae60838d7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/Sarcomancy.java @@ -0,0 +1,76 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DamageControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.permanent.token.ZombieToken; + +/** + * + * @author LevelX2 + */ +public class Sarcomancy extends CardImpl { + + public Sarcomancy(UUID ownerId) { + super(ownerId, 48, "Sarcomancy", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{B}"); + this.expansionSetCode = "TMP"; + + this.color.setBlack(true); + + // When Sarcomancy enters the battlefield, put a 2/2 black Zombie creature token onto the battlefield. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new ZombieToken(), 1), false)); + // At the beginning of your upkeep, if there are no Zombies on the battlefield, Sarcomancy deals 1 damage to you. + this.addAbility(new ConditionalTriggeredAbility( + new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageControllerEffect(1), TargetController.YOU, false), + new PermanentsOnTheBattlefieldCondition(new FilterPermanent("Zombie", "Zombies"), PermanentsOnTheBattlefieldCondition.CountType.EQUAL_TO, 0, false), + "At the beginning of your upkeep, if there are no Zombies on the battlefield, {this} deals 1 damage to you.")); + } + + public Sarcomancy(final Sarcomancy card) { + super(card); + } + + @Override + public Sarcomancy copy() { + return new Sarcomancy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/Sarcomancy.java b/Mage.Sets/src/mage/sets/vintagemasters/Sarcomancy.java new file mode 100644 index 00000000000..66c5679c661 --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/Sarcomancy.java @@ -0,0 +1,54 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.vintagemasters; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class Sarcomancy extends mage.sets.tempest.Sarcomancy { + + public Sarcomancy(UUID ownerId) { + super(ownerId); + this.cardNumber = 139; + this.expansionSetCode = "VMA"; + this.rarity = Rarity.UNCOMMON; + } + + public Sarcomancy(final Sarcomancy card) { + super(card); + } + + @Override + public Sarcomancy copy() { + return new Sarcomancy(this); + } +} From 400e8bf0ae07641107b600c8d3fd79136bac0d22 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 14:57:38 +0200 Subject: [PATCH 28/34] Chnaged tooltip text generation of modal spells to use bullets. --- .../java/mage/server/util/SystemUtil.java | 1 + Mage/src/mage/abilities/AbilitiesImpl.java | 28 ++++++------ Mage/src/mage/abilities/AbilityImpl.java | 1 - Mage/src/mage/abilities/Modes.java | 43 +++++++------------ Mage/src/mage/abilities/effects/Effects.java | 35 +++++++++------ 5 files changed, 56 insertions(+), 52 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java index ef6b8bdf90a..e8bef838cf1 100644 --- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java @@ -37,6 +37,7 @@ public class SystemUtil { * 3b. Parse next line (go to 2.), If EOF go to 4.
* 4. Log message to all players that cards were added (to prevent unfair play).
* 5. Exit
+ * @param game */ public static void addCardsForTesting(Game game) { try { diff --git a/Mage/src/mage/abilities/AbilitiesImpl.java b/Mage/src/mage/abilities/AbilitiesImpl.java index 717689c9520..7826656f7b1 100644 --- a/Mage/src/mage/abilities/AbilitiesImpl.java +++ b/Mage/src/mage/abilities/AbilitiesImpl.java @@ -74,11 +74,16 @@ public class AbilitiesImpl extends ArrayList implements Ab continue; } if (!(ability instanceof SpellAbility || ability instanceof PlayLandAbility)) { - if (ability.getRuleAtTheTop()) { - rules.add(0, ability.getRule()); - } else { - rules.add(ability.getRule()); + String rule = ability.getRule(); + if (rule.length() > 3) { + rule = Character.toUpperCase(rule.charAt(0)) + rule.substring(1); + if (ability.getRuleAtTheTop()) { + rules.add(0, rule); + } else { + rules.add(rule); + } } + continue; } if (ability instanceof SpellAbility) { if (ability.getAlternativeCosts().size() > 0) { @@ -86,11 +91,11 @@ public class AbilitiesImpl extends ArrayList implements Ab for (AlternativeCost cost: ability.getAlternativeCosts()) { if (cost.getClass().getName().equals("mage.abilities.costs.AlternativeCostImpl")) { // if the template class is used, the rule is in the getName() instead in the getText() - sbRule.append(cost.getName()).append(".\n"); + sbRule.append(cost.getName()).append(".
"); } else { - sbRule.append(cost.getText()).append(".\n"); + sbRule.append(cost.getText()).append(".
"); } } rules.add(sbRule.toString()); @@ -102,17 +107,16 @@ public class AbilitiesImpl extends ArrayList implements Ab if (!cost.getText().startsWith("As an additional cost")) { sbRule.append("As an additional cost to cast {this}, "); } - sbRule.append(cost.getText()).append(".\n"); + sbRule.append(cost.getText()).append(".
"); } } rules.add(sbRule.toString()); } String rule = ability.getRule(); - if (rule.length() > 1) { - rule = rule.substring(0, 1).toUpperCase() + rule.substring(1); - } - rules.add(rule); - } + if (rule.length() > 0) { + rules.add(Character.toUpperCase(rule.charAt(0)) + rule.substring(1)); + } + } } return rules; diff --git a/Mage/src/mage/abilities/AbilityImpl.java b/Mage/src/mage/abilities/AbilityImpl.java index dfc8b57dff1..42a80aff69a 100644 --- a/Mage/src/mage/abilities/AbilityImpl.java +++ b/Mage/src/mage/abilities/AbilityImpl.java @@ -612,7 +612,6 @@ public abstract class AbilityImpl implements Ability { sbRule.append(text); } } - return sbRule.toString(); } diff --git a/Mage/src/mage/abilities/Modes.java b/Mage/src/mage/abilities/Modes.java index ce752177616..d91b05ae620 100644 --- a/Mage/src/mage/abilities/Modes.java +++ b/Mage/src/mage/abilities/Modes.java @@ -177,36 +177,25 @@ public class Modes extends LinkedHashMap { } public String getText() { - String andOr = ""; + if (this.size() <= 1) { + return this.getMode().getEffects().getText(this.getMode()); + } StringBuilder sb = new StringBuilder(); - if (this.size() > 1) { - if (this.getMinModes() == 1 && this.getMaxModes() == 3) { - sb.append("Choose one or more - "); - andOr = "; and/or "; - }else if (this.getMinModes() == 1 && this.getMaxModes() == 2) { - sb.append("Choose one or both - "); - andOr = "; and/or "; - } else if (this.getMinModes() == 2 && this.getMaxModes() == 2) { - sb.append("Choose two - "); - andOr = "; or "; - } else { - sb.append("Choose one - "); - andOr = "; or "; - } + if (this.getMinModes() == 1 && this.getMaxModes() == 3) { + sb.append("choose one or more - "); + }else if (this.getMinModes() == 1 && this.getMaxModes() == 2) { + sb.append("choose one or both - "); + } else if (this.getMinModes() == 2 && this.getMaxModes() == 2) { + sb.append("choose two - "); + } else { + sb.append("choose one - "); } + sb.append("
"); for (Mode mode: this.values()) { - sb.append(mode.getEffects().getText(mode)); - if (this.size() > 1) { - if (sb.length() > 2 && sb.substring(sb.length()-1, sb.length()).equals(".")) { - sb.delete(sb.length()-1, sb.length()); - } - sb.append(andOr); - } - } - if (this.size() > 1) { - sb.delete(sb.length() - andOr.length(), sb.length()); - sb.append("."); - } + sb.append("&bull "); + sb.append(mode.getEffects().getTextStartingUpperCase(mode)); + sb.append("
"); + } return sb.toString(); } diff --git a/Mage/src/mage/abilities/effects/Effects.java b/Mage/src/mage/abilities/effects/Effects.java index 2dc12bce577..6c4ef89997d 100644 --- a/Mage/src/mage/abilities/effects/Effects.java +++ b/Mage/src/mage/abilities/effects/Effects.java @@ -53,25 +53,36 @@ public class Effects extends ArrayList { return new Effects(this); } + public String getTextStartingUpperCase(Mode mode) { + String text = getText(mode); + if (text.length() > 3) { + return Character.toUpperCase(text.charAt(0)) + text.substring(1); + } + return text; + } + public String getText(Mode mode) { StringBuilder sbText = new StringBuilder(); - String rule = null; + String lastRule = null; for (Effect effect: this) { - String endString = ""; - if (rule != null && rule.length()> 3 && !rule.endsWith(".")) { - endString = ". "; - } - rule = effect.getText(mode); - if (rule != null) { - if (rule.startsWith("and ") || rule.startsWith("with ")) { + String endString = ""; + String nextRule = effect.getText(mode); + if (nextRule != null) { + if (nextRule.startsWith("and ") || nextRule.startsWith("with ")) { endString = " "; - } else if (rule.startsWith(",")) { + } else if (nextRule.startsWith(",")) { endString = ""; + } else if (lastRule != null && lastRule.length()> 3 && !lastRule.endsWith(".")) { + endString = ". "; + if (nextRule.length() > 3) { + nextRule = Character.toUpperCase(nextRule.charAt(0)) + nextRule.substring(1); + } } - sbText.append(endString).append(rule); + sbText.append(endString).append(nextRule); } + lastRule = nextRule; } - if (rule != null && rule.length()> 3 && !rule.endsWith(".") && !rule.endsWith("\"") && !rule.startsWith("Level ")) { + if (lastRule != null && lastRule.length()> 3 && !lastRule.endsWith(".") && !lastRule.endsWith("\"") && !lastRule.startsWith("Level ")) { sbText.append("."); } return sbText.toString(); @@ -91,7 +102,7 @@ public class Effects extends ArrayList { for (Effect effect: this) { outcomes.add(effect.getOutcome()); } - return new ArrayList(outcomes); + return new ArrayList<>(outcomes); } public int getOutcomeTotal() { From 7f3774deb646670905f54aabc0426d1466598e94 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 17:22:36 +0200 Subject: [PATCH 29/34] Some minor changes. --- Mage.Server/src/main/java/mage/server/game/ReplayManager.java | 2 +- Mage/src/mage/players/net/SkipPrioritySteps.java | 3 ++- Mage/src/mage/players/net/UserSkipPrioritySteps.java | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/game/ReplayManager.java b/Mage.Server/src/main/java/mage/server/game/ReplayManager.java index d277c158afd..99de309b811 100644 --- a/Mage.Server/src/main/java/mage/server/game/ReplayManager.java +++ b/Mage.Server/src/main/java/mage/server/game/ReplayManager.java @@ -45,7 +45,7 @@ public class ReplayManager { private ReplayManager() {} - private final ConcurrentHashMap replaySessions = new ConcurrentHashMap(); + private final ConcurrentHashMap replaySessions = new ConcurrentHashMap<>(); public void replayGame(UUID gameId, UUID userId) { ReplaySession replaySession = new ReplaySession(gameId, userId); diff --git a/Mage/src/mage/players/net/SkipPrioritySteps.java b/Mage/src/mage/players/net/SkipPrioritySteps.java index 12fc3278efe..a777b4a07dc 100644 --- a/Mage/src/mage/players/net/SkipPrioritySteps.java +++ b/Mage/src/mage/players/net/SkipPrioritySteps.java @@ -27,13 +27,14 @@ */ package mage.players.net; +import java.io.Serializable; import mage.constants.PhaseStep; /** * * @author LevelX2 */ -public class SkipPrioritySteps { +public class SkipPrioritySteps implements Serializable { boolean upkeep; boolean draw; boolean main1; diff --git a/Mage/src/mage/players/net/UserSkipPrioritySteps.java b/Mage/src/mage/players/net/UserSkipPrioritySteps.java index 28d608c6130..4771244ab98 100644 --- a/Mage/src/mage/players/net/UserSkipPrioritySteps.java +++ b/Mage/src/mage/players/net/UserSkipPrioritySteps.java @@ -27,12 +27,14 @@ */ package mage.players.net; +import java.io.Serializable; + /** * * @author LevelX2 */ -public class UserSkipPrioritySteps { +public class UserSkipPrioritySteps implements Serializable { SkipPrioritySteps yourTurn; SkipPrioritySteps opponentTurn; From 26e1e5daa5b9e8c62d6c9d0b73d820e7968c1f58 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 17:23:43 +0200 Subject: [PATCH 30/34] Moved button panel from third split panel above stack area (functional but not finished yet). --- .../main/java/mage/client/game/GamePanel.java | 129 ++++++++++++------ 1 file changed, 91 insertions(+), 38 deletions(-) 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 cd7df66a148..0ffd250db9c 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -213,7 +213,7 @@ public final class GamePanel extends javax.swing.JPanel { logger.fatal("popupContainer error:", ex); } jPanel2.remove(bigCard); - this.bigCard = null; + this.bigCard = null; } private void saveDividerLocations() { @@ -821,10 +821,16 @@ public final class GamePanel extends javax.swing.JPanel { txtPriority = new javax.swing.JLabel(); lblPriority = new javax.swing.JLabel(); feedbackPanel = new mage.client.game.FeedbackPanel(); + btnConcede = new javax.swing.JButton(); btnEndTurn = new javax.swing.JButton(); + btnCancelSkip = new javax.swing.JButton(); + btnSkipToYourTurn = new javax.swing.JButton(); + btnSwitchHands = new javax.swing.JButton(); + btnStopWatching = new javax.swing.JButton(); + bigCard = new mage.client.cards.BigCard(); stack = new mage.client.cards.Cards(); pnlReplay = new javax.swing.JPanel(); @@ -862,7 +868,7 @@ public final class GamePanel extends javax.swing.JPanel { restoreDividerLocations(); pnlGameInfo.setOpaque(false); - + pnlGameInfo.setPreferredSize(new Dimension(400, 60)); lblPhase.setLabelFor(txtPhase); lblPhase.setText("Phase:"); @@ -898,12 +904,52 @@ public final class GamePanel extends javax.swing.JPanel { lblPriority.setLabelFor(txtPriority); lblPriority.setText("Priority Player:"); - feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); + feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50),2)); feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121)); feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121)); bigCard.setBorder(new LineBorder(Color.black, 1, true)); + + int c = JComponent.WHEN_IN_FOCUSED_WINDOW; + + KeyStroke ks3 = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0); + this.getInputMap(c).put(ks3, "F3_PRESS"); + this.getActionMap().put("F3_PRESS", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + restorePriorityActionPerformed(actionEvent); + } + }); + + btnCancelSkip.setText("F3"); + btnCancelSkip.setToolTipText("Cancel all skip actions (F3)"); + btnCancelSkip.setFocusable(true); + btnCancelSkip.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent evt) { + restorePriorityActionPerformed(null); + } + }); + KeyStroke ks9 = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); + this.getInputMap(c).put(ks9, "F9_PRESS"); + this.getActionMap().put("F9_PRESS", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + btnPassPriorityUntilNextYourTurnActionPerformed(actionEvent); + } + }); + + btnSkipToYourTurn.setText("F9"); + btnSkipToYourTurn.setToolTipText("Skip to your next turn (F9)"); + btnSkipToYourTurn.setFocusable(true); + btnSkipToYourTurn.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent evt) { + btnPassPriorityUntilNextYourTurnActionPerformed(null); + } + }); + btnConcede.setText("Concede"); btnConcede.setToolTipText("Concede the current game"); btnConcede.setFocusable(false); @@ -914,8 +960,8 @@ public final class GamePanel extends javax.swing.JPanel { } }); - btnEndTurn.setText("End Turn (F4)"); - btnEndTurn.setToolTipText("End This Turn"); + btnEndTurn.setText("F4"); + btnEndTurn.setToolTipText("End This Turn (F4)"); btnEndTurn.setFocusable(false); btnEndTurn.addMouseListener(new MouseAdapter() { @Override @@ -924,7 +970,7 @@ public final class GamePanel extends javax.swing.JPanel { } }); - int c = JComponent.WHEN_IN_FOCUSED_WINDOW; + KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0); this.getInputMap(c).put(ks, "F4_PRESS"); @@ -953,14 +999,7 @@ public final class GamePanel extends javax.swing.JPanel { } }); - KeyStroke ks9 = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); - this.getInputMap(c).put(ks9, "F9_PRESS"); - this.getActionMap().put("F9_PRESS", new AbstractAction() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - btnPassPriorityUntilNextYourTurnActionPerformed(actionEvent); - } - }); + KeyStroke ks2 = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); this.getInputMap(c).put(ks2, "F2_PRESS"); @@ -973,15 +1012,6 @@ public final class GamePanel extends javax.swing.JPanel { } }); - KeyStroke ks3 = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0); - this.getInputMap(c).put(ks3, "F3_PRESS"); - this.getActionMap().put("F3_PRESS", new AbstractAction() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - restorePriorityActionPerformed(actionEvent); - } - }); - KeyStroke ksAltE = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK); this.getInputMap(c).put(ksAltE, "ENLARGE"); this.getActionMap().put("ENLARGE", new AbstractAction() { @@ -1141,8 +1171,12 @@ public final class GamePanel extends javax.swing.JPanel { .addGap(10, 10, 10) .addComponent(btnConcede) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCancelSkip) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnEndTurn) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnSkipToYourTurn) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnSwitchHands) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnStopWatching) @@ -1167,7 +1201,9 @@ public final class GamePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(gl_pnlGameInfo.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnConcede) + .addComponent(btnCancelSkip) .addComponent(btnEndTurn) + .addComponent(btnSkipToYourTurn) .addComponent(btnSwitchHands) .addComponent(btnStopWatching))) ); @@ -1178,7 +1214,7 @@ public final class GamePanel extends javax.swing.JPanel { jPhases.setBackground(new Color(0, 0, 0, 0)); jPhases.setLayout(null); jPhases.setPreferredSize(new Dimension(X_PHASE_WIDTH, 450)); - + MouseAdapter phasesMouseAdapter = new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { @@ -1229,16 +1265,17 @@ public final class GamePanel extends javax.swing.JPanel { gl_jPanel3.setHorizontalGroup( gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createSequentialGroup() - //.addComponent(pnlGameInfo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - //.addGap(0) +// .addGap(0) .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createSequentialGroup() .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) - .addComponent(helper, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(helper, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ) + .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) + .addComponent(pnlGameInfo, 400, 400, 400) + .addComponent(stack, 400, 400, 400) ) - .addComponent(stack, 400, 400, 400) - ) .addGap(0) //.addComponent(jPhases, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -1257,7 +1294,8 @@ public final class GamePanel extends javax.swing.JPanel { //.addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createSequentialGroup() - .addGap(75) + .addComponent(pnlGameInfo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGap(0) .addComponent(stack, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ) .addGroup(gl_jPanel3.createSequentialGroup() @@ -1284,13 +1322,15 @@ public final class GamePanel extends javax.swing.JPanel { gbl.setConstraints( bigCard, gbc ); jPanel2.add( bigCard ); - GridBagConstraints gbc2 = new GridBagConstraints(); - gbc2.fill = GridBagConstraints.NONE; - gbc2.gridx = 0; gbc2.gridy = GridBagConstraints.RELATIVE; - gbc2.gridwidth = 1; gbc2.gridheight = 1; //size 1/5 - gbc2.weightx = 0.0; gbc2.weighty = 0.0; - gbl.setConstraints( pnlGameInfo, gbc2 ); - jPanel2.add( pnlGameInfo ); +// GridBagConstraints gbc2 = new GridBagConstraints(); +// gbc2.fill = GridBagConstraints.NONE; +// gbc2.gridx = 0; gbc2.gridy = GridBagConstraints.RELATIVE; +// gbc2.gridwidth = 1; gbc2.gridheight = 1; //size 1/5 +// gbc2.weightx = 0.0; gbc2.weighty = 0.0; +// gl_jPanel3.setConstraints( pnlGameInfo, gbc2 ); + +// gbl.setConstraints( pnlGameInfo, gbc2 ); +// jPanel2.add( pnlGameInfo ); jPanel2.setOpaque(false); @@ -1315,9 +1355,15 @@ public final class GamePanel extends javax.swing.JPanel { for (MouseListener ml :this.getMouseListeners()) { this.removeMouseListener(ml); } + for (MouseListener ml :this.btnCancelSkip.getMouseListeners()) { + this.btnCancelSkip.removeMouseListener(ml); + } for (MouseListener ml :this.btnConcede.getMouseListeners()) { this.btnConcede.removeMouseListener(ml); } + for (MouseListener ml :this.btnSkipToYourTurn.getMouseListeners()) { + this.btnSkipToYourTurn.removeMouseListener(ml); + } for (MouseListener ml :this.btnEndTurn.getMouseListeners()) { this.btnEndTurn.removeMouseListener(ml); } @@ -1511,15 +1557,22 @@ public final class GamePanel extends javax.swing.JPanel { private mage.client.components.ability.AbilityPicker abilityPicker; private mage.client.cards.BigCard bigCard; + + private javax.swing.JButton btnCancelSkip; private javax.swing.JButton btnConcede; private javax.swing.JButton btnEndTurn; + private javax.swing.JButton btnSkipToYourTurn; + private javax.swing.JButton btnSwitchHands; + private javax.swing.JButton btnNextPlay; private javax.swing.JButton btnPlay; private javax.swing.JButton btnPreviousPlay; private javax.swing.JButton btnSkipForward; private javax.swing.JButton btnStopReplay; + private javax.swing.JButton btnStopWatching; + private mage.client.chat.ChatPanel gameChatPanel; private mage.client.game.FeedbackPanel feedbackPanel; private mage.client.chat.ChatPanel userChatPanel; From 1c8639a0b512457312de7c43247bc3af9b8a036c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 17 Oct 2014 19:07:58 +0200 Subject: [PATCH 31/34] * Fixed text of modal test after the change of modal text generation. --- .../cards/abilities/keywords/DeathtouchTest.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DeathtouchTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DeathtouchTest.java index d6603a162f9..ed7cbf314fb 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DeathtouchTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DeathtouchTest.java @@ -29,8 +29,6 @@ package org.mage.test.cards.abilities.keywords; import mage.constants.PhaseStep; import mage.constants.Zone; -import mage.game.permanent.Permanent; -import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -89,21 +87,22 @@ public class DeathtouchTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN , playerA, "Marath, Will of the Wild"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}", "Marath, Will of the Wild"); - activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{X},Remove X +1/+1 counters from Marath: Choose one - Put X +1/+1 counters on target creature; or {source} deals X damage to target creature or player; or put an X/X green Elemental creature token onto the battlefield.", "Archangel of Thune"); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{X},Remove X +1/+1 counters from Marath: Choose one -
&bull Put X +1/+1 counters on target creature.
&bull {source} deals X damage to target creature or player.
&bull Put an X/X green Elemental creature token onto the battlefield.
", "Archangel of Thune"); setChoice(playerA, "X=3"); setModeChoice(playerA, "2"); // Marath deals X damage to target creature or player - setStopAt(1, PhaseStep.END_TURN); execute(); - assertLife(playerA, 23); + assertPermanentCount(playerA, "Marath, Will of the Wild", 0); // died because all +1/+1 counters are removed + assertPermanentCount(playerB, "Archangel of Thune", 0); // died from deathtouch + + assertLife(playerA, 23); // +3 from lifelink doing 3 damage with Marath to Archangel assertLife(playerB, 20); - assertPermanentCount(playerA, "Marath, Will of the Wild", 0); - assertPermanentCount(playerB, "Archangel of Thune", 0); } From 2bd14269d6af38047bc27f598d6a8b6d42db997c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 18 Oct 2014 12:15:40 +0200 Subject: [PATCH 32/34] * Finished button handling above stack. --- .../main/java/mage/client/game/GamePanel.java | 304 +++++++++++------- .../java/org/mage/card/arcane/CardPanel.java | 1 + .../mage/plugins/card/utils/ImageManager.java | 10 + .../card/utils/impl/ImageManagerImpl.java | 77 ++++- .../main/resources/buttons/cancel_skip.png | Bin 0 -> 2536 bytes .../src/main/resources/buttons/concede.png | Bin 0 -> 1968 bytes .../src/main/resources/buttons/skip_all.png | Bin 0 -> 2351 bytes .../main/resources/buttons/skip_to_end.png | Bin 0 -> 2399 bytes .../main/resources/buttons/skip_to_main.png | Bin 0 -> 2478 bytes .../src/main/resources/buttons/skip_turn.png | Bin 0 -> 2321 bytes .../main/resources/buttons/stop_watching.png | Bin 0 -> 2505 bytes .../main/resources/buttons/switch_hands.png | Bin 0 -> 2363 bytes 12 files changed, 275 insertions(+), 117 deletions(-) create mode 100644 Mage.Client/src/main/resources/buttons/cancel_skip.png create mode 100644 Mage.Client/src/main/resources/buttons/concede.png create mode 100644 Mage.Client/src/main/resources/buttons/skip_all.png create mode 100644 Mage.Client/src/main/resources/buttons/skip_to_end.png create mode 100644 Mage.Client/src/main/resources/buttons/skip_to_main.png create mode 100644 Mage.Client/src/main/resources/buttons/skip_turn.png create mode 100644 Mage.Client/src/main/resources/buttons/stop_watching.png create mode 100644 Mage.Client/src/main/resources/buttons/switch_hands.png 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 0ffd250db9c..509962e833c 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -65,6 +65,7 @@ import java.util.*; import java.util.List; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; +import javax.swing.border.EmptyBorder; import mage.constants.PlayerAction; /** @@ -219,8 +220,8 @@ public final class GamePanel extends javax.swing.JPanel { private void saveDividerLocations() { // save panel sizes and divider locations. Rectangle rec = MageFrame.getDesktop().getBounds(); - StringBuilder sb = new StringBuilder(Double.toString(rec.getWidth())).append("x").append(Double.toString(rec.getHeight())); - PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb.toString()); + String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight()); + PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb); PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_0, Integer.toString(this.jSplitPane0.getDividerLocation())); PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation())); PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPane2.getDividerLocation())); @@ -230,9 +231,9 @@ public final class GamePanel extends javax.swing.JPanel { Rectangle rec = MageFrame.getDesktop().getBounds(); if (rec != null) { String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null); - StringBuilder sb = new StringBuilder(Double.toString(rec.getWidth())).append("x").append(Double.toString(rec.getHeight())); + String sb = Double.toString(rec.getWidth()) + "x" + Double.toString(rec.getHeight()); // use divider positions only if screen size is the same as it was the time the settings were saved - if (size != null && size.equals(sb.toString())) { + if (size != null && size.equals(sb)) { String location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_0, null); if (location != null && jSplitPane0 != null) { @@ -260,8 +261,8 @@ public final class GamePanel extends javax.swing.JPanel { bigCard.setMaximumSize(bbDimension); bigCard.setMinimumSize(bbDimension); bigCard.setPreferredSize(bbDimension); - pnlGameInfo.revalidate(); - pnlGameInfo.repaint(); + pnlShortCuts.revalidate(); + pnlShortCuts.repaint(); //this.handContainer.sizeHand(0.8, smallMode); for (PlayAreaPanel p: players.values()) { p.sizePlayer(smallMode); @@ -275,8 +276,8 @@ public final class GamePanel extends javax.swing.JPanel { bigCard.setMaximumSize(bbDimension); bigCard.setMinimumSize(bbDimension); bigCard.setPreferredSize(bbDimension); - pnlGameInfo.revalidate(); - pnlGameInfo.repaint(); + pnlShortCuts.revalidate(); + pnlShortCuts.repaint(); this.handContainer.sizeHand(1, smallMode); for (PlayAreaPanel p: players.values()) { p.sizePlayer(smallMode); @@ -300,11 +301,19 @@ public final class GamePanel extends javax.swing.JPanel { this.feedbackPanel.init(gameId); this.feedbackPanel.clear(); this.abilityPicker.init(session, gameId); + this.btnConcede.setVisible(true); - this.btnEndTurn.setVisible(true); - this.btnSwitchHands.setVisible(false); - this.pnlReplay.setVisible(false); this.btnStopWatching.setVisible(false); + this.btnSwitchHands.setVisible(false); + this.btnCancelSkip.setVisible(true); + + this.btnSkipToNextTurn.setVisible(true); + this.btnSkipToEndTurn.setVisible(true); + this.btnSkipToNextMain.setVisible(true); + this.btnSkipToYourTurn.setVisible(true); + + this.pnlReplay.setVisible(false); + this.gameChatPanel.clear(); this.gameChatPanel.connect(session.getGameChatId(gameId)); if (!session.joinGame(gameId)) { @@ -320,10 +329,18 @@ public final class GamePanel extends javax.swing.JPanel { MageFrame.addGame(gameId, this); this.feedbackPanel.init(gameId); this.feedbackPanel.clear(); + this.btnConcede.setVisible(false); - this.btnEndTurn.setVisible(false); - this.btnSwitchHands.setVisible(false); this.btnStopWatching.setVisible(true); + this.btnSwitchHands.setVisible(false); + this.btnCancelSkip.setVisible(false); + + this.btnSkipToNextTurn.setVisible(false); + this.btnSkipToEndTurn.setVisible(false); + this.btnSkipToNextMain.setVisible(false); + this.btnSkipToYourTurn.setVisible(false); + + this.pnlReplay.setVisible(false); this.gameChatPanel.clear(); this.gameChatPanel.connect(session.getGameChatId(gameId)); @@ -343,7 +360,7 @@ public final class GamePanel extends javax.swing.JPanel { this.feedbackPanel.init(gameId); this.feedbackPanel.clear(); this.btnConcede.setVisible(false); - this.btnEndTurn.setVisible(false); + this.btnSkipToNextTurn.setVisible(false); this.btnSwitchHands.setVisible(false); this.btnStopWatching.setVisible(false); this.pnlReplay.setVisible(true); @@ -489,7 +506,7 @@ public final class GamePanel extends javax.swing.JPanel { if (previous != visible) { btnSwitchHands.setVisible(visible); if (visible) { - JOptionPane.showMessageDialog(null, "You control other player's turn. \nUse \"Switch Hand\" on the bottom to switch between cards in different hands."); + JOptionPane.showMessageDialog(null, "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."); } @@ -809,7 +826,7 @@ public final class GamePanel extends javax.swing.JPanel { jSplitPane0 = new javax.swing.JSplitPane(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); - pnlGameInfo = new javax.swing.JPanel(); + pnlShortCuts = new javax.swing.JPanel(); lblPhase = new javax.swing.JLabel(); txtPhase = new javax.swing.JLabel(); lblStep = new javax.swing.JLabel(); @@ -822,11 +839,13 @@ public final class GamePanel extends javax.swing.JPanel { lblPriority = new javax.swing.JLabel(); feedbackPanel = new mage.client.game.FeedbackPanel(); - btnConcede = new javax.swing.JButton(); - btnEndTurn = new javax.swing.JButton(); - btnCancelSkip = new javax.swing.JButton(); - btnSkipToYourTurn = new javax.swing.JButton(); + btnCancelSkip = new javax.swing.JButton(); // F3 + btnSkipToNextTurn = new javax.swing.JButton(); // F4 + btnSkipToEndTurn = new javax.swing.JButton(); // F5 + btnSkipToNextMain = new javax.swing.JButton(); // F7 + btnSkipToYourTurn = new javax.swing.JButton(); // F9 + btnConcede = new javax.swing.JButton(); btnSwitchHands = new javax.swing.JButton(); btnStopWatching = new javax.swing.JButton(); @@ -867,8 +886,8 @@ public final class GamePanel extends javax.swing.JPanel { restoreDividerLocations(); - pnlGameInfo.setOpaque(false); - pnlGameInfo.setPreferredSize(new Dimension(400, 60)); + pnlShortCuts.setOpaque(false); + pnlShortCuts.setPreferredSize(new Dimension(400, 60)); lblPhase.setLabelFor(txtPhase); lblPhase.setText("Phase:"); @@ -921,56 +940,33 @@ public final class GamePanel extends javax.swing.JPanel { } }); - btnCancelSkip.setText("F3"); - btnCancelSkip.setToolTipText("Cancel all skip actions (F3)"); - btnCancelSkip.setFocusable(true); + btnCancelSkip.setContentAreaFilled(false); + btnCancelSkip.setBorder(new EmptyBorder(0,0,0,0)); + btnCancelSkip.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getCancelSkipButtonImage())); + btnCancelSkip.setToolTipText("Cancel all skip actions (F3)."); + btnCancelSkip.setFocusable(false); btnCancelSkip.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { - restorePriorityActionPerformed(null); + if (evt.getButton() == MouseEvent.BUTTON1) { + restorePriorityActionPerformed(null); + } } }); - KeyStroke ks9 = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); - this.getInputMap(c).put(ks9, "F9_PRESS"); - this.getActionMap().put("F9_PRESS", new AbstractAction() { - @Override - public void actionPerformed(ActionEvent actionEvent) { - btnPassPriorityUntilNextYourTurnActionPerformed(actionEvent); - } - }); - - btnSkipToYourTurn.setText("F9"); - btnSkipToYourTurn.setToolTipText("Skip to your next turn (F9)"); - btnSkipToYourTurn.setFocusable(true); - btnSkipToYourTurn.addMouseListener(new MouseAdapter() { + btnSkipToNextTurn.setContentAreaFilled(false); + btnSkipToNextTurn.setBorder(new EmptyBorder(0,0,0,0)); + btnSkipToNextTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipNextTurnButtonImage())); + btnSkipToNextTurn.setToolTipText("Skip to next turn (F4)."); + btnSkipToNextTurn.setFocusable(false); + btnSkipToNextTurn.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { - btnPassPriorityUntilNextYourTurnActionPerformed(null); + if (evt.getButton() == MouseEvent.BUTTON1) { + btnEndTurnActionPerformed(null); + } } }); - - btnConcede.setText("Concede"); - btnConcede.setToolTipText("Concede the current game"); - btnConcede.setFocusable(false); - btnConcede.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent evt) { - btnConcedeActionPerformed(null); - } - }); - - btnEndTurn.setText("F4"); - btnEndTurn.setToolTipText("End This Turn (F4)"); - btnEndTurn.setFocusable(false); - btnEndTurn.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent evt) { - btnEndTurnActionPerformed(null); - } - }); - - KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0); this.getInputMap(c).put(ks, "F4_PRESS"); @@ -981,6 +977,20 @@ public final class GamePanel extends javax.swing.JPanel { } }); + btnSkipToEndTurn.setContentAreaFilled(false); + btnSkipToEndTurn.setBorder(new EmptyBorder(0,0,0,0)); + btnSkipToEndTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipEndTurnButtonImage())); + btnSkipToEndTurn.setToolTipText("Skip to (opponents/next) end of turn step (F5) - adjust using preferences."); + btnSkipToEndTurn.setFocusable(false); + btnSkipToEndTurn.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent evt) { + if (evt.getButton() == MouseEvent.BUTTON1) { + btnUntilEndOfTurnActionPerformed(null); + } + } + }); + ks = KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0); this.getInputMap(c).put(ks, "F5_PRESS"); this.getActionMap().put("F5_PRESS", new AbstractAction() { @@ -990,6 +1000,20 @@ public final class GamePanel extends javax.swing.JPanel { } }); + btnSkipToNextMain.setContentAreaFilled(false); + btnSkipToNextMain.setBorder(new EmptyBorder(0,0,0,0)); + btnSkipToNextMain.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipMainButtonImage())); + btnSkipToNextMain.setToolTipText("Skip to (your) next main phase (F7) - adjust using preferences."); + btnSkipToNextMain.setFocusable(false); + btnSkipToNextMain.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent evt) { + if (evt.getButton() == MouseEvent.BUTTON1) { + btnUntilNextMainPhaseActionPerformed(null); + } + } + }); + ks = KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0); this.getInputMap(c).put(ks, "F7_PRESS"); this.getActionMap().put("F7_PRESS", new AbstractAction() { @@ -999,6 +1023,42 @@ public final class GamePanel extends javax.swing.JPanel { } }); + btnSkipToYourTurn.setContentAreaFilled(false); + btnSkipToYourTurn.setBorder(new EmptyBorder(0,0,0,0)); + btnSkipToYourTurn.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSkipYourNextTurnButtonImage())); + btnSkipToYourTurn.setToolTipText("Skip to your next turn (F9)."); + btnSkipToYourTurn.setFocusable(false); + btnSkipToYourTurn.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent evt) { + if (evt.getButton() == MouseEvent.BUTTON1) { + btnPassPriorityUntilNextYourTurnActionPerformed(null); + } + } + }); + + KeyStroke ks9 = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); + this.getInputMap(c).put(ks9, "F9_PRESS"); + this.getActionMap().put("F9_PRESS", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + btnPassPriorityUntilNextYourTurnActionPerformed(actionEvent); + } + }); + + btnConcede.setContentAreaFilled(false); + btnConcede.setBorder(new EmptyBorder(0,0,0,0)); + btnConcede.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getConcedeButtonImage())); + btnConcede.setToolTipText("Concede the current game."); + btnConcede.setFocusable(false); + btnConcede.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent evt) { + if (evt.getButton() == MouseEvent.BUTTON1) { + btnConcedeActionPerformed(null); + } + } + }); KeyStroke ks2 = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); @@ -1077,20 +1137,31 @@ public final class GamePanel extends javax.swing.JPanel { } }); - - btnSwitchHands.setText("Switch Hands"); + btnSwitchHands.setContentAreaFilled(false); + btnSwitchHands.setBorder(new EmptyBorder(0,0,0,0)); + btnSwitchHands.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getSwitchHandsButtonImage())); + btnSwitchHands.setFocusable(false); + btnSwitchHands.setToolTipText("Switch between your hand cards and hand cards of controlled players."); btnSwitchHands.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { - btnSwitchHandActionPerformed(null); + if (evt.getButton() == MouseEvent.BUTTON1) { + btnSwitchHandActionPerformed(null); + } } }); - btnStopWatching.setText("Stop Watching"); - btnStopWatching.addActionListener(new java.awt.event.ActionListener() { + btnStopWatching.setContentAreaFilled(false); + btnStopWatching.setBorder(new EmptyBorder(0,0,0,0)); + btnStopWatching.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getStopWatchButtonImage())); + btnStopWatching.setFocusable(false); + btnSwitchHands.setToolTipText("Stop watching this game."); + btnStopWatching.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnStopWatchingActionPerformed(evt); + public void mouseClicked(MouseEvent evt) { + if (evt.getButton() == MouseEvent.BUTTON1) { + btnStopWatchingActionPerformed(null); + } } }); @@ -1163,35 +1234,32 @@ public final class GamePanel extends javax.swing.JPanel { ); // Game info panel (buttons on the right panel) - javax.swing.GroupLayout gl_pnlGameInfo = new javax.swing.GroupLayout(pnlGameInfo); - pnlGameInfo.setLayout(gl_pnlGameInfo); - gl_pnlGameInfo.setHorizontalGroup( - gl_pnlGameInfo.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(gl_pnlGameInfo.createSequentialGroup() - .addGap(10, 10, 10) - .addComponent(btnConcede) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnCancelSkip) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnEndTurn) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + javax.swing.GroupLayout gl_pnlShortCuts = new javax.swing.GroupLayout(pnlShortCuts); + pnlShortCuts.setLayout(gl_pnlShortCuts); + gl_pnlShortCuts.setHorizontalGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(gl_pnlShortCuts.createSequentialGroup() + .addComponent(btnSkipToNextTurn) + .addComponent(btnSkipToEndTurn) + .addComponent(btnSkipToNextMain) .addComponent(btnSkipToYourTurn) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + ) + .addGroup(gl_pnlShortCuts.createSequentialGroup() .addComponent(btnSwitchHands) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCancelSkip) + .addComponent(btnConcede) .addComponent(btnStopWatching) - .addContainerGap(62, Short.MAX_VALUE)) + ) //.addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) //.addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) //.addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) - .addGroup(gl_pnlGameInfo.createSequentialGroup() + + .addGroup(gl_pnlShortCuts.createSequentialGroup() .addContainerGap() .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(51, Short.MAX_VALUE)) ); - gl_pnlGameInfo.setVerticalGroup( - gl_pnlGameInfo.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(gl_pnlGameInfo.createSequentialGroup() + gl_pnlShortCuts.setVerticalGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(gl_pnlShortCuts.createSequentialGroup() //.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) //.addGap(1, 1, 1) //.addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1199,13 +1267,20 @@ public final class GamePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE) .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(gl_pnlGameInfo.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnConcede) - .addComponent(btnCancelSkip) - .addComponent(btnEndTurn) + + .addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(btnSkipToNextTurn) + .addComponent(btnSkipToEndTurn) + .addComponent(btnSkipToNextMain) .addComponent(btnSkipToYourTurn) + ) + .addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnSwitchHands) - .addComponent(btnStopWatching))) + .addComponent(btnCancelSkip) + .addComponent(btnConcede) + .addComponent(btnStopWatching) + ) + ) ); pnlBattlefield.setLayout(new java.awt.GridBagLayout()); @@ -1273,7 +1348,7 @@ public final class GamePanel extends javax.swing.JPanel { .addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ) .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) - .addComponent(pnlGameInfo, 400, 400, 400) + .addComponent(pnlShortCuts, 400, 400, 400) .addComponent(stack, 400, 400, 400) ) ) @@ -1294,7 +1369,7 @@ public final class GamePanel extends javax.swing.JPanel { //.addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_jPanel3.createParallelGroup(Alignment.LEADING) .addGroup(gl_jPanel3.createSequentialGroup() - .addComponent(pnlGameInfo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0) .addComponent(stack, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ) @@ -1322,16 +1397,6 @@ public final class GamePanel extends javax.swing.JPanel { gbl.setConstraints( bigCard, gbc ); jPanel2.add( bigCard ); -// GridBagConstraints gbc2 = new GridBagConstraints(); -// gbc2.fill = GridBagConstraints.NONE; -// gbc2.gridx = 0; gbc2.gridy = GridBagConstraints.RELATIVE; -// gbc2.gridwidth = 1; gbc2.gridheight = 1; //size 1/5 -// gbc2.weightx = 0.0; gbc2.weighty = 0.0; -// gl_jPanel3.setConstraints( pnlGameInfo, gbc2 ); - -// gbl.setConstraints( pnlGameInfo, gbc2 ); -// jPanel2.add( pnlGameInfo ); - jPanel2.setOpaque(false); // game pane and chat/log pane @@ -1364,12 +1429,21 @@ public final class GamePanel extends javax.swing.JPanel { for (MouseListener ml :this.btnSkipToYourTurn.getMouseListeners()) { this.btnSkipToYourTurn.removeMouseListener(ml); } - for (MouseListener ml :this.btnEndTurn.getMouseListeners()) { - this.btnEndTurn.removeMouseListener(ml); + for (MouseListener ml :this.btnSkipToEndTurn.getMouseListeners()) { + this.btnSkipToEndTurn.removeMouseListener(ml); + } + for (MouseListener ml :this.btnSkipToNextMain.getMouseListeners()) { + this.btnSkipToNextMain.removeMouseListener(ml); + } + for (MouseListener ml :this.btnSkipToNextTurn.getMouseListeners()) { + this.btnSkipToNextTurn.removeMouseListener(ml); } for (MouseListener ml :this.btnSwitchHands.getMouseListeners()) { this.btnSwitchHands.removeMouseListener(ml); } + for (MouseListener ml :this.btnStopWatching.getMouseListeners()) { + this.btnStopWatching.removeMouseListener(ml); + } for (MouseListener ml :this.jPhases.getMouseListeners()) { this.jPhases.removeMouseListener(ml); } @@ -1382,9 +1456,6 @@ public final class GamePanel extends javax.swing.JPanel { for (ActionListener al :this.btnPlay.getActionListeners()) { this.btnPlay.removeActionListener(al); } - for (ActionListener al :this.btnStopWatching.getActionListeners()) { - this.btnStopWatching.removeActionListener(al); - } for (ActionListener al :this.btnStopReplay.getActionListeners()) { this.btnStopReplay.removeActionListener(al); } @@ -1557,12 +1628,15 @@ public final class GamePanel extends javax.swing.JPanel { private mage.client.components.ability.AbilityPicker abilityPicker; private mage.client.cards.BigCard bigCard; - + +// private JPanel cancelSkipPanel; private javax.swing.JButton btnCancelSkip; + private javax.swing.JButton btnSkipToNextTurn; // F4 + private javax.swing.JButton btnSkipToEndTurn; // F5 + private javax.swing.JButton btnSkipToNextMain; // F7 + private javax.swing.JButton btnSkipToYourTurn; // F9 + private javax.swing.JButton btnConcede; - private javax.swing.JButton btnEndTurn; - private javax.swing.JButton btnSkipToYourTurn; - private javax.swing.JButton btnSwitchHands; private javax.swing.JButton btnNextPlay; @@ -1586,7 +1660,7 @@ public final class GamePanel extends javax.swing.JPanel { private javax.swing.JLabel lblStep; private javax.swing.JLabel lblTurn; private javax.swing.JPanel pnlBattlefield; - private javax.swing.JPanel pnlGameInfo; + private javax.swing.JPanel pnlShortCuts; private javax.swing.JPanel pnlReplay; private javax.swing.JLabel txtActivePlayer; private javax.swing.JLabel txtPhase; diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java index ee525a4dbb8..9f8bd91896e 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanel.java @@ -342,6 +342,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti typeButton.setLocation(2, 2); typeButton.setSize(25, 25); + iconPanel.setVisible(true); typeButton.setIcon(new ImageIcon(bufferedImage)); if (toolTipText != null) { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java index 3d79777b22b..a7254e7771b 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/ImageManager.java @@ -30,5 +30,15 @@ public interface ImageManager { Image getDlgNextButtonImage(); Image getDlgActiveNextButtonImage(); + Image getSwitchHandsButtonImage(); + Image getStopWatchButtonImage(); + Image getConcedeButtonImage(); + Image getCancelSkipButtonImage(); + Image getSkipNextTurnButtonImage(); + Image getSkipEndTurnButtonImage(); + Image getSkipMainButtonImage(); + Image getSkipYourNextTurnButtonImage(); + + Image getPhaseImage(String phase); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java index bca793d9187..3d30f575da9 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/impl/ImageManagerImpl.java @@ -237,9 +237,73 @@ public class ImageManagerImpl implements ImageManager { return imageDlgActiveNextButton; } + @Override + public Image getConcedeButtonImage() { + if (imageConcedeButton == null) { + imageConcedeButton = getBufferedImageFromResource("/buttons/concede.png"); + } + return imageConcedeButton; + } + + @Override + public Image getSwitchHandsButtonImage() { + if (imageSwitchHandsButton == null) { + imageSwitchHandsButton = getBufferedImageFromResource("/buttons/switch_hands.png"); + } + return imageSwitchHandsButton; + } + + @Override + public Image getStopWatchButtonImage() { + if (imageStopWatchingButton == null) { + imageStopWatchingButton = getBufferedImageFromResource("/buttons/stop_watching.png"); + } + return imageStopWatchingButton; + } + + @Override + public Image getCancelSkipButtonImage() { + if (imageCancelSkipButton == null) { + imageCancelSkipButton = getBufferedImageFromResource("/buttons/cancel_skip.png"); + } + return imageCancelSkipButton; + } + + @Override + public Image getSkipNextTurnButtonImage() { + if (imageSkipNextTurnButton == null) { + imageSkipNextTurnButton = getBufferedImageFromResource("/buttons/skip_turn.png"); + } + return imageSkipNextTurnButton; + } + + @Override + public Image getSkipEndTurnButtonImage() { + if (imageSkipToEndTurnButton == null) { + imageSkipToEndTurnButton = getBufferedImageFromResource("/buttons/skip_to_end.png"); + } + return imageSkipToEndTurnButton; + } + + @Override + public Image getSkipMainButtonImage() { + if (imageSkipToMainButton == null) { + imageSkipToMainButton = getBufferedImageFromResource("/buttons/skip_to_main.png"); + } + return imageSkipToMainButton; + } + + @Override + public Image getSkipYourNextTurnButtonImage() { + if (imageSkipYourNextTurnButton == null) { + imageSkipYourNextTurnButton = getBufferedImageFromResource("/buttons/skip_all.png"); + } + return imageSkipYourNextTurnButton; + } + protected static Image getImageFromResourceTransparent(String path, Color mask, Rectangle rec) { - BufferedImage image = null; - Image imageCardTransparent = null; + BufferedImage image; + Image imageCardTransparent; Image resized = null; URL imageURL = ImageManager.class.getResource(path); @@ -317,5 +381,14 @@ public class ImageManagerImpl implements ImageManager { private static BufferedImage imageDlgNextButton; private static BufferedImage imageDlgActiveNextButton; + private static BufferedImage imageCancelSkipButton; + private static BufferedImage imageSwitchHandsButton; + private static BufferedImage imageStopWatchingButton; + private static BufferedImage imageConcedeButton; + private static BufferedImage imageSkipNextTurnButton; + private static BufferedImage imageSkipToEndTurnButton; + private static BufferedImage imageSkipToMainButton; + private static BufferedImage imageSkipYourNextTurnButton; + private static Map phasesImages; } diff --git a/Mage.Client/src/main/resources/buttons/cancel_skip.png b/Mage.Client/src/main/resources/buttons/cancel_skip.png new file mode 100644 index 0000000000000000000000000000000000000000..c418d5d63e73ddf641fdb775b70b5a50ffa2c92e GIT binary patch literal 2536 zcmVP)bLBqE?;5eJYY3I-)&Fe-|; zL`6|RC88{%M-UZ33?PdrB8ovkAw*@n~NpMIe#^cOr4mx-0-s&p5 zZH!Gu&oG(kbNQyzv{Qonk&oGIUSc!(1l%)JU_m2`YOhuJ3U*g7y z!{1>n*BoF~$yi3585%+_tS9t_9?>f|As zM(@OcEXbt5`hW@QjCtrv#yaW|o(i!6ieGhK3e zds8~7Yia}Ahoqva2BFa@1LnRcZ7XV^V;h*74;XikDkBDDK_+5D#;1Hlj7ZazT|C+~ z+_r-8+(J@#ZZo7-b;u}oe?2IPM09ZPz{TLZAcE@3DyooJ)I>SkN-n{wPIeKZ;T z*@2T26tSIRSl7_j17o%?mQ{yqz&m;MkXX_NwhpdBAJl|b1BJ1NOPy_4Ub5u?^~1WJ zvALW_6nf`5kO|q4kyxL&6qH$+DT$Y~*ao}{UK?u!EzfO(treXzdS&ivI@*cO-?vYv8BI(kryhnTr43Cu@1PMV+-#myp)JzkN zG5=)=G&Yt^EbU-jZi6rZ1NlJj(k#e^jL0fs7C!2Xj;oj2$gsQ9;_D!A$3;PJ?rete zf~&CcSSQ4mc9Hy7BuNfzA+(Ku?Jbxzb1AIOJ_}2?m%>Xdh>oEtXy}wW0d7HM!tEdjpk6jCQ5IJPejc zd(7n4kkHclJzmU_E*cNN zpNvK2w~_`srnHa|S&^Av2XLDxRuj)EnjKdON!8!{u7!-qip=~LnI=HR%s+E({0Z1y z`~6duT!lNVHv0axy#J)o-`29ur^b;HS*0g{E&)d0b7SE8;{MFWK6p~;bv@ubIY8zf zjrH{U9*ErgK6kA^{>i z$AXN=Dt!rXi=g&|d6VXB@7v$QHVhd_v*_IsGdGb@4_Ph(du;2QvMbnKpEBqfnL@?~?cfs_Lb34Vd?C+zjH57to-^jr7>WwV!G79$ zhOjazkF>MAMTj5%_%=kP9R*!O6IP~>eyT%;1KE%fS*34-jAT<_qis2LSJb;_9v$!a zJ4ox;wY%UuZ#jrqIAK%5LhP=%04XKhZp_fkf+k2)M;CJ0C&TI+4`51AD8<&M9uV>{ zo{(1oMr=OT_f)n}F0Y-XjS#u3fOPoMEtwdO^W^D2KXS87j`xf?psF^U9*~lcHOX)w z8!{rR^hQY73Nz}qQ$6RzcOLnq532t3Ku|{YWr$}@rC^~^#51d`#Lf<3s4_-|5xU54$o`H!O6gIYltv$E9ODn6PTwW!Y zzJM$?7gclfCz%+IgMG{_t!3JqdVgWp00+?0(Sv=bF2MYVjg^NbsX*gxS(iPMeDm~k?{vh`?tsQkPea!zx*v6sDk;Np+{ zARcKafj$7!7jP4>Ik!m2Q`gi2kurBFIeBlZ*t+uk3i{bJ3ap_5Qgcyoj zZjgUuK_+A)#sMCOAHNV`7;{F|*u&L7tTe5%?P0^WkARuWe#~rK@oH9*~-U zybsk~-B9~=FV!1v{UFr&^7-5MAg@L;QQki6#NB{HO|8)SbH6Z-BEoTSywhLx3>g3L z+dGg|-2~aETcQ3N_HtmoBLlJ^6S4iu3z5gK#PA-eV&LxNvmkr(f!e!OU;Zpi!o{Be zKKTd0rw<0Ff(C8^TqgSry00QaPw0*JiJs9rG9ZiOzOSz6dqI4GID%19AFF3EVcG16 z9gXQHTOS<1`WLA0c}NHNuos~5w&JS0bstLFx}oB;-a++KMCb)Qp*Qr1UePmpM+Rb1 z@TI8iYjK7#U}eQ9>$>WhJ1z7Ji7r}}nA@6AaH@Mp=|?~8u4uk96og*T6M93B=oLMa zcaA~jxBoH1&72|aorj4=G0NJm>?!5Ls2cgQnl?n_OPP=76dU;5(omdpi+Slhtza5 z-$EKI#bYQ$1d$R#1>cTJKEW^u6e?5HN{dvYP%Cw`tgOr)l$q1ZQu}wmZyzo!m6qe| z&Uk13bI;W>Vg@Jl}-0=;#`oAWd1nSioEMNh>6&Uky$$}1#3y3GIjES zfTU%J$=zwt^wq5>sy}9tBJaj5#72z7s$(`>_QEML#Q% zkh|p=@@kG-gvcv-Chx{9#72z7s@o6^)89p?5;N7&bAEed)qCiy2JesRfM-c|dXp`@JWpmgyzfa{7QMq*`V-DXH@!N=Nb zHj%Ttnje<%$kUupex^Y>dgdcVx>J7ato3m9?!|4W?a=8ZTpmBQ5YBEsh)PU>qpK&Z z6}A|rS-^FgrLV!e_njO=<-Nm)AZzVATu1TLp6cixC-tL`QF#YKCX*Xt{elN_-Q=h1 z;L)=$m)Ul6LfGJkF{}Ed2@5e2D>3W$0XinCZPg<;jh@|rc`tooBI=ZsQc`D9m%a8N zWO6y|luk&}6hr0Z&uyp8--f~CvN_$|LyfROqd4v66UcF{p4xUp#%Cks-r;a?aYy`= zJdUGscXc2}W|YAz;0{B7L6NbX4v!s!+oQB;|9*F4PVGs4zKxv{!=@K;e^eJcai)o1 zVkA~#)*q3102H2y%g5$#MOo8VCbE}0rw*si-N^a8%2o`UR*0N+%@{XxCD%m^8O?RE z7Jc1C6{9UY#7L~h1Hel_xJ2iU$gaAyd~Z8CYrxQP++okYcj2+}dIS%Q=X_{P zA|79~mD9dKVJO>q8X?h%oS!&r1%^(Y$!WS5)g0oqtEVrwlgX`NZDWhMHEo!&pcY~G zC1JRx2;*{=aJ!(0`;cFC5W{CYh0&SwF{io}{=s)?XG3unmoa2mGzzO*b<4#Ax$E{~ zg7j>P%UZGBgoPN1)p!YLH$lhnhwmO!(*Ep$bLgz{?I+;VtFK`x@L$ry8>QP0Vg1|Z zF(7_ahq^uyF<8_5HHJ^0#d*3fY7Dlb2dd1yvKhZq`=^s;J>^9u^;Q0Lz_9IN(y z2~EicLz%P6gYUOX&!YYYjY{bd!@ZzRVP}z3D zL>pVrp>RVJ(n_91&hlDRzWohqKKRL?k}dnVZtlh=Y&r5Hm#y4&obzENY`Kr})_wFLHl$*Y`)F_^k3uRP6hN`&(Fl&`?)e+l;j03TYrWWAz(f zm@p6gfuyG$4nV4Er-q3n^&zDyW9ldo9c;_ec7J1bB zCGW&QEX2fY|L{TN>L)RJM=D(Vhu%M7<(zd*7aC9ecy$nd0N(u-ICRmxM4rf--Y0n` z@5DeXy7#{QwSE_*4~SkuW*^+$Cw$uI^wPbHwzXWWJ@PGfpSf&U5_`Wf59y~oc_WYH zl{}MoVqlhQ{3zP-v$znhlKh0Vb7Xh#&`A$Wd}7nI!qqJWYqy^+t$E|Svikk!%|Yaa zJdro@NM6Y^d)G23{`(Ij+L2T7+1W}SD6AbLr73m4uyKo*lwc-`XHVpfJZjJRDxLQm z^b3)86qS;?OLEg4CCy20I&VsySJ|x}M{iyKe*Fa=*qpUBcw;;O00005+$O7B*BLqi+c!05el4`VoRzfws;b?X&Zac-p;-AW}F8o zq%}EYnREWd2u%6HxdPJ|>guDQ79Y?tzP;7DNW{TOr z;s*I2whgJyP&766C@~-lG7%dxK4Vj1RJ6_5n@5Y5b1IlDDJI{ek$VQCZ zW3%6>ufv%7MyZXD?X?X)0(Rk5q|NVMg^c6v3i6H4BmjLAi9$U5t;1kpGl6nC`o{3P zWs&{%MQtiR10%F`37Q}8x-dw{`$VRJfvJSzINAPN@+t1Na5Wus#ireKENnZt&ZQi- zEo|(;($TGs;ovSOM@<3&))-X@uviZ7Bxfau?_|Ktlch5 z03S=LxFSG#1tow)4(1!1)o*`s4U{npnS7*$;%{VB$ZK1GcStg5=^9YY^+gRZ$-{?o zxNp##Wz-%s!I}2sYuUcy4vW}4#?ZT%1=)}hS>?>arpf3zxoM0If9RD|4~uqO6twuQ zOAvYBI>aCDfP~6U(rart^CMZ4eC+i!&baiYDb)84OQ*iWEFWP^U+Ef}(HI=d$7U^y zrPz$c5!9dHwt)J0OsvJX{kN7=+sfXV#_+vzSfK(35 z(E|c=KL#T!d+N_yUkc-07IKq1I~XRU_B4|Ty{@(RnQgXtMtD8#2Oh!Bj>sV%jIsG=*+tb_aGIIPFV)|GaEl+MTd6xg53}zVX~TxIfmxdg6FuWf#SL`wF z)L`C`5m}L$zYpLtQK}*JDO-|Q4e7PFe%3-pWJP9viA)oqHp)AHS<-RHk$t70lq0R| zs;YTF^&R^|E359-fIhZ=&`tS_nl6akbrNC1ND70u9>2N{u7d5Btd{Jb{YZJI#d3KYUBtThBdzO(a&- z#~k*zmdaphWD+-FYz{v|x8~EQuD%ibJHVFOBeb-kK-MYL8%+H1P;&#Kz;{g|tV!Qb zIf*q_b6Z&hq#wCNZ4FIr1qNh8Mr0K~1{wLHV2rM%XIAWxgsw@xe+M_CU=a zA1P>s9LRCHJ2c$xB~>)tq?nm>H1#ou{asaOAaLV0YA=o0D2(S#VSA3>Dr#@qT`J^J z*yqP#4RMY?9xAW;9QBX3+!6Ab<+TtTpAMN7GH#t>U?liQCS*g#ftJEb@*fCe^rUV{ zF}WxHaq5d+kp1Pcpnwe=(4-meaG~c3=|tNtim7Xifar|fpsB6H-5gIgLhxp8MTejK zc-}m=y;rQJc4EOhLLPOx`|nV7?a!oBH@{KHVT`YVZE-G$J&vKN87z;A1K&_?IX!np z2zf^qWI{Iix34qMdjY&5m@uk(4t6vA%d(C&JwEdl0IyYX9MBXuclh`|2y*uDS?vk;QNjmJ-ZEN>p$^ZdC9NGU2)sP{Zow{;6Our1CVYv}^%*l|LB;&czF zYQ0O|kp-EMjTi^`IsEj62*XGibrTmS@9@f<)ycVs{oWFofbybyW%N(`ToYKBuC-Tn8bl*k^|eD>h!Bzyz#>AwK3 zJsMs@Pw0*JiJs9rG9Zimxvx3Y_k#EW(VS7%wAZ(o9I_;ON8_#&O^@Ec{x>*%`!OBh z_jdsr|2jN`UeFVILyzbcJ)?JIAeJG%6jgjJ&M=0otQggiPWlqZ*XIOmEDPCM)RcVS z!|olG=kDbkyL5jz2)&>u^oAbMD|#mH9D~~b{>KP6b4IjwR#LHHRCS%$Q_7uDH=fPP zYnW&@c|vdKkz3~*$-Tdze~7qQ)Mlm6%2>XX98NNpd()PCRsJFVBmBkwIr_8R{tHPL Vtoy7V##R6T002ovPDHLkV1hTbftCOO literal 0 HcmV?d00001 diff --git a/Mage.Client/src/main/resources/buttons/skip_to_end.png b/Mage.Client/src/main/resources/buttons/skip_to_end.png new file mode 100644 index 0000000000000000000000000000000000000000..7325a90b1f1a6f223a76667e2f8edd8f24e93a4b GIT binary patch literal 2399 zcmV-l3840gP)3DP$Rbez%|n#Mg+&n5&_Dnof-DjQ*C2I4MUSzVk_4j`(^zX;?NNI>_s*N)y~neC zw&Wa=cFy_E-2dMHzw>>UnSbsZ80P=SYaJ>QsIm|ZFsMrL>-R&IQBl`mOjk{2%tJn4 zEJE{HR5BJ}wF3jlh2@0YkRx*C3epe4^~UQn=0O`7%kbNbWd!KF6$`Thav(6F3?h=M z1_XjwF0)tUg06iWAV=bgoRRx~Q3!Qr_!4)4uE?3?{uOCJEwA~UYq7UdFk8*PGxiCfJ7*81SGGgLmF}MfGODf;XXH*A zPz!2OVt>F1+Kg#HFk=<*l9`+YDjpdSTht20r#pXEh&|Lw+))E*K~1Rb-xNWUG4`3k z-a1c3ZzqGuD+?xve+GMNZ^|Hc-%*&mEL0&dCO`jG2uj?mFvqr{Mx}FX6d$5Bc$SY% ziTI2(pcd3b+EC*w4iO{L9mZ}RS9B(C0b~DzgpllWkXqFt1OM<8VCO3Y#^mR}3X^8~ zD$Eg_T&Q#okHsOh2G8;_rNZh&aQ0pTD>mo!$$^+KgDb!|XAfG-V@t^; zShKAVX8MOvUU$DB$`!erFqG{1q1*eccXXex@D89H z{#*_XEgjI()hFB1ZX(4@ZN|~q#KIO-MIy3szI=Y*#%+)WHViP@=vajFc+&s3R;cQN{we<}kruaHIc?ZxK=ks}yD{@Be(ppd( zYDBG)4NUsPuJ|f3d+Jisjm0gXKmguQr9G3K>C-kAfbY6L(@0^VGnbHWxQzoCnc0#(ZEt1lnZM4U zp=Pws#A+;!t?Z|Px~7gWPZ`dr5w((L$!3Vpf|=Tg`32q^OCX`FOKC(NyaEpH?-9`E z{c$CoY-<`1HjZv!J835PtQRX>KbQ6M>!qwX=aG$P{yNU{0%_g)%qAG?>`m~I zDYI_XrM;aikkTrnF^pj+&jxZz5;gE-&2Ul z+-3+$t)R1_xVZMaSFY_ZY_INOJG{0&z-uGq{o5*T^~r%6QLA(T=n-HHU1EGA4?oXp z?g43tt2@DBw1dnuieqt2CuFtsK(M$J%xvCb-`$sK{8J)4<8#HYP4?Q6`|JDo-(49E z@_JAsYL$KjxJ^)h!s4lmQhM^v{}H6&7nVfHOh=7{Z6z0Au#pMq=nsZ~ovX zS{OhvPk*i-aCDhT*F$@{?{XO(s0}ruR_R7aXoVSV>)9@g;%^+e*aKC+dqzkssD?H1 zX|Vm1de~og0UV~fQF14DFKFz34#Ui?X#7d*9UAk*&@T;)^M0Hc5cLt)EU{-C^Wgo6 z57Q6I#CDZ62{FuvsJQ+>h?igE?A)dfu2nX(5_F&@)P@=rwZbZr9|$7{nY+e^?>_pM zx^JFC{kJc`e?trMV#pRvrH`O^Jbv{(td=s-8kX8 z?}u`nUFZ0b2GoL@P@Ckhuczp{0B#7zjM^Z3yLXlriOXAGG~ENJ>3jmtv**g(cFwcB zp#JNJ@Z}?b_X0x&e__i-g88U71RvUm&$dJ5wJxrQ*VSV;Qtk)RL|1n>_24PxQ3m^u z_jaE0vHUMuWv)Bg!3m1nx&Sqx7Sx2=NTY(E!@VCw7{-**Fm`tG4k}5jYh+X1+cPu?X}7P zIUzTmCvryar~$P|-uv3heiy_Kh$9$P?Kcg~Cam=f+tIx1XzR1m_CLUh?iX}{llK9d z9}Em27vzN8kRx(M&d41#kQOCBipqW#XP6-@EE%=IP6npqmwPUYDq5SE-I{QqrfWyZ zsfRnu&pjFlKrYA$xgkg7ikyi%r$PNc|HlYdIV0+wRYW$7n!XczOSv%`Lp@k{4G?$` zC*+14xjx@W!o8pVL&Q~4mxTd~p^{c|AYrJ4o34bb>QC`M!vEQSj{ahge**GLdHvqf R(Q5zz002ovPDHLkV1g#LncV;Y literal 0 HcmV?d00001 diff --git a/Mage.Client/src/main/resources/buttons/skip_to_main.png b/Mage.Client/src/main/resources/buttons/skip_to_main.png new file mode 100644 index 0000000000000000000000000000000000000000..8aec79da18196423ce4617595a820d64aaed1644 GIT binary patch literal 2478 zcmV;f2~qZmP)0;c>Mo=k#7i!BKYH{AZU@FU_q&y@ria;UHnjWDPv@O$l-3NuQq##kl;)8EP-VurO z-QU2uytxguwl`z_LdT3+!!*I<{@N;aF{GcH-6J+~NkHC~02U3Y&HC~Ue$oRK?e zKrN_g82bYTXfl?uD;ZnqbH+UvMg>TMc|%#1WKB35FDJRg0Z>f0HB?Z847tdZ9+dwJ4dqR*MF)s-f;R4XHF04 z5z>HKP!nlGjsN2kF(PeqcJt`ca?b(Ns0u>To(|aFbe-Vp6AbpwZlGge0&F~$*hV`a zGZZq)PEubUYj!ojI~hevwwLvPzxD$7FG_;2`1B#?Lhif{)P&kdBlp-Gu=I5pvjx8v zJ4*Y;#vKADNj*VUeFgH4URT1D+2KSKOGSG`(nc^evm~GC7<-6LFB;Hy-QH8=x3F`f zGI-fKm>#+mG_-ZWz?AEYaVs`egSqwFLQ<^9x z+v4*Mkj=n!41^?PftIczsE92e9UuTgLN1!bOu@Gb2E z=5OtQqX|mf)a0j=L zSo+nl?H`)~`fT#Bj&agGXCYvj490r}QZo7Z`2HA+aX1dP7iU(`Tv&IW8BUy$yP_7< zh8j_;d_xqLzae8BBDM0)eiHxNYcLcXy?#j(VaeNkVsbcPuCpMv-~t%iOrZAMH5E#I zqjFD>eYB$+%#jodOMIT}0O%NTD*)rP49uuLJ8mmX3riN}bJcFILim8d0m_Ex>Jpx>FWSU%08a?32Gjf4IyDq|If#yB|#Q z3F0;(BQw_b9pu!UXP@_~Fm9?3?Em!Pj}Gt9B{aXfrZ$+2wjp=~EP%|4(^NN>L#(Dw zaWS$2B`v5CwJL6c++$G9Y_fy5q^qFiHdI}Cq=eCSV`;EyvqK?udnLqW7C?6Saj3cS z0Bpy(kWWijAEpOILfs!9L+*h#aQ2)han z{K8{sKF@#%C~mnysJZ+=@E^SP7~VhBK?(3=`6%i@ZKx5oDn14o`Jup0*Lu!2>F(y| zhp+z&6p^;;Ac)m9gvT4!7pG*wv7V>!*7!+e)7H}m->@jCzVH=jXlb+1fnTkZ3I6P| zMp%-XO?5+4a|nq}OmaJ+rL)Q zf!a_bYE?W42}fZ@(|(Tk!p!cP%e~O_r>9CN{IC;JHWh<+aQKUtmbz20v;GX#U8nm& z>)k#`FRB(qx_bG7wZk}Shb@&r?ArIJ9xctJSd78;p-W#$Y8>n+JWBq8V5ev0lbKrZ!9P!Y*#|9OJ%h%Z ze+LnJk5i_r8{zD|??Ff3fZDkg^-%O-8~0u?!w=5)K8I}wKccq1lQR^vzBOA*AazqA z>}|OKaWd|-7#foRr|$d%bo97!j^FB~zC5ICeEj+xf}$M}viKe9gJpjoB3SO;YFNEx2gnLa;N1Pk!Z^c0 z`RR6=2g||y8%iocR#-`#kvnQYEvSjKz2t+)i%(+sj1(JrxcWtxWS6%*YGQ8#KAY`- z1GxNefX|-3IwaX#0RiBXUK~$Q?D1mSKJr zRsJl_Fh(qF7*%~Y154MXfiY_<6W-m^nYHiuoh@}Af0y6T@o*#nxgaOxh8&SAawhJa z2JsL7V}#3`F`b=9i5wVJT{m_~`7vrH0W5+>2m*)`azl>XIp0{${WbkV#AQ*Ng#il_ s`B8Et!9>nYTh3MG&7Y%huA#600-#o79^hIqBlK=n! literal 0 HcmV?d00001 diff --git a/Mage.Client/src/main/resources/buttons/skip_turn.png b/Mage.Client/src/main/resources/buttons/skip_turn.png new file mode 100644 index 0000000000000000000000000000000000000000..4c35eda03e420e7f94a4224b3e469c7c61bfe5a2 GIT binary patch literal 2321 zcmV+s3GViZP)vxso6?TYdvWid(_^}z4K~NpB$qNP$rO{a$lr56lo=&eHO3^&o{`0D zVazsFvub0^VoyvBp%>N@dP9%sm79>~0Iq4P#mJ%(81uMaG3N0weO@Z82-y#j8BGwM z-99B0#d>iKJpfXhG(eB!6+NT(XP5|8X4YC~#ys{GW0?r54%rY{cpA>#_!6%EW_U{K z{LL>Rx~LP>Sg+`r_5K+#Aj?zU=hN7w6wS`&KNy<~kghC);!9MN?>^(6Ei(Gwy z?H^U|)^<|NWTbCoLSyV*R#6?t@_8nkV>GQx$pZrubA>jC_#?!CEXYJ`$T-F!VI)!` z_Th1Dx_uTH1lEvZDlR}?`wa+9Erk`UW5C+sO)@)8szr6wyA2m92G1LIz7NU!KBW3+ z(lay>fY)d2gVf4XLYryboaG?s|pX7@KjhONim?nYBGa4s63dj6v@_2QncW zF>+s7Xo;2u3Vl zvxCfrOA0Y49LL9K&oF{bh0Q`8`x8n(q;|edMO6*nPRNDi$}XC8Y>UXLhu4>RQ`sv# zoxPU5!iwCo|1{-7?>q-GAsaFh>l3$v3aeSlvapXWz25_;ttSOVR9u3r=9_|iH|-K8 zfNx8#K1c9qFuI@><~e#&jB9YB!dMhP0oIG%={#Fx9{YbZ--*i0{G(y@)-sv^%$s@S zI;>&q{OZHA6}uX7OmIe}ki&=dm-f>u)Q;Z8EXan8$SP+R4h=@z&Pjbv)IE>%Q{c0^ zSI}Fz7a*ppAGUsQ6H*%o!D|CI0XhbzR7VA6)=`_ewY@@&%`#shh8K>*J{%*nQvBq^ z{Te!kAk{M#v}s>Aq#WvJC(u-gUz1iPBj8Ie`~Kopk09y7x;Ugo&{ z`=68#z<7EiB%3azsc#~*1?QgyiK;rNsB3^rL@^k@;y^KuYqyUWkK?d!<>rInzvC#4 z+s7CXVP7``pj~nKenKe-H)hH zyLb3D5VHtOEF-dtAA;Q1pqk!<)FtG^eBwUw_3WKJz&$V&0-}?s z-EO%DNZ6&nA*%=iH>OaGgX=1&V1IJ+49J9R$T-?oSV{f^VYar+DLt;J^=~JC{{T8Z ze@IFy;(%tES-|<>M}l}mU3b2NC2n3+PAhw#gk{e)>x5Vwi)~Gx{tnisWO4T|dlu(w zxcEyNgW6V7tni|MN=YrZe9bN3;$0AAXd>gb#X7p6A=RYv_KI2(ZFhs#39&d9+uE)VL3k=R0eBYY zn@BuZ`OkY4+N;m>Q5$M=ZV9)70@p#)z}Ms-S&#|Yh;fvk!;fExFpLSKX0X`KGpezm z?b5@}FCIbVnSKb}k_BQdQr< zc6rd=?bRLk+Hd_8_|?$+7l12&2l({<)Dn6^Z@f?RjNXv}S>)gQ8k2o5h%XS08D$M? zUDE~O{;|8e3tRi{AMXDnoWAprF7VOU0NvkA4WSqGgx=62dPUFZ9T|vak}pLSUyC!0 zJ}YxZMaNFp#P-MT!AZ5@nH7B*RmX>RH=g}de)EO9Q$gqjJ)t-Bh+fe%dFL2Z|NTEk zxS5+lduJudTt-F9j$KmA8MT>itURWO+{hDpLyz1(e}>%qbNYvfn?)%rT~;&YTgj=U rnR0JZxmV@?#D9eUvwx1hu*bgub-qcOhq|DqsU?_AwGqriV}y?3g`&!Z zjuCsChscZQiM)|V@+u9;2LNwnttXhvqXmn|n}S6YTJ}kR%cM1!o?M2g^onL7x#-1p zavpU1CW1V&SMp5W-(w&&1(VN)3lC_|@+bvf>c5 zM6cvo^nQaGh(*QcyoETGLd4PhP3W5p-H|z1S$+`*s_*|#D6`@cdnWJ9KrF=c4(kIY z=m=($LWE9HuLYZQsJUe#p|}d0j@?p8MF%eY$CT|)!u6=X~w)<=;-P}?2n}`lVQ|^aBj=o zRn286*Vv5`Y2$aLF_i$`@!n=}}YD`JJ_p2U)h8kJ;X(S^ZX z147{!Hjm3~jLop1^b7)HmU3*-%^JyT4=b-pEk1%73)Ueq|A4Y?{-)DN5M#P-c6K>S z6(8iij)RzpjTxoa<{zehE1{ilm}b|gm)(N4pohGS6}$dC7VM}|NtV5B7_z0F0jwQ8 z;2k;-X{Ay>b+dwGK!YOI4fP3bP~TU)W`5ZvIFAeE*tkPyW!qoGx_9+K-s?DsiP(sd zS^w)%&=6&!Za(!?=h0bkirc5uwA?dD+kRCg#S|Vx4;vSr`gO*QM2Lj-RdDj2ri}e# zG9h2GjpMc^76@IrOF4LBXD-9=abaBkq^~`KGq!Ml8k$;2-ctQeKFE807GfhtVpT9J z4;`WPASdllP9n76BH}h*MMCMdCKXeB4qo9IaQ-YBVL4yJXI2hm zqGGs)Dr0t=w-wCqh>6W?)p$~j-C9%Ii_>{GPUU&ci=cw?DuUR$SZj!@AX-T zjTnhlu^=j^e;dKjGs@gC<@x8UFX4UFvb7N#?P~80=V>b;(~t&WOzcLCoViw-{-#zK z6|(`pDLbXd#h@KrLbB1OLpP4y!*kJpo-omUqJz-3C>dwC;9Vr6Ef#WK3PoD>2ut1GG&v z*EaVq_Dd{B`tI+Vjhx5N;sK!Zhw76UiIte^w#YmHnkJsvHY`**CIw@tv>+# z2ncN)-tzmxhCi@_-O^FzZwf-X@ErNRe1ML03sLen16V@EB zg|?0^PrsbQ-@$RrB;|q@pT7?QGc&k6+$RWY|MsL&jR=h3yr9(8Z_Ohanp$w~l8Va> z>c7}_7EYrBF*ZD{$vz6Jen$RjQ6fWQB1U4ZzX(dNL9KTEtQ_UlEB4<($@!<~WjmY= zC9OSxHto#BO^61^KGWkc$a%E%K3JD=;&2Unmw1xbY5O|xIv$d<<*q~qmr=a?!RED7@YhgH&OA; z3lI~r5#yV-!fJ{i2$rqQosuF~?EH26l^+}YK-pRI1H$GlQ^rF)y>PttHSFC+aqJ%w zt!(e-FpS$g$4j#(F=rjebPdIEnFToV@HYfT#zUTxfiG{=!la`FR(9bof@0I8J1d^E zcU3m%v$4FyRqMFiYoHxc^UIVsuH@7m?ECg5h>6$~cfZw}z6;QTU@T~~?%Ts5uz2zI zs#liXdvhn<#5?=fhd}As>&gKLO^Qb_@erqWAL(ulcI39HbCNl3rEee( zLLpY~Il_;TOhbcbkd*6$6OUiQ)ItI)zkCnD2@)8c=^82za2m#aHkNnv(Q`3JTDQzB zyP#ET11@hma}UHqOvJ{FZ}>U<`v(z0FcY+l2M_X;mrk6syvk_OAVJ%_}%`LYxW7h|em-zPrzr1027){1vef z6SKYLgUIin#ONKV+1A#2Sm3IZ!u?MxuK&UVz=QBJaPFVLg%{0BThG@hr+ph^>34{} zp~+KXAQr`YU*}!F3(^NfQ$by)mqCaA!F~}LmCJWlz1Vv32OPZriU)!oiONUKL*#`# zzmQnix%s{@>14z z@YTJH(xX2v-G1^(a}aqUPvng}l2`J~-X#XjKmU&rY2*xf@2n=X5;XJ%iBoErpk?GH z%DtJ$jXjY!@+j@|4He!$(0_=eQPdS>Aj(Lwm26HjQh3uk^P)>90Iwqh-5f>zb8}1MyL>OZT#!1vfBXPxzlQ^0<8KaqTCN3v4(HV8Vse7xt zY_uD2#vdfdI_Ep@-g@`G_kFjkUcIUogqO#29Yz`$i!f%&Z`dSOhl-YtR6r4W#8c@AD4gr8GmV=D!4=g|HgF9&2hEap3Irp9R*|o@36$ zoi&ga($t3afdVW9=foL;oBFX3m=B}KwaDGxfbvhT{H&0>qk*}T2G&BFNLwpKFc<7c z3>Gh)`zHMhU^28Aff;*HQrGkhGM1OY%Rd;l4$g3P_r#ExM6BL>N^h(_B+glep1y(H zl3%?40^50|zi%~{@(8WP^;7R*4WxxMu{P3Z;4l$PtQ^F}Iu$6`tycJ*T__uaqiA&d$>)c<*8}q%5zHNeoNMM$D`?FfOYQ zsYTTot9}a}-T|2U<~F=pbq=0>A?z!n5U8{pMkv7uETA#WVOhq^v zD<^;MF=8D;=Y1$+TImTaslL<dW(M$L#JKEa$~#uYHCm zao5#C+DId5)o7Lv3!zg$sCoC4dqeXMAbR;x8L@92!>rAXm{)NLxs^>a=Iv_4*tu^b zI5rhFj_ypNlXxpopVKS8;;-g{e!~-?Ft>z_g9@H~!{OFD5SE?oFt7XqLdT?W4z-k{ z68p%HU%Z3;E@BS((~CY}KeOx$d2Ve1=I(5SPncAk-^^V0gqz5fI1_hWEu@V!l2*-v zC|~|v1luUJGGx*HslPji)(|pr5l?Dq(+!Dhj$`n&BKAqFZojFy1-b_egWs^}Ffuk_ z_(V+N82{ljIfh#Doje2BAD&spzOAws`$ID}@f==*CgNAonV7Whq+9@s^9&j#two9X zXbX4JNLpF5<~E=O!9iRhR|O?({Lh?SSI`>LH=RLO=k7eQxurEs6y_3%@pHL9we+O8 zNJ{6TW)>lF>H9KivMDAwHiLa?$$xb~H2WPocERYJtr$LYHH^iA(bzNx^?3!2;8^Wg zWP1-BEfs3|O0nTRv~9s6Z_F(Y;5Lwxqn(=9rsg9e&*(rJWlw8Y^1I~BF97|**<1L4f6N>`42G+vHgG46q*eD8kQPB}|M9`&mfqU*`42FN z_E*-P*V(n5H<AIuKyZ4PT$juigQ1r z@`7RX4j3qHf(DPkjQkCV7x(ts0+bwR!iGav;oUzR#wMnG&dyndoRVtJ?Ipff*oops zPMHIRnK>L>yJLNQ6Dk_-B5YIw=O}x;3QOzG@_70<5JyA&NgHV-t-6mvL9;1vw|0$K zpD#M7v1`U(54JZKSp`iC{!9qMAsk;_QUFM*w-3;aTcAYLu)6;z(RIk%gO z8~Z_#qu|!lo9(2zOEJIX9chc~)&rArmNpyD5D((2PXlQqjigm~BP4Hy1q+Xeka2mJ zcAdI~+CM&Mh7Z2^Hx6EZ*dly`2Qj$;L!*(iW-C$_7s`ZpH(bTO%Xg7gxCz51Oog*3 zh|W7G-8h$8@^>8lN_;E)t+ZzlTU}c>j>a>@gSbA;pEQv+(x`7MY@~TXaPOoH&C6K5 z_a7hr=^^UBeI(-#Hy-1&TP?$HfK-4fIZN2DI`fTO0J0;;Ca^srEgLH;q|K3|s~g8s ztBs?4?Ks)1N~JAxR5WTY-GqfzM>)x`KnsGsVA{#YYe4+= z71a%oKE4TP@yYkV@jES}Z>Us&RhK(yAx)%>HR^dCe)2&?5S#@w`=EfRl*&~# zCmtRA?y)@3(I0@5KN?2)@kVT{Ka71%*VsSy_xtP<$Zoj%5G%^7v1~^rKKbqrwjFNZ zK02?pDUR}W$EpANd*pB3jmnc3x6i>hINldG|>XZUd)&0?s^WUm#AzP0N!w6L-=;S~Smni?)6jqz{Nrg0V$!8yElN zG3m<>7425==V> z*f{&X{#wGE?a7Nv8y0Tfe{Ff?k-rsIAG^~YKwO9uaU+hzl{hnZNrU2l|6@d|oGtI2 zjZAt7rq%)CB{fJevx^ilw4ET5IT1JFDDCrYHQZm&KSWX$twh*}u+wZM+Y{_G+^jTQ hjbHvb`toS~_%9BT-v*t|!ZZK?002ovPDHLkV1nNZcy0gy literal 0 HcmV?d00001 From e4d2782a08bdb6645d0cf8b6ad6f2c9db6aead19 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 18 Oct 2014 18:11:37 +0200 Subject: [PATCH 33/34] * Fixed some Ferocious effects. --- .../sets/khansoftarkir/BarrageOfBoulders.java | 31 +++++++++-- .../mage/sets/khansoftarkir/CratersClaws.java | 50 ++++++++++++----- .../mage/sets/khansoftarkir/FeedTheClan.java | 54 +++++++++++++------ .../src/mage/sets/khansoftarkir/IcyBlast.java | 33 ++++++++++-- .../sets/khansoftarkir/RoarOfChallenge.java | 45 +++++++++++++--- 5 files changed, 171 insertions(+), 42 deletions(-) diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java b/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java index e3e275c848d..d7ab4ff46a5 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BarrageOfBoulders.java @@ -28,8 +28,8 @@ package mage.sets.khansoftarkir; import java.util.UUID; +import mage.abilities.Ability; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalRestrictionEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageAllEffect; import mage.abilities.effects.common.combat.CantBlockAllEffect; @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.TargetController; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; /** * @@ -62,9 +63,7 @@ public class BarrageOfBoulders extends CardImpl { // Barrage of Boulders deals 1 damage to each creature you don't control. this.getSpellAbility().addEffect(new DamageAllEffect(1, filter)); // Ferocious - If you control a creature with power 4 or greater, creatures can't block this turn - Effect effect = new ConditionalRestrictionEffect(Duration.EndOfTurn, - new CantBlockAllEffect(new FilterCreaturePermanent("creatures"), Duration.EndOfTurn), - FerociousCondition.getInstance() , null); + Effect effect = new BarrageOfBouldersCantBlockAllEffect(new FilterCreaturePermanent("creatures"), Duration.EndOfTurn); effect.setText("

Ferocious - If you control a creature with power 4 or greater, creatures can't block this turn"); this.getSpellAbility().addEffect(effect); } @@ -78,3 +77,27 @@ public class BarrageOfBoulders extends CardImpl { return new BarrageOfBoulders(this); } } + +class BarrageOfBouldersCantBlockAllEffect extends CantBlockAllEffect { + + public BarrageOfBouldersCantBlockAllEffect(FilterCreaturePermanent filter, Duration duration) { + super(filter, duration); + } + + public BarrageOfBouldersCantBlockAllEffect(final BarrageOfBouldersCantBlockAllEffect effect) { + super(effect); + } + + @Override + public void init(Ability source, Game game) { + if (!FerociousCondition.getInstance().apply(game, source)) { + discard(); + } + } + + @Override + public BarrageOfBouldersCantBlockAllEffect copy() { + return new BarrageOfBouldersCantBlockAllEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java b/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java index f9046e9b7dc..90034d6d00f 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/CratersClaws.java @@ -28,15 +28,17 @@ package mage.sets.khansoftarkir; import java.util.UUID; -import mage.abilities.condition.InvertCondition; +import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.IntPlusDynamicValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; +import mage.game.Game; import mage.target.common.TargetCreatureOrPlayer; /** @@ -52,17 +54,9 @@ public class CratersClaws extends CardImpl { this.color.setRed(true); // Crater's Claws deals X damage to target creature or player. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new DamageTargetEffect(new ManacostVariableValue()), - new InvertCondition(FerociousCondition.getInstance()), - "{this} deals X damage to target creature or player.")); - this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); - // Ferocious - Crater's Claws deals X plus 2 damage to that creature or player instead if you control a creature with power 4 or greater. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new DamageTargetEffect(new IntPlusDynamicValue(2, new ManacostVariableValue())), - FerociousCondition.getInstance(), - "

Ferocious - Crater's Claws deals X plus 2 damage to that creature or player instead if you control a creature with power 4 or greater")); + this.getSpellAbility().addEffect(new CratersClawsDamageTargetEffect(new ManacostVariableValue())); + this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); } public CratersClaws(final CratersClaws card) { @@ -74,3 +68,35 @@ public class CratersClaws extends CardImpl { return new CratersClaws(this); } } + +class CratersClawsDamageTargetEffect extends DamageTargetEffect { + + + public CratersClawsDamageTargetEffect(DynamicValue amount) { + super(amount, false); + } + + public CratersClawsDamageTargetEffect(final CratersClawsDamageTargetEffect effect) { + super(effect); + } + + @Override + public CratersClawsDamageTargetEffect copy() { + return new CratersClawsDamageTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (FerociousCondition.getInstance().apply(game, source)) { + amount = new IntPlusDynamicValue(2, new ManacostVariableValue()); + } + return super.apply(game, source); + } + + @Override + public String getText(Mode mode) { + return "{this} deals X damage to target creature or player." + + "

Ferocious - {this} deals X plus 2 damage to that creature or player instead if you control a creature with power 4 or greater"; + } + +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java b/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java index 43574560c86..6698bd9347b 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/FeedTheClan.java @@ -28,16 +28,15 @@ package mage.sets.khansoftarkir; import java.util.UUID; -import mage.abilities.condition.InvertCondition; +import mage.abilities.Ability; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalOneShotEffect; -import mage.abilities.dynamicvalue.IntPlusDynamicValue; -import mage.abilities.dynamicvalue.common.ManacostVariableValue; -import mage.abilities.effects.common.DamageTargetEffect; -import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Rarity; +import mage.game.Game; +import mage.players.Player; /** * @@ -52,16 +51,8 @@ public class FeedTheClan extends CardImpl { this.color.setGreen(true); // You gain 5 life. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new GainLifeEffect(5), - new InvertCondition(FerociousCondition.getInstance()), - "You gain 5 life")); - - // Ferocious - You gain 10 life instead if you control a creature with power 4 or greater. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new GainLifeEffect(10), - FerociousCondition.getInstance(), - "

Ferocious - You gain 10 life instead if you control a creature with power 4 or greater")); + // Ferocious - You gain 10 life instead if you control a creature with power 4 or greater + this.getSpellAbility().addEffect(new FeedTheClanEffect()); } @@ -74,3 +65,34 @@ public class FeedTheClan extends CardImpl { return new FeedTheClan(this); } } + +class FeedTheClanEffect extends OneShotEffect { + + public FeedTheClanEffect() { + super(Outcome.GainLife); + this.staticText = "You gain 5 life.

Ferocious - You gain 10 life instead if you control a creature with power 4 or greater"; + } + + public FeedTheClanEffect(final FeedTheClanEffect effect) { + super(effect); + } + + @Override + public FeedTheClanEffect copy() { + return new FeedTheClanEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (FerociousCondition.getInstance().apply(game, source)) { + controller.gainLife(10, game); + } else { + controller.gainLife(5, game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java b/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java index e9343631854..79cc02d6a52 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/IcyBlast.java @@ -31,7 +31,6 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.condition.common.FerociousCondition; -import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.SkipNextUntapTargetEffect; import mage.abilities.effects.common.TapTargetEffect; @@ -59,9 +58,7 @@ public class IcyBlast extends CardImpl { this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent(), false)); // Ferocious - If you control a creature with power 4 or greater, those creatures don't untap during their controllers' next untap steps. - Effect effect = new ConditionalContinuousRuleModifyingEffect( - new SkipNextUntapTargetEffect(), - FerociousCondition.getInstance()); + Effect effect = new IcyBlastSkipNextUntapTargetEffect(); effect.setText("

Ferocious - If you control a creature with power 4 or greater, those creatures don't untap during their controllers' next untap steps"); this.getSpellAbility().addEffect(effect); } @@ -85,3 +82,31 @@ public class IcyBlast extends CardImpl { return new IcyBlast(this); } } + +class IcyBlastSkipNextUntapTargetEffect extends SkipNextUntapTargetEffect { + + public IcyBlastSkipNextUntapTargetEffect() { + super(); + } + + public IcyBlastSkipNextUntapTargetEffect(final IcyBlastSkipNextUntapTargetEffect effect) { + super(effect); + } + + @Override + public IcyBlastSkipNextUntapTargetEffect copy() { + return new IcyBlastSkipNextUntapTargetEffect(this); + } + + @Override + public void init(Ability source, Game game) { + if (!FerociousCondition.getInstance().apply(game, source)) { + discard(); + } + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java b/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java index 236615cb767..771fe386ba5 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/RoarOfChallenge.java @@ -33,15 +33,20 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.FerociousCondition; import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.combat.MustBeBlockedByAllTargetEffect; import mage.abilities.effects.common.continious.GainAbilityTargetEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; import mage.target.common.TargetCreaturePermanent; /** @@ -57,13 +62,10 @@ public class RoarOfChallenge extends CardImpl { this.color.setGreen(true); // All creatures able to block target creature this turn do so. - this.getSpellAbility().addEffect(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn)); - this.getSpellAbility().addTarget(new TargetCreaturePermanent()); // Ferocious - That creature gains indestructible until end of turn if you control a creature with power 4 or greater. - this.getSpellAbility().addEffect(new ConditionalContinousEffect( - new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), - new LockedInCondition(FerociousCondition.getInstance()), - "

Ferocious - That creature gains indestructible until end of turn if you control a creature with power 4 or greater")); + this.getSpellAbility().addEffect(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new RoarOfChallengeEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } public RoarOfChallenge(final RoarOfChallenge card) { @@ -75,3 +77,34 @@ public class RoarOfChallenge extends CardImpl { return new RoarOfChallenge(this); } } + +class RoarOfChallengeEffect extends OneShotEffect { + + public RoarOfChallengeEffect() { + super(Outcome.AddAbility); + this.staticText = "

Ferocious - That creature gains indestructible until end of turn if you control a creature with power 4 or greater"; + } + + public RoarOfChallengeEffect(final RoarOfChallengeEffect effect) { + super(effect); + } + + @Override + public RoarOfChallengeEffect copy() { + return new RoarOfChallengeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (FerociousCondition.getInstance().apply(game, source)) { + ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn); + effect.setTargetPointer(getTargetPointer()); + game.addEffect(effect, source); + } + return true; + } + return false; + } +} From 0ecb04d8d28ce5e72631dafa22cb72d6be5442f8 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 18 Oct 2014 18:23:05 +0200 Subject: [PATCH 34/34] * Minor change to user info. --- Mage.Client/src/main/java/mage/client/chat/ChatPanel.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java index 695db98429f..835b5a2defa 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java @@ -312,9 +312,9 @@ public class ChatPanel extends javax.swing.JPanel { TableColumnModel tcm = th.getColumnModel(); tcm.getColumn(0).setHeaderValue("Players (" + this.players.length + ")"); tcm.getColumn(2).setHeaderValue( - "Games (" + roomUserInfo.getNumberActiveGames() + - (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " T:" + roomUserInfo.getNumberGameThreads():"") + - " max: " + roomUserInfo.getNumberMaxGames() + ")"); + "Games " + roomUserInfo.getNumberActiveGames() + + (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads():" (") + + " limit: " + roomUserInfo.getNumberMaxGames() + ")"); th.repaint(); this.fireTableDataChanged(); }