mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
changed cardtype from list to enumset
This commit is contained in:
parent
c0ffc47bf7
commit
372584f7ad
22 changed files with 116 additions and 55 deletions
|
|
@ -205,7 +205,7 @@ 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()){
|
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());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@
|
||||||
package mage.view;
|
package mage.view;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
||||||
|
|
@ -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 = new HashSet<>();
|
||||||
this.subTypes = new ArrayList<>();
|
this.subTypes = new ArrayList<>();
|
||||||
this.superTypes = new ArrayList<>();
|
this.superTypes = new ArrayList<>();
|
||||||
this.color = new ObjectColor();
|
this.color = new ObjectColor();
|
||||||
|
|
|
||||||
|
|
@ -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 Set<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 = new HashSet<>();
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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())
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -164,7 +165,7 @@ class PossibilityStormEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean sharesType(Card card, List<CardType> cardTypes) {
|
private boolean sharesType(Card card, Set<CardType> cardTypes) {
|
||||||
for (CardType type : card.getCardType()) {
|
for (CardType type : card.getCardType()) {
|
||||||
if (cardTypes.contains(type)) {
|
if (cardTypes.contains(type)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -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))
|
||||||
|
|
|
||||||
|
|
@ -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())
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,6 +50,7 @@ import mage.util.GameLog;
|
||||||
*/
|
*/
|
||||||
public class Emblem implements CommandObject {
|
public class Emblem implements CommandObject {
|
||||||
|
|
||||||
|
private static EnumSet<CardType> 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 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
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
28
Mage/src/test/java/mage/ContinuousEffectImplTest.java
Normal file
28
Mage/src/test/java/mage/ContinuousEffectImplTest.java
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue