From f37c823aa8698f6c655f9fd934233c4c8d3a6155 Mon Sep 17 00:00:00 2001 From: vraskulin Date: Mon, 20 Mar 2017 14:00:18 +0300 Subject: [PATCH 01/20] String + string concatenation can be replaced by string + char concetenation --- Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java | 2 +- .../mage/test/cards/single/DivergentTransformationsTest.java | 2 +- Mage/src/main/java/mage/abilities/AbilityImpl.java | 2 +- .../mage/abilities/effects/PayCostToAttackBlockEffectImpl.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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 9eda832ecac..91324908844 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.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 0376f3fc39b..772923a1b6c 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/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 7cbce9ac759..cc30fc971fe 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/effects/PayCostToAttackBlockEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java index 9eb3e16e82f..aec6202603f 100644 --- a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java @@ -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); } From c783614cba6f72a944c75c5b71d988722b3c334f Mon Sep 17 00:00:00 2001 From: vraskulin Date: Mon, 20 Mar 2017 15:17:30 +0300 Subject: [PATCH 02/20] NotifyAll --- .../client/unusedFiles/DelayedViewerThread.java | 2 +- .../java/mage/client/game/StartMultiGamesTest.java | 2 +- .../src/mage/player/human/HumanPlayer.java | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) 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 851bffeabe2..89976b2669f 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/test/java/mage/client/game/StartMultiGamesTest.java b/Mage.Client/src/test/java/mage/client/game/StartMultiGamesTest.java index 10e2d072f90..f5dea6e8c51 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.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 6fe57b2d0a0..3c11dbc5879 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 @@ -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()); } } From 096efc895113678a48a5fca0279f0ed24690e15b Mon Sep 17 00:00:00 2001 From: Alexsandro Date: Mon, 20 Mar 2017 18:55:49 -0300 Subject: [PATCH 03/20] Implement Citadel of Pain --- Mage.Sets/src/mage/cards/c/CitadelOfPain.java | 104 ++++++++++++++++++ Mage.Sets/src/mage/sets/Prophecy.java | 1 + 2 files changed, 105 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CitadelOfPain.java diff --git a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java new file mode 100644 index 00000000000..c4285892fcc --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java @@ -0,0 +1,104 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.OnEventTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; + +/** + * + * @author Alexsandr0x + */ +public class CitadelOfPain extends CardImpl { + + public CitadelOfPain(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + + TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, + new CitadelOfPainEffect()); + // At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands he or she controls. + } + + public CitadelOfPain(final CitadelOfPain card) { + super(card); + } + + @Override + public CitadelOfPain copy() { + return new CitadelOfPain(this); + } +} + +class CitadelOfPainEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledLandPermanent(); + + static { + filter.add(Predicates.not(new TappedPredicate())); + } + + public CitadelOfPainEffect() { + super(Outcome.Damage); + } + + public CitadelOfPainEffect(Outcome outcome) { + super(outcome); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(targetPointer.getFirst(game, source)); + if (player != null) { + int damage = game.getBattlefield().countAll(filter, game.getActivePlayerId(), game); + player.damage(damage, source.getSourceId(), game, false, true); + return true; + } + return false; + } + + @Override + public Effect copy() { + return new CitadelOfPainEffect(); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Prophecy.java b/Mage.Sets/src/mage/sets/Prophecy.java index 601b1245480..34cfc2e6aed 100644 --- a/Mage.Sets/src/mage/sets/Prophecy.java +++ b/Mage.Sets/src/mage/sets/Prophecy.java @@ -71,6 +71,7 @@ public class Prophecy extends ExpansionSet { cards.add(new SetCardInfo("Calming Verse", 110, Rarity.COMMON, mage.cards.c.CalmingVerse.class)); cards.add(new SetCardInfo("Chilling Apparition", 59, Rarity.UNCOMMON, mage.cards.c.ChillingApparition.class)); cards.add(new SetCardInfo("Chimeric Idol", 136, Rarity.UNCOMMON, mage.cards.c.ChimericIdol.class)); + cards.add(new SetCardInfo("Citadel of Pain", 86, Rarity.UNCOMMON, mage.cards.c.CitadelOfPain.class)); cards.add(new SetCardInfo("Coastal Hornclaw", 31, Rarity.COMMON, mage.cards.c.CoastalHornclaw.class)); cards.add(new SetCardInfo("Darba", 111, Rarity.UNCOMMON, mage.cards.d.Darba.class)); cards.add(new SetCardInfo("Denying Wind", 32, Rarity.RARE, mage.cards.d.DenyingWind.class)); From a6e1c1a37d54bed67727aaf2b02fcfe837fa6971 Mon Sep 17 00:00:00 2001 From: Alexsandro Date: Mon, 20 Mar 2017 19:03:12 -0300 Subject: [PATCH 04/20] Add ability to cast --- Mage.Sets/src/mage/cards/c/CitadelOfPain.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java index c4285892fcc..86c9ece906d 100644 --- a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java +++ b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java @@ -58,6 +58,7 @@ public class CitadelOfPain extends CardImpl { TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new CitadelOfPainEffect()); // At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands he or she controls. + this.addAbility(triggered); } public CitadelOfPain(final CitadelOfPain card) { From b154bf58f9cd6b041ec3192427fd642524dc6ed8 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 22 Mar 2017 10:24:50 +0100 Subject: [PATCH 05/20] phantom effect code duplication --- .../src/mage/cards/p/PhantomCentaur.java | 84 +---------------- Mage.Sets/src/mage/cards/p/PhantomFlock.java | 91 ++----------------- .../src/mage/cards/p/PhantomNantuko.java | 81 +---------------- .../src/mage/cards/p/PhantomNishoba.java | 91 ++----------------- Mage.Sets/src/mage/cards/p/PhantomNomad.java | 84 +---------------- Mage.Sets/src/mage/cards/p/PhantomTiger.java | 85 +---------------- Mage.Sets/src/mage/cards/p/PhantomWurm.java | 84 +---------------- .../effects/PhantomPreventionEffect.java | 81 +++++++++++++++++ 8 files changed, 121 insertions(+), 560 deletions(-) create mode 100644 Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java diff --git a/Mage.Sets/src/mage/cards/p/PhantomCentaur.java b/Mage.Sets/src/mage/cards/p/PhantomCentaur.java index 924c5e8b205..2567877bc04 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomCentaur.java +++ b/Mage.Sets/src/mage/cards/p/PhantomCentaur.java @@ -27,35 +27,28 @@ */ package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.PhantomPreventionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.turn.Step; + +import java.util.UUID; /** - * * @author LevelX2 */ public class PhantomCentaur extends CardImpl { public PhantomCentaur(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); this.subtype.add("Centaur"); this.subtype.add("Spirit"); @@ -69,7 +62,7 @@ public class PhantomCentaur extends CardImpl { this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)), "with three +1/+1 counters on it")); // If damage would be dealt to Phantom Centaur, prevent that damage. Remove a +1/+1 counter from Phantom Centaur. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomCentaurPreventionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomPreventionEffect())); } public PhantomCentaur(final PhantomCentaur card) { @@ -82,70 +75,3 @@ public class PhantomCentaur extends CardImpl { } } -class PhantomCentaurPreventionEffect extends PreventionEffectImpl { - - // remember turn and phase step to check if counter in this step was already removed - private int turn = 0; - private Step combatPhaseStep = null; - - public PhantomCentaurPreventionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; - } - - public PhantomCentaurPreventionEffect(final PhantomCentaurPreventionEffect effect) { - super(effect); - this.turn = effect.turn; - this.combatPhaseStep = effect.combatPhaseStep; - } - - @Override - public PhantomCentaurPreventionEffect copy() { - return new PhantomCentaurPreventionEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamageAction(event, source, game); - - Permanent permanent = game.getPermanent(source.getSourceId()); - 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.getTurnNum() == turn - && game.getTurn().getStep().equals(combatPhaseStep)) { - removeCounter = false; - } else { - turn = game.getTurnNum(); - combatPhaseStep = game.getTurn().getStep(); - } - } - - if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { - StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); - sb.append("Removed a +1/+1 counter "); - game.informPlayers(sb.toString()); - } - } - - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } - } - return false; - } - -} diff --git a/Mage.Sets/src/mage/cards/p/PhantomFlock.java b/Mage.Sets/src/mage/cards/p/PhantomFlock.java index 517d927afb3..f3573f59d57 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomFlock.java +++ b/Mage.Sets/src/mage/cards/p/PhantomFlock.java @@ -27,34 +27,27 @@ */ package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.PhantomPreventionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.turn.Step; + +import java.util.UUID; /** - * * @author emerald000 */ public class PhantomFlock extends CardImpl { public PhantomFlock(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}"); this.subtype.add("Bird"); this.subtype.add("Soldier"); this.subtype.add("Spirit"); @@ -63,12 +56,12 @@ public class PhantomFlock extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - + // Phantom Flock enters the battlefield with three +1/+1 counters on it. this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)), "with three +1/+1 counters on it")); - + // If damage would be dealt to Phantom Flock, prevent that damage. Remove a +1/+1 counter from Phantom Flock. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomFlockPreventionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomPreventionEffect())); } public PhantomFlock(final PhantomFlock card) { @@ -79,72 +72,4 @@ public class PhantomFlock extends CardImpl { public PhantomFlock copy() { return new PhantomFlock(this); } -} - -class PhantomFlockPreventionEffect extends PreventionEffectImpl { - - // remember turn and phase step to check if counter in this step was already removed - private int turn = 0; - private Step combatPhaseStep = null; - - PhantomFlockPreventionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; - } - - PhantomFlockPreventionEffect(final PhantomFlockPreventionEffect effect) { - super(effect); - this.turn = effect.turn; - this.combatPhaseStep = effect.combatPhaseStep; - } - - @Override - public PhantomFlockPreventionEffect copy() { - return new PhantomFlockPreventionEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamageAction(event, source, game); - - Permanent permanent = game.getPermanent(source.getSourceId()); - 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.getTurnNum() == turn - && game.getTurn().getStep().equals(combatPhaseStep)) { - removeCounter = false; - } else { - turn = game.getTurnNum(); - combatPhaseStep = game.getTurn().getStep(); - } - } - - if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { - StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); - sb.append("Removed a +1/+1 counter "); - game.informPlayers(sb.toString()); - } - } - - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } - } - return false; - } - -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/p/PhantomNantuko.java b/Mage.Sets/src/mage/cards/p/PhantomNantuko.java index fd1898d4468..bb5415b4396 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomNantuko.java +++ b/Mage.Sets/src/mage/cards/p/PhantomNantuko.java @@ -27,27 +27,21 @@ */ package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.PhantomPreventionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.turn.Step; + +import java.util.UUID; /** * @@ -68,7 +62,7 @@ public class PhantomNantuko extends CardImpl { // Phantom Nantuko enters the battlefield with two +1/+1 counters on it. this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2), true), "with two +1/+1 counters on it")); // If damage would be dealt to Phantom Nantuko, prevent that damage. Remove a +1/+1 counter from Phantom Nantuko. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomNantukoPreventionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomPreventionEffect())); // {tap}: Put a +1/+1 counter on Phantom Nantuko. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new TapSourceCost())); } @@ -83,70 +77,3 @@ public class PhantomNantuko extends CardImpl { } } -class PhantomNantukoPreventionEffect extends PreventionEffectImpl { - - // remember turn and phase step to check if counter in this step was already removed - private int turn = 0; - private Step combatPhaseStep = null; - - public PhantomNantukoPreventionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; - } - - public PhantomNantukoPreventionEffect(final PhantomNantukoPreventionEffect effect) { - super(effect); - this.turn = effect.turn; - this.combatPhaseStep = effect.combatPhaseStep; - } - - @Override - public PhantomNantukoPreventionEffect copy() { - return new PhantomNantukoPreventionEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamageAction(event, source, game); - - Permanent permanent = game.getPermanent(source.getSourceId()); - 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() == PhaseStep.COMBAT_DAMAGE) { - if (game.getTurnNum() == turn - && game.getTurn().getStep().equals(combatPhaseStep)) { - removeCounter = false; - } else { - turn = game.getTurnNum(); - combatPhaseStep = game.getTurn().getStep(); - } - } - - if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { - StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); - sb.append("Removed a +1/+1 counter "); - game.informPlayers(sb.toString()); - } - } - - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } - } - return false; - } - -} diff --git a/Mage.Sets/src/mage/cards/p/PhantomNishoba.java b/Mage.Sets/src/mage/cards/p/PhantomNishoba.java index 3162aaa36ae..bf380299b2e 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomNishoba.java +++ b/Mage.Sets/src/mage/cards/p/PhantomNishoba.java @@ -27,35 +27,28 @@ */ package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.DealsDamageGainLifeSourceTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.PhantomPreventionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.turn.Step; + +import java.util.UUID; /** - * * @author fireshoes */ public class PhantomNishoba extends CardImpl { public PhantomNishoba(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{W}"); this.subtype.add("Cat"); this.subtype.add("Beast"); this.subtype.add("Spirit"); @@ -64,15 +57,15 @@ public class PhantomNishoba extends CardImpl { // Trample this.addAbility(TrampleAbility.getInstance()); - + // Phantom Nishoba enters the battlefield with seven +1/+1 counters on it. this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(7), true), "with seven +1/+1 counters on it")); - + // Whenever Phantom Nishoba deals damage, you gain that much life. this.addAbility(new DealsDamageGainLifeSourceTriggeredAbility()); - + // If damage would be dealt to Phantom Nishoba, prevent that damage. Remove a +1/+1 counter from Phantom Nishoba. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomNishobaPreventionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomPreventionEffect())); } public PhantomNishoba(final PhantomNishoba card) { @@ -83,72 +76,4 @@ public class PhantomNishoba extends CardImpl { public PhantomNishoba copy() { return new PhantomNishoba(this); } -} - -class PhantomNishobaPreventionEffect extends PreventionEffectImpl { - - // remember turn and phase step to check if counter in this step was already removed - private int turn = 0; - private Step combatPhaseStep = null; - - public PhantomNishobaPreventionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; - } - - public PhantomNishobaPreventionEffect(final PhantomNishobaPreventionEffect effect) { - super(effect); - this.turn = effect.turn; - this.combatPhaseStep = effect.combatPhaseStep; - } - - @Override - public PhantomNishobaPreventionEffect copy() { - return new PhantomNishobaPreventionEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamageAction(event, source, game); - - Permanent permanent = game.getPermanent(source.getSourceId()); - 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.getTurnNum() == turn - && game.getTurn().getStep().equals(combatPhaseStep)) { - removeCounter = false; - } else { - turn = game.getTurnNum(); - combatPhaseStep = game.getTurn().getStep(); - } - } - - if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { - StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); - sb.append("Removed a +1/+1 counter "); - game.informPlayers(sb.toString()); - } - } - - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } - } - return false; - } - } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/p/PhantomNomad.java b/Mage.Sets/src/mage/cards/p/PhantomNomad.java index 28d5181191c..69046f978c1 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomNomad.java +++ b/Mage.Sets/src/mage/cards/p/PhantomNomad.java @@ -27,24 +27,18 @@ */ package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.PhantomPreventionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.turn.Step; + +import java.util.UUID; /** * @@ -65,7 +59,7 @@ public class PhantomNomad extends CardImpl { "two +1/+1 counters on it")); // If damage would be dealt to Phantom Nomad, prevent that damage. Remove a +1/+1 counter from Phantom Nomad. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomNomadPreventionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomPreventionEffect())); } @@ -78,72 +72,4 @@ public class PhantomNomad extends CardImpl { public PhantomNomad copy() { return new PhantomNomad(this); } -} - -class PhantomNomadPreventionEffect extends PreventionEffectImpl { - - // remember turn and phase step to check if counter in this step was already removed - private int turn = 0; - private Step combatPhaseStep = null; - - public PhantomNomadPreventionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; - } - - public PhantomNomadPreventionEffect(final PhantomNomadPreventionEffect effect) { - super(effect); - this.turn = effect.turn; - this.combatPhaseStep = effect.combatPhaseStep; - } - - @Override - public PhantomNomadPreventionEffect copy() { - return new PhantomNomadPreventionEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamageAction(event, source, game); - - Permanent permanent = game.getPermanent(source.getSourceId()); - 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.getTurnNum() == turn - && game.getTurn().getStep().equals(combatPhaseStep)) { - removeCounter = false; - } else { - turn = game.getTurnNum(); - combatPhaseStep = game.getTurn().getStep(); - } - } - - if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { - StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); - sb.append("Removed a +1/+1 counter "); - game.informPlayers(sb.toString()); - } - } - - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } - } - return false; - } - -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/p/PhantomTiger.java b/Mage.Sets/src/mage/cards/p/PhantomTiger.java index 0f96aecb419..1f453808ba8 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomTiger.java +++ b/Mage.Sets/src/mage/cards/p/PhantomTiger.java @@ -27,25 +27,18 @@ */ package mage.cards.p; -import java.util.UUID; - import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.PhantomPreventionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.turn.Step; + +import java.util.UUID; /** * @author Temba @@ -63,7 +56,7 @@ public class PhantomTiger extends CardImpl { this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), "with two +1/+1 counters on it")); // If damage would be dealt to Phantom Tiger, prevent that damage. Remove a +1/+1 counter from Phantom Tiger. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomTigerPreventionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomPreventionEffect())); } public PhantomTiger(final PhantomTiger card) { @@ -74,72 +67,4 @@ public class PhantomTiger extends CardImpl { public PhantomTiger copy() { return new PhantomTiger(this); } -} - -class PhantomTigerPreventionEffect extends PreventionEffectImpl { - - // remember turn and phase step to check if counter in this step was already removed - private int turn = 0; - private Step combatPhaseStep = null; - - public PhantomTigerPreventionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; - } - - public PhantomTigerPreventionEffect(final PhantomTigerPreventionEffect effect) { - super(effect); - this.turn = effect.turn; - this.combatPhaseStep = effect.combatPhaseStep; - } - - @Override - public PhantomTigerPreventionEffect copy() { - return new PhantomTigerPreventionEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamageAction(event, source, game); - - Permanent permanent = game.getPermanent(source.getSourceId()); - 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() == PhaseStep.COMBAT_DAMAGE) { - if (game.getTurnNum() == turn - && game.getTurn().getStep().equals(combatPhaseStep)) { - removeCounter = false; - } else { - turn = game.getTurnNum(); - combatPhaseStep = game.getTurn().getStep(); - } - } - - if (removeCounter && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { - StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); - sb.append("Removed a +1/+1 counter "); - game.informPlayers(sb.toString()); - } - } - - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } - } - return false; - } - -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/p/PhantomWurm.java b/Mage.Sets/src/mage/cards/p/PhantomWurm.java index 13a03e1f84c..fef5a5c81d4 100644 --- a/Mage.Sets/src/mage/cards/p/PhantomWurm.java +++ b/Mage.Sets/src/mage/cards/p/PhantomWurm.java @@ -27,24 +27,18 @@ */ package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.PhantomPreventionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.turn.Step; + +import java.util.UUID; /** * @@ -65,7 +59,7 @@ public class PhantomWurm extends CardImpl { "with four +1/+1 counters on it")); // If damage would be dealt to Phantom Wurm, prevent that damage. Remove a +1/+1 counter from Phantom Wurm. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomWurmPreventionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomPreventionEffect())); } public PhantomWurm(final PhantomWurm card) { @@ -76,72 +70,4 @@ public class PhantomWurm extends CardImpl { public PhantomWurm copy() { return new PhantomWurm(this); } -} - -class PhantomWurmPreventionEffect extends PreventionEffectImpl { - - // remember turn and phase step to check if counter in this step was already removed - private int turn = 0; - private Step combatPhaseStep = null; - - public PhantomWurmPreventionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; - } - - public PhantomWurmPreventionEffect(final PhantomWurmPreventionEffect effect) { - super(effect); - this.turn = effect.turn; - this.combatPhaseStep = effect.combatPhaseStep; - } - - @Override - public PhantomWurmPreventionEffect copy() { - return new PhantomWurmPreventionEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - preventDamageAction(event, source, game); - - Permanent permanent = game.getPermanent(source.getSourceId()); - 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() == PhaseStep.COMBAT_DAMAGE) { - if (game.getTurnNum() == turn - && game.getTurn().getStep().equals(combatPhaseStep)) { - removeCounter = false; - } else { - turn = game.getTurnNum(); - combatPhaseStep = game.getTurn().getStep(); - } - } - - if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { - StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); - permanent.removeCounters(CounterType.P1P1.createInstance(), game); - sb.append("Removed a +1/+1 counter "); - game.informPlayers(sb.toString()); - } - } - - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getTargetId().equals(source.getSourceId())) { - return true; - } - } - return false; - } - -} +} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java b/Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java new file mode 100644 index 00000000000..737d6a68fa4 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/PhantomPreventionEffect.java @@ -0,0 +1,81 @@ +package mage.abilities.effects; + +import mage.abilities.Ability; +import mage.constants.Duration; +import mage.constants.PhaseStep; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.turn.Step; + +/** + * Created by IGOUDT on 22-3-2017. + */ +public class PhantomPreventionEffect extends PreventionEffectImpl { + + // remember turn and phase step to check if counter in this step was already removed + private int turn = 0; + private Step combatPhaseStep = null; + + public PhantomPreventionEffect() { + super(Duration.WhileOnBattlefield); + staticText = "If damage would be dealt to {this}, prevent that damage. Remove a +1/+1 counter from {this}"; + } + + public PhantomPreventionEffect(final PhantomPreventionEffect effect) { + super(effect); + this.turn = effect.turn; + this.combatPhaseStep = effect.combatPhaseStep; + } + + @Override + public PhantomPreventionEffect copy() { + return new PhantomPreventionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + preventDamageAction(event, source, game); + + Permanent permanent = game.getPermanent(source.getSourceId()); + 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() == PhaseStep.COMBAT_DAMAGE) { + if (game.getTurnNum() == turn + && game.getTurn().getStep().equals(combatPhaseStep)) { + removeCounter = false; + } else { + turn = game.getTurnNum(); + combatPhaseStep = game.getTurn().getStep(); + } + } + + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { + StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); + permanent.removeCounters(CounterType.P1P1.createInstance(), game); + sb.append("Removed a +1/+1 counter "); + game.informPlayers(sb.toString()); + } + } + + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (super.applies(event, source, game)) { + if (event.getTargetId().equals(source.getSourceId())) { + return true; + } + } + return false; + } + +} From d93061c0bc67bac27aa774f291a31b58cb793826 Mon Sep 17 00:00:00 2001 From: vraskulin Date: Wed, 22 Mar 2017 14:50:46 +0300 Subject: [PATCH 06/20] Equals should be compared with == but not equals() --- .../src/main/java/mage/client/MageFrame.java | 4 +- .../main/java/mage/client/cards/BigCard.java | 2 +- .../main/java/mage/client/cards/CardGrid.java | 2 +- .../mage/client/chat/ChatPanelSeparated.java | 4 +- .../components/ext/dlg/DialogContainer.java | 2 +- .../client/dialog/CardInfoWindowDialog.java | 4 +- .../mage/client/dialog/PreferencesDialog.java | 2 +- .../main/java/mage/client/game/GamePanel.java | 6 +- .../client/remote/CallbackClientImpl.java | 4 +- .../mage/client/util/gui/GuiDisplayUtil.java | 2 +- .../mage/card/arcane/CardPanelRenderImpl.java | 2 +- .../org/mage/plugins/card/CardPluginImpl.java | 2 +- .../dl/sources/MythicspoilerComSource.java | 2 +- .../dl/sources/WizardCardsImageSource.java | 2 +- .../plugins/card/utils/CardImageUtils.java | 2 +- .../src/mage/game/MomirDuel.java | 2 +- .../src/mage/player/ai/ComputerPlayer6.java | 2 +- .../src/mage/player/ai/SimulatedPlayer2.java | 2 +- .../player/ai/ma/ArtificialScoringSystem.java | 2 +- .../ma/optimizers/impl/OutcomeOptimizer.java | 2 +- .../java/mage/player/ai/ComputerPlayer.java | 16 +-- .../java/mage/player/ai/utils/RateCard.java | 6 +- .../src/mage/player/human/HumanPlayer.java | 18 ++-- Mage.Sets/src/mage/cards/a/AAT1.java | 66 ++++++------ .../src/mage/cards/a/AlhammarretsArchive.java | 2 +- .../src/mage/cards/a/AlphaAuthority.java | 2 +- .../src/mage/cards/a/AnafenzaTheForemost.java | 2 +- .../src/mage/cards/a/AnthemOfRakdos.java | 2 +- .../src/mage/cards/a/AquamorphEntity.java | 2 +- .../src/mage/cards/a/AthreosGodOfPassage.java | 4 +- .../src/mage/cards/b/BurningVengeance.java | 2 +- Mage.Sets/src/mage/cards/c/CelestialDawn.java | 2 +- .../mage/cards/c/ChainsOfMephistopheles.java | 2 +- Mage.Sets/src/mage/cards/c/CoffinQueen.java | 4 +- .../src/mage/cards/d/DanceOfTheDead.java | 2 +- Mage.Sets/src/mage/cards/d/DiviningWitch.java | 100 +++++++++--------- Mage.Sets/src/mage/cards/e/EliteArcanist.java | 2 +- .../mage/cards/e/EpiphanyAtTheDrownyard.java | 4 +- Mage.Sets/src/mage/cards/f/FactOrFiction.java | 2 +- .../src/mage/cards/g/GiftOfImmortality.java | 2 +- .../src/mage/cards/g/GontiLordOfLuxury.java | 2 +- .../src/mage/cards/g/GracefulReprieve.java | 2 +- .../src/mage/cards/g/GrafdiggersCage.java | 2 +- .../src/mage/cards/g/GreaterHarvester.java | 2 +- Mage.Sets/src/mage/cards/g/GrimoireThief.java | 2 +- .../src/mage/cards/g/GruesomeEncore.java | 4 +- Mage.Sets/src/mage/cards/h/HavengulLich.java | 2 +- .../mage/cards/h/HomuraHumanAscendant.java | 2 +- Mage.Sets/src/mage/cards/h/Humility.java | 2 +- .../src/mage/cards/i/IntetTheDreamer.java | 4 +- .../src/mage/cards/i/IslandSanctuary.java | 2 +- .../src/mage/cards/i/IsochronScepter.java | 2 +- .../mage/cards/k/KalitasTraitorOfGhet.java | 2 +- Mage.Sets/src/mage/cards/k/KembasLegion.java | 2 +- Mage.Sets/src/mage/cards/k/KheruLichLord.java | 4 +- Mage.Sets/src/mage/cards/l/LeoninArbiter.java | 2 +- Mage.Sets/src/mage/cards/l/LifeAndLimb.java | 2 +- .../mage/cards/m/MeanderingTowershell.java | 2 +- Mage.Sets/src/mage/cards/m/Mindreaver.java | 2 +- Mage.Sets/src/mage/cards/n/NotionThief.java | 2 +- .../src/mage/cards/o/ObzedatGhostCouncil.java | 2 +- .../src/mage/cards/o/OtherworldlyJourney.java | 2 +- .../src/mage/cards/p/PersonalSanctuary.java | 2 +- .../src/mage/cards/p/PhantomCentaur.java | 2 +- Mage.Sets/src/mage/cards/p/PhantomFlock.java | 2 +- .../src/mage/cards/p/PhantomNishoba.java | 2 +- Mage.Sets/src/mage/cards/p/PhantomNomad.java | 2 +- .../mage/cards/p/PharikaGodOfAffliction.java | 2 +- .../src/mage/cards/p/PhyrexianDelver.java | 2 +- Mage.Sets/src/mage/cards/p/PithingNeedle.java | 2 +- .../src/mage/cards/p/PostmortemLunge.java | 2 +- .../src/mage/cards/r/RosheenMeanderer.java | 2 +- Mage.Sets/src/mage/cards/s/SacredGround.java | 2 +- .../src/mage/cards/s/SerraAscendant.java | 2 +- Mage.Sets/src/mage/cards/s/SharedFate.java | 4 +- Mage.Sets/src/mage/cards/s/SithMagic.java | 4 +- .../src/mage/cards/s/SoldeviMachinist.java | 2 +- Mage.Sets/src/mage/cards/s/SoulSeparator.java | 2 +- Mage.Sets/src/mage/cards/s/Spellbinder.java | 2 +- .../src/mage/cards/s/SphinxOfUthuun.java | 4 +- Mage.Sets/src/mage/cards/s/StartledAwake.java | 2 +- Mage.Sets/src/mage/cards/s/SteamAugury.java | 4 +- .../src/mage/cards/s/StinkdrinkerBandit.java | 2 +- Mage.Sets/src/mage/cards/s/Stranglehold.java | 4 +- Mage.Sets/src/mage/cards/s/SummonersEgg.java | 2 +- .../src/mage/cards/s/SunglassesOfUrza.java | 2 +- .../src/mage/cards/s/SuppressionField.java | 2 +- .../src/mage/cards/s/SwordOfTheMeek.java | 2 +- Mage.Sets/src/mage/cards/t/TawnossCoffin.java | 4 +- Mage.Sets/src/mage/cards/t/ThoughtPrison.java | 2 +- .../mage/cards/t/TreacherousPitDweller.java | 2 +- .../src/mage/cards/t/TuktukScrapper.java | 2 +- .../src/mage/cards/u/UnwindingClock.java | 4 +- .../src/mage/cards/u/UrbanBurgeoning.java | 2 +- .../src/mage/cards/v/VorracBattlehorns.java | 2 +- .../src/mage/cards/w/WheelOfSunAndMoon.java | 2 +- .../src/mage/cards/x/XenicPoltergeist.java | 2 +- Mage.Sets/src/mage/sets/DragonsMaze.java | 2 +- Mage.Sets/src/mage/sets/FateReforged.java | 2 +- .../com/xmage/ws/util/json/JSONParser.java | 4 +- .../continuous/DependentEffectsTest.java | 4 +- .../java/org/mage/test/player/TestPlayer.java | 2 +- .../test/serverside/base/MageTestBase.java | 4 +- .../serverside/base/MageTestPlayerBase.java | 4 +- .../serverside/base/impl/CardTestAPIImpl.java | 20 ++-- .../base/impl/CardTestPlayerAPIImpl.java | 12 +-- Mage/src/main/java/mage/Mana.java | 10 +- ...mageToAPlayerAttachedTriggeredAbility.java | 2 +- .../common/DiesAttachedTriggeredAbility.java | 2 +- .../EntersBattlefieldAllTriggeredAbility.java | 2 +- .../ExploitCreatureTriggeredAbility.java | 2 +- .../LimitedTimesPerTurnActivatedAbility.java | 2 +- .../common/ZoneChangeTriggeredAbility.java | 2 +- .../abilities/costs/mana/ColoredManaCost.java | 2 +- .../abilities/costs/mana/ManaSymbols.java | 4 +- .../costs/mana/MonoHybridManaCost.java | 2 +- .../effects/AuraReplacementEffect.java | 2 +- .../abilities/effects/ContinuousEffects.java | 8 +- .../PayCostToAttackBlockEffectImpl.java | 6 +- .../common/CantBeTargetedTargetEffect.java | 4 +- .../abilities/effects/common/CopyEffect.java | 2 +- .../CounterTargetWithReplacementEffect.java | 6 +- ...attlefieldPayCostOrPutGraveyardEffect.java | 2 +- .../effects/common/ExileTargetEffect.java | 8 +- .../PreventAllDamageToPlayersEffect.java | 4 +- ...reventDamageToTargetMultiAmountEffect.java | 4 +- ...tDamageFromChosenSourceToTargetEffect.java | 2 +- ...NextDamageFromChosenSourceToYouEffect.java | 2 +- .../common/RegenerateTargetEffect.java | 2 +- .../ReturnFromExileForSourceEffect.java | 2 +- ...ourceFromGraveyardToBattlefieldEffect.java | 2 +- .../CanBlockAdditionalCreatureEffect.java | 4 +- .../combat/CantAttackAnyPlayerAllEffect.java | 2 +- .../combat/CantBeBlockedTargetEffect.java | 2 +- ...MustBeBlockedByAtLeastOneSourceEffect.java | 2 +- .../continuous/BecomesAuraSourceEffect.java | 2 +- .../BecomesBasicLandTargetEffect.java | 2 +- .../BecomesCreatureSourceEffect.java | 2 +- .../BecomesCreatureTargetEffect.java | 2 +- .../BecomesCreatureTypeTargetEffect.java | 4 +- .../BecomesFaceDownCreatureEffect.java | 6 +- .../continuous/BecomesSubtypeAllEffect.java | 4 +- .../CommanderReplacementEffect.java | 4 +- .../continuous/GainAbilityAllEffect.java | 2 +- .../GainAbilityControllerEffect.java | 2 +- .../continuous/GainAbilitySourceEffect.java | 2 +- .../continuous/GainAbilityTargetEffect.java | 2 +- .../common/continuous/GainSuspendEffect.java | 2 +- .../continuous/LoseAllAbilitiesAllEffect.java | 2 +- .../MaximumHandSizeControllerEffect.java | 4 +- .../SetPowerToughnessSourceEffect.java | 2 +- ...DuringEachOtherPlayersUntapStepEffect.java | 2 +- .../counter/AddCountersSourceEffect.java | 2 +- .../mage/abilities/keyword/BestowAbility.java | 2 +- .../abilities/keyword/ConvokeAbility.java | 2 +- .../mage/abilities/keyword/DelveAbility.java | 2 +- .../mage/abilities/keyword/EchoAbility.java | 2 +- .../abilities/keyword/ForecastAbility.java | 2 +- .../mage/abilities/keyword/HauntAbility.java | 4 +- .../mage/abilities/keyword/KickerAbility.java | 4 +- .../mage/abilities/keyword/MorphAbility.java | 4 +- .../abilities/keyword/ReboundAbility.java | 2 +- .../abilities/keyword/UnearthAbility.java | 2 +- .../main/java/mage/cards/ExpansionSet.java | 2 +- .../mage/cards/repository/CardScanner.java | 2 +- .../main/java/mage/filter/FilterAbility.java | 2 +- .../mageobject/MulticoloredPredicate.java | 2 +- .../predicate/mageobject/NamePredicate.java | 2 +- Mage/src/main/java/mage/game/Table.java | 2 +- .../src/main/java/mage/game/ZonesHandler.java | 2 +- Mage/src/main/java/mage/game/stack/Spell.java | 12 +-- Mage/src/main/java/mage/players/ManaPool.java | 6 +- .../target/common/TargetActivatedAbility.java | 4 +- .../common/CastFromGraveyardWatcher.java | 2 +- .../watchers/common/SpellsCastWatcher.java | 2 +- 175 files changed, 348 insertions(+), 344 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index d0fc5e02dc0..e5c0908323d 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 8048c8977f3..59ecb2ce279 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 04eb29c0d46..dbf4c1d6da6 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 a3bc1aaa97f..2592737fb6d 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 e0f6d37dac0..3a5a36f2da9 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 f5bc858288d..fcfaed61531 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/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java index c7c28bba6e5..61b83ebd8e8 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 bba59889206..d68e842327e 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 af2a653105e..0db517ded03 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/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index c355527a025..4b37032e4c8 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 d5a3f7b74d5..a5ff85e3b2a 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 6ff9dd60701..cc75bff9cfc 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 af9424a35e7..23b9180d414 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 4b0da49d62e..047bb90f240 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 37c9f07e317..28f8001ac3d 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.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java b/Mage.Server.Plugins/Mage.Game.MomirDuel/src/mage/game/MomirDuel.java index d8ad9fae672..dc23a4364e8 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 cb5a4497469..db6da80b747 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 dc113944d3d..7650f1f8390 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 3c80b69c654..04ed14327fd 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 d2e22c0062e..c80f585cc74 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 b33381c4356..0f12ea92442 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 c409e2d2642..bdd761b68d0 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 6fe57b2d0a0..f69c4c442d9 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()) { @@ -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 77ccc46c2d6..7f3ba047c4e 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 6d064dd8c4b..2c80e8e6251 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 94039aa8c0d..eb011deb6a4 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 a34cdf61fba..8a508658420 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 177cb5bfca7..30c7c41e68e 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 fcb6eb219be..7a56b32b9f1 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 478e7688659..7acc93f8e1d 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 bd02c8b3a5e..24a100e8665 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 5fa6cd39e13..a2ed2dc60a2 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 abdf483ce1c..b96ff02532a 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 7ca8251bd69..b51adf9b8d2 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 990e3ca775b..df5a9eae310 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 09a05685f1a..47295968c63 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 1e3f659ed64..c3f3d5816e6 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 0bf68ea7845..41ff18625ba 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 47499ae08ce..da45ca20222 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 615eecbfc5f..2722cd935ac 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 b28a3b874d8..14186d4b5f0 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 809a58e45ba..f727f6d91b7 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 358ec75623b..bc07a31920d 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 5e1c3e63f27..dcb5e5a2cd9 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 2a52958e34b..538f528b053 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 18c8e87568a..162c5f0259f 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 3f2fc45ec79..e52f632b646 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 770d21f64be..d1e72db9ee9 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 a5eb89a30c0..800299bd3e6 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 29a59add1b6..a8dfc60f0e2 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 a17111a8e5a..fbbdb5dd5eb 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 1ff39c48c86..99335309324 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 b938e148680..f1a68420e7a 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 12eb42a40f2..7b5fa0da0a3 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 f27bffcaa42..f1b90e5c62a 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 8dbb86850a9..50652ef6a4c 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 8efb4e38b3a..f3024e3fb3c 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 1e3abe8c276..250d59acf86 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 593b3ef29d2..9fac6fcd521 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 d8a1c3e6a6c..0a5c5e40427 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 19a2581e677..cc9189ba600 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 0523be13eab..1c24520f24d 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 43c431e59b9..9c79c1a2d7d 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 924c5e8b205..d8c31b16ca1 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 517d927afb3..d3e4c787d9f 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 3162aaa36ae..d8064e8bdf3 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 28d5181191c..8d4132ca061 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 e65595e80ed..ff440b907d2 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 6af4f923ee5..d2ab2d80c4d 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 360768ddba1..7846dfbc157 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 35f22cb0920..e45c17e5787 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 307d9a66679..11c6b0fb836 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 d3230e22b64..d89f19b434e 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 f1ccdddc5cd..1cee553fa1f 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 1d12d4d225e..046eb494759 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 57637f4db42..a61842a20b4 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 02dc3a58d57..407062d0acc 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 bc2548513ca..aa5f1312234 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 1134a3b6613..74b02b0048e 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 15dbf48a6a9..9c41830a095 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 10282410ff0..255bc054748 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 76444217806..5de2e5f42db 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 348a6f1c558..24409457a97 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 633d78c0b79..9c7e269cba4 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 74c8c59f565..d9f673b6914 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 cb98d309362..26633df851b 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 71077ee8bb5..2403ad29390 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 9bd39e24f42..ee9acf6c798 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 b943f1ba467..399ea34b413 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 00bca35e0bc..991dbc5607a 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 7b9aa900855..01ca0e9ec80 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 deaf478b79c..d63cce6dc92 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 4294d7a3093..8d4814449c5 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 4a5c5bb4d7f..f33758431bf 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 726e9a0bc5f..367ca1a8c14 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 019fb0111d4..6ea6909d995 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 7255b793cca..2198066f5f8 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 cf305e84711..a022fee617d 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 82a0078dedc..58c65acfe48 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 ce68bedbfb1..ac96be11cb6 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 f4cb9911c18..bb7994fcce4 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/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index ff972281e39..e58a4f17cb8 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 05b3c73d0e5..82d77721301 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 51932f83f04..17f987cde70 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 8825bc72b7e..62a60d0fdf4 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 800ce80d6d3..cabd79c4598 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 7a7ff39d6b5..7eb518ed5e9 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/common/DealsDamageToAPlayerAttachedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealsDamageToAPlayerAttachedTriggeredAbility.java index 77dbc161dd2..b8c245b7235 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 5d92b4c406c..3eb151ac1e2 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 400e81d107b..9e4daeb3fec 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 f8573a1ae4a..c5e4f734f45 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 cfbe003e571..4e42a1678c3 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 f18ff9e6c5d..44c4c634ba0 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 14ef126220d..e1031a72f4d 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 83aec80836b..11ad3793265 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 e6571177bce..99432210b49 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 f7e5db45a03..337ca43d5d9 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 fc7378c4aee..4f42e779237 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 9eb3e16e82f..5dd2e469339 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?"; @@ -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 977c48a5d40..59ed333f561 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 65f0fcb96de..5e689fc6755 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 2726ccfb195..fff7a3f4376 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 fb20d2a15ed..63d20659a7a 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 9862689e266..88b3307d25c 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 783f8171930..4e670bcc3c1 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 aff138d575f..a1b1fb9d3bd 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 fd7c3b5908e..659ec194e58 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 f33f75a9122..6164d9c2de3 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 2a14b1925aa..436fd1d8028 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 359bf3fd9c4..6872ae51dde 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 a1c3ebe28ab..225d4db4976 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 f10d6d0305f..d3601092933 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 436ed02beb0..131bdbbe3b2 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 67abeff84dc..e79a133198b 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 f150a28cd08..7779965ef7e 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 dc731efe9e3..4a27866dd33 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 dd1fbc9c6fd..5ada0f6b1c1 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 8e0c19724ed..51ad5a94d80 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 833597d81a4..838014740d7 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 f7bb98281df..ed1d1e817e8 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 43d7ce2faa5..bd04bd6eaa8 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 f59a794e8ed..56d365283fc 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 1182383da3a..486e5ed7446 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 513fe0f5ae9..962a782ead3 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 2bd64769972..7db331292cf 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 1d6666a93af..3b4b491b5e3 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 8f14b71150f..91f1d4af731 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 2af1d49efc7..2891e9f4170 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 85da971ab9f..a458a75600d 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 e81642e8234..ef212b15af2 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 8182274c246..725b5306eee 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 9fb4fabaefb..e7a40be5f5a 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 f1b1bb981c6..3233d7a286a 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 6d35515677e..a69c5aa5387 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 fd3f408d600..ceb9e90a7d7 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 5ff77dd9c9a..97c03922d16 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 a98f93567fe..6fd2119c17c 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 cf47b3a56f4..a23e221fffb 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 2ef128b03ab..6a6adb78396 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 e897faae382..dad2df5a918 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 fa8f8b6e089..5a81ae7d193 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 5e3baf1d3dc..17bcf1d600e 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 a688f576a45..deef93c61bb 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 14850e62cce..a16ab16f41c 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 708ee308055..943dfc77329 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 d1d8db88705..b3f5ebfe280 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 06e80094b14..b5bc36ef68e 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 299ff48ba3c..00b2fd8bb4a 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 aa779be8fa7..7850809ec37 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 ba835095d0c..644ed9aa440 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 d54613a9d39..df7753c6425 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 fc15e9a6345..71e131b29be 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 5c1f3a53a6d..a8a63557026 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 44e831b1f58..7913fd121ab 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 f0309d0ff89..e0de2c9c8fc 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); From d947a8d75b527afd41fbde665ef425bb73773cb2 Mon Sep 17 00:00:00 2001 From: spjspj Date: Thu, 23 Mar 2017 00:44:03 +1100 Subject: [PATCH 07/20] spjspj - Add Chronomantic Escape (FUT) --- .../src/mage/cards/c/ChronomanticEscape.java | 75 +++++++++++++++++++ Mage.Sets/src/mage/sets/FutureSight.java | 1 + 2 files changed, 76 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ChronomanticEscape.java diff --git a/Mage.Sets/src/mage/cards/c/ChronomanticEscape.java b/Mage.Sets/src/mage/cards/c/ChronomanticEscape.java new file mode 100644 index 00000000000..8f6034e2fe6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ChronomanticEscape.java @@ -0,0 +1,75 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import java.util.UUID; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ExileSpellEffect; +import mage.abilities.effects.common.combat.CantAttackYouAllEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.SuspendAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; + +/** + * + * @author spjspj + */ +public class ChronomanticEscape extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures"); + + public ChronomanticEscape(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}{W}"); + + // Until your next turn, creatures can't attack you. Exile Chronomantic Escape with three time counters on it. + getSpellAbility().addEffect(new CantAttackYouAllEffect(Duration.UntilYourNextTurn, filter)); + getSpellAbility().addEffect(ExileSpellEffect.getInstance()); + Effect effect = new AddCountersSourceEffect(CounterType.TIME.createInstance(), new StaticValue(3), true, true); + effect.setText("with 3 time counters on it"); + getSpellAbility().addEffect(effect); + + // Suspend 3-{2}{W} + this.addAbility(new SuspendAbility(3, new ManaCostsImpl("{2}{W}"), this)); + } + + public ChronomanticEscape(final ChronomanticEscape card) { + super(card); + } + + @Override + public ChronomanticEscape copy() { + return new ChronomanticEscape(this); + } +} diff --git a/Mage.Sets/src/mage/sets/FutureSight.java b/Mage.Sets/src/mage/sets/FutureSight.java index 6a06a53d501..5c2526d1b2c 100644 --- a/Mage.Sets/src/mage/sets/FutureSight.java +++ b/Mage.Sets/src/mage/sets/FutureSight.java @@ -75,6 +75,7 @@ public class FutureSight extends ExpansionSet { cards.add(new SetCardInfo("Bridge from Below", 81, Rarity.RARE, mage.cards.b.BridgeFromBelow.class)); cards.add(new SetCardInfo("Centaur Omenreader", 143, Rarity.UNCOMMON, mage.cards.c.CentaurOmenreader.class)); cards.add(new SetCardInfo("Char-Rumbler", 96, Rarity.UNCOMMON, mage.cards.c.CharRumbler.class)); + cards.add(new SetCardInfo("Chronomantic Escape", 4, Rarity.UNCOMMON, mage.cards.c.ChronomanticEscape.class)); cards.add(new SetCardInfo("Cloud Key", 160, Rarity.RARE, mage.cards.c.CloudKey.class)); cards.add(new SetCardInfo("Cloudseeder", 33, Rarity.UNCOMMON, mage.cards.c.Cloudseeder.class)); cards.add(new SetCardInfo("Coalition Relic", 161, Rarity.RARE, mage.cards.c.CoalitionRelic.class)); From bfb2b07ba62b40a9161224e68d54391a03b81406 Mon Sep 17 00:00:00 2001 From: Alexsandro Date: Wed, 22 Mar 2017 13:09:49 -0300 Subject: [PATCH 08/20] Create unit tests --- Mage.Sets/src/mage/cards/c/CitadelOfPain.java | 11 ++++++-- .../oneshot/damage/CitadelOfPainTest.java | 25 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java diff --git a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java index 86c9ece906d..8d03fc18e8b 100644 --- a/Mage.Sets/src/mage/cards/c/CitadelOfPain.java +++ b/Mage.Sets/src/mage/cards/c/CitadelOfPain.java @@ -30,6 +30,7 @@ package mage.cards.c; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.TriggeredAbility; import mage.abilities.common.OnEventTriggeredAbility; import mage.abilities.effects.Effect; @@ -55,7 +56,8 @@ public class CitadelOfPain extends CardImpl { public CitadelOfPain(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); - TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, + TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, + "beginning of the end step", true, new CitadelOfPainEffect()); // At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands he or she controls. this.addAbility(triggered); @@ -75,6 +77,11 @@ class CitadelOfPainEffect extends OneShotEffect { private static final FilterPermanent filter = new FilterControlledLandPermanent(); + @Override + public String getText(Mode mode) { + return "{this} deals X damage to that player, where X is the number of untapped lands he or she controls."; + } + static { filter.add(Predicates.not(new TappedPredicate())); } @@ -89,7 +96,7 @@ class CitadelOfPainEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(targetPointer.getFirst(game, source)); + Player player = game.getPlayer(game.getActivePlayerId()); if (player != null) { int damage = game.getBattlefield().countAll(filter, game.getActivePlayerId(), game); player.damage(damage, source.getSourceId(), game, false, true); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java new file mode 100644 index 00000000000..cf972d5a939 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java @@ -0,0 +1,25 @@ +package org.mage.test.cards.abilities.oneshot.damage; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * Created by Alexsandr0x. + */ +public class CitadelOfPainTest extends CardTestPlayerBase { + + @Test + public void testDamage() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + // At the beginning of each player's end step, Citadel of Pain deals X damage to that + // player, where X is the number of untapped lands he or she controls. + addCard(Zone.BATTLEFIELD, playerA, "Citadel of Pain"); + + setStopAt(3, PhaseStep.END_TURN); + execute(); + + assertLife(playerA, 17); + } +} From 0d0bba7f5785bc724c96ab6a83248d9d94e453bd Mon Sep 17 00:00:00 2001 From: Alexsandro Date: Wed, 22 Mar 2017 13:14:15 -0300 Subject: [PATCH 09/20] Fiz turns to pass in unit test --- .../test/cards/abilities/oneshot/damage/CitadelOfPainTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java index cf972d5a939..a342278eed7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/CitadelOfPainTest.java @@ -17,7 +17,7 @@ public class CitadelOfPainTest extends CardTestPlayerBase { // player, where X is the number of untapped lands he or she controls. addCard(Zone.BATTLEFIELD, playerA, "Citadel of Pain"); - setStopAt(3, PhaseStep.END_TURN); + setStopAt(1, PhaseStep.END_TURN); execute(); assertLife(playerA, 17); From 334ad729a81a43b721aa0bcc9e5879f79bf47323 Mon Sep 17 00:00:00 2001 From: ingmargoudt Date: Wed, 22 Mar 2017 20:49:12 +0100 Subject: [PATCH 10/20] remove usermap by name, introduced more optionals --- .../main/java/mage/server/ChatManager.java | 37 ++++---- .../main/java/mage/server/MageServerImpl.java | 55 +++++------ .../src/main/java/mage/server/Session.java | 91 ++++++++++--------- .../main/java/mage/server/SessionManager.java | 6 +- .../main/java/mage/server/UserManager.java | 83 ++++++++--------- 5 files changed, 132 insertions(+), 140 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index c48de3f0c8d..e77b9b12dd1 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -106,27 +106,28 @@ public enum ChatManager { ChatSession chatSession = chatSessions.get(chatId); if (chatSession != null) { if (message.startsWith("\\") || message.startsWith("/")) { - User user = UserManager.instance.getUserByName(userName); - if (user != null) { - if (!performUserCommand(user, message, chatId, false)) { - performUserCommand(user, message, chatId, true); + Optional user = UserManager.instance.getUserByName(userName); + if (user.isPresent()) { + if (!performUserCommand(user.get(), message, chatId, false)) { + performUserCommand(user.get(), message, chatId, true); } return; } } if (messageType != MessageType.GAME) { - User user = UserManager.instance.getUserByName(userName); - if (message != null && userName != null && !userName.isEmpty()) { + Optional u = UserManager.instance.getUserByName(userName); + if (u.isPresent()) { + User user = u.get(); if (message.equals(userMessages.get(userName))) { // prevent identical messages String informUser = "Your message appears to be identical to your last message"; chatSessions.get(chatId).broadcastInfoToUser(user, informUser); return; } - - if (message.length() > 500) { + + if (message.length() > 500) { message = message.replaceFirst("^(.{500}).*", "$1 (rest of message truncated)"); } @@ -157,10 +158,9 @@ public enum ChatManager { } userMessages.put(userName, message); - } - if (messageType == MessageType.TALK) { - if (user != null) { + + if (messageType == MessageType.TALK) { if (user.getChatLockedUntil() != null) { if (user.getChatLockedUntil().compareTo(Calendar.getInstance().getTime()) > 0) { chatSessions.get(chatId).broadcastInfoToUser(user, "Your chat is muted until " + SystemUtil.dateFormat.format(user.getChatLockedUntil())); @@ -169,11 +169,12 @@ public enum ChatManager { user.setChatLockedUntil(null); } } - } - } + } + + } + chatSession.broadcast(userName, message, color, withTime, messageType, soundToPlay); } - chatSession.broadcast(userName, message, color, withTime, messageType, soundToPlay); } } @@ -213,9 +214,9 @@ public enum ChatManager { if (first > 1) { String userToName = rest.substring(0, first); rest = rest.substring(first + 1).trim(); - User userTo = UserManager.instance.getUserByName(userToName); - if (userTo != null) { - if (!chatSessions.get(chatId).broadcastWhisperToUser(user, userTo, rest)) { + Optional userTo = UserManager.instance.getUserByName(userToName); + if (userTo.isPresent()) { + if (!chatSessions.get(chatId).broadcastWhisperToUser(user, userTo.get(), rest)) { message += new StringBuilder("
User ").append(userToName).append(" not found").toString(); chatSessions.get(chatId).broadcastInfoToUser(user, message); } @@ -244,7 +245,7 @@ public enum ChatManager { * @param color */ public void broadcast(UUID userId, String message, MessageColor color) throws UserNotFoundException { - UserManager.instance.getUser(userId).ifPresent(user-> { + UserManager.instance.getUser(userId).ifPresent(user -> { chatSessions.values() .stream() .filter(chat -> chat.hasUser(userId)) diff --git a/Mage.Server/src/main/java/mage/server/MageServerImpl.java b/Mage.Server/src/main/java/mage/server/MageServerImpl.java index 996a568c0de..0c28c809177 100644 --- a/Mage.Server/src/main/java/mage/server/MageServerImpl.java +++ b/Mage.Server/src/main/java/mage/server/MageServerImpl.java @@ -1071,12 +1071,11 @@ public class MageServerImpl implements MageServer { @Override public void muteUser(final String sessionId, final String userName, final long durationMinutes) throws MageException { execute("muteUser", sessionId, () -> { - User user = UserManager.instance.getUserByName(userName); - if (user != null) { + UserManager.instance.getUserByName(userName).ifPresent(user -> { Date muteUntil = new Date(Calendar.getInstance().getTimeInMillis() + (durationMinutes * Timer.ONE_MINUTE)); user.showUserMessage("Admin info", "You were muted for chat messages until " + SystemUtil.dateFormat.format(muteUntil) + '.'); user.setChatLockedUntil(muteUntil); - } + }); }); } @@ -1084,15 +1083,14 @@ public class MageServerImpl implements MageServer { @Override public void lockUser(final String sessionId, final String userName, final long durationMinutes) throws MageException { execute("lockUser", sessionId, () -> { - User user = UserManager.instance.getUserByName(userName); - if (user != null) { + UserManager.instance.getUserByName(userName).ifPresent(user -> { Date lockUntil = new Date(Calendar.getInstance().getTimeInMillis() + (durationMinutes * Timer.ONE_MINUTE)); user.showUserMessage("Admin info", "Your user profile was locked until " + SystemUtil.dateFormat.format(lockUntil) + '.'); user.setLockedUntil(lockUntil); if (user.isConnected()) { SessionManager.instance.disconnectUser(sessionId, user.getSessionId()); } - } + }); }); } @@ -1101,8 +1099,9 @@ public class MageServerImpl implements MageServer { public void setActivation(final String sessionId, final String userName, boolean active) throws MageException { execute("setActivation", sessionId, () -> { AuthorizedUser authorizedUser = AuthorizedUserRepository.instance.getByName(userName); - User user = UserManager.instance.getUserByName(userName); - if (user != null) { + Optional u = UserManager.instance.getUserByName(userName); + if (u.isPresent()) { + User user = u.get(); user.setActive(active); if (!user.isActive() && user.isConnected()) { SessionManager.instance.disconnectUser(sessionId, user.getSessionId()); @@ -1117,16 +1116,14 @@ public class MageServerImpl implements MageServer { @Override public void toggleActivation(final String sessionId, final String userName) throws MageException { - execute("toggleActivation", sessionId, () -> { - User user = UserManager.instance.getUserByName(userName); - if (user != null) { - user.setActive(!user.isActive()); - if (!user.isActive() && user.isConnected()) { - SessionManager.instance.disconnectUser(sessionId, user.getSessionId()); - } - } - - }); + execute("toggleActivation", sessionId, () -> + UserManager.instance.getUserByName(userName).ifPresent(user -> + { + user.setActive(!user.isActive()); + if (!user.isActive() && user.isConnected()) { + SessionManager.instance.disconnectUser(sessionId, user.getSessionId()); + } + })); } @Override @@ -1144,13 +1141,10 @@ public class MageServerImpl implements MageServer { @Override public void removeTable(final String sessionId, final UUID tableId) throws MageException { execute("removeTable", sessionId, () -> { - Optional session = SessionManager.instance.getSession(sessionId); - if (!session.isPresent()) { - logger.error("Session not found : " + sessionId); - } else { - UUID userId = session.get().getUserId(); + SessionManager.instance.getSession(sessionId).ifPresent(session -> { + UUID userId = session.getUserId(); TableManager.instance.removeTable(userId, tableId); - } + }); }); } @@ -1162,15 +1156,12 @@ public class MageServerImpl implements MageServer { @Override public void sendFeedbackMessage(final String sessionId, final String username, final String title, final String type, final String message, final String email) throws MageException { if (title != null && message != null) { - execute("sendFeedbackMessage", sessionId, () -> { - Optional session = SessionManager.instance.getSession(sessionId); - if (!session.isPresent()) { - logger.error(String.format("Session not found: %s", sessionId)); - } else { - FeedbackServiceImpl.instance.feedback(username, title, type, message, email, session.get().getHost()); + execute("sendFeedbackMessage", sessionId, () -> + SessionManager.instance.getSession(sessionId).ifPresent( + session -> FeedbackServiceImpl.instance.feedback(username, title, type, message, email, session.getHost()) - } - }); + + )); } } diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index e18a28630f5..f01adb59ae9 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -217,55 +217,59 @@ public class Session { if (authorizedUser.lockedUntil.compareTo(Calendar.getInstance().getTime()) > 0) { return "Your profile is deactivated until " + SystemUtil.dateFormat.format(authorizedUser.lockedUntil); } else { - User user = UserManager.instance.createUser(userName, host, authorizedUser); - if (user != null && authorizedUser.lockedUntil != null) { - user.setLockedUntil(null); + UserManager.instance.createUser(userName, host, authorizedUser).ifPresent(user -> + user.setLockedUntil(null) + ); + + } + Optional selectUser = UserManager.instance.createUser(userName, host, authorizedUser); + boolean reconnect = false; + if (!selectUser.isPresent()) { // user already exists + selectUser = UserManager.instance.getUserByName(userName); + if (selectUser.isPresent()) { + User user = selectUser.get(); + // If authentication is not activated, check the identity using IP address. + if (ConfigSettings.instance.isAuthenticationActivated() || user.getHost().equals(host)) { + user.updateLastActivity(null); // minimizes possible expiration + this.userId = user.getId(); + if (user.getSessionId().isEmpty()) { + logger.info("Reconnecting session for " + userName); + reconnect = true; + } else { + //disconnect previous session + logger.info("Disconnecting another user instance: " + userName); + SessionManager.instance.disconnect(user.getSessionId(), DisconnectReason.ConnectingOtherInstance); + } + } else { + return "User name " + userName + " already in use (or your IP address changed)"; + } } } - } - } - User user = UserManager.instance.createUser(userName, host, authorizedUser); - boolean reconnect = false; - if (user == null) { // user already exists - user = UserManager.instance.getUserByName(userName); - // If authentication is not activated, check the identity using IP address. - if (ConfigSettings.instance.isAuthenticationActivated() || user.getHost().equals(host)) { - user.updateLastActivity(null); // minimizes possible expiration - this.userId = user.getId(); - if (user.getSessionId().isEmpty()) { - logger.info("Reconnecting session for " + userName); - reconnect = true; - } else { - //disconnect previous session - logger.info("Disconnecting another user instance: " + userName); - SessionManager.instance.disconnect(user.getSessionId(), DisconnectReason.ConnectingOtherInstance); + User user = selectUser.get(); + if (!UserManager.instance.connectToSession(sessionId, user.getId())) { + return "Error connecting " + userName; + } + this.userId = user.getId(); + if (reconnect) { // must be connected to receive the message + Optional room = GamesRoomManager.instance.getRoom(GamesRoomManager.instance.getMainRoomId()); + if (!room.isPresent()) { + logger.error("main room not found"); + return null; + } + ChatManager.instance.joinChat(room.get().getChatId(), userId); + ChatManager.instance.sendReconnectMessage(userId); } - } else { - return "User name " + userName + " already in use (or your IP address changed)"; } } - if (!UserManager.instance.connectToSession(sessionId, user.getId())) { - return "Error connecting " + userName; - } - this.userId = user.getId(); - if (reconnect) { // must be connected to receive the message - Optional room = GamesRoomManager.instance.getRoom(GamesRoomManager.instance.getMainRoomId()); - if (!room.isPresent()) { - logger.error("main room not found"); - return null; - } - ChatManager.instance.joinChat(room.get().getChatId(), userId); - ChatManager.instance.sendReconnectMessage(userId); - } return null; + } public void connectAdmin() { this.isAdmin = true; - User user = UserManager.instance.createUser("Admin", host, null); - if (user == null) { - user = UserManager.instance.getUserByName("Admin"); - } + User user = UserManager.instance.createUser("Admin", host, null).orElse( + UserManager.instance.getUserByName("Admin").get()); + UserData adminUserData = UserData.getDefaultUserDataView(); adminUserData.setGroupId(UserGroup.ADMIN.getGroupId()); user.setUserData(adminUserData); @@ -276,8 +280,8 @@ public class Session { } public boolean setUserData(String userName, UserData userData, String clientVersion, String userIdStr) { - User user = UserManager.instance.getUserByName(userName); - if (user != null) { + Optional _user = UserManager.instance.getUserByName(userName); + _user.ifPresent(user -> { if (clientVersion != null) { user.setClientVersion(clientVersion); } @@ -294,9 +298,8 @@ public class Session { if (user.getUserData().getAvatarId() == 11) { user.getUserData().setAvatarId(updateAvatar(user.getName())); } - return true; - } - return false; + }); + return _user.isPresent(); } private int updateAvatar(String userName) { diff --git a/Mage.Server/src/main/java/mage/server/SessionManager.java b/Mage.Server/src/main/java/mage/server/SessionManager.java index 1a8abc9f9d7..b1df7969f38 100644 --- a/Mage.Server/src/main/java/mage/server/SessionManager.java +++ b/Mage.Server/src/main/java/mage/server/SessionManager.java @@ -51,7 +51,11 @@ public enum SessionManager { public Optional getSession(@Nonnull String sessionId) { Session session = sessions.get(sessionId); - if (session != null && session.getUserId() != null && UserManager.instance.getUser(session.getUserId()) == null) { + if(session == null){ + logger.error("Session with sessionId " + sessionId + " is not found"); + return Optional.empty(); + } + if (session.getUserId() != null && UserManager.instance.getUser(session.getUserId()) == null) { logger.error("User for session " + sessionId + " with userId " + session.getUserId() + " is missing. Session removed."); // can happen if user from same host signs in multiple time with multiple clients, after he disconnects with one client disconnect(sessionId, DisconnectReason.ConnectingOtherInstance); diff --git a/Mage.Server/src/main/java/mage/server/UserManager.java b/Mage.Server/src/main/java/mage/server/UserManager.java index bd7634435bd..18d45fb7fac 100644 --- a/Mage.Server/src/main/java/mage/server/UserManager.java +++ b/Mage.Server/src/main/java/mage/server/UserManager.java @@ -42,7 +42,7 @@ import java.util.concurrent.*; * * @author BetaSteward_at_googlemail.com */ -public enum UserManager { +public enum UserManager { instance; protected final ScheduledExecutorService expireExecutor = Executors.newSingleThreadScheduledExecutor(); @@ -50,7 +50,6 @@ public enum UserManager { private static final Logger LOGGER = Logger.getLogger(UserManager.class); private final ConcurrentHashMap users = new ConcurrentHashMap<>(); - private final ConcurrentHashMap usersByName = new ConcurrentHashMap<>(); private static final ExecutorService USER_EXECUTOR = ThreadExecutor.getInstance().getCallExecutor(); @@ -58,32 +57,36 @@ public enum UserManager { expireExecutor.scheduleAtFixedRate(this::checkExpired, 60, 60, TimeUnit.SECONDS); } - public User createUser(String userName, String host, AuthorizedUser authorizedUser) { - if (getUserByName(userName) != null) { - return null; //user already exists + public Optional createUser(String userName, String host, AuthorizedUser authorizedUser) { + if (getUserByName(userName).isPresent()) { + return Optional.empty(); //user already exists } User user = new User(userName, host, authorizedUser); users.put(user.getId(), user); - usersByName.put(userName, user); - return user; + return Optional.of(user); } public Optional getUser(UUID userId) { - if (users.get(userId) == null) { + if (!users.containsKey(userId)) { LOGGER.error(String.format("User with id %s could not be found", userId)); + return Optional.empty(); } else { return Optional.of(users.get(userId)); } - /* if (userId != null) { - return users.get(userId); - } - return null; - */ } - public User getUserByName(String userName) { - return usersByName.get(userName); + public Optional getUserByName(String userName) { + Optional u = users.values().stream().filter(user -> user.getName().equals(userName)) + .findFirst(); + if (u.isPresent()) { + return u; + } else { + + LOGGER.error("User with name " + userName + " could not be found"); + return Optional.empty(); + + } } public Collection getUsers() { @@ -103,12 +106,9 @@ public enum UserManager { public void disconnect(UUID userId, DisconnectReason reason) { if (userId != null) { - User user = users.get(userId); - if (user != null) { - user.setSessionId(""); // Session will be set again with new id if user reconnects - } - ChatManager.instance.removeUser(userId, reason); + getUser(userId).ifPresent(user -> user.setSessionId(""));// Session will be set again with new id if user reconnects } + ChatManager.instance.removeUser(userId, reason); } public boolean isAdmin(UUID userId) { @@ -123,25 +123,21 @@ public enum UserManager { public void removeUser(final UUID userId, final DisconnectReason reason) { if (userId != null) { - final User user = users.get(userId); - if (user != null) { - USER_EXECUTOR.execute( - () -> { - try { - LOGGER.info("USER REMOVE - " + user.getName() + " (" + reason.toString() + ") userId: " + userId + " [" + user.getGameInfo() + ']'); - user.remove(reason); - LOGGER.debug("USER REMOVE END - " + user.getName()); - } catch (Exception ex) { - handleException(ex); - } finally { - users.remove(userId); - usersByName.remove(user.getName()); + getUser(userId).ifPresent(user -> + USER_EXECUTOR.execute( + () -> { + try { + LOGGER.info("USER REMOVE - " + user.getName() + " (" + reason.toString() + ") userId: " + userId + " [" + user.getGameInfo() + ']'); + user.remove(reason); + LOGGER.debug("USER REMOVE END - " + user.getName()); + } catch (Exception ex) { + handleException(ex); + } finally { + users.remove(userId); + } } - } - ); - } else { - LOGGER.warn("Trying to remove userId: " + userId + " - but it does not exist."); - } + )); + } } @@ -183,9 +179,9 @@ public enum UserManager { } public String getUserHistory(String userName) { - User user = getUserByName(userName); - if (user != null) { - return "History of user " + userName + " - " + user.getUserData().getHistory(); + Optional user = getUserByName(userName); + if (user.isPresent()) { + return "History of user " + userName + " - " + user.get().getUserData().getHistory(); } UserStats userStats = UserStatsRepository.instance.getUser(userName); @@ -199,10 +195,7 @@ public enum UserManager { public void updateUserHistory() { USER_EXECUTOR.execute(() -> { for (String updatedUser : UserStatsRepository.instance.updateUserStats()) { - User user = getUserByName(updatedUser); - if (user != null) { - user.resetUserStats(); - } + getUserByName(updatedUser).ifPresent(User::resetUserStats); } }); } From 097d60f5fcf88e13a6581641353546d8b4263982 Mon Sep 17 00:00:00 2001 From: drmDev Date: Thu, 23 Mar 2017 10:25:21 -0400 Subject: [PATCH 11/20] fixes #3012 manaCosts not null check and way to retrieve it --- .../cards/restriction/CantAttackTest.java | 158 +++++++++++++++++- .../PayCostToAttackBlockEffectImpl.java | 12 +- 2 files changed, 163 insertions(+), 7 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantAttackTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantAttackTest.java index 5ebd9205c41..f3a8cd4a9a7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantAttackTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantAttackTest.java @@ -40,8 +40,8 @@ import org.mage.test.serverside.base.CardTestPlayerBase; public class CantAttackTest extends CardTestPlayerBase { /** - * Tests "If all other elves get the Forestwalk ability and can't be blockt - * from creatures whose controler has a forest in game" + * Tests "If all other elves get the Forestwalk ability and can't be blocked + * from creatures whose controller has a forest in game" */ @Test public void testAttack() { @@ -250,4 +250,158 @@ public class CantAttackTest extends CardTestPlayerBase { assertGraveyardCount(playerA, eFirecraft, 1); assertPermanentCount(playerA, medomai, 1); } + + @Test + public void sphereOfSafetyPaidCostAllowsAttack() { + /* + Sphere of Safety {4}{W} + Enchantment + Creatures can't attack you or a planeswalker you control unless their controller pays {X} for each of those creatures, where X is the number of enchantments you control. + */ + String sphere = "Sphere of Safety"; + String memnite = "Memnite"; + + addCard(Zone.BATTLEFIELD, playerA, memnite); // {0} 1/1 + addCard(Zone.BATTLEFIELD, playerB, sphere); + addCard(Zone.BATTLEFIELD, playerA, "Forest"); + + attack(1, playerA, memnite); + setChoice(playerA, "Yes"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPermanentCount(playerB, sphere, 1); + assertLife(playerB, 19); // took the hit from memnite + assertTapped("Forest", true); // forest had to be tapped + } + + @Test + public void sphereOfSafetyCostNotPaid_NoAttackAllowed() { + /* + Sphere of Safety {4}{W} + Enchantment + Creatures can't attack you or a planeswalker you control unless their controller pays {X} for each of those creatures, where X is the number of enchantments you control. + */ + String sphere = "Sphere of Safety"; + String memnite = "Memnite"; + + addCard(Zone.BATTLEFIELD, playerA, memnite); // {0} 1/1 + addCard(Zone.BATTLEFIELD, playerB, sphere); + addCard(Zone.BATTLEFIELD, playerA, "Forest"); + + attack(1, playerA, memnite); + setChoice(playerA, "No"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPermanentCount(playerB, sphere, 1); + assertLife(playerB, 20); // no damage went through, did not elect to pay + assertTapped("Forest", false); // forest not tapped + } + + @Test + public void collectiveResistanceCostPaid_AttackAllowed() + { + /* + Collective Restraint {3}{U} + Enchantment + Domain — Creatures can't attack you unless their controller pays {X} for each creature he or she controls that's attacking you, where X is the number of basic land types among lands you control. + */ + String cRestraint = "Collective Restraint"; + String memnite = "Memnite"; + + addCard(Zone.BATTLEFIELD, playerA, memnite); // {0} 1/1 + addCard(Zone.BATTLEFIELD, playerB, cRestraint); + addCard(Zone.BATTLEFIELD, playerB, "Island"); // 1 basic land type = pay 1 to attack + addCard(Zone.BATTLEFIELD, playerA, "Forest"); + + attack(1, playerA, memnite); + setChoice(playerA, "Yes"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPermanentCount(playerB, cRestraint, 1); + assertLife(playerB, 19); // took the hit from memnite + assertTapped("Forest", true); // forest had to be tapped + } + + @Test + public void collectiveResistanceCostNotPaid_NoAttackAllowed() + { + /* + Collective Restraint {3}{U} + Enchantment + Domain — Creatures can't attack you unless their controller pays {X} for each creature he or she controls that's attacking you, where X is the number of basic land types among lands you control. + */ + String cRestraint = "Collective Restraint"; + String memnite = "Memnite"; + + addCard(Zone.BATTLEFIELD, playerA, memnite); // {0} 1/1 + addCard(Zone.BATTLEFIELD, playerB, cRestraint); + addCard(Zone.BATTLEFIELD, playerB, "Island"); // 1 basic land type = pay 1 to attack + addCard(Zone.BATTLEFIELD, playerA, "Forest"); + + attack(1, playerA, memnite); + setChoice(playerA, "No"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPermanentCount(playerB, cRestraint, 1); + assertLife(playerB, 20); // no damage went through, did not elect to pay + assertTapped("Forest", false); // forest not tapped + } + + @Test + public void ghostlyPrison_PaidCost_AllowsAttack() { + /* + Ghostly Prison {2}{W} + Enchantment + Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you. + */ + String gPrison = "Ghostly Prison"; + String memnite = "Memnite"; + + addCard(Zone.BATTLEFIELD, playerA, memnite); // {0} 1/1 + addCard(Zone.BATTLEFIELD, playerB, gPrison); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); + + attack(1, playerA, memnite); + setChoice(playerA, "Yes"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPermanentCount(playerB, gPrison, 1); + assertLife(playerB, 19); // took the hit from memnite + assertTappedCount("Forest", true, 2); // forests had to be tapped + } + + @Test + public void ghostlyPrison_CostNotPaid_NoAttackAllowed() { + /* + Ghostly Prison {2}{W} + Enchantment + Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you. + */ + String gPrison = "Ghostly Prison"; + String memnite = "Memnite"; + + addCard(Zone.BATTLEFIELD, playerA, memnite); // {0} 1/1 + addCard(Zone.BATTLEFIELD, playerB, gPrison); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); + + attack(1, playerA, memnite); + setChoice(playerA, "No"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPermanentCount(playerB, gPrison, 1); + assertLife(playerB, 20); // no damage went through, did not elect to pay + assertTapped("Forest", false); // no forests tapped + } } diff --git a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java index 48c16da477e..cad17d724e8 100644 --- a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java @@ -27,6 +27,7 @@ */ package mage.abilities.effects; +import java.util.Iterator; import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.Costs; @@ -43,9 +44,6 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.players.Player; -import java.util.Iterator; -import java.util.List; - /** * * @author LevelX2 @@ -72,7 +70,6 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm protected final Cost cost; protected final ManaCosts manaCosts; - protected final RestrictType restrictType; public PayCostToAttackBlockEffectImpl(Duration duration, Outcome outcome, RestrictType restrictType) { @@ -149,7 +146,9 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm attackBlockManaTax.clearPaid(); if (attackBlockManaTax.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Neutral, chooseText, source, game)) { - handlePhyrexianManaCosts(manaCosts, player, source, game); + + handlePhyrexianManaCosts(getManaCostToPay(event, source, game), player, source, game); + if (attackBlockManaTax instanceof ManaCostsImpl) { if (attackBlockManaTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) { return false; @@ -162,6 +161,9 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm } private void handlePhyrexianManaCosts(ManaCosts manaCosts, Player player, Ability source, Game game) { + + if (manaCosts == null) return; // nothing to be done without any mana costs. prevents NRE from occurring here + Iterator manaCostIterator = manaCosts.iterator(); Costs costs = new CostsImpl<>(); From 57efb1000336771a0a39a3f01fc3a7948ac9e5d5 Mon Sep 17 00:00:00 2001 From: drmDev Date: Thu, 23 Mar 2017 11:21:38 -0400 Subject: [PATCH 12/20] fixing tokens exiled at end of combat - not at end step --- Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java | 2 +- .../src/mage/cards/i/InvocationOfSaintTraft.java | 2 +- Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java | 2 +- .../abilities/effects/common/CreateTokenEffect.java | 12 ++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java b/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java index 956bea71f34..80759f534b7 100644 --- a/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java +++ b/Mage.Sets/src/mage/cards/g/GeistOfSaintTraft.java @@ -89,7 +89,7 @@ class GeistOfSaintTraftEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && effect.apply(game, source)) { - effect.exileTokensCreatedAtNextEndStep(game, source); + effect.exileTokensCreatedAtEndOfCombat(game, source); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java b/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java index e0c45d5e6e3..17a6278ea3c 100644 --- a/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java +++ b/Mage.Sets/src/mage/cards/i/InvocationOfSaintTraft.java @@ -97,7 +97,7 @@ class InvocationOfSaintTraftEffect extends OneShotEffect { CreateTokenEffect effect = new CreateTokenEffect(new AngelToken(), 1, true, true); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && (effect.apply(game, source))) { - effect.exileTokensCreatedAtNextEndStep(game, source); + effect.exileTokensCreatedAtEndOfCombat(game, source); return true; } return false; diff --git a/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java b/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java index 9883c36222b..d9ac3f53f1b 100644 --- a/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java +++ b/Mage.Sets/src/mage/cards/k/KariZevSkyshipRaider.java @@ -94,7 +94,7 @@ class KariZevSkyshipRaiderEffect extends OneShotEffect { CreateTokenEffect effect = new CreateTokenEffect(new RagavanToken(), 1, true, true); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && effect.apply(game, source)) { - effect.exileTokensCreatedAtNextEndStep(game, source); + effect.exileTokensCreatedAtEndOfCombat(game, source); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java index 964fa5f99df..025cebb7acc 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenEffect.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; @@ -124,6 +125,17 @@ public class CreateTokenEffect extends OneShotEffect { } } + public void exileTokensCreatedAtEndOfCombat(Game game, Ability source) { + for (UUID tokenId : this.getLastAddedTokenIds()) { + Permanent tokenPermanent = game.getPermanent(tokenId); + if (tokenPermanent != null) { + ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD); + exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game)); + game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source); + } + } + } + private void setText() { StringBuilder sb = new StringBuilder("create "); if (amount.toString().equals("1")) { From 8bcb2d1d2d57dc75c58b84d1df4aaf40e1913015 Mon Sep 17 00:00:00 2001 From: Achilles Date: Thu, 23 Mar 2017 15:13:13 -0500 Subject: [PATCH 13/20] - Added Quicksilver Fountain --- .../src/mage/cards/q/QuicksilverFountain.java | 187 ++++++++++++++++++ Mage.Sets/src/mage/sets/Mirrodin.java | 1 + 2 files changed, 188 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/q/QuicksilverFountain.java diff --git a/Mage.Sets/src/mage/cards/q/QuicksilverFountain.java b/Mage.Sets/src/mage/cards/q/QuicksilverFountain.java new file mode 100644 index 00000000000..e4ea73af408 --- /dev/null +++ b/Mage.Sets/src/mage/cards/q/QuicksilverFountain.java @@ -0,0 +1,187 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.q; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetLandPermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public class QuicksilverFountain extends CardImpl { + + public QuicksilverFountain(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); + + // At the beginning of each player's upkeep, that player puts a flood counter on target non-Island land he or she controls of his or her choice. That land is an Island for as long as it has a flood counter on it. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect(), TargetController.ANY, false, true)); + + // At the beginning of each end step, if all lands on the battlefield are Islands, remove all flood counters from them. + Condition condition = new AllLandsAreSubtypeCondition("Island"); + this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect2(), TargetController.ANY, condition, false)); + + } + + public QuicksilverFountain(final QuicksilverFountain card) { + super(card); + } + + @Override + public QuicksilverFountain copy() { + return new QuicksilverFountain(this); + } +} + +class QuicksilverFountainEffect extends OneShotEffect { + + static final private FilterLandPermanent filterNonIslandLand = new FilterLandPermanent("non-Island land"); + + static { + filterNonIslandLand.add(Predicates.not(new SubtypePredicate("Island"))); + } + + public QuicksilverFountainEffect() { + super(Outcome.Neutral); + staticText = "that player puts a flood counter on target non-Island land he or she controls of his or her choice. That land is an Island for as long as it has a flood counter on it"; + } + + public QuicksilverFountainEffect(final QuicksilverFountainEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(targetPointer.getFirst(game, source)); + Target targetNonIslandLand = new TargetLandPermanent(filterNonIslandLand); + if (player != null) { + if (player.choose(Outcome.Neutral, targetNonIslandLand, source.getId(), game)) { + Permanent landChosen = game.getPermanent(targetNonIslandLand.getFirstTarget()); + landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game); + ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new BecomesBasicLandTargetEffect(Duration.OneUse, "Island"), new LandHasFloodCounterCondition(this), staticText); + this.setTargetPointer(new FixedTarget(landChosen, game)); + effect.setTargetPointer(new FixedTarget(landChosen, game)); + game.addEffect(effect, source); + return true; + } + } + return false; + } + + @Override + public QuicksilverFountainEffect copy() { + return new QuicksilverFountainEffect(this); + } +} + +class QuicksilverFountainEffect2 extends OneShotEffect { + + public QuicksilverFountainEffect2() { + super(Outcome.Neutral); + staticText = "remove all flood counters from them"; + } + + public QuicksilverFountainEffect2(final QuicksilverFountainEffect2 effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + for (Permanent land : game.getBattlefield().getAllActivePermanents(CardType.LAND)) { + land.removeCounters(CounterType.FLOOD.createInstance(land.getCounters(game).getCount(CounterType.FLOOD)), game); + } + return true; + } + + @Override + public QuicksilverFountainEffect2 copy() { + return new QuicksilverFountainEffect2(this); + } +} + +class AllLandsAreSubtypeCondition implements Condition { + + private final String subtype; + + public AllLandsAreSubtypeCondition(String subtype) { + this.subtype = subtype; + } + + @Override + public boolean apply(Game game, Ability source) { + FilterLandPermanent filterLand = new FilterLandPermanent(); + filterLand.add(new SubtypePredicate(subtype)); + int landCount = game.getBattlefield().getAllActivePermanents(CardType.LAND).size(); + return game.getBattlefield().getAllActivePermanents(filterLand, game).size() == landCount; + } + + @Override + public String toString() { + return "if all lands on the battlefield are " + subtype + "s"; + } +} + +class LandHasFloodCounterCondition implements Condition { + + private final Effect effect; + + public LandHasFloodCounterCondition(Effect effect) { + this.effect = effect; + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(effect.getTargetPointer().getFirst(game, source)); + return permanent != null + && permanent.getCounters(game).getCount(CounterType.FLOOD) > 0; + } +} diff --git a/Mage.Sets/src/mage/sets/Mirrodin.java b/Mage.Sets/src/mage/sets/Mirrodin.java index d35973de0a5..b839f531d86 100644 --- a/Mage.Sets/src/mage/sets/Mirrodin.java +++ b/Mage.Sets/src/mage/sets/Mirrodin.java @@ -208,6 +208,7 @@ public class Mirrodin extends ExpansionSet { cards.add(new SetCardInfo("Psychogenic Probe", 231, Rarity.RARE, mage.cards.p.PsychogenicProbe.class)); cards.add(new SetCardInfo("Pyrite Spellbomb", 232, Rarity.COMMON, mage.cards.p.PyriteSpellbomb.class)); cards.add(new SetCardInfo("Quicksilver Elemental", 47, Rarity.RARE, mage.cards.q.QuicksilverElemental.class)); + cards.add(new SetCardInfo("Quicksilver Fountain", 233, Rarity.RARE, mage.cards.q.QuicksilverFountain.class)); cards.add(new SetCardInfo("Raise the Alarm", 16, Rarity.COMMON, mage.cards.r.RaiseTheAlarm.class)); cards.add(new SetCardInfo("Razor Barrier", 17, Rarity.COMMON, mage.cards.r.RazorBarrier.class)); cards.add(new SetCardInfo("Regress", 48, Rarity.COMMON, mage.cards.r.Regress.class)); From 1e8216c5c59eb0354ed2516cb177c7bfb57d1ca6 Mon Sep 17 00:00:00 2001 From: spjspj Date: Fri, 24 Mar 2017 08:14:17 +1100 Subject: [PATCH 14/20] Change for id str --- .../java/mage/client/dialog/ConnectDialog.java | 8 +++++++- Mage.Common/src/mage/remote/Connection.java | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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 91324908844..291f53a9c1d 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -45,6 +45,7 @@ import java.io.InputStreamReader; import java.io.Writer; import java.net.InetSocketAddress; import java.net.Proxy; +import java.net.SocketException; import java.net.SocketTimeoutException; import java.net.URL; import java.net.UnknownHostException; @@ -391,7 +392,12 @@ 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()); + String allMAC = ""; + try { + allMAC = connection.getMAC(); + } catch (SocketException ex) { + } + connection.setUserIdStr(System.getProperty("user.name") + ":" + System.getProperty("os.name") + ":" + MagePreferences.getUserNames() + ":" + allMAC); MageFrame.getPreferences().put(KEY_CONNECT_FLAG, ((CountryItemEditor) cbFlag.getEditor()).getImageItem()); PreferencesDialog.setProxyInformation(connection); diff --git a/Mage.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/remote/Connection.java index a5cac723360..855404ec87f 100644 --- a/Mage.Common/src/mage/remote/Connection.java +++ b/Mage.Common/src/mage/remote/Connection.java @@ -258,6 +258,24 @@ public class Connection { return null; } + public static String getMAC() throws SocketException { + StringBuilder allMACs = new StringBuilder(); + for (Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements();) { + NetworkInterface iface = interfaces.nextElement(); + byte[] mac = iface.getHardwareAddress(); + + if (mac != null) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < mac.length; i++) { + sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "")); + } + sb.append(';'); + allMACs.append(sb.toString()); + } + } + return allMACs.toString(); + } + public void setUserData(UserData userData) { this.userData = userData; } From 94c8d7f387f19eb756c535bbf48cbce213c879b8 Mon Sep 17 00:00:00 2001 From: drmDev Date: Thu, 23 Mar 2017 23:38:03 -0400 Subject: [PATCH 15/20] #3017 unit tests for declaration in stone. cannot duplicate issue --- .../single/soi/DeclarationInStoneTest.java | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/soi/DeclarationInStoneTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/DeclarationInStoneTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/DeclarationInStoneTest.java new file mode 100644 index 00000000000..355b9aabf0f --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/DeclarationInStoneTest.java @@ -0,0 +1,75 @@ +package org.mage.test.cards.single.soi; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author escplan9 + */ +public class DeclarationInStoneTest extends CardTestPlayerBase { + + @Test + public void testExileNonToken_NameShared_ExilesMultiple() { + + /* + Declaration in Stone {1}{W} Sorcery + Exile target creature and all other creatures its controller controls with the same name as that creature. That player investigates for each nontoken creature exiled this way. + */ + String dStone = "Declaration in Stone"; + String memnite = "Memnite"; // {0} 1/1 + String hGiant = "Hill Giant"; // {3}{R} 3/3 + + addCard(Zone.BATTLEFIELD, playerB, memnite, 3); + addCard(Zone.BATTLEFIELD, playerB, hGiant); + addCard(Zone.HAND, playerA, dStone); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, dStone, memnite); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, dStone, 1); + assertPermanentCount(playerB, hGiant, 1); + assertPermanentCount(playerB, memnite, 0); + assertExileCount(playerB, memnite, 3); + assertPermanentCount(playerB, "Clue", 3); // 3 creatures exiled = 3 clues for them + } + + @Test + public void testExileToken_NameShared_ExilesMultipleNoCluesFromTokensExiled() { + + /* + Declaration in Stone {1}{W} Sorcery + Exile target creature and all other creatures its controller controls with the same name as that creature. That player investigates for each nontoken creature exiled this way. + */ + String dStone = "Declaration in Stone"; + + /* + Grave Titan {4}{B}{B} + Creature — Giant + Deathtouch + Whenever Grave Titan enters the battlefield or attacks, create two 2/2 black Zombie creature tokens. + */ + String gTitan = "Grave Titan"; + + addCard(Zone.HAND, playerA, gTitan, 1); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6); + addCard(Zone.HAND, playerB, dStone); + addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, gTitan); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, dStone, "Zombie"); + + setStopAt(2, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerB, dStone, 1); + assertPermanentCount(playerA, gTitan, 1); + assertPermanentCount(playerA, "Zombie", 0); + assertPermanentCount(playerA, "Clue", 0); // tokens exiled do not generate clues + } +} From be62b11d2fc956eae8400859a155036466e640c7 Mon Sep 17 00:00:00 2001 From: drmDev Date: Thu, 23 Mar 2017 23:52:02 -0400 Subject: [PATCH 16/20] #3005 halimar tidecaller unit test. unable to duplicate issue. --- .../single/bfz/HalimarTidecallerTest.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/HalimarTidecallerTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/HalimarTidecallerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/HalimarTidecallerTest.java new file mode 100644 index 00000000000..2180d97fa7c --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/HalimarTidecallerTest.java @@ -0,0 +1,50 @@ +package org.mage.test.cards.single.bfz; + +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author escplan9 + */ +public class HalimarTidecallerTest extends CardTestPlayerBase { + + @Test + public void testMe() { + + /* + Halimar Tidecaller {2}{U} + Creature — Human Wizard Ally 2/3 + When Halimar Tidecaller enters the battlefield, you may return target card with awaken from your graveyard to your hand. + Land creatures you control have flying. + */ + String hTidecaller = "Halimar Tidecaller"; + + /* + Treetop Village + Land + Treetop Village enters the battlefield tapped. + {T}: Add Green to your mana pool. + {1}{G}: Treetop Village becomes a 3/3 green Ape creature with trample until end of turn. It's still a land. + */ + String tVillage = "Treetop Village"; + + addCard(Zone.BATTLEFIELD, playerA, hTidecaller); + addCard(Zone.BATTLEFIELD, playerA, tVillage); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{G}:"); // activate tree-top + attack(1, playerA, tVillage); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertLife(playerB, 17); // 3 damage from tree-top + assertAbility(playerA, tVillage, FlyingAbility.getInstance(), true); + assertAbility(playerA, tVillage, TrampleAbility.getInstance(), true); + } +} From b4a60555fcd098c8bb960e71f76e0e1e618aa050 Mon Sep 17 00:00:00 2001 From: Achilles Date: Fri, 24 Mar 2017 17:06:33 -0500 Subject: [PATCH 17/20] Revert "Change for id str" This reverts commit 1e8216c5c59eb0354ed2516cb177c7bfb57d1ca6. --- .../java/mage/client/dialog/ConnectDialog.java | 8 +------- Mage.Common/src/mage/remote/Connection.java | 18 ------------------ 2 files changed, 1 insertion(+), 25 deletions(-) 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 291f53a9c1d..91324908844 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -45,7 +45,6 @@ import java.io.InputStreamReader; import java.io.Writer; import java.net.InetSocketAddress; import java.net.Proxy; -import java.net.SocketException; import java.net.SocketTimeoutException; import java.net.URL; import java.net.UnknownHostException; @@ -392,12 +391,7 @@ public class ConnectDialog extends MageDialog { connection.setUsername(this.txtUserName.getText().trim()); connection.setPassword(this.txtPassword.getText().trim()); connection.setForceDBComparison(this.chkForceUpdateDB.isSelected()); - String allMAC = ""; - try { - allMAC = connection.getMAC(); - } catch (SocketException ex) { - } - connection.setUserIdStr(System.getProperty("user.name") + ":" + System.getProperty("os.name") + ":" + MagePreferences.getUserNames() + ":" + allMAC); + 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.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/remote/Connection.java index 855404ec87f..a5cac723360 100644 --- a/Mage.Common/src/mage/remote/Connection.java +++ b/Mage.Common/src/mage/remote/Connection.java @@ -258,24 +258,6 @@ public class Connection { return null; } - public static String getMAC() throws SocketException { - StringBuilder allMACs = new StringBuilder(); - for (Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements();) { - NetworkInterface iface = interfaces.nextElement(); - byte[] mac = iface.getHardwareAddress(); - - if (mac != null) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < mac.length; i++) { - sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "")); - } - sb.append(';'); - allMACs.append(sb.toString()); - } - } - return allMACs.toString(); - } - public void setUserData(UserData userData) { this.userData = userData; } From e30821b6cfdd5504814c1841f72e2f85c3b5c8bd Mon Sep 17 00:00:00 2001 From: Achilles Date: Fri, 24 Mar 2017 18:30:57 -0500 Subject: [PATCH 18/20] - Added Azorius AEthermage. Fixed Spellshift: The library must be shuffled. --- .../src/mage/cards/a/AzoriusAEthermage.java | 141 ++++++ Mage.Sets/src/mage/cards/s/Spellshift.java | 1 + Mage.Sets/src/mage/sets/Dissension.java | 422 +++++++++--------- 3 files changed, 354 insertions(+), 210 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java diff --git a/Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java b/Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java new file mode 100644 index 00000000000..fb94ae39d7e --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AzoriusAEthermage.java @@ -0,0 +1,141 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.a; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author jeffwadsworth + */ +public class AzoriusAEthermage extends CardImpl { + + private static final String rule = "Whenever a permanent is returned to your hand, "; + + public AzoriusAEthermage(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}"); + + this.subtype.add("Human"); + this.subtype.add("Wizard"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever a permanent is returned to your hand, you may pay {1}. If you do, draw a card. + Effect effect = new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{1}")); + this.addAbility(new AzoriusAEthermageAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.HAND, effect, new FilterPermanent(), rule, true)); + } + + public AzoriusAEthermage(final AzoriusAEthermage card) { + super(card); + } + + @Override + public AzoriusAEthermage copy() { + return new AzoriusAEthermage(this); + } +} + +class AzoriusAEthermageAbility extends TriggeredAbilityImpl { + + protected FilterPermanent filter; + protected Zone fromZone; + protected Zone toZone; + protected String rule; + + public AzoriusAEthermageAbility(Zone zone, Zone fromZone, Zone toZone, Effect effect, FilterPermanent filter, String rule, boolean optional) { + super(zone, effect, optional); + this.fromZone = fromZone; + this.toZone = toZone; + this.rule = rule; + this.filter = filter; + } + + public AzoriusAEthermageAbility(final AzoriusAEthermageAbility ability) { + super(ability); + this.fromZone = ability.fromZone; + this.toZone = ability.toZone; + this.rule = ability.rule; + this.filter = ability.filter; + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if ((fromZone == null || zEvent.getFromZone() == fromZone) + && (toZone == null || zEvent.getToZone() == toZone)) { + Permanent permanentThatMoved = null; + if (zEvent.getTarget() != null) { + permanentThatMoved = zEvent.getTarget(); + } + if (permanentThatMoved != null + && filter.match(permanentThatMoved, sourceId, controllerId, game) + && zEvent.getPlayerId() == controllerId) { //The controller's hand is where the permanent moved to. + return true; + } + } + return false; + } + + @Override + public String getRule() { + return rule + super.getRule(); + } + + @Override + public AzoriusAEthermageAbility copy() { + return new AzoriusAEthermageAbility(this); + } + + public Zone getFromZone() { + return fromZone; + } + + public Zone getToZone() { + return toZone; + } +} diff --git a/Mage.Sets/src/mage/cards/s/Spellshift.java b/Mage.Sets/src/mage/cards/s/Spellshift.java index a58475d546f..ea167b19758 100644 --- a/Mage.Sets/src/mage/cards/s/Spellshift.java +++ b/Mage.Sets/src/mage/cards/s/Spellshift.java @@ -115,6 +115,7 @@ class SpellshiftEffect extends OneShotEffect { library.addAll(cards.getCards(game), game); } } + player.shuffleLibrary(source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/Dissension.java b/Mage.Sets/src/mage/sets/Dissension.java index 19ce21b1677..1aa9ce4f8a3 100644 --- a/Mage.Sets/src/mage/sets/Dissension.java +++ b/Mage.Sets/src/mage/sets/Dissension.java @@ -1,210 +1,212 @@ -/* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ -package mage.sets; - -import mage.cards.ExpansionSet; -import mage.constants.SetType; - -import mage.constants.Rarity; - -/** - * Created by IntelliJ IDEA. User: Loki Date: 20.12.10 Time: 21:40 - */ -public class Dissension extends ExpansionSet { - - private static final Dissension instance = new Dissension(); - - public static Dissension getInstance() { - return instance; - } - - private Dissension() { - super("Dissension", "DIS", ExpansionSet.buildDate(2006, 4, 5), SetType.EXPANSION); - this.blockName = "Ravnica"; - this.parentSet = RavnicaCityOfGuilds.getInstance(); - this.hasBasicLands = false; - this.hasBoosters = true; - this.numBoosterLands = 0; - this.numBoosterCommon = 11; - this.numBoosterUncommon = 3; - this.numBoosterRare = 1; - this.ratioBoosterMythic = 0; - cards.add(new SetCardInfo("Aethermage's Touch", 101, Rarity.RARE, mage.cards.a.AethermagesTouch.class)); - cards.add(new SetCardInfo("Anthem of Rakdos", 102, Rarity.RARE, mage.cards.a.AnthemOfRakdos.class)); - cards.add(new SetCardInfo("Aquastrand Spider", 80, Rarity.COMMON, mage.cards.a.AquastrandSpider.class)); - cards.add(new SetCardInfo("Assault Zeppelid", 103, Rarity.COMMON, mage.cards.a.AssaultZeppelid.class)); - cards.add(new SetCardInfo("Aurora Eidolon", 1, Rarity.COMMON, mage.cards.a.AuroraEidolon.class)); - cards.add(new SetCardInfo("Avatar of Discord", 140, Rarity.RARE, mage.cards.a.AvatarOfDiscord.class)); - cards.add(new SetCardInfo("Azorius Chancery", 170, Rarity.COMMON, mage.cards.a.AzoriusChancery.class)); - cards.add(new SetCardInfo("Azorius First-Wing", 105, Rarity.COMMON, mage.cards.a.AzoriusFirstWing.class)); - cards.add(new SetCardInfo("Azorius Guildmage", 141, Rarity.UNCOMMON, mage.cards.a.AzoriusGuildmage.class)); - cards.add(new SetCardInfo("Azorius Herald", 2, Rarity.UNCOMMON, mage.cards.a.AzoriusHerald.class)); - cards.add(new SetCardInfo("Azorius Signet", 159, Rarity.COMMON, mage.cards.a.AzoriusSignet.class)); - cards.add(new SetCardInfo("Beacon Hawk", 3, Rarity.COMMON, mage.cards.b.BeaconHawk.class)); - cards.add(new SetCardInfo("Biomantic Mastery", 142, Rarity.RARE, mage.cards.b.BiomanticMastery.class)); - cards.add(new SetCardInfo("Blessing of the Nephilim", 4, Rarity.UNCOMMON, mage.cards.b.BlessingOfTheNephilim.class)); - cards.add(new SetCardInfo("Blood Crypt", 171, Rarity.RARE, mage.cards.b.BloodCrypt.class)); - cards.add(new SetCardInfo("Bond of Agony", 38, Rarity.UNCOMMON, mage.cards.b.BondOfAgony.class)); - cards.add(new SetCardInfo("Bound // Determined", 149, Rarity.RARE, mage.cards.b.BoundDetermined.class)); - cards.add(new SetCardInfo("Brain Pry", 39, Rarity.UNCOMMON, mage.cards.b.BrainPry.class)); - cards.add(new SetCardInfo("Breeding Pool", 172, Rarity.RARE, mage.cards.b.BreedingPool.class)); - cards.add(new SetCardInfo("Cackling Flames", 59, Rarity.COMMON, mage.cards.c.CacklingFlames.class)); - cards.add(new SetCardInfo("Carom", 6, Rarity.COMMON, mage.cards.c.Carom.class)); - cards.add(new SetCardInfo("Celestial Ancient", 7, Rarity.RARE, mage.cards.c.CelestialAncient.class)); - cards.add(new SetCardInfo("Coiling Oracle", 107, Rarity.COMMON, mage.cards.c.CoilingOracle.class)); - cards.add(new SetCardInfo("Condemn", 8, Rarity.UNCOMMON, mage.cards.c.Condemn.class)); - cards.add(new SetCardInfo("Court Hussar", 22, Rarity.UNCOMMON, mage.cards.c.CourtHussar.class)); - cards.add(new SetCardInfo("Crime // Punishment", 150, Rarity.RARE, mage.cards.c.CrimePunishment.class)); - cards.add(new SetCardInfo("Crypt Champion", 40, Rarity.UNCOMMON, mage.cards.c.CryptChampion.class)); - cards.add(new SetCardInfo("Cytoplast Manipulator", 23, Rarity.RARE, mage.cards.c.CytoplastManipulator.class)); - cards.add(new SetCardInfo("Cytoplast Root-Kin", 81, Rarity.RARE, mage.cards.c.CytoplastRootKin.class)); - cards.add(new SetCardInfo("Cytospawn Shambler", 82, Rarity.COMMON, mage.cards.c.CytospawnShambler.class)); - cards.add(new SetCardInfo("Delirium Skeins", 41, Rarity.COMMON, mage.cards.d.DeliriumSkeins.class)); - cards.add(new SetCardInfo("Demonfire", 60, Rarity.RARE, mage.cards.d.Demonfire.class)); - cards.add(new SetCardInfo("Demon's Jester", 42, Rarity.COMMON, mage.cards.d.DemonsJester.class)); - cards.add(new SetCardInfo("Dovescape", 143, Rarity.RARE, mage.cards.d.Dovescape.class)); - cards.add(new SetCardInfo("Dread Slag", 109, Rarity.RARE, mage.cards.d.DreadSlag.class)); - cards.add(new SetCardInfo("Drekavac", 43, Rarity.UNCOMMON, mage.cards.d.Drekavac.class)); - cards.add(new SetCardInfo("Enemy of the Guildpact", 44, Rarity.COMMON, mage.cards.e.EnemyOfTheGuildpact.class)); - cards.add(new SetCardInfo("Enigma Eidolon", 24, Rarity.COMMON, mage.cards.e.EnigmaEidolon.class)); - cards.add(new SetCardInfo("Entropic Eidolon", 45, Rarity.COMMON, mage.cards.e.EntropicEidolon.class)); - cards.add(new SetCardInfo("Evolution Vat", 161, Rarity.RARE, mage.cards.e.EvolutionVat.class)); - cards.add(new SetCardInfo("Experiment Kraj", 110, Rarity.RARE, mage.cards.e.ExperimentKraj.class)); - cards.add(new SetCardInfo("Flaring Flame-Kin", 62, Rarity.UNCOMMON, mage.cards.f.FlaringFlameKin.class)); - cards.add(new SetCardInfo("Freewind Equenaut", 9, Rarity.COMMON, mage.cards.f.FreewindEquenaut.class)); - cards.add(new SetCardInfo("Ghost Quarter", 173, Rarity.UNCOMMON, mage.cards.g.GhostQuarter.class)); - cards.add(new SetCardInfo("Gnat Alley Creeper", 63, Rarity.UNCOMMON, mage.cards.g.GnatAlleyCreeper.class)); - cards.add(new SetCardInfo("Gobhobbler Rats", 111, Rarity.COMMON, mage.cards.g.GobhobblerRats.class)); - cards.add(new SetCardInfo("Govern the Guildless", 25, Rarity.RARE, mage.cards.g.GovernTheGuildless.class)); - cards.add(new SetCardInfo("Grand Arbiter Augustin IV", 112, Rarity.RARE, mage.cards.g.GrandArbiterAugustinIV.class)); - cards.add(new SetCardInfo("Guardian of the Guildpact", 10, Rarity.COMMON, mage.cards.g.GuardianOfTheGuildpact.class)); - cards.add(new SetCardInfo("Haazda Exonerator", 11, Rarity.COMMON, mage.cards.h.HaazdaExonerator.class)); - cards.add(new SetCardInfo("Haazda Shield Mate", 12, Rarity.RARE, mage.cards.h.HaazdaShieldMate.class)); - cards.add(new SetCardInfo("Hallowed Fountain", 174, Rarity.RARE, mage.cards.h.HallowedFountain.class)); - cards.add(new SetCardInfo("Helium Squirter", 26, Rarity.COMMON, mage.cards.h.HeliumSquirter.class)); - cards.add(new SetCardInfo("Hellhole Rats", 113, Rarity.UNCOMMON, mage.cards.h.HellholeRats.class)); - cards.add(new SetCardInfo("Hide // Seek", 151, Rarity.UNCOMMON, mage.cards.h.HideSeek.class)); - cards.add(new SetCardInfo("Hit // Run", 152, Rarity.UNCOMMON, mage.cards.h.HitRun.class)); - cards.add(new SetCardInfo("Indrik Stomphowler", 86, Rarity.UNCOMMON, mage.cards.i.IndrikStomphowler.class)); - cards.add(new SetCardInfo("Infernal Tutor", 46, Rarity.RARE, mage.cards.i.InfernalTutor.class)); - cards.add(new SetCardInfo("Isperia the Inscrutable", 114, Rarity.RARE, mage.cards.i.IsperiaTheInscrutable.class)); - cards.add(new SetCardInfo("Kill-Suit Cultist", 65, Rarity.COMMON, mage.cards.k.KillSuitCultist.class)); - cards.add(new SetCardInfo("Leafdrake Roost", 116, Rarity.UNCOMMON, mage.cards.l.LeafdrakeRoost.class)); - cards.add(new SetCardInfo("Loaming Shaman", 87, Rarity.RARE, mage.cards.l.LoamingShaman.class)); - cards.add(new SetCardInfo("Lyzolda, the Blood Witch", 117, Rarity.RARE, mage.cards.l.LyzoldaTheBloodWitch.class)); - cards.add(new SetCardInfo("Macabre Waltz", 47, Rarity.COMMON, mage.cards.m.MacabreWaltz.class)); - cards.add(new SetCardInfo("Magewright's Stone", 162, Rarity.UNCOMMON, mage.cards.m.MagewrightsStone.class)); - cards.add(new SetCardInfo("Might of the Nephilim", 88, Rarity.UNCOMMON, mage.cards.m.MightOfTheNephilim.class)); - cards.add(new SetCardInfo("Minister of Impediments", 144, Rarity.COMMON, mage.cards.m.MinisterOfImpediments.class)); - cards.add(new SetCardInfo("Mistral Charger", 13, Rarity.UNCOMMON, mage.cards.m.MistralCharger.class)); - cards.add(new SetCardInfo("Momir Vig, Simic Visionary", 118, Rarity.RARE, mage.cards.m.MomirVigSimicVisionary.class)); - cards.add(new SetCardInfo("Novijen, Heart of Progress", 175, Rarity.UNCOMMON, mage.cards.n.NovijenHeartOfProgress.class)); - cards.add(new SetCardInfo("Novijen Sages", 27, Rarity.RARE, mage.cards.n.NovijenSages.class)); - cards.add(new SetCardInfo("Ocular Halo", 28, Rarity.COMMON, mage.cards.o.OcularHalo.class)); - cards.add(new SetCardInfo("Odds // Ends", 153, Rarity.RARE, mage.cards.o.OddsEnds.class)); - cards.add(new SetCardInfo("Ogre Gatecrasher", 67, Rarity.COMMON, mage.cards.o.OgreGatecrasher.class)); - cards.add(new SetCardInfo("Omnibian", 119, Rarity.RARE, mage.cards.o.Omnibian.class)); - cards.add(new SetCardInfo("Overrule", 120, Rarity.COMMON, mage.cards.o.Overrule.class)); - cards.add(new SetCardInfo("Pain Magnification", 121, Rarity.UNCOMMON, mage.cards.p.PainMagnification.class)); - cards.add(new SetCardInfo("Paladin of Prahv", 14, Rarity.UNCOMMON, mage.cards.p.PaladinOfPrahv.class)); - cards.add(new SetCardInfo("Palliation Accord", 122, Rarity.UNCOMMON, mage.cards.p.PalliationAccord.class)); - cards.add(new SetCardInfo("Patagia Viper", 89, Rarity.UNCOMMON, mage.cards.p.PatagiaViper.class)); - cards.add(new SetCardInfo("Pillar of the Paruns", 176, Rarity.RARE, mage.cards.p.PillarOfTheParuns.class)); - cards.add(new SetCardInfo("Plaxcaster Frogling", 123, Rarity.UNCOMMON, mage.cards.p.PlaxcasterFrogling.class)); - cards.add(new SetCardInfo("Plaxmanta", 29, Rarity.UNCOMMON, mage.cards.p.Plaxmanta.class)); - cards.add(new SetCardInfo("Plumes of Peace", 124, Rarity.COMMON, mage.cards.p.PlumesOfPeace.class)); - cards.add(new SetCardInfo("Prahv, Spires of Order", 177, Rarity.UNCOMMON, mage.cards.p.PrahvSpiresOfOrder.class)); - cards.add(new SetCardInfo("Pride of the Clouds", 125, Rarity.RARE, mage.cards.p.PrideOfTheClouds.class)); - cards.add(new SetCardInfo("Proclamation of Rebirth", 15, Rarity.RARE, mage.cards.p.ProclamationOfRebirth.class)); - cards.add(new SetCardInfo("Proper Burial", 16, Rarity.RARE, mage.cards.p.ProperBurial.class)); - cards.add(new SetCardInfo("Protean Hulk", 90, Rarity.RARE, mage.cards.p.ProteanHulk.class)); - cards.add(new SetCardInfo("Psychic Possession", 30, Rarity.RARE, mage.cards.p.PsychicPossession.class)); - cards.add(new SetCardInfo("Psychotic Fury", 68, Rarity.COMMON, mage.cards.p.PsychoticFury.class)); - cards.add(new SetCardInfo("Pure // Simple", 154, Rarity.UNCOMMON, mage.cards.p.PureSimple.class)); - cards.add(new SetCardInfo("Ragamuffyn", 51, Rarity.UNCOMMON, mage.cards.r.Ragamuffyn.class)); - cards.add(new SetCardInfo("Rain of Gore", 126, Rarity.RARE, mage.cards.r.RainOfGore.class)); - cards.add(new SetCardInfo("Rakdos Carnarium", 178, Rarity.COMMON, mage.cards.r.RakdosCarnarium.class)); - cards.add(new SetCardInfo("Rakdos Guildmage", 145, Rarity.UNCOMMON, mage.cards.r.RakdosGuildmage.class)); - cards.add(new SetCardInfo("Rakdos Ickspitter", 128, Rarity.COMMON, mage.cards.r.RakdosIckspitter.class)); - cards.add(new SetCardInfo("Rakdos Pit Dragon", 69, Rarity.RARE, mage.cards.r.RakdosPitDragon.class)); - cards.add(new SetCardInfo("Rakdos Signet", 165, Rarity.COMMON, mage.cards.r.RakdosSignet.class)); - cards.add(new SetCardInfo("Rakdos the Defiler", 129, Rarity.RARE, mage.cards.r.RakdosTheDefiler.class)); - cards.add(new SetCardInfo("Ratcatcher", 52, Rarity.RARE, mage.cards.r.Ratcatcher.class)); - cards.add(new SetCardInfo("Research // Development", 155, Rarity.RARE, mage.cards.r.ResearchDevelopment.class)); - cards.add(new SetCardInfo("Riot Spikes", 146, Rarity.COMMON, mage.cards.r.RiotSpikes.class)); - cards.add(new SetCardInfo("Rise // Fall", 156, Rarity.UNCOMMON, mage.cards.r.RiseFall.class)); - cards.add(new SetCardInfo("Rix Maadi, Dungeon Palace", 179, Rarity.UNCOMMON, mage.cards.r.RixMaadiDungeonPalace.class)); - cards.add(new SetCardInfo("Sandstorm Eidolon", 70, Rarity.COMMON, mage.cards.s.SandstormEidolon.class)); - cards.add(new SetCardInfo("Seal of Doom", 53, Rarity.COMMON, mage.cards.s.SealOfDoom.class)); - cards.add(new SetCardInfo("Seal of Fire", 71, Rarity.COMMON, mage.cards.s.SealOfFire.class)); - cards.add(new SetCardInfo("Shielding Plax", 147, Rarity.COMMON, mage.cards.s.ShieldingPlax.class)); - cards.add(new SetCardInfo("Silkwing Scout", 31, Rarity.COMMON, mage.cards.s.SilkwingScout.class)); - cards.add(new SetCardInfo("Simic Basilisk", 91, Rarity.UNCOMMON, mage.cards.s.SimicBasilisk.class)); - cards.add(new SetCardInfo("Simic Growth Chamber", 180, Rarity.COMMON, mage.cards.s.SimicGrowthChamber.class)); - cards.add(new SetCardInfo("Simic Guildmage", 148, Rarity.UNCOMMON, mage.cards.s.SimicGuildmage.class)); - cards.add(new SetCardInfo("Simic Initiate", 92, Rarity.COMMON, mage.cards.s.SimicInitiate.class)); - cards.add(new SetCardInfo("Simic Ragworm", 93, Rarity.COMMON, mage.cards.s.SimicRagworm.class)); - cards.add(new SetCardInfo("Simic Signet", 166, Rarity.COMMON, mage.cards.s.SimicSignet.class)); - cards.add(new SetCardInfo("Simic Sky Swallower", 130, Rarity.RARE, mage.cards.s.SimicSkySwallower.class)); - cards.add(new SetCardInfo("Skullmead Cauldron", 167, Rarity.UNCOMMON, mage.cards.s.SkullmeadCauldron.class)); - cards.add(new SetCardInfo("Sky Hussar", 131, Rarity.UNCOMMON, mage.cards.s.SkyHussar.class)); - cards.add(new SetCardInfo("Skyscribing", 32, Rarity.UNCOMMON, mage.cards.s.Skyscribing.class)); - cards.add(new SetCardInfo("Slithering Shade", 55, Rarity.UNCOMMON, mage.cards.s.SlitheringShade.class)); - cards.add(new SetCardInfo("Soulsworn Jury", 17, Rarity.COMMON, mage.cards.s.SoulswornJury.class)); - cards.add(new SetCardInfo("Spell Snare", 33, Rarity.UNCOMMON, mage.cards.s.SpellSnare.class)); - cards.add(new SetCardInfo("Sporeback Troll", 94, Rarity.COMMON, mage.cards.s.SporebackTroll.class)); - cards.add(new SetCardInfo("Sprouting Phytohydra", 95, Rarity.RARE, mage.cards.s.SproutingPhytohydra.class)); - cards.add(new SetCardInfo("Stalking Vengeance", 73, Rarity.RARE, mage.cards.s.StalkingVengeance.class)); - cards.add(new SetCardInfo("Steeling Stance", 18, Rarity.COMMON, mage.cards.s.SteelingStance.class)); - cards.add(new SetCardInfo("Stoic Ephemera", 19, Rarity.UNCOMMON, mage.cards.s.StoicEphemera.class)); - cards.add(new SetCardInfo("Stomp and Howl", 96, Rarity.UNCOMMON, mage.cards.s.StompAndHowl.class)); - cards.add(new SetCardInfo("Supply // Demand", 157, Rarity.UNCOMMON, mage.cards.s.SupplyDemand.class)); - cards.add(new SetCardInfo("Taste for Mayhem", 75, Rarity.COMMON, mage.cards.t.TasteForMayhem.class)); - cards.add(new SetCardInfo("Thrive", 98, Rarity.COMMON, mage.cards.t.Thrive.class)); - cards.add(new SetCardInfo("Tidespout Tyrant", 34, Rarity.RARE, mage.cards.t.TidespoutTyrant.class)); - cards.add(new SetCardInfo("Transguild Courier", 168, Rarity.UNCOMMON, mage.cards.t.TransguildCourier.class)); - cards.add(new SetCardInfo("Trial // Error", 158, Rarity.UNCOMMON, mage.cards.t.TrialError.class)); - cards.add(new SetCardInfo("Trygon Predator", 133, Rarity.UNCOMMON, mage.cards.t.TrygonPredator.class)); - cards.add(new SetCardInfo("Twinstrike", 134, Rarity.UNCOMMON, mage.cards.t.Twinstrike.class)); - cards.add(new SetCardInfo("Utopia Sprawl", 99, Rarity.COMMON, mage.cards.u.UtopiaSprawl.class)); - cards.add(new SetCardInfo("Utvara Scalper", 76, Rarity.COMMON, mage.cards.u.UtvaraScalper.class)); - cards.add(new SetCardInfo("Valor Made Real", 20, Rarity.COMMON, mage.cards.v.ValorMadeReal.class)); - cards.add(new SetCardInfo("Verdant Eidolon", 100, Rarity.COMMON, mage.cards.v.VerdantEidolon.class)); - cards.add(new SetCardInfo("Vesper Ghoul", 57, Rarity.COMMON, mage.cards.v.VesperGhoul.class)); - cards.add(new SetCardInfo("Vigean Graftmage", 35, Rarity.UNCOMMON, mage.cards.v.VigeanGraftmage.class)); - cards.add(new SetCardInfo("Vigean Hydropon", 135, Rarity.COMMON, mage.cards.v.VigeanHydropon.class)); - cards.add(new SetCardInfo("Vision Skeins", 36, Rarity.COMMON, mage.cards.v.VisionSkeins.class)); - cards.add(new SetCardInfo("Voidslime", 137, Rarity.RARE, mage.cards.v.Voidslime.class)); - cards.add(new SetCardInfo("Wakestone Gargoyle", 21, Rarity.RARE, mage.cards.w.WakestoneGargoyle.class)); - cards.add(new SetCardInfo("Walking Archive", 169, Rarity.RARE, mage.cards.w.WalkingArchive.class)); - cards.add(new SetCardInfo("Whiptail Moloch", 79, Rarity.COMMON, mage.cards.w.WhiptailMoloch.class)); - cards.add(new SetCardInfo("Windreaver", 138, Rarity.RARE, mage.cards.w.Windreaver.class)); - cards.add(new SetCardInfo("Wit's End", 58, Rarity.RARE, mage.cards.w.WitsEnd.class)); - cards.add(new SetCardInfo("Wrecking Ball", 139, Rarity.COMMON, mage.cards.w.WreckingBall.class)); - } -} +/* +* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are +* permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this list of +* conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, this list +* of conditions and the following disclaimer in the documentation and/or other materials +* provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* The views and conclusions contained in the software and documentation are those of the +* authors and should not be interpreted as representing official policies, either expressed +* or implied, of BetaSteward_at_googlemail.com. +*/ +package mage.sets; + +import mage.cards.ExpansionSet; +import mage.constants.SetType; + +import mage.constants.Rarity; + +/** + * Created by IntelliJ IDEA. User: Loki Date: 20.12.10 Time: 21:40 + */ +public class Dissension extends ExpansionSet { + + private static final Dissension instance = new Dissension(); + + public static Dissension getInstance() { + return instance; + } + + private Dissension() { + super("Dissension", "DIS", ExpansionSet.buildDate(2006, 4, 5), SetType.EXPANSION); + this.blockName = "Ravnica"; + this.parentSet = RavnicaCityOfGuilds.getInstance(); + this.hasBasicLands = false; + this.hasBoosters = true; + this.numBoosterLands = 0; + this.numBoosterCommon = 11; + this.numBoosterUncommon = 3; + this.numBoosterRare = 1; + this.ratioBoosterMythic = 0; + cards.add(new SetCardInfo("Aethermage's Touch", 101, Rarity.RARE, mage.cards.a.AethermagesTouch.class)); + cards.add(new SetCardInfo("Anthem of Rakdos", 102, Rarity.RARE, mage.cards.a.AnthemOfRakdos.class)); + cards.add(new SetCardInfo("Aquastrand Spider", 80, Rarity.COMMON, mage.cards.a.AquastrandSpider.class)); + cards.add(new SetCardInfo("Assault Zeppelid", 103, Rarity.COMMON, mage.cards.a.AssaultZeppelid.class)); + cards.add(new SetCardInfo("Aurora Eidolon", 1, Rarity.COMMON, mage.cards.a.AuroraEidolon.class)); + cards.add(new SetCardInfo("Avatar of Discord", 140, Rarity.RARE, mage.cards.a.AvatarOfDiscord.class)); + cards.add(new SetCardInfo("Azorius AEthermage", 104, Rarity.UNCOMMON, mage.cards.a.AzoriusAEthermage.class)); + cards.add(new SetCardInfo("Azorius Chancery", 170, Rarity.COMMON, mage.cards.a.AzoriusChancery.class)); + cards.add(new SetCardInfo("Azorius First-Wing", 105, Rarity.COMMON, mage.cards.a.AzoriusFirstWing.class)); + cards.add(new SetCardInfo("Azorius Guildmage", 141, Rarity.UNCOMMON, mage.cards.a.AzoriusGuildmage.class)); + cards.add(new SetCardInfo("Azorius Herald", 2, Rarity.UNCOMMON, mage.cards.a.AzoriusHerald.class)); + cards.add(new SetCardInfo("Azorius Signet", 159, Rarity.COMMON, mage.cards.a.AzoriusSignet.class)); + cards.add(new SetCardInfo("Beacon Hawk", 3, Rarity.COMMON, mage.cards.b.BeaconHawk.class)); + cards.add(new SetCardInfo("Biomantic Mastery", 142, Rarity.RARE, mage.cards.b.BiomanticMastery.class)); + cards.add(new SetCardInfo("Blessing of the Nephilim", 4, Rarity.UNCOMMON, mage.cards.b.BlessingOfTheNephilim.class)); + cards.add(new SetCardInfo("Blood Crypt", 171, Rarity.RARE, mage.cards.b.BloodCrypt.class)); + cards.add(new SetCardInfo("Bond of Agony", 38, Rarity.UNCOMMON, mage.cards.b.BondOfAgony.class)); + cards.add(new SetCardInfo("Bound // Determined", 149, Rarity.RARE, mage.cards.b.BoundDetermined.class)); + cards.add(new SetCardInfo("Brain Pry", 39, Rarity.UNCOMMON, mage.cards.b.BrainPry.class)); + cards.add(new SetCardInfo("Breeding Pool", 172, Rarity.RARE, mage.cards.b.BreedingPool.class)); + cards.add(new SetCardInfo("Cackling Flames", 59, Rarity.COMMON, mage.cards.c.CacklingFlames.class)); + cards.add(new SetCardInfo("Carom", 6, Rarity.COMMON, mage.cards.c.Carom.class)); + cards.add(new SetCardInfo("Celestial Ancient", 7, Rarity.RARE, mage.cards.c.CelestialAncient.class)); + cards.add(new SetCardInfo("Coiling Oracle", 107, Rarity.COMMON, mage.cards.c.CoilingOracle.class)); + cards.add(new SetCardInfo("Condemn", 8, Rarity.UNCOMMON, mage.cards.c.Condemn.class)); + cards.add(new SetCardInfo("Court Hussar", 22, Rarity.UNCOMMON, mage.cards.c.CourtHussar.class)); + cards.add(new SetCardInfo("Crime // Punishment", 150, Rarity.RARE, mage.cards.c.CrimePunishment.class)); + cards.add(new SetCardInfo("Crypt Champion", 40, Rarity.UNCOMMON, mage.cards.c.CryptChampion.class)); + cards.add(new SetCardInfo("Cytoplast Manipulator", 23, Rarity.RARE, mage.cards.c.CytoplastManipulator.class)); + cards.add(new SetCardInfo("Cytoplast Root-Kin", 81, Rarity.RARE, mage.cards.c.CytoplastRootKin.class)); + cards.add(new SetCardInfo("Cytospawn Shambler", 82, Rarity.COMMON, mage.cards.c.CytospawnShambler.class)); + cards.add(new SetCardInfo("Delirium Skeins", 41, Rarity.COMMON, mage.cards.d.DeliriumSkeins.class)); + cards.add(new SetCardInfo("Demonfire", 60, Rarity.RARE, mage.cards.d.Demonfire.class)); + cards.add(new SetCardInfo("Demon's Jester", 42, Rarity.COMMON, mage.cards.d.DemonsJester.class)); + cards.add(new SetCardInfo("Dovescape", 143, Rarity.RARE, mage.cards.d.Dovescape.class)); + cards.add(new SetCardInfo("Dread Slag", 109, Rarity.RARE, mage.cards.d.DreadSlag.class)); + cards.add(new SetCardInfo("Drekavac", 43, Rarity.UNCOMMON, mage.cards.d.Drekavac.class)); + cards.add(new SetCardInfo("Enemy of the Guildpact", 44, Rarity.COMMON, mage.cards.e.EnemyOfTheGuildpact.class)); + cards.add(new SetCardInfo("Enigma Eidolon", 24, Rarity.COMMON, mage.cards.e.EnigmaEidolon.class)); + cards.add(new SetCardInfo("Entropic Eidolon", 45, Rarity.COMMON, mage.cards.e.EntropicEidolon.class)); + cards.add(new SetCardInfo("Evolution Vat", 161, Rarity.RARE, mage.cards.e.EvolutionVat.class)); + cards.add(new SetCardInfo("Experiment Kraj", 110, Rarity.RARE, mage.cards.e.ExperimentKraj.class)); + cards.add(new SetCardInfo("Flaring Flame-Kin", 62, Rarity.UNCOMMON, mage.cards.f.FlaringFlameKin.class)); + cards.add(new SetCardInfo("Freewind Equenaut", 9, Rarity.COMMON, mage.cards.f.FreewindEquenaut.class)); + cards.add(new SetCardInfo("Ghost Quarter", 173, Rarity.UNCOMMON, mage.cards.g.GhostQuarter.class)); + cards.add(new SetCardInfo("Gnat Alley Creeper", 63, Rarity.UNCOMMON, mage.cards.g.GnatAlleyCreeper.class)); + cards.add(new SetCardInfo("Gobhobbler Rats", 111, Rarity.COMMON, mage.cards.g.GobhobblerRats.class)); + cards.add(new SetCardInfo("Govern the Guildless", 25, Rarity.RARE, mage.cards.g.GovernTheGuildless.class)); + cards.add(new SetCardInfo("Grand Arbiter Augustin IV", 112, Rarity.RARE, mage.cards.g.GrandArbiterAugustinIV.class)); + cards.add(new SetCardInfo("Guardian of the Guildpact", 10, Rarity.COMMON, mage.cards.g.GuardianOfTheGuildpact.class)); + cards.add(new SetCardInfo("Haazda Exonerator", 11, Rarity.COMMON, mage.cards.h.HaazdaExonerator.class)); + cards.add(new SetCardInfo("Haazda Shield Mate", 12, Rarity.RARE, mage.cards.h.HaazdaShieldMate.class)); + cards.add(new SetCardInfo("Hallowed Fountain", 174, Rarity.RARE, mage.cards.h.HallowedFountain.class)); + cards.add(new SetCardInfo("Helium Squirter", 26, Rarity.COMMON, mage.cards.h.HeliumSquirter.class)); + cards.add(new SetCardInfo("Hellhole Rats", 113, Rarity.UNCOMMON, mage.cards.h.HellholeRats.class)); + cards.add(new SetCardInfo("Hide // Seek", 151, Rarity.UNCOMMON, mage.cards.h.HideSeek.class)); + cards.add(new SetCardInfo("Hit // Run", 152, Rarity.UNCOMMON, mage.cards.h.HitRun.class)); + cards.add(new SetCardInfo("Indrik Stomphowler", 86, Rarity.UNCOMMON, mage.cards.i.IndrikStomphowler.class)); + cards.add(new SetCardInfo("Infernal Tutor", 46, Rarity.RARE, mage.cards.i.InfernalTutor.class)); + cards.add(new SetCardInfo("Isperia the Inscrutable", 114, Rarity.RARE, mage.cards.i.IsperiaTheInscrutable.class)); + cards.add(new SetCardInfo("Kill-Suit Cultist", 65, Rarity.COMMON, mage.cards.k.KillSuitCultist.class)); + cards.add(new SetCardInfo("Leafdrake Roost", 116, Rarity.UNCOMMON, mage.cards.l.LeafdrakeRoost.class)); + cards.add(new SetCardInfo("Loaming Shaman", 87, Rarity.RARE, mage.cards.l.LoamingShaman.class)); + cards.add(new SetCardInfo("Lyzolda, the Blood Witch", 117, Rarity.RARE, mage.cards.l.LyzoldaTheBloodWitch.class)); + cards.add(new SetCardInfo("Macabre Waltz", 47, Rarity.COMMON, mage.cards.m.MacabreWaltz.class)); + cards.add(new SetCardInfo("Magewright's Stone", 162, Rarity.UNCOMMON, mage.cards.m.MagewrightsStone.class)); + cards.add(new SetCardInfo("Might of the Nephilim", 88, Rarity.UNCOMMON, mage.cards.m.MightOfTheNephilim.class)); + cards.add(new SetCardInfo("Minister of Impediments", 144, Rarity.COMMON, mage.cards.m.MinisterOfImpediments.class)); + cards.add(new SetCardInfo("Mistral Charger", 13, Rarity.UNCOMMON, mage.cards.m.MistralCharger.class)); + cards.add(new SetCardInfo("Momir Vig, Simic Visionary", 118, Rarity.RARE, mage.cards.m.MomirVigSimicVisionary.class)); + cards.add(new SetCardInfo("Novijen, Heart of Progress", 175, Rarity.UNCOMMON, mage.cards.n.NovijenHeartOfProgress.class)); + cards.add(new SetCardInfo("Novijen Sages", 27, Rarity.RARE, mage.cards.n.NovijenSages.class)); + cards.add(new SetCardInfo("Ocular Halo", 28, Rarity.COMMON, mage.cards.o.OcularHalo.class)); + cards.add(new SetCardInfo("Odds // Ends", 153, Rarity.RARE, mage.cards.o.OddsEnds.class)); + cards.add(new SetCardInfo("Ogre Gatecrasher", 67, Rarity.COMMON, mage.cards.o.OgreGatecrasher.class)); + cards.add(new SetCardInfo("Omnibian", 119, Rarity.RARE, mage.cards.o.Omnibian.class)); + cards.add(new SetCardInfo("Overrule", 120, Rarity.COMMON, mage.cards.o.Overrule.class)); + cards.add(new SetCardInfo("Pain Magnification", 121, Rarity.UNCOMMON, mage.cards.p.PainMagnification.class)); + cards.add(new SetCardInfo("Paladin of Prahv", 14, Rarity.UNCOMMON, mage.cards.p.PaladinOfPrahv.class)); + cards.add(new SetCardInfo("Palliation Accord", 122, Rarity.UNCOMMON, mage.cards.p.PalliationAccord.class)); + cards.add(new SetCardInfo("Patagia Viper", 89, Rarity.UNCOMMON, mage.cards.p.PatagiaViper.class)); + cards.add(new SetCardInfo("Pillar of the Paruns", 176, Rarity.RARE, mage.cards.p.PillarOfTheParuns.class)); + cards.add(new SetCardInfo("Plaxcaster Frogling", 123, Rarity.UNCOMMON, mage.cards.p.PlaxcasterFrogling.class)); + cards.add(new SetCardInfo("Plaxmanta", 29, Rarity.UNCOMMON, mage.cards.p.Plaxmanta.class)); + cards.add(new SetCardInfo("Plumes of Peace", 124, Rarity.COMMON, mage.cards.p.PlumesOfPeace.class)); + cards.add(new SetCardInfo("Prahv, Spires of Order", 177, Rarity.UNCOMMON, mage.cards.p.PrahvSpiresOfOrder.class)); + cards.add(new SetCardInfo("Pride of the Clouds", 125, Rarity.RARE, mage.cards.p.PrideOfTheClouds.class)); + cards.add(new SetCardInfo("Proclamation of Rebirth", 15, Rarity.RARE, mage.cards.p.ProclamationOfRebirth.class)); + cards.add(new SetCardInfo("Proper Burial", 16, Rarity.RARE, mage.cards.p.ProperBurial.class)); + cards.add(new SetCardInfo("Protean Hulk", 90, Rarity.RARE, mage.cards.p.ProteanHulk.class)); + cards.add(new SetCardInfo("Psychic Possession", 30, Rarity.RARE, mage.cards.p.PsychicPossession.class)); + cards.add(new SetCardInfo("Psychotic Fury", 68, Rarity.COMMON, mage.cards.p.PsychoticFury.class)); + cards.add(new SetCardInfo("Pure // Simple", 154, Rarity.UNCOMMON, mage.cards.p.PureSimple.class)); + cards.add(new SetCardInfo("Ragamuffyn", 51, Rarity.UNCOMMON, mage.cards.r.Ragamuffyn.class)); + cards.add(new SetCardInfo("Rain of Gore", 126, Rarity.RARE, mage.cards.r.RainOfGore.class)); + cards.add(new SetCardInfo("Rakdos Carnarium", 178, Rarity.COMMON, mage.cards.r.RakdosCarnarium.class)); + cards.add(new SetCardInfo("Rakdos Guildmage", 145, Rarity.UNCOMMON, mage.cards.r.RakdosGuildmage.class)); + cards.add(new SetCardInfo("Rakdos Ickspitter", 128, Rarity.COMMON, mage.cards.r.RakdosIckspitter.class)); + cards.add(new SetCardInfo("Rakdos Pit Dragon", 69, Rarity.RARE, mage.cards.r.RakdosPitDragon.class)); + cards.add(new SetCardInfo("Rakdos Signet", 165, Rarity.COMMON, mage.cards.r.RakdosSignet.class)); + cards.add(new SetCardInfo("Rakdos the Defiler", 129, Rarity.RARE, mage.cards.r.RakdosTheDefiler.class)); + cards.add(new SetCardInfo("Ratcatcher", 52, Rarity.RARE, mage.cards.r.Ratcatcher.class)); + cards.add(new SetCardInfo("Research // Development", 155, Rarity.RARE, mage.cards.r.ResearchDevelopment.class)); + cards.add(new SetCardInfo("Riot Spikes", 146, Rarity.COMMON, mage.cards.r.RiotSpikes.class)); + cards.add(new SetCardInfo("Rise // Fall", 156, Rarity.UNCOMMON, mage.cards.r.RiseFall.class)); + cards.add(new SetCardInfo("Rix Maadi, Dungeon Palace", 179, Rarity.UNCOMMON, mage.cards.r.RixMaadiDungeonPalace.class)); + cards.add(new SetCardInfo("Sandstorm Eidolon", 70, Rarity.COMMON, mage.cards.s.SandstormEidolon.class)); + cards.add(new SetCardInfo("Seal of Doom", 53, Rarity.COMMON, mage.cards.s.SealOfDoom.class)); + cards.add(new SetCardInfo("Seal of Fire", 71, Rarity.COMMON, mage.cards.s.SealOfFire.class)); + cards.add(new SetCardInfo("Shielding Plax", 147, Rarity.COMMON, mage.cards.s.ShieldingPlax.class)); + cards.add(new SetCardInfo("Silkwing Scout", 31, Rarity.COMMON, mage.cards.s.SilkwingScout.class)); + cards.add(new SetCardInfo("Simic Basilisk", 91, Rarity.UNCOMMON, mage.cards.s.SimicBasilisk.class)); + cards.add(new SetCardInfo("Simic Growth Chamber", 180, Rarity.COMMON, mage.cards.s.SimicGrowthChamber.class)); + cards.add(new SetCardInfo("Simic Guildmage", 148, Rarity.UNCOMMON, mage.cards.s.SimicGuildmage.class)); + cards.add(new SetCardInfo("Simic Initiate", 92, Rarity.COMMON, mage.cards.s.SimicInitiate.class)); + cards.add(new SetCardInfo("Simic Ragworm", 93, Rarity.COMMON, mage.cards.s.SimicRagworm.class)); + cards.add(new SetCardInfo("Simic Signet", 166, Rarity.COMMON, mage.cards.s.SimicSignet.class)); + cards.add(new SetCardInfo("Simic Sky Swallower", 130, Rarity.RARE, mage.cards.s.SimicSkySwallower.class)); + cards.add(new SetCardInfo("Skullmead Cauldron", 167, Rarity.UNCOMMON, mage.cards.s.SkullmeadCauldron.class)); + cards.add(new SetCardInfo("Sky Hussar", 131, Rarity.UNCOMMON, mage.cards.s.SkyHussar.class)); + cards.add(new SetCardInfo("Skyscribing", 32, Rarity.UNCOMMON, mage.cards.s.Skyscribing.class)); + cards.add(new SetCardInfo("Slithering Shade", 55, Rarity.UNCOMMON, mage.cards.s.SlitheringShade.class)); + cards.add(new SetCardInfo("Soulsworn Jury", 17, Rarity.COMMON, mage.cards.s.SoulswornJury.class)); + cards.add(new SetCardInfo("Spell Snare", 33, Rarity.UNCOMMON, mage.cards.s.SpellSnare.class)); + cards.add(new SetCardInfo("Sporeback Troll", 94, Rarity.COMMON, mage.cards.s.SporebackTroll.class)); + cards.add(new SetCardInfo("Sprouting Phytohydra", 95, Rarity.RARE, mage.cards.s.SproutingPhytohydra.class)); + cards.add(new SetCardInfo("Stalking Vengeance", 73, Rarity.RARE, mage.cards.s.StalkingVengeance.class)); + cards.add(new SetCardInfo("Steeling Stance", 18, Rarity.COMMON, mage.cards.s.SteelingStance.class)); + cards.add(new SetCardInfo("Stoic Ephemera", 19, Rarity.UNCOMMON, mage.cards.s.StoicEphemera.class)); + cards.add(new SetCardInfo("Stomp and Howl", 96, Rarity.UNCOMMON, mage.cards.s.StompAndHowl.class)); + cards.add(new SetCardInfo("Supply // Demand", 157, Rarity.UNCOMMON, mage.cards.s.SupplyDemand.class)); + cards.add(new SetCardInfo("Taste for Mayhem", 75, Rarity.COMMON, mage.cards.t.TasteForMayhem.class)); + cards.add(new SetCardInfo("Thrive", 98, Rarity.COMMON, mage.cards.t.Thrive.class)); + cards.add(new SetCardInfo("Tidespout Tyrant", 34, Rarity.RARE, mage.cards.t.TidespoutTyrant.class)); + cards.add(new SetCardInfo("Transguild Courier", 168, Rarity.UNCOMMON, mage.cards.t.TransguildCourier.class)); + cards.add(new SetCardInfo("Trial // Error", 158, Rarity.UNCOMMON, mage.cards.t.TrialError.class)); + cards.add(new SetCardInfo("Trygon Predator", 133, Rarity.UNCOMMON, mage.cards.t.TrygonPredator.class)); + cards.add(new SetCardInfo("Twinstrike", 134, Rarity.UNCOMMON, mage.cards.t.Twinstrike.class)); + cards.add(new SetCardInfo("Utopia Sprawl", 99, Rarity.COMMON, mage.cards.u.UtopiaSprawl.class)); + cards.add(new SetCardInfo("Utvara Scalper", 76, Rarity.COMMON, mage.cards.u.UtvaraScalper.class)); + cards.add(new SetCardInfo("Valor Made Real", 20, Rarity.COMMON, mage.cards.v.ValorMadeReal.class)); + cards.add(new SetCardInfo("Verdant Eidolon", 100, Rarity.COMMON, mage.cards.v.VerdantEidolon.class)); + cards.add(new SetCardInfo("Vesper Ghoul", 57, Rarity.COMMON, mage.cards.v.VesperGhoul.class)); + cards.add(new SetCardInfo("Vigean Graftmage", 35, Rarity.UNCOMMON, mage.cards.v.VigeanGraftmage.class)); + cards.add(new SetCardInfo("Vigean Hydropon", 135, Rarity.COMMON, mage.cards.v.VigeanHydropon.class)); + cards.add(new SetCardInfo("Vision Skeins", 36, Rarity.COMMON, mage.cards.v.VisionSkeins.class)); + cards.add(new SetCardInfo("Voidslime", 137, Rarity.RARE, mage.cards.v.Voidslime.class)); + cards.add(new SetCardInfo("Wakestone Gargoyle", 21, Rarity.RARE, mage.cards.w.WakestoneGargoyle.class)); + cards.add(new SetCardInfo("Walking Archive", 169, Rarity.RARE, mage.cards.w.WalkingArchive.class)); + cards.add(new SetCardInfo("War's Toll", 77, Rarity.RARE, mage.cards.w.WarsToll.class)); + cards.add(new SetCardInfo("Whiptail Moloch", 79, Rarity.COMMON, mage.cards.w.WhiptailMoloch.class)); + cards.add(new SetCardInfo("Windreaver", 138, Rarity.RARE, mage.cards.w.Windreaver.class)); + cards.add(new SetCardInfo("Wit's End", 58, Rarity.RARE, mage.cards.w.WitsEnd.class)); + cards.add(new SetCardInfo("Wrecking Ball", 139, Rarity.COMMON, mage.cards.w.WreckingBall.class)); + } +} From 9702074bf526230341ee9d9dc925912ff2135588 Mon Sep 17 00:00:00 2001 From: Achilles Date: Fri, 24 Mar 2017 18:54:28 -0500 Subject: [PATCH 19/20] - Fixed the Dissention set. Accidently add War's Toll. --- Mage.Sets/src/mage/sets/Dissension.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Mage.Sets/src/mage/sets/Dissension.java b/Mage.Sets/src/mage/sets/Dissension.java index 1aa9ce4f8a3..3362ed00ac2 100644 --- a/Mage.Sets/src/mage/sets/Dissension.java +++ b/Mage.Sets/src/mage/sets/Dissension.java @@ -203,7 +203,6 @@ public class Dissension extends ExpansionSet { cards.add(new SetCardInfo("Voidslime", 137, Rarity.RARE, mage.cards.v.Voidslime.class)); cards.add(new SetCardInfo("Wakestone Gargoyle", 21, Rarity.RARE, mage.cards.w.WakestoneGargoyle.class)); cards.add(new SetCardInfo("Walking Archive", 169, Rarity.RARE, mage.cards.w.WalkingArchive.class)); - cards.add(new SetCardInfo("War's Toll", 77, Rarity.RARE, mage.cards.w.WarsToll.class)); cards.add(new SetCardInfo("Whiptail Moloch", 79, Rarity.COMMON, mage.cards.w.WhiptailMoloch.class)); cards.add(new SetCardInfo("Windreaver", 138, Rarity.RARE, mage.cards.w.Windreaver.class)); cards.add(new SetCardInfo("Wit's End", 58, Rarity.RARE, mage.cards.w.WitsEnd.class)); From 302f1f82623ab0c2da2275fa869c112907daa294 Mon Sep 17 00:00:00 2001 From: Achilles Date: Fri, 24 Mar 2017 21:18:06 -0500 Subject: [PATCH 20/20] - Fixed Goblin Grenade --- Mage.Sets/src/mage/cards/g/GoblinGrenade.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GoblinGrenade.java b/Mage.Sets/src/mage/cards/g/GoblinGrenade.java index f2cdde9fe16..1c0a900a253 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinGrenade.java +++ b/Mage.Sets/src/mage/cards/g/GoblinGrenade.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.cards.g; import java.util.UUID; @@ -35,9 +34,9 @@ import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreatureOrPlayer; /** @@ -45,16 +44,16 @@ import mage.target.common.TargetCreatureOrPlayer; */ public class GoblinGrenade extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a Goblin"); + private static final FilterControlledPermanent filter = new FilterControlledPermanent("a Goblin"); static { filter.add(new SubtypePredicate("Goblin")); } public GoblinGrenade(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{R}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}"); - this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, false))); this.getSpellAbility().addEffect(new DamageTargetEffect(5)); this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); }