mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Fixed card type displaying order (fixes #6055).
This commit is contained in:
parent
4006e9e909
commit
2788eab082
24 changed files with 106 additions and 141 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package mage;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import mage.abilities.Abilities;
|
||||
|
|
@ -30,7 +31,7 @@ public interface MageObject extends MageItem, Serializable {
|
|||
|
||||
void setName(String name);
|
||||
|
||||
Set<CardType> getCardType();
|
||||
ArrayList<CardType> getCardType();
|
||||
|
||||
SubTypeList getSubtype(Game game);
|
||||
|
||||
|
|
@ -41,6 +42,8 @@ public interface MageObject extends MageItem, Serializable {
|
|||
/**
|
||||
* For cards: return basic abilities (without dynamic added) For permanents:
|
||||
* return all abilities (dynamic ability inserts into permanent)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Abilities<Ability> getAbilities();
|
||||
|
||||
|
|
@ -201,7 +204,7 @@ public interface MageObject extends MageItem, Serializable {
|
|||
|
||||
void setIsAllCreatureTypes(boolean value);
|
||||
|
||||
default void addCardTypes(Set<CardType> cardType) {
|
||||
default void addCardTypes(ArrayList<CardType> cardType) {
|
||||
getCardType().addAll(cardType);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage;
|
||||
|
||||
import java.util.*;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -21,8 +22,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class MageObjectImpl implements MageObject {
|
||||
|
||||
protected UUID objectId;
|
||||
|
|
@ -32,7 +31,7 @@ public abstract class MageObjectImpl implements MageObject {
|
|||
protected ObjectColor color;
|
||||
protected ObjectColor frameColor;
|
||||
protected FrameStyle frameStyle;
|
||||
protected Set<CardType> cardType = EnumSet.noneOf(CardType.class);
|
||||
protected ArrayList<CardType> cardType = new ArrayList<>();
|
||||
protected SubTypeList subtype = new SubTypeList();
|
||||
protected boolean isAllCreatureTypes;
|
||||
protected Set<SuperType> supertype = EnumSet.noneOf(SuperType.class);
|
||||
|
|
@ -112,7 +111,7 @@ public abstract class MageObjectImpl implements MageObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<CardType> getCardType() {
|
||||
public ArrayList<CardType> getCardType() {
|
||||
return cardType;
|
||||
}
|
||||
|
||||
|
|
@ -329,7 +328,7 @@ public abstract class MageObjectImpl implements MageObject {
|
|||
*/
|
||||
@Override
|
||||
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();
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof ContinuousEffect && ((ContinuousEffect) effect).getSublayer() == SubLayer.CharacteristicDefining_7a) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -8,8 +9,6 @@ import mage.constants.CardType;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
|
|
@ -21,7 +20,7 @@ public enum CardTypesInGraveyardCount implements DynamicValue {
|
|||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Player controller = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (controller != null) {
|
||||
EnumSet<CardType> foundCardTypes = EnumSet.noneOf(CardType.class);
|
||||
ArrayList<CardType> foundCardTypes = new ArrayList<>();
|
||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||
foundCardTypes.addAll(card.getCardType());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package mage.cards.repository;
|
|||
import com.j256.ormlite.field.DataType;
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
|
@ -15,9 +17,6 @@ import mage.util.CardUtil;
|
|||
import mage.util.SubTypeList;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
*/
|
||||
|
|
@ -289,8 +288,8 @@ public class CardInfo {
|
|||
return res;
|
||||
}
|
||||
|
||||
public final Set<CardType> getTypes() {
|
||||
Set<CardType> list = EnumSet.noneOf(CardType.class);
|
||||
public final ArrayList<CardType> getTypes() {
|
||||
ArrayList<CardType> list = new ArrayList<>();
|
||||
for (String type : this.types.split(SEPARATOR)) {
|
||||
try {
|
||||
list.add(CardType.valueOf(type));
|
||||
|
|
@ -300,7 +299,7 @@ public class CardInfo {
|
|||
return list;
|
||||
}
|
||||
|
||||
public final void setTypes(Set<CardType> types) {
|
||||
public final void setTypes(ArrayList<CardType> types) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (CardType item : types) {
|
||||
sb.append(item.name()).append(SEPARATOR);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package mage.constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import mage.MageObject;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
*/
|
||||
|
|
@ -63,7 +62,7 @@ public enum CardType {
|
|||
* @return
|
||||
*/
|
||||
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(b));
|
||||
return cardTypes.toArray(new CardType[0]);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package mage.designations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -19,11 +23,6 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
|
@ -151,8 +150,8 @@ public abstract class Designation implements MageObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<CardType> getCardType() {
|
||||
return emptySet;
|
||||
public ArrayList<CardType> getCardType() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
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.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -20,10 +24,6 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Commander implements CommandObject {
|
||||
|
||||
private final Card sourceObject;
|
||||
|
|
@ -133,7 +133,7 @@ public class Commander implements CommandObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<CardType> getCardType() {
|
||||
public ArrayList<CardType> getCardType() {
|
||||
return sourceObject.getCardType();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
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.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -22,16 +26,12 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
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 ManaCosts emptyCost = new ManaCostsImpl();
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ public class Emblem implements CommandObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<CardType> getCardType() {
|
||||
public ArrayList<CardType> getCardType() {
|
||||
return emptySet;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
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.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -24,17 +29,12 @@ import mage.util.GameLog;
|
|||
import mage.util.RandomUtil;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
*/
|
||||
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 ManaCosts emptyCost = new ManaCostsImpl();
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ public class Plane implements CommandObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<CardType> getCardType() {
|
||||
public ArrayList<CardType> getCardType() {
|
||||
return emptySet;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public final class TilonallisSummonerElementalToken extends TokenImpl {
|
|||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TilonallisSummonerElementalToken copy() {
|
||||
return new TilonallisSummonerElementalToken(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.game.stack;
|
||||
|
||||
import java.util.*;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
|
|
@ -31,8 +32,6 @@ import mage.players.Player;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -467,14 +466,14 @@ public class Spell extends StackObjImpl implements Card {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<CardType> getCardType() {
|
||||
public ArrayList<CardType> getCardType() {
|
||||
if (faceDown) {
|
||||
EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class);
|
||||
ArrayList<CardType> cardTypes = new ArrayList<>();
|
||||
cardTypes.add(CardType.CREATURE);
|
||||
return cardTypes;
|
||||
}
|
||||
if (this.getSpellAbility() instanceof BestowAbility) {
|
||||
EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class);
|
||||
ArrayList<CardType> cardTypes = new ArrayList<>();
|
||||
cardTypes.addAll(card.getCardType());
|
||||
cardTypes.remove(CardType.CREATURE);
|
||||
return cardTypes;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
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.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -30,17 +34,12 @@ import mage.util.GameLog;
|
|||
import mage.util.SubTypeList;
|
||||
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
|
||||
*/
|
||||
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 ObjectColor emptyColor = new ObjectColor();
|
||||
private static ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>();
|
||||
|
|
@ -153,7 +152,7 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<CardType> getCardType() {
|
||||
public ArrayList<CardType> getCardType() {
|
||||
return emptyCardType;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue