diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index d0fc5e02dc..e5c0908323 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -1046,8 +1046,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { // close & remove sideboarding or construction pane if open if (window instanceof DeckEditorPane) { DeckEditorPane deckEditorPane = (DeckEditorPane) window; - if (deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.LIMITED_BUILDING) - || deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.SIDEBOARDING)) { + if (deckEditorPane.getDeckEditorMode() == DeckEditorMode.LIMITED_BUILDING + || deckEditorPane.getDeckEditorMode() == DeckEditorMode.SIDEBOARDING) { deckEditorPane.removeFrame(); } } diff --git a/Mage.Client/src/main/java/mage/client/cards/BigCard.java b/Mage.Client/src/main/java/mage/client/cards/BigCard.java index 8048c8977f..59ecb2ce27 100644 --- a/Mage.Client/src/main/java/mage/client/cards/BigCard.java +++ b/Mage.Client/src/main/java/mage/client/cards/BigCard.java @@ -111,7 +111,7 @@ public class BigCard extends JComponent { image = TransformedImageCache.getResizedImage((BufferedImage)image, getWidth(), getHeight()); } - if (this.cardId == null || !enlargeMode.equals(this.enlargeMode) || !this.cardId.equals(cardId)) { + if (this.cardId == null || enlargeMode != this.enlargeMode || !this.cardId.equals(cardId)) { if (this.panel != null) { remove(this.panel); } diff --git a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java index 04eb29c0d4..dbf4c1d6da 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java @@ -192,7 +192,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener, } break; case RARITY: - if (!cardImg.getOriginal().getRarity().equals(lastCard.getOriginal().getRarity())) { + if (cardImg.getOriginal().getRarity() != lastCard.getOriginal().getRarity()) { curColumn++; curRow = 0; } diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanelSeparated.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanelSeparated.java index a3bc1aaa97..2592737fb6 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanelSeparated.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanelSeparated.java @@ -88,10 +88,10 @@ public class ChatPanelSeparated extends ChatPanelBasic { textColor = MESSAGE_COLOR; userSeparator = ": "; } - if (color.equals(ChatMessage.MessageColor.ORANGE)) { + if (color == ChatMessage.MessageColor.ORANGE) { textColor = "Orange"; } - if (color.equals(ChatMessage.MessageColor.YELLOW)) { + if (color == ChatMessage.MessageColor.YELLOW) { textColor = "Yellow"; } if (username != null && !username.isEmpty()) { diff --git a/Mage.Client/src/main/java/mage/client/components/ext/dlg/DialogContainer.java b/Mage.Client/src/main/java/mage/client/components/ext/dlg/DialogContainer.java index e0f6d37dac..3a5a36f2da 100644 --- a/Mage.Client/src/main/java/mage/client/components/ext/dlg/DialogContainer.java +++ b/Mage.Client/src/main/java/mage/client/components/ext/dlg/DialogContainer.java @@ -39,7 +39,7 @@ public class DialogContainer extends JPanel { if (dialogType == DialogManager.MTGDialogs.MessageDialog) { //backgroundColor = new Color(0, 255, 255, 60); - if (params.type.equals(MessageDlg.Types.Warning)) { + if (params.type == MessageDlg.Types.Warning) { backgroundColor = new Color(255, 0, 0, 90); } else { backgroundColor = new Color(0, 0, 0, 90); diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java index f5bc858288..fcfaed6153 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardInfoWindowDialog.java @@ -162,7 +162,7 @@ public class CardInfoWindowDialog extends MageDialog { public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId, boolean revertOrder) { cards.loadCards(showCards, bigCard, gameId, revertOrder); - if (showType.equals(ShowType.GRAVEYARD)) { + if (showType == ShowType.GRAVEYARD) { int qty = qtyCardTypes(showCards); String titel = name + "'s Graveyard (" + showCards.size() + ") - " + qty + ((qty == 1) ? " Card Type" : " Card Types"); setTitle(titel); @@ -173,7 +173,7 @@ public class CardInfoWindowDialog extends MageDialog { @Override public void show() { - if (showType.equals(ShowType.EXILE)) { + if (showType == ShowType.EXILE) { if (cards == null || cards.getNumberOfCards() == 0) { return; } diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java index 9eda832eca..9132490884 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -391,7 +391,7 @@ public class ConnectDialog extends MageDialog { connection.setUsername(this.txtUserName.getText().trim()); connection.setPassword(this.txtPassword.getText().trim()); connection.setForceDBComparison(this.chkForceUpdateDB.isSelected()); - connection.setUserIdStr(System.getProperty("user.name") + ":" + MagePreferences.getUserNames()); + connection.setUserIdStr(System.getProperty("user.name") + ':' + MagePreferences.getUserNames()); MageFrame.getPreferences().put(KEY_CONNECT_FLAG, ((CountryItemEditor) cbFlag.getEditor()).getImageItem()); PreferencesDialog.setProxyInformation(connection); diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java index c7c28bba6e..61b83ebd8e 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java @@ -2958,7 +2958,7 @@ public class PreferencesDialog extends javax.swing.JDialog { } connection.setProxyType(configProxyType); - if (!configProxyType.equals(ProxyType.NONE)) { + if (configProxyType != ProxyType.NONE) { String host = getCachedValue(KEY_PROXY_ADDRESS, ""); String port = getCachedValue(KEY_PROXY_PORT, ""); if (!host.isEmpty() && !port.isEmpty()) { 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 bba5988920..d68e842327 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -1144,7 +1144,7 @@ public final class GamePanel extends javax.swing.JPanel { PopUpMenuType popupMenuType = null; if (options != null) { if (options.containsKey("targetZone")) { - if (Zone.HAND.equals(options.get("targetZone"))) { // mark selectable target cards in hand + if (Zone.HAND == options.get("targetZone")) { // mark selectable target cards in hand List choosen = null; if (options.containsKey("chosen")) { choosen = (List) options.get("chosen"); @@ -1163,7 +1163,7 @@ public final class GamePanel extends javax.swing.JPanel { } } } - if (options.containsKey("queryType") && PlayerQueryEvent.QueryType.PICK_ABILITY.equals(options.get("queryType"))) { + if (options.containsKey("queryType") && PlayerQueryEvent.QueryType.PICK_ABILITY == options.get("queryType")) { popupMenuType = PopUpMenuType.TRIGGER_ORDER; } } @@ -1263,7 +1263,7 @@ public final class GamePanel extends javax.swing.JPanel { hideAll(); ShowCardsDialog showCards = new ShowCardsDialog(); JPopupMenu popupMenu = null; - if (PopUpMenuType.TRIGGER_ORDER.equals(popupMenuType)) { + if (PopUpMenuType.TRIGGER_ORDER == popupMenuType) { popupMenu = popupMenuTriggerOrder; } showCards.loadCards(title, cards, bigCard, gameId, required, options, popupMenu, getShowCardsEventListener(showCards)); diff --git a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java index af2a653105..0db517ded0 100644 --- a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java +++ b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java @@ -145,7 +145,7 @@ public class CallbackClientImpl implements CallbackClient { createChatStartMessage(panel); } // send the message to subchat if exists and it's not a game message - if (!message.getMessageType().equals(MessageType.GAME) && panel.getConnectedChat() != null) { + if (message.getMessageType() != MessageType.GAME && panel.getConnectedChat() != null) { panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), ChatMessage.MessageColor.BLACK); } else { panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), message.getColor()); @@ -157,7 +157,7 @@ public class CallbackClientImpl implements CallbackClient { case "serverMessage": if (callback.getData() != null) { ChatMessage message = (ChatMessage) callback.getData(); - if (message.getColor().equals(ChatMessage.MessageColor.RED)) { + if (message.getColor() == ChatMessage.MessageColor.RED) { JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.WARNING_MESSAGE); } else { JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.INFORMATION_MESSAGE); diff --git a/Mage.Client/src/main/java/mage/client/unusedFiles/DelayedViewerThread.java b/Mage.Client/src/main/java/mage/client/unusedFiles/DelayedViewerThread.java index 851bffeabe..89976b2669 100644 --- a/Mage.Client/src/main/java/mage/client/unusedFiles/DelayedViewerThread.java +++ b/Mage.Client/src/main/java/mage/client/unusedFiles/DelayedViewerThread.java @@ -24,7 +24,7 @@ public class DelayedViewerThread extends Thread { public synchronized void show(Component component, long delay) { delayedViewers.put(component, System.currentTimeMillis() + delay); - notify(); + notifyAll(); } public synchronized void hide(Component component) { diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index c355527a02..4b37032e4c 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -147,7 +147,7 @@ public final class GuiDisplayUtil { for (String rule : card.getRules()) { textLines.basicTextLength += rule.length(); } - if (card.getMageObjectType().equals(MageObjectType.PERMANENT)) { + if (card.getMageObjectType() == MageObjectType.PERMANENT) { if (card.getPairedCard() != null) { textLines.lines.add("Paired with another creature"); textLines.basicTextLength += 30; diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderImpl.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderImpl.java index d5a3f7b74d..a5ff85e3b2 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderImpl.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderImpl.java @@ -65,7 +65,7 @@ public class CardPanelRenderImpl extends CardPanel { if (a.getRarity() == null || b.getRarity() == null) { return false; } - if (!a.getRarity().equals(b.getRarity())) { + if (a.getRarity() != b.getRarity()) { return false; } if (a.getCardNumber() != null && !a.getCardNumber().equals(b.getCardNumber())) { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java index 6ff9dd6070..cc75bff9cf 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/CardPluginImpl.java @@ -460,7 +460,7 @@ public class CardPluginImpl implements CardPlugin { continue; } // all attached permanents are grouped separately later - if (!type.equals(RowType.attached) && RowType.attached.isType(permanent)) { + if (type != RowType.attached && RowType.attached.isType(permanent)) { continue; } Stack stack = new Stack(); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java index af9424a35e..23b9180d41 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java @@ -142,7 +142,7 @@ public class MythicspoilerComSource implements CardImageSource { String urlDocument; Document doc; - if (proxyType.equals(ProxyType.NONE)) { + if (proxyType == ProxyType.NONE) { urlDocument = pageUrl; doc = Jsoup.connect(urlDocument).get(); } else { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java index 4b0da49d62..047bb90f24 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java @@ -332,7 +332,7 @@ public class WizardCardsImageSource implements CardImageSource { Preferences prefs = MageFrame.getPreferences(); Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None")); Document doc; - if (proxyType.equals(ProxyType.NONE)) { + if (proxyType == ProxyType.NONE) { doc = Jsoup.connect(urlString).get(); } else { String proxyServer = prefs.get("proxyAddress", ""); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java index 37c9f07e31..28f8001ac3 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java @@ -216,7 +216,7 @@ public final class CardImageUtils { public static Proxy getProxyFromPreferences() { Preferences prefs = MageFrame.getPreferences(); Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None")); - if (!proxyType.equals(ProxyType.NONE)) { + if (proxyType != ProxyType.NONE) { String proxyServer = prefs.get("proxyAddress", ""); int proxyPort = Integer.parseInt(prefs.get("proxyPort", "0")); return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyServer, proxyPort)); diff --git a/Mage.Client/src/test/java/mage/client/game/StartMultiGamesTest.java b/Mage.Client/src/test/java/mage/client/game/StartMultiGamesTest.java index 10e2d072f9..f5dea6e8c5 100644 --- a/Mage.Client/src/test/java/mage/client/game/StartMultiGamesTest.java +++ b/Mage.Client/src/test/java/mage/client/game/StartMultiGamesTest.java @@ -48,7 +48,7 @@ public class StartMultiGamesTest { synchronized (sync) { frame = new MageFrame(); frame.setVisible(true); - sync.notify(); + sync.notifyAll(); } }); synchronized (sync) { diff --git a/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java b/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java index d8ad9fae67..dc23a4364e 100644 --- a/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java +++ b/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java @@ -167,7 +167,7 @@ class MomirEffect extends OneShotEffect { while (token.getName().isEmpty() && !options.isEmpty()) { int index = RandomUtil.nextInt(options.size()); ExpansionSet expansionSet = Sets.findSet(options.get(index).getSetCode()); - if (expansionSet == null || expansionSet.getSetType().equals(SetType.CUSTOM_SET)) { + if (expansionSet == null || expansionSet.getSetType() == SetType.CUSTOM_SET) { options.remove(index); } else { Card card = options.get(index).getCard(); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index cb5a449746..db6da80b74 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -1372,7 +1372,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ { private boolean checkForRepeatedAction(Game sim, SimulationNode2 node, Ability action, UUID playerId) { // pass or casting two times a spell multiple times on hand is ok - if (action instanceof PassAbility || action instanceof SpellAbility || action.getAbilityType().equals(AbilityType.MANA)) { + if (action instanceof PassAbility || action instanceof SpellAbility || action.getAbilityType() == AbilityType.MANA) { return false; } int newVal = GameStateEvaluator2.evaluate(playerId, sim); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java index dc113944d3..7650f1f839 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/SimulatedPlayer2.java @@ -124,7 +124,7 @@ public class SimulatedPlayer2 extends ComputerPlayer { List playables = game.getPlayer(playerId).getPlayable(game, isSimulatedPlayer); playables = filterAbilities(game, playables, suggested); for (Ability ability : playables) { - if (ability.getAbilityType().equals(AbilityType.MANA)) { + if (ability.getAbilityType() == AbilityType.MANA) { continue; } List options = game.getPlayer(playerId).getPlayableOptions(ability, game); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java index 3c80b69c65..04ed14327f 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java @@ -91,7 +91,7 @@ public final class ArtificialScoringSystem { Outcome outcome = effect.getOutcome(); if (outcome.isGood()) { enchantments++; - } else if (!outcome.equals(Outcome.Detriment)) { + } else if (outcome != Outcome.Detriment) { enchantments--; } } diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/OutcomeOptimizer.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/OutcomeOptimizer.java index d2e22c0062..c80f585cc7 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/OutcomeOptimizer.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/OutcomeOptimizer.java @@ -23,7 +23,7 @@ public class OutcomeOptimizer extends BaseTreeOptimizer { public void filter(Game game, List actions) { for (Ability ability : actions) { for (Effect effect: ability.getEffects()) { - if (effect.getOutcome().equals(Outcome.AIDontUseIt)) { + if (effect.getOutcome() == Outcome.AIDontUseIt) { removeAbility(ability); break; } diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index b33381c435..0f12ea9244 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -230,7 +230,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } if (target.getOriginalTarget() instanceof TargetCardInHand - || (target.getZone().equals(Zone.HAND) && (target.getOriginalTarget() instanceof TargetCard))) { + || (target.getZone() == Zone.HAND && (target.getOriginalTarget() instanceof TargetCard))) { List cards = new ArrayList<>(); for (UUID cardId : target.possibleTargets(sourceId, this.getId(), game)) { Card card = game.getCard(cardId); @@ -759,7 +759,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } UUID opponentId = game.getOpponents(playerId).iterator().next(); if (target.getOriginalTarget() instanceof TargetCreatureOrPlayerAmount) { - if (outcome.equals(Outcome.Damage) && game.getPlayer(opponentId).getLife() <= target.getAmountRemaining()) { + if (outcome == Outcome.Damage && game.getPlayer(opponentId).getLife() <= target.getAmountRemaining()) { target.addTarget(opponentId, target.getAmountRemaining(), source, game); return true; } @@ -1265,7 +1265,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { // Be proactive! Always use abilities, the evaluation function will decide if it's good or not // Otherwise some abilities won't be used by AI like LoseTargetEffect that has "bad" outcome // but still is good when targets opponent - return !outcome.equals(Outcome.AIDontUseIt); // Added for Desecration Demon sacrifice ability + return outcome != Outcome.AIDontUseIt; // Added for Desecration Demon sacrifice ability } @Override @@ -1276,7 +1276,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { chooseCreatureType(outcome, choice, game); } // choose the correct color to pay a spell - if (outcome.equals(Outcome.PutManaInPool) && choice instanceof ChoiceColor && currentUnpaidMana != null) { + if (outcome == Outcome.PutManaInPool && choice instanceof ChoiceColor && currentUnpaidMana != null) { if (currentUnpaidMana.containsColor(ColoredManaSymbol.W) && choice.getChoices().contains("White")) { choice.setChoice("White"); return true; @@ -1319,7 +1319,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } protected boolean chooseCreatureType(Outcome outcome, Choice choice, Game game) { - if (outcome.equals(Outcome.Detriment)) { + if (outcome == Outcome.Detriment) { // choose a creature type of opponent on battlefield or graveyard for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) { if (game.getOpponents(this.getId()).contains(permanent.getControllerId()) @@ -1391,7 +1391,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { // We don't have any valid target to choose so stop choosing return target.getTargets().size() < target.getNumberOfTargets(); } - if (outcome.equals(Outcome.Neutral) && target.getTargets().size() > target.getNumberOfTargets() + (target.getMaxNumberOfTargets() - target.getNumberOfTargets()) / 2) { + if (outcome == Outcome.Neutral && target.getTargets().size() > target.getNumberOfTargets() + (target.getMaxNumberOfTargets() - target.getNumberOfTargets()) / 2) { return true; } } @@ -1415,7 +1415,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { // We don't have any valid target to choose so stop choosing break; } - if (outcome.equals(Outcome.Neutral) && target.getTargets().size() > target.getNumberOfTargets() + (target.getMaxNumberOfTargets() - target.getNumberOfTargets()) / 2) { + if (outcome == Outcome.Neutral && target.getTargets().size() > target.getNumberOfTargets() + (target.getMaxNumberOfTargets() - target.getNumberOfTargets()) / 2) { return true; } } @@ -2076,7 +2076,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { for (Card card : this.playableInstant) { if (card.getSpellAbility().canActivate(playerId, game)) { for (Effect effect : card.getSpellAbility().getEffects()) { - if (effect.getOutcome().equals(Outcome.DestroyPermanent) || effect.getOutcome().equals(Outcome.ReturnToHand)) { + if (effect.getOutcome() == Outcome.DestroyPermanent || effect.getOutcome() == Outcome.ReturnToHand) { if (card.getSpellAbility().getTargets().get(0).canTarget(creatureId, card.getSpellAbility(), game)) { if (this.activateAbility(card.getSpellAbility(), game)) { return; diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java index c409e2d264..bdd761b68d 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/utils/RateCard.java @@ -83,11 +83,11 @@ public final class RateCard { for (Ability ability : card.getAbilities()) { for (Effect effect : ability.getEffects()) { - if (effect.getOutcome().equals(Outcome.Removal)) { + if (effect.getOutcome() == Outcome.Removal) { log.debug("Found removal: " + card.getName()); return 1; } - if (effect.getOutcome().equals(Outcome.Damage)) { + if (effect.getOutcome() == Outcome.Damage) { if (effect instanceof DamageTargetEffect) { DamageTargetEffect damageEffect = (DamageTargetEffect) effect; if (damageEffect.getAmount() > 1) { @@ -100,7 +100,7 @@ public final class RateCard { } } } - if (effect.getOutcome().equals(Outcome.DestroyPermanent)) { + if (effect.getOutcome() == Outcome.DestroyPermanent) { for (Target target : ability.getTargets()) { if (target instanceof TargetCreaturePermanent) { log.debug("Found destroyer: " + card.getName()); diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 6fe57b2d0a..afc14c45f3 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -297,7 +297,7 @@ public class HumanPlayer extends PlayerImpl { @Override public boolean choose(Outcome outcome, Choice choice, Game game) { - if (Outcome.PutManaInPool.equals(outcome)) { + if (Outcome.PutManaInPool == outcome) { if (currentlyUnpaidMana != null && ManaUtil.tryToAutoSelectAManaColor(choice, currentlyUnpaidMana)) { return true; @@ -593,12 +593,12 @@ public class HumanPlayer extends PlayerImpl { } } if (getJustActivatedType() != null && !holdingPriority) { - if (controllingPlayer.getUserData().isPassPriorityCast() && getJustActivatedType().equals(AbilityType.SPELL)) { + if (controllingPlayer.getUserData().isPassPriorityCast() && getJustActivatedType() == AbilityType.SPELL) { setJustActivatedType(null); pass(game); return false; } - if (controllingPlayer.getUserData().isPassPriorityActivation() && getJustActivatedType().equals(AbilityType.ACTIVATED)) { + if (controllingPlayer.getUserData().isPassPriorityActivation() && getJustActivatedType() == AbilityType.ACTIVATED) { setJustActivatedType(null); pass(game); return false; @@ -612,7 +612,7 @@ public class HumanPlayer extends PlayerImpl { } if (passedUntilEndStepBeforeMyTurn) { - if (!game.getTurn().getStepType().equals(PhaseStep.END_TURN)) { + if (game.getTurn().getStepType() != PhaseStep.END_TURN) { if (passWithManaPoolCheck(game)) { return false; } @@ -634,7 +634,7 @@ public class HumanPlayer extends PlayerImpl { } } if (passedUntilNextMain) { - if (game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN)) { + if (game.getTurn().getStepType() == PhaseStep.POSTCOMBAT_MAIN || game.getTurn().getStepType() == PhaseStep.PRECOMBAT_MAIN) { // it's a main phase if (!skippedAtLeastOnce || (!playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllMainPhases())) { skippedAtLeastOnce = true; @@ -653,7 +653,7 @@ public class HumanPlayer extends PlayerImpl { } } if (passedUntilEndOfTurn) { - if (game.getTurn().getStepType().equals(PhaseStep.END_TURN)) { + if (game.getTurn().getStepType() == PhaseStep.END_TURN) { // It's end of turn phase if (!skippedAtLeastOnce || (playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllEndPhases())) { skippedAtLeastOnce = true; @@ -1376,7 +1376,7 @@ public class HumanPlayer extends PlayerImpl { } } } - if (!source.getAbilityType().equals(AbilityType.TRIGGERED)) { + if (source.getAbilityType() != AbilityType.TRIGGERED) { done = true; } if (!canRespond()) { @@ -1407,7 +1407,7 @@ public class HumanPlayer extends PlayerImpl { public void setResponseString(String responseString) { synchronized (response) { response.setString(responseString); - response.notify(); + response.notifyAll(); logger.debug("Got response string from player: " + getId()); } } @@ -1417,7 +1417,7 @@ public class HumanPlayer extends PlayerImpl { synchronized (response) { response.setManaType(manaType); response.setResponseManaTypePlayerId(manaTypePlayerId); - response.notify(); + response.notifyAll(); logger.debug("Got response mana type from player: " + getId()); } } @@ -1426,7 +1426,7 @@ public class HumanPlayer extends PlayerImpl { public void setResponseUUID(UUID responseUUID) { synchronized (response) { response.setUUID(responseUUID); - response.notify(); + response.notifyAll(); logger.debug("Got response UUID from player: " + getId()); } } @@ -1435,7 +1435,7 @@ public class HumanPlayer extends PlayerImpl { public void setResponseBoolean(Boolean responseBoolean) { synchronized (response) { response.setBoolean(responseBoolean); - response.notify(); + response.notifyAll(); logger.debug("Got response boolean from player: " + getId()); } } @@ -1444,7 +1444,7 @@ public class HumanPlayer extends PlayerImpl { public void setResponseInteger(Integer responseInteger) { synchronized (response) { response.setInteger(responseInteger); - response.notify(); + response.notifyAll(); logger.debug("Got response integer from player: " + getId()); } } @@ -1453,7 +1453,7 @@ public class HumanPlayer extends PlayerImpl { public void abort() { abort = true; synchronized (response) { - response.notify(); + response.notifyAll(); logger.debug("Got cancel action from player: " + getId()); } } @@ -1462,7 +1462,7 @@ public class HumanPlayer extends PlayerImpl { public void skip() { synchronized (response) { response.setInteger(0); - response.notify(); + response.notifyAll(); logger.debug("Got skip action from player: " + getId()); } } @@ -1516,7 +1516,7 @@ public class HumanPlayer extends PlayerImpl { } private void setRequestAutoAnswer(PlayerAction playerAction, Game game, Object data) { - if (playerAction.equals(REQUEST_AUTO_ANSWER_RESET_ALL)) { + if (playerAction == REQUEST_AUTO_ANSWER_RESET_ALL) { requestAutoAnswerId.clear(); requestAutoAnswerText.clear(); return; @@ -1541,7 +1541,7 @@ public class HumanPlayer extends PlayerImpl { } private void setTriggerAutoOrder(PlayerAction playerAction, Game game, Object data) { - if (playerAction.equals(TRIGGER_AUTO_ORDER_RESET_ALL)) { + if (playerAction == TRIGGER_AUTO_ORDER_RESET_ALL) { triggerAutoOrderAbilityFirst.clear(); triggerAutoOrderAbilityLast.clear(); triggerAutoOrderNameFirst.clear(); diff --git a/Mage.Sets/src/mage/cards/a/AAT1.java b/Mage.Sets/src/mage/cards/a/AAT1.java index 77ccc46c2d..7f3ba047c4 100644 --- a/Mage.Sets/src/mage/cards/a/AAT1.java +++ b/Mage.Sets/src/mage/cards/a/AAT1.java @@ -80,42 +80,44 @@ public class AAT1 extends CardImpl { public AAT1 copy() { return new AAT1(this); } -} -class AAT1TriggeredAbility extends TriggeredAbilityImpl { + private static class AAT1TriggeredAbility extends TriggeredAbilityImpl { - public AAT1TriggeredAbility(Effect effect) { - super(Zone.BATTLEFIELD, effect); - } - - public AAT1TriggeredAbility(AAT1TriggeredAbility ability) { - super(ability); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.COUNTER_REMOVED; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Card card = game.getCard(event.getTargetId()); - if (event.getPlayerId().equals(game.getControllerId(sourceId)) - && card.isCreature() - && game.getState().getZone(card.getId()) == Zone.GRAVEYARD - && event.getData().equals("repair")) { - return true; + public AAT1TriggeredAbility(Effect effect) { + super(Zone.BATTLEFIELD, effect); } - return false; - } - @Override - public String getRule() { - return "Whenever a repair counter is removed from a creature card in your graveyard " + super.getRule(); - } + public AAT1TriggeredAbility(AAT1TriggeredAbility ability) { + super(ability); + } - @Override - public AAT1TriggeredAbility copy() { - return new AAT1TriggeredAbility(this); + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.COUNTER_REMOVED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Card card = game.getCard(event.getTargetId()); + if (event.getPlayerId().equals(game.getControllerId(sourceId)) + && card.isCreature() + && game.getState().getZone(card.getId()) == Zone.GRAVEYARD + && event.getData().equals("repair")) { + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever a repair counter is removed from a creature card in your graveyard " + super.getRule(); + } + + @Override + public AAT1TriggeredAbility copy() { + return new AAT1TriggeredAbility(this); + } } } + + diff --git a/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java b/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java index 6d064dd8c4..2c80e8e625 100644 --- a/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java +++ b/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java @@ -94,7 +94,7 @@ class AlhammarretsArchiveEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType().equals(GameEvent.EventType.GAIN_LIFE); + return event.getType() == GameEvent.EventType.GAIN_LIFE; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AlphaAuthority.java b/Mage.Sets/src/mage/cards/a/AlphaAuthority.java index 94039aa8c0..eb011deb6a 100644 --- a/Mage.Sets/src/mage/cards/a/AlphaAuthority.java +++ b/Mage.Sets/src/mage/cards/a/AlphaAuthority.java @@ -100,7 +100,7 @@ class CantBeBlockedByMoreThanOneAttachedEffect extends ContinuousEffectImpl { super(duration, Outcome.Benefit); this.amount = amount; this.attachmentType = attachmentType; - staticText = (attachmentType.equals(AttachmentType.AURA) ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s"); + staticText = (attachmentType == AttachmentType.AURA ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s"); } public CantBeBlockedByMoreThanOneAttachedEffect(final CantBeBlockedByMoreThanOneAttachedEffect effect) { diff --git a/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java b/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java index a34cdf61fb..8a50865842 100644 --- a/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java +++ b/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java @@ -135,7 +135,7 @@ class AnafenzaTheForemostEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType().equals(GameEvent.EventType.ZONE_CHANGE); + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AnthemOfRakdos.java b/Mage.Sets/src/mage/cards/a/AnthemOfRakdos.java index 177cb5bfca..30c7c41e68 100644 --- a/Mage.Sets/src/mage/cards/a/AnthemOfRakdos.java +++ b/Mage.Sets/src/mage/cards/a/AnthemOfRakdos.java @@ -96,7 +96,7 @@ class AnthemOfRakdosHellbentEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DAMAGE_CREATURE - || event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); + || event.getType() == GameEvent.EventType.DAMAGE_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/a/AquamorphEntity.java b/Mage.Sets/src/mage/cards/a/AquamorphEntity.java index fcb6eb219b..7a56b32b9f 100644 --- a/Mage.Sets/src/mage/cards/a/AquamorphEntity.java +++ b/Mage.Sets/src/mage/cards/a/AquamorphEntity.java @@ -117,7 +117,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl { } } } - if (event.getType().equals(EventType.TURNFACEUP)) { + if (event.getType() == EventType.TURNFACEUP) { if (event.getTargetId().equals(source.getSourceId())) { return true; } diff --git a/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java b/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java index 478e768865..7acc93f8e1 100644 --- a/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java +++ b/Mage.Sets/src/mage/cards/a/AthreosGodOfPassage.java @@ -136,7 +136,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect { } } if (opponent == null || !paid) { - if (game.getState().getZone(creature.getId()).equals(Zone.GRAVEYARD)) { + if (game.getState().getZone(creature.getId()) == Zone.GRAVEYARD) { controller.moveCards(game.getCard(creatureId), Zone.HAND, source, game); } } @@ -174,7 +174,7 @@ class AthreosDiesCreatureTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) { + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/cards/b/BurningVengeance.java b/Mage.Sets/src/mage/cards/b/BurningVengeance.java index bd02c8b3a5..24a100e866 100644 --- a/Mage.Sets/src/mage/cards/b/BurningVengeance.java +++ b/Mage.Sets/src/mage/cards/b/BurningVengeance.java @@ -83,7 +83,7 @@ class BurningVengeanceOnCastAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getPlayerId().equals(controllerId) && event.getZone().equals(Zone.GRAVEYARD); + return event.getPlayerId().equals(controllerId) && event.getZone() == Zone.GRAVEYARD; } @Override diff --git a/Mage.Sets/src/mage/cards/c/CelestialDawn.java b/Mage.Sets/src/mage/cards/c/CelestialDawn.java index 5fa6cd39e1..a2ed2dc60a 100644 --- a/Mage.Sets/src/mage/cards/c/CelestialDawn.java +++ b/Mage.Sets/src/mage/cards/c/CelestialDawn.java @@ -273,7 +273,7 @@ class CelestialDawnSpendColorlessManaEffect extends AsThoughEffectImpl implement @Override public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) { - if (mana.getWhite() == 0 && !ManaType.COLORLESS.equals(manaType)) { + if (mana.getWhite() == 0 && ManaType.COLORLESS != manaType) { return null; } return manaType; diff --git a/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java b/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java index abdf483ce1..b96ff02532 100644 --- a/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java +++ b/Mage.Sets/src/mage/cards/c/ChainsOfMephistopheles.java @@ -115,7 +115,7 @@ class ChainsOfMephistophelesReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType().equals(PhaseStep.DRAW)) { + if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getPhase().getStep().getType() == PhaseStep.DRAW) { CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep"); if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) { return true; diff --git a/Mage.Sets/src/mage/cards/c/CoffinQueen.java b/Mage.Sets/src/mage/cards/c/CoffinQueen.java index 7ca8251bd6..b51adf9b8d 100644 --- a/Mage.Sets/src/mage/cards/c/CoffinQueen.java +++ b/Mage.Sets/src/mage/cards/c/CoffinQueen.java @@ -138,11 +138,11 @@ class CoffinQueenDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (GameEvent.EventType.LOST_CONTROL.equals(event.getType()) + if (EventType.LOST_CONTROL == event.getType() && event.getSourceId().equals(getSourceId())) { return true; } - return GameEvent.EventType.UNTAPPED.equals(event.getType()) + return EventType.UNTAPPED == event.getType() && event.getTargetId() != null && event.getTargetId().equals(getSourceId()); } diff --git a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java index 990e3ca775..df5a9eae31 100644 --- a/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java +++ b/Mage.Sets/src/mage/cards/d/DanceOfTheDead.java @@ -218,7 +218,7 @@ class DanceOfTheDeadAttachEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getFirstTarget()); - if (card != null && game.getState().getZone(source.getFirstTarget()).equals(Zone.GRAVEYARD)) { + if (card != null && game.getState().getZone(source.getFirstTarget()) == Zone.GRAVEYARD) { // Card have no attachedTo attribute yet so write ref only to enchantment now Permanent enchantment = game.getPermanent(source.getSourceId()); if (enchantment != null) { diff --git a/Mage.Sets/src/mage/cards/d/DiviningWitch.java b/Mage.Sets/src/mage/cards/d/DiviningWitch.java index 09a05685f1..47295968c6 100644 --- a/Mage.Sets/src/mage/cards/d/DiviningWitch.java +++ b/Mage.Sets/src/mage/cards/d/DiviningWitch.java @@ -76,63 +76,65 @@ public class DiviningWitch extends CardImpl { public DiviningWitch copy() { return new DiviningWitch(this); } -} -class DiviningWitchEffect extends OneShotEffect { + private static class DiviningWitchEffect extends OneShotEffect { - DiviningWitchEffect() { - super(Outcome.Benefit); - this.staticText = "Name a card. Exile the top six cards of your library. Reveal cards from the top of your library until you reveal the named card, then put that card into your hand. Exile all other cards revealed this way"; - } + DiviningWitchEffect() { + super(Outcome.Benefit); + this.staticText = "Name a card. Exile the top six cards of your library. Reveal cards from the top of your library until you reveal the named card, then put that card into your hand. Exile all other cards revealed this way"; + } - DiviningWitchEffect(final DiviningWitchEffect effect) { - super(effect); - } + DiviningWitchEffect(final DiviningWitchEffect effect) { + super(effect); + } - @Override - public DiviningWitchEffect copy() { - return new DiviningWitchEffect(this); - } + @Override + public DiviningWitchEffect copy() { + return new DiviningWitchEffect(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) { - // Name a card. - Choice choice = new ChoiceImpl(); - choice.setChoices(CardRepository.instance.getNames()); - while (!controller.choose(Outcome.Benefit, choice, game)) { - if (!controller.canRespond()) { - return false; - } - } - String name = choice.getChoice(); - game.informPlayers("Card named: " + name); - - // Exile the top six cards of your library, - controller.moveCards(controller.getLibrary().getTopCards(game, 6), Zone.EXILED, source, game); - - // then reveal cards from the top of your library until you reveal the named card. - Cards cardsToReaveal = new CardsImpl(); - Card cardToHand = null; - while (controller.getLibrary().hasCards()) { - Card card = controller.getLibrary().removeFromTop(game); - if (card != null) { - cardsToReaveal.add(card); - // Put that card into your hand - if (card.getName().equals(name)) { - cardToHand = card; - break; + @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) { + // Name a card. + Choice choice = new ChoiceImpl(); + choice.setChoices(CardRepository.instance.getNames()); + while (!controller.choose(Outcome.Benefit, choice, game)) { + if (!controller.canRespond()) { + return false; } } + String name = choice.getChoice(); + game.informPlayers("Card named: " + name); + + // Exile the top six cards of your library, + controller.moveCards(controller.getLibrary().getTopCards(game, 6), Zone.EXILED, source, game); + + // then reveal cards from the top of your library until you reveal the named card. + Cards cardsToReaveal = new CardsImpl(); + Card cardToHand = null; + while (controller.getLibrary().hasCards()) { + Card card = controller.getLibrary().removeFromTop(game); + if (card != null) { + cardsToReaveal.add(card); + // Put that card into your hand + if (card.getName().equals(name)) { + cardToHand = card; + break; + } + } + } + controller.moveCards(cardToHand, Zone.HAND, source, game); + controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game); + cardsToReaveal.remove(cardToHand); + controller.moveCards(cardsToReaveal, Zone.EXILED, source, game); + return true; } - controller.moveCards(cardToHand, Zone.HAND, source, game); - controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game); - cardsToReaveal.remove(cardToHand); - controller.moveCards(cardsToReaveal, Zone.EXILED, source, game); - return true; + return false; } - return false; } } + + diff --git a/Mage.Sets/src/mage/cards/e/EliteArcanist.java b/Mage.Sets/src/mage/cards/e/EliteArcanist.java index 1e3f659ed6..c3f3d5816e 100644 --- a/Mage.Sets/src/mage/cards/e/EliteArcanist.java +++ b/Mage.Sets/src/mage/cards/e/EliteArcanist.java @@ -168,7 +168,7 @@ class EliteArcanistCopyEffect extends OneShotEffect { } if (sourcePermanent != null && sourcePermanent.getImprinted() != null && !sourcePermanent.getImprinted().isEmpty()) { Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0)); - if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) { + if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java index 0bf68ea784..41ff18625b 100644 --- a/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java +++ b/Mage.Sets/src/mage/cards/e/EpiphanyAtTheDrownyard.java @@ -145,7 +145,7 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect { pile2Zone = Zone.GRAVEYARD; } - StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(": "); + StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone == Zone.HAND ? "Hand" : "Graveyard").append(": "); int i = 0; for (UUID cardUuid : pile1CardsIds) { i++; @@ -160,7 +160,7 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':'); + sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone == Zone.HAND ? "Hand" : "Graveyard").append(':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); diff --git a/Mage.Sets/src/mage/cards/f/FactOrFiction.java b/Mage.Sets/src/mage/cards/f/FactOrFiction.java index 47499ae08c..da45ca2022 100644 --- a/Mage.Sets/src/mage/cards/f/FactOrFiction.java +++ b/Mage.Sets/src/mage/cards/f/FactOrFiction.java @@ -125,7 +125,7 @@ class FactOrFictionEffect extends OneShotEffect { pile2Zone = Zone.GRAVEYARD; } - StringBuilder sb = new StringBuilder("Pile 1, going to ").append(pile1Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(": "); + StringBuilder sb = new StringBuilder("Pile 1, going to ").append(pile1Zone == Zone.HAND ? "Hand" : "Graveyard").append(": "); int i = 0; for (Card card : pile1) { i++; diff --git a/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java b/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java index 615eecbfc5..2722cd935a 100644 --- a/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java +++ b/Mage.Sets/src/mage/cards/g/GiftOfImmortality.java @@ -136,7 +136,7 @@ class GiftOfImmortalityReturnEnchantmentEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Card aura = game.getCard(source.getSourceId()); - if (aura != null && game.getState().getZone(aura.getId()).equals(Zone.GRAVEYARD)) { + if (aura != null && game.getState().getZone(aura.getId()) == Zone.GRAVEYARD) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && creature != null) { diff --git a/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java b/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java index b28a3b874d..14186d4b5f 100644 --- a/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java +++ b/Mage.Sets/src/mage/cards/g/GontiLordOfLuxury.java @@ -270,7 +270,7 @@ class GontiLordOfLuxuryLookEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) { + if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { diff --git a/Mage.Sets/src/mage/cards/g/GracefulReprieve.java b/Mage.Sets/src/mage/cards/g/GracefulReprieve.java index 809a58e45b..f727f6d91b 100644 --- a/Mage.Sets/src/mage/cards/g/GracefulReprieve.java +++ b/Mage.Sets/src/mage/cards/g/GracefulReprieve.java @@ -165,7 +165,7 @@ class GracefulReprieveDelayedEffect extends OneShotEffect { Player player = game.getPlayer(permanent.getOwnerId()); if (player != null) { Card card = game.getCard(target); - if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { + if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) { return card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), player.getId()); } return true; diff --git a/Mage.Sets/src/mage/cards/g/GrafdiggersCage.java b/Mage.Sets/src/mage/cards/g/GrafdiggersCage.java index 358ec75623..bc07a31920 100644 --- a/Mage.Sets/src/mage/cards/g/GrafdiggersCage.java +++ b/Mage.Sets/src/mage/cards/g/GrafdiggersCage.java @@ -88,7 +88,7 @@ class GrafdiggersCageEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return EventType.ZONE_CHANGE.equals(event.getType()); + return EventType.ZONE_CHANGE == event.getType(); } @Override diff --git a/Mage.Sets/src/mage/cards/g/GreaterHarvester.java b/Mage.Sets/src/mage/cards/g/GreaterHarvester.java index 5e1c3e63f2..dcb5e5a2cd 100644 --- a/Mage.Sets/src/mage/cards/g/GreaterHarvester.java +++ b/Mage.Sets/src/mage/cards/g/GreaterHarvester.java @@ -82,7 +82,7 @@ class GreaterHarvesterAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return EventType.DAMAGED_PLAYER.equals(event.getType()); + return EventType.DAMAGED_PLAYER == event.getType(); } diff --git a/Mage.Sets/src/mage/cards/g/GrimoireThief.java b/Mage.Sets/src/mage/cards/g/GrimoireThief.java index 2a52958e34..538f528b05 100644 --- a/Mage.Sets/src/mage/cards/g/GrimoireThief.java +++ b/Mage.Sets/src/mage/cards/g/GrimoireThief.java @@ -167,7 +167,7 @@ class GrimoireThiefLookEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) { + if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { diff --git a/Mage.Sets/src/mage/cards/g/GruesomeEncore.java b/Mage.Sets/src/mage/cards/g/GruesomeEncore.java index 18c8e87568..162c5f0259 100644 --- a/Mage.Sets/src/mage/cards/g/GruesomeEncore.java +++ b/Mage.Sets/src/mage/cards/g/GruesomeEncore.java @@ -150,8 +150,8 @@ class GruesomeEncoreReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { return event.getTargetId().equals(source.getFirstTarget()) - && ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD) - && !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED); + && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD + && ((ZoneChangeEvent) event).getToZone() != Zone.EXILED; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HavengulLich.java b/Mage.Sets/src/mage/cards/h/HavengulLich.java index 3f2fc45ec7..e52f632b64 100644 --- a/Mage.Sets/src/mage/cards/h/HavengulLich.java +++ b/Mage.Sets/src/mage/cards/h/HavengulLich.java @@ -117,7 +117,7 @@ class HavengulLichPlayEffect extends AsThoughEffectImpl { if (targetId != null) { return targetId.equals(objectId) && source.getControllerId().equals(affectedControllerId) - && Zone.GRAVEYARD.equals(game.getState().getZone(objectId)); + && Zone.GRAVEYARD == game.getState().getZone(objectId); } else { // the target card has changed zone meanwhile, so the effect is no longer needed discard(); diff --git a/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java b/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java index 770d21f64b..d1e72db9ee 100644 --- a/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java +++ b/Mage.Sets/src/mage/cards/h/HomuraHumanAscendant.java @@ -110,7 +110,7 @@ class HomuraReturnFlippedSourceEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Card sourceCard = game.getCard(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); - if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { + if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), ""); game.addEffect(effect, source); controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/h/Humility.java b/Mage.Sets/src/mage/cards/h/Humility.java index a5eb89a30c..800299bd3e 100644 --- a/Mage.Sets/src/mage/cards/h/Humility.java +++ b/Mage.Sets/src/mage/cards/h/Humility.java @@ -95,7 +95,7 @@ class HumilityEffect extends ContinuousEffectImpl { permanent.removeAllAbilities(source.getSourceId(), game); break; case PTChangingEffects_7: - if (sublayer.equals(SubLayer.SetPT_7b)) { + if (sublayer == SubLayer.SetPT_7b) { permanent.getPower().setValue(1); permanent.getToughness().setValue(1); } diff --git a/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java b/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java index 29a59add1b..a8dfc60f0e 100644 --- a/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java +++ b/Mage.Sets/src/mage/cards/i/IntetTheDreamer.java @@ -152,7 +152,7 @@ class IntetTheDreamerCastEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) { + if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { @@ -200,7 +200,7 @@ class IntetTheDreamerLookEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) { + if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { diff --git a/Mage.Sets/src/mage/cards/i/IslandSanctuary.java b/Mage.Sets/src/mage/cards/i/IslandSanctuary.java index a17111a8e5..fbbdb5dd5e 100644 --- a/Mage.Sets/src/mage/cards/i/IslandSanctuary.java +++ b/Mage.Sets/src/mage/cards/i/IslandSanctuary.java @@ -107,7 +107,7 @@ class IslandSanctuaryEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - return source.getControllerId().equals(event.getPlayerId()) && game.getTurn().getStepType().equals(PhaseStep.DRAW); + return source.getControllerId().equals(event.getPlayerId()) && game.getTurn().getStepType() == PhaseStep.DRAW; } @Override diff --git a/Mage.Sets/src/mage/cards/i/IsochronScepter.java b/Mage.Sets/src/mage/cards/i/IsochronScepter.java index 1ff39c48c8..9933530932 100644 --- a/Mage.Sets/src/mage/cards/i/IsochronScepter.java +++ b/Mage.Sets/src/mage/cards/i/IsochronScepter.java @@ -154,7 +154,7 @@ class IsochronScepterCopyEffect extends OneShotEffect { Permanent scepter = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) { Card imprintedInstant = game.getCard(scepter.getImprinted().get(0)); - if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) { + if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) { if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) { Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); if (copiedCard != null) { diff --git a/Mage.Sets/src/mage/cards/k/KalitasTraitorOfGhet.java b/Mage.Sets/src/mage/cards/k/KalitasTraitorOfGhet.java index b938e14868..f1a68420e7 100644 --- a/Mage.Sets/src/mage/cards/k/KalitasTraitorOfGhet.java +++ b/Mage.Sets/src/mage/cards/k/KalitasTraitorOfGhet.java @@ -141,7 +141,7 @@ class KalitasTraitorOfGhetEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType().equals(GameEvent.EventType.ZONE_CHANGE); + return event.getType() == GameEvent.EventType.ZONE_CHANGE; } @Override diff --git a/Mage.Sets/src/mage/cards/k/KembasLegion.java b/Mage.Sets/src/mage/cards/k/KembasLegion.java index 12eb42a40f..7b5fa0da0a 100644 --- a/Mage.Sets/src/mage/cards/k/KembasLegion.java +++ b/Mage.Sets/src/mage/cards/k/KembasLegion.java @@ -94,7 +94,7 @@ class KembasLegionEffect extends ContinuousEffectImpl { public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && !permanent.getAttachments().isEmpty()) { - if (layer.equals(Layer.RulesEffects)) { + if (layer == Layer.RulesEffects) { // maxBlocks = 0 equals to "can block any number of creatures" if (permanent.getMaxBlocks() > 0) { List attachments = permanent.getAttachments(); diff --git a/Mage.Sets/src/mage/cards/k/KheruLichLord.java b/Mage.Sets/src/mage/cards/k/KheruLichLord.java index f27bffcaa4..f1b90e5c62 100644 --- a/Mage.Sets/src/mage/cards/k/KheruLichLord.java +++ b/Mage.Sets/src/mage/cards/k/KheruLichLord.java @@ -184,8 +184,8 @@ class KheruLichLordReplacementEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(getTargetPointer().getFirst(game, source)) - && ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD) - && !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED)) { + && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD + && ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/l/LeoninArbiter.java b/Mage.Sets/src/mage/cards/l/LeoninArbiter.java index 8dbb86850a..50652ef6a4 100644 --- a/Mage.Sets/src/mage/cards/l/LeoninArbiter.java +++ b/Mage.Sets/src/mage/cards/l/LeoninArbiter.java @@ -154,7 +154,7 @@ class LeoninArbiterCantSearchEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return EventType.SEARCH_LIBRARY.equals(event.getType()); + return EventType.SEARCH_LIBRARY == event.getType(); } @Override diff --git a/Mage.Sets/src/mage/cards/l/LifeAndLimb.java b/Mage.Sets/src/mage/cards/l/LifeAndLimb.java index 8efb4e38b3..f3024e3fb3 100644 --- a/Mage.Sets/src/mage/cards/l/LifeAndLimb.java +++ b/Mage.Sets/src/mage/cards/l/LifeAndLimb.java @@ -128,7 +128,7 @@ class LifeAndLimbEffect extends ContinuousEffectImpl { } break; case PTChangingEffects_7: - if (sublayer.equals(SubLayer.SetPT_7b)) { + if (sublayer == SubLayer.SetPT_7b) { permanent.getPower().setValue(1); permanent.getToughness().setValue(1); } diff --git a/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java b/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java index 1e3abe8c27..250d59acf8 100644 --- a/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java +++ b/Mage.Sets/src/mage/cards/m/MeanderingTowershell.java @@ -187,7 +187,7 @@ class MeanderingTowershellReturnEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Card card = game.getCard(source.getSourceId()); - if (card != null && game.getState().getZone(source.getSourceId()).equals(Zone.EXILED)) { + if (card != null && game.getState().getZone(source.getSourceId()) == Zone.EXILED) { controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); game.getCombat().addAttackingCreature(card.getId(), game); return true; diff --git a/Mage.Sets/src/mage/cards/m/Mindreaver.java b/Mage.Sets/src/mage/cards/m/Mindreaver.java index 593b3ef29d..9fac6fcd52 100644 --- a/Mage.Sets/src/mage/cards/m/Mindreaver.java +++ b/Mage.Sets/src/mage/cards/m/Mindreaver.java @@ -151,7 +151,7 @@ class MindreaverNamePredicate implements Predicate { // A split card has the chosen name if one of its two names matches the chosen name. if (input instanceof SplitCard) { return cardNames.contains(((SplitCard) input).getLeftHalfCard().getName()) || cardNames.contains(((SplitCard) input).getRightHalfCard().getName()); - } else if (input instanceof Spell && ((Spell) input).getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) { + } else if (input instanceof Spell && ((Spell) input).getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) { SplitCard card = (SplitCard) ((Spell) input).getCard(); return cardNames.contains(card.getLeftHalfCard().getName()) || cardNames.contains(card.getRightHalfCard().getName()); } else { diff --git a/Mage.Sets/src/mage/cards/n/NotionThief.java b/Mage.Sets/src/mage/cards/n/NotionThief.java index d8a1c3e6a6..0a5c5e4042 100644 --- a/Mage.Sets/src/mage/cards/n/NotionThief.java +++ b/Mage.Sets/src/mage/cards/n/NotionThief.java @@ -114,7 +114,7 @@ class NotionThiefReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { - if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getStep().getType().equals(PhaseStep.DRAW)) { + if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getStep().getType() == PhaseStep.DRAW) { CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep"); if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) { return true; diff --git a/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java b/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java index 19a2581e67..cc9189ba60 100644 --- a/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java +++ b/Mage.Sets/src/mage/cards/o/ObzedatGhostCouncil.java @@ -176,7 +176,7 @@ class ObzedatGhostCouncilReturnEffect extends OneShotEffect { if (card != null) { Zone zone = game.getState().getZone(source.getSourceId()); // return it from every public zone - http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/513186-obzedat-gc-as-edh-commander - if (!zone.equals(Zone.BATTLEFIELD) && !zone.equals(Zone.LIBRARY) && !zone.equals(Zone.HAND)) { + if (zone != Zone.BATTLEFIELD && zone != Zone.LIBRARY && zone != Zone.HAND) { Player owner = game.getPlayer(card.getOwnerId()); if (owner != null) { owner.moveCards(card, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java b/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java index 0523be13ea..1c24520f24 100644 --- a/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java +++ b/Mage.Sets/src/mage/cards/o/OtherworldlyJourney.java @@ -169,7 +169,7 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return EventType.ENTERS_THE_BATTLEFIELD.equals(event.getType()); + return EventType.ENTERS_THE_BATTLEFIELD == event.getType(); } @Override diff --git a/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java b/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java index 43c431e59b..9c79c1a2d7 100644 --- a/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java +++ b/Mage.Sets/src/mage/cards/p/PersonalSanctuary.java @@ -94,7 +94,7 @@ class PersonalSanctuaryEffect extends PreventionEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)) { + if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) { if (event.getTargetId().equals(source.getControllerId()) && game.getActivePlayerId().equals(source.getControllerId())) return super.applies(event, source, game); } diff --git a/Mage.Sets/src/mage/cards/p/PhantomCentaur.java b/Mage.Sets/src/mage/cards/p/PhantomCentaur.java index 924c5e8b20..d8c31b16ca 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomCentaur.java +++ b/Mage.Sets/src/mage/cards/p/PhantomCentaur.java @@ -117,7 +117,7 @@ class PhantomCentaurPreventionEffect extends PreventionEffectImpl { if (permanent != null) { boolean removeCounter = true; // check if in the same combat damage step already a counter was removed - if (game.getTurn().getPhase().getStep().getType().equals(PhaseStep.COMBAT_DAMAGE)) { + if (game.getTurn().getPhase().getStep().getType() == PhaseStep.COMBAT_DAMAGE) { if (game.getTurnNum() == turn && game.getTurn().getStep().equals(combatPhaseStep)) { removeCounter = false; diff --git a/Mage.Sets/src/mage/cards/p/PhantomFlock.java b/Mage.Sets/src/mage/cards/p/PhantomFlock.java index 517d927afb..d3e4c787d9 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomFlock.java +++ b/Mage.Sets/src/mage/cards/p/PhantomFlock.java @@ -116,7 +116,7 @@ class PhantomFlockPreventionEffect extends PreventionEffectImpl { if (permanent != null) { boolean removeCounter = true; // check if in the same combat damage step already a counter was removed - if (game.getTurn().getPhase().getStep().getType().equals(PhaseStep.COMBAT_DAMAGE)) { + if (game.getTurn().getPhase().getStep().getType() == PhaseStep.COMBAT_DAMAGE) { if (game.getTurnNum() == turn && game.getTurn().getStep().equals(combatPhaseStep)) { removeCounter = false; diff --git a/Mage.Sets/src/mage/cards/p/PhantomNishoba.java b/Mage.Sets/src/mage/cards/p/PhantomNishoba.java index 3162aaa36a..d8064e8bdf 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomNishoba.java +++ b/Mage.Sets/src/mage/cards/p/PhantomNishoba.java @@ -120,7 +120,7 @@ class PhantomNishobaPreventionEffect extends PreventionEffectImpl { if (permanent != null) { boolean removeCounter = true; // check if in the same combat damage step already a counter was removed - if (game.getTurn().getPhase().getStep().getType().equals(PhaseStep.COMBAT_DAMAGE)) { + if (game.getTurn().getPhase().getStep().getType() == PhaseStep.COMBAT_DAMAGE) { if (game.getTurnNum() == turn && game.getTurn().getStep().equals(combatPhaseStep)) { removeCounter = false; diff --git a/Mage.Sets/src/mage/cards/p/PhantomNomad.java b/Mage.Sets/src/mage/cards/p/PhantomNomad.java index 28d5181191..8d4132ca06 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomNomad.java +++ b/Mage.Sets/src/mage/cards/p/PhantomNomad.java @@ -115,7 +115,7 @@ class PhantomNomadPreventionEffect extends PreventionEffectImpl { if (permanent != null) { boolean removeCounter = true; // check if in the same combat damage step already a counter was removed - if (game.getTurn().getPhase().getStep().getType().equals(PhaseStep.COMBAT_DAMAGE)) { + if (game.getTurn().getPhase().getStep().getType() == PhaseStep.COMBAT_DAMAGE) { if (game.getTurnNum() == turn && game.getTurn().getStep().equals(combatPhaseStep)) { removeCounter = false; diff --git a/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java b/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java index e65595e80e..ff440b907d 100644 --- a/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java +++ b/Mage.Sets/src/mage/cards/p/PharikaGodOfAffliction.java @@ -108,7 +108,7 @@ class PharikaExileEffect extends OneShotEffect { if (controller != null) { Card targetCard = game.getCard(source.getFirstTarget()); if (targetCard != null) { - if (game.getState().getZone(source.getFirstTarget()).equals(Zone.GRAVEYARD)) { + if (game.getState().getZone(source.getFirstTarget()) == Zone.GRAVEYARD) { controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); } Player tokenController = game.getPlayer(targetCard.getOwnerId()); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java index 6af4f923ee..d2ab2d80c4 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianDelver.java @@ -96,7 +96,7 @@ class PhyrexianDelverEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (creatureCard != null && controller != null) { boolean result = false; - if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) { + if (game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) { result = controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game); } controller.loseLife(creatureCard.getConvertedManaCost(), game, false); diff --git a/Mage.Sets/src/mage/cards/p/PithingNeedle.java b/Mage.Sets/src/mage/cards/p/PithingNeedle.java index 360768ddba..7846dfbc15 100644 --- a/Mage.Sets/src/mage/cards/p/PithingNeedle.java +++ b/Mage.Sets/src/mage/cards/p/PithingNeedle.java @@ -101,7 +101,7 @@ class PithingNeedleEffect extends ContinuousRuleModifyingEffectImpl { MageObject object = game.getObject(event.getSourceId()); Ability ability = game.getAbility(event.getTargetId(), event.getSourceId()); if (ability != null && object != null) { - if (!ability.getAbilityType().equals(AbilityType.MANA) + if (ability.getAbilityType() != AbilityType.MANA && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) { return true; } diff --git a/Mage.Sets/src/mage/cards/p/PostmortemLunge.java b/Mage.Sets/src/mage/cards/p/PostmortemLunge.java index 35f22cb092..e45c17e578 100644 --- a/Mage.Sets/src/mage/cards/p/PostmortemLunge.java +++ b/Mage.Sets/src/mage/cards/p/PostmortemLunge.java @@ -78,7 +78,7 @@ public class PostmortemLunge extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { - if (ability.getAbilityType().equals(AbilityType.SPELL)) { // otherwise the target is also added to the delayed triggered ability + if (ability.getAbilityType() == AbilityType.SPELL) { // otherwise the target is also added to the delayed triggered ability ability.getTargets().clear(); int xValue = ability.getManaCostsToPay().getX(); FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard"); diff --git a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java index 307d9a6667..11c6b0fb83 100644 --- a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java +++ b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java @@ -101,7 +101,7 @@ class RosheenMeandererManaCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - if (AbilityType.SPELL.equals(source.getAbilityType())) { + if (AbilityType.SPELL == source.getAbilityType()) { MageObject object = game.getObject(source.getSourceId()); return object != null && object.getManaCost().getText().contains("X"); diff --git a/Mage.Sets/src/mage/cards/s/SacredGround.java b/Mage.Sets/src/mage/cards/s/SacredGround.java index d3230e22b6..d89f19b434 100644 --- a/Mage.Sets/src/mage/cards/s/SacredGround.java +++ b/Mage.Sets/src/mage/cards/s/SacredGround.java @@ -88,7 +88,7 @@ class SacredGroundTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId()))) { ZoneChangeEvent zce = (ZoneChangeEvent) event; - if (Zone.BATTLEFIELD.equals(zce.getFromZone()) && Zone.GRAVEYARD.equals(zce.getToZone())) { + if (Zone.BATTLEFIELD == zce.getFromZone() && Zone.GRAVEYARD == zce.getToZone()) { Permanent targetPermanent = zce.getTarget(); if (targetPermanent.isLand() && targetPermanent.getControllerId().equals(getControllerId())) { getEffects().get(0).setTargetPointer(new FixedTarget(targetPermanent.getId(), game.getState().getZoneChangeCounter(targetPermanent.getId()))); diff --git a/Mage.Sets/src/mage/cards/s/SerraAscendant.java b/Mage.Sets/src/mage/cards/s/SerraAscendant.java index f1ccdddc5c..1cee553fa1 100644 --- a/Mage.Sets/src/mage/cards/s/SerraAscendant.java +++ b/Mage.Sets/src/mage/cards/s/SerraAscendant.java @@ -127,7 +127,7 @@ class SerraAscendantEffect extends ContinuousEffectImpl { @Override public boolean hasLayer(Layer layer) { - return Layer.AbilityAddingRemovingEffects_6.equals(layer) || Layer.PTChangingEffects_7.equals(layer); + return Layer.AbilityAddingRemovingEffects_6 == layer || Layer.PTChangingEffects_7 == layer; } } diff --git a/Mage.Sets/src/mage/cards/s/SharedFate.java b/Mage.Sets/src/mage/cards/s/SharedFate.java index 1d12d4d225..046eb49475 100644 --- a/Mage.Sets/src/mage/cards/s/SharedFate.java +++ b/Mage.Sets/src/mage/cards/s/SharedFate.java @@ -152,7 +152,7 @@ class SharedFatePlayEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (game.getState().getZone(objectId).equals(Zone.EXILED)) { + if (game.getState().getZone(objectId) == Zone.EXILED) { Player player = game.getPlayer(affectedControllerId); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); UUID exileId = CardUtil.getExileZoneId(source.getSourceId().toString() + sourcePermanent.getZoneChangeCounter(game) + affectedControllerId.toString(), game); @@ -192,7 +192,7 @@ class SharedFateLookEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (game.getState().getZone(objectId).equals(Zone.EXILED)) { + if (game.getState().getZone(objectId) == Zone.EXILED) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); UUID exileId = CardUtil.getExileZoneId(source.getSourceId().toString() + sourcePermanent.getZoneChangeCounter(game) + affectedControllerId.toString(), game); if (exileId != null) { diff --git a/Mage.Sets/src/mage/cards/s/SithMagic.java b/Mage.Sets/src/mage/cards/s/SithMagic.java index 57637f4db4..a61842a20b 100644 --- a/Mage.Sets/src/mage/cards/s/SithMagic.java +++ b/Mage.Sets/src/mage/cards/s/SithMagic.java @@ -169,8 +169,8 @@ class SithMagicReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getFirstTarget()) - && ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD) - && !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED)) { + && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD + && ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) { return true; } return false; diff --git a/Mage.Sets/src/mage/cards/s/SoldeviMachinist.java b/Mage.Sets/src/mage/cards/s/SoldeviMachinist.java index 02dc3a58d5..407062d0ac 100644 --- a/Mage.Sets/src/mage/cards/s/SoldeviMachinist.java +++ b/Mage.Sets/src/mage/cards/s/SoldeviMachinist.java @@ -99,7 +99,7 @@ class ArtifactAbilityManaCondition extends ManaCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - if (source != null && source.getAbilityType().equals(AbilityType.ACTIVATED)) { + if (source != null && source.getAbilityType() == AbilityType.ACTIVATED) { MageObject object = game.getObject(source.getSourceId()); if (object != null && object.isArtifact()) { return true; diff --git a/Mage.Sets/src/mage/cards/s/SoulSeparator.java b/Mage.Sets/src/mage/cards/s/SoulSeparator.java index bc2548513c..aa5f131223 100644 --- a/Mage.Sets/src/mage/cards/s/SoulSeparator.java +++ b/Mage.Sets/src/mage/cards/s/SoulSeparator.java @@ -102,7 +102,7 @@ class SoulSeparatorEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (creatureCard != null && controller != null) { boolean result = false; - if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) { + if (game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) { result = controller.moveCardToExileWithInfo(creatureCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true); ZombieToken2 token = new ZombieToken2(creatureCard.getPower().getValue(), creatureCard.getToughness().getValue()); token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/s/Spellbinder.java b/Mage.Sets/src/mage/cards/s/Spellbinder.java index 1134a3b661..74b02b0048 100644 --- a/Mage.Sets/src/mage/cards/s/Spellbinder.java +++ b/Mage.Sets/src/mage/cards/s/Spellbinder.java @@ -188,7 +188,7 @@ class SpellbinderCopyEffect extends OneShotEffect { Permanent spellbinder = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (spellbinder != null && spellbinder.getImprinted() != null && !spellbinder.getImprinted().isEmpty()) { Card imprintedInstant = game.getCard(spellbinder.getImprinted().get(0)); - if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) { + if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) { if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) { Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); if (copiedCard != null) { diff --git a/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java b/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java index 15dbf48a6a..9c41830a09 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java +++ b/Mage.Sets/src/mage/cards/s/SphinxOfUthuun.java @@ -147,7 +147,7 @@ class SphinxOfUthuunEffect extends OneShotEffect { pile2Zone = Zone.GRAVEYARD; } - StringBuilder sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (": "); + StringBuilder sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 1, going to ").append(pile1Zone == Zone.HAND ?"Hand":"Graveyard").append (": "); int i = 0; for (UUID cardUuid : pile1CardsIds) { i++; @@ -162,7 +162,7 @@ class SphinxOfUthuunEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (':'); + sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone == Zone.HAND ?"Hand":"Graveyard").append (':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); diff --git a/Mage.Sets/src/mage/cards/s/StartledAwake.java b/Mage.Sets/src/mage/cards/s/StartledAwake.java index 10282410ff..255bc05474 100644 --- a/Mage.Sets/src/mage/cards/s/StartledAwake.java +++ b/Mage.Sets/src/mage/cards/s/StartledAwake.java @@ -98,7 +98,7 @@ class StartledAwakeReturnTransformedEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - if (game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { + if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE); Card card = game.getCard(source.getSourceId()); if (card != null) { diff --git a/Mage.Sets/src/mage/cards/s/SteamAugury.java b/Mage.Sets/src/mage/cards/s/SteamAugury.java index 7644421780..5de2e5f42d 100644 --- a/Mage.Sets/src/mage/cards/s/SteamAugury.java +++ b/Mage.Sets/src/mage/cards/s/SteamAugury.java @@ -146,7 +146,7 @@ class SteamAuguryEffect extends OneShotEffect { pile2Zone = Zone.GRAVEYARD; } - StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(": "); + StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone == Zone.HAND ? "Hand" : "Graveyard").append(": "); int i = 0; for (UUID cardUuid : pile1CardsIds) { i++; @@ -161,7 +161,7 @@ class SteamAuguryEffect extends OneShotEffect { } game.informPlayers(sb.toString()); - sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':'); + sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone == Zone.HAND ? "Hand" : "Graveyard").append(':'); i = 0; for (UUID cardUuid : pile2CardsIds) { Card card = game.getCard(cardUuid); diff --git a/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java b/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java index 348a6f1c55..24409457a9 100644 --- a/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java +++ b/Mage.Sets/src/mage/cards/s/StinkdrinkerBandit.java @@ -103,7 +103,7 @@ class StinkdrinkerBanditTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType().equals(EventType.DECLARED_BLOCKERS); + return event.getType() == EventType.DECLARED_BLOCKERS; } @Override diff --git a/Mage.Sets/src/mage/cards/s/Stranglehold.java b/Mage.Sets/src/mage/cards/s/Stranglehold.java index 633d78c0b7..9c7e269cba 100644 --- a/Mage.Sets/src/mage/cards/s/Stranglehold.java +++ b/Mage.Sets/src/mage/cards/s/Stranglehold.java @@ -102,7 +102,7 @@ class OpponentsCantSearchLibarariesEffect extends ContinuousRuleModifyingEffectI @Override public boolean checksEventType(GameEvent event, Game game) { - return EventType.SEARCH_LIBRARY.equals(event.getType()); + return EventType.SEARCH_LIBRARY == event.getType(); } @Override @@ -145,7 +145,7 @@ class StrangleholdSkipExtraTurnsEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType().equals(GameEvent.EventType.EXTRA_TURN); + return event.getType() == EventType.EXTRA_TURN; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SummonersEgg.java b/Mage.Sets/src/mage/cards/s/SummonersEgg.java index 74c8c59f56..d9f673b691 100644 --- a/Mage.Sets/src/mage/cards/s/SummonersEgg.java +++ b/Mage.Sets/src/mage/cards/s/SummonersEgg.java @@ -143,7 +143,7 @@ class SummonersEggPutOntoBattlefieldEffect extends OneShotEffect { Permanent SummonersEgg = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (SummonersEgg != null && SummonersEgg.getImprinted() != null && !SummonersEgg.getImprinted().isEmpty()) { Card imprintedCard = game.getCard(SummonersEgg.getImprinted().get(0)); - if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()).equals(Zone.EXILED)) { + if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()) == Zone.EXILED) { //turn the exiled card face up. imprintedCard.turnFaceUp(game, source.getControllerId()); //If it's a creature card, diff --git a/Mage.Sets/src/mage/cards/s/SunglassesOfUrza.java b/Mage.Sets/src/mage/cards/s/SunglassesOfUrza.java index cb98d30936..26633df851 100644 --- a/Mage.Sets/src/mage/cards/s/SunglassesOfUrza.java +++ b/Mage.Sets/src/mage/cards/s/SunglassesOfUrza.java @@ -85,7 +85,7 @@ class SunglassesOfUrzaManaAsThoughtEffect extends AsThoughEffectImpl implements @Override public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) { - if (mana.getWhite() > 0 && ManaType.RED.equals(manaType)) { + if (mana.getWhite() > 0 && ManaType.RED == manaType) { return ManaType.WHITE; } return manaType; diff --git a/Mage.Sets/src/mage/cards/s/SuppressionField.java b/Mage.Sets/src/mage/cards/s/SuppressionField.java index 71077ee8bb..2403ad2939 100644 --- a/Mage.Sets/src/mage/cards/s/SuppressionField.java +++ b/Mage.Sets/src/mage/cards/s/SuppressionField.java @@ -84,7 +84,7 @@ class SuppressionFieldCostReductionEffect extends CostModificationEffectImpl { @Override public boolean applies(Ability abilityToModify, Ability source, Game game) { - return abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED); + return abilityToModify.getAbilityType() == AbilityType.ACTIVATED; } @Override diff --git a/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java b/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java index 9bd39e24f4..ee9acf6c79 100644 --- a/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java +++ b/Mage.Sets/src/mage/cards/s/SwordOfTheMeek.java @@ -106,7 +106,7 @@ class SwordOfTheMeekEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Card equipment = game.getCard(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); - if (equipment != null && controller != null && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { + if (equipment != null && controller != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { controller.moveCards(equipment, Zone.BATTLEFIELD, source, game); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { diff --git a/Mage.Sets/src/mage/cards/t/TawnossCoffin.java b/Mage.Sets/src/mage/cards/t/TawnossCoffin.java index b943f1ba46..399ea34b41 100644 --- a/Mage.Sets/src/mage/cards/t/TawnossCoffin.java +++ b/Mage.Sets/src/mage/cards/t/TawnossCoffin.java @@ -107,12 +107,12 @@ class TawnossCoffinTriggeredAbility extends LeavesBattlefieldTriggeredAbility { @Override public boolean checkEventType(GameEvent event, Game game) { - return super.checkEventType(event, game) || event.getType().equals(GameEvent.EventType.UNTAPPED); + return super.checkEventType(event, game) || event.getType() == GameEvent.EventType.UNTAPPED; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.UNTAPPED)) { + if (event.getType() == GameEvent.EventType.UNTAPPED) { return event.getTargetId().equals(sourceId); } else { return super.checkTrigger(event, game); diff --git a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java index 00bca35e0b..991dbc5607 100644 --- a/Mage.Sets/src/mage/cards/t/ThoughtPrison.java +++ b/Mage.Sets/src/mage/cards/t/ThoughtPrison.java @@ -169,7 +169,7 @@ class ThoughtPrisonTriggeredAbility extends TriggeredAbilityImpl { } if (sourcePermanent != null && sourcePermanent.getImprinted() != null && !sourcePermanent.getImprinted().isEmpty()) { Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0)); - if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()).equals(Zone.EXILED)) { + if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()) == Zone.EXILED) { // Check if spell's color matches the imprinted card ObjectColor spellColor = spell.getColor(game); ObjectColor imprintedColor = imprintedCard.getColor(game); diff --git a/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java b/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java index 7b9aa90085..01ca0e9ec8 100644 --- a/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java +++ b/Mage.Sets/src/mage/cards/t/TreacherousPitDweller.java @@ -93,7 +93,7 @@ class TreacherousPitDwellerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getTargetId().equals(getSourceId()) && ((EntersTheBattlefieldEvent) event).getFromZone().equals(Zone.GRAVEYARD); + return event.getTargetId().equals(getSourceId()) && ((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TuktukScrapper.java b/Mage.Sets/src/mage/cards/t/TuktukScrapper.java index deaf478b79..d63cce6dc9 100644 --- a/Mage.Sets/src/mage/cards/t/TuktukScrapper.java +++ b/Mage.Sets/src/mage/cards/t/TuktukScrapper.java @@ -149,7 +149,7 @@ class TuktukScrapperEffect extends OneShotEffect { if (controller != null && targetArtifact != null) { targetArtifact.destroy(source.getSourceId(), game, false); Player targetController = game.getPlayer(targetArtifact.getControllerId()); - if (targetController != null && game.getState().getZone(targetArtifact.getId()).equals(Zone.GRAVEYARD)) { + if (targetController != null && game.getState().getZone(targetArtifact.getId()) == Zone.GRAVEYARD) { int alliesControlled = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); if (alliesControlled > 0) { targetController.damage(alliesControlled, source.getSourceId(), game, false, true); diff --git a/Mage.Sets/src/mage/cards/u/UnwindingClock.java b/Mage.Sets/src/mage/cards/u/UnwindingClock.java index 4294d7a309..8d4814449c 100644 --- a/Mage.Sets/src/mage/cards/u/UnwindingClock.java +++ b/Mage.Sets/src/mage/cards/u/UnwindingClock.java @@ -92,7 +92,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl { if (applied == null) { applied = Boolean.FALSE; } - if (!applied && layer.equals(Layer.RulesEffects)) { + if (!applied && layer == Layer.RulesEffects) { if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) { game.getState().setValue(source.getSourceId() + "applied", true); for (Permanent artifact : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { @@ -105,7 +105,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl { } } } - } else if (applied && layer.equals(Layer.RulesEffects)) { + } else if (applied && layer == Layer.RulesEffects) { if (game.getStep().getType() == PhaseStep.END_TURN) { game.getState().setValue(source.getSourceId() + "applied", false); } diff --git a/Mage.Sets/src/mage/cards/u/UrbanBurgeoning.java b/Mage.Sets/src/mage/cards/u/UrbanBurgeoning.java index 4a5c5bb4d7..f33758431b 100644 --- a/Mage.Sets/src/mage/cards/u/UrbanBurgeoning.java +++ b/Mage.Sets/src/mage/cards/u/UrbanBurgeoning.java @@ -106,7 +106,7 @@ class UrbanBurgeoningUntapEffect extends ContinuousEffectImpl { if (applied == null) { applied = Boolean.FALSE; } - if (!applied && layer.equals(Layer.RulesEffects)) { + if (!applied && layer == Layer.RulesEffects) { if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) { game.getState().setValue(source.getSourceId() + "applied", true); Permanent land = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/v/VorracBattlehorns.java b/Mage.Sets/src/mage/cards/v/VorracBattlehorns.java index 726e9a0bc5..367ca1a8c1 100644 --- a/Mage.Sets/src/mage/cards/v/VorracBattlehorns.java +++ b/Mage.Sets/src/mage/cards/v/VorracBattlehorns.java @@ -93,7 +93,7 @@ class CantBeBlockedByMoreThanOneAttachedEffect extends ContinuousEffectImpl { super(duration, Outcome.Benefit); this.amount = amount; this.attachmentType = attachmentType; - staticText = (attachmentType.equals(AttachmentType.AURA) ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s"); + staticText = (attachmentType == AttachmentType.AURA ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s"); } public CantBeBlockedByMoreThanOneAttachedEffect(final CantBeBlockedByMoreThanOneAttachedEffect effect) { diff --git a/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java b/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java index 019fb0111d..6ea6909d99 100644 --- a/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java +++ b/Mage.Sets/src/mage/cards/w/WheelOfSunAndMoon.java @@ -105,7 +105,7 @@ class WheelOfSunAndMoonEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getToZone().equals(Zone.GRAVEYARD)) { + if (zEvent.getToZone() == Zone.GRAVEYARD) { Card card = game.getCard(event.getTargetId()); if (card != null) { Permanent enchantment = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java b/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java index 7255b793cc..2198066f5f 100644 --- a/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java +++ b/Mage.Sets/src/mage/cards/x/XenicPoltergeist.java @@ -127,7 +127,7 @@ class XenicPoltergeistEffect extends ContinuousEffectImpl { if (super.isInactive(source, game)) { return true; } - if (durationPhaseStep != null && durationPhaseStep.equals(game.getPhase().getStep().getType())) { + if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) { if (!sameStep && game.getActivePlayerId().equals(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) { return true; } diff --git a/Mage.Sets/src/mage/sets/DragonsMaze.java b/Mage.Sets/src/mage/sets/DragonsMaze.java index cf305e8471..a022fee617 100644 --- a/Mage.Sets/src/mage/sets/DragonsMaze.java +++ b/Mage.Sets/src/mage/sets/DragonsMaze.java @@ -225,7 +225,7 @@ public class DragonsMaze extends ExpansionSet { @Override public List getCardsByRarity(Rarity rarity) { - if (rarity.equals(Rarity.COMMON)) { + if (rarity == Rarity.COMMON) { List savedCardsInfos = savedCards.get(rarity); if (savedCardsInfos == null) { CardCriteria criteria = new CardCriteria(); diff --git a/Mage.Sets/src/mage/sets/FateReforged.java b/Mage.Sets/src/mage/sets/FateReforged.java index 82a0078ded..58c65acfe4 100644 --- a/Mage.Sets/src/mage/sets/FateReforged.java +++ b/Mage.Sets/src/mage/sets/FateReforged.java @@ -256,7 +256,7 @@ public class FateReforged extends ExpansionSet { @Override public List getCardsByRarity(Rarity rarity) { // Common cards retrievement of Fate Reforged boosters - prevent the retrievement of the common lands (e.g. Blossoming Sands) - if (rarity.equals(Rarity.COMMON)) { + if (rarity == Rarity.COMMON) { List savedCardsInfos = savedCards.get(rarity); if (savedCardsInfos == null) { CardCriteria criteria = new CardCriteria(); diff --git a/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java b/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java index ce68bedbfb..ac96be11cb 100644 --- a/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java +++ b/Mage.Stats/src/main/java/com/xmage/ws/util/json/JSONParser.java @@ -83,7 +83,7 @@ public class JSONParser { String currentPath = ""; for (int i = 0; i < params.length - 1; i++) { String param = params[i]; - if (cachePolicy.equals(CachePolicy.CACHE_ALL_LEVELS)) { + if (cachePolicy == CachePolicy.CACHE_ALL_LEVELS) { if (!currentPath.isEmpty()) { currentPath += "."; } @@ -123,7 +123,7 @@ public class JSONParser { } } - if (cachePolicy.equals(CachePolicy.CACHE_ALL_LEVELS)) { + if (cachePolicy == CachePolicy.CACHE_ALL_LEVELS) { saveToCache(currentPath, json); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/DependentEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/DependentEffectsTest.java index f4cb9911c1..bb7994fcce 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/DependentEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/DependentEffectsTest.java @@ -137,7 +137,7 @@ public class DependentEffectsTest extends CardTestPlayerBase { Permanent necroticOoze = getPermanent("Necrotic Ooze", playerA); int numberOfActivatedAbilities = 0; for (Ability ability : necroticOoze.getAbilities(currentGame)) { - if (ability.getAbilityType().equals(AbilityType.ACTIVATED)) { + if (ability.getAbilityType() == AbilityType.ACTIVATED) { numberOfActivatedAbilities++; } } @@ -166,7 +166,7 @@ public class DependentEffectsTest extends CardTestPlayerBase { Permanent necroticOoze = getPermanent("Necrotic Ooze", playerA); int numberOfActivatedAbilities = 0; for (Ability ability : necroticOoze.getAbilities(currentGame)) { - if (ability.getAbilityType().equals(AbilityType.ACTIVATED)) { + if (ability.getAbilityType() == AbilityType.ACTIVATED) { numberOfActivatedAbilities++; } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/DivergentTransformationsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/DivergentTransformationsTest.java index 0376f3fc39..772923a1b6 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/DivergentTransformationsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/DivergentTransformationsTest.java @@ -38,7 +38,7 @@ public class DivergentTransformationsTest extends CardTestPlayerBase { addCard(Zone.LIBRARY, playerA, hGiant); addCard(Zone.LIBRARY, playerB, mFlunkies); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, dTransformations, memnite + "^" + gBears); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, dTransformations, memnite + '^' + gBears); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); 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 ff972281e3..e58a4f17cb 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 @@ -236,7 +236,7 @@ public class TestPlayer implements Player { if (group.startsWith("spell") || group.startsWith("!spell") || group.startsWith("target=null") || group.startsWith("manaInPool=")) { break; } - if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) { + if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) { if (group.contains("FuseLeft-")) { result = handleTargetString(group.substring(group.indexOf("FuseLeft-") + 9), ability, game); } else if (group.startsWith("FuseRight-")) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java index 05b3c73d0e..82d7772130 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestBase.java @@ -192,7 +192,7 @@ public abstract class MageTestBase { } private void parseLine(String line) { - if (parserState.equals(ParserState.EXPECTED)) { + if (parserState == ParserState.EXPECTED) { expectedResults.add(line); // just remember for future use return; } @@ -248,7 +248,7 @@ public abstract class MageTestBase { CardInfo cardInfo = CardRepository.instance.findCard(cardName); Card card = cardInfo != null ? cardInfo.getCard() : null; if (card != null) { - if (gameZone.equals(Zone.BATTLEFIELD)) { + if (gameZone == Zone.BATTLEFIELD) { PermanentCard p = new PermanentCard(card, null, currentGame); p.setTapped(tapped); perms.add(p); diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java index 51932f83f0..17f987cde7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/MageTestPlayerBase.java @@ -178,7 +178,7 @@ public abstract class MageTestPlayerBase { } private void parseLine(String line) { - if (parserState.equals(ParserState.EXPECTED)) { + if (parserState == ParserState.EXPECTED) { expectedResults.add(line); // just remember for future use return; } @@ -226,7 +226,7 @@ public abstract class MageTestPlayerBase { CardInfo cardInfo = CardRepository.instance.findCard(cardName); Card card = cardInfo != null ? cardInfo.getCard() : null; if (card != null) { - if (gameZone.equals(Zone.BATTLEFIELD)) { + if (gameZone == Zone.BATTLEFIELD) { PermanentCard p = new PermanentCard(card, null, currentGame); p.setTapped(tapped); perms.add(p); diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java index 8825bc72b7..62a60d0fdf 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java @@ -121,7 +121,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP public void addCard(Zone gameZone, TestPlayer player, String cardName, int count, boolean tapped) { - if (gameZone.equals(Zone.BATTLEFIELD)) { + if (gameZone == Zone.BATTLEFIELD) { for (int i = 0; i < count; i++) { CardInfo cardInfo = CardRepository.instance.findCard(cardName); Card card = cardInfo != null ? cardInfo.getCard() : null; @@ -158,19 +158,19 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP */ private List getCardList(Zone gameZone, Player player) { if (player.equals(playerA)) { - if (gameZone.equals(Zone.HAND)) { + if (gameZone == Zone.HAND) { return handCardsA; - } else if (gameZone.equals(Zone.GRAVEYARD)) { + } else if (gameZone == Zone.GRAVEYARD) { return graveyardCardsA; - } else if (gameZone.equals(Zone.LIBRARY)) { + } else if (gameZone == Zone.LIBRARY) { return libraryCardsA; } } else if (player.equals(playerB)) { - if (gameZone.equals(Zone.HAND)) { + if (gameZone == Zone.HAND) { return handCardsB; - } else if (gameZone.equals(Zone.GRAVEYARD)) { + } else if (gameZone == Zone.GRAVEYARD) { return graveyardCardsB; - } else if (gameZone.equals(Zone.LIBRARY)) { + } else if (gameZone == Zone.LIBRARY) { return libraryCardsB; } } @@ -289,12 +289,12 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) { if (permanent.getName().equals(cardName)) { count++; - if (scope.equals(Filter.ComparisonScope.All)) { + if (scope == Filter.ComparisonScope.All) { Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ')', power, permanent.getPower().getValue()); Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ')', toughness, permanent.getToughness().getValue()); - } else if (scope.equals(Filter.ComparisonScope.Any)) { + } else if (scope == Filter.ComparisonScope.Any) { if (power == permanent.getPower().getValue() && toughness == permanent.getToughness().getValue()) { fit++; break; @@ -306,7 +306,7 @@ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAP Assert.assertTrue("There is no such permanent under player's control, player=" + player.getName() + ", cardName=" + cardName, count > 0); - if (scope.equals(Filter.ComparisonScope.Any)) { + if (scope == Filter.ComparisonScope.Any) { Assert.assertTrue("There is no such creature under player's control with specified power&toughness, player=" + player.getName() + ", cardName=" + cardName, fit > 0); } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 800ce80d6d..cabd79c459 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -278,7 +278,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement @Override public void addCard(Zone gameZone, TestPlayer player, String cardName, int count, boolean tapped) { - if (gameZone.equals(Zone.BATTLEFIELD)) { + if (gameZone == Zone.BATTLEFIELD) { for (int i = 0; i < count; i++) { CardInfo cardInfo = CardRepository.instance.findCard(cardName); Card card = cardInfo != null ? cardInfo.getCard() : null; @@ -445,12 +445,12 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) { if (permanent.getName().equals(cardName) && permanent.getControllerId().equals(player.getId())) { count++; - if (scope.equals(Filter.ComparisonScope.All)) { + if (scope == Filter.ComparisonScope.All) { Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ')', power, permanent.getPower().getValue()); Assert.assertEquals("Toughness is not the same (" + toughness + " vs. " + permanent.getToughness().getValue() + ')', toughness, permanent.getToughness().getValue()); - } else if (scope.equals(Filter.ComparisonScope.Any)) { + } else if (scope == Filter.ComparisonScope.Any) { if (power == permanent.getPower().getValue() && toughness == permanent.getToughness().getValue()) { fit++; break; @@ -465,7 +465,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertTrue("There is no such permanent under player's control, player=" + player.getName() + ", cardName=" + cardName, count > 0); - if (scope.equals(Filter.ComparisonScope.Any)) { + if (scope == Filter.ComparisonScope.Any) { Assert.assertTrue("There is no such creature under player's control with specified p/t of " + power + '/' + toughness + ", player=" + player.getName() + ", cardName=" + cardName + " (found similar: " + found + ", one of them: power=" + foundPower + " toughness=" + foundToughness + ')', fit > 0); } @@ -1055,7 +1055,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement * @param clause */ public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) { - if (StackClause.WHILE_ON_STACK.equals(clause)) { + if (StackClause.WHILE_ON_STACK == clause) { player.addAction(turnNum, step, "activate:Cast " + cardName + '$' + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName) + "$spellOnStack=" + spellOnStack); @@ -1253,7 +1253,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement if (currentGame == null) { throw new IllegalStateException("Current game is null"); } - if (scope.equals(Filter.ComparisonScope.All)) { + if (scope == Filter.ComparisonScope.All) { throw new UnsupportedOperationException("ComparisonScope.All is not implemented."); } diff --git a/Mage/src/main/java/mage/Mana.java b/Mage/src/main/java/mage/Mana.java index 7a7ff39d6b..7eb518ed5e 100644 --- a/Mage/src/main/java/mage/Mana.java +++ b/Mage/src/main/java/mage/Mana.java @@ -846,19 +846,19 @@ public class Mana implements Comparable, Serializable, Copyable { * in {@link ColoredManaSymbol}. */ public int getColor(final ColoredManaSymbol color) { - if (color.equals(ColoredManaSymbol.G)) { + if (color == ColoredManaSymbol.G) { return green; } - if (color.equals(ColoredManaSymbol.R)) { + if (color == ColoredManaSymbol.R) { return red; } - if (color.equals(ColoredManaSymbol.B)) { + if (color == ColoredManaSymbol.B) { return black; } - if (color.equals(ColoredManaSymbol.U)) { + if (color == ColoredManaSymbol.U) { return blue; } - if (color.equals(ColoredManaSymbol.W)) { + if (color == ColoredManaSymbol.W) { return white; } return 0; diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 7cbce9ac75..cc30fc971f 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -518,7 +518,7 @@ public abstract class AbilityImpl implements Ability { PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost)cost; PayLifeCost payLifeCost = new PayLifeCost(2); if(payLifeCost.canPay(this, sourceId, controller.getId(), game) && - controller.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + "?", this, game)) { + controller.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', this, game)) { costIterator.remove(); costs.add(payLifeCost); } diff --git a/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAttachedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAttachedTriggeredAbility.java index 77dbc161dd..b8c245b723 100644 --- a/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAttachedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAttachedTriggeredAbility.java @@ -60,7 +60,7 @@ public class DealsDamageToAPlayerAttachedTriggeredAbility extends TriggeredAbili @Override public boolean checkTrigger(GameEvent event, Game game) { - if (targetController.equals(TargetController.OPPONENT)) { + if (targetController == TargetController.OPPONENT) { Player controller = game.getPlayer(this.getControllerId()); if (controller == null || !game.isOpponent(controller, event.getPlayerId())) { return false; diff --git a/Mage/src/main/java/mage/abilities/common/DiesAttachedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DiesAttachedTriggeredAbility.java index 5d92b4c406..3eb151ac1e 100644 --- a/Mage/src/main/java/mage/abilities/common/DiesAttachedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DiesAttachedTriggeredAbility.java @@ -83,7 +83,7 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl { for (Effect effect : getEffects()) { if (zEvent.getTarget() != null) { effect.setValue("attachedTo", zEvent.getTarget()); - if (setTargetPointer.equals(SetTargetPointer.ATTACHED_TO_CONTROLLER)) { + if (setTargetPointer == SetTargetPointer.ATTACHED_TO_CONTROLLER) { Permanent attachment = game.getPermanentOrLKIBattlefield(getSourceId()); if (attachment != null && attachment.getAttachedTo() != null) { Permanent attachedTo = (Permanent) game.getLastKnownInformation(attachment.getAttachedTo(), Zone.BATTLEFIELD, attachment.getAttachedToZoneChangeCounter()); diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java index 400e81d107..9e4daeb3fe 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java @@ -105,7 +105,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl { UUID targetId = event.getTargetId(); Permanent permanent = game.getPermanent(targetId); if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { - if (!setTargetPointer.equals(SetTargetPointer.NONE)) { + if (setTargetPointer != SetTargetPointer.NONE) { for (Effect effect : this.getEffects()) { switch (setTargetPointer) { case PERMANENT: diff --git a/Mage/src/main/java/mage/abilities/common/ExploitCreatureTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/ExploitCreatureTriggeredAbility.java index f8573a1ae4..c5e4f734f4 100644 --- a/Mage/src/main/java/mage/abilities/common/ExploitCreatureTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ExploitCreatureTriggeredAbility.java @@ -84,7 +84,7 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getSourceId().equals(getSourceId())) { for (Effect effect: getEffects()) { - if (setTargetPointer.equals(SetTargetPointer.PERMANENT)) { + if (setTargetPointer == SetTargetPointer.PERMANENT) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } } diff --git a/Mage/src/main/java/mage/abilities/common/LimitedTimesPerTurnActivatedAbility.java b/Mage/src/main/java/mage/abilities/common/LimitedTimesPerTurnActivatedAbility.java index cfbe003e57..4e42a1678c 100644 --- a/Mage/src/main/java/mage/abilities/common/LimitedTimesPerTurnActivatedAbility.java +++ b/Mage/src/main/java/mage/abilities/common/LimitedTimesPerTurnActivatedAbility.java @@ -121,7 +121,7 @@ public class LimitedTimesPerTurnActivatedAbility extends ActivatedAbilityImpl { if (condition != null) { sb.append("only ").append(condition.toString()).append(" and "); } - if (getTiming().equals(TimingRule.SORCERY)) { + if (getTiming() == TimingRule.SORCERY) { sb.append("only any time you could cast a sorcery and "); } switch (maxActivationsPerTurn) { diff --git a/Mage/src/main/java/mage/abilities/common/ZoneChangeTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/ZoneChangeTriggeredAbility.java index f18ff9e6c5..44c4c634ba 100644 --- a/Mage/src/main/java/mage/abilities/common/ZoneChangeTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ZoneChangeTriggeredAbility.java @@ -54,7 +54,7 @@ public class ZoneChangeTriggeredAbility extends TriggeredAbilityImpl { public ZoneChangeTriggeredAbility(Zone worksInZone, Zone fromZone, Zone toZone, Effect effect, String rule, boolean optional) { super(worksInZone, effect, optional); - if (fromZone.equals(Zone.BATTLEFIELD)) { + if (fromZone == Zone.BATTLEFIELD) { setLeavesTheBattlefieldTrigger(true); } this.fromZone = fromZone; diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java index 14ef126220..e1031a72f4 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java @@ -104,7 +104,7 @@ public class ColoredManaCost extends ManaCostImpl { @Override public boolean containsColor(ColoredManaSymbol coloredManaSymbol) { - return mana.equals(coloredManaSymbol); + return mana == coloredManaSymbol; } } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaSymbols.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaSymbols.java index 83aec80836..11ad379326 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaSymbols.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaSymbols.java @@ -116,7 +116,7 @@ public class ManaSymbols extends ArrayList { * @return */ private static boolean compareHybridCosts(HybridManaCost h1, HybridManaCost h2) { - return h1.getMana1().equals(h2.getMana1()) && h1.getMana2().equals(h2.getMana2()) - || h1.getMana1().equals(h2.getMana2()) && h1.getMana2().equals(h2.getMana1()); + return h1.getMana1() == h2.getMana1() && h1.getMana2() == h2.getMana2() + || h1.getMana1() == h2.getMana2() && h1.getMana2() == h2.getMana1(); } } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java index e6571177bc..99432210b4 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java @@ -119,7 +119,7 @@ public class MonoHybridManaCost extends ManaCostImpl { @Override public boolean containsColor(ColoredManaSymbol coloredManaSymbol) { - return mana.equals(coloredManaSymbol); + return mana == coloredManaSymbol; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java index f7e5db45a0..337ca43d5d 100644 --- a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java @@ -129,7 +129,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { if (spellAbility.getTargets().isEmpty()) { for (Ability ability : card.getAbilities(game)) { if ((ability instanceof SpellAbility) - && SpellAbilityType.BASE_ALTERNATE.equals(((SpellAbility) ability).getSpellAbilityType()) + && SpellAbilityType.BASE_ALTERNATE == ((SpellAbility) ability).getSpellAbilityType() && !ability.getTargets().isEmpty()) { spellAbility = (SpellAbility) ability; break; diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java index fc7378c4ae..4f42e77923 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffects.java @@ -418,8 +418,8 @@ public class ContinuousEffects implements Serializable { return true; } MageObject object; - if (event.getType().equals(EventType.ZONE_CHANGE) - && ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD) + if (event.getType() == EventType.ZONE_CHANGE + && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD && event.getTargetId().equals(ability.getSourceId())) { object = ((ZoneChangeEvent) event).getTarget(); } else { @@ -645,7 +645,7 @@ public class ContinuousEffects implements Serializable { * @param game */ public void applySpliceEffects(Ability abilityToModify, Game game) { - if (((SpellAbility) abilityToModify).getSpellAbilityType().equals(SpellAbilityType.SPLICE)) { + if (((SpellAbility) abilityToModify).getSpellAbilityType() == SpellAbilityType.SPLICE) { // on a spliced ability of a spell can't be spliced again return; } @@ -778,7 +778,7 @@ public class ContinuousEffects implements Serializable { if (rEffects.size() == 1) { ReplacementEffect effect = rEffects.keySet().iterator().next(); HashSet abilities; - if (effect.getEffectType().equals(EffectType.REPLACEMENT)) { + if (effect.getEffectType() == EffectType.REPLACEMENT) { abilities = replacementEffects.getAbility(effect.getId()); } else { abilities = preventionEffects.getAbility(effect.getId()); diff --git a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java index 9eb3e16e82..48c16da477 100644 --- a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java @@ -117,7 +117,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm case ATTACK: return event.getType() == GameEvent.EventType.DECLARE_ATTACKER; case BLOCK: - return event.getType().equals(GameEvent.EventType.DECLARE_BLOCKER); + return event.getType() == EventType.DECLARE_BLOCKER; case ATTACK_AND_BLOCK: return event.getType() == GameEvent.EventType.DECLARE_ATTACKER || event.getType() == EventType.DECLARE_BLOCKER; } @@ -141,7 +141,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm Player player = game.getPlayer(event.getPlayerId()); if (player != null) { String chooseText; - if (event.getType().equals(GameEvent.EventType.DECLARE_ATTACKER)) { + if (event.getType() == EventType.DECLARE_ATTACKER) { chooseText = "Pay " + attackBlockManaTax.getText() + " to attack?"; } else { chooseText = "Pay " + attackBlockManaTax.getText() + " to block?"; @@ -171,7 +171,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost)manaCost; PayLifeCost payLifeCost = new PayLifeCost(2); if(payLifeCost.canPay(source, source.getSourceId(), player.getId(), game) && - player.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + "?", source, game)) { + player.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', source, game)) { manaCostIterator.remove(); costs.add(payLifeCost); } @@ -188,7 +188,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm attackBlockOtherTax.clearPaid(); if (attackBlockOtherTax.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Neutral, - attackBlockOtherTax.getText() + " to " + (event.getType().equals(EventType.DECLARE_ATTACKER) ? "attack?" : "block?"), source, game)) { + attackBlockOtherTax.getText() + " to " + (event.getType() == EventType.DECLARE_ATTACKER ? "attack?" : "block?"), source, game)) { if (attackBlockOtherTax.pay(source, game, source.getSourceId(), event.getPlayerId(), false, null)) { return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java index 977c48a5d4..59ed333f56 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java @@ -84,7 +84,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp @Override public boolean applies(GameEvent event, Ability source, Game game) { if (getTargetPointer().getTargets(game, source).contains(event.getTargetId())) { - if (targetController.equals(TargetController.OPPONENT) + if (targetController == TargetController.OPPONENT && !game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { return false; } @@ -115,7 +115,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp sb.append(filterSource.getMessage()); if (!duration.toString().isEmpty()) { sb.append(' '); - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { sb.append("this turn"); } else { sb.append(duration.toString()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java index 65f0fcb96d..5e689fc675 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java @@ -86,7 +86,7 @@ public class CopyEffect extends ContinuousEffectImpl { Permanent permanent = game.getPermanent(copyToObjectId); if (permanent != null) { affectedObjectList.add(new MageObjectReference(permanent, game)); - } else if (source.getAbilityType().equals(AbilityType.STATIC)) { + } else if (source.getAbilityType() == AbilityType.STATIC) { // for replacement effects that let a permanent enter the battlefield as a copy of another permanent we need to apply that copy // before the permanent is added to the battlefield permanent = game.getPermanentEntering(copyToObjectId); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java index 2726ccfb19..fff7a3f437 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CounterTargetWithReplacementEffect.java @@ -85,13 +85,13 @@ public class CounterTargetWithReplacementEffect extends OneShotEffect { StringBuilder sb = new StringBuilder("Counter target "); sb.append(mode.getTargets().get(0).getTargetName()); sb.append(". If that spell is countered this way, "); - if (targetZone.equals(Zone.EXILED)) { + if (targetZone == Zone.EXILED) { sb.append("exile it instead of putting it into its owner's graveyard"); } - if (targetZone.equals(Zone.HAND)) { + if (targetZone == Zone.HAND) { sb.append("put it into its owner's hand instead of into that player's graveyard"); } - if (targetZone.equals(Zone.LIBRARY)) { + if (targetZone == Zone.LIBRARY) { sb.append("put it on "); switch (zoneDetail) { case BOTTOM: diff --git a/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java index fb20d2a15e..63d20659a7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java @@ -101,7 +101,7 @@ public class EnterBattlefieldPayCostOrPutGraveyardEffect extends ReplacementEffe public boolean applies(GameEvent event, Ability source, Game game) { if (source.getSourceId().equals(event.getTargetId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getToZone().equals(Zone.BATTLEFIELD)) { + if (zEvent.getToZone() == Zone.BATTLEFIELD) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java index 9862689e26..88b3307d25 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java @@ -106,14 +106,14 @@ public class ExileTargetEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { Zone currentZone = game.getState().getZone(permanent.getId()); - if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) { + if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == Zone.BATTLEFIELD)) { toExile.add(permanent); } } else { Card card = game.getCard(targetId); if (card != null) { Zone currentZone = game.getState().getZone(card.getId()); - if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) { + if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == currentZone)) { toExile.add(card); } } @@ -125,14 +125,14 @@ public class ExileTargetEffect extends OneShotEffect { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { Zone currentZone = game.getState().getZone(permanent.getId()); - if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) { + if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == Zone.BATTLEFIELD)) { toExile.add(permanent); } } else { Card card = game.getCard(targetId); if (card != null) { Zone currentZone = game.getState().getZone(card.getId()); - if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) { + if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == currentZone)) { toExile.add(card); } } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToPlayersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToPlayersEffect.java index 783f817193..4e670bcc3c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToPlayersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToPlayersEffect.java @@ -61,7 +61,7 @@ public class PreventAllDamageToPlayersEffect extends PreventionEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game) && event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)) { + if (super.applies(event, source, game) && event.getType() == GameEvent.EventType.DAMAGE_PLAYER) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && game.getState().getPlayersInRange(controller.getId(), game).contains(event.getTargetId())) { return true; @@ -76,7 +76,7 @@ public class PreventAllDamageToPlayersEffect extends PreventionEffectImpl { sb.append("combat "); } sb.append("damage that would be dealt to players"); - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { sb.append(" this turn"); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java index aff138d575..a1b1fb9d3b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetMultiAmountEffect.java @@ -132,8 +132,8 @@ public class PreventDamageToTargetMultiAmountEffect extends PreventionEffectImpl @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - sb.append("prevent the next ").append(amountToPrevent).append(" damage that would be dealt "); - if (duration.equals(Duration.EndOfTurn)) { + sb.append("prevent the next ").append(amountToPrevent).append(" damage that would be dealt "); + if (duration == Duration.EndOfTurn) { sb.append("this turn "); } sb.append("to any number of target creatures and/or players, divided as you choose"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToTargetEffect.java index fd7c3b5908..659ec194e5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToTargetEffect.java @@ -73,7 +73,7 @@ public class PreventNextDamageFromChosenSourceToTargetEffect extends PreventionE StringBuilder sb = new StringBuilder("The next time a ").append(targetSource.getFilter().getMessage()); sb.append(" of your choice would deal damage to target "); sb.append(mode.getTargets().get(0).getTargetName()); - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { sb.append(" this turn"); } sb.append(", prevent that damage"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java index f33f75a912..6164d9c2de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventNextDamageFromChosenSourceToYouEffect.java @@ -70,7 +70,7 @@ public class PreventNextDamageFromChosenSourceToYouEffect extends PreventionEffe private String setText() { StringBuilder sb = new StringBuilder("The next time a ").append(targetSource.getFilter().getMessage()); sb.append(" of your choice would deal damage to you"); - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { sb.append(" this turn"); } sb.append(", prevent that damage"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/RegenerateTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RegenerateTargetEffect.java index 2a14b1925a..436fd1d802 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RegenerateTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RegenerateTargetEffect.java @@ -76,7 +76,7 @@ public class RegenerateTargetEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return EventType.DESTROY_PERMANENT.equals(event.getType()); + return EventType.DESTROY_PERMANENT == event.getType(); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java index 359bf3fd9c..6872ae51dd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java @@ -100,7 +100,7 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect { } ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), permanentLeftBattlefield.getZoneChangeCounter(game))); if (exile != null) { // null is valid if source left battlefield before enters the battlefield effect resolved - if (returnToZone.equals(Zone.BATTLEFIELD)) { + if (returnToZone == Zone.BATTLEFIELD) { controller.moveCards(exile.getCards(game), returnToZone, source, game, false, false, true, null); } else { controller.moveCards(exile, returnToZone, source, game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java index a1c3ebe28a..225d4db497 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java @@ -74,7 +74,7 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect @Override public boolean apply(Game game, Ability source) { - if (!game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { + if (game.getState().getZone(source.getSourceId()) != Zone.GRAVEYARD) { return false; } Card card = game.getCard(source.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockAdditionalCreatureEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockAdditionalCreatureEffect.java index f10d6d0305..d360109293 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockAdditionalCreatureEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CanBlockAdditionalCreatureEffect.java @@ -103,10 +103,10 @@ public class CanBlockAdditionalCreatureEffect extends ContinuousEffectImpl { default: text += CardUtil.numberToText(amount, "an") + " additional creature" + (amount > 1 ? "s" : ""); } - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { text += " this turn"; } - if (duration.equals(Duration.WhileOnBattlefield)) { + if (duration == Duration.WhileOnBattlefield) { text += " each combat"; } return text; diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java index 436ed02beb..131bdbbe3b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantAttackAnyPlayerAllEffect.java @@ -50,7 +50,7 @@ public class CantAttackAnyPlayerAllEffect extends RestrictionEffect { StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack"); if (!duration.toString().isEmpty()) { sb.append(' '); - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { sb.append(" this turn"); } else { sb.append(' ').append(duration.toString()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java index 67abeff84d..e79a133198 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java @@ -97,7 +97,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect { sb.append(" can't be blocked"); } - if (Duration.EndOfTurn.equals(this.duration)) { + if (Duration.EndOfTurn == this.duration) { sb.append(" this turn"); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAtLeastOneSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAtLeastOneSourceEffect.java index f150a28cd0..7779965ef7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAtLeastOneSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/MustBeBlockedByAtLeastOneSourceEffect.java @@ -68,7 +68,7 @@ public class MustBeBlockedByAtLeastOneSourceEffect extends RequirementEffect { public MustBeBlockedByAtLeastOneSourceEffect(Duration duration) { super(duration); - staticText = "{this} must be blocked " + (duration.equals(Duration.EndOfTurn) ? "this turn " : "") + "if able"; + staticText = "{this} must be blocked " + (duration == Duration.EndOfTurn ? "this turn " : "") + "if able"; } public MustBeBlockedByAtLeastOneSourceEffect(final MustBeBlockedByAtLeastOneSourceEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesAuraSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesAuraSourceEffect.java index dc731efe9e..4a27866dd3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesAuraSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesAuraSourceEffect.java @@ -108,7 +108,7 @@ public class BecomesAuraSourceEffect extends ContinuousEffectImpl implements Sou @Override public boolean hasLayer(Layer layer) { - return Layer.AbilityAddingRemovingEffects_6.equals(layer) || Layer.TypeChangingEffects_4.equals(layer); + return Layer.AbilityAddingRemovingEffects_6 == layer || Layer.TypeChangingEffects_4 == layer; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index dd1fbc9c6f..5ada0f6b1c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -215,7 +215,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { sb.append(landType); } } - if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { + if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) { sb.append(' ').append(duration.toString()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java index 8e0c19724e..51ad5a94d8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureSourceEffect.java @@ -160,7 +160,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements } } return true; - } else if (duration.equals(Duration.Custom)) { + } else if (duration == Duration.Custom) { this.discard(); } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java index 833597d81a..838014740d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTargetEffect.java @@ -144,7 +144,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { result = true; } } - if (!result && this.duration.equals(Duration.Custom)) { + if (!result && this.duration == Duration.Custom) { this.discard(); } return result; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java index f7bb98281d..ed1d1e817e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureTypeTargetEffect.java @@ -84,7 +84,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl { break; } } else { - if (duration.equals(Duration.Custom)) { + if (duration == Duration.Custom) { discard(); } } @@ -100,7 +100,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl { private String setText() { StringBuilder sb = new StringBuilder(); sb.append("Target creature becomes that type"); - if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) { + if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) { sb.append(' ').append(duration.toString()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java index 43d7ce2faa..bd04bd6eaa 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesFaceDownCreatureEffect.java @@ -89,7 +89,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen this.objectReference = objectReference; this.zoneChangeCounter = Integer.MIN_VALUE; if (turnFaceUpCosts != null) { - this.turnFaceUpAbility = new TurnFaceUpAbility(turnFaceUpCosts, faceDownType.equals(FaceDownType.MEGAMORPHED)); + this.turnFaceUpAbility = new TurnFaceUpAbility(turnFaceUpCosts, faceDownType == FaceDownType.MEGAMORPHED); } staticText = "{this} becomes a 2/2 face-down creature, with no text, no name, no subtypes, and no mana cost"; foundPermanent = false; @@ -124,7 +124,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen @Override public void init(Ability source, Game game) { super.init(source, game); - if (faceDownType.equals(FaceDownType.MANUAL)) { + if (faceDownType == FaceDownType.MANUAL) { Permanent permanent; if (objectReference != null) { permanent = objectReference.getPermanent(game); @@ -200,7 +200,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen permanent.getToughness().setValue(2); } } - } else if (duration.equals(Duration.Custom) && foundPermanent == true) { + } else if (duration == Duration.Custom && foundPermanent == true) { discard(); } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java index f59a794e8e..56d365283f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesSubtypeAllEffect.java @@ -86,7 +86,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl { } break; } - } else if (duration.equals(Duration.Custom)) { + } else if (duration == Duration.Custom) { discard(); } } @@ -102,7 +102,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl { StringBuilder sb = new StringBuilder(); sb.append("Target creature becomes that type"); if (!duration.toString().isEmpty() - && !duration.equals(Duration.EndOfGame)) { + && duration != Duration.EndOfGame) { sb.append(' ').append(duration.toString()); } return sb.toString(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java index 1182383da3..486e5ed744 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java @@ -108,7 +108,7 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl { } case GRAVEYARD: case EXILED: - if (((ZoneChangeEvent) event).getFromZone().equals(Zone.STACK)) { + if (((ZoneChangeEvent) event).getFromZone() == Zone.STACK) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && commanderId.equals(spell.getSourceId())) { return true; @@ -147,7 +147,7 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl { } } else { Card card = null; - if (((ZoneChangeEvent) event).getFromZone().equals(Zone.STACK)) { + if (((ZoneChangeEvent) event).getFromZone() == Zone.STACK) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null) { card = game.getCard(spell.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java index 513fe0f5ae..962a782ead 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityAllEffect.java @@ -179,7 +179,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl { sb.append("Other "); } sb.append(filter.getMessage()); - if (duration.equals(Duration.WhileOnBattlefield)) { + if (duration == Duration.WhileOnBattlefield) { if (filter.getMessage().toLowerCase().startsWith("each")) { sb.append(" has "); } else { diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java index 2bd6476997..7db331292c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityControllerEffect.java @@ -82,7 +82,7 @@ public class GainAbilityControllerEffect extends ContinuousEffectImpl { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.addAbility(ability); - if (duration.equals(Duration.Custom)) { + if (duration == Duration.Custom) { if (game.getPermanent(source.getSourceId()) == null) { discard(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java index 1d6666a93a..3b4b491b5e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilitySourceEffect.java @@ -128,7 +128,7 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou return true; } } - if (duration.equals(Duration.Custom)) { + if (duration == Duration.Custom) { this.discard(); } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java index 8f14b71150..91f1d4af73 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java @@ -149,7 +149,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl { } } } - if (duration.equals(Duration.Custom) && affectedTargets == 0) { + if (duration == Duration.Custom && affectedTargets == 0) { this.discard(); } return affectedTargets > 0; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainSuspendEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainSuspendEffect.java index 2af1d49efc..2891e9f417 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainSuspendEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainSuspendEffect.java @@ -67,7 +67,7 @@ public class GainSuspendEffect extends ContinuousEffectImpl implements SourceEff @Override public boolean apply(Game game, Ability source) { Card card = game.getCard(mor.getSourceId()); - if (card != null && mor.refersTo(card, game) && game.getState().getZone(card.getId()).equals(Zone.EXILED)) { + if (card != null && mor.refersTo(card, game) && game.getState().getZone(card.getId()) == Zone.EXILED) { SuspendAbility.addSuspendTemporaryToCard(card, source, game); } else { discard(); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllAbilitiesAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllAbilitiesAllEffect.java index 85da971ab9..a458a75600 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllAbilitiesAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/LoseAllAbilitiesAllEffect.java @@ -74,7 +74,7 @@ public class LoseAllAbilitiesAllEffect extends ContinuousEffectImpl { @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); - if (duration.equals(Duration.EndOfTurn)) { + if (duration == Duration.EndOfTurn) { sb.append(duration.toString()).append(", "); } sb.append(filter.getMessage()).append(" lose all abilities."); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java index e81642e823..ef212b15af 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java @@ -166,9 +166,9 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { break; } sb.append("maximum hand size"); - if (handSizeModification.equals(HandSizeModification.INCREASE)) { + if (handSizeModification == HandSizeModification.INCREASE) { sb.append(" is increased by "); - } else if (handSizeModification.equals(HandSizeModification.REDUCE)) { + } else if (handSizeModification == HandSizeModification.REDUCE) { sb.append(" is reduced by "); } else if ((handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) || !(handSize instanceof StaticValue)) { sb.append(" is "); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java index 8182274c24..725b5306ee 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessSourceEffect.java @@ -53,7 +53,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl { public SetPowerToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) { super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature); - setCharacterDefining(subLayer.equals(SubLayer.CharacteristicDefining_7a)); + setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a); this.amount = amount; staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapAllDuringEachOtherPlayersUntapStepEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapAllDuringEachOtherPlayersUntapStepEffect.java index 9fb4fabaef..e7a40be5f5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapAllDuringEachOtherPlayersUntapStepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapAllDuringEachOtherPlayersUntapStepEffect.java @@ -82,7 +82,7 @@ public class UntapAllDuringEachOtherPlayersUntapStepEffect extends ContinuousEff } } } - } else if (applied && layer.equals(Layer.RulesEffects)) { + } else if (applied && layer == Layer.RulesEffects) { if (game.getStep().getType() == PhaseStep.END_TURN) { game.getState().setValue(source.getSourceId() + "applied", false); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index f1b1bb981c..3233d7a286 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -115,7 +115,7 @@ public class AddCountersSourceEffect extends OneShotEffect { } } else { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent == null && source.getAbilityType().equals(AbilityType.STATIC)) { + if (permanent == null && source.getAbilityType() == AbilityType.STATIC) { permanent = game.getPermanentEntering(source.getSourceId()); } if (permanent != null) { diff --git a/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java b/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java index 6d35515677..a69c5aa538 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BestowAbility.java @@ -175,7 +175,7 @@ class BestowEntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return EventType.ENTERS_THE_BATTLEFIELD_SELF.equals(event.getType()); + return EventType.ENTERS_THE_BATTLEFIELD_SELF == event.getType(); } @Override diff --git a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java index fd3f408d60..ceb9e90a7d 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java @@ -115,7 +115,7 @@ public class ConvokeAbility extends SimpleStaticAbility implements AlternateMana public void addSpecialAction(Ability source, Game game, ManaCost unpaid) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && game.getBattlefield().contains(filterUntapped, controller.getId(), 1, game)) { - if (source.getAbilityType().equals(AbilityType.SPELL)) { + if (source.getAbilityType() == AbilityType.SPELL) { SpecialAction specialAction = new ConvokeSpecialAction(unpaid); specialAction.setControllerId(source.getControllerId()); specialAction.setSourceId(source.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java b/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java index 5ff77dd9c9..97c03922d1 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DelveAbility.java @@ -100,7 +100,7 @@ public class DelveAbility extends SimpleStaticAbility implements AlternateManaPa public void addSpecialAction(Ability source, Game game, ManaCost unpaid) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && !controller.getGraveyard().isEmpty()) { - if (unpaid.getMana().getGeneric() > 0 && source.getAbilityType().equals(AbilityType.SPELL)) { + if (unpaid.getMana().getGeneric() > 0 && source.getAbilityType() == AbilityType.SPELL) { SpecialAction specialAction = new DelveSpecialAction(); specialAction.setControllerId(source.getControllerId()); specialAction.setSourceId(source.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java index a98f93567f..6fd2119c17 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java @@ -96,7 +96,7 @@ public class EchoAbility extends TriggeredAbilityImpl { this.echoPaid = false; } - if (event.getType().equals(GameEvent.EventType.UPKEEP_STEP_PRE)) { + if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { if(lastController != null){ if(!lastController.equals(this.controllerId)){ this.echoPaid = false; diff --git a/Mage/src/main/java/mage/abilities/keyword/ForecastAbility.java b/Mage/src/main/java/mage/abilities/keyword/ForecastAbility.java index cf47b3a56f..a23e221fff 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ForecastAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ForecastAbility.java @@ -71,7 +71,7 @@ public class ForecastAbility extends LimitedTimesPerTurnActivatedAbility { public boolean canActivate(UUID playerId, Game game) { // May be activated only during the upkeep step of the card's owner // Because it can only be activated from a players hand it should be ok to check here with controllerId instead of card.getOwnerId(). - if (!game.getActivePlayerId().equals(controllerId) || !PhaseStep.UPKEEP.equals(game.getStep().getType())) { + if (!game.getActivePlayerId().equals(controllerId) || PhaseStep.UPKEEP != game.getStep().getType()) { return false; } return super.canActivate(playerId, game); diff --git a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java index 2ef128b03a..6a6adb7839 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HauntAbility.java @@ -98,12 +98,12 @@ public class HauntAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { switch (event.getType()) { case ENTERS_THE_BATTLEFIELD: - if (game.getState().getZone(getSourceId()).equals(Zone.BATTLEFIELD)) { + if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) { return event.getTargetId().equals(getSourceId()); } break; case ZONE_CHANGE: - if (!usedFromExile &&game.getState().getZone(getSourceId()).equals(Zone.EXILED)) { + if (!usedFromExile && game.getState().getZone(getSourceId()) == Zone.EXILED) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.isDiesEvent()) { Card card = game.getCard(getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java index e897faae38..dad2df5a91 100644 --- a/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/KickerAbility.java @@ -197,13 +197,13 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo private String getActivationKey(Ability source, String costText, Game game) { int zcc = 0; - if (source.getAbilityType().equals(AbilityType.TRIGGERED)) { + if (source.getAbilityType() == AbilityType.TRIGGERED) { zcc = source.getSourceObjectZoneChangeCounter(); } if (zcc == 0) { zcc = game.getState().getZoneChangeCounter(source.getSourceId()); } - if (zcc > 0 && (source.getAbilityType().equals(AbilityType.TRIGGERED))) { + if (zcc > 0 && (source.getAbilityType() == AbilityType.TRIGGERED)) { --zcc; } return String.valueOf(zcc) + ((kickerCosts.size() > 1) ? costText : ""); diff --git a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java index fa8f8b6e08..5a81ae7d19 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MorphAbility.java @@ -200,7 +200,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost @Override public boolean askToActivateAlternativeCosts(Ability ability, Game game) { - if (ability.getAbilityType().equals(AbilityType.SPELL)) { + if (ability.getAbilityType() == AbilityType.SPELL) { Player player = game.getPlayer(controllerId); Spell spell = game.getStack().getSpell(ability.getId()); if (player != null && spell != null) { @@ -233,7 +233,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost } } } - if (ability.getAbilityType().equals(AbilityType.PLAY_LAND)) { + if (ability.getAbilityType() == AbilityType.PLAY_LAND) { Player player = game.getPlayer(controllerId); if (player != null) { this.resetMorph(); diff --git a/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java b/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java index 5e3baf1d3d..17bcf1d600 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ReboundAbility.java @@ -108,7 +108,7 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl { && event.getSourceId() != null && event.getSourceId().equals(source.getSourceId())) { // if countered the source.sourceId is different or null if it fizzles Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getFromZone().equals(Zone.HAND)) { + if (spell != null && spell.getFromZone() == Zone.HAND) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java index a688f576a4..deef93c61b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java @@ -141,7 +141,7 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return EventType.ZONE_CHANGE.equals(event.getType()); + return EventType.ZONE_CHANGE == event.getType(); } @Override diff --git a/Mage/src/main/java/mage/cards/ExpansionSet.java b/Mage/src/main/java/mage/cards/ExpansionSet.java index 14850e62cc..a16ab16f41 100644 --- a/Mage/src/main/java/mage/cards/ExpansionSet.java +++ b/Mage/src/main/java/mage/cards/ExpansionSet.java @@ -399,7 +399,7 @@ public abstract class ExpansionSet implements Serializable { savedCardsInfos = CardRepository.instance.findCards(criteria); // Workaround after card number is numeric if (maxCardNumberInBooster != Integer.MAX_VALUE) { - savedCardsInfos.removeIf(next -> Integer.valueOf(next.getCardNumber()) > maxCardNumberInBooster && !rarity.equals(Rarity.LAND)); + savedCardsInfos.removeIf(next -> Integer.valueOf(next.getCardNumber()) > maxCardNumberInBooster && rarity != Rarity.LAND); } savedCards.put(rarity, savedCardsInfos); diff --git a/Mage/src/main/java/mage/cards/repository/CardScanner.java b/Mage/src/main/java/mage/cards/repository/CardScanner.java index 708ee30805..943dfc7732 100644 --- a/Mage/src/main/java/mage/cards/repository/CardScanner.java +++ b/Mage/src/main/java/mage/cards/repository/CardScanner.java @@ -58,7 +58,7 @@ public final class CardScanner { || !expansionInfo.code.equals(set.getCode()) || (expansionInfo.blockName == null ? set.getBlockName() != null : !expansionInfo.blockName.equals(set.getBlockName())) || !expansionInfo.releaseDate.equals(set.getReleaseDate()) - || !expansionInfo.type.equals(set.getSetType()) + || expansionInfo.type != set.getSetType() || expansionInfo.boosters != set.hasBoosters() || expansionInfo.basicLands != set.hasBasicLands()) { ExpansionRepository.instance.update(expansionInfo); diff --git a/Mage/src/main/java/mage/filter/FilterAbility.java b/Mage/src/main/java/mage/filter/FilterAbility.java index d1d8db8870..b3f5ebfe28 100644 --- a/Mage/src/main/java/mage/filter/FilterAbility.java +++ b/Mage/src/main/java/mage/filter/FilterAbility.java @@ -94,7 +94,7 @@ public class FilterAbility extends FilterImpl { @Override public boolean apply(Ability input, Game game) { - return input.getAbilityType().equals(type); + return input.getAbilityType() == type; } @Override diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/MulticoloredPredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/MulticoloredPredicate.java index 06e80094b1..b5bc36ef68 100644 --- a/Mage/src/main/java/mage/filter/predicate/mageobject/MulticoloredPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/MulticoloredPredicate.java @@ -44,7 +44,7 @@ public class MulticoloredPredicate implements Predicate { // 708.3. Each split card that consists of two halves with different colored mana symbols in their mana costs // is a multicolored card while it’s not a spell on the stack. While it’s a spell on the stack, it’s only the // color or colors of the half or halves being cast. # - if (input instanceof SplitCardHalf && !game.getState().getZone(input.getId()).equals(Zone.STACK)) { + if (input instanceof SplitCardHalf && game.getState().getZone(input.getId()) != Zone.STACK) { return 1 < ((SplitCardHalf) input).getMainCard().getColor(game).getColorCount(); } else { return 1 < input.getColor(game).getColorCount(); diff --git a/Mage/src/main/java/mage/filter/predicate/mageobject/NamePredicate.java b/Mage/src/main/java/mage/filter/predicate/mageobject/NamePredicate.java index 299ff48ba3..00b2fd8bb4 100644 --- a/Mage/src/main/java/mage/filter/predicate/mageobject/NamePredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/mageobject/NamePredicate.java @@ -52,7 +52,7 @@ public class NamePredicate implements Predicate { // A split card has the chosen name if one of its two names matches the chosen name. if (input instanceof SplitCard) { return name.equals(((SplitCard)input).getLeftHalfCard().getName()) || name.equals(((SplitCard)input).getRightHalfCard().getName()); - } else if (input instanceof Spell && ((Spell)input).getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)){ + } else if (input instanceof Spell && ((Spell) input).getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED){ SplitCard card = (SplitCard) ((Spell)input).getCard(); return name.equals(card.getLeftHalfCard().getName()) || name.equals(card.getRightHalfCard().getName()); } else { diff --git a/Mage/src/main/java/mage/game/Table.java b/Mage/src/main/java/mage/game/Table.java index aa779be8fa..7850809ec3 100644 --- a/Mage/src/main/java/mage/game/Table.java +++ b/Mage/src/main/java/mage/game/Table.java @@ -234,7 +234,7 @@ public class Table implements Serializable { Player player = seats[i].getPlayer(); if (player != null && player.getId().equals(playerId)) { seats[i].setPlayer(null); - if (getState().equals(TableState.READY_TO_START)) { + if (getState() == TableState.READY_TO_START) { setState(TableState.WAITING); } break; diff --git a/Mage/src/main/java/mage/game/ZonesHandler.java b/Mage/src/main/java/mage/game/ZonesHandler.java index ba835095d0..644ed9aa44 100644 --- a/Mage/src/main/java/mage/game/ZonesHandler.java +++ b/Mage/src/main/java/mage/game/ZonesHandler.java @@ -283,7 +283,7 @@ public final class ZonesHandler { private static Card takeAttributesFromSpell(Card card, ZoneChangeEvent event, Game game) { card = card.copy(); - if (Zone.STACK.equals(event.getFromZone())) { + if (Zone.STACK == event.getFromZone()) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && !spell.isFaceDown(game)) { if (!card.getColor(game).equals(spell.getColor(game))) { diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index d54613a9d3..df7753c642 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -99,7 +99,7 @@ public class Spell extends StackObjImpl implements Card { id = ability.getId(); this.ability = ability; this.ability.setControllerId(controllerId); - if (ability.getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) { + if (ability.getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) { spellCards.add(((SplitCard) card).getLeftHalfCard()); spellAbilities.add(((SplitCard) card).getLeftHalfCard().getSpellAbility().copy()); spellCards.add(((SplitCard) card).getRightHalfCard()); @@ -155,7 +155,7 @@ public class Spell extends StackObjImpl implements Card { ignoreAbility = false; } else { // costs for spliced abilities were added to main spellAbility, so pay no mana for spliced abilities - payNoMana |= spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE); + payNoMana |= spellAbility.getSpellAbilityType() == SpellAbilityType.SPLICE; if (!spellAbility.activate(game, payNoMana)) { return false; } @@ -375,15 +375,15 @@ public class Spell extends StackObjImpl implements Card { if (counteringObject instanceof StackObject) { counteringAbility = ((StackObject) counteringObject).getStackAbility(); } - if (zone.equals(Zone.LIBRARY)) { - if (zoneDetail.equals(ZoneDetail.CHOOSE)) { + if (zone == Zone.LIBRARY) { + if (zoneDetail == ZoneDetail.CHOOSE) { if (player.chooseUse(Outcome.Detriment, "Move countered spell to the top of the library? (otherwise it goes to the bottom)", counteringAbility, game)) { zoneDetail = ZoneDetail.TOP; } else { zoneDetail = ZoneDetail.BOTTOM; } } - if (zoneDetail.equals(ZoneDetail.TOP)) { + if (zoneDetail == ZoneDetail.TOP) { player.putCardsOnTopOfLibrary(new CardsImpl(card), game, counteringAbility, false); } else { player.putCardsOnBottomOfLibrary(new CardsImpl(card), game, counteringAbility, false); @@ -740,7 +740,7 @@ public class Spell extends StackObjImpl implements Card { // 706.10a If a copy of a spell is in a zone other than the stack, it ceases to exist. // If a copy of a card is in any zone other than the stack or the battlefield, it ceases to exist. // These are state-based actions. See rule 704. - if (this.isCopiedSpell() && !zone.equals(Zone.STACK)) { + if (this.isCopiedSpell() && zone != Zone.STACK) { return true; } return card.moveToZone(zone, sourceId, game, flag, appliedEffects); diff --git a/Mage/src/main/java/mage/players/ManaPool.java b/Mage/src/main/java/mage/players/ManaPool.java index fc15e9a634..71e131b29b 100644 --- a/Mage/src/main/java/mage/players/ManaPool.java +++ b/Mage/src/main/java/mage/players/ManaPool.java @@ -113,11 +113,11 @@ public class ManaPool implements Serializable { * @return */ public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay) { - if (!autoPayment && !manaType.equals(unlockedManaType)) { + if (!autoPayment && manaType != unlockedManaType) { // if manual payment and the needed mana type was not unlocked, nothing will be paid return false; } - if (autoPayment && autoPaymentRestricted && !wasManaAddedBeyondStock() && !manaType.equals(unlockedManaType)) { + if (autoPayment && autoPaymentRestricted && !wasManaAddedBeyondStock() && manaType != unlockedManaType) { // if automatic restricted payment and there is laready mana in the pool // and the needed mana type was not unlocked, nothing will be paid return false; @@ -137,7 +137,7 @@ public class ManaPool implements Serializable { } } } - if (!manaType.equals(unlockedManaType) && autoPayment && autoPaymentRestricted && mana.count() == mana.getStock()) { + if (manaType != unlockedManaType && autoPayment && autoPaymentRestricted && mana.count() == mana.getStock()) { // no mana added beyond the stock so don't auto pay this continue; } diff --git a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java index 5c1f3a53a6..a8a6355702 100644 --- a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java +++ b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java @@ -63,7 +63,7 @@ public class TargetActivatedAbility extends TargetObject { return false; } StackObject stackObject = game.getStack().getStackObject(id); - return stackObject != null && stackObject.getStackAbility() != null && stackObject.getStackAbility().getAbilityType().equals(AbilityType.ACTIVATED); + return stackObject != null && stackObject.getStackAbility() != null && stackObject.getStackAbility().getAbilityType() == AbilityType.ACTIVATED; } @Override @@ -92,7 +92,7 @@ public class TargetActivatedAbility extends TargetObject { public Set possibleTargets(UUID sourceControllerId, Game game) { Set possibleTargets = new HashSet<>(); for (StackObject stackObject : game.getStack()) { - if (stackObject.getStackAbility().getAbilityType().equals(AbilityType.ACTIVATED) && game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getStackAbility().getControllerId())) { + if (stackObject.getStackAbility().getAbilityType() == AbilityType.ACTIVATED && game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getStackAbility().getControllerId())) { possibleTargets.add(stackObject.getStackAbility().getId()); } } diff --git a/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java b/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java index 44e831b1f5..7913fd121a 100644 --- a/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CastFromGraveyardWatcher.java @@ -63,7 +63,7 @@ public class CastFromGraveyardWatcher extends Watcher { * play from other zones during the same step. But at least the state is * reset if the game comes to a new step */ - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone().equals(Zone.GRAVEYARD)) { + if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) { Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null) { HashSet zcc = spellsCastFromGraveyard.computeIfAbsent(spell.getSourceId(), k -> new HashSet<>()); diff --git a/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java b/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java index f0309d0ff8..e0de2c9c8f 100644 --- a/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java @@ -42,7 +42,7 @@ public class SpellsCastWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (EventType.SPELL_CAST.equals(event.getType())) { + if (EventType.SPELL_CAST == event.getType()) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell == null) { MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.STACK);