diff --git a/Mage/src/main/java/mage/abilities/SpellAbility.java b/Mage/src/main/java/mage/abilities/SpellAbility.java index 8952db5a3a..8f8074e1b2 100644 --- a/Mage/src/main/java/mage/abilities/SpellAbility.java +++ b/Mage/src/main/java/mage/abilities/SpellAbility.java @@ -109,7 +109,7 @@ public class SpellAbility extends ActivatedAbilityImpl { } } if (costs.canPay(this, sourceId, controllerId, game)) { - if (getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) { + if (getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) { SplitCard splitCard = (SplitCard) game.getCard(getSourceId()); if (splitCard != null) { return (splitCard.getLeftHalfCard().getSpellAbility().canChooseTarget(game) diff --git a/Mage/src/main/java/mage/abilities/TriggeredAbilities.java b/Mage/src/main/java/mage/abilities/TriggeredAbilities.java index b9f6a179c0..65b3b92bc8 100644 --- a/Mage/src/main/java/mage/abilities/TriggeredAbilities.java +++ b/Mage/src/main/java/mage/abilities/TriggeredAbilities.java @@ -95,7 +95,7 @@ public class TriggeredAbilities extends ConcurrentHashMap savedCardsInfos = savedCards.get(rarity); if (savedCardsInfos == null) { CardCriteria criteria = new CardCriteria(); - if (rarity.equals(Rarity.LAND)) { + if (rarity == Rarity.LAND) { criteria.setCodes(!hasBasicLands && parentSet != null ? parentSet.code : this.code); } else { criteria.setCodes(this.code); diff --git a/Mage/src/main/java/mage/cards/SplitCard.java b/Mage/src/main/java/mage/cards/SplitCard.java index 3eefebf443..8a29fad787 100644 --- a/Mage/src/main/java/mage/cards/SplitCard.java +++ b/Mage/src/main/java/mage/cards/SplitCard.java @@ -130,7 +130,7 @@ public abstract class SplitCard extends CardImpl { public Abilities getAbilities() { Abilities allAbilites = new AbilitiesImpl<>(); for (Ability ability : super.getAbilities()) { - if (ability instanceof SpellAbility && !((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) { + if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT) { allAbilites.add(ability); } } @@ -143,7 +143,7 @@ public abstract class SplitCard extends CardImpl { public Abilities getAbilities(Game game) { Abilities allAbilites = new AbilitiesImpl<>(); for (Ability ability : super.getAbilities(game)) { - if (ability instanceof SpellAbility && !((SpellAbility) ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT)) { + if (ability instanceof SpellAbility && ((SpellAbility) ability).getSpellAbilityType() != SpellAbilityType.SPLIT) { allAbilites.add(ability); } } @@ -155,7 +155,7 @@ public abstract class SplitCard extends CardImpl { @Override public List getRules() { List rules = new ArrayList<>(); - if (getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) { + if (getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) { rules.add("--------------------------------------------------------------------------\nFuse (You may cast one or both halves of this card from your hand.)"); } return rules; diff --git a/Mage/src/main/java/mage/cards/repository/CardRepository.java b/Mage/src/main/java/mage/cards/repository/CardRepository.java index 0a8cdfa8d7..030fefbf9f 100644 --- a/Mage/src/main/java/mage/cards/repository/CardRepository.java +++ b/Mage/src/main/java/mage/cards/repository/CardRepository.java @@ -384,7 +384,7 @@ public enum CardRepository { for (CardInfo cardinfo : cards) { ExpansionInfo set = ExpansionRepository.instance.getSetByCode(cardinfo.getSetCode()); if (set != null) { - if ((set.getType().equals(SetType.EXPANSION) || set.getType().equals(SetType.CORE)) + if ((set.getType() == SetType.EXPANSION || set.getType() == SetType.CORE) && (lastExpansionDate == null || set.getReleaseDate().after(lastExpansionDate))) { cardToUse = cardinfo; lastExpansionDate = set.getReleaseDate(); diff --git a/Mage/src/main/java/mage/constants/Zone.java b/Mage/src/main/java/mage/constants/Zone.java index 618f58b4aa..73b2d4743c 100644 --- a/Mage/src/main/java/mage/constants/Zone.java +++ b/Mage/src/main/java/mage/constants/Zone.java @@ -41,7 +41,7 @@ public enum Zone { @Override public String toString() { - if (this.equals(EXILED)) { + if (this == EXILED) { return "exile zone"; } return super.toString(); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 337158a0d3..44b7f63427 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1465,12 +1465,12 @@ public abstract class GameImpl implements Game, Serializable { newEffect.init(newAbility, this); // If there are already copy effects with dration = Custom to the same object, remove the existing effects because they no longer have any effect - if (Duration.Custom.equals(duration)) { + if (duration == Duration.Custom) { for (Effect effect : getState().getContinuousEffects().getLayeredEffects(this)) { if (effect instanceof CopyEffect) { CopyEffect copyEffect = (CopyEffect) effect; // there is another copy effect that copies to the same permanent - if (copyEffect.getSourceId().equals(copyToPermanentId) && copyEffect.getDuration().equals(Duration.Custom)) { + if (copyEffect.getSourceId().equals(copyToPermanentId) && copyEffect.getDuration() == Duration.Custom) { copyEffect.discard(); } } @@ -1750,7 +1750,7 @@ public abstract class GameImpl implements Game, Serializable { if (spellAbility.getTargets().isEmpty()) { for (Ability ability : perm.getAbilities(this)) { if ((ability instanceof SpellAbility) - && SpellAbilityType.BASE_ALTERNATE.equals(((SpellAbility) ability).getSpellAbilityType()) + && SpellAbilityType.BASE_ALTERNATE == ((SpellAbility) ability).getSpellAbilityType() && !ability.getTargets().isEmpty()) { spellAbility = (SpellAbility) ability; break; @@ -2337,6 +2337,7 @@ public abstract class GameImpl implements Game, Serializable { } Iterator it = gameCards.entrySet().iterator(); + while (it.hasNext()) { Entry entry = (Entry) it.next(); Card card = entry.getValue(); @@ -2507,7 +2508,7 @@ public abstract class GameImpl implements Game, Serializable { @Override public MageObject getLastKnownInformation(UUID objectId, Zone zone, int zoneChangeCounter) { - if (zone.equals(Zone.BATTLEFIELD)) { + if (zone == Zone.BATTLEFIELD) { Map lkiMapExtended = lkiExtended.get(objectId); if (lkiMapExtended != null) { diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index 2f2871b641..c8c2cbcc2c 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -218,7 +218,7 @@ public class Spell extends StackObjImpl implements Card { for (UUID modeId : spellAbility.getModes().getSelectedModes()) { spellAbility.getModes().setActiveMode(modeId); if (spellAbility.getTargets().stillLegal(spellAbility, game)) { - if (!spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE)) { + if (spellAbility.getSpellAbilityType() != SpellAbilityType.SPLICE) { updateOptionalCosts(index); } result |= spellAbility.resolve(game); diff --git a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java index bae294f7c3..baccdf74f7 100644 --- a/Mage/src/main/java/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/main/java/mage/game/tournament/TournamentImpl.java @@ -283,14 +283,14 @@ public abstract class TournamentImpl implements Tournament { // set player state if he finished the round if (round.getRoundNumber() == rounds.size()) { // for elimination getRoundNumber = 0 so never true here match.setTournamentRound(round.getRoundNumber()); - if (tp1.getState().equals(TournamentPlayerState.DUELING)) { + if (tp1.getState() == TournamentPlayerState.DUELING) { if (round.getRoundNumber() == getNumberRounds()) { tp1.setState(TournamentPlayerState.FINISHED); } else { tp1.setState(TournamentPlayerState.WAITING); } } - if (tp2.getState().equals(TournamentPlayerState.DUELING)) { + if (tp2.getState() == TournamentPlayerState.DUELING) { if (round.getRoundNumber() == getNumberRounds()) { tp2.setState(TournamentPlayerState.FINISHED); } else { diff --git a/Mage/src/main/java/mage/game/turn/Turn.java b/Mage/src/main/java/mage/game/turn/Turn.java index c4c635b278..cd4f630138 100644 --- a/Mage/src/main/java/mage/game/turn/Turn.java +++ b/Mage/src/main/java/mage/game/turn/Turn.java @@ -145,7 +145,7 @@ public class Turn implements Serializable { if (game.isPaused() || game.gameOver(null)) { return false; } - if (!isEndTurnRequested() || phase.getType().equals(TurnPhase.END)) { + if (!isEndTurnRequested() || phase.getType() == TurnPhase.END) { currentPhase = phase; game.fireEvent(new GameEvent(GameEvent.EventType.PHASE_CHANGED, activePlayer.getId(), null, activePlayer.getId())); if (!game.getState().getTurnMods().skipPhase(activePlayer.getId(), currentPhase.getType())) { diff --git a/Mage/src/main/java/mage/players/ManaPool.java b/Mage/src/main/java/mage/players/ManaPool.java index 7ab223a4bc..fc15e9a634 100644 --- a/Mage/src/main/java/mage/players/ManaPool.java +++ b/Mage/src/main/java/mage/players/ManaPool.java @@ -214,7 +214,7 @@ public class ManaPool implements Serializable { for (ManaType manaType : ManaType.values()) { if (!doNotEmptyManaTypes.contains(manaType)) { if (item.get(manaType) > 0) { - if (!item.getDuration().equals(Duration.EndOfTurn) || game.getPhase().getType().equals(TurnPhase.END)) { + if (item.getDuration() != Duration.EndOfTurn || game.getPhase().getType() == TurnPhase.END) { if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) { int amount = item.get(manaType); item.clear(manaType); @@ -227,7 +227,7 @@ public class ManaPool implements Serializable { } if (conditionalItem != null) { if (conditionalItem.get(manaType) > 0) { - if (!item.getDuration().equals(Duration.EndOfTurn) || game.getPhase().getType().equals(TurnPhase.END)) { + if (item.getDuration() != Duration.EndOfTurn || game.getPhase().getType() == TurnPhase.END) { if (game.replaceEvent(new GameEvent(GameEvent.EventType.EMPTY_MANA_POOL, playerId, null, playerId))) { int amount = conditionalItem.get(manaType); conditionalItem.clear(manaType); diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 0ec4220302..dd1b9ced7c 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -2795,8 +2795,8 @@ public abstract class PlayerImpl implements Player, Serializable { return true; } for (Entry phaseStep : silentPhaseSteps.entrySet()) { - if (game.getPhase() != null && game.getPhase().getStep() != null && phaseStep.getKey().equals(game.getPhase().getStep().getType())) { - if (phaseStep.getValue() == null || phaseStep.getValue().equals(game.getPhase().getStep().getStepPart())) { + if (game.getPhase() != null && game.getPhase().getStep() != null && phaseStep.getKey() == game.getPhase().getStep().getType()) { + if (phaseStep.getValue() == null || phaseStep.getValue() == game.getPhase().getStep().getStepPart()) { return true; } } diff --git a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java index 5056610f74..5c1f3a53a6 100644 --- a/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java +++ b/Mage/src/main/java/mage/target/common/TargetActivatedAbility.java @@ -75,7 +75,7 @@ public class TargetActivatedAbility extends TargetObject { public boolean canChoose(UUID sourceControllerId, Game game) { for (StackObject stackObject : game.getStack()) { if (stackObject.getStackAbility() != null - && stackObject.getStackAbility().getAbilityType().equals(AbilityType.ACTIVATED) + && stackObject.getStackAbility().getAbilityType() == AbilityType.ACTIVATED && game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getStackAbility().getControllerId())) { return true; } diff --git a/Mage/src/main/java/mage/target/common/TargetActivatedOrTriggeredAbility.java b/Mage/src/main/java/mage/target/common/TargetActivatedOrTriggeredAbility.java index a0b402e5dc..c9d116bd96 100644 --- a/Mage/src/main/java/mage/target/common/TargetActivatedOrTriggeredAbility.java +++ b/Mage/src/main/java/mage/target/common/TargetActivatedOrTriggeredAbility.java @@ -118,8 +118,8 @@ public class TargetActivatedOrTriggeredAbility extends TargetObject { } if (stackObject instanceof Ability) { Ability ability = (Ability)stackObject; - return ability.getAbilityType().equals(AbilityType.TRIGGERED) - || ability.getAbilityType().equals(AbilityType.ACTIVATED); + return ability.getAbilityType() == AbilityType.TRIGGERED + || ability.getAbilityType() == AbilityType.ACTIVATED; } return false; }