mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
program towards Interface rather than implementations
This commit is contained in:
parent
b04c436801
commit
ae7919cd07
100 changed files with 218 additions and 209 deletions
|
@ -1241,7 +1241,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (button.isSelected()) {
|
||||
// Special case - "Multiples" (CONSPIRACY type)
|
||||
if (cardType == CardType.CONSPIRACY) {
|
||||
HashMap<String, CardView> cardNames = new HashMap<>();
|
||||
Map<String, CardView> cardNames = new HashMap<>();
|
||||
|
||||
for (List<List<CardView>> gridRow : cardGrid) {
|
||||
for (List<CardView> stack : gridRow) {
|
||||
|
@ -1334,11 +1334,11 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
private static final Pattern pattern = Pattern.compile(".*Add(.*)(\\{[WUBRGXC]\\})");
|
||||
|
||||
public void analyseDeck() {
|
||||
HashMap<String, Integer> qtys = new HashMap<>();
|
||||
HashMap<String, Integer> pips = new HashMap<>();
|
||||
HashMap<String, Integer> pips_at_cmcs = new HashMap<>();
|
||||
HashMap<String, Integer> sourcePips = new HashMap<>();
|
||||
HashMap<String, Integer> manaCounts = new HashMap<>();
|
||||
Map<String, Integer> qtys = new HashMap<>();
|
||||
Map<String, Integer> pips = new HashMap<>();
|
||||
Map<String, Integer> pips_at_cmcs = new HashMap<>();
|
||||
Map<String, Integer> sourcePips = new HashMap<>();
|
||||
Map<String, Integer> manaCounts = new HashMap<>();
|
||||
pips.put("#w}", 0);
|
||||
pips.put("#u}", 0);
|
||||
pips.put("#b}", 0);
|
||||
|
@ -1651,7 +1651,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
int thisMaxStackSize = 0;
|
||||
cardGrid.add(gridRow);
|
||||
for (List<DeckCardInfo> stack : row) {
|
||||
ArrayList<CardView> gridStack = new ArrayList<>();
|
||||
List<CardView> gridStack = new ArrayList<>();
|
||||
gridRow.add(gridStack);
|
||||
for (DeckCardInfo info : stack) {
|
||||
if (trackedCards.containsKey(info.getSetCode()) && trackedCards.get(info.getSetCode()).containsKey(info.getCardNum())) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ManaBarChart extends JComponent {
|
|||
|
||||
void drawBar(Graphics2D g, Rectangle area) {
|
||||
Pattern regex = Pattern.compile("^([0-9]+)##(.)}");
|
||||
HashMap<Integer, Integer> totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
int max_num_pips = 0;
|
||||
int max_cmc = 0;
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class ManaBarChart extends JComponent {
|
|||
|
||||
}
|
||||
|
||||
HashMap<Integer, Integer> running_totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> running_totals_at_cmcs = new HashMap<Integer, Integer>();
|
||||
for (String key : pips_at_cmcs.keySet()) {
|
||||
Matcher regexMatcher = regex.matcher(key);
|
||||
int num_pips = pips_at_cmcs.get(key);
|
||||
|
|
|
@ -38,6 +38,7 @@ import javax.swing.table.DefaultTableCellRenderer;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import static mage.client.dialog.PreferencesDialog.*;
|
||||
|
@ -228,7 +229,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
filter.add(new CardTextPredicate(name, chkNames.isSelected(), chkTypes.isSelected(), chkRules.isSelected(), chkUnique.isSelected()));
|
||||
|
||||
if (limited) {
|
||||
ArrayList<Predicate<MageObject>> predicates = new ArrayList<>();
|
||||
List<Predicate<MageObject>> predicates = new ArrayList<>();
|
||||
|
||||
if (this.tbGreen.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
|
@ -277,7 +278,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
if (this.cbExpansionSet.isVisible()) {
|
||||
String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
|
||||
if (!expansionSelection.equals("- All Sets")) {
|
||||
ArrayList<Predicate<Card>> expansionPredicates = new ArrayList<>();
|
||||
List<Predicate<Card>> expansionPredicates = new ArrayList<>();
|
||||
for (String setCode : ConstructedFormats.getSetsByFormat(expansionSelection)) {
|
||||
expansionPredicates.add(new ExpansionSetPredicate(setCode));
|
||||
}
|
||||
|
|
|
@ -541,8 +541,8 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private List<Token> getTokens(int page, String set) {
|
||||
ArrayList<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
ArrayList<Token> tokens = new ArrayList<>();
|
||||
List<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
List<Token> tokens = new ArrayList<>();
|
||||
|
||||
for (CardDownloadData token : allTokens) {
|
||||
if (token.getSet().equals(set)) {
|
||||
|
@ -715,7 +715,7 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private int getTotalNumTokens(String set) {
|
||||
ArrayList<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
List<CardDownloadData> allTokens = getTokenCardUrls();
|
||||
int numTokens = 0;
|
||||
|
||||
for (CardDownloadData token : allTokens) {
|
||||
|
@ -732,7 +732,7 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private int getTotalNumEmblems(String set) {
|
||||
ArrayList<CardDownloadData> allEmblems = getTokenCardUrls();
|
||||
List<CardDownloadData> allEmblems = getTokenCardUrls();
|
||||
int numEmblems = 0;
|
||||
|
||||
for (CardDownloadData emblem : allEmblems) {
|
||||
|
@ -749,7 +749,7 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private int getTotalNumPlanes(String set) {
|
||||
ArrayList<CardDownloadData> allPlanes = getTokenCardUrls();
|
||||
List<CardDownloadData> allPlanes = getTokenCardUrls();
|
||||
int numPlanes = 0;
|
||||
|
||||
for (CardDownloadData plane : allPlanes) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package mage.client.dialog;
|
|||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.*;
|
||||
import mage.cards.decks.Deck;
|
||||
|
@ -951,7 +952,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
private void loadRandomPacks(int version) {
|
||||
String versionStr = prepareVersionStr(version, false);
|
||||
ArrayList<String> packList;
|
||||
List<String> packList;
|
||||
String packNames;
|
||||
String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT + versionStr, "");
|
||||
if (!randomPrefs.isEmpty()) {
|
||||
|
@ -1219,7 +1220,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.isRandom = tournamentType.isRandom();
|
||||
this.isRichMan = tournamentType.isRichMan();
|
||||
tOptions.getLimitedOptions().getSetCodes().clear();
|
||||
ArrayList<String> selected = randomPackSelector.getSelectedPacks();
|
||||
List<String> selected = randomPackSelector.getSelectedPacks();
|
||||
Collections.shuffle(selected);
|
||||
int maxPacks = 3 * (players.size() + 1);
|
||||
if (tournamentType.isRichMan()) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import javax.swing.event.DocumentListener;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
@ -19,7 +20,7 @@ import java.util.*;
|
|||
public class PickCheckBoxDialog extends MageDialog {
|
||||
|
||||
Choice choice;
|
||||
ArrayList<KeyValueItem> allItems = new ArrayList<>();
|
||||
List<KeyValueItem> allItems = new ArrayList<>();
|
||||
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel();
|
||||
CheckBoxList.CheckBoxListModel m_dataModel;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import javax.swing.event.DocumentListener;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
@ -18,8 +19,8 @@ import java.util.*;
|
|||
public class PickChoiceDialog extends MageDialog {
|
||||
|
||||
Choice choice;
|
||||
ArrayList<KeyValueItem> allItems = new ArrayList<>();
|
||||
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel();
|
||||
List<KeyValueItem> allItems = new ArrayList<>();
|
||||
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel<>();
|
||||
|
||||
final private static String HTML_TEMPLATE = "<html><div style='text-align: center;'>%s</div></html>";
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ package mage.client.dialog;
|
|||
|
||||
import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JOptionPane;
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
|
@ -58,7 +59,7 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
|||
this.setModal(true);
|
||||
}
|
||||
|
||||
public void setSelectedPacks(ArrayList<String> packs) {
|
||||
public void setSelectedPacks(List<String> packs) {
|
||||
if (!boxesCreated) {
|
||||
createCheckboxes();
|
||||
}
|
||||
|
@ -72,8 +73,8 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList<String> getSelectedPacks() {
|
||||
ArrayList<String> returnVal = new ArrayList<>();
|
||||
public List<String> getSelectedPacks() {
|
||||
List<String> returnVal = new ArrayList<>();
|
||||
for (Component pack : pnlPacks.getComponents()) {
|
||||
JCheckBox thePack = (JCheckBox) pack;
|
||||
if (thePack.isSelected()) {
|
||||
|
|
|
@ -202,7 +202,7 @@ public class TestCardRenderDialog extends MageDialog {
|
|||
Player playerOpponent = new StubPlayer("player2", RangeOfInfluence.ALL);
|
||||
game.addPlayer(playerOpponent, deck);
|
||||
|
||||
ArrayList<CardView> cardViews = new ArrayList<>();
|
||||
java.util.List<CardView> cardViews = new ArrayList<>();
|
||||
///*
|
||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "263", 0, 0, 0, false)); // mountain
|
||||
cardViews.add(createPermanentCard(game, playerYou.getId(), "RNA", "185", 0, 0, 0, true)); // Judith, the Scourge Diva
|
||||
|
|
|
@ -308,7 +308,7 @@ public class HelperPanel extends JPanel {
|
|||
this.buttonGrid.setLayout(new FlowLayout(FlowLayout.CENTER, BUTTONS_H_GAP, 0));
|
||||
this.buttonGrid.setPreferredSize(null);
|
||||
|
||||
ArrayList<JButton> buttons = new ArrayList<>();
|
||||
java.util.List<JButton> buttons = new ArrayList<>();
|
||||
if (this.btnSpecial.isVisible()) {
|
||||
buttons.add(this.btnSpecial);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mage.client.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
@ -41,7 +42,7 @@ public enum CardLanguage {
|
|||
}
|
||||
|
||||
public static String[] toList() {
|
||||
ArrayList<String> res = new ArrayList<>();
|
||||
List<String> res = new ArrayList<>();
|
||||
for (CardLanguage l : values()) {
|
||||
res.add(l.toString());
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public final class GuiDisplayUtil {
|
|||
|
||||
// counters
|
||||
if (card.getMageObjectType().canHaveCounters()) {
|
||||
ArrayList<CounterView> counters = new ArrayList<>();
|
||||
java.util.List<CounterView> counters = new ArrayList<>();
|
||||
if (card instanceof PermanentView) {
|
||||
if (card.getCounters() != null) {
|
||||
counters = new ArrayList<>(card.getCounters());
|
||||
|
|
|
@ -132,7 +132,7 @@ public abstract class CardRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
protected void parseRules(List<String> stringRules, ArrayList<TextboxRule> keywords, ArrayList<TextboxRule> rules) {
|
||||
protected void parseRules(List<String> stringRules, List<TextboxRule> keywords, List<TextboxRule> rules) {
|
||||
// Translate the textbox text and remove card hints
|
||||
for (String rule : stringRules) {
|
||||
// remove all card hints
|
||||
|
|
|
@ -1170,7 +1170,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
return layout;
|
||||
}
|
||||
|
||||
protected void drawRulesText(Graphics2D g, ArrayList<TextboxRule> keywords, ArrayList<TextboxRule> rules, int x, int y, int w, int h, boolean forceRules) {
|
||||
protected void drawRulesText(Graphics2D g, List<TextboxRule> keywords, List<TextboxRule> rules, int x, int y, int w, int h, boolean forceRules) {
|
||||
// Gather all rules to render
|
||||
List<TextboxRule> allRules = new ArrayList<>(rules);
|
||||
|
||||
|
@ -1271,7 +1271,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
}
|
||||
|
||||
// Get the first line of the textbox, the keyword string
|
||||
private static String getKeywordRulesString(ArrayList<TextboxRule> keywords) {
|
||||
private static String getKeywordRulesString(List<TextboxRule> keywords) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < keywords.size(); ++i) {
|
||||
builder.append(keywords.get(i).text);
|
||||
|
|
|
@ -25,8 +25,8 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
String typeLineString;
|
||||
String manaCostString;
|
||||
ObjectColor color;
|
||||
ArrayList<TextboxRule> rules = new ArrayList<>();
|
||||
ArrayList<TextboxRule> keywords = new ArrayList<>();
|
||||
List<TextboxRule> rules = new ArrayList<>();
|
||||
List<TextboxRule> keywords = new ArrayList<>();
|
||||
}
|
||||
|
||||
private static ArrayList<CardType> ONLY_LAND_TYPE = new ArrayList<CardType>() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.mage.card.arcane;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by stravant@gmail.com on 2016-09-14.
|
||||
|
@ -8,7 +9,7 @@ import java.util.ArrayList;
|
|||
public class TextboxBasicManaRule extends TextboxRule {
|
||||
private final String basicManaSymbol;
|
||||
|
||||
public TextboxBasicManaRule(String rule, ArrayList<AttributeRegion> regions, String basicManaSymbol) {
|
||||
public TextboxBasicManaRule(String rule, List<AttributeRegion> regions, String basicManaSymbol) {
|
||||
super(rule, regions, TextboxRuleType.BASIC_MANA);
|
||||
|
||||
this.basicManaSymbol = basicManaSymbol;
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class TextboxRuleParser {
|
|||
// the textbox of a card.
|
||||
public static TextboxRule parse(CardView source, String rule) {
|
||||
// List of regions to apply
|
||||
ArrayList<TextboxRule.AttributeRegion> regions = new ArrayList<>();
|
||||
java.util.List<TextboxRule.AttributeRegion> regions = new ArrayList<>();
|
||||
|
||||
// Leveler / loyalty / basic
|
||||
boolean isLeveler = false;
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.mage.plugins.card.images.CardDownloadData;
|
|||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
|
@ -69,9 +70,9 @@ public enum AltMtgOnlTokensImageSource implements CardImageSource {
|
|||
return null;
|
||||
}
|
||||
|
||||
HashMap<String, String> copyUrlToImage = null;
|
||||
HashMap<String, String> copyImageToUrl = null;
|
||||
HashMap<String, Integer> copyUrlToImageDone = null;
|
||||
Map<String, String> copyUrlToImage = null;
|
||||
Map<String, String> copyImageToUrl = null;
|
||||
Map<String, Integer> copyUrlToImageDone = null;
|
||||
|
||||
private void setupLinks() {
|
||||
if (copyUrlToImage != null) {
|
||||
|
|
|
@ -4,6 +4,8 @@ package org.mage.plugins.card.dl.sources;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
@ -40,7 +42,7 @@ public class CardFrames implements Iterable<DownloadJob> {
|
|||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
for (String texture : TEXTURES) {
|
||||
jobs.add(generateDownloadJob(TEXTURES_FOLDER, texture));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public interface CardImageSource {
|
|||
|
||||
void doPause(String httpImageUrl);
|
||||
|
||||
default ArrayList<String> getSupportedSets() {
|
||||
default List<String> getSupportedSets() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
|
||||
private Set<String> supportedSets = new LinkedHashSet<String>();
|
||||
private Set<String> missingCards = new LinkedHashSet<String>();
|
||||
HashMap<String, String> singleLinks = null;
|
||||
Map<String, String> singleLinks = null;
|
||||
boolean loadedFromDialog = false;
|
||||
boolean viewMissingCards = true;
|
||||
HashMap<String, Integer> singleLinksDone = null;
|
||||
Map<String, Integer> singleLinksDone = null;
|
||||
private static int maxTimes = 2;
|
||||
|
||||
@Override
|
||||
|
@ -225,13 +225,11 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
public List<String> getSupportedSets() {
|
||||
setupLinks();
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
List<String> supportedSetsCopy = new ArrayList<>();
|
||||
if (supportedSets.isEmpty()) {
|
||||
for (String setCode : Sets.getInstance().keySet()) {
|
||||
supportedSets.add(setCode);
|
||||
}
|
||||
supportedSets.addAll(Sets.getInstance().keySet());
|
||||
}
|
||||
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
|
|
|
@ -10,10 +10,7 @@ import mage.client.constants.Constants;
|
|||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
@ -48,7 +45,7 @@ public class DirectLinksForDownload implements Iterable<DownloadJob> {
|
|||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, String> url : directLinks.entrySet()) {
|
||||
File dst = new File(outDir, url.getKey());
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package org.mage.plugins.card.dl.sources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.*;
|
||||
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
|
@ -286,7 +282,7 @@ public class GathererSets implements Iterable<DownloadJob> {
|
|||
c.setTime(new Date());
|
||||
c.add(Calendar.DATE, DAYS_BEFORE_RELEASE_TO_DOWNLOAD);
|
||||
Date compareDate = c.getTime();
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
boolean canDownload;
|
||||
|
||||
setsToDownload.clear();
|
||||
|
|
|
@ -69,7 +69,7 @@ public enum GrabbagImageSource implements CardImageSource {
|
|||
return null;
|
||||
}
|
||||
|
||||
HashMap<String, String> singleLinks = null;
|
||||
Map<String, String> singleLinks = null;
|
||||
|
||||
private void setupLinks() {
|
||||
if (singleLinks != null) {
|
||||
|
@ -485,10 +485,8 @@ public enum GrabbagImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -289,9 +289,7 @@ public enum MagidexImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.mage.plugins.card.images.CardDownloadData;
|
|||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
|
@ -69,9 +70,9 @@ public enum MtgOnlTokensImageSource implements CardImageSource {
|
|||
return null;
|
||||
}
|
||||
|
||||
HashMap<String, String> copyUrlToImage = null;
|
||||
HashMap<String, String> copyImageToUrl = null;
|
||||
HashMap<String, Integer> copyUrlToImageDone = null;
|
||||
Map<String, String> copyUrlToImage = null;
|
||||
Map<String, String> copyImageToUrl = null;
|
||||
Map<String, Integer> copyUrlToImageDone = null;
|
||||
|
||||
private void setupLinks() {
|
||||
if (copyUrlToImage != null) {
|
||||
|
|
|
@ -259,7 +259,7 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
cardNameAliases.put("RIX-tetzimocdeathprimordial", "tetzimocprimaldeath");
|
||||
// <card name, card link>
|
||||
manualLinks = new HashMap<>();
|
||||
HashMap<String, String> links = new HashMap<>();
|
||||
Map<String, String> links = new HashMap<>();
|
||||
links.put("templeofaclazotz", "templeofaclazotz");
|
||||
links.put("conquerorsfoothold", "conquerorsfoothold");
|
||||
links.put("primalwellspring", "primalwellspring");
|
||||
|
@ -272,7 +272,7 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
links.put("spitfirebastion", "spitfirebastion");
|
||||
manualLinks.put("XLN", links);
|
||||
|
||||
HashMap<String, String> linksRix = new HashMap<>();
|
||||
Map<String, String> linksRix = new HashMap<>();
|
||||
linksRix.put("vaultofcatlacan", "vaultofcatlacan");
|
||||
linksRix.put("atzalcaveofeternity", "atzalcaveofeternity");
|
||||
linksRix.put("wingedtempleoforazca", "wingedtempleoforazca");
|
||||
|
@ -283,7 +283,7 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
manualLinks.put("RIX", linksRix);
|
||||
|
||||
cardNameAliasesStart = new HashMap<>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
Set<String> names = new HashSet<>();
|
||||
names.add("eldrazidevastator.jpg");
|
||||
cardNameAliasesStart.put("BFZ", names);
|
||||
}
|
||||
|
@ -450,10 +450,8 @@ public enum MythicspoilerComSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -309,11 +309,10 @@ public enum ScryfallImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
public List<String> getSupportedSets() {
|
||||
|
||||
// cards
|
||||
supportedSetsCopy.addAll(ScryfallImageSupportCards.getSupportedSets());
|
||||
List<String> supportedSetsCopy = new ArrayList<>(ScryfallImageSupportCards.getSupportedSets());
|
||||
|
||||
// tokens
|
||||
for (String code : ScryfallImageSupportTokens.getSupportedSets().keySet()) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ScryfallSymbolsSource implements Iterable<DownloadJob> {
|
|||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
List<DownloadJob> jobs = new ArrayList<>();
|
||||
|
||||
// all symbols on one page
|
||||
jobs.add(generateDownloadJob());
|
||||
|
|
|
@ -151,10 +151,8 @@ public enum TokensMtgImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -625,7 +625,7 @@ public enum WizardCardsImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
String languageName = languageAliases.get(preferredLanguage);
|
||||
HashMap<String, Integer> localizedLanguageIds = getlocalizedMultiverseIds(multiverseId);
|
||||
Map<String, Integer> localizedLanguageIds = getlocalizedMultiverseIds(multiverseId);
|
||||
if (localizedLanguageIds.containsKey(languageName)) {
|
||||
return localizedLanguageIds.get(languageName);
|
||||
} else {
|
||||
|
@ -633,11 +633,11 @@ public enum WizardCardsImageSource implements CardImageSource {
|
|||
}
|
||||
}
|
||||
|
||||
private HashMap<String, Integer> getlocalizedMultiverseIds(Integer englishMultiverseId) throws IOException {
|
||||
private Map<String, Integer> getlocalizedMultiverseIds(Integer englishMultiverseId) throws IOException {
|
||||
String cardLanguagesUrl = "https://gatherer.wizards.com/Pages/Card/Languages.aspx?multiverseid=" + englishMultiverseId;
|
||||
Document cardLanguagesDoc = CardImageUtils.downloadHtmlDocument(cardLanguagesUrl);
|
||||
Elements languageTableRows = cardLanguagesDoc.select("tr.cardItem");
|
||||
HashMap<String, Integer> localizedIds = new HashMap<>();
|
||||
Map<String, Integer> localizedIds = new HashMap<>();
|
||||
if (!languageTableRows.isEmpty()) {
|
||||
for (Element languageTableRow : languageTableRows) {
|
||||
Elements languageTableColumns = languageTableRow.select("td");
|
||||
|
@ -714,10 +714,8 @@ public enum WizardCardsImageSource implements CardImageSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getSupportedSets() {
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
supportedSetsCopy.addAll(supportedSets);
|
||||
return supportedSetsCopy;
|
||||
public List<String> getSupportedSets() {
|
||||
return new ArrayList<>(supportedSets);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
|
|||
|
||||
private Object[] getSetsForCurrentImageSource() {
|
||||
// Set the available sets to the combo box
|
||||
ArrayList<String> supportedSets = selectedSource.getSupportedSets();
|
||||
List<String> supportedSets = selectedSource.getSupportedSets();
|
||||
List<String> setNames = new ArrayList<>();
|
||||
|
||||
// multiple sets selection
|
||||
|
@ -490,8 +490,8 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
|
|||
return Collections.synchronizedList(new ArrayList<>(cardsToDownload));
|
||||
}
|
||||
|
||||
public static ArrayList<CardDownloadData> getTokenCardUrls() throws RuntimeException {
|
||||
ArrayList<CardDownloadData> list = new ArrayList<>();
|
||||
public static List<CardDownloadData> getTokenCardUrls() throws RuntimeException {
|
||||
List<CardDownloadData> list = new ArrayList<>();
|
||||
InputStream in = DownloadPicturesService.class.getClassLoader().getResourceAsStream("card-pictures-tok.txt");
|
||||
|
||||
if (in == null) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class Log {
|
|||
}
|
||||
|
||||
public List<String> getArguments() {
|
||||
ArrayList<String> arguments = new ArrayList<>();
|
||||
List<String> arguments = new ArrayList<>();
|
||||
if (arg0 != null) {
|
||||
arguments.add(arg0);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class SimulatedPlayer2 extends ComputerPlayer {
|
|||
forced = false;
|
||||
simulateOptions(sim);
|
||||
|
||||
ArrayList<Ability> list = new ArrayList<>(allActions);
|
||||
List<Ability> list = new ArrayList<>(allActions);
|
||||
Collections.reverse(list);
|
||||
|
||||
if (!forced) {
|
||||
|
|
|
@ -517,7 +517,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
if (outcome.isGood()) {
|
||||
// good
|
||||
Cards cards = new CardsImpl(target.possibleTargets(sourceId, getId(), game));
|
||||
ArrayList<Card> cardsInHand = new ArrayList<>(cards.getCards(game));
|
||||
List<Card> cardsInHand = new ArrayList<>(cards.getCards(game));
|
||||
while (!target.isChosen()
|
||||
&& !target.possibleTargets(sourceId, getId(), game).isEmpty()
|
||||
&& target.getMaxNumberOfTargets() > target.getTargets().size()) {
|
||||
|
@ -1793,7 +1793,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
abilityControllerId = target.getAbilityController();
|
||||
}
|
||||
|
||||
ArrayList<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), game));
|
||||
List<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), game));
|
||||
while (!target.doneChosing()) {
|
||||
Card card = pickTarget(abilityControllerId, cardChoices, outcome, target, source, game);
|
||||
if (card != null) {
|
||||
|
@ -1824,7 +1824,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
abilityControllerId = target.getAbilityController();
|
||||
}
|
||||
|
||||
ArrayList<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), game));
|
||||
List<Card> cardChoices = new ArrayList<>(cards.getCards(target.getFilter(), game));
|
||||
while (!target.doneChosing()) {
|
||||
Card card = pickTarget(abilityControllerId, cardChoices, outcome, target, null, game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SimulatedPlayer extends ComputerPlayer {
|
|||
|
||||
simulateOptions(sim, pass);
|
||||
|
||||
ArrayList<Ability> list = new ArrayList<>(allActions);
|
||||
List<Ability> list = new ArrayList<>(allActions);
|
||||
//Collections.shuffle(list);
|
||||
Collections.reverse(list);
|
||||
return list;
|
||||
|
|
|
@ -187,7 +187,7 @@ public enum UserManager {
|
|||
calendarRemove.add(Calendar.SECOND, -1 * SERVER_TIMEOUTS_USER_REMOVE_FROM_SERVER_AFTER_SECS);
|
||||
List<User> toRemove = new ArrayList<>();
|
||||
logger.debug("Start Check Expired");
|
||||
ArrayList<User> userList = new ArrayList<>();
|
||||
List<User> userList = new ArrayList<>();
|
||||
final Lock r = lock.readLock();
|
||||
r.lock();
|
||||
try {
|
||||
|
|
|
@ -85,7 +85,7 @@ public final class SystemUtil {
|
|||
|
||||
String name;
|
||||
boolean isSpecialCommand;
|
||||
ArrayList<String> commands = new ArrayList<>();
|
||||
List<String> commands = new ArrayList<>();
|
||||
|
||||
public CommandGroup(String name) {
|
||||
this(name, false);
|
||||
|
@ -114,14 +114,14 @@ public final class SystemUtil {
|
|||
}
|
||||
}
|
||||
|
||||
private static String getCardsListForSpecialInform(Game game, Set<UUID> cardsList, ArrayList<String> commandParams) {
|
||||
private static String getCardsListForSpecialInform(Game game, Set<UUID> cardsList, List<String> commandParams) {
|
||||
return getCardsListForSpecialInform(game, cardsList.stream().collect(Collectors.toList()), commandParams);
|
||||
}
|
||||
|
||||
private static String getCardsListForSpecialInform(Game game, List<UUID> cardsList, ArrayList<String> commandParams) {
|
||||
private static String getCardsListForSpecialInform(Game game, List<UUID> cardsList, List<String> commandParams) {
|
||||
// cards list with ext info
|
||||
|
||||
ArrayList<String> res = new ArrayList<>();
|
||||
List<String> res = new ArrayList<>();
|
||||
|
||||
for (UUID cardID : cardsList) {
|
||||
Card card = game.getCard(cardID);
|
||||
|
@ -276,7 +276,7 @@ public final class SystemUtil {
|
|||
// 3. process system commands
|
||||
// 4. run commands from selected group
|
||||
// 1. parse
|
||||
ArrayList<CommandGroup> groups = new ArrayList<>();
|
||||
List<CommandGroup> groups = new ArrayList<>();
|
||||
|
||||
try (Scanner scanner = new Scanner(f)) {
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -56,7 +57,7 @@ class AwakenedAmalgamLandNamesCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
HashSet<String> landNames = new HashSet<>();
|
||||
Set<String> landNames = new HashSet<>();
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
|
||||
if (permanent.isLand()) {
|
||||
landNames.add(permanent.getName());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
|
@ -151,7 +152,7 @@ class BronzehideLionContinuousEffect extends ContinuousEffectImpl {
|
|||
lion.getSubtype(game).add(SubType.AURA);
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
ArrayList<Ability> toRemove = new ArrayList<>();
|
||||
List<Ability> toRemove = new ArrayList<>();
|
||||
for (Ability ability : lion.getAbilities(game)) {
|
||||
if (!lion.getSpellAbility().equals(ability)) {
|
||||
toRemove.add(ability);
|
||||
|
|
|
@ -3,6 +3,7 @@ package mage.cards.e;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -85,7 +86,7 @@ class ElementalResonanceEffect extends OneShotEffect {
|
|||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
ArrayList<String> manaOptions = new ArrayList<>();
|
||||
List<String> manaOptions = new ArrayList<>();
|
||||
// TODO: Phyrexian mana gives multiple choices when there should only be one (e.g. Slash Panther is {4} or {4}{R}).
|
||||
for (Mana mana : permanent.getManaCost().getOptions()) {
|
||||
String manaString = mana.toString();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -70,7 +71,7 @@ class HammerJammerEntersEffect extends EntersBattlefieldWithXCountersEffect {
|
|||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
int amount = controller.rollDice(game, 6);
|
||||
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects);
|
||||
return super.apply(game, source);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
|
@ -82,7 +83,7 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
HashSet<Card> cardsToManifest = new HashSet<>();
|
||||
Set<Card> cardsToManifest = new HashSet<>();
|
||||
cardsToManifest.add(source.getSourcePermanentIfItStillExists(game));
|
||||
cardsToManifest.add(controller.getLibrary().getFromTop(game));
|
||||
UUID exileId = UUID.randomUUID();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -78,7 +79,7 @@ class JumboImpEffect extends EntersBattlefieldWithXCountersEffect {
|
|||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
int amount = controller.rollDice(game, 6);
|
||||
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects);
|
||||
return super.apply(game, source);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import mage.target.TargetCard;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -79,7 +80,7 @@ class NissasEncouragementEffect extends OneShotEffect {
|
|||
searchGY = true;
|
||||
}
|
||||
|
||||
HashMap<String, Integer> foundCards = new HashMap<>();
|
||||
Map<String, Integer> foundCards = new HashMap<>();
|
||||
foundCards.put("Forest", 0);
|
||||
foundCards.put("Brambleweft Behemoth", 0);
|
||||
foundCards.put("Nissa, Genesis Mage", 0);
|
||||
|
|
|
@ -71,7 +71,7 @@ class NykthosShrineToNyxManaAbility extends ActivatedManaAbilityImpl {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
ArrayList<Mana> netManaCopy = new ArrayList<>();
|
||||
List<Mana> netManaCopy = new ArrayList<>();
|
||||
if (game == null) {
|
||||
return netManaCopy;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class NyxLotusManaAbility extends ActivatedManaAbilityImpl {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
ArrayList<Mana> netManaCopy = new ArrayList<>();
|
||||
List<Mana> netManaCopy = new ArrayList<>();
|
||||
if (game == null) {
|
||||
return netManaCopy;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
|
@ -69,7 +70,7 @@ class PlanarGuideExileEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
HashSet<Card> toExile = new HashSet<>();
|
||||
Set<Card> toExile = new HashSet<>();
|
||||
toExile.addAll(game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game));
|
||||
controller.moveCardsToExile(toExile, source, game, true, source.getSourceId(), sourceObject.getIdName());
|
||||
ExileZone exile = game.getExile().getExileZone(source.getSourceId());
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -112,7 +113,7 @@ class StanggExileTokenEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ArrayList<UUID> tokenIds = (ArrayList<UUID>) game.getState().getValue(source.getSourceId() + "_token");
|
||||
List<UUID> tokenIds = (ArrayList<UUID>) game.getState().getValue(source.getSourceId() + "_token");
|
||||
if (tokenIds != null) {
|
||||
Cards cards = new CardsImpl();
|
||||
for (UUID tokenId : tokenIds) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -61,7 +62,7 @@ class StrongarmTacticsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
// Store for each player the cards to discard, that's important because all discard shall happen at the same time
|
||||
HashMap<UUID, Cards> cardsToDiscard = new HashMap<>();
|
||||
Map<UUID, Cards> cardsToDiscard = new HashMap<>();
|
||||
if (controller != null) {
|
||||
// choose cards to discard
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
|
|
|
@ -2973,7 +2973,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Ability source, Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
|
||||
public boolean flipCoin(Ability source, Game game, boolean winnable, List<UUID> appliedEffects) {
|
||||
return computerPlayer.flipCoin(source, game, true, appliedEffects);
|
||||
}
|
||||
|
||||
|
@ -2983,7 +2983,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int rollDice(Game game, ArrayList<UUID> appliedEffects, int numSides) {
|
||||
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
|
||||
return computerPlayer.rollDice(game, appliedEffects, numSides);
|
||||
}
|
||||
|
||||
|
@ -3604,12 +3604,12 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects) {
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
|
|
@ -642,7 +642,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean flipCoin(Ability source, Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
|
||||
public boolean flipCoin(Ability source, Game game, boolean winnable, List<UUID> appliedEffects) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int rollDice(Game game, ArrayList<UUID> appliedEffects, int numSides) {
|
||||
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1322,12 +1322,12 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects) {
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.mage.test.utils;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -188,7 +189,7 @@ public class ManaUtilTest extends CardTestPlayerBase {
|
|||
Card card = CardRepository.instance.findCard(landName).getCard();
|
||||
Assert.assertNotNull(card);
|
||||
|
||||
HashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
|
||||
Map<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
|
||||
Assert.assertEquals(expected1, useableAbilities.size());
|
||||
|
||||
useableAbilities = ManaUtil.tryToAutoPay(unpaid, (LinkedHashMap<UUID, ActivatedManaAbilityImpl>) useableAbilities);
|
||||
|
@ -216,7 +217,7 @@ public class ManaUtilTest extends CardTestPlayerBase {
|
|||
Card card = CardRepository.instance.findCard(landName).getCard();
|
||||
Assert.assertNotNull(card);
|
||||
|
||||
HashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
|
||||
Map<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
|
||||
Assert.assertEquals(expected1, useableAbilities.size());
|
||||
|
||||
useableAbilities = ManaUtil.tryToAutoPay(unpaid, (LinkedHashMap<UUID, ActivatedManaAbilityImpl>) useableAbilities);
|
||||
|
@ -251,8 +252,8 @@ public class ManaUtilTest extends CardTestPlayerBase {
|
|||
* @param card Card to extract mana abilities from.
|
||||
* @return
|
||||
*/
|
||||
private HashMap<UUID, ActivatedManaAbilityImpl> getManaAbilities(Card card) {
|
||||
HashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = new LinkedHashMap<>();
|
||||
private Map<UUID, ActivatedManaAbilityImpl> getManaAbilities(Card card) {
|
||||
Map<UUID, ActivatedManaAbilityImpl> useableAbilities = new LinkedHashMap<>();
|
||||
for (Ability ability : card.getAbilities()) {
|
||||
if (ability instanceof ActivatedManaAbilityImpl) {
|
||||
ability.newId(); // we need to assign id manually as we are not in game
|
||||
|
|
|
@ -628,7 +628,7 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
|
||||
// tok file's data
|
||||
ArrayList<CardDownloadData> tokFileTokens = DownloadPicturesService.getTokenCardUrls();
|
||||
List<CardDownloadData> tokFileTokens = DownloadPicturesService.getTokenCardUrls();
|
||||
LinkedHashMap<String, String> tokDataClassesIndex = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, String> tokDataNamesIndex = new LinkedHashMap<>();
|
||||
for (CardDownloadData tokData : tokFileTokens) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
|
@ -120,7 +121,7 @@ class LicidContinuousEffect extends ContinuousEffectImpl {
|
|||
licid.getSubtype(game).add(SubType.AURA);
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
ArrayList<Ability> toRemove = new ArrayList<>();
|
||||
List<Ability> toRemove = new ArrayList<>();
|
||||
for (Ability ability : licid.getAbilities(game)) {
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof LicidEffect) {
|
||||
|
|
|
@ -705,7 +705,7 @@ public class ContinuousEffects implements Serializable {
|
|||
Cards cardsToReveal = new CardsImpl();
|
||||
do {
|
||||
FilterCard filter = new FilterCard("a card to splice");
|
||||
ArrayList<Predicate<MageObject>> idPredicates = new ArrayList<>();
|
||||
List<Predicate<MageObject>> idPredicates = new ArrayList<>();
|
||||
for (Ability ability : spliceAbilities) {
|
||||
idPredicates.add(new CardIdPredicate((ability.getSourceId())));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
private boolean tapped;
|
||||
private boolean attacking;
|
||||
private UUID lastAddedTokenId;
|
||||
private ArrayList<UUID> lastAddedTokenIds = new ArrayList<>();
|
||||
private List<UUID> lastAddedTokenIds = new ArrayList<>();
|
||||
|
||||
public CreateTokenEffect(Token token) {
|
||||
this(token, StaticValue.get(1));
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -32,7 +33,7 @@ public class ExileGraveyardAllTargetPlayerEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (targetPlayer != null) {
|
||||
ArrayList<UUID> graveyard = new ArrayList<>(targetPlayer.getGraveyard());
|
||||
List<UUID> graveyard = new ArrayList<>(targetPlayer.getGraveyard());
|
||||
for (UUID cardId : graveyard) {
|
||||
game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false);
|
||||
}
|
||||
|
|
|
@ -12,10 +12,7 @@ import mage.filter.FilterPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
|
@ -101,7 +98,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
// still as long as the prev. permanent is known to the LKI (e.g. Mikaeus, the Unhallowed) so gained dies triggered ability will trigger
|
||||
HashMap<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
|
||||
Map<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
|
||||
if (LKIBattlefield != null) {
|
||||
for (MageObject mageObject : LKIBattlefield.values()) {
|
||||
Permanent perm = (Permanent) mageObject;
|
||||
|
|
|
@ -13,6 +13,7 @@ import mage.game.permanent.Permanent;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -104,7 +105,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
// still as long as the prev. permanent is known to the LKI (e.g. Mikaeus, the Unhallowed) so gained dies triggered ability will trigger
|
||||
HashMap<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
|
||||
Map<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
|
||||
if (LKIBattlefield != null) {
|
||||
for (MageObject mageObject : LKIBattlefield.values()) {
|
||||
Permanent perm = (Permanent) mageObject;
|
||||
|
|
|
@ -2,6 +2,7 @@ package mage.abilities.effects.common.continuous;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
|
@ -104,7 +105,7 @@ public class LoseAbilityAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
// still as long as the prev. permanent is known to the LKI (e.g. Mikaeus, the Unhallowed) so gained dies triggered ability will trigger
|
||||
HashMap<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
|
||||
Map<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
|
||||
if (LKIBattlefield != null) {
|
||||
for (MageObject mageObject : LKIBattlefield.values()) {
|
||||
Permanent perm = (Permanent) mageObject;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
|
@ -45,7 +46,7 @@ public class PlayWithHandRevealedEffect extends ContinuousEffectImpl {
|
|||
affectedPlayers = game.getOpponents(source.getControllerId());
|
||||
break;
|
||||
case YOU:
|
||||
ArrayList<UUID> tmp = new ArrayList<>();
|
||||
List<UUID> tmp = new ArrayList<>();
|
||||
tmp.add(source.getControllerId());
|
||||
affectedPlayers = tmp;
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mage.abilities.effects.common.counter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -79,7 +80,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
|
|||
countersToAdd--;
|
||||
}
|
||||
newCounter.add(countersToAdd);
|
||||
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects");
|
||||
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects");
|
||||
card.addCounters(newCounter, source, game, appliedEffects);
|
||||
if (informPlayers && !game.isSimulation()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
@ -107,7 +108,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
|
|||
}
|
||||
newCounter.add(countersToAdd);
|
||||
int before = permanent.getCounters(game).getCount(newCounter.getName());
|
||||
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects");
|
||||
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects");
|
||||
permanent.addCounters(newCounter, source, game, appliedEffects); // if used from a replacement effect, the basic event determines if an effect was already applied to an event
|
||||
if (informPlayers && !game.isSimulation()) {
|
||||
int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before;
|
||||
|
|
|
@ -18,6 +18,7 @@ import mage.target.common.TargetDiscard;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DiscardEachPlayerEffect extends OneShotEffect {
|
||||
|
@ -60,7 +61,7 @@ public class DiscardEachPlayerEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
// Store for each player the cards to discard, that's important because all discard shall happen at the same time
|
||||
HashMap<UUID, Cards> cardsToDiscard = new HashMap<>();
|
||||
Map<UUID, Cards> cardsToDiscard = new HashMap<>();
|
||||
if (controller != null) {
|
||||
// choose cards to discard
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class AddConditionalManaOfTwoDifferentColorsEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(Mana.AnyMana(2));
|
||||
return netMana;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class AddManaAnyColorAttachedControllerEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(Mana.AnyMana(1));
|
||||
return netMana;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class AddManaInAnyCombinationEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
int amountOfManaLeft = amount.calculate(game, source, this);
|
||||
if (amountOfManaLeft > 0) {
|
||||
netMana.add(Mana.AnyMana(amountOfManaLeft));
|
||||
|
|
|
@ -37,7 +37,7 @@ public class AddManaOfAnyTypeProducedEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
Mana types = (Mana) this.getValue("mana"); // TODO: will not work until TriggeredManaAbility fix (see TriggeredManaAbilityMustGivesExtraManaOptions test)
|
||||
if (types != null) {
|
||||
netMana.add(types.copy());
|
||||
|
|
|
@ -24,7 +24,7 @@ public class AddManaOfTwoDifferentColorsEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(Mana.AnyMana(2));
|
||||
return netMana;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
ArrayList<Mana> netMana = new ArrayList<>();
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(mana.copy());
|
||||
return netMana;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package mage.abilities.hint;
|
|||
import java.awt.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
@ -46,7 +47,7 @@ public class HintUtils {
|
|||
|
||||
public static void appendHints(List<String> destList, List<String> newHints) {
|
||||
// append only unique hints
|
||||
HashSet<String> used = new HashSet<>();
|
||||
Set<String> used = new HashSet<>();
|
||||
for (String s : newHints) {
|
||||
if (!used.contains(s)) {
|
||||
destList.add(s);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
|
@ -73,7 +74,7 @@ class BloodthirstEffect extends OneShotEffect {
|
|||
if (watcher != null && watcher.conditionMet()) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game, appliedEffects);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -3,6 +3,7 @@ package mage.abilities.keyword;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -74,7 +75,7 @@ public class ChampionAbility extends StaticAbility {
|
|||
|
||||
this.subtypes = subtypes;
|
||||
StringBuilder sb = new StringBuilder("another ");
|
||||
ArrayList<Predicate<MageObject>> subtypesPredicates = new ArrayList<>();
|
||||
List<Predicate<MageObject>> subtypesPredicates = new ArrayList<>();
|
||||
if (!subtypes.isEmpty()) {
|
||||
int i = 0;
|
||||
for (SubType subtype : this.subtypes) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.StaticAbility;
|
||||
|
@ -160,7 +161,7 @@ class ModularDistributeCounterEffect extends OneShotEffect {
|
|||
if (sourcePermanent != null && targetArtifact != null && player != null) {
|
||||
int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
|
||||
if (numberOfCounters > 0) {
|
||||
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), source, game, appliedEffects);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -10,6 +10,7 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -56,7 +57,7 @@ public class SpectacleAbility extends SpellAbility {
|
|||
@SuppressWarnings("unchecked")
|
||||
public boolean activate(Game game, boolean noMana) {
|
||||
if (super.activate(game, noMana)) {
|
||||
ArrayList<Integer> spectacleActivations = (ArrayList) game.getState().getValue(SPECTACLE_ACTIVATION_VALUE_KEY + getSourceId());
|
||||
List<Integer> spectacleActivations = (ArrayList) game.getState().getValue(SPECTACLE_ACTIVATION_VALUE_KEY + getSourceId());
|
||||
if (spectacleActivations == null) {
|
||||
spectacleActivations = new ArrayList<>(); // zoneChangeCounter
|
||||
game.getState().setValue(SPECTACLE_ACTIVATION_VALUE_KEY + getSourceId(), spectacleActivations);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
|
@ -71,14 +72,12 @@ class SunburstEffect extends OneShotEffect {
|
|||
} else {
|
||||
counter = CounterType.CHARGE.createInstance(amount.calculate(game, source, this));
|
||||
}
|
||||
if (counter != null) {
|
||||
ArrayList<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
permanent.addCounters(counter, source, game, appliedEffects);
|
||||
if (!game.isSimulation()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
game.informPlayers(player.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName() + " counter on " + permanent.getName());
|
||||
}
|
||||
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||
permanent.addCounters(counter, source, game, appliedEffects);
|
||||
if (!game.isSimulation()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
game.informPlayers(player.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName() + " counter on " + permanent.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import mage.players.Player;
|
|||
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +67,7 @@ public class SurgeAbility extends SpellAbility {
|
|||
@SuppressWarnings("unchecked")
|
||||
public boolean activate(Game game, boolean noMana) {
|
||||
if (super.activate(game, noMana)) {
|
||||
ArrayList<Integer> surgeActivations = (ArrayList) game.getState().getValue(SURGE_ACTIVATION_VALUE_KEY + getSourceId());
|
||||
List<Integer> surgeActivations = (ArrayList) game.getState().getValue(SURGE_ACTIVATION_VALUE_KEY + getSourceId());
|
||||
if (surgeActivations == null) {
|
||||
surgeActivations = new ArrayList<>(); // zoneChangeCounter
|
||||
game.getState().setValue(SURGE_ACTIVATION_VALUE_KEY + getSourceId(), surgeActivations);
|
||||
|
|
|
@ -70,7 +70,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl
|
|||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
if (netMana.isEmpty()) {
|
||||
ArrayList<Mana> dynamicNetMana = new ArrayList<>();
|
||||
List<Mana> dynamicNetMana = new ArrayList<>();
|
||||
for (Effect effect : getEffects()) {
|
||||
if (effect instanceof ManaEffect) {
|
||||
List<Mana> effectNetMana = ((ManaEffect) effect).getNetMana(game, this);
|
||||
|
@ -81,7 +81,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl
|
|||
}
|
||||
return dynamicNetMana;
|
||||
}
|
||||
ArrayList<Mana> netManaCopy = new ArrayList<>();
|
||||
List<Mana> netManaCopy = new ArrayList<>();
|
||||
for (Mana mana : netMana) {
|
||||
netManaCopy.add(mana.copy());
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public abstract class TriggeredManaAbility extends TriggeredAbilityImpl implemen
|
|||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
if (game != null) {
|
||||
ArrayList<Mana> newNetMana = new ArrayList<>();
|
||||
List<Mana> newNetMana = new ArrayList<>();
|
||||
for (Effect effect : getEffects()) {
|
||||
if (effect instanceof ManaEffect) {
|
||||
newNetMana.addAll(((ManaEffect) effect).getNetMana(game, this));
|
||||
|
|
|
@ -30,7 +30,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
private Set<String> customSets = new HashSet<>();
|
||||
|
||||
private Sets() {
|
||||
ArrayList<String> packages = new ArrayList<>();
|
||||
List<String> packages = new ArrayList<>();
|
||||
packages.add("mage.sets");
|
||||
for (Class c : ClassScanner.findClasses(null, packages, ExpansionSet.class)) {
|
||||
try {
|
||||
|
|
|
@ -25,7 +25,7 @@ public abstract class XmlDeckImporter extends DeckImporter {
|
|||
|
||||
protected List<Node> getNodes(Document doc, String xpathExpression) throws XPathExpressionException {
|
||||
NodeList nodes = (NodeList) xpathFactory.newXPath().evaluate(xpathExpression, doc, NODESET);
|
||||
ArrayList<Node> list = new ArrayList<>();
|
||||
List<Node> list = new ArrayList<>();
|
||||
for (int i = 0; i < nodes.getLength(); i++) {
|
||||
list.add(nodes.item(i));
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ public class CardInfo {
|
|||
}
|
||||
if (length > MAX_RULE_LENGTH) {
|
||||
length = 0;
|
||||
ArrayList<String> shortRules = new ArrayList<>();
|
||||
List<String> shortRules = new ArrayList<>();
|
||||
for (String rule : rulesList) {
|
||||
if (length + rule.length() + 3 <= MAX_RULE_LENGTH) {
|
||||
shortRules.add(rule);
|
||||
|
|
|
@ -15,7 +15,7 @@ public class ChoiceColor extends ChoiceImpl {
|
|||
private static final List<String> colorChoices = getBaseColors();
|
||||
|
||||
public static List<String> getBaseColors() {
|
||||
ArrayList<String> arr = new ArrayList<>();
|
||||
List<String> arr = new ArrayList<>();
|
||||
arr.add("Green");
|
||||
arr.add("Blue");
|
||||
arr.add("Black");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package mage.filter.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterImpl;
|
||||
|
@ -26,14 +27,14 @@ public class FilterPlaneswalkerOrPlayer extends FilterImpl<Object> {
|
|||
public FilterPlaneswalkerOrPlayer(Set<UUID> defenders) {
|
||||
super("planeswalker or player");
|
||||
|
||||
ArrayList<Predicate<Permanent>> permanentPredicates = new ArrayList<>();
|
||||
List<Predicate<Permanent>> permanentPredicates = new ArrayList<>();
|
||||
for (UUID defenderId : defenders) {
|
||||
permanentPredicates.add(new ControllerIdPredicate(defenderId));
|
||||
}
|
||||
planeswalkerFilter = new FilterPlaneswalkerPermanent();
|
||||
planeswalkerFilter.add(Predicates.or(permanentPredicates));
|
||||
|
||||
ArrayList<Predicate<Player>> playerPredicates = new ArrayList<>();
|
||||
List<Predicate<Player>> playerPredicates = new ArrayList<>();
|
||||
for (UUID defenderId : defenders) {
|
||||
playerPredicates.add(new PlayerIdPredicate(defenderId));
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ public final class Predicates {
|
|||
}
|
||||
|
||||
static <T> List<T> defensiveCopy(Iterable<T> iterable) {
|
||||
ArrayList<T> list = new ArrayList<>();
|
||||
List<T> list = new ArrayList<>();
|
||||
for (T element : iterable) {
|
||||
list.add(checkNotNull(element));
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public interface Game extends MageItem, Serializable {
|
|||
|
||||
Map<UUID, Permanent> getPermanentsEntering();
|
||||
|
||||
Map<Zone, HashMap<UUID, MageObject>> getLKI();
|
||||
Map<Zone, Map<UUID, MageObject>> getLKI();
|
||||
|
||||
// Result must be checked for null. Possible errors search pattern: (\S*) = game.getCard.+\n(?!.+\1 != null)
|
||||
Card getCard(UUID cardId);
|
||||
|
|
|
@ -89,8 +89,8 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
protected Map<UUID, Card> gameCards = new HashMap<>();
|
||||
protected Map<UUID, MeldCard> meldCards = new HashMap<>(0);
|
||||
|
||||
protected Map<Zone, HashMap<UUID, MageObject>> lki = new EnumMap<>(Zone.class);
|
||||
protected Map<Zone, HashMap<UUID, CardState>> lkiCardState = new EnumMap<>(Zone.class);
|
||||
protected Map<Zone, Map<UUID, MageObject>> lki = new EnumMap<>(Zone.class);
|
||||
protected Map<Zone, Map<UUID, CardState>> lkiCardState = new EnumMap<>(Zone.class);
|
||||
protected Map<UUID, Map<Integer, MageObject>> lkiExtended = new HashMap<>();
|
||||
// Used to check if an object was moved by the current effect in resolution (so Wrath like effect can be handled correctly)
|
||||
protected Map<Zone, Set<UUID>> shortLivingLKI = new EnumMap<>(Zone.class);
|
||||
|
@ -2819,7 +2819,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (lkiMap != null) {
|
||||
lkiMap.put(objectId, copy);
|
||||
} else {
|
||||
HashMap<UUID, MageObject> newMap = new HashMap<>();
|
||||
Map<UUID, MageObject> newMap = new HashMap<>();
|
||||
newMap.put(objectId, copy);
|
||||
lki.put(zone, newMap);
|
||||
}
|
||||
|
@ -2844,7 +2844,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (lkiMap != null) {
|
||||
lkiMap.put(objectId, getState().getCardState(objectId));
|
||||
} else {
|
||||
HashMap<UUID, CardState> newMap = new HashMap<>();
|
||||
Map<UUID, CardState> newMap = new HashMap<>();
|
||||
newMap.put(objectId, getState().getCardState(objectId).copy());
|
||||
lkiCardState.put(zone, newMap);
|
||||
}
|
||||
|
@ -2908,7 +2908,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<Zone, HashMap<UUID, MageObject>> getLKI() {
|
||||
public Map<Zone, Map<UUID, MageObject>> getLKI() {
|
||||
return lki;
|
||||
}
|
||||
|
||||
|
|
|
@ -448,8 +448,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
}
|
||||
if (mustAttack) {
|
||||
// check which defenders the forced to attack creature can attack without paying a cost
|
||||
HashSet<UUID> defendersCostlessAttackable = new HashSet<>();
|
||||
defendersCostlessAttackable.addAll(defenders);
|
||||
Set<UUID> defendersCostlessAttackable = new HashSet<>(defenders);
|
||||
for (UUID defenderId : defenders) {
|
||||
if (game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects(
|
||||
GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER,
|
||||
|
|
|
@ -6,6 +6,7 @@ import mage.abilities.Ability;
|
|||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -23,7 +24,7 @@ public interface Token extends MageObject {
|
|||
|
||||
UUID getLastAddedToken();
|
||||
|
||||
ArrayList<UUID> getLastAddedTokenIds();
|
||||
List<UUID> getLastAddedTokenIds();
|
||||
|
||||
void addAbility(Ability ability);
|
||||
|
||||
|
|
|
@ -111,10 +111,8 @@ public abstract class TokenImpl extends MageObjectImpl implements Token {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<UUID> getLastAddedTokenIds() {
|
||||
ArrayList<UUID> ids = new ArrayList<>();
|
||||
ids.addAll(lastAddedTokenIds);
|
||||
return ids;
|
||||
public List<UUID> getLastAddedTokenIds() {
|
||||
return new ArrayList<>(lastAddedTokenIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -405,7 +405,7 @@ public abstract class TournamentImpl implements Tournament {
|
|||
}
|
||||
|
||||
public void resetBufferedCards() {
|
||||
HashSet<ExpansionSet> setsDone = new HashSet<>();
|
||||
Set<ExpansionSet> setsDone = new HashSet<>();
|
||||
for (ExpansionSet set : sets) {
|
||||
if (!setsDone.contains(set)) {
|
||||
set.removeSavedCards();
|
||||
|
|
|
@ -396,17 +396,17 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
boolean flipCoin(Ability source, Game game, boolean winnable);
|
||||
|
||||
boolean flipCoin(Ability source, Game game, boolean winnable, ArrayList<UUID> appliedEffects);
|
||||
boolean flipCoin(Ability source, Game game, boolean winnable, List<UUID> appliedEffects);
|
||||
|
||||
int rollDice(Game game, int numSides);
|
||||
|
||||
int rollDice(Game game, ArrayList<UUID> appliedEffects, int numSides);
|
||||
int rollDice(Game game, List<UUID> appliedEffects, int numSides);
|
||||
|
||||
PlanarDieRoll rollPlanarDie(Game game);
|
||||
|
||||
PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects);
|
||||
PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects);
|
||||
|
||||
PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides);
|
||||
PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides);
|
||||
|
||||
Card discardOne(boolean random, Ability source, Game game);
|
||||
|
||||
|
|
|
@ -1784,7 +1784,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public void untap(Game game) {
|
||||
// create list of all "notMoreThan" effects to track which one are consumed
|
||||
HashMap<Entry<RestrictionUntapNotMoreThanEffect, Set<Ability>>, Integer> notMoreThanEffectsUsage = new HashMap<>();
|
||||
Map<Entry<RestrictionUntapNotMoreThanEffect, Set<Ability>>, Integer> notMoreThanEffectsUsage = new HashMap<>();
|
||||
for (Entry<RestrictionUntapNotMoreThanEffect, Set<Ability>> restrictionEffect
|
||||
: game.getContinuousEffects().getApplicableRestrictionUntapNotMoreThanEffects(this, game).entrySet()) {
|
||||
notMoreThanEffectsUsage.put(restrictionEffect, restrictionEffect.getKey().getNumber());
|
||||
|
@ -1908,6 +1908,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
} else {
|
||||
//20091005 - 502.2
|
||||
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(playerId)) {
|
||||
boolean untap = true;
|
||||
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(permanent, game).keySet()) {
|
||||
|
@ -2788,7 +2789,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* for heads and false for tails
|
||||
*/
|
||||
@Override
|
||||
public boolean flipCoin(Ability source, Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
|
||||
public boolean flipCoin(Ability source, Game game, boolean winnable, List<UUID> appliedEffects) {
|
||||
boolean chosen = false;
|
||||
if (winnable) {
|
||||
chosen = this.chooseUse(Outcome.Benefit, "Heads or tails?", "", "Heads", "Tails", source, game);
|
||||
|
@ -2843,7 +2844,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* @return the number that the player rolled
|
||||
*/
|
||||
@Override
|
||||
public int rollDice(Game game, ArrayList<UUID> appliedEffects, int numSides) {
|
||||
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
|
||||
int result = RandomUtil.nextInt(numSides) + 1;
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("[Roll a die] " + getLogName() + " rolled a "
|
||||
|
@ -2869,7 +2870,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects) {
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
|
||||
return rollPlanarDie(game, appliedEffects, 2, 2);
|
||||
}
|
||||
|
||||
|
@ -2884,7 +2885,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* or NilRoll
|
||||
*/
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides,
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides,
|
||||
int numberPlanarSides) {
|
||||
int result = RandomUtil.nextInt(9) + 1;
|
||||
PlanarDieRoll roll = PlanarDieRoll.NIL_ROLL;
|
||||
|
|
|
@ -451,9 +451,7 @@ public abstract class TargetImpl implements Target {
|
|||
|
||||
@Override
|
||||
public List<UUID> getTargets() {
|
||||
ArrayList<UUID> newList = new ArrayList<>();
|
||||
newList.addAll(targets.keySet());
|
||||
return newList;
|
||||
return new ArrayList<>(targets.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,7 +42,7 @@ public class FirstTargetPointer implements TargetPointer {
|
|||
|
||||
@Override
|
||||
public List<UUID> getTargets(Game game, Ability source) {
|
||||
ArrayList<UUID> target = new ArrayList<>();
|
||||
List<UUID> target = new ArrayList<>();
|
||||
if (!source.getTargets().isEmpty()) {
|
||||
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
||||
Card card = game.getCard(targetId);
|
||||
|
|
|
@ -90,7 +90,7 @@ public class FixedTarget implements TargetPointer {
|
|||
}
|
||||
}
|
||||
|
||||
ArrayList<UUID> list = new ArrayList<>(1);
|
||||
List<UUID> list = new ArrayList<>(1);
|
||||
list.add(targetId);
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class FixedTargets implements TargetPointer {
|
|||
@Override
|
||||
public List<UUID> getTargets(Game game, Ability source) {
|
||||
// check target not changed zone
|
||||
ArrayList<UUID> list = new ArrayList<>(1);
|
||||
List<UUID> list = new ArrayList<>(1);
|
||||
for (MageObjectReference mor : targets) {
|
||||
if (game.getState().getZoneChangeCounter(mor.getSourceId()) == mor.getZoneChangeCounter()) {
|
||||
list.add(mor.getSourceId());
|
||||
|
|
|
@ -37,7 +37,7 @@ public class SecondTargetPointer implements TargetPointer {
|
|||
|
||||
@Override
|
||||
public List<UUID> getTargets(Game game, Ability source) {
|
||||
ArrayList<UUID> target = new ArrayList<>();
|
||||
List<UUID> target = new ArrayList<>();
|
||||
if (source.getTargets().size() > 1) {
|
||||
for (UUID targetId : source.getTargets().get(1).getTargets()) {
|
||||
Card card = game.getCard(targetId);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ThirdTargetPointer implements TargetPointer {
|
|||
|
||||
@Override
|
||||
public List<UUID> getTargets(Game game, Ability source) {
|
||||
ArrayList<UUID> target = new ArrayList<>();
|
||||
List<UUID> target = new ArrayList<>();
|
||||
if (source.getTargets().size() > 2) {
|
||||
for (UUID targetId : source.getTargets().get(2).getTargets()) {
|
||||
Card card = game.getCard(targetId);
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.*;
|
|||
public class CastFromGraveyardWatcher extends Watcher {
|
||||
|
||||
// holds which spell with witch zone change counter was cast from graveyard
|
||||
private final Map<UUID, HashSet<Integer>> spellsCastFromGraveyard = new HashMap<>();
|
||||
private final Map<UUID, Set<Integer>> spellsCastFromGraveyard = new HashMap<>();
|
||||
|
||||
public CastFromGraveyardWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
|
|
Loading…
Reference in a new issue