Little fixes

This commit is contained in:
Oleg Agafonov 2021-08-20 09:38:16 +04:00
parent ca521751cd
commit fb4065ba66
7 changed files with 14 additions and 16 deletions

View file

@ -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 private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed
// one item selected by user // one item selected by user
// ignore combobox modifing // ignore combobox modifying
if (isSetsFilterLoading) { if (isSetsFilterLoading) {
return; return;
} }

View file

@ -64,7 +64,7 @@ public final class CountryUtil {
public static String getCountryName(String countryCode) { public static String getCountryName(String countryCode) {
if (COUNTRY_MAP.isEmpty()) { 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]); COUNTRY_MAP.put(CountryComboBox.countryList[i][1], CountryComboBox.countryList[i][0]);
} }
} }

View file

@ -291,7 +291,7 @@ public class LoadTest {
} }
LoadTestGameResultsList gameResults = new LoadTestGameResultsList(); 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); long randomSeed = seedsList.get(i);
logger.info("Game " + (i + 1) + " of " + seedsList.size() + ", RANDOM seed: " + randomSeed); logger.info("Game " + (i + 1) + " of " + seedsList.size() + ", RANDOM seed: " + randomSeed);
RandomUtil.setSeed(randomSeed); RandomUtil.setSeed(randomSeed);

View file

@ -1,6 +1,5 @@
package org.mage.test.serverside.tournament; package org.mage.test.serverside.tournament;
import mage.game.tournament.Round; import mage.game.tournament.Round;
import mage.game.tournament.TournamentPairing; import mage.game.tournament.TournamentPairing;
import mage.game.tournament.TournamentPlayer; import mage.game.tournament.TournamentPlayer;
@ -17,7 +16,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
* @author Quercitron * @author Quercitron
*/ */
@ -258,7 +256,7 @@ public class SwissPairingMinimalWeightMatchingTest {
@Test @Test
public void SimulateDifferentTournaments() { public void SimulateDifferentTournaments() {
int playersCount = 12; int playersCount = 12;
for (int i = 0; i <= playersCount; i++) { for (int i = 0; i < playersCount; i++) {
int roundsCount = ((i + 1) / 2) * 2 - 1; int roundsCount = ((i + 1) / 2) * 2 - 1;
for (int j = 1; j <= roundsCount; j++) { for (int j = 1; j <= roundsCount; j++) {
SimulateTournament(i, j); SimulateTournament(i, j);

View file

@ -1591,9 +1591,9 @@ public class VerifyCardDataTest {
} }
boolean isFine = true; boolean isFine = true;
for (int i = 0; i <= cardRules.length - 1; i++) { for (int i = 0; i < cardRules.length; i++) {
boolean isAbilityFounded = false; boolean isAbilityFounded = false;
for (int j = 0; j <= refRules.length - 1; j++) { for (int j = 0; j < refRules.length; j++) {
String refRule = refRules[j]; String refRule = refRules[j];
if (compareText(cardRules[i], refRule, card.getName())) { if (compareText(cardRules[i], refRule, card.getName())) {
cardRules[i] = "+ " + cardRules[i]; cardRules[i] = "+ " + cardRules[i];

View file

@ -21,10 +21,10 @@ import mage.util.CardUtil;
*/ */
public class SpellsCostReductionAllEffect extends CostModificationEffectImpl { public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
private FilterCard filter; private final FilterCard filter;
private int amount; private final int amount;
private final boolean upTo; private final boolean upTo;
private boolean onlyControlled; private final boolean onlyControlled;
private UUID controllerId; private UUID controllerId;
public SpellsCostReductionAllEffect(int amount) { public SpellsCostReductionAllEffect(int amount) {
@ -72,8 +72,8 @@ public class SpellsCostReductionAllEffect extends CostModificationEffectImpl {
} }
Mana mana = abilityToModify.getManaCostsToPay().getMana(); Mana mana = abilityToModify.getManaCostsToPay().getMana();
int reduceMax = mana.getGeneric(); int reduceMax = mana.getGeneric();
if (reduceMax > 2) { if (reduceMax > this.amount) {
reduceMax = 2; reduceMax = this.amount;
} }
if (reduceMax > 0) { if (reduceMax > 0) {
Player controller = game.getPlayer(abilityToModify.getControllerId()); Player controller = game.getPlayer(abilityToModify.getControllerId());

View file

@ -71,8 +71,8 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
if (upTo) { if (upTo) {
Mana mana = abilityToModify.getManaCostsToPay().getMana(); Mana mana = abilityToModify.getManaCostsToPay().getMana();
int reduceMax = mana.getGeneric(); int reduceMax = mana.getGeneric();
if (reduceMax > amount) { if (reduceMax > this.amount) {
reduceMax = amount; reduceMax = this.amount;
} }
if (reduceMax > 0) { if (reduceMax > 0) {
Player controller = game.getPlayer(abilityToModify.getControllerId()); Player controller = game.getPlayer(abilityToModify.getControllerId());
@ -83,7 +83,7 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI
if (!game.inCheckPlayableState()) { if (!game.inCheckPlayableState()) {
ChoiceImpl choice = new ChoiceImpl(false); ChoiceImpl choice = new ChoiceImpl(false);
Set<String> set = new LinkedHashSet<>(); Set<String> set = new LinkedHashSet<>();
for (int i = 0; i <= amount; i++) { for (int i = 0; i <= reduceMax; i++) {
set.add(String.valueOf(i)); set.add(String.valueOf(i));
} }
choice.setChoices(set); choice.setChoices(set);