Fixed game error for few cards like Agent's Toolkit (fix NotSerializableException, #9580);

This commit is contained in:
Oleg Agafonov 2023-04-01 18:52:31 +04:00
parent 4bf3e43da6
commit ad3b76dae6
3 changed files with 6 additions and 3 deletions

View file

@ -23,6 +23,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
@ -90,7 +91,7 @@ class AgentToolkitMoveCounterEffect extends OneShotEffect {
Permanent enteringCreature = (Permanent) enteringObject;
Choice moveCounterChoice = new ChoiceImpl(false);
Set<String> possibleCounterNames = agentsToolkitPermanent.getCounters(game).keySet();
Set<String> possibleCounterNames = new LinkedHashSet<>(agentsToolkitPermanent.getCounters(game).keySet());
moveCounterChoice.setMessage("Choose counter to move");
moveCounterChoice.setChoices(possibleCounterNames);

View file

@ -23,6 +23,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
import mage.util.RandomUtil;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
@ -125,7 +126,7 @@ class ContractualSafeguardSecondEffect extends OneShotEffect {
if (permanent == null) {
return false;
}
Set<String> counterTypes = permanent.getCounters(game).keySet();
Set<String> counterTypes = new LinkedHashSet<>(permanent.getCounters(game).keySet());
String chosenType;
switch (counterTypes.size()) {
case 0:

View file

@ -14,6 +14,7 @@ import mage.players.Player;
import mage.util.RandomUtil;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
@ -58,7 +59,7 @@ public class RemoveCountersSourceCost extends CostImpl {
}
String toRemove;
if (name.isEmpty()) {
Set<String> toChoose = permanent.getCounters(game).keySet();
Set<String> toChoose = new LinkedHashSet<>(permanent.getCounters(game).keySet());
switch (toChoose.size()) {
case 0:
return paid;