diff --git a/forge-ai/src/main/java/forge/ai/AiCardMemory.java b/forge-ai/src/main/java/forge/ai/AiCardMemory.java
index 44bb9de13eb..002241f638f 100644
--- a/forge-ai/src/main/java/forge/ai/AiCardMemory.java
+++ b/forge-ai/src/main/java/forge/ai/AiCardMemory.java
@@ -40,9 +40,9 @@ import java.util.Set;
*/
public class AiCardMemory {
- private HashSet memMandatoryAttackers = new HashSet();
- private HashSet memHeldManaSources = new HashSet();
- private HashSet memAttachedThisTurn = new HashSet();
+ private Set memMandatoryAttackers = new HashSet();
+ private Set memHeldManaSources = new HashSet();
+ private Set memAttachedThisTurn = new HashSet();
//private HashSet memRevealedCards = new HashSet();
/**
diff --git a/forge-ai/src/main/java/forge/ai/AiController.java b/forge-ai/src/main/java/forge/ai/AiController.java
index 3385bca089c..c3a2b305a7b 100644
--- a/forge-ai/src/main/java/forge/ai/AiController.java
+++ b/forge-ai/src/main/java/forge/ai/AiController.java
@@ -137,7 +137,7 @@ public class AiController {
simPicker = new SpellAbilityPicker(game, player);
}
- private ArrayList getPossibleETBCounters() {
+ private List getPossibleETBCounters() {
final Player opp = player.getOpponent();
CardCollection all = new CardCollection(player.getCardsIn(ZoneType.Hand));
all.addAll(player.getCardsIn(ZoneType.Exile));
@@ -147,7 +147,7 @@ public class AiController {
}
all.addAll(opp.getCardsIn(ZoneType.Exile));
- final ArrayList spellAbilities = new ArrayList();
+ final List spellAbilities = new ArrayList();
for (final Card c : all) {
for (final SpellAbility sa : c.getNonManaAbilities()) {
if (sa instanceof SpellPermanent) {
@@ -323,8 +323,8 @@ public class AiController {
return true;
}
- private static ArrayList getPlayableCounters(final CardCollection l) {
- final ArrayList spellAbility = new ArrayList();
+ private static List getPlayableCounters(final CardCollection l) {
+ final List spellAbility = new ArrayList();
for (final Card c : l) {
for (final SpellAbility sa : c.getNonManaAbilities()) {
// Check if this AF is a Counterpsell
@@ -482,7 +482,7 @@ public class AiController {
if (Iterables.any(landList, CardPredicates.Presets.BASIC_LANDS)) {
final CardCollectionView combined = player.getCardsIn(ZoneType.Battlefield);
- final ArrayList basics = new ArrayList();
+ final List basics = new ArrayList();
// what types can I go get?
for (final String name : CardType.Constant.BASIC_TYPES) {
@@ -513,7 +513,7 @@ public class AiController {
}
// if return true, go to next phase
- private SpellAbility chooseCounterSpell(final ArrayList possibleCounters) {
+ private SpellAbility chooseCounterSpell(final List possibleCounters) {
if (possibleCounters == null || possibleCounters.isEmpty()) {
return null;
}
@@ -562,7 +562,7 @@ public class AiController {
final CardCollectionView cards = handOnly ? player.getCardsIn(ZoneType.Hand) :
ComputerUtilAbility.getAvailableCards(game, player);
- ArrayList all = ComputerUtilAbility.getSpellAbilities(cards, player);
+ List all = ComputerUtilAbility.getSpellAbilities(cards, player);
Collections.sort(all, saComparator); // put best spells first
for (final SpellAbility sa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, player)) {
@@ -1169,7 +1169,7 @@ public class AiController {
return result;
}
- private SpellAbility chooseSpellAbilityToPlay(final ArrayList all, boolean skipCounter) {
+ private SpellAbility chooseSpellAbilityToPlay(final List all, boolean skipCounter) {
if (all == null || all.isEmpty())
return null;
diff --git a/forge-ai/src/main/java/forge/ai/AiProfileUtil.java b/forge-ai/src/main/java/forge/ai/AiProfileUtil.java
index 1e71052ed9d..6c575d39dc6 100644
--- a/forge-ai/src/main/java/forge/ai/AiProfileUtil.java
+++ b/forge-ai/src/main/java/forge/ai/AiProfileUtil.java
@@ -62,7 +62,7 @@ public class AiProfileUtil {
AI_PROFILE_DIR = aiProfileDir;
loadedProfiles.clear();
- ArrayList availableProfiles = getAvailableProfiles();
+ List availableProfiles = getAvailableProfiles();
for (String profile : availableProfiles) {
loadedProfiles.put(profile, loadProfile(profile));
}
@@ -119,9 +119,9 @@ public class AiProfileUtil {
* @return ArrayList - an array of strings containing all
* available profiles.
*/
- public static ArrayList getAvailableProfiles()
+ public static List getAvailableProfiles()
{
- final ArrayList availableProfiles = new ArrayList();
+ final List availableProfiles = new ArrayList();
final File dir = new File(AI_PROFILE_DIR);
final String[] children = dir.list();
@@ -144,8 +144,8 @@ public class AiProfileUtil {
* @return ArrayList - an array list of strings containing all
* available profiles including special random profile tags.
*/
- public static ArrayList getProfilesDisplayList() {
- final ArrayList availableProfiles = new ArrayList();
+ public static List getProfilesDisplayList() {
+ final List availableProfiles = new ArrayList();
availableProfiles.add(AI_PROFILE_RANDOM_MATCH);
availableProfiles.add(AI_PROFILE_RANDOM_DUEL);
availableProfiles.addAll(getAvailableProfiles());
diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtil.java b/forge-ai/src/main/java/forge/ai/ComputerUtil.java
index 12c671b1357..046d9e0d1c5 100644
--- a/forge-ai/src/main/java/forge/ai/ComputerUtil.java
+++ b/forge-ai/src/main/java/forge/ai/ComputerUtil.java
@@ -27,9 +27,9 @@ import java.util.Random;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Predicate;
-import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Multimap;
import forge.ai.ability.ProtectAi;
import forge.card.CardType;
@@ -1156,7 +1156,7 @@ public class ComputerUtil {
}
} else {
objects = topStack.getTargets().getTargets();
- final ArrayList canBeTargeted = new ArrayList();
+ final List canBeTargeted = new ArrayList();
for (Object o : objects) {
if (o instanceof Card) {
final Card c = (Card) o;
@@ -1612,7 +1612,7 @@ public class ComputerUtil {
if (logic != null) {
if (logic.equals("MostNeededType")) {
// Choose a type that is in the deck, but not in hand or on the battlefield
- final ArrayList basics = new ArrayList();
+ final List basics = new ArrayList();
basics.addAll(CardType.Constant.BASIC_TYPES);
CardCollectionView presentCards = CardCollection.combine(ai.getCardsIn(ZoneType.Battlefield), ai.getCardsIn(ZoneType.Hand));
CardCollectionView possibleCards = ai.getAllCards();
@@ -1666,7 +1666,7 @@ public class ComputerUtil {
return chosen;
}
- public static Object vote(Player ai, List
*
- * @return a {@link java.util.ArrayList} object.
+ * @return a {@link java.util.List} object.
*/
- public static ArrayList getAIPlayableMana(Card c) {
- final ArrayList res = new ArrayList<>();
+ public static List getAIPlayableMana(Card c) {
+ final List res = new ArrayList<>();
for (final SpellAbility a : c.getManaAbilities()) {
// if a mana ability has a mana cost the AI will miscalculate
// if there is a parent ability the AI can't use it
diff --git a/forge-ai/src/main/java/forge/ai/GameState.java b/forge-ai/src/main/java/forge/ai/GameState.java
index 959155391f7..3c8d1192f12 100644
--- a/forge-ai/src/main/java/forge/ai/GameState.java
+++ b/forge-ai/src/main/java/forge/ai/GameState.java
@@ -6,6 +6,7 @@ import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -214,7 +215,7 @@ public abstract class GameState {
if (life > 0) p.setLife(life, null);
for (Entry kv : playerCards.entrySet()) {
if (kv.getKey() == ZoneType.Battlefield) {
- ArrayList cards = new ArrayList();
+ List cards = new ArrayList();
for (final Card c : kv.getValue()) {
if (c.isToken()) {
cards.add(c);
diff --git a/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java b/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java
index 28911ad5166..06666787442 100644
--- a/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java
+++ b/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java
@@ -3,8 +3,8 @@ package forge.ai;
import com.esotericsoftware.minlog.Log;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
-import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Iterables;
+import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimap;
import forge.LobbyPlayer;
@@ -356,7 +356,7 @@ public class PlayerControllerAi extends PlayerController {
}
@Override
- public Object vote(SpellAbility sa, String prompt, List options, ArrayListMultimap votes) {
+ public Object vote(SpellAbility sa, String prompt, List options, ListMultimap votes) {
return ComputerUtil.vote(player, options, sa, votes);
}
@@ -599,7 +599,7 @@ public class PlayerControllerAi extends PlayerController {
}
@Override
- public ReplacementEffect chooseSingleReplacementEffect(String prompt, List possibleReplacers, HashMap runParams) {
+ public ReplacementEffect chooseSingleReplacementEffect(String prompt, List possibleReplacers, Map runParams) {
// AI logic for choosing which replacement effect to apply
// happens here.
return possibleReplacers.get(0);
diff --git a/forge-ai/src/main/java/forge/ai/ability/AnimateAi.java b/forge-ai/src/main/java/forge/ai/ability/AnimateAi.java
index b7ba811febf..c5fb2a492ca 100644
--- a/forge-ai/src/main/java/forge/ai/ability/AnimateAi.java
+++ b/forge-ai/src/main/java/forge/ai/ability/AnimateAi.java
@@ -290,17 +290,17 @@ public class AnimateAi extends SpellAbilityAi {
types.add(source.getChosenType());
}
- final ArrayList keywords = new ArrayList();
+ final List keywords = new ArrayList();
if (sa.hasParam("Keywords")) {
keywords.addAll(Arrays.asList(sa.getParam("Keywords").split(" & ")));
}
- final ArrayList removeKeywords = new ArrayList();
+ final List removeKeywords = new ArrayList();
if (sa.hasParam("RemoveKeywords")) {
removeKeywords.addAll(Arrays.asList(sa.getParam("RemoveKeywords").split(" & ")));
}
- final ArrayList hiddenKeywords = new ArrayList();
+ final List hiddenKeywords = new ArrayList();
if (sa.hasParam("HiddenKeywords")) {
hiddenKeywords.addAll(Arrays.asList(sa.getParam("HiddenKeywords").split(" & ")));
}
@@ -327,31 +327,31 @@ public class AnimateAi extends SpellAbilityAi {
final String finalDesc = tmpDesc;
// abilities to add to the animated being
- final ArrayList abilities = new ArrayList();
+ final List abilities = new ArrayList();
if (sa.hasParam("Abilities")) {
abilities.addAll(Arrays.asList(sa.getParam("Abilities").split(",")));
}
// replacement effects to add to the animated being
- final ArrayList replacements = new ArrayList();
+ final List replacements = new ArrayList();
if (sa.hasParam("Replacements")) {
replacements.addAll(Arrays.asList(sa.getParam("Replacements").split(",")));
}
// triggers to add to the animated being
- final ArrayList triggers = new ArrayList();
+ final List triggers = new ArrayList();
if (sa.hasParam("Triggers")) {
triggers.addAll(Arrays.asList(sa.getParam("Triggers").split(",")));
}
// static abilities to add to the animated being
- final ArrayList stAbs = new ArrayList();
+ final List stAbs = new ArrayList();
if (sa.hasParam("staticAbilities")) {
stAbs.addAll(Arrays.asList(sa.getParam("staticAbilities").split(",")));
}
// sVars to add to the animated being
- final ArrayList sVars = new ArrayList();
+ final List sVars = new ArrayList();
if (sa.hasParam("sVars")) {
sVars.addAll(Arrays.asList(sa.getParam("sVars").split(",")));
}
@@ -413,7 +413,7 @@ public class AnimateAi extends SpellAbilityAi {
//back to duplicating AnimateEffect.resolve
//TODO will all these abilities/triggers/replacements/etc. lead to memory leaks or unintended effects?
// remove abilities
- final ArrayList removedAbilities = new ArrayList();
+ final List removedAbilities = new ArrayList();
boolean clearAbilities = sa.hasParam("OverwriteAbilities");
boolean clearSpells = sa.hasParam("OverwriteSpells");
boolean removeAll = sa.hasParam("RemoveAllAbilities");
@@ -429,7 +429,7 @@ public class AnimateAi extends SpellAbilityAi {
}
// give abilities
- final ArrayList addedAbilities = new ArrayList();
+ final List addedAbilities = new ArrayList();
if (abilities.size() > 0) {
for (final String s : abilities) {
final String actualAbility = source.getSVar(s);
@@ -440,7 +440,7 @@ public class AnimateAi extends SpellAbilityAi {
}
// Grant triggers
- final ArrayList addedTriggers = new ArrayList();
+ final List addedTriggers = new ArrayList();
if (triggers.size() > 0) {
for (final String s : triggers) {
final String actualTrigger = source.getSVar(s);
@@ -450,7 +450,7 @@ public class AnimateAi extends SpellAbilityAi {
}
// give replacement effects
- final ArrayList addedReplacements = new ArrayList();
+ final List addedReplacements = new ArrayList();
if (replacements.size() > 0) {
for (final String s : replacements) {
final String actualReplacement = source.getSVar(s);
@@ -460,7 +460,7 @@ public class AnimateAi extends SpellAbilityAi {
}
// suppress triggers from the animated card
- final ArrayList removedTriggers = new ArrayList();
+ final List removedTriggers = new ArrayList();
if (sa.hasParam("OverwriteTriggers") || removeAll) {
final FCollectionView triggersToRemove = card.getTriggers();
for (final Trigger trigger : triggersToRemove) {
@@ -498,7 +498,7 @@ public class AnimateAi extends SpellAbilityAi {
}
// suppress static abilities from the animated card
- final ArrayList removedStatics = new ArrayList();
+ final List removedStatics = new ArrayList();
if (sa.hasParam("OverwriteStatics") || removeAll) {
final FCollectionView staticsToRemove = card.getStaticAbilities();
for (final StaticAbility stAb : staticsToRemove) {
@@ -508,7 +508,7 @@ public class AnimateAi extends SpellAbilityAi {
}
// suppress static abilities from the animated card
- final ArrayList removedReplacements = new ArrayList();
+ final List removedReplacements = new ArrayList();
if (sa.hasParam("OverwriteReplacements") || removeAll) {
for (final ReplacementEffect re : card.getReplacementEffects()) {
re.setTemporarilySuppressed(true);
diff --git a/forge-ai/src/main/java/forge/ai/ability/AttachAi.java b/forge-ai/src/main/java/forge/ai/ability/AttachAi.java
index 78c22255023..255e2b67d7c 100644
--- a/forge-ai/src/main/java/forge/ai/ability/AttachAi.java
+++ b/forge-ai/src/main/java/forge/ai/ability/AttachAi.java
@@ -564,7 +564,7 @@ public class AttachAi extends SpellAbilityAi {
int totToughness = 0;
int totPower = 0;
- final ArrayList keywords = new ArrayList();
+ final List keywords = new ArrayList();
for (final StaticAbility stAbility : attachSource.getStaticAbilities()) {
final Map stabMap = stAbility.getMapParams();
@@ -860,7 +860,7 @@ public class AttachAi extends SpellAbilityAi {
int totToughness = 0;
int totPower = 0;
- final ArrayList keywords = new ArrayList();
+ final List keywords = new ArrayList();
boolean grantingAbilities = false;
for (final StaticAbility stAbility : attachSource.getStaticAbilities()) {
@@ -1169,7 +1169,7 @@ public class AttachAi extends SpellAbilityAi {
* @param sa SpellAbility
* @return true, if successful
*/
- private static boolean containsUsefulCurseKeyword(final ArrayList keywords, final Card card, final SpellAbility sa) {
+ private static boolean containsUsefulCurseKeyword(final List keywords, final Card card, final SpellAbility sa) {
for (final String keyword : keywords) {
if (isUsefulCurseKeyword(keyword, card, sa)) {
return true;
diff --git a/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java b/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java
index b53179b6170..24af7a35e74 100644
--- a/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java
+++ b/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java
@@ -465,7 +465,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
*/
private static Card basicManaFixing(final Player ai, final List list) { // Search for a Basic Land
final CardCollectionView combined = CardCollection.combine(ai.getCardsIn(ZoneType.Battlefield), ai.getCardsIn(ZoneType.Hand));
- final ArrayList basics = new ArrayList();
+ final List basics = new ArrayList();
// what types can I go get?
for (final String name : MagicColor.Constant.BASIC_LANDS) {
diff --git a/forge-ai/src/main/java/forge/ai/ability/ProtectAi.java b/forge-ai/src/main/java/forge/ai/ability/ProtectAi.java
index 9a9208ceb70..3fbd9027c95 100644
--- a/forge-ai/src/main/java/forge/ai/ability/ProtectAi.java
+++ b/forge-ai/src/main/java/forge/ai/ability/ProtectAi.java
@@ -1,8 +1,17 @@
package forge.ai.ability;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
import com.google.common.base.Predicate;
-import forge.ai.*;
+import forge.ai.AiAttackController;
+import forge.ai.ComputerUtil;
+import forge.ai.ComputerUtilCard;
+import forge.ai.ComputerUtilCombat;
+import forge.ai.ComputerUtilCost;
+import forge.ai.SpellAbilityAi;
import forge.card.MagicColor;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
@@ -21,13 +30,9 @@ import forge.game.spellability.TargetRestrictions;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
public class ProtectAi extends SpellAbilityAi {
private static boolean hasProtectionFrom(final Card card, final String color) {
- final ArrayList onlyColors = new ArrayList(MagicColor.Constant.ONLY_COLORS);
+ final List onlyColors = new ArrayList(MagicColor.Constant.ONLY_COLORS);
// make sure we have a valid color
if (!onlyColors.contains(color)) {
diff --git a/forge-ai/src/main/java/forge/ai/simulation/GameSimulator.java b/forge-ai/src/main/java/forge/ai/simulation/GameSimulator.java
index 7019f5e0368..fee16bd6c35 100644
--- a/forge-ai/src/main/java/forge/ai/simulation/GameSimulator.java
+++ b/forge-ai/src/main/java/forge/ai/simulation/GameSimulator.java
@@ -26,7 +26,7 @@ public class GameSimulator {
private Game simGame;
private Player aiPlayer;
private GameStateEvaluator eval;
- private ArrayList origLines;
+ private List origLines;
private Score origScore;
public GameSimulator(final SimulationController controller, final Game origGame, final Player origAiPlayer) {
@@ -44,7 +44,7 @@ public class GameSimulator {
origScore = eval.getScoreForGameState(origGame, origAiPlayer);
eval.setDebugging(true);
- ArrayList simLines = new ArrayList();
+ List simLines = new ArrayList();
debugLines = simLines;
Score simScore = eval.getScoreForGameState(simGame, aiPlayer);
if (!simScore.equals(origScore)) {
@@ -102,7 +102,7 @@ public class GameSimulator {
}
public static boolean debugPrint;
- public static ArrayList debugLines;
+ public static List debugLines;
public static void debugPrint(String str) {
if (debugPrint) {
System.out.println(str);
@@ -172,7 +172,7 @@ public class GameSimulator {
// TODO: If this is during combat, before blockers are declared,
// we should simulate how combat will resolve and evaluate that
// state instead!
- ArrayList simLines = null;
+ List simLines = null;
if (debugPrint) {
debugPrint("SimGame:");
simLines = new ArrayList();
@@ -190,7 +190,7 @@ public class GameSimulator {
controller.push(sa);
SpellAbilityPicker sim = new SpellAbilityPicker(simGame, aiPlayer);
CardCollection cards = ComputerUtilAbility.getAvailableCards(simGame, aiPlayer);
- ArrayList all = ComputerUtilAbility.getSpellAbilities(cards, aiPlayer);
+ List all = ComputerUtilAbility.getSpellAbilities(cards, aiPlayer);
SpellAbility nextSa = sim.chooseSpellAbilityToPlay(controller, all, true);
if (nextSa != null) {
score = sim.getScoreForChosenAbility();
diff --git a/forge-ai/src/main/java/forge/ai/simulation/SpellAbilityPicker.java b/forge-ai/src/main/java/forge/ai/simulation/SpellAbilityPicker.java
index ddc0f169f79..812fcc237aa 100644
--- a/forge-ai/src/main/java/forge/ai/simulation/SpellAbilityPicker.java
+++ b/forge-ai/src/main/java/forge/ai/simulation/SpellAbilityPicker.java
@@ -32,7 +32,7 @@ public class SpellAbilityPicker {
}
}
- public SpellAbility chooseSpellAbilityToPlay(SimulationController controller, final ArrayList all, boolean skipCounter) {
+ public SpellAbility chooseSpellAbilityToPlay(SimulationController controller, final List all, boolean skipCounter) {
printOutput = false;
if (controller == null) {
controller = new SimulationController();
@@ -40,7 +40,7 @@ public class SpellAbilityPicker {
}
print("---- choose ability (phase = " + game.getPhaseHandler().getPhase() + ")");
- ArrayList candidateSAs = new ArrayList<>();
+ List candidateSAs = new ArrayList<>();
for (final SpellAbility sa : ComputerUtilAbility.getOriginalAndAltCostAbilities(all, player)) {
// Don't add Counterspells to the "normal" playcard lookups
if (skipCounter && sa.getApi() == ApiType.Counter) {
diff --git a/forge-core/src/main/java/forge/card/BoosterGenerator.java b/forge-core/src/main/java/forge/card/BoosterGenerator.java
index 762530fb22e..773cd65c4db 100644
--- a/forge-core/src/main/java/forge/card/BoosterGenerator.java
+++ b/forge-core/src/main/java/forge/card/BoosterGenerator.java
@@ -223,7 +223,7 @@ public class BoosterGenerator {
} else if (operator.startsWith("fromSheet(") && invert) {
String sheetName = StringUtils.strip(operator.substring(9), "()\" ");
Iterable src = StaticData.instance().getPrintSheets().get(sheetName).toFlatList();
- ArrayList cardNames = Lists.newArrayList();
+ List cardNames = Lists.newArrayList();
for (PaperCard card : src) {
cardNames.add(card.getName());
}
diff --git a/forge-core/src/main/java/forge/deck/DeckFormat.java b/forge-core/src/main/java/forge/deck/DeckFormat.java
index 63182d1da40..d93afae6c7a 100644
--- a/forge-core/src/main/java/forge/deck/DeckFormat.java
+++ b/forge-core/src/main/java/forge/deck/DeckFormat.java
@@ -22,6 +22,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
+import java.util.Set;
import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -50,7 +51,7 @@ public enum DeckFormat {
Limited ( Range.between(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
Commander ( Range.is(99), Range.between(0, 10), 1),
TinyLeaders ( Range.is(49), Range.between(0, 10), 1, new Predicate() {
- private final HashSet bannedCards = new HashSet(Arrays.asList(
+ private final Set bannedCards = new HashSet(Arrays.asList(
"Ancestral Recall", "Balance", "Black Lotus", "Black Vise", "Channel", "Chaos Orb", "Contract From Below", "Counterbalance", "Darkpact", "Demonic Attorney", "Demonic Tutor", "Earthcraft", "Edric, Spymaster of Trest", "Falling Star",
"Fastbond", "Flash", "Goblin Recruiter", "Hermit Druid", "Imperial Seal", "Jeweled Bird", "Karakas", "Library of Alexandria", "Mana Crypt", "Mana Drain", "Mana Vault", "Metalworker", "Mind Twist", "Mishra's Workshop", "Mox Emerald",
"Mox Jet", "Mox Pearl", "Mox Ruby", "Mox Sapphire", "Necropotence", "Painter's Servant", "Shahrazad", "Skullclamp", "Sol Ring", "Strip Mine", "Survival of the Fittest", "Sword of Body and Mind", "Time Vault", "Time Walk", "Timetwister",
diff --git a/forge-core/src/main/java/forge/deck/generation/DeckGenPool.java b/forge-core/src/main/java/forge/deck/generation/DeckGenPool.java
index 1540c1003ad..b5a6de19322 100644
--- a/forge-core/src/main/java/forge/deck/generation/DeckGenPool.java
+++ b/forge-core/src/main/java/forge/deck/generation/DeckGenPool.java
@@ -1,6 +1,7 @@
package forge.deck.generation;
import java.util.HashMap;
+import java.util.Map;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
@@ -8,7 +9,7 @@ import com.google.common.collect.Iterables;
import forge.item.PaperCard;
public class DeckGenPool implements IDeckGenPool {
- private final HashMap cards = new HashMap();
+ private final Map cards = new HashMap();
public DeckGenPool() {
}
diff --git a/forge-core/src/main/java/forge/util/CollectionSuppliers.java b/forge-core/src/main/java/forge/util/CollectionSuppliers.java
index 1c94ab0d6d7..c68cce77ee5 100644
--- a/forge-core/src/main/java/forge/util/CollectionSuppliers.java
+++ b/forge-core/src/main/java/forge/util/CollectionSuppliers.java
@@ -1,41 +1,41 @@
package forge.util;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+
import com.google.common.base.Supplier;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.TreeSet;
+public final class CollectionSuppliers {
-/**
- * TODO: Write javadoc for this type.
- *
- */
-public abstract class CollectionSuppliers {
+ /**
+ * Private constructor to prevent instantiation.
+ */
+ private CollectionSuppliers() {
+ }
-
- public static Supplier> arrayLists() {
- return new Supplier>() {
- @Override
- public ArrayList get() {
- return new ArrayList();
+ public static Supplier> arrayLists() {
+ return new Supplier>() {
+ @Override public List get() {
+ return Lists.newArrayList();
}
};
}
- public static Supplier> hashSets() {
- return new Supplier>() {
- @Override
- public HashSet get() {
- return new HashSet();
+ public static Supplier> hashSets() {
+ return new Supplier>() {
+ @Override public Set get() {
+ return Sets.newHashSet();
}
};
}
-
- public static > Supplier> treeSets() {
- return new Supplier>() {
- @Override
- public TreeSet get() {
- return new TreeSet();
+
+ public static > Supplier> treeSets() {
+ return new Supplier>() {
+ @Override public SortedSet get() {
+ return Sets.newTreeSet();
}
};
}
diff --git a/forge-core/src/main/java/forge/util/FileUtil.java b/forge-core/src/main/java/forge/util/FileUtil.java
index c77afd6bf94..aaf45c8a736 100644
--- a/forge-core/src/main/java/forge/util/FileUtil.java
+++ b/forge-core/src/main/java/forge/util/FileUtil.java
@@ -234,7 +234,7 @@ public final class FileUtil {
* @return list of strings
*/
public static List readAllLines(final Reader reader, final boolean mayTrim) {
- final ArrayList list = new ArrayList();
+ final List list = new ArrayList();
try {
final BufferedReader in = new BufferedReader(reader);
String line;
diff --git a/forge-game/src/main/java/forge/game/GameAction.java b/forge-game/src/main/java/forge/game/GameAction.java
index 1c434dc8f51..f4df70dca54 100644
--- a/forge-game/src/main/java/forge/game/GameAction.java
+++ b/forge-game/src/main/java/forge/game/GameAction.java
@@ -1414,13 +1414,13 @@ public class GameAction {
// Power Play - Each player with a Power Play in the CommandZone becomes the Starting Player
Set powerPlayers = new HashSet<>();
for (Card c : game.getCardsIn(ZoneType.Command)) {
- if (c.getName().equals("Power Play")) {
- powerPlayers.add(c.getOwner());
- }
+ if (c.getName().equals("Power Play")) {
+ powerPlayers.add(c.getOwner());
+ }
}
if (!powerPlayers.isEmpty()) {
- ArrayList players = Lists.newArrayList(powerPlayers);
+ List players = Lists.newArrayList(powerPlayers);
Collections.shuffle(players);
return players.get(0);
}
diff --git a/forge-game/src/main/java/forge/game/GameActionUtil.java b/forge-game/src/main/java/forge/game/GameActionUtil.java
index e3ce844748b..6621ceac50f 100644
--- a/forge-game/src/main/java/forge/game/GameActionUtil.java
+++ b/forge-game/src/main/java/forge/game/GameActionUtil.java
@@ -450,9 +450,9 @@ public final class GameActionUtil {
* @return an ArrayList.
* get abilities with all Splice options
*/
- private static final ArrayList getSpliceAbilities(SpellAbility sa) {
- ArrayList newSAs = new ArrayList();
- ArrayList allSaCombinations = new ArrayList();
+ private static final List getSpliceAbilities(SpellAbility sa) {
+ List newSAs = new ArrayList();
+ List allSaCombinations = new ArrayList();
allSaCombinations.add(sa);
Card source = sa.getHostCard();
diff --git a/forge-game/src/main/java/forge/game/GameEntity.java b/forge-game/src/main/java/forge/game/GameEntity.java
index 350c9f01a97..c192b03bcb0 100644
--- a/forge-game/src/main/java/forge/game/GameEntity.java
+++ b/forge-game/src/main/java/forge/game/GameEntity.java
@@ -32,7 +32,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
private String name = "";
private int preventNextDamage = 0;
private CardCollection enchantedBy;
- private TreeMap> preventionShieldsWithEffects = new TreeMap>();
+ private Map> preventionShieldsWithEffects = new TreeMap>();
protected GameEntity(int id0) {
id = id0;
@@ -97,7 +97,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
}
// PreventNextDamageWithEffect
- public TreeMap> getPreventNextDamageWithEffect() {
+ public Map> getPreventNextDamageWithEffect() {
return preventionShieldsWithEffects;
}
public int getPreventNextDamageTotalShields() {
@@ -112,7 +112,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
* @param shieldSource - The source card which generated the shield
* @param effectMap - A map of the effect occurring with the damage prevention
*/
- public void addPreventNextDamageWithEffect(final Card shieldSource, TreeMap effectMap) {
+ public void addPreventNextDamageWithEffect(final Card shieldSource, Map effectMap) {
if (preventionShieldsWithEffects.containsKey(shieldSource)) {
int currentShields = Integer.valueOf(preventionShieldsWithEffects.get(shieldSource).get("ShieldAmount"));
currentShields += Integer.valueOf(effectMap.get("ShieldAmount"));
diff --git a/forge-game/src/main/java/forge/game/GameLogFormatter.java b/forge-game/src/main/java/forge/game/GameLogFormatter.java
index 9047e6b5d7d..ad41f28e0e7 100644
--- a/forge-game/src/main/java/forge/game/GameLogFormatter.java
+++ b/forge-game/src/main/java/forge/game/GameLogFormatter.java
@@ -1,22 +1,36 @@
package forge.game;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map.Entry;
+
import com.google.common.eventbus.Subscribe;
import forge.LobbyPlayer;
import forge.game.card.Card;
-import forge.game.event.*;
+import forge.game.event.GameEvent;
+import forge.game.event.GameEventAttackersDeclared;
+import forge.game.event.GameEventBlockersDeclared;
+import forge.game.event.GameEventCardDamaged;
import forge.game.event.GameEventCardDamaged.DamageType;
+import forge.game.event.GameEventGameOutcome;
+import forge.game.event.GameEventLandPlayed;
+import forge.game.event.GameEventMulligan;
+import forge.game.event.GameEventPlayerControl;
+import forge.game.event.GameEventPlayerDamaged;
+import forge.game.event.GameEventPlayerPoisoned;
+import forge.game.event.GameEventScry;
+import forge.game.event.GameEventSpellAbilityCast;
+import forge.game.event.GameEventSpellResolved;
+import forge.game.event.GameEventTurnBegan;
+import forge.game.event.GameEventTurnPhase;
+import forge.game.event.IGameEventVisitor;
import forge.game.player.Player;
import forge.game.spellability.TargetChoices;
import forge.game.zone.ZoneType;
import forge.util.Lang;
import forge.util.maps.MapOfLists;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map.Entry;
-
public class GameLogFormatter extends IGameEventVisitor.Base {
private final GameLog log;
@@ -68,7 +82,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base {
if (event.sa.getTargetRestrictions() != null) {
sb.append(" targeting ");
- ArrayList targets = event.sa.getAllTargetChoices();
+ List targets = event.sa.getAllTargetChoices();
// Include the TargetChoices from the stack instance, since the real target choices
// are on that object at this point (see SpellAbilityStackInstance constructor).
targets.add(event.si.getTargetChoices());
diff --git a/forge-game/src/main/java/forge/game/GameObjectMap.java b/forge-game/src/main/java/forge/game/GameObjectMap.java
index dd15a869d29..cdf18d9f732 100644
--- a/forge-game/src/main/java/forge/game/GameObjectMap.java
+++ b/forge-game/src/main/java/forge/game/GameObjectMap.java
@@ -14,37 +14,37 @@ public abstract class GameObjectMap {
public abstract GameObject map(GameObject o);
- public Player map(Player p) {
+ public Player map(final Player p) {
return (Player) map((GameObject) p);
}
-
- public Card map(Card c) {
+
+ public Card map(final Card c) {
return (Card) map((GameObject) c);
}
- public GameEntity map(GameEntity e) {
+ public GameEntity map(final GameEntity e) {
return (GameEntity) map((GameObject) e);
}
- public CardCollectionView mapCollection(CardCollectionView cards) {
- CardCollection collection = new CardCollection();
- for (Card c : cards) {
+ public CardCollectionView mapCollection(final CardCollectionView cards) {
+ final CardCollection collection = new CardCollection();
+ for (final Card c : cards) {
collection.add(map(c));
}
return collection;
}
@SuppressWarnings("unchecked")
- public List mapList(List objects) {
- ArrayList result = new ArrayList();
- for (T o : objects) {
+ public List mapList(final List objects) {
+ final List result = new ArrayList();
+ for (final T o : objects) {
result.add((T) map(o));
}
return result;
}
- public void fillKeyedMap(Map dest, Map src) {
- for (Map.Entry entry : src.entrySet()) {
+ public void fillKeyedMap(final Map dest, final Map src) {
+ for (final Map.Entry entry : src.entrySet()) {
dest.put(entry.getKey(), entry.getValue());
}
}
diff --git a/forge-game/src/main/java/forge/game/StaticEffect.java b/forge-game/src/main/java/forge/game/StaticEffect.java
index 7a178f33f9a..45bee41134c 100644
--- a/forge-game/src/main/java/forge/game/StaticEffect.java
+++ b/forge-game/src/main/java/forge/game/StaticEffect.java
@@ -181,7 +181,7 @@ public class StaticEffect {
* @param c
* a {@link forge.game.card.Card} object.
* @param s
- * a {@link java.util.ArrayList} object.
+ * a {@link java.util.List} object.
*/
public final void addOriginalAbilities(final Card c, final List s) {
final List list = new ArrayList(s);
@@ -200,10 +200,10 @@ public class StaticEffect {
*
* @param c
* a {@link forge.game.card.Card} object.
- * @return a {@link java.util.ArrayList} object.
+ * @return a {@link java.util.List} object.
*/
- public final ArrayList getOriginalAbilities(final Card c) {
- final ArrayList returnList = new ArrayList();
+ public final List getOriginalAbilities(final Card c) {
+ final List returnList = new ArrayList();
if (this.originalAbilities.containsKey(c)) {
returnList.addAll(this.originalAbilities.get(c));
}
@@ -566,7 +566,7 @@ public class StaticEffect {
*/
public final void addType(final Card c, final String s) {
if (!this.types.containsKey(c)) {
- final ArrayList list = new ArrayList();
+ final List list = new ArrayList();
list.add(s);
this.types.put(c, list);
} else {
@@ -581,10 +581,10 @@ public class StaticEffect {
*
* @param c
* a {@link forge.game.card.Card} object.
- * @return a {@link java.util.ArrayList} object.
+ * @return a {@link java.util.List} object.
*/
- public final ArrayList getTypes(final Card c) {
- final ArrayList returnList = new ArrayList();
+ public final List getTypes(final Card c) {
+ final List returnList = new ArrayList();
if (this.types.containsKey(c)) {
returnList.addAll(this.types.get(c));
}
@@ -749,7 +749,7 @@ public class StaticEffect {
* @param list
* the new affected players
*/
- public final void setAffectedPlayers(final ArrayList list) {
+ public final void setAffectedPlayers(final List list) {
this.affectedPlayers = list;
}
diff --git a/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java b/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java
index c45e2d86926..1fb307fc76a 100644
--- a/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java
+++ b/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java
@@ -69,17 +69,17 @@ public class AnimateAllEffect extends AnimateEffectBase {
types.add(host.getChosenType());
}
- final ArrayList keywords = new ArrayList();
+ final List keywords = new ArrayList();
if (sa.hasParam("Keywords")) {
keywords.addAll(Arrays.asList(sa.getParam("Keywords").split(" & ")));
}
- final ArrayList removeKeywords = new ArrayList();
+ final List removeKeywords = new ArrayList();
if (sa.hasParam("RemoveKeywords")) {
removeKeywords.addAll(Arrays.asList(sa.getParam("RemoveKeywords").split(" & ")));
}
- final ArrayList hiddenKeywords = new ArrayList();
+ final List hiddenKeywords = new ArrayList();
if (sa.hasParam("HiddenKeywords")) {
hiddenKeywords.addAll(Arrays.asList(sa.getParam("HiddenKeywords").split(" & ")));
}
@@ -105,23 +105,23 @@ public class AnimateAllEffect extends AnimateEffectBase {
final String finalDesc = tmpDesc;
// abilities to add to the animated being
- final ArrayList abilities = new ArrayList();
+ final List abilities = new ArrayList();
if (sa.hasParam("Abilities")) {
abilities.addAll(Arrays.asList(sa.getParam("Abilities").split(",")));
}
// replacement effects to add to the animated being
- final ArrayList replacements = new ArrayList();
+ final List replacements = new ArrayList();
if (sa.hasParam("Replacements")) {
replacements.addAll(Arrays.asList(sa.getParam("Replacements").split(",")));
}
// triggers to add to the animated being
- final ArrayList triggers = new ArrayList();
+ final List triggers = new ArrayList();
if (sa.hasParam("Triggers")) {
triggers.addAll(Arrays.asList(sa.getParam("Triggers").split(",")));
}
// sVars to add to the animated being
- final ArrayList sVars = new ArrayList();
+ final List sVars = new ArrayList();
if (sa.hasParam("sVars")) {
sVars.addAll(Arrays.asList(sa.getParam("sVars").split(",")));
}
@@ -149,7 +149,7 @@ public class AnimateAllEffect extends AnimateEffectBase {
keywords, removeKeywords, hiddenKeywords, timestamp);
// give abilities
- final ArrayList addedAbilities = new ArrayList();
+ final List