mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
list.size > 0 changed to !list.isEmpty
We care about if it's empty or not, not about it's size
This commit is contained in:
parent
f60ebfbb1f
commit
0557b5e89c
366 changed files with 532 additions and 548 deletions
|
@ -181,7 +181,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
gImage.setColor(Color.BLACK);
|
||||
gImage.drawImage(background, 0, 0, this);
|
||||
|
||||
if (card.getManaCost().size() > 0) {
|
||||
if (!card.getManaCost().isEmpty()) {
|
||||
ImageHelper.drawCosts(card.getManaCost(), gImage, FRAME_MAX_WIDTH - SYMBOL_MAX_XOFFSET, SYMBOL_MAX_YOFFSET, this);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
|
||||
if (card.getCardTypes().size() > 0) {
|
||||
if (!card.getCardTypes().isEmpty()) {
|
||||
gImage.drawString(cardType, CONTENT_MAX_XOFFSET, TYPE_MAX_YOFFSET);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
gSmall.drawString(card.getLoyalty(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
}
|
||||
|
||||
if (card.getCardTypes().size() > 0) {
|
||||
if (!card.getCardTypes().isEmpty()) {
|
||||
gSmall.drawString(cardType, Config.dimensions.contentXOffset, Config.dimensions.typeYOffset);
|
||||
}
|
||||
drawText();
|
||||
|
@ -232,7 +232,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
}
|
||||
} else {
|
||||
sb.append(card.getName());
|
||||
if (card.getManaCost().size() > 0) {
|
||||
if (!card.getManaCost().isEmpty()) {
|
||||
sb.append('\n').append(card.getManaCost());
|
||||
}
|
||||
sb.append('\n').append(cardType);
|
||||
|
@ -247,7 +247,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
for (String rule : getRules()) {
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) {
|
||||
if (card.getExpansionSetCode() != null && !card.getExpansionSetCode().isEmpty()) {
|
||||
sb.append('\n').append(card.getCardNumber()).append(" - ");
|
||||
sb.append(Sets.getInstance().get(card.getExpansionSetCode()).getName()).append(" - ");
|
||||
sb.append(card.getRarity().toString());
|
||||
|
@ -308,7 +308,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
if (!card.getSubTypes().isEmpty()) {
|
||||
sbType.append("- ");
|
||||
for (String subType : card.getSubTypes()) {
|
||||
sbType.append(subType).append(' ');
|
||||
|
|
|
@ -163,7 +163,7 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
int rowsOfCards = 20;
|
||||
int columns = 1;
|
||||
if (showCards != null && showCards.size() > 0) {
|
||||
if (showCards != null && !showCards.isEmpty()) {
|
||||
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
|
||||
int count = 0;
|
||||
for (CardView card : showCards.values()) {
|
||||
|
|
|
@ -225,7 +225,7 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
if (!isVisibleIfEmpty) {
|
||||
cardArea.setVisible(cards.size() > 0);
|
||||
cardArea.setVisible(!cards.isEmpty());
|
||||
}
|
||||
|
||||
sizeCards(getCardDimension());
|
||||
|
|
|
@ -322,7 +322,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
cardArea.remove(card);
|
||||
}
|
||||
|
||||
if (cards != null && cards.size() > 0) {
|
||||
if (cards != null && !cards.isEmpty()) {
|
||||
Rectangle rectangle = new Rectangle(cardDimension.width, cardDimension.height);
|
||||
List<CardView> sortedCards = new ArrayList<>(cards.values());
|
||||
switch (sortSetting.getSortBy()) {
|
||||
|
|
|
@ -1077,7 +1077,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
for (Sort s : sortMenuItems.keySet()) {
|
||||
sortMenuItems.get(s).setSelected(cardSort == s);
|
||||
}
|
||||
hideSelected.setEnabled(dragCardList().size() > 0);
|
||||
hideSelected.setEnabled(!dragCardList().isEmpty());
|
||||
separateButton.setSelected(separateCreatures);
|
||||
menu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
|
@ -1534,7 +1534,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
List<CardInfo> cardPool = CardRepository.instance.findCards(cardCriteria);
|
||||
|
||||
if (cardPool.size() > 0) {
|
||||
if (!cardPool.isEmpty()) {
|
||||
Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard();
|
||||
|
||||
if (acard.getName().equals(card.getName())) {
|
||||
|
@ -1656,7 +1656,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (trackedCards.containsKey(info.getSetCode()) && trackedCards.get(info.getSetCode()).containsKey(info.getCardNum())) {
|
||||
ArrayList<CardView> candidates
|
||||
= trackedCards.get(info.getSetCode()).get(info.getCardNum());
|
||||
if (candidates.size() > 0) {
|
||||
if (!candidates.isEmpty()) {
|
||||
gridStack.add(candidates.remove(0));
|
||||
thisMaxStackSize = Math.max(thisMaxStackSize, gridStack.size());
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class Permanent extends Card {
|
|||
if (permanent.getOriginal() != null) {
|
||||
sb.append("\n----- Originally -------\n");
|
||||
sb.append(permanent.getOriginal().getName());
|
||||
if (permanent.getOriginal().getManaCost().size() > 0) {
|
||||
if (!permanent.getOriginal().getManaCost().isEmpty()) {
|
||||
sb.append('\n').append(permanent.getOriginal().getManaCost());
|
||||
}
|
||||
sb.append('\n').append(getType(permanent.getOriginal()));
|
||||
|
@ -122,7 +122,7 @@ public class Permanent extends Card {
|
|||
for (String rule: getRules()) {
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
if (permanent.getOriginal().getExpansionSetCode().length() > 0) {
|
||||
if (!permanent.getOriginal().getExpansionSetCode().isEmpty()) {
|
||||
sb.append('\n').append(permanent.getCardNumber()).append(" - ");
|
||||
sb.append('\n').append(Sets.getInstance().get(permanent.getOriginal().getExpansionSetCode()).getName()).append(" - ");
|
||||
sb.append(permanent.getOriginal().getRarity().toString());
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MageTextArea extends JEditorPane {
|
|||
text = text.replace("\r\n", "<div style='font-size:5pt'></div>");
|
||||
|
||||
final String basicText = ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG);
|
||||
if (text.length() > 0) {
|
||||
if (!text.isEmpty()) {
|
||||
buffer.append(basicText);
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
text = text.replace("\r\n", "<div style='font-size:5pt'></div>");
|
||||
//text += "<br>";
|
||||
|
||||
if (text.length() > 0) {
|
||||
if (!text.isEmpty()) {
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.DIALOG));
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class CardHelper {
|
|||
type.append(cardType.toString());
|
||||
type.append(' ');
|
||||
}
|
||||
if (c.getSubTypes().size() > 0) {
|
||||
if (!c.getSubTypes().isEmpty()) {
|
||||
type.append("- ");
|
||||
for (String subType : c.getSubTypes()) {
|
||||
type.append(subType);
|
||||
|
|
|
@ -137,7 +137,7 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
String titel = name + " (" + exile.size() + ')';
|
||||
setTitle(titel);
|
||||
this.setTitelBarToolTip(titel);
|
||||
if (exile.size() > 0) {
|
||||
if (!exile.isEmpty()) {
|
||||
show();
|
||||
if (changed) {
|
||||
try {
|
||||
|
|
|
@ -507,7 +507,7 @@ public class NewTableDialog extends MageDialog {
|
|||
while (players.size() != numPlayers) {
|
||||
TablePlayerPanel playerPanel = new TablePlayerPanel();
|
||||
String playerType = "Human";
|
||||
if (prefPlayerTypes.size() >= players.size() && players.size() > 0) {
|
||||
if (prefPlayerTypes.size() >= players.size() && !players.isEmpty()) {
|
||||
playerType = prefPlayerTypes.get(players.size() - 1);
|
||||
}
|
||||
playerPanel.init(players.size() + 2, playerType);
|
||||
|
|
|
@ -826,7 +826,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
txtRandomPacks.setEnabled(false);
|
||||
txtRandomPacks.setLineWrap(true);
|
||||
String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, "");
|
||||
if (randomPrefs.length() > 0) {
|
||||
if (!randomPrefs.isEmpty()) {
|
||||
txtRandomPacks.setText(randomPrefs);
|
||||
ArrayList<String> theList = new ArrayList<>();
|
||||
theList.addAll(Arrays.asList(randomPrefs.split(";")));
|
||||
|
@ -1026,7 +1026,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
|
||||
private void loadBoosterPacks(String packString) {
|
||||
if (packString.length()>0) {
|
||||
if (!packString.isEmpty()) {
|
||||
String[] packsArray = packString.substring(1, packString.length() - 1).split(",");
|
||||
int packNumber = 0;
|
||||
for (String pack : packsArray ){
|
||||
|
|
|
@ -723,7 +723,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (!handCards.containsKey(chosenHandKey)) {
|
||||
chosenHandKey = YOUR_HAND;
|
||||
}
|
||||
} else if (chosenHandKey.isEmpty() && handCards.size() > 0) {
|
||||
} else if (chosenHandKey.isEmpty() && !handCards.isEmpty()) {
|
||||
chosenHandKey = handCards.keySet().iterator().next();
|
||||
}
|
||||
if (chosenHandKey != null && handCards.containsKey(chosenHandKey)) {
|
||||
|
@ -854,7 +854,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
showRevealed(game);
|
||||
showLookedAt(game);
|
||||
if (game.getCombat().size() > 0) {
|
||||
if (!game.getCombat().isEmpty()) {
|
||||
CombatManager.getInstance().showCombat(game.getCombat(), gameId);
|
||||
} else {
|
||||
CombatManager.getInstance().hideCombat(gameId);
|
||||
|
@ -1164,7 +1164,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
updateGame(gameView);
|
||||
Map<String, Serializable> options0 = options == null ? new HashMap<>() : options;
|
||||
ShowCardsDialog dialog = null;
|
||||
if (cardView != null && cardView.size() > 0) {
|
||||
if (cardView != null && !cardView.isEmpty()) {
|
||||
dialog = showCards(message, cardView, required, options0, popupMenuType);
|
||||
options0.put("dialog", dialog);
|
||||
}
|
||||
|
@ -2130,7 +2130,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
choices,
|
||||
this.chosenHandKey);
|
||||
|
||||
if (newChosenHandKey != null && newChosenHandKey.length() > 0) {
|
||||
if (newChosenHandKey != null && !newChosenHandKey.isEmpty()) {
|
||||
this.chosenHandKey = newChosenHandKey;
|
||||
CardsView cards = handCards.get(chosenHandKey);
|
||||
handContainer.loadCards(cards, bigCard, gameId);
|
||||
|
|
|
@ -259,7 +259,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
switch (action) {
|
||||
case "Replay":
|
||||
List<UUID> gameList = matchesModel.getListofGames(modelRow);
|
||||
if (gameList != null && gameList.size() > 0) {
|
||||
if (gameList != null && !gameList.isEmpty()) {
|
||||
if (gameList.size() == 1) {
|
||||
SessionHandler.replayGame(gameList.get(0));
|
||||
} else {
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ImageHelper {
|
|||
}
|
||||
|
||||
public static void drawCosts(List<String> costs, Graphics2D g, int xOffset, int yOffset, ImageObserver o) {
|
||||
if (costs.size() > 0) {
|
||||
if (!costs.isEmpty()) {
|
||||
int costLeft = xOffset;
|
||||
for (int i = costs.size() - 1; i >= 0; i--) {
|
||||
String symbol = costs.get(i);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MageTableRowSorter extends TableRowSorter<TableModel> {
|
|||
@Override
|
||||
public void toggleSortOrder(int column) {
|
||||
List<? extends SortKey> sortKeys = getSortKeys();
|
||||
if (sortKeys.size() > 0) {
|
||||
if (!sortKeys.isEmpty()) {
|
||||
if (sortKeys.get(0).getSortOrder() == SortOrder.DESCENDING) {
|
||||
setSortKeys(null);
|
||||
return;
|
||||
|
|
|
@ -135,7 +135,7 @@ public class ArrowBuilder {
|
|||
if (map.containsKey(gameId)) {
|
||||
Map<Type, List<Arrow>> innerMap = map.get(gameId);
|
||||
java.util.List<Arrow> arrows = innerMap.get(type);
|
||||
if (arrows != null && arrows.size() > 0) {
|
||||
if (arrows != null && !arrows.isEmpty()) {
|
||||
JPanel p = getArrowsPanel(gameId);
|
||||
synchronized (map) {
|
||||
for (Arrow arrow : arrows) {
|
||||
|
|
|
@ -330,7 +330,7 @@ public class GuiDisplayUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (textLines.lines.size() > 0) {
|
||||
if (!textLines.lines.isEmpty()) {
|
||||
for (String textLine : textLines.lines) {
|
||||
if (textLine != null && !textLine.replace(".", "").trim().isEmpty()) {
|
||||
rule.append("<p style='margin: 2px'>").append(textLine).append("</p>");
|
||||
|
@ -339,7 +339,7 @@ public class GuiDisplayUtil {
|
|||
}
|
||||
|
||||
String legal = rule.toString();
|
||||
if (legal.length() > 0) {
|
||||
if (!legal.isEmpty()) {
|
||||
legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));
|
||||
|
@ -366,7 +366,7 @@ public class GuiDisplayUtil {
|
|||
for (CardType cardType : card.getCardTypes()) {
|
||||
types += cardType.toString() + ' ';
|
||||
}
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
if (!card.getSubTypes().isEmpty()) {
|
||||
types += "- ";
|
||||
}
|
||||
for (String subType : card.getSubTypes()) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
|
|||
|
||||
@Override
|
||||
protected void process(List<Float> chunks) {
|
||||
if (chunks != null && chunks.size() > 0) {
|
||||
if (chunks != null && !chunks.isEmpty()) {
|
||||
Float memUsage = chunks.get(chunks.size() - 1);
|
||||
if (memUsage != null) {
|
||||
jLabelToDisplayInfo.setText(Math.round(memUsage) + "% Mem free");
|
||||
|
|
|
@ -688,7 +688,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
|
||||
if (card.getSubTypes().size() > 0) {
|
||||
if (!card.getSubTypes().isEmpty()) {
|
||||
sbType.append("- ");
|
||||
for (String subType : card.getSubTypes()) {
|
||||
sbType.append(subType).append(' ');
|
||||
|
@ -706,7 +706,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
}
|
||||
} else {
|
||||
sb.append(card.getName());
|
||||
if (card.getManaCost().size() > 0) {
|
||||
if (!card.getManaCost().isEmpty()) {
|
||||
sb.append('\n').append(card.getManaCost());
|
||||
}
|
||||
sb.append('\n').append(cardType);
|
||||
|
@ -724,7 +724,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
for (String rule : card.getRules()) {
|
||||
sb.append('\n').append(rule);
|
||||
}
|
||||
if (card.getExpansionSetCode() != null && card.getExpansionSetCode().length() > 0) {
|
||||
if (card.getExpansionSetCode() != null && !card.getExpansionSetCode().isEmpty()) {
|
||||
sb.append('\n').append(card.getCardNumber()).append(" - ");
|
||||
sb.append(card.getExpansionSetCode()).append(" - ");
|
||||
sb.append(card.getRarity().toString());
|
||||
|
|
|
@ -385,7 +385,7 @@ public abstract class CardRenderer {
|
|||
for (CardType cardType : cardView.getCardTypes()) {
|
||||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
if (cardView.getSubTypes().size() > 0) {
|
||||
if (!cardView.getSubTypes().isEmpty()) {
|
||||
sbType.append("- ");
|
||||
for (String subType : cardView.getSubTypes()) {
|
||||
sbType.append(subType).append(' ');
|
||||
|
|
|
@ -87,7 +87,7 @@ public class TextboxRule {
|
|||
// Do it in reverse order for proper handling of regions where
|
||||
// there are multiple attributes stacked (EG: bold + italic)
|
||||
AttributedString attributedRule = new AttributedString(text);
|
||||
if (text.length() != 0) {
|
||||
if (!text.isEmpty()) {
|
||||
attributedRule.addAttribute(TextAttribute.FONT, normal);
|
||||
for (int i = regions.size() - 1; i >= 0; --i) {
|
||||
regions.get(i).applyToAttributedString(attributedRule, normal, italic);
|
||||
|
|
|
@ -179,7 +179,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
break;
|
||||
}
|
||||
List<CounterView> counters = firstPanel.getOriginalPermanent().getCounters();
|
||||
if (counters != null && counters.size() > 0) {
|
||||
if (counters != null && !counters.isEmpty()) {
|
||||
// don't put to first panel if it has counters
|
||||
insertIndex = i;
|
||||
break;
|
||||
|
@ -191,7 +191,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
continue;
|
||||
}
|
||||
counters = permanent.getOriginalPermanent().getCounters();
|
||||
if (counters != null && counters.size() > 0) {
|
||||
if (counters != null && !counters.isEmpty()) {
|
||||
// if a land has counter, put it to the right
|
||||
insertIndex = i + 1;
|
||||
continue;
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class Constants {
|
|||
|
||||
public enum SessionState {
|
||||
|
||||
DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING;
|
||||
DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING
|
||||
}
|
||||
|
||||
public enum Option {
|
||||
|
|
|
@ -397,7 +397,7 @@ public class CardView extends SimpleCardView {
|
|||
for (SpellAbility spellAbility : spell.getSpellAbilities()) {
|
||||
for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
|
||||
Mode mode = spellAbility.getModes().get(modeId);
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
setTargets(mode.getTargets());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
}
|
||||
abilityView = new AbilityView(ability, sourceObject.getName(), sourceCardView);
|
||||
}
|
||||
if (ability.getTargets().size() > 0) {
|
||||
if (!ability.getTargets().isEmpty()) {
|
||||
abilityView.setTargets(ability.getTargets());
|
||||
} else {
|
||||
List<UUID> abilityTargets = new ArrayList<>();
|
||||
|
|
|
@ -45,15 +45,15 @@ public class ChatMessage implements Serializable {
|
|||
private MessageType messageType;
|
||||
|
||||
public enum MessageColor {
|
||||
BLACK, RED, GREEN, BLUE, ORANGE, YELLOW;
|
||||
BLACK, RED, GREEN, BLUE, ORANGE, YELLOW
|
||||
}
|
||||
|
||||
public enum MessageType {
|
||||
USER_INFO, STATUS, GAME, TALK, WHISPER;
|
||||
USER_INFO, STATUS, GAME, TALK, WHISPER
|
||||
}
|
||||
|
||||
public enum SoundToPlay {
|
||||
PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered;
|
||||
PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered
|
||||
}
|
||||
|
||||
public ChatMessage(String username, String message, String time, MessageColor color) {
|
||||
|
|
|
@ -191,7 +191,7 @@ public class GameView implements Serializable {
|
|||
if (priorityPlayer != null && createdForPlayer != null && createdForPlayerId != null && createdForPlayer.isGameUnderControl()
|
||||
&& (createdForPlayerId.equals(priorityPlayer.getId()) // player controls the turn
|
||||
|| createdForPlayer.getPlayersUnderYourControl().contains(priorityPlayer.getId()))) { // player controls active players turn
|
||||
this.special = state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).size() > 0;
|
||||
this.special = !state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).isEmpty();
|
||||
}
|
||||
} else {
|
||||
this.special = false;
|
||||
|
|
|
@ -143,7 +143,7 @@ public class MatchView implements Serializable {
|
|||
}
|
||||
this.players = sb1.toString();
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
if (table.getTournament().getRounds().size() > 0) {
|
||||
if (!table.getTournament().getRounds().isEmpty()) {
|
||||
for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) {
|
||||
sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(' ');
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class PermanentView extends CardView {
|
|||
this.morphed = permanent.isMorphed();
|
||||
this.manifested = permanent.isManifested();
|
||||
this.damage = permanent.getDamage();
|
||||
if (permanent.getAttachments().size() > 0) {
|
||||
if (!permanent.getAttachments().isEmpty()) {
|
||||
attachments = new ArrayList<>();
|
||||
attachments.addAll(permanent.getAttachments());
|
||||
}
|
||||
|
|
|
@ -258,7 +258,7 @@ public class PlayerView implements Serializable {
|
|||
}
|
||||
|
||||
public boolean hasAttachments() {
|
||||
return attachments != null && attachments.size() > 0;
|
||||
return attachments != null && !attachments.isEmpty();
|
||||
}
|
||||
|
||||
public int getStatesSavedSize() {
|
||||
|
|
|
@ -101,7 +101,7 @@ public class StackAbilityView extends CardView {
|
|||
List<String> names = new ArrayList<>();
|
||||
for (UUID modeId : ability.getModes().getSelectedModes()) {
|
||||
Mode mode = ability.getModes().get(modeId);
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
setTargets(mode.getTargets());
|
||||
} else {
|
||||
List<UUID> targetList = new ArrayList<>();
|
||||
|
@ -111,7 +111,7 @@ public class StackAbilityView extends CardView {
|
|||
targetList.add(((FixedTarget) targetPointer).getTarget());
|
||||
}
|
||||
}
|
||||
if (targetList.size() > 0) {
|
||||
if (!targetList.isEmpty()) {
|
||||
overrideTargets(targetList);
|
||||
|
||||
for (UUID uuid : targetList) {
|
||||
|
|
|
@ -272,7 +272,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
while (actions.peek() != null) {
|
||||
Ability ability = actions.poll();
|
||||
logger.info(new StringBuilder("===> Act [").append(game.getPlayer(playerId).getName()).append("] Action: ").append(ability.toString()).toString());
|
||||
if (ability.getTargets().size() > 0) {
|
||||
if (!ability.getTargets().isEmpty()) {
|
||||
for (Target target : ability.getTargets()) {
|
||||
for (UUID id : target.getTargets()) {
|
||||
target.updateTarget(id, game);
|
||||
|
@ -318,7 +318,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
//int bestScore = addActionsTimed(new FilterAbility());
|
||||
currentScore = GameStateEvaluator2.evaluate(playerId, game);
|
||||
addActionsTimed();
|
||||
if (root.children.size() > 0) {
|
||||
if (!root.children.isEmpty()) {
|
||||
root = root.children.get(0);
|
||||
//GameStateEvaluator2.evaluate(playerId, root.getGame());
|
||||
int bestScore = root.getScore();
|
||||
|
@ -335,10 +335,10 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
}
|
||||
|
||||
protected boolean getNextAction(Game game) {
|
||||
if (root != null && root.children.size() > 0) {
|
||||
if (root != null && !root.children.isEmpty()) {
|
||||
SimulationNode2 test = root;
|
||||
root = root.children.get(0);
|
||||
while (root.children.size() > 0 && !root.playerId.equals(playerId)) {
|
||||
while (!root.children.isEmpty() && !root.playerId.equals(playerId)) {
|
||||
test = root;
|
||||
root = root.children.get(0);
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
UUID currentPlayerId = node.getGame().getPlayerList().get();
|
||||
//logger.info("reached - " + val + ", playerId=" + playerId + ", node.pid="+currentPlayerId);
|
||||
return val;
|
||||
} else if (node.getChildren().size() > 0) {
|
||||
} else if (!node.getChildren().isEmpty()) {
|
||||
logger.trace("Add actions -- something added children:" + node.getChildren().size());
|
||||
val = minimaxAB(node, depth - 1, alpha, beta);
|
||||
return val;
|
||||
|
@ -542,7 +542,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
|
||||
if (game.gameOver(null)) {
|
||||
val = GameStateEvaluator2.evaluate(playerId, game);
|
||||
} else if (node.getChildren().size() > 0) {
|
||||
} else if (!node.getChildren().isEmpty()) {
|
||||
//declared attackers or blockers or triggered abilities
|
||||
logger.debug("Add actions -- attack/block/trigger added children:" + node.getChildren().size());
|
||||
val = minimaxAB(node, depth - 1, alpha, beta);
|
||||
|
@ -568,7 +568,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
SimulationNode2 bestNode = null;
|
||||
List<Ability> allActions = currentPlayer.simulatePriority(game);
|
||||
optimize(game, allActions);
|
||||
if (logger.isInfoEnabled() && allActions.size() > 0 && depth == maxDepth) {
|
||||
if (logger.isInfoEnabled() && !allActions.isEmpty() && depth == maxDepth) {
|
||||
logger.info("ADDED ACTIONS (" + allActions.size() + ") " + ' ' + allActions);
|
||||
}
|
||||
int counter = 0;
|
||||
|
@ -614,9 +614,9 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
.append(listTargets(game, action.getTargets())).append(')')
|
||||
.append(logger.isTraceEnabled() ? " #" + newNode.hashCode() : "");
|
||||
SimulationNode2 logNode = newNode;
|
||||
while (logNode.getChildren() != null && logNode.getChildren().size() > 0) {
|
||||
while (logNode.getChildren() != null && !logNode.getChildren().isEmpty()) {
|
||||
logNode = logNode.getChildren().get(0);
|
||||
if (logNode.getAbilities() != null && logNode.getAbilities().size() > 0) {
|
||||
if (logNode.getAbilities() != null && !logNode.getAbilities().isEmpty()) {
|
||||
sb.append(" -> [").append(logNode.getDepth()).append(']').append(logNode.getAbilities().toString()).append('<').append(logNode.getScore()).append('>');
|
||||
}
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
alpha = val;
|
||||
bestNode = newNode;
|
||||
bestNode.setScore(val);
|
||||
if (newNode.getChildren().size() > 0) {
|
||||
if (!newNode.getChildren().isEmpty()) {
|
||||
bestNode.setCombat(newNode.getChildren().get(0).getCombat());
|
||||
}
|
||||
/*
|
||||
|
@ -660,7 +660,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
beta = val;
|
||||
bestNode = newNode;
|
||||
bestNode.setScore(val);
|
||||
if (newNode.getChildren().size() > 0) {
|
||||
if (!newNode.getChildren().isEmpty()) {
|
||||
bestNode.setCombat(newNode.getChildren().get(0).getCombat());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
|
||||
addActionsTimed();
|
||||
logger.trace("After add actions timed: root.children.size = " + root.children.size());
|
||||
if (root.children.size() > 0) {
|
||||
if (!root.children.isEmpty()) {
|
||||
root = root.children.get(0);
|
||||
// int bestScore = root.getScore();
|
||||
// if (bestScore > currentScore || allowBadMoves) {
|
||||
|
@ -204,7 +204,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
logger.debug("Sim Calculate post combat actions ----------------------------------------------------------------------------------------");
|
||||
|
||||
addActionsTimed();
|
||||
if (root != null && root.children.size() > 0) {
|
||||
if (root != null && !root.children.isEmpty()) {
|
||||
root = root.children.get(0);
|
||||
int bestScore = root.getScore();
|
||||
if (bestScore > currentScore || allowBadMoves) {
|
||||
|
@ -244,7 +244,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
} while ((logNode.getParent() != null));
|
||||
logger.trace(sb);
|
||||
}
|
||||
} else if (node.getChildren().size() > 0) {
|
||||
} else if (!node.getChildren().isEmpty()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
StringBuilder sb = new StringBuilder("Add Action [").append(depth)
|
||||
.append("] -- something added children ")
|
||||
|
@ -299,7 +299,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
val = GameStateEvaluator2.evaluate(playerId, game);
|
||||
*/
|
||||
}
|
||||
} else if (node.getChildren().size() > 0) {
|
||||
} else if (!node.getChildren().isEmpty()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
StringBuilder sb = new StringBuilder("Add Action [").append(depth)
|
||||
.append("] -- trigger ")
|
||||
|
@ -411,7 +411,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
beta = val;
|
||||
bestNode = newNode;
|
||||
bestNode.setScore(val);
|
||||
if (newNode.getChildren().size() > 0) {
|
||||
if (!newNode.getChildren().isEmpty()) {
|
||||
bestNode.setCombat(newNode.getChildren().get(0).getCombat());
|
||||
}
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
alpha = val;
|
||||
bestNode = newNode;
|
||||
bestNode.setScore(val);
|
||||
if (newNode.getChildren().size() > 0) {
|
||||
if (!newNode.getChildren().isEmpty()) {
|
||||
bestNode.setCombat(newNode.getChildren().get(0).getCombat());
|
||||
}
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
}
|
||||
Game sim = game.copy();
|
||||
for (CombatGroup group : engagement.getGroups()) {
|
||||
if (group.getAttackers().size() > 0) {
|
||||
if (!group.getAttackers().isEmpty()) {
|
||||
UUID attackerId = group.getAttackers().get(0);
|
||||
for (UUID blockerId : group.getBlockers()) {
|
||||
sim.getPlayer(defenderId).declareBlocker(defenderId, blockerId, attackerId, sim);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class SimulatedAction2 {
|
|||
}
|
||||
|
||||
public boolean usesStack() {
|
||||
if (abilities != null && abilities.size() > 0) {
|
||||
if (abilities != null && !abilities.isEmpty()) {
|
||||
return abilities.get(abilities.size() -1).isUsesStack();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -103,7 +103,7 @@ public class SimulatedPlayer2 extends ComputerPlayer {
|
|||
if (logger.isTraceEnabled()) {
|
||||
for (Ability a : allActions) {
|
||||
logger.info("ability==" + a);
|
||||
if (a.getTargets().size() > 0) {
|
||||
if (!a.getTargets().isEmpty()) {
|
||||
MageObject mageObject = game.getObject(a.getFirstTarget());
|
||||
if (mageObject != null) {
|
||||
logger.info(" target=" + mageObject.getName());
|
||||
|
@ -177,7 +177,7 @@ public class SimulatedPlayer2 extends ComputerPlayer {
|
|||
}
|
||||
card.adjustTargets(newAbility, game);
|
||||
// add the different possible target option for the specific X value
|
||||
if (newAbility.getTargets().getUnchosen().size() > 0) {
|
||||
if (!newAbility.getTargets().getUnchosen().isEmpty()) {
|
||||
addTargetOptions(options, newAbility, targetNum, game);
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ public class SimulatedPlayer2 extends ComputerPlayer {
|
|||
}
|
||||
List<Ability> filtered = new ArrayList<>();
|
||||
for (Ability option : options) {
|
||||
if (option.getTargets().size() > 0 && option.getTargets().get(0).getMaxNumberOfTargets() == 1) {
|
||||
if (!option.getTargets().isEmpty() && option.getTargets().get(0).getMaxNumberOfTargets() == 1) {
|
||||
Card card = game.getCard(ability.getSourceId());
|
||||
for (String s : suggested) {
|
||||
String[] groups = s.split(";");
|
||||
|
|
|
@ -212,7 +212,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
if (target.getOriginalTarget() instanceof TargetDiscard) {
|
||||
findPlayables(game);
|
||||
if (unplayable.size() > 0) {
|
||||
if (!unplayable.isEmpty()) {
|
||||
for (int i = unplayable.size() - 1; i >= 0; i--) {
|
||||
if (target.canTarget(unplayable.values().toArray(new Card[0])[i].getId(), game)) {
|
||||
target.add(unplayable.values().toArray(new Card[0])[i].getId(), game);
|
||||
|
@ -222,7 +222,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (hand.size() > 0) {
|
||||
if (!hand.isEmpty()) {
|
||||
for (int i = 0; i < hand.size(); i++) {
|
||||
if (target.canTarget(hand.toArray(new UUID[0])[i], game)) {
|
||||
target.add(hand.toArray(new UUID[0])[i], game);
|
||||
|
@ -467,7 +467,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
Cards cards = new CardsImpl(target.possibleTargets(source.getSourceId(), getId(), game));
|
||||
ArrayList<Card> cardsInHand = new ArrayList<>(cards.getCards(game));
|
||||
while (!target.isChosen()
|
||||
&& target.possibleTargets(source.getSourceId(), getId(), game).size() > 0
|
||||
&& !target.possibleTargets(source.getSourceId(), getId(), game).isEmpty()
|
||||
&& target.getMaxNumberOfTargets() > target.getTargets().size()) {
|
||||
Card card = pickBestCard(cardsInHand, null, target, source, game);
|
||||
if (card != null) {
|
||||
|
@ -482,7 +482,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
} else {
|
||||
findPlayables(game);
|
||||
if (unplayable.size() > 0) {
|
||||
if (!unplayable.isEmpty()) {
|
||||
for (int i = unplayable.size() - 1; i >= 0; i--) {
|
||||
if (target.canTarget(getId(), unplayable.values().toArray(new Card[0])[i].getId(), source, game)) {
|
||||
target.addTarget(unplayable.values().toArray(new Card[0])[i].getId(), source, game);
|
||||
|
@ -492,7 +492,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (hand.size() > 0) {
|
||||
if (!hand.isEmpty()) {
|
||||
for (int i = 0; i < hand.size(); i++) {
|
||||
if (target.canTarget(getId(), hand.toArray(new UUID[0])[i], source, game)) {
|
||||
target.addTarget(hand.toArray(new UUID[0])[i], source, game);
|
||||
|
@ -674,7 +674,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
return target.isChosen();
|
||||
}
|
||||
if (target.getOriginalTarget() instanceof TargetSpell) {
|
||||
if (game.getStack().size() > 0) {
|
||||
if (!game.getStack().isEmpty()) {
|
||||
Iterator<StackObject> it = game.getStack().iterator();
|
||||
while (it.hasNext()) {
|
||||
StackObject o = it.next();
|
||||
|
@ -708,7 +708,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (game.getStack().size() > 0) {
|
||||
if (!game.getStack().isEmpty()) {
|
||||
Iterator<StackObject> it = game.getStack().iterator();
|
||||
while (it.hasNext()) {
|
||||
StackObject stackObject = it.next();
|
||||
|
@ -878,7 +878,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
break;
|
||||
case PRECOMBAT_MAIN:
|
||||
findPlayables(game);
|
||||
if (playableAbilities.size() > 0) {
|
||||
if (!playableAbilities.isEmpty()) {
|
||||
for (ActivatedAbility ability : playableAbilities) {
|
||||
if (ability.canActivate(playerId, game)) {
|
||||
if (ability.getEffects().hasOutcome(Outcome.PutLandInPlay)) {
|
||||
|
@ -909,7 +909,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
case POSTCOMBAT_MAIN:
|
||||
findPlayables(game);
|
||||
if (game.getStack().isEmpty()) {
|
||||
if (playableNonInstant.size() > 0) {
|
||||
if (!playableNonInstant.isEmpty()) {
|
||||
for (Card card : playableNonInstant) {
|
||||
if (card.getSpellAbility().canActivate(playerId, game)) {
|
||||
if (this.activateAbility(card.getSpellAbility(), game)) {
|
||||
|
@ -918,7 +918,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (playableAbilities.size() > 0) {
|
||||
if (!playableAbilities.isEmpty()) {
|
||||
for (ActivatedAbility ability : playableAbilities) {
|
||||
if (ability.canActivate(playerId, game)) {
|
||||
if (!(ability.getEffects().get(0) instanceof BecomesCreatureSourceEffect)) {
|
||||
|
@ -975,7 +975,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
lands.add(landCard);
|
||||
}
|
||||
while (lands.size() > 0 && this.canPlayLand()) {
|
||||
while (!lands.isEmpty() && this.canPlayLand()) {
|
||||
if (lands.size() == 1) {
|
||||
this.playLand(lands.iterator().next(), game, false);
|
||||
} else {
|
||||
|
@ -1030,7 +1030,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
for (Card card : nonLands) {
|
||||
ManaOptions options = card.getManaCost().getOptions();
|
||||
if (card.getManaCost().getVariableCosts().size() > 0) {
|
||||
if (!card.getManaCost().getVariableCosts().isEmpty()) {
|
||||
//don't use variable mana costs unless there is at least 3 extra mana for X
|
||||
for (Mana option : options) {
|
||||
option.add(Mana.GenericMana(3));
|
||||
|
@ -1062,7 +1062,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
continue;
|
||||
}
|
||||
ManaOptions abilityOptions = ability.getManaCosts().getOptions();
|
||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
|
||||
//don't use variable mana costs unless there is at least 3 extra mana for X
|
||||
for (Mana option : abilityOptions) {
|
||||
option.add(Mana.GenericMana(3));
|
||||
|
@ -1386,7 +1386,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) {
|
||||
if (game.getOpponents(this.getId()).contains(permanent.getControllerId())
|
||||
&& permanent.getCardType().contains(CardType.CREATURE)
|
||||
&& permanent.getSubtype(game).size() > 0) {
|
||||
&& !permanent.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(permanent.getSubtype(game).get(0))) {
|
||||
choice.setChoice(permanent.getSubtype(game).get(0));
|
||||
break;
|
||||
|
@ -1398,7 +1398,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (UUID opponentId : game.getOpponents(this.getId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
for (Card card : opponent.getGraveyard().getCards(game)) {
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) {
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0))) {
|
||||
choice.setChoice(card.getSubtype(game).get(0));
|
||||
break;
|
||||
|
@ -1414,7 +1414,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
// choose a creature type of hand or library
|
||||
for (UUID cardId : this.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) {
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0))) {
|
||||
choice.setChoice(card.getSubtype(game).get(0));
|
||||
break;
|
||||
|
@ -1424,7 +1424,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
if (!choice.isChosen()) {
|
||||
for (UUID cardId : this.getLibrary().getCardList()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && card.getSubtype(game).size() > 0) {
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0))) {
|
||||
choice.setChoice(card.getSubtype(game).get(0));
|
||||
break;
|
||||
|
@ -1545,7 +1545,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
MageObject object = game.getObject(ability.getSourceId());
|
||||
if (object != null) {
|
||||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game);
|
||||
if (useableAbilities != null && useableAbilities.size() > 0) {
|
||||
if (useableAbilities != null && !useableAbilities.isEmpty()) {
|
||||
game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values()));
|
||||
// TODO: Improve this
|
||||
return (SpellAbility) useableAbilities.values().iterator().next();
|
||||
|
@ -1584,7 +1584,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
public TriggeredAbility chooseTriggeredAbility(List<TriggeredAbility> abilities, Game game) {
|
||||
log.debug("chooseTriggeredAbility: " + abilities.toString());
|
||||
//TODO: improve this
|
||||
if (abilities.size() > 0) {
|
||||
if (!abilities.isEmpty()) {
|
||||
return abilities.get(0);
|
||||
}
|
||||
return null;
|
||||
|
@ -1729,7 +1729,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
@Override
|
||||
public void construct(Tournament tournament, Deck deck) {
|
||||
if (deck != null && deck.getCards().size() < 40 && deck.getSideboard().size() > 0) {
|
||||
if (deck != null && deck.getCards().size() < 40 && !deck.getSideboard().isEmpty()) {
|
||||
//pick the top 23 cards
|
||||
if (chosenColors == null) {
|
||||
for (Card card : deck.getSideboard()) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MCTSPlayer extends ComputerPlayer {
|
|||
private NextAction nextAction;
|
||||
|
||||
public enum NextAction {
|
||||
PRIORITY, SELECT_ATTACKERS, SELECT_BLOCKERS;
|
||||
PRIORITY, SELECT_ATTACKERS, SELECT_BLOCKERS
|
||||
}
|
||||
|
||||
public MCTSPlayer(UUID id) {
|
||||
|
@ -83,7 +83,7 @@ public class MCTSPlayer extends ComputerPlayer {
|
|||
for (Ability ability: playables) {
|
||||
List<Ability> options = game.getPlayer(playerId).getPlayableOptions(ability, game);
|
||||
if (options.isEmpty()) {
|
||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
|
||||
simulateVariableCosts(ability, all, game);
|
||||
}
|
||||
else {
|
||||
|
@ -92,7 +92,7 @@ public class MCTSPlayer extends ComputerPlayer {
|
|||
}
|
||||
else {
|
||||
for (Ability option: options) {
|
||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
|
||||
simulateVariableCosts(option, all, game);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -124,7 +124,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
|
|||
ability = options.get(RandomUtil.nextInt(options.size()));
|
||||
}
|
||||
}
|
||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
|
||||
int amount = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost();
|
||||
if (amount > 0) {
|
||||
ability = ability.copy();
|
||||
|
@ -221,7 +221,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
|
|||
int check = RandomUtil.nextInt(numGroups + 1);
|
||||
if (check < numGroups) {
|
||||
CombatGroup group = game.getCombat().getGroups().get(check);
|
||||
if (group.getAttackers().size() > 0) {
|
||||
if (!group.getAttackers().isEmpty()) {
|
||||
this.declareBlocker(this.getId(), blocker.getId(), group.getAttackers().get(0), game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
else
|
||||
addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s");
|
||||
if (root.children.size() > 0) {
|
||||
if (!root.children.isEmpty()) {
|
||||
root = root.children.get(0);
|
||||
actions = new LinkedList<Ability>(root.abilities);
|
||||
combat = root.combat;
|
||||
|
@ -174,10 +174,10 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
}
|
||||
|
||||
protected boolean getNextAction(Game game) {
|
||||
if (root != null && root.children.size() > 0) {
|
||||
if (root != null && !root.children.isEmpty()) {
|
||||
SimulationNode test = root;
|
||||
root = root.children.get(0);
|
||||
while (root.children.size() > 0 && !root.playerId.equals(playerId)) {
|
||||
while (!root.children.isEmpty() && !root.playerId.equals(playerId)) {
|
||||
test = root;
|
||||
root = root.children.get(0);
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
logger.debug(indent(node.depth) + "simulating -- reached end state");
|
||||
val = GameStateEvaluator.evaluate(playerId, game);
|
||||
}
|
||||
else if (node.getChildren().size() > 0) {
|
||||
else if (!node.getChildren().isEmpty()) {
|
||||
logger.debug(indent(node.depth) + "simulating -- somthing added children:" + node.getChildren().size());
|
||||
val = minimaxAB(node, alpha, beta);
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
if (game.gameOver(null)) {
|
||||
val = GameStateEvaluator.evaluate(playerId, game);
|
||||
}
|
||||
else if (node.getChildren().size() > 0) {
|
||||
else if (!node.getChildren().isEmpty()) {
|
||||
//declared attackers or blockers or triggered abilities
|
||||
logger.debug(indent(node.depth) + "simulating -- attack/block/trigger added children:" + node.getChildren().size());
|
||||
val = minimaxAB(node, alpha, beta);
|
||||
|
@ -430,9 +430,9 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
alpha = val;
|
||||
bestNode = newNode;
|
||||
node.setCombat(newNode.getCombat());
|
||||
if (node.getTargets().size() > 0)
|
||||
if (!node.getTargets().isEmpty())
|
||||
targets = node.getTargets();
|
||||
if (node.getChoices().size() > 0)
|
||||
if (!node.getChoices().isEmpty())
|
||||
choices = node.getChoices();
|
||||
}
|
||||
if (val == GameStateEvaluator.WIN_SCORE) {
|
||||
|
@ -673,7 +673,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
|||
@Override
|
||||
public void selectBlockers(Game game, UUID defendingPlayerId) {
|
||||
logger.debug("selectBlockers");
|
||||
if (combat != null && combat.getGroups().size() > 0) {
|
||||
if (combat != null && !combat.getGroups().isEmpty()) {
|
||||
List<CombatGroup> groups = game.getCombat().getGroups();
|
||||
for (int i = 0; i < groups.size(); i++) {
|
||||
if (i < combat.getGroups().size()) {
|
||||
|
|
|
@ -139,7 +139,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
else
|
||||
addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s");
|
||||
if (root.children.size() > 0) {
|
||||
if (!root.children.isEmpty()) {
|
||||
root = root.children.get(0);
|
||||
actions = new LinkedList<Ability>(root.abilities);
|
||||
combat = root.combat;
|
||||
|
@ -163,7 +163,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
else
|
||||
addActions(root, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
logger.info(name + " simulated " + nodeCount + " nodes in " + thinkTime/1000000000.0 + "s - average " + nodeCount/(thinkTime/1000000000.0) + " nodes/s");
|
||||
if (root.children.size() > 0) {
|
||||
if (!root.children.isEmpty()) {
|
||||
root = root.children.get(0);
|
||||
actions = new LinkedList<Ability>(root.abilities);
|
||||
combat = root.combat;
|
||||
|
@ -189,7 +189,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
logger.debug(indent(node.depth) + "simulating -- reached end state");
|
||||
val = GameStateEvaluator.evaluate(playerId, game);
|
||||
}
|
||||
else if (node.getChildren().size() > 0) {
|
||||
else if (!node.getChildren().isEmpty()) {
|
||||
logger.debug(indent(node.depth) + "simulating -- somthing added children:" + node.getChildren().size());
|
||||
val = minimaxAB(node, alpha, beta);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
val = GameStateEvaluator.evaluate(playerId, game);
|
||||
}
|
||||
}
|
||||
else if (node.getChildren().size() > 0) {
|
||||
else if (!node.getChildren().isEmpty()) {
|
||||
logger.debug(indent(node.depth) + "simulating -- trigger added children:" + node.getChildren().size());
|
||||
val = minimaxAB(node, alpha, beta);
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
|||
}
|
||||
Game sim = game.copy();
|
||||
for (CombatGroup group: engagement.getGroups()) {
|
||||
if (group.getAttackers().size() > 0) {
|
||||
if (!group.getAttackers().isEmpty()) {
|
||||
UUID attackerId = group.getAttackers().get(0);
|
||||
for (UUID blockerId: group.getBlockers()) {
|
||||
sim.getPlayer(defenderId).declareBlocker(defenderId, blockerId, attackerId, sim);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class SimulatedAction {
|
|||
}
|
||||
|
||||
public boolean usesStack() {
|
||||
if (abilities != null && abilities.size() > 0) {
|
||||
if (abilities != null && !abilities.isEmpty()) {
|
||||
return abilities.get(abilities.size() -1).isUsesStack();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -90,7 +90,7 @@ public class SimulatedPlayer extends ComputerPlayer {
|
|||
for (Ability ability: playables) {
|
||||
List<Ability> options = game.getPlayer(playerId).getPlayableOptions(ability, game);
|
||||
if (options.isEmpty()) {
|
||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
|
||||
simulateVariableCosts(ability, game);
|
||||
}
|
||||
else {
|
||||
|
@ -101,7 +101,7 @@ public class SimulatedPlayer extends ComputerPlayer {
|
|||
else {
|
||||
// ExecutorService simulationExecutor = Executors.newFixedThreadPool(4);
|
||||
for (Ability option: options) {
|
||||
if (ability.getManaCosts().getVariableCosts().size() > 0) {
|
||||
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
|
||||
simulateVariableCosts(option, game);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -726,7 +726,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
if (actingPlayer != null) {
|
||||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = actingPlayer.getUseableActivatedAbilities(object, zone, game);
|
||||
if (useableAbilities != null && useableAbilities.size() > 0) {
|
||||
if (useableAbilities != null && !useableAbilities.isEmpty()) {
|
||||
activateAbility(useableAbilities, object, game);
|
||||
result = true;
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
Zone zone = game.getState().getZone(object.getId());
|
||||
if (zone != null) {
|
||||
LinkedHashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = getUseableManaAbilities(object, zone, game);
|
||||
if (useableAbilities != null && useableAbilities.size() > 0) {
|
||||
if (useableAbilities != null && !useableAbilities.isEmpty()) {
|
||||
useableAbilities = ManaUtil.tryToAutoPay(unpaid, useableAbilities); // eliminates other abilities if one fits perfectly
|
||||
currentlyUnpaidMana = unpaid;
|
||||
activateAbility(useableAbilities, object, game);
|
||||
|
@ -940,7 +940,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
}
|
||||
options.put(Constants.Option.POSSIBLE_ATTACKERS, (Serializable) possibleAttackers);
|
||||
if (possibleAttackers.size() > 0) {
|
||||
if (!possibleAttackers.isEmpty()) {
|
||||
options.put(Constants.Option.SPECIAL_BUTTON, (Serializable) "All attack");
|
||||
}
|
||||
|
||||
|
@ -1330,7 +1330,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game);
|
||||
if (useableAbilities != null && useableAbilities.size() == 1) {
|
||||
return (SpellAbility) useableAbilities.values().iterator().next();
|
||||
} else if (useableAbilities != null && useableAbilities.size() > 0) {
|
||||
} else if (useableAbilities != null && !useableAbilities.isEmpty()) {
|
||||
game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values()));
|
||||
waitForResponse(game);
|
||||
if (response.getUUID() != null) {
|
||||
|
@ -1378,7 +1378,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
modeMap.put(mode.getId(), modeText);
|
||||
}
|
||||
}
|
||||
if (modeMap.size() > 0) {
|
||||
if (!modeMap.isEmpty()) {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
game.fireGetModeEvent(playerId, "Choose Mode", modeMap);
|
||||
|
|
|
@ -564,7 +564,7 @@ public class User {
|
|||
if (tournament > 0) {
|
||||
sb.append("Tourn: ").append(tournament).append(' ');
|
||||
}
|
||||
if (watchedGames.size() > 0) {
|
||||
if (!watchedGames.isEmpty()) {
|
||||
sb.append("Watch: ").append(watchedGames.size()).append(' ');
|
||||
}
|
||||
return sb.toString();
|
||||
|
@ -665,7 +665,7 @@ public class User {
|
|||
if (proto.getMatchesQuit() > 0) {
|
||||
quit.add("Q:" + Integer.toString(proto.getMatchesQuit()));
|
||||
}
|
||||
if (quit.size() > 0) {
|
||||
if (!quit.isEmpty()) {
|
||||
builder.append(" (");
|
||||
joinStrings(builder, quit, " ");
|
||||
builder.append(')');
|
||||
|
@ -697,7 +697,7 @@ public class User {
|
|||
if (proto.getTourneysQuitDuringRound() > 0) {
|
||||
quit.add("R:" + Integer.toString(proto.getTourneysQuitDuringRound()));
|
||||
}
|
||||
if (quit.size() > 0) {
|
||||
if (!quit.isEmpty()) {
|
||||
builder.append(" (");
|
||||
joinStrings(builder, quit, " ");
|
||||
builder.append(')');
|
||||
|
|
|
@ -236,7 +236,7 @@ public class GameController implements GameCallback {
|
|||
break;
|
||||
case CHOOSE_ABILITY:
|
||||
String objectName = null;
|
||||
if (event.getChoices() != null && event.getChoices().size() > 0) {
|
||||
if (event.getChoices() != null && !event.getChoices().isEmpty()) {
|
||||
objectName = event.getChoices().iterator().next();
|
||||
}
|
||||
chooseAbility(event.getPlayerId(), objectName, event.getAbilities());
|
||||
|
@ -816,7 +816,7 @@ public class GameController implements GameCallback {
|
|||
private void informOthers(List<UUID> players) throws MageException {
|
||||
// first player is always original controller
|
||||
Player controller = null;
|
||||
if (players != null && players.size() > 0) {
|
||||
if (players != null && !players.isEmpty()) {
|
||||
controller = game.getPlayer(players.get(0));
|
||||
}
|
||||
if (controller == null || game.getStep() == null || game.getStep().getType() == null) {
|
||||
|
|
|
@ -86,7 +86,6 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
if (!killed) {
|
||||
UserManager.getInstance().getUser(userId).ifPresent(user -> user.fireCallback(new ClientCallback("gameSelect", game.getId(), new GameClientMessage(getGameView(), message, options))));
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
public void chooseAbility(final AbilityPickerView abilities) {
|
||||
|
@ -232,7 +231,7 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
}
|
||||
|
||||
private void processControlledPlayers(Player player, GameView gameView) {
|
||||
if (player.getPlayersUnderYourControl().size() > 0) {
|
||||
if (!player.getPlayersUnderYourControl().isEmpty()) {
|
||||
Map<String, SimpleCardsView> handCards = new HashMap<>();
|
||||
for (UUID controlledPlayerId : player.getPlayersUnderYourControl()) {
|
||||
Player opponent = game.getPlayer(controlledPlayerId);
|
||||
|
|
|
@ -98,7 +98,7 @@ class ActOnImpulseExileEffect extends OneShotEffect {
|
|||
cards.add(card);
|
||||
}
|
||||
}
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
List<UUID> cardsId = new ArrayList<>();
|
||||
for (Card card : cards) {
|
||||
card.moveToExile(source.getSourceId(), "Act on Impulse", source.getSourceId(), game);
|
||||
|
|
|
@ -96,7 +96,7 @@ class AgonizingMemoriesEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) {
|
||||
if (targetPlayer.getHand().size() > 0) {
|
||||
if (!targetPlayer.getHand().isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to put on the top of library (last chosen will be on top)"));
|
||||
if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
|
||||
Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
|
||||
|
|
|
@ -121,7 +121,7 @@ class AladdinsLampEffect extends ReplacementEffectImpl {
|
|||
|
||||
|
||||
// Put the rest on the bottom of your library in a random order
|
||||
while (cards.size() > 0) {
|
||||
while (!cards.isEmpty()) {
|
||||
Card card = cards.getRandom(game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
|
|
|
@ -95,7 +95,7 @@ class AltarOfDementiaEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
int amount = 0;
|
||||
for (Cost cost: source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) {
|
||||
if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) {
|
||||
amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class AmassTheComponentsEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
player.drawCards(3, game);
|
||||
if (player.getHand().size() > 0) {
|
||||
if (!player.getHand().isEmpty()) {
|
||||
FilterCard filter = new FilterCard("card from your hand to put on the bottom of your library");
|
||||
TargetCard target = new TargetCard(Zone.HAND, filter);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class AncestralMemoriesEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
player.lookAtCards("Ancestral Memories", cards, game);
|
||||
|
||||
TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand"));
|
||||
|
|
|
@ -106,7 +106,7 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
filter.add(new AnotherPredicate());
|
||||
TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, 3, filter, false);
|
||||
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target1, this, game);
|
||||
if (target1.getTargets().size() > 0) {
|
||||
if (!target1.getTargets().isEmpty()) {
|
||||
getTargets().add(target1);
|
||||
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
FilterCard filter2 = new FilterCreatureCard("up to " + leftTargets + " target creature card" + (leftTargets > 1 ? "s" : "") + " from graveyards");
|
||||
TargetCardInGraveyard target2 = new TargetCardInGraveyard(0, leftTargets, filter2);
|
||||
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target2, this, game);
|
||||
if (target2.getTargets().size() > 0) {
|
||||
if (!target2.getTargets().isEmpty()) {
|
||||
getTargets().add(target2);
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ class AngelOfSerenityEnterEffect extends OneShotEffect {
|
|||
boolean result = true;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null && source.getTargets().size() > 0) {
|
||||
if (controller != null && sourceObject != null && !source.getTargets().isEmpty()) {
|
||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
||||
for (Target target : source.getTargets()) {
|
||||
if (target instanceof TargetCreaturePermanent) {
|
||||
|
|
|
@ -109,7 +109,7 @@ class AngelicArbiterWatcher2 extends Watcher {
|
|||
&& game.getActivePlayerId().equals(event.getPlayerId())
|
||||
&& game.getOpponents(controllerId).contains(event.getPlayerId())
|
||||
&& game.getCombat().getAttackerId().equals(event.getPlayerId())
|
||||
&& game.getCombat().getAttackers().size() > 0) {
|
||||
&& !game.getCombat().getAttackers().isEmpty()) {
|
||||
playersThatAttackedThisTurn.add(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class AnimalBoneyardEffect extends OneShotEffect {
|
|||
int toughness = 0;
|
||||
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) {
|
||||
if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) {
|
||||
toughness = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ class AnimationModuleEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
if (permanent.getCounters(game).size() > 0) {
|
||||
if (!permanent.getCounters(game).isEmpty()) {
|
||||
if (permanent.getCounters(game).size() == 1) {
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
|
@ -172,7 +172,7 @@ class AnimationModuleEffect extends OneShotEffect {
|
|||
else {
|
||||
Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
if (player.getCounters().size() > 0) {
|
||||
if (!player.getCounters().isEmpty()) {
|
||||
if (player.getCounters().size() == 1) {
|
||||
for (Counter counter : player.getCounters().values()) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
|
|
|
@ -93,7 +93,7 @@ class AnimistsAwakeningEffect extends OneShotEffect {
|
|||
Cards cards = new CardsImpl();
|
||||
int xValue = source.getManaCostsToPay().getX();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, xValue));
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
Set<Card> toBattlefield = new LinkedHashSet<>();
|
||||
for (Card card : cards.getCards(new FilterLandCard(), source.getSourceId(), source.getControllerId(), game)) {
|
||||
|
|
|
@ -127,7 +127,7 @@ class AnyaMercilessAngelCondition implements Condition {
|
|||
|
||||
public static AnyaMercilessAngelCondition getInstance() {
|
||||
return fInstance;
|
||||
};
|
||||
}
|
||||
|
||||
private AnyaMercilessAngelCondition() {}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCardInExile {
|
|||
if (sourceCard != null) {
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, sourceId);
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null && exile.size() > 0) {
|
||||
if (exile != null && !exile.isEmpty()) {
|
||||
possibleTargets.addAll(exile);
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCardInExile {
|
|||
if (sourceCard != null) {
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, sourceId);
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null && exile.size() > 0) {
|
||||
if (exile != null && !exile.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class BirthingPodEffect extends OneShotEffect {
|
|||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost) {
|
||||
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
|
||||
if (sacrificeCost.getPermanents().size() > 0) {
|
||||
if (!sacrificeCost.getPermanents().isEmpty()) {
|
||||
sacrificedPermanent = sacrificeCost.getPermanents().get(0);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -97,7 +97,7 @@ class BitterRevelationEffect extends OneShotEffect {
|
|||
cards.add(card);
|
||||
}
|
||||
}
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
Cards cardsToHand = new CardsImpl();
|
||||
player.lookAtCards("Bitter Revelation", cards, game);
|
||||
TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand"));
|
||||
|
|
|
@ -127,7 +127,7 @@ class BlessedReincarnationEffect extends OneShotEffect {
|
|||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId());
|
||||
}
|
||||
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
player.revealCards("BlessedReincarnation", cards, game);
|
||||
Set<Card> cardsToShuffle = cards.getCards(game);
|
||||
cardsToShuffle.remove(card);
|
||||
|
|
|
@ -136,7 +136,7 @@ class BorderlandExplorerEffect extends OneShotEffect {
|
|||
if (cardsPlayer != null) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, new FilterBasicLandCard());
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards cards = new CardsImpl(target.getTargets());
|
||||
cards.addAll(target.getTargets());
|
||||
cardsToReveal.put(playerId, cards);
|
||||
|
|
|
@ -110,7 +110,7 @@ class BrionStoutarmEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
int amount = 0;
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) {
|
||||
if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) {
|
||||
amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class BrowseEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
player.lookAtCards("Browse", cards, game);
|
||||
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand"));
|
||||
|
|
|
@ -278,7 +278,7 @@ class ChandraPyromasterEffect3 extends OneShotEffect {
|
|||
cards.addAll(controller.getLibrary().getTopCards(game, 10));
|
||||
controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), sourceObject.getIdName());
|
||||
|
||||
if (cards.getCards(new FilterInstantOrSorceryCard(), game).size() > 0) {
|
||||
if (!cards.getCards(new FilterInstantOrSorceryCard(), game).isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.EXILED, new FilterInstantOrSorceryCard());
|
||||
if (controller.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) {
|
||||
Card card = cards.get(target.getFirstTarget(), game);
|
||||
|
|
|
@ -96,7 +96,7 @@ class ChimneyImpEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (targetOpponent != null) {
|
||||
if (targetOpponent.getHand().size() > 0) {
|
||||
if (!targetOpponent.getHand().isEmpty()) {
|
||||
TargetCardInHand target = new TargetCardInHand();
|
||||
target.setNotTarget(true);
|
||||
target.setTargetName("a card from your hand to put on top of your library");
|
||||
|
|
|
@ -93,7 +93,7 @@ class ChitteringRatsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (targetOpponent != null) {
|
||||
if (targetOpponent.getHand().size() > 0) {
|
||||
if (!targetOpponent.getHand().isEmpty()) {
|
||||
TargetCardInHand target = new TargetCardInHand();
|
||||
target.setNotTarget(true);
|
||||
target.setTargetName("a card from your hand to put on top of your library");
|
||||
|
|
|
@ -107,7 +107,7 @@ class ChromeMoxEffect extends OneShotEffect {
|
|||
target.setNotTarget(true);
|
||||
Card cardToImprint = null;
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller.getHand().size() > 0 && controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
|
||||
if (!controller.getHand().isEmpty() && controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
|
||||
cardToImprint = controller.getHand().get(target.getFirstTarget(), game);
|
||||
}
|
||||
if (sourcePermanent != null) {
|
||||
|
@ -154,7 +154,7 @@ class ChromeMoxManaEffect extends ManaEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (permanent != null && player != null) {
|
||||
List<UUID> imprinted = permanent.getImprinted();
|
||||
if (imprinted.size() > 0) {
|
||||
if (!imprinted.isEmpty()) {
|
||||
Card imprintedCard = game.getCard(imprinted.get(0));
|
||||
if (imprintedCard != null) {
|
||||
Choice choice = new ChoiceColor(true);
|
||||
|
@ -177,7 +177,7 @@ class ChromeMoxManaEffect extends ManaEffect {
|
|||
choice.getChoices().add("White");
|
||||
}
|
||||
|
||||
if (choice.getChoices().size() > 0) {
|
||||
if (!choice.getChoices().isEmpty()) {
|
||||
Mana mana = new Mana();
|
||||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
|
|
|
@ -60,7 +60,7 @@ public class CircleOfProtectionWhite extends CardImpl {
|
|||
|
||||
// {1}: The next time a white source of your choice would deal damage to you this turn, prevent that damage.
|
||||
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));;
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("1")));
|
||||
}
|
||||
|
||||
public CircleOfProtectionWhite(final CircleOfProtectionWhite card) {
|
||||
|
|
|
@ -106,7 +106,7 @@ class CitanulFluteSearchEffect extends OneShotEffect {
|
|||
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
Cards cards = new CardsImpl();
|
||||
if (card != null){
|
||||
|
|
|
@ -94,7 +94,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
|
|||
|
||||
private Counter selectCounterType(Game game, Ability source, Permanent permanent) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && permanent.getCounters(game).size() > 0) {
|
||||
if (controller != null && !permanent.getCounters(game).isEmpty()) {
|
||||
String counterName = null;
|
||||
if (permanent.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
|
@ -122,7 +122,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
|
|||
|
||||
private Counter selectCounterType(Game game, Ability source, Card card) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && card.getCounters(game).size() > 0) {
|
||||
if (controller != null && !card.getCounters(game).isEmpty()) {
|
||||
String counterName = null;
|
||||
if (card.getCounters(game).size() > 1) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
|
|
|
@ -120,7 +120,7 @@ class CloneShellEffect extends OneShotEffect {
|
|||
target1.clearChosen();
|
||||
}
|
||||
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter2);
|
||||
while (player.canRespond() && cards.size() > 1) {
|
||||
player.choose(Outcome.Benefit, cards, target2, game);
|
||||
|
@ -163,7 +163,7 @@ class CloneShellDiesEffect extends OneShotEffect {
|
|||
Permanent permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
if (permanent != null) {
|
||||
List<UUID> imprinted = permanent.getImprinted();
|
||||
if (imprinted.size() > 0) {
|
||||
if (!imprinted.isEmpty()) {
|
||||
Card imprintedCard = game.getCard(imprinted.get(0));
|
||||
imprintedCard.setFaceDown(false, game);
|
||||
if (imprintedCard.getCardType().contains(CardType.CREATURE)) {
|
||||
|
|
|
@ -117,7 +117,7 @@ class CobraTrapWatcher extends Watcher {
|
|||
if (event.getType() == EventType.DESTROYED_PERMANENT) {
|
||||
Permanent perm = (Permanent) game.getPermanentOrLKIBattlefield(event.getTargetId()); // can regenerate or be indestructible
|
||||
if (perm != null && !perm.getCardType().contains(CardType.CREATURE)) {
|
||||
if (game.getStack().size() > 0) {
|
||||
if (!game.getStack().isEmpty()) {
|
||||
StackObject spell = game.getStack().getStackObject(event.getSourceId());
|
||||
if (spell != null && game.getOpponents(perm.getControllerId()).contains(spell.getControllerId())) {
|
||||
players.add(perm.getControllerId());
|
||||
|
|
|
@ -109,7 +109,7 @@ class ConfluxEffect extends OneShotEffect {
|
|||
|
||||
if (you != null && you.getLibrary().size() > 0) {
|
||||
if (you.searchLibrary(targetWhite, game)) {
|
||||
if (targetWhite.getTargets().size() > 0) {
|
||||
if (!targetWhite.getTargets().isEmpty()) {
|
||||
for (UUID cardId : (List<UUID>) targetWhite.getTargets()) {
|
||||
Card card = you.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
|
@ -121,7 +121,7 @@ class ConfluxEffect extends OneShotEffect {
|
|||
}
|
||||
if (you != null && you.getLibrary().size() > 0) {
|
||||
if (you.searchLibrary(targetBlue, game)) {
|
||||
if (targetBlue.getTargets().size() > 0) {
|
||||
if (!targetBlue.getTargets().isEmpty()) {
|
||||
for (UUID cardId : (List<UUID>) targetBlue.getTargets()) {
|
||||
Card card = you.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
|
@ -133,7 +133,7 @@ class ConfluxEffect extends OneShotEffect {
|
|||
}
|
||||
if (you != null && you.getLibrary().size() > 0) {
|
||||
if (you.searchLibrary(targetBlack, game)) {
|
||||
if (targetBlack.getTargets().size() > 0) {
|
||||
if (!targetBlack.getTargets().isEmpty()) {
|
||||
for (UUID cardId : (List<UUID>) targetBlack.getTargets()) {
|
||||
Card card = you.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
|
@ -145,7 +145,7 @@ class ConfluxEffect extends OneShotEffect {
|
|||
}
|
||||
if (you != null && you.getLibrary().size() > 0) {
|
||||
if (you.searchLibrary(targetRed, game)) {
|
||||
if (targetRed.getTargets().size() > 0) {
|
||||
if (!targetRed.getTargets().isEmpty()) {
|
||||
for (UUID cardId : (List<UUID>) targetRed.getTargets()) {
|
||||
Card card = you.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
|
@ -157,7 +157,7 @@ class ConfluxEffect extends OneShotEffect {
|
|||
}
|
||||
if (you != null && you.getLibrary().size() > 0) {
|
||||
if (you.searchLibrary(targetGreen, game)) {
|
||||
if (targetGreen.getTargets().size() > 0) {
|
||||
if (!targetGreen.getTargets().isEmpty()) {
|
||||
for (UUID cardId : (List<UUID>) targetGreen.getTargets()) {
|
||||
Card card = you.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class CongregationAtDawnEffect extends OneShotEffect {
|
|||
if (controller != null && sourceObject != null) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCreatureCard("creature cards"));
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards revealed = new CardsImpl();
|
||||
for (UUID cardId : (List<UUID>) target.getTargets()) {
|
||||
Card card = controller.getLibrary().remove(cardId, game);
|
||||
|
|
|
@ -97,7 +97,7 @@ class SearchLibraryPutInGraveyard extends SearchEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
|
|
|
@ -136,7 +136,7 @@ class CorruptedGrafstoneManaEffect extends ManaEffect {
|
|||
if (types.getWhite() > 0) {
|
||||
choice.getChoices().add("White");
|
||||
}
|
||||
if (choice.getChoices().size() > 0) {
|
||||
if (!choice.getChoices().isEmpty()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (player != null) {
|
||||
|
|
|
@ -98,7 +98,7 @@ class CultivateEffect extends OneShotEffect {
|
|||
}
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards revealed = new CardsImpl();
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = controller.getLibrary().getCard(cardId, game);
|
||||
|
|
|
@ -140,7 +140,7 @@ class CurseOfChaosEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player attacker = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (attacker != null) {
|
||||
if (attacker.getHand().size() > 0 && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)){
|
||||
if (!attacker.getHand().isEmpty() && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)){
|
||||
attacker.discard(1, false, source, game);
|
||||
attacker.drawCards(1, game);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ class CurseOfEchoesEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (mode.getTargets().size() > 0) {
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
return "Copy target " + mode.getTargets().get(0).getTargetName() + ". You may choose new targets for the copy";
|
||||
}
|
||||
return "No target";
|
||||
|
|
|
@ -93,7 +93,7 @@ class CursedScrollEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
|
||||
if (sourceObject != null && controller != null && cardName != null && !cardName.isEmpty()) {
|
||||
if (controller.getHand().size() > 0) {
|
||||
if (!controller.getHand().isEmpty()) {
|
||||
Cards revealed = new CardsImpl();
|
||||
Card card = controller.getHand().getRandom(game);
|
||||
revealed.add(card);
|
||||
|
|
|
@ -261,7 +261,7 @@ class DanceOfTheDeadChangeAbilityEffect extends ContinuousEffectImpl implements
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = affectedObjectList.get(0).getPermanent(game);;
|
||||
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
|
||||
if (permanent != null) {
|
||||
Ability abilityToRemove = null;
|
||||
for (Ability ability : permanent.getAbilities()) {
|
||||
|
|
|
@ -116,7 +116,7 @@ class DarkSupplicantEffect extends OneShotEffect {
|
|||
// Library check
|
||||
if (player.chooseUse(Outcome.Benefit, "Do you want to search your library for Scion of Darkness?", source, game)) {
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
for (UUID cardId : (List<UUID>) target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -148,7 +148,7 @@ class TransmuteArtifactEffect extends SearchEffect {
|
|||
}
|
||||
}
|
||||
if (sacrifice && controller.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = controller.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -107,7 +107,7 @@ class DementiaSliverEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
|
||||
if (opponent != null && sourceObject != null && !cardName.isEmpty()) {
|
||||
if (opponent.getHand().size() > 0) {
|
||||
if (!opponent.getHand().isEmpty()) {
|
||||
Cards revealed = new CardsImpl();
|
||||
Card card = opponent.getHand().getRandom(game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -123,7 +123,7 @@ class DeployTheGatewatchEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// Put the rest on the bottom of your library in a random order
|
||||
while (cards.size() > 0) {
|
||||
while (!cards.isEmpty()) {
|
||||
Card card = cards.getRandom(game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
|
|
|
@ -95,11 +95,11 @@ class DescendantOfMasumaroEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
if (controller.getHand().size() > 0) {
|
||||
if (!controller.getHand().isEmpty()) {
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance(controller.getHand().size()), true).apply(game, source);
|
||||
}
|
||||
Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (targetOpponent != null && targetOpponent.getHand().size() > 0) {
|
||||
if (targetOpponent != null && !targetOpponent.getHand().isEmpty()) {
|
||||
sourcePermanent.removeCounters(CounterType.P1P1.getName(), targetOpponent.getHand().size(), game);
|
||||
game.informPlayers(controller.getLogName() + " removes " + targetOpponent.getHand().size() + " +1/+1 counters from " + sourcePermanent.getLogName());
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class DevoutInvocationEffect extends OneShotEffect {
|
|||
Map<String, Serializable> options = new HashMap<>();
|
||||
options.put("UI.right.btn.text", "Tapping complete");
|
||||
controller.choose(outcome, target, source.getControllerId(), game, options);
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
UUID creature = target.getFirstTarget();
|
||||
if (creature != null) {
|
||||
game.getPermanent(creature).tap(game);
|
||||
|
|
|
@ -120,7 +120,7 @@ class DimirCharmEffect extends OneShotEffect {
|
|||
cards.add(card);
|
||||
}
|
||||
}
|
||||
if(cards.size() > 0){
|
||||
if(!cards.isEmpty()){
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("Card to put back on top of library"));
|
||||
if(controller.chooseTarget(Outcome.Benefit, cards, target, source, game)){
|
||||
Card card = cards.get(target.getFirstTarget(), game);
|
||||
|
|
|
@ -108,7 +108,7 @@ class DimirMachinationsEffect extends OneShotEffect {
|
|||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
while (cards.size() > 0) {
|
||||
while (!cards.isEmpty()) {
|
||||
if (cards.size() == 1) {
|
||||
Card card = cards.get(cards.iterator().next(), game);
|
||||
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
|
||||
|
|
|
@ -125,7 +125,7 @@ class DivergentTransformationsEffect extends OneShotEffect {
|
|||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId());
|
||||
}
|
||||
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
player.revealCards(sourceObject.getIdName(), cards, game);
|
||||
Set<Card> cardsToShuffle = cards.getCards(game);
|
||||
cardsToShuffle.remove(card);
|
||||
|
|
|
@ -130,7 +130,7 @@ class DracoplasmEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
controller.chooseTarget(Outcome.Detriment, target, source, game);
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
int power = 0;
|
||||
int toughness = 0;
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
|
|
|
@ -121,7 +121,7 @@ class DralnusPetEffect extends OneShotEffect {
|
|||
&& permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||
int cmc = 0;
|
||||
for (Cost cost : spellAbility.getCosts()) {
|
||||
if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) {
|
||||
if (cost instanceof DiscardCardCost && !((DiscardCardCost) cost).getCards().isEmpty()) {
|
||||
cmc = ((DiscardCardCost) cost).getCards().get(0).getConvertedManaCost();
|
||||
}
|
||||
if (cmc > 0) {
|
||||
|
|
|
@ -143,7 +143,7 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
if(permanent.getImprinted().size() > 0){
|
||||
if(!permanent.getImprinted().isEmpty()){
|
||||
Card card = game.getCard(permanent.getImprinted().get(0));
|
||||
if(card != null && card.getCardType().contains(CardType.CREATURE))
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ class EldritchEvolutionEffect extends OneShotEffect {
|
|||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost) {
|
||||
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
|
||||
if (sacrificeCost.getPermanents().size() > 0) {
|
||||
if (!sacrificeCost.getPermanents().isEmpty()) {
|
||||
sacrificedPermanent = sacrificeCost.getPermanents().get(0);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -118,7 +118,7 @@ class EliteArcanistImprintEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player.getHand().size() > 0) {
|
||||
if (!player.getHand().isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, filter);
|
||||
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
|
||||
&& player.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
|
|
|
@ -105,7 +105,7 @@ class EndlessHorizonsEffect extends SearchEffect {
|
|||
if (you != null) {
|
||||
if (you.searchLibrary(target, game)) {
|
||||
UUID exileZone = CardUtil.getCardExileZoneId(game, source);
|
||||
if (target.getTargets().size() > 0) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = you.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class EpicExperimentEffect extends OneShotEffect {
|
|||
return true;
|
||||
}
|
||||
cardsToCast.addAll(epicExperimentExileZone.getCards(filter, source.getSourceId(), source.getControllerId(), game));
|
||||
while (cardsToCast.size() > 0) {
|
||||
while (!cardsToCast.isEmpty()) {
|
||||
if (!controller.chooseUse(Outcome.PlayForFree, "Cast (another) a card exiled with " + sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
||||
break;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue