Merge pull request #2910 from ingmargoudt/master

changed cardtype from list to enumset
This commit is contained in:
ingmargoudt 2017-03-03 23:01:56 +01:00 committed by GitHub
commit a4f64c74c9
24 changed files with 172 additions and 81 deletions

View file

@ -177,7 +177,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
String key1 = cv.getName() + cv.getExpansionSetCode() + cv.getCardNumber(); String key1 = cv.getName() + cv.getExpansionSetCode() + cv.getCardNumber();
for (CardView cardView : cards.values()) { for (CardView cardView : cards.values()) {
String key2 = cardView.getName() + cardView.getExpansionSetCode() + cardView.getCardNumber(); String key2 = cardView.getName() + cardView.getExpansionSetCode() + cardView.getCardNumber();
if ((key1).equals(key2)) { if (key1.equals(key2)) {
view.set(j, cardView); view.set(j, cardView);
break; break;
} }

View file

@ -44,6 +44,7 @@ import javax.swing.ImageIcon;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent; 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;
@ -58,7 +59,6 @@ import org.apache.log4j.Logger;
import org.mage.plugins.card.utils.impl.ImageManagerImpl; import org.mage.plugins.card.utils.impl.ImageManagerImpl;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class CardInfoWindowDialog extends MageDialog { public class CardInfoWindowDialog extends MageDialog {
@ -109,7 +109,7 @@ public class CardInfoWindowDialog extends MageDialog {
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage())); this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage()));
break; break;
default: default:
// no icon yet // no icon yet
} }
this.setTitelBarToolTip(name); this.setTitelBarToolTip(name);
setGUISize(); setGUISize();
@ -202,17 +202,19 @@ public class CardInfoWindowDialog extends MageDialog {
}); });
} }
private int qtyCardTypes(mage.view.CardsView cardsView){ private int qtyCardTypes(mage.view.CardsView cardsView) {
Set<String> cardTypesPresent = new LinkedHashSet<String>() {}; Set<String> cardTypesPresent = new LinkedHashSet<String>() {
for (CardView card : cardsView.values()){ };
List<CardType> cardTypes = card.getCardTypes(); for (CardView card : cardsView.values()) {
for (CardType cardType : cardTypes){ Set<CardType> cardTypes = card.getCardTypes();
for (CardType cardType : cardTypes) {
cardTypesPresent.add(cardType.toString()); cardTypesPresent.add(cardType.toString());
} }
} }
if (cardTypesPresent.isEmpty()) return 0; if (cardTypesPresent.isEmpty()) return 0;
else return cardTypesPresent.size(); else return cardTypesPresent.size();
} }
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -227,24 +229,24 @@ public class CardInfoWindowDialog extends MageDialog {
setIconifiable(true); setIconifiable(true);
setResizable(true); setResizable(true);
setPreferredSize(new Dimension((int) Math.round(GUISizeHelper.otherZonesCardDimension.width * 1.3), setPreferredSize(new Dimension((int) Math.round(GUISizeHelper.otherZonesCardDimension.width * 1.3),
(int) Math.round(GUISizeHelper.otherZonesCardDimension.height * 1.2))); (int) Math.round(GUISizeHelper.otherZonesCardDimension.height * 1.2)));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0)) .addGap(0, 0, 0))
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0)) .addGap(0, 0, 0))
); );
pack(); pack();
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables

View file

