* Fixed card type displaying order (fixes #6055).

This commit is contained in:
LevelX2 2020-06-15 21:11:54 +02:00
parent 4006e9e909
commit 2788eab082
24 changed files with 106 additions and 141 deletions

View file

@ -1,5 +1,14 @@
package mage.client.dialog; package mage.client.dialog;
import java.awt.*;
import java.beans.PropertyVetoException;
import java.util.EnumSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
import javax.swing.*;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import mage.client.cards.BigCard; import mage.client.cards.BigCard;
import mage.client.util.GUISizeHelper; import mage.client.util.GUISizeHelper;
import mage.client.util.ImageHelper; import mage.client.util.ImageHelper;
@ -13,15 +22,6 @@ import mage.view.SimpleCardsView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.mage.plugins.card.utils.impl.ImageManagerImpl; import org.mage.plugins.card.utils.impl.ImageManagerImpl;
import javax.swing.*;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import java.awt.*;
import java.beans.PropertyVetoException;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
/** /**
* @author BetaSteward_at_googlemail.com, JayDi85 * @author BetaSteward_at_googlemail.com, JayDi85
*/ */
@ -77,7 +77,7 @@ public class CardInfoWindowDialog extends MageDialog {
this.setClosable(false); this.setClosable(false);
break; break;
default: default:
// no icon yet // no icon yet
} }
this.setTitelBarToolTip(name); this.setTitelBarToolTip(name);
setGUISize(); setGUISize();
@ -174,13 +174,17 @@ public class CardInfoWindowDialog extends MageDialog {
Set<String> cardTypesPresent = new LinkedHashSet<String>() { Set<String> cardTypesPresent = new LinkedHashSet<String>() {
}; };
for (CardView card : cardsView.values()) { for (CardView card : cardsView.values()) {
Set<CardType> cardTypes = card.getCardTypes(); Set<CardType> cardTypes = EnumSet.noneOf(CardType.class);
cardTypes.addAll(card.getCardTypes());
for (CardType cardType : cardTypes) { for (CardType cardType : cardTypes) {
cardTypesPresent.add(cardType.toString()); cardTypesPresent.add(cardType.toString());
} }
} }
if (cardTypesPresent.isEmpty()) return 0; if (cardTypesPresent.isEmpty()) {
else return cardTypesPresent.size(); return 0;
} else {
return cardTypesPresent.size();
}
} }
/** /**

View file

@ -1,5 +1,13 @@
package mage.client.game; package mage.client.game;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.*;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import mage.cards.decks.importer.DckDeckImporter; import mage.cards.decks.importer.DckDeckImporter;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.SessionHandler; import mage.client.SessionHandler;
@ -15,6 +23,7 @@ import mage.client.util.gui.countryBox.CountryUtil;
import mage.components.ImagePanel; import mage.components.ImagePanel;
import mage.components.ImagePanelStyle; import mage.components.ImagePanelStyle;
import mage.constants.CardType; import mage.constants.CardType;
import static mage.constants.Constants.*;
import mage.constants.ManaType; import mage.constants.ManaType;
import mage.counters.Counter; import mage.counters.Counter;
import mage.counters.CounterType; import mage.counters.CounterType;
@ -23,17 +32,6 @@ import mage.utils.timer.PriorityTimer;
import mage.view.*; import mage.view.*;
import org.mage.card.arcane.ManaSymbols; import org.mage.card.arcane.ManaSymbols;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.*;
import static mage.constants.Constants.*;
/** /**
* Enhanced player pane. * Enhanced player pane.
* *
@ -42,7 +40,6 @@ import static mage.constants.Constants.*;
public class PlayerPanelExt extends javax.swing.JPanel { public class PlayerPanelExt extends javax.swing.JPanel {
// TODO: *.form file was lost, panel must be reworks in designer // TODO: *.form file was lost, panel must be reworks in designer
private UUID playerId; private UUID playerId;
private UUID gameId; private UUID gameId;
private PlayerView player; private PlayerView player;
@ -612,7 +609,6 @@ public class PlayerPanelExt extends javax.swing.JPanel {
manaCountLabelW.addMouseListener(manaMouseAdapter); manaCountLabelW.addMouseListener(manaMouseAdapter);
manaLabels.put(manaCountLabelW, ManaType.WHITE);l manaLabels.put(manaCountLabelW, ManaType.WHITE);l
//*/ //*/
///* ///*
JLabel manaCountLabelW = new JLabel(); JLabel manaCountLabelW = new JLabel();
manaCountLabelW.setToolTipText("White mana"); manaCountLabelW.setToolTipText("White mana");
@ -944,7 +940,8 @@ public class PlayerPanelExt extends javax.swing.JPanel {
Set<String> cardTypesPresent = new LinkedHashSet<String>() { Set<String> cardTypesPresent = new LinkedHashSet<String>() {
}; };
for (CardView card : cardsView.values()) { for (CardView card : cardsView.values()) {
Set<CardType> cardTypes = card.getCardTypes(); Set<CardType> cardTypes = EnumSet.noneOf(CardType.class);
cardTypes.addAll(card.getCardTypes());
for (CardType cardType : cardTypes) { for (CardType cardType : cardTypes) {
cardTypesPresent.add(cardType.toString()); cardTypesPresent.add(cardType.toString());
} }

View file

@ -1,14 +1,13 @@
package mage.view; package mage.view;
import java.util.ArrayList;
import java.util.EnumSet;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.EnumSet;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -29,7 +28,7 @@ public class AbilityView extends CardView {
this.power = ""; this.power = "";
this.toughness = ""; this.toughness = "";
this.loyalty = ""; this.loyalty = "";
this.cardTypes = EnumSet.noneOf(CardType.class); this.cardTypes = new ArrayList<CardType>();
this.subTypes = new SubTypeList(); this.subTypes = new SubTypeList();
this.superTypes = EnumSet.noneOf(SuperType.class); this.superTypes = EnumSet.noneOf(SuperType.class);
this.color = new ObjectColor(); this.color = new ObjectColor();
@ -45,5 +44,4 @@ public class AbilityView extends CardView {
this.name = name; this.name = name;
} }
} }

View file

@ -1,6 +1,8 @@
package mage.view; package mage.view;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import java.util.*;
import java.util.stream.Collectors;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Abilities; import mage.abilities.Abilities;
@ -29,9 +31,6 @@ import mage.target.Targets;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -55,7 +54,7 @@ public class CardView extends SimpleCardView {
@Expose @Expose
protected String loyalty = ""; protected String loyalty = "";
protected String startingLoyalty; protected String startingLoyalty;
protected Set<CardType> cardTypes; protected ArrayList<CardType> cardTypes;
protected SubTypeList subTypes; protected SubTypeList subTypes;
protected Set<SuperType> superTypes; protected Set<SuperType> superTypes;
protected ObjectColor color; protected ObjectColor color;
@ -151,7 +150,7 @@ public class CardView extends SimpleCardView {
this.toughness = cardView.toughness; this.toughness = cardView.toughness;
this.loyalty = cardView.loyalty; this.loyalty = cardView.loyalty;
this.startingLoyalty = cardView.startingLoyalty; this.startingLoyalty = cardView.startingLoyalty;
this.cardTypes = new HashSet<>(cardView.cardTypes); this.cardTypes = new ArrayList<>(cardView.cardTypes);
this.subTypes = new SubTypeList(cardView.subTypes); this.subTypes = new SubTypeList(cardView.subTypes);
this.superTypes = cardView.superTypes; this.superTypes = cardView.superTypes;
@ -213,8 +212,8 @@ public class CardView extends SimpleCardView {
* @param card * @param card
* @param game * @param game
* @param controlled is the card view created for the card controller - used * @param controlled is the card view created for the card controller - used
* for morph / face down cards to know which player may see information for * for morph / face down cards to know which player may see information for
* the card * the card
*/ */
public CardView(Card card, Game game, boolean controlled) { public CardView(Card card, Game game, boolean controlled) {
this(card, game, controlled, false, false); this(card, game, controlled, false, false);
@ -240,12 +239,12 @@ public class CardView extends SimpleCardView {
/** /**
* @param card * @param card
* @param game * @param game
* @param controlled is the card view created for the card controller - used * @param controlled is the card view created for the card controller - used
* for morph / face down cards to know which player may see information for * for morph / face down cards to know which player may see information for
* the card * the card
* @param showFaceDownCard if true and the card is not on the battlefield, * @param showFaceDownCard if true and the card is not on the battlefield,
* also a face down card is shown in the view, face down cards will be shown * also a face down card is shown in the view, face down cards will be shown
* @param storeZone if true the card zone will be set in the zone attribute. * @param storeZone if true the card zone will be set in the zone attribute.
*/ */
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard, boolean storeZone) { public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard, boolean storeZone) {
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null, card.getTokenDescriptor()); super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null, card.getTokenDescriptor());
@ -636,7 +635,7 @@ public class CardView extends SimpleCardView {
this.toughness = ""; this.toughness = "";
this.loyalty = ""; this.loyalty = "";
this.startingLoyalty = ""; this.startingLoyalty = "";
this.cardTypes = EnumSet.noneOf(CardType.class); this.cardTypes = new ArrayList<>();
this.subTypes = new SubTypeList(); this.subTypes = new SubTypeList();
this.superTypes = EnumSet.noneOf(SuperType.class); this.superTypes = EnumSet.noneOf(SuperType.class);
this.color = new ObjectColor(); this.color = new ObjectColor();
@ -764,7 +763,7 @@ public class CardView extends SimpleCardView {
return startingLoyalty; return startingLoyalty;
} }
public Set<CardType> getCardTypes() { public ArrayList<CardType> getCardTypes() {
return cardTypes; return cardTypes;
} }

View file

@ -1,8 +1,5 @@
package mage.cards.c; package mage.cards.c;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.OnEventTriggeredAbility; import mage.abilities.common.OnEventTriggeredAbility;
@ -69,11 +66,8 @@ class CrawlingSensationTriggeredAbility extends TriggeredAbilityImpl {
for (Card card : zEvent.getCards()) { for (Card card : zEvent.getCards()) {
if (card != null) { if (card != null) {
UUID cardOwnerId = card.getOwnerId(); UUID cardOwnerId = card.getOwnerId();
Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.isOwnedBy(getControllerId()) && card.isOwnedBy(getControllerId())
&& cardType != null
&& card.isLand()) { && card.isLand()) {
game.getState().setValue("usedOnTurn" + getControllerId() + getOriginalId(), game.getTurnNum()); game.getState().setValue("usedOnTurn" + getControllerId() + getOriginalId(), game.getTurnNum());
return true; return true;

View file

@ -1,6 +1,5 @@
package mage.cards.d; package mage.cards.d;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
@ -60,13 +59,9 @@ class DesecratedTombTriggeredAbility extends TriggeredAbilityImpl {
&& zEvent.getCards() != null) { && zEvent.getCards() != null) {
for (Card card : zEvent.getCards()) { for (Card card : zEvent.getCards()) {
if (card != null) { if (card != null) {
UUID cardOwnerId = card.getOwnerId(); UUID cardOwnerId = card.getOwnerId();
Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.isOwnedBy(getControllerId()) && card.isOwnedBy(getControllerId())
&& cardType != null
&& card.isCreature()) { && card.isCreature()) {
return true; return true;
} }

View file

@ -1,5 +1,6 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -10,8 +11,6 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import java.util.UUID;
/** /**
* @author LevelX2 * @author LevelX2
*/ */
@ -20,7 +19,8 @@ public final class ManaClash extends CardImpl {
public ManaClash(UUID ownerId, CardSetInfo setInfo) { public ManaClash(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}");
// You and target opponent each flip a coin. Mana Clash deals 1 damage to each player whose coin comes up tails. Repeat this process until both players' coins come up heads on the same flip. // You and target opponent each flip a coin. Mana Clash deals 1 damage to each player whose coin comes up tails.
// Repeat this process until both players' coins come up heads on the same flip.
this.getSpellAbility().addEffect(new ManaClashEffect()); this.getSpellAbility().addEffect(new ManaClashEffect());
this.getSpellAbility().addTarget(new TargetOpponent()); this.getSpellAbility().addTarget(new TargetOpponent());
} }

View file

@ -1,7 +1,5 @@
package mage.cards.p; package mage.cards.p;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
@ -61,10 +59,8 @@ class PedanticLearningTriggeredAbility extends TriggeredAbilityImpl {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null) { if (card != null) {
UUID cardOwnerId = card.getOwnerId(); UUID cardOwnerId = card.getOwnerId();
Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.isOwnedBy(getControllerId()) && card.isOwnedBy(getControllerId())
&& cardType != null
&& card.isLand()) { && card.isLand()) {
return true; return true;
} }

View file

@ -1,8 +1,6 @@
package mage.cards.p; package mage.cards.p;
import java.util.EnumSet; import java.util.ArrayList;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.MageObjectReference; import mage.MageObjectReference;
@ -147,7 +145,7 @@ class PossibilityStormEffect extends OneShotEffect {
return false; return false;
} }
private boolean sharesType(Card card, Set<CardType> cardTypes) { private boolean sharesType(Card card, ArrayList<CardType> cardTypes) {
for (CardType type : card.getCardType()) { for (CardType type : card.getCardType()) {
if (cardTypes.contains(type)) { if (cardTypes.contains(type)) {
return true; return true;

View file

@ -1,7 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -73,13 +71,9 @@ class SidisiBroodTyrantTriggeredAbility extends TriggeredAbilityImpl {
if (zEvent != null && Zone.LIBRARY == zEvent.getFromZone() && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { if (zEvent != null && Zone.LIBRARY == zEvent.getFromZone() && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) {
for (Card card : zEvent.getCards()) { for (Card card : zEvent.getCards()) {
if (card != null) { if (card != null) {
UUID cardOwnerId = card.getOwnerId(); UUID cardOwnerId = card.getOwnerId();
Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.isOwnedBy(getControllerId()) && card.isOwnedBy(getControllerId())
&& cardType != null
&& card.isCreature()) { && card.isCreature()) {
return true; return true;
} }

View file

@ -1,7 +1,5 @@
package mage.cards.t; package mage.cards.t;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
@ -29,7 +27,7 @@ import mage.target.common.TargetControlledPermanent;
public final class TheGitrogMonster extends CardImpl { public final class TheGitrogMonster extends CardImpl {
public TheGitrogMonster(UUID ownerId, CardSetInfo setInfo) { public TheGitrogMonster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{G}");
addSuperType(SuperType.LEGENDARY); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.FROG); this.subtype.add(SubType.FROG);
this.subtype.add(SubType.HORROR); this.subtype.add(SubType.HORROR);
@ -79,12 +77,10 @@ class TheGitrogMonsterTriggeredAbility extends TriggeredAbilityImpl {
ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event;
if (zEvent != null && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { if (zEvent != null && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) {
for (Card card : zEvent.getCards()) { for (Card card : zEvent.getCards()) {
if (card != null) { if (card != null) {
UUID cardOwnerId = card.getOwnerId(); UUID cardOwnerId = card.getOwnerId();
Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.isOwnedBy(getControllerId()) && card.isOwnedBy(getControllerId())
&& cardType != null
&& card.isLand()) { && card.isLand()) {
return true; return true;
} }

View file

@ -1,6 +1,5 @@
package mage.cards.t; package mage.cards.t;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -11,10 +10,10 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
@ -94,10 +93,8 @@ class TurntimberSowerTriggeredAbility extends TriggeredAbilityImpl {
for (Card card : zEvent.getCards()) { for (Card card : zEvent.getCards()) {
if (card != null) { if (card != null) {
UUID cardOwnerId = card.getOwnerId(); UUID cardOwnerId = card.getOwnerId();
Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.isOwnedBy(getControllerId()) && card.isOwnedBy(getControllerId())
&& cardType != null
&& card.isLand()) { && card.isLand()) {
return true; return true;
} }

View file

@ -1,6 +1,7 @@
package mage; package mage;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import mage.abilities.Abilities; import mage.abilities.Abilities;
@ -30,7 +31,7 @@ public interface MageObject extends MageItem, Serializable {
void setName(String name); void setName(String name);
Set<CardType> getCardType(); ArrayList<CardType> getCardType();
SubTypeList getSubtype(Game game); SubTypeList getSubtype(Game game);
@ -41,6 +42,8 @@ public interface MageObject extends MageItem, Serializable {
/** /**
* For cards: return basic abilities (without dynamic added) For permanents: * For cards: return basic abilities (without dynamic added) For permanents:
* return all abilities (dynamic ability inserts into permanent) * return all abilities (dynamic ability inserts into permanent)
*
* @return
*/ */
Abilities<Ability> getAbilities(); Abilities<Ability> getAbilities();
@ -201,7 +204,7 @@ public interface MageObject extends MageItem, Serializable {
void setIsAllCreatureTypes(boolean value); void setIsAllCreatureTypes(boolean value);
default void addCardTypes(Set<CardType> cardType) { default void addCardTypes(ArrayList<CardType> cardType) {
getCardType().addAll(cardType); getCardType().addAll(cardType);
} }

View file

@ -1,5 +1,6 @@
package mage; package mage;
import java.util.*;
import mage.abilities.Abilities; import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl; import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -21,8 +22,6 @@ import mage.game.permanent.Permanent;
import mage.util.GameLog; import mage.util.GameLog;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.*;
public abstract class MageObjectImpl implements MageObject { public abstract class MageObjectImpl implements MageObject {
protected UUID objectId; protected UUID objectId;
@ -32,7 +31,7 @@ public abstract class MageObjectImpl implements MageObject {
protected ObjectColor color; protected ObjectColor color;
protected ObjectColor frameColor; protected ObjectColor frameColor;
protected FrameStyle frameStyle; protected FrameStyle frameStyle;
protected Set<CardType> cardType = EnumSet.noneOf(CardType.class); protected ArrayList<CardType> cardType = new ArrayList<>();
protected SubTypeList subtype = new SubTypeList(); protected SubTypeList subtype = new SubTypeList();
protected boolean isAllCreatureTypes; protected boolean isAllCreatureTypes;
protected Set<SuperType> supertype = EnumSet.noneOf(SuperType.class); protected Set<SuperType> supertype = EnumSet.noneOf(SuperType.class);
@ -112,7 +111,7 @@ public abstract class MageObjectImpl implements MageObject {
} }
@Override @Override
public Set<CardType> getCardType() { public ArrayList<CardType> getCardType() {
return cardType; return cardType;
} }
@ -329,7 +328,7 @@ public abstract class MageObjectImpl implements MageObject {
*/ */
@Override @Override
public void removePTCDA() { public void removePTCDA() {
for (Iterator<Ability> iter = this.getAbilities().iterator(); iter.hasNext(); ) { for (Iterator<Ability> iter = this.getAbilities().iterator(); iter.hasNext();) {
Ability ability = iter.next(); Ability ability = iter.next();
for (Effect effect : ability.getEffects()) { for (Effect effect : ability.getEffects()) {
if (effect instanceof ContinuousEffect && ((ContinuousEffect) effect).getSublayer() == SubLayer.CharacteristicDefining_7a) { if (effect instanceof ContinuousEffect && ((ContinuousEffect) effect).getSublayer() == SubLayer.CharacteristicDefining_7a) {

View file

@ -1,5 +1,6 @@
package mage.abilities.dynamicvalue.common; package mage.abilities.dynamicvalue.common;
import java.util.ArrayList;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
@ -8,8 +9,6 @@ import mage.constants.CardType;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.EnumSet;
/** /**
* @author JayDi85 * @author JayDi85
*/ */
@ -21,7 +20,7 @@ public enum CardTypesInGraveyardCount implements DynamicValue {
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player controller = game.getPlayer(sourceAbility.getControllerId()); Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller != null) { if (controller != null) {
EnumSet<CardType> foundCardTypes = EnumSet.noneOf(CardType.class); ArrayList<CardType> foundCardTypes = new ArrayList<>();
for (Card card : controller.getGraveyard().getCards(game)) { for (Card card : controller.getGraveyard().getCards(game)) {
foundCardTypes.addAll(card.getCardType()); foundCardTypes.addAll(card.getCardType());
} }

View file

@ -3,6 +3,8 @@ package mage.cards.repository;
import com.j256.ormlite.field.DataType; import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; import com.j256.ormlite.table.DatabaseTable;
import java.util.*;
import java.util.stream.Collectors;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
@ -15,9 +17,6 @@ import mage.util.CardUtil;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author North * @author North
*/ */
@ -289,8 +288,8 @@ public class CardInfo {
return res; return res;
} }
public final Set<CardType> getTypes() { public final ArrayList<CardType> getTypes() {
Set<CardType> list = EnumSet.noneOf(CardType.class); ArrayList<CardType> list = new ArrayList<>();
for (String type : this.types.split(SEPARATOR)) { for (String type : this.types.split(SEPARATOR)) {
try { try {
list.add(CardType.valueOf(type)); list.add(CardType.valueOf(type));
@ -300,7 +299,7 @@ public class CardInfo {
return list; return list;
} }
public final void setTypes(Set<CardType> types) { public final void setTypes(ArrayList<CardType> types) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (CardType item : types) { for (CardType item : types) {
sb.append(item.name()).append(SEPARATOR); sb.append(item.name()).append(SEPARATOR);

View file

@ -1,12 +1,11 @@
package mage.constants; package mage.constants;
import java.util.ArrayList;
import java.util.Arrays;
import mage.MageObject; import mage.MageObject;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
import mage.game.Game; import mage.game.Game;
import java.util.Arrays;
import java.util.EnumSet;
/** /**
* @author North * @author North
*/ */
@ -63,7 +62,7 @@ public enum CardType {
* @return * @return
*/ */
public static CardType[] mergeTypes(CardType[] a, CardType[] b) { public static CardType[] mergeTypes(CardType[] a, CardType[] b) {
EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class); ArrayList<CardType> cardTypes = new ArrayList<>();
cardTypes.addAll(Arrays.asList(a)); cardTypes.addAll(Arrays.asList(a));
cardTypes.addAll(Arrays.asList(b)); cardTypes.addAll(Arrays.asList(b));
return cardTypes.toArray(new CardType[0]); return cardTypes.toArray(new CardType[0]);

View file

@ -1,5 +1,9 @@
package mage.designations; package mage.designations;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
@ -19,11 +23,6 @@ import mage.game.events.ZoneChangeEvent;
import mage.util.GameLog; import mage.util.GameLog;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/** /**
* @author LevelX2 * @author LevelX2
*/ */
@ -151,8 +150,8 @@ public abstract class Designation implements MageObject {
} }
@Override @Override
public EnumSet<CardType> getCardType() { public ArrayList<CardType> getCardType() {
return emptySet; return new ArrayList<>();
} }
@Override @Override

View file

@ -1,5 +1,9 @@
package mage.game.command; package mage.game.command;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
@ -20,10 +24,6 @@ import mage.game.events.ZoneChangeEvent;
import mage.util.GameLog; import mage.util.GameLog;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public class Commander implements CommandObject { public class Commander implements CommandObject {
private final Card sourceObject; private final Card sourceObject;
@ -133,7 +133,7 @@ public class Commander implements CommandObject {
} }
@Override @Override
public Set<CardType> getCardType() { public ArrayList<CardType> getCardType() {
return sourceObject.getCardType(); return sourceObject.getCardType();
} }

View file

@ -1,5 +1,9 @@
package mage.game.command; package mage.game.command;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
@ -22,16 +26,12 @@ import mage.game.events.ZoneChangeEvent;
import mage.util.GameLog; import mage.util.GameLog;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/** /**
* @author nantuko * @author nantuko
*/ */
public class Emblem implements CommandObject { public class Emblem implements CommandObject {
private static EnumSet<CardType> emptySet = EnumSet.noneOf(CardType.class); private static ArrayList<CardType> emptySet = new ArrayList<>();
private static ObjectColor emptyColor = new ObjectColor(); private static ObjectColor emptyColor = new ObjectColor();
private static ManaCosts emptyCost = new ManaCostsImpl(); private static ManaCosts emptyCost = new ManaCostsImpl();
@ -148,7 +148,7 @@ public class Emblem implements CommandObject {
} }
@Override @Override
public EnumSet<CardType> getCardType() { public ArrayList<CardType> getCardType() {
return emptySet; return emptySet;
} }

View file

@ -1,5 +1,10 @@
package mage.game.command; package mage.game.command;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
@ -24,17 +29,12 @@ import mage.util.GameLog;
import mage.util.RandomUtil; import mage.util.RandomUtil;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.lang.reflect.Constructor;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/** /**
* @author spjspj * @author spjspj
*/ */
public class Plane implements CommandObject { public class Plane implements CommandObject {
private static EnumSet<CardType> emptySet = EnumSet.noneOf(CardType.class); private static ArrayList<CardType> emptySet = new ArrayList<>();
private static ObjectColor emptyColor = new ObjectColor(); private static ObjectColor emptyColor = new ObjectColor();
private static ManaCosts emptyCost = new ManaCostsImpl(); private static ManaCosts emptyCost = new ManaCostsImpl();
@ -157,7 +157,7 @@ public class Plane implements CommandObject {
} }
@Override @Override
public EnumSet<CardType> getCardType() { public ArrayList<CardType> getCardType() {
return emptySet; return emptySet;
} }

View file

@ -24,6 +24,7 @@ public final class TilonallisSummonerElementalToken extends TokenImpl {
super(token); super(token);
} }
@Override
public TilonallisSummonerElementalToken copy() { public TilonallisSummonerElementalToken copy() {
return new TilonallisSummonerElementalToken(this); return new TilonallisSummonerElementalToken(this);
} }

View file

@ -1,5 +1,6 @@
package mage.game.stack; package mage.game.stack;
import java.util.*;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
@ -31,8 +32,6 @@ import mage.players.Player;
import mage.util.GameLog; import mage.util.GameLog;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import java.util.*;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -467,14 +466,14 @@ public class Spell extends StackObjImpl implements Card {
} }
@Override @Override
public Set<CardType> getCardType() { public ArrayList<CardType> getCardType() {
if (faceDown) { if (faceDown) {
EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class); ArrayList<CardType> cardTypes = new ArrayList<>();
cardTypes.add(CardType.CREATURE); cardTypes.add(CardType.CREATURE);
return cardTypes; return cardTypes;
} }
if (this.getSpellAbility() instanceof BestowAbility) { if (this.getSpellAbility() instanceof BestowAbility) {
EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class); ArrayList<CardType> cardTypes = new ArrayList<>();
cardTypes.addAll(card.getCardType()); cardTypes.addAll(card.getCardType());
cardTypes.remove(CardType.CREATURE); cardTypes.remove(CardType.CREATURE);
return cardTypes; return cardTypes;

View file

@ -1,5 +1,9 @@
package mage.game.stack; package mage.game.stack;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
@ -30,17 +34,12 @@ import mage.util.GameLog;
import mage.util.SubTypeList; import mage.util.SubTypeList;
import mage.watchers.Watcher; import mage.watchers.Watcher;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class StackAbility extends StackObjImpl implements Ability { public class StackAbility extends StackObjImpl implements Ability {
private static EnumSet<CardType> emptyCardType = EnumSet.noneOf(CardType.class); private static ArrayList<CardType> emptyCardType = new ArrayList<>();
private static List<String> emptyString = new ArrayList<>(); private static List<String> emptyString = new ArrayList<>();
private static ObjectColor emptyColor = new ObjectColor(); private static ObjectColor emptyColor = new ObjectColor();
private static ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>(); private static ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>();
@ -153,7 +152,7 @@ public class StackAbility extends StackObjImpl implements Ability {
} }
@Override @Override
public EnumSet<CardType> getCardType() { public ArrayList<CardType> getCardType() {
return emptyCardType; return emptyCardType;
} }