From fb4065ba66d25bc2324d597df886a097e8375b6e Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 20 Aug 2021 09:38:16 +0400 Subject: [PATCH] Little fixes --- .../main/java/mage/client/deckeditor/CardSelector.java | 2 +- .../mage/client/util/gui/countryBox/CountryUtil.java | 2 +- .../src/test/java/org/mage/test/load/LoadTest.java | 2 +- .../SwissPairingMinimalWeightMatchingTest.java | 4 +--- .../src/test/java/mage/verify/VerifyCardDataTest.java | 4 ++-- .../common/cost/SpellsCostReductionAllEffect.java | 10 +++++----- .../cost/SpellsCostReductionControllerEffect.java | 6 +++--- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java index 9e84078d6d..4665d8dc0e 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java @@ -1252,7 +1252,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed // one item selected by user - // ignore combobox modifing + // ignore combobox modifying if (isSetsFilterLoading) { return; } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/countryBox/CountryUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/countryBox/CountryUtil.java index 6154310bc0..214f822ffe 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/countryBox/CountryUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/countryBox/CountryUtil.java @@ -64,7 +64,7 @@ public final class CountryUtil { public static String getCountryName(String countryCode) { if (COUNTRY_MAP.isEmpty()) { - for (int i = 0; i <= CountryComboBox.countryList.length - 1; i++) { + for (int i = 0; i < CountryComboBox.countryList.length; i++) { COUNTRY_MAP.put(CountryComboBox.countryList[i][1], CountryComboBox.countryList[i][0]); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java index ffccc65157..349181d431 100644 --- a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java @@ -291,7 +291,7 @@ public class LoadTest { } LoadTestGameResultsList gameResults = new LoadTestGameResultsList(); - for (int i = 0; i <= seedsList.size() - 1; i++) { + for (int i = 0; i < seedsList.size(); i++) { long randomSeed = seedsList.get(i); logger.info("Game " + (i + 1) + " of " + seedsList.size() + ", RANDOM seed: " + randomSeed); RandomUtil.setSeed(randomSeed); diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/tournament/SwissPairingMinimalWeightMatchingTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/tournament/SwissPairingMinimalWeightMatchingTest.java index f79e7b4b3b..b144e00eb0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/tournament/SwissPairingMinimalWeightMatchingTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/tournament/SwissPairingMinimalWeightMatchingTest.java @@ -1,6 +1,5 @@ package org.mage.test.serverside.tournament; - import mage.game.tournament.Round; import mage.game.tournament.TournamentPairing; import mage.game.tournament.TournamentPlayer; @@ -17,7 +16,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; - /** * @author Quercitron */ @@ -258,7 +256,7 @@ public class SwissPairingMinimalWeightMatchingTest { @Test public void SimulateDifferentTournaments() { int playersCount = 12; - for (int i = 0; i <= playersCount; i++) { + for (int i = 0; i < playersCount; i++) { int roundsCount = ((i + 1) / 2) * 2 - 1; for (int j = 1; j <= roundsCount; j++) { SimulateTournament(i, j); diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index 392750d46d..2825e22dd9 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -1591,9 +1591,9 @@ public class VerifyCardDataTest { } boolean isFine = true; - for (int i = 0; i <= cardRules.length - 1; i++) { + for (int i = 0; i < cardRules.length; i++) { boolean isAbilityFounded = false; - for (int j = 0; j <= refRules.length - 1; j++) { + for (int j = 0; j < refRules.length; j++) { String refRule = refRules[j]; if (compareText(cardRules[i], refRule, card.getName())) { cardRules[i] = "+ " + cardRules[i]; diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java index cf9eb0340d..4786eb69af 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionAllEffect.java @@ -21,10 +21,10 @@ import mage.util.CardUtil; */ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { - private FilterCard filter; - private int amount; + private final FilterCard filter; + private final int amount; private final boolean upTo; - private boolean onlyControlled; + private final boolean onlyControlled; private UUID controllerId; public SpellsCostReductionAllEffect(int amount) { @@ -72,8 +72,8 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { } Mana mana = abilityToModify.getManaCostsToPay().getMana(); int reduceMax = mana.getGeneric(); - if (reduceMax > 2) { - reduceMax = 2; + if (reduceMax > this.amount) { + reduceMax = this.amount; } if (reduceMax > 0) { Player controller = game.getPlayer(abilityToModify.getControllerId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java index 23bf6e9f7c..b2367505fb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java @@ -71,8 +71,8 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI if (upTo) { Mana mana = abilityToModify.getManaCostsToPay().getMana(); int reduceMax = mana.getGeneric(); - if (reduceMax > amount) { - reduceMax = amount; + if (reduceMax > this.amount) { + reduceMax = this.amount; } if (reduceMax > 0) { Player controller = game.getPlayer(abilityToModify.getControllerId()); @@ -83,7 +83,7 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI if (!game.inCheckPlayableState()) { ChoiceImpl choice = new ChoiceImpl(false); Set set = new LinkedHashSet<>(); - for (int i = 0; i <= amount; i++) { + for (int i = 0; i <= reduceMax; i++) { set.add(String.valueOf(i)); } choice.setChoices(set);