@ -869,7 +869,7 @@ 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()) {
List<CardType> cardTypes = card.getCardTypes(); Set<CardType> cardTypes = card.getCardTypes();
for (CardType cardType : cardTypes) { for (CardType cardType : cardTypes) {
cardTypesPresent.add(cardType.toString()); cardTypesPresent.add(cardType.toString());
} }

View file

@ -0,0 +1,27 @@
package mage.client.util;
import mage.client.deckeditor.table.CardHelper;
import mage.constants.CardType;
import mage.view.CardView;
import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
/**
* Created by IGOUDT on 3-3-2017.
*/
public class CardHelperTest {
@Test
public void testCardTypeOrder() {
CardView v = new CardView(true);
v.getCardTypes().add(CardType.CREATURE);
v.getCardTypes().add(CardType.ARTIFACT);
String cardtypeText = CardHelper.getType(v);
Assert.assertThat(cardtypeText, is("Artifact Creature"));
}
}

View file

@ -28,12 +28,14 @@
package mage.view; package mage.view;
import java.util.ArrayList;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.constants.CardType;
import java.util.ArrayList;
import java.util.EnumSet;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class AbilityView extends CardView { public class AbilityView extends CardView {
@ -53,7 +55,7 @@ public class AbilityView extends CardView {
this.power = ""; this.power = "";
this.toughness = ""; this.toughness = "";
this.loyalty = ""; this.loyalty = "";
this.cardTypes = new ArrayList<>(); this.cardTypes = EnumSet.noneOf(CardType.class);
this.subTypes = new ArrayList<>(); this.subTypes = new ArrayList<>();
this.superTypes = new ArrayList<>(); this.superTypes = new ArrayList<>();
this.color = new ObjectColor(); this.color = new ObjectColor();

View file

@ -27,9 +27,8 @@
*/ */
package mage.view; package mage.view;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Mode; import mage.abilities.Mode;
@ -71,7 +70,7 @@ public class CardView extends SimpleCardView {
protected String toughness; protected String toughness;
protected String loyalty; protected String loyalty;
protected String startingLoyalty; protected String startingLoyalty;
protected List<CardType> cardTypes; protected EnumSet<CardType> cardTypes;
protected List<String> subTypes; protected List<String> subTypes;
protected List<String> superTypes; protected List<String> superTypes;
protected ObjectColor color; protected ObjectColor color;
@ -519,7 +518,7 @@ public class CardView extends SimpleCardView {
this.toughness = ""; this.toughness = "";
this.loyalty = ""; this.loyalty = "";
this.startingLoyalty = ""; this.startingLoyalty = "";
this.cardTypes = new ArrayList<>(); this.cardTypes = EnumSet.noneOf(CardType.class);
this.subTypes = new ArrayList<>(); this.subTypes = new ArrayList<>();
this.superTypes = new ArrayList<>(); this.superTypes = new ArrayList<>();
this.color = new ObjectColor(); this.color = new ObjectColor();
@ -640,7 +639,7 @@ public class CardView extends SimpleCardView {
return startingLoyalty; return startingLoyalty;
} }
public List<CardType> getCardTypes() { public Set<CardType> getCardTypes() {
return cardTypes; return cardTypes;
} }

View file

@ -170,7 +170,7 @@ public class UserManager {
calendar.add(Calendar.MINUTE, -3); calendar.add(Calendar.MINUTE, -3);
List<User> usersToCheck = new ArrayList<>(users.values()); List<User> usersToCheck = new ArrayList<>(users.values());
for (User user : usersToCheck) { for (User user : usersToCheck) {
if (!user.getUserState().equals(UserState.Expired) && user.isExpired(calendar.getTime())) { if (user.getUserState() != UserState.Expired && user.isExpired(calendar.getTime())) {
removeUser(user.getId(), DisconnectReason.SessionExpired); removeUser(user.getId(), DisconnectReason.SessionExpired);
} }
} }

View file

@ -401,7 +401,7 @@ public class GameController implements GameCallback {
return false; return false;
} }
} }
if (player.isHuman() && gameSessions.get(player.getId()) == null) { if (player.isHuman() && !gameSessions.containsKey(player.getId())) {
return false; return false;
} }
} }
@ -410,11 +410,11 @@ public class GameController implements GameCallback {
} }
public void watch(UUID userId) { public void watch(UUID userId) {
if (userPlayerMap.get(userId) != null) { if (userPlayerMap.containsKey(userId)) {
// You can't watch a game if you already a player in it // You can't watch a game if you already a player in it
return; return;
} }
if (watchers.get(userId) != null) { if (watchers.containsKey(userId)) {
// You can't watch a game if you already watch it // You can't watch a game if you already watch it
return; return;
} }

View file

@ -29,6 +29,7 @@
package mage.cards.c; package mage.cards.c;
import java.util.List; import java.util.List;
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;
@ -95,7 +96,7 @@ 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();
List<CardType> cardType = card.getCardType(); Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.getOwnerId().equals(getControllerId()) && card.getOwnerId().equals(getControllerId())

View file

@ -28,6 +28,7 @@
package mage.cards.m; package mage.cards.m;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
@ -90,7 +91,7 @@ class PermanentsAreArtifactsEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) { for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
List<CardType> cardType = perm.getCardType(); Set<CardType> cardType = perm.getCardType();
if (!cardType.contains(CardType.ARTIFACT)) { if (!cardType.contains(CardType.ARTIFACT)) {
cardType.add(CardType.ARTIFACT); cardType.add(CardType.ARTIFACT);
} }

View file

@ -27,7 +27,9 @@
*/ */
package mage.cards.p; package mage.cards.p;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -164,7 +166,7 @@ class PossibilityStormEffect extends OneShotEffect {
return false; return false;
} }
private boolean sharesType(Card card, List<CardType> cardTypes) { private boolean sharesType(Card card, EnumSet<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

@ -28,6 +28,7 @@
package mage.cards.p; package mage.cards.p;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -95,7 +96,7 @@ class PrimalSurgeEffect extends OneShotEffect {
Card card = player.getLibrary().removeFromTop(game); Card card = player.getLibrary().removeFromTop(game);
if (card != null) { if (card != null) {
card.moveToExile(null, "", source.getSourceId(), game); card.moveToExile(null, "", source.getSourceId(), game);
List<CardType> cardType = card.getCardType(); Set<CardType> cardType = card.getCardType();
if ((cardType.contains(CardType.ARTIFACT) || cardType.contains(CardType.CREATURE) if ((cardType.contains(CardType.ARTIFACT) || cardType.contains(CardType.CREATURE)
|| cardType.contains(CardType.ENCHANTMENT) || cardType.contains(CardType.LAND) || cardType.contains(CardType.ENCHANTMENT) || cardType.contains(CardType.LAND)
|| cardType.contains(CardType.PLANESWALKER)) || cardType.contains(CardType.PLANESWALKER))

View file

@ -28,6 +28,7 @@
package mage.cards.s; package mage.cards.s;
import java.util.List; import java.util.List;
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;
@ -99,7 +100,7 @@ class SidisiBroodTyrantTriggeredAbility extends TriggeredAbilityImpl {
if (card != null) { if (card != null) {
UUID cardOwnerId = card.getOwnerId(); UUID cardOwnerId = card.getOwnerId();
List<CardType> cardType = card.getCardType(); Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.getOwnerId().equals(getControllerId()) && card.getOwnerId().equals(getControllerId())

View file

@ -28,6 +28,7 @@
package mage.cards.t; package mage.cards.t;
import java.util.List; import java.util.List;
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;
@ -110,7 +111,7 @@ class TheGitrogMonsterTriggeredAbility 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();
List<CardType> cardType = card.getCardType(); Set<CardType> cardType = card.getCardType();
if (cardOwnerId != null if (cardOwnerId != null
&& card.getOwnerId().equals(getControllerId()) && card.getOwnerId().equals(getControllerId())
&& cardType != null && cardType != null

View file

@ -0,0 +1,26 @@
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* Created by IGOUDT on 23-2-2017.
*/
public class AuratouchedMageTest extends CardTestPlayerBase {
@Test
public void testSearch() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 10);
addCard(Zone.HAND, playerA, "Auratouched Mage");
castSpell(0, PhaseStep.PRECOMBAT_MAIN, playerA, "Auratouched Mage");
addCard(Zone.LIBRARY, playerA, "White Ward", 1);
setChoice(playerA, "White ward");
setStopAt(0, PhaseStep.PRECOMBAT_MAIN);
execute();
}
}

View file

@ -1,7 +1,9 @@
package mage; package mage;
import java.io.Serializable; import java.io.Serializable;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Abilities; import mage.abilities.Abilities;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -24,7 +26,7 @@ public interface MageObject extends MageItem, Serializable {
void setName(String name); void setName(String name);
List<CardType> getCardType(); EnumSet<CardType> getCardType();
List<String> getSubtype(Game game); List<String> getSubtype(Game game);

View file

@ -27,9 +27,8 @@
*/ */
package mage; package mage;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.UUID;
import mage.abilities.Abilities; import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl; import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -55,7 +54,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 List<CardType> cardType = new ArrayList<>(); protected EnumSet<CardType> cardType = EnumSet.noneOf(CardType.class);
protected List<String> subtype = new ArrayList<>(); protected List<String> subtype = new ArrayList<>();
protected List<String> supertype = new ArrayList<>(); protected List<String> supertype = new ArrayList<>();
protected Abilities<Ability> abilities; protected Abilities<Ability> abilities;
@ -127,7 +126,7 @@ public abstract class MageObjectImpl implements MageObject {
} }
@Override @Override
public List<CardType> getCardType() { public EnumSet<CardType> getCardType() {
return cardType; return cardType;
} }

View file

@ -30,10 +30,9 @@ 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.ArrayList;
import java.util.Arrays; import java.util.*;
import java.util.Collections;
import java.util.List;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
@ -253,8 +252,8 @@ public class CardInfo {
return Arrays.asList(list.split(SEPARATOR)); return Arrays.asList(list.split(SEPARATOR));
} }
public final List<CardType> getTypes() { public final EnumSet<CardType> getTypes() {
ArrayList<CardType> list = new ArrayList<>(); EnumSet<CardType> list = EnumSet.noneOf(CardType.class);
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));
@ -264,7 +263,7 @@ public class CardInfo {
return list; return list;
} }
public final void setTypes(List<CardType> types) { public final void setTypes(Set<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

@ -5,9 +5,8 @@
*/ */
package mage.designations; package mage.designations;
import java.util.ArrayList; import java.util.*;
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;
@ -29,6 +28,7 @@ import mage.util.GameLog;
*/ */
public abstract class Designation implements MageObject { public abstract class Designation implements MageObject {
private static EnumSet emptySet = EnumSet.noneOf(CardType.class);
private static List emptyList = new ArrayList(); private static List emptyList = 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();
@ -118,8 +118,8 @@ public abstract class Designation implements MageObject {
} }
@Override @Override
public List<CardType> getCardType() { public EnumSet<CardType> getCardType() {
return emptyList; return emptySet;
} }
@Override @Override

View file

@ -27,7 +27,9 @@
*/ */
package mage.game.command; package mage.game.command;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
@ -110,7 +112,7 @@ public class Commander implements CommandObject {
} }
@Override @Override
public List<CardType> getCardType() { public EnumSet<CardType> getCardType() {
return sourceObject.getCardType(); return sourceObject.getCardType();
} }

View file

@ -27,9 +27,8 @@
*/ */
package mage.game.command; package mage.game.command;
import java.util.ArrayList; import java.util.*;
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;
@ -51,7 +50,8 @@ import mage.util.GameLog;
*/ */
public class Emblem implements CommandObject { public class Emblem implements CommandObject {
private static List emptyList = new ArrayList(); private static EnumSet<CardType> emptySet = EnumSet.noneOf(CardType.class);
private static List emptyList = 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,8 +148,8 @@ public class Emblem implements CommandObject {
} }
@Override @Override
public List<CardType> getCardType() { public EnumSet<CardType> getCardType() {
return emptyList; return emptySet;
} }
@Override @Override

View file

@ -27,9 +27,8 @@
*/ */
package mage.game.stack; package mage.game.stack;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
@ -457,14 +456,14 @@ public class Spell extends StackObjImpl implements Card {
} }
@Override @Override
public List<CardType> getCardType() { public EnumSet<CardType> getCardType() {
if (faceDown) { if (faceDown) {
List<CardType> cardTypes = new ArrayList<>(); EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class);
cardTypes.add(CardType.CREATURE); cardTypes.add(CardType.CREATURE);
return cardTypes; return cardTypes;
} }
if (this.getSpellAbility() instanceof BestowAbility) { if (this.getSpellAbility() instanceof BestowAbility) {
List<CardType> cardTypes = new ArrayList<>(); EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class);
cardTypes.addAll(card.getCardType()); cardTypes.addAll(card.getCardType());
cardTypes.remove(CardType.CREATURE); cardTypes.remove(CardType.CREATURE);
return cardTypes; return cardTypes;

View file

@ -27,9 +27,8 @@
*/ */
package mage.game.stack; package mage.game.stack;
import java.util.ArrayList; import java.util.*;
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;
@ -72,7 +71,7 @@ import mage.watchers.Watcher;
*/ */
public class StackAbility extends StackObjImpl implements Ability { public class StackAbility extends StackObjImpl implements Ability {
private static List<CardType> emptyCardType = new ArrayList<>(); private static EnumSet<CardType> emptyCardType = EnumSet.noneOf(CardType.class);
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<>();
@ -160,7 +159,7 @@ public class StackAbility extends StackObjImpl implements Ability {
} }
@Override @Override
public List<CardType> getCardType() { public EnumSet<CardType> getCardType() {
return emptyCardType; return emptyCardType;
} }

View file

@ -0,0 +1,28 @@
package mage;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.constants.DependencyType;
import mage.constants.Duration;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Set;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.is;
/**
* Created by IGOUDT on 25-2-2017.
*/
public class ContinuousEffectImplTest {
@Test
public void isDependentTo(){
BoostTargetEffect ghe = new BoostTargetEffect(0,0, Duration.Custom);
ghe.setDependedToType(DependencyType.AuraAddingRemoving);
Set<UUID> x = ghe.isDependentTo(new ArrayList<>());
Assert.assertThat(x.size(), is(0));
}
}