mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
* Game: fixed random sort order of choices in choose dialogs
This commit is contained in:
parent
6b05562336
commit
a7480aeab1
40 changed files with 78 additions and 71 deletions
|
@ -3,13 +3,11 @@ package mage.client.components.ext.dlg;
|
|||
import mage.client.cards.BigCard;
|
||||
import mage.client.components.ext.MessageDialogType;
|
||||
import mage.client.game.FeedbackPanel;
|
||||
import mage.util.CardUtil;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* GUI: parameters for dialogs, uses to store useful data
|
||||
|
@ -39,7 +37,7 @@ public class DlgParams {
|
|||
|
||||
private boolean isAI = false;
|
||||
|
||||
private Set<String> manaChoices = new HashSet<>();
|
||||
private Set<String> manaChoices = new LinkedHashSet<>();
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
|
@ -80,6 +78,7 @@ public class DlgParams {
|
|||
}
|
||||
|
||||
public void setManaChoices(Set<String> manaChoices) {
|
||||
CardUtil.checkSetParamForSerializationCompatibility(manaChoices);
|
||||
this.manaChoices = manaChoices;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class PickChoiceDialog extends MageDialog {
|
|||
cbSpecial.setToolTipText(choice.getSpecialHint());
|
||||
|
||||
// 2 modes: string or key-values
|
||||
// sore data in allItems for inremental filtering
|
||||
// store data in allItems for inremental filtering
|
||||
// http://logicbig.com/tutorials/core-java-tutorial/swing/list-filter/
|
||||
this.allItems.clear();
|
||||
if (choice.isKeyChoice()) {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
|
||||
|
@ -72,7 +70,7 @@ class AngelicSkirmisherEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
Choice abilityChoice = new ChoiceImpl(true);
|
||||
Set<String> abilityChoices = new HashSet<>(3);
|
||||
Set<String> abilityChoices = new LinkedHashSet<>(3);
|
||||
abilityChoice.setMessage("Choose ability for your creatures");
|
||||
abilityChoices.add("First strike");
|
||||
abilityChoices.add("Vigilance");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -125,7 +126,7 @@ class AnimationModuleEffect extends OneShotEffect {
|
|||
}
|
||||
} else {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>(permanent.getCounters(game).size());
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
choices.add(counter.getName());
|
||||
}
|
||||
|
@ -155,7 +156,7 @@ class AnimationModuleEffect extends OneShotEffect {
|
|||
}
|
||||
} else {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>(player.getCounters().size());
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counter : player.getCounters().values()) {
|
||||
choices.add(counter.getName());
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import mage.target.common.TargetPermanentOrSuspendedCard;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -71,7 +72,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
|
|||
String counterName = null;
|
||||
if (permanent.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>(2);
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (permanent.getCounters(game).getCount(counter.getName()) > 0) {
|
||||
choices.add(counter.getName());
|
||||
|
@ -103,7 +104,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
|
|||
String counterName = null;
|
||||
if (card.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counter : card.getCounters(game).values()) {
|
||||
if (card.getCounters(game).getCount(counter.getName()) > 0) {
|
||||
choices.add(counter.getName());
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -60,7 +61,7 @@ public final class DwarvenArmorer extends CardImpl {
|
|||
|
||||
class DwarvenArmorerEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("+0/+1");
|
||||
|
|
|
@ -20,10 +20,7 @@ import mage.target.TargetCard;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -61,7 +58,7 @@ public final class ElspethResplendent extends CardImpl {
|
|||
|
||||
class ElspethResplendentCounterEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Flying");
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -50,7 +48,7 @@ public final class Fatespinner extends CardImpl {
|
|||
|
||||
class FatespinnerChooseEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Draw step");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -58,7 +59,7 @@ public final class FlowstoneSculpture extends CardImpl {
|
|||
|
||||
class FlowstoneSculptureEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("+1/+1 counter");
|
||||
|
|
|
@ -96,7 +96,7 @@ class GarthOneEyeEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
Set<String> alreadyChosen = getAlreadyChosen(game, source);
|
||||
Set<String> choices = new HashSet<>(names);
|
||||
Set<String> choices = new LinkedHashSet<>(names);
|
||||
choices.removeAll(alreadyChosen);
|
||||
String chosen;
|
||||
switch (choices.size()) {
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.target.TargetPermanent;
|
|||
import mage.target.common.TargetNonlandPermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -111,7 +112,7 @@ class GideonBlackbladeToken extends TokenImpl {
|
|||
}
|
||||
|
||||
class GideonBlackbladeEffect extends OneShotEffect {
|
||||
private static final Set<String> choices = new HashSet();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Vigilance");
|
||||
|
|
|
@ -18,6 +18,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -49,7 +50,7 @@ public final class Grimdancer extends CardImpl {
|
|||
|
||||
class GrimdancerEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Menace and deathtouch");
|
||||
|
|
|
@ -23,6 +23,7 @@ import mage.players.Player;
|
|||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -96,7 +97,7 @@ class IchormoonGauntletEffect extends OneShotEffect {
|
|||
}
|
||||
} else {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>(permanent.getCounters(game).size());
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
choices.add(counter.getName());
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class InvokeTheAncients extends CardImpl {
|
|||
class InvokeTheAncientsEffect extends OneShotEffect {
|
||||
|
||||
private static final Token token = new SpiritGreenToken();
|
||||
private static final Set<String> choices = new HashSet<>(Arrays.asList(
|
||||
private static final Set<String> choices = new LinkedHashSet<>(Arrays.asList(
|
||||
"Vigilance", "Reach", "Trample"
|
||||
));
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -53,7 +54,7 @@ public final class JodahsAvenger extends CardImpl {
|
|||
|
||||
class JodahsAvengerEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
private Ability gainedAbility;
|
||||
|
||||
static {
|
||||
|
|
|
@ -26,6 +26,7 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -100,7 +101,7 @@ class LeechBonderEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Set<String> possibleChoices = new HashSet<>(fromPermanent.getCounters(game).keySet());
|
||||
Set<String> possibleChoices = new LinkedHashSet<>(fromPermanent.getCounters(game).keySet());
|
||||
if (possibleChoices.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -58,7 +59,7 @@ public final class LunarAvenger extends CardImpl {
|
|||
|
||||
class LunarAvengerEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Flying");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -65,7 +66,7 @@ public final class MaintenanceDroid extends CardImpl {
|
|||
|
||||
class MaintenanceDroidEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Remove a repair counter");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -79,7 +80,7 @@ class ChooseLetterEffect extends OneShotEffect {
|
|||
|
||||
ChoiceImpl choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose letter");
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (char letter = 'A'; letter <= 'Z'; letter++) {
|
||||
choices.add(Character.toString(letter));
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -60,7 +61,7 @@ public final class MultiformWonder extends CardImpl {
|
|||
|
||||
class MultiformWonderEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Flying");
|
||||
|
|
|
@ -24,6 +24,7 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -54,7 +55,7 @@ public final class NaturesBlessing extends CardImpl {
|
|||
|
||||
class NaturesBlessingEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
private Ability gainedAbility;
|
||||
|
||||
static {
|
||||
|
|
|
@ -20,10 +20,7 @@ import mage.players.Player;
|
|||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -93,7 +90,7 @@ class NeganTheColdBloodedEffect extends OneShotEffect {
|
|||
if (!target.canChoose(source.getControllerId(), source, game)) {
|
||||
return false;
|
||||
}
|
||||
Set<UUID> choices = new HashSet<>();
|
||||
Set<UUID> choices = new LinkedHashSet<>();
|
||||
controller.choose(Outcome.DestroyPermanent, target, source, game);
|
||||
UUID controllerChoice = target.getFirstTarget();
|
||||
choices.add(controllerChoice);
|
||||
|
|
|
@ -25,6 +25,7 @@ import mage.target.TargetPermanent;
|
|||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -93,7 +94,7 @@ class NestingGroundsEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Set<String> possibleChoices = new HashSet<>(fromPermanent.getCounters(game).keySet());
|
||||
Set<String> possibleChoices = new LinkedHashSet<>(fromPermanent.getCounters(game).keySet());
|
||||
if (possibleChoices.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -59,7 +60,7 @@ class ReverseTheSandsEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Choice lifeChoice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -77,7 +78,7 @@ public final class RickSteadfastLeader extends CardImpl {
|
|||
|
||||
class RickSteadfastLeaderChooseEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("First strike and vigilance");
|
||||
|
|
|
@ -60,7 +60,7 @@ class RiteOfRuinEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
choices.add("Artifacts");
|
||||
choices.add("Creatures");
|
||||
choices.add("Lands");
|
||||
|
|
|
@ -24,6 +24,7 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -60,7 +61,7 @@ public final class ShiftingCeratops extends CardImpl {
|
|||
}
|
||||
|
||||
class ShiftingCeratopsEffect extends OneShotEffect {
|
||||
private static final Set<String> choices = new HashSet();
|
||||
private static final Set<String> choices = new LinkedHashSet();
|
||||
|
||||
static {
|
||||
choices.add("Reach");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -60,7 +61,7 @@ public final class SithEvoker extends CardImpl {
|
|||
|
||||
class SithEvokerEffect extends OneShotEffect {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add("Gain life equal to creature's power");
|
||||
|
|
|
@ -19,10 +19,7 @@ import mage.game.stack.Spell;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author L_J
|
||||
|
@ -70,7 +67,7 @@ class StaffOfTheLetterMagusChooseLetterEffect extends OneShotEffect {
|
|||
|
||||
ChoiceImpl choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose letter");
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
// Can I choose Y?
|
||||
// Yes. We play by popular game show rules here. Y is a consonant.
|
||||
// https://magic.wizards.com/en/articles/archive/news/unstable-faqawaslfaqpaftidawabiajtbt-2017-12-06
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.target.TargetPermanent;
|
|||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -101,7 +102,7 @@ class TayamLuminousEnigmaCost extends RemoveCounterCost {
|
|||
String counterName = null;
|
||||
if (permanent.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (permanent.getCounters(game).getCount(counter.getName()) > 0) {
|
||||
choices.add(counter.getName());
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
|
||||
package mage.cards.t;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -52,7 +49,7 @@ class TeferisRealmEffect extends OneShotEffect {
|
|||
private static final String CREATURE = "Creature";
|
||||
private static final String LAND = "Land";
|
||||
private static final String NON_AURA_ENCHANTMENT = "Non-Aura enchantment";
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
choices.add(ARTIFACT);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.u;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
|
@ -52,7 +53,7 @@ public final class UrzasAvenger extends CardImpl {
|
|||
|
||||
class UrzasAvengerEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final Set<String> choices = new HashSet<>();
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
private Ability gainedAbility;
|
||||
|
||||
static {
|
||||
|
|
|
@ -74,7 +74,7 @@ public final class VivienMonstersAdvocate extends CardImpl {
|
|||
class VivienMonstersAdvocateTokenEffect extends OneShotEffect {
|
||||
|
||||
private static final Token token = new BeastToken();
|
||||
private static final Set<String> choices = new HashSet<>(Arrays.asList(
|
||||
private static final Set<String> choices = new LinkedHashSet<>(Arrays.asList(
|
||||
"Vigilance", "Reach", "Trample"
|
||||
));
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -62,7 +63,7 @@ class WhenFluffyBunniesAttackEffect extends OneShotEffect {
|
|||
|
||||
ChoiceImpl choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose letter");
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Character letter = 'A'; letter <= 'Z'; letter++) {
|
||||
choices.add(letter.toString());
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ public class SerializationTest extends CardTestPlayerBase {
|
|||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose an ability");
|
||||
|
||||
choice.setChoices(new HashSet<>(abilityMap.keySet()));
|
||||
choice.setChoices(new LinkedHashSet<>(abilityMap.keySet()));
|
||||
|
||||
Object compressed = CompressUtil.compress(choice);
|
||||
Assert.assertTrue("Must be zip", compressed instanceof ZippedObjectImpl);
|
||||
|
|
|
@ -19,6 +19,7 @@ import mage.target.TargetPermanent;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -108,7 +109,7 @@ public class RemoveCounterCost extends CostImpl {
|
|||
}
|
||||
} else { // Multiple counters, player much choose which type to remove from
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counter : targetObject.getCounters(game).values()) {
|
||||
if (targetObject.getCounters(game).getCount(counter.getName()) > 0) {
|
||||
choices.add(counter.getName());
|
||||
|
|
|
@ -338,7 +338,7 @@ public class ContinuousEffects implements Serializable {
|
|||
* event
|
||||
*/
|
||||
private Map<ReplacementEffect, Set<Ability>> getApplicableReplacementEffects(GameEvent event, Game game) {
|
||||
Map<ReplacementEffect, Set<Ability>> replaceEffects = new HashMap<>();
|
||||
Map<ReplacementEffect, Set<Ability>> replaceEffects = new LinkedHashMap<>();
|
||||
if (auraReplacementEffect.checksEventType(event, game) && auraReplacementEffect.applies(event, null, game)) {
|
||||
replaceEffects.put(auraReplacementEffect, null);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +70,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect {
|
|||
String counterName = null;
|
||||
if (permanent.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Set<String> choices = new HashSet<>();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
for (Counter counterOnPermanent : permanent.getCounters(game).values()) {
|
||||
if (permanent.getCounters(game).getCount(counterOnPermanent.getName()) > 0) {
|
||||
choices.add(counterOnPermanent.getName());
|
||||
|
|
|
@ -2906,7 +2906,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (rollsAmount == 1) {
|
||||
return rollDieInnerWithReplacement(game, source, rollDieType, sidesAmount, chaosSidesAmount, planarSidesAmount);
|
||||
}
|
||||
Set<Object> choices = new HashSet<>();
|
||||
Set<Object> choices = new LinkedHashSet<>();
|
||||
for (int j = 0; j < rollsAmount; j++) {
|
||||
choices.add(rollDieInnerWithReplacement(game, source, rollDieType, sidesAmount, chaosSidesAmount, planarSidesAmount));
|
||||
}
|
||||
|
|
|
@ -1738,7 +1738,7 @@ public final class CardUtil {
|
|||
// HashMap uses inner class for Keys without serialization support,
|
||||
// so you can't use it for client-server data
|
||||
if (data != null && data.getClass().getName().endsWith("$KeySet")) {
|
||||
throw new IllegalArgumentException("Can't use KeySet as param, use new HashSet<>(data.keySet()) instead");
|
||||
throw new IllegalArgumentException("Can't use KeySet as param, use new LinkedHashSet<>(data.keySet()) instead");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue