forked from External/mage
[BRC] Implement Rootpath Purifier (ready for review) (#10363)
* refactor check supertype methods * change supertype to list to match card type * refactor various subtype methods * implement mageobjectattribute for supertype * a few fixes * [BRC] Implement Rootpath Purifier * a few extra fixes * more fixes * add test for purifier
This commit is contained in:
parent
a850e3660b
commit
024c3081df
98 changed files with 489 additions and 238 deletions
|
|
@ -19,22 +19,27 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface MageObject extends MageItem, Serializable, Copyable<MageObject> {
|
||||
|
||||
String getExpansionSetCode();
|
||||
|
||||
void setExpansionSetCode(String expansionSetCode);
|
||||
|
||||
String getCardNumber();
|
||||
|
||||
void setCardNumber(String cardNumber);
|
||||
|
||||
Integer getImageNumber();
|
||||
|
||||
void setImageNumber(Integer imageNumber);
|
||||
|
||||
String getName();
|
||||
|
||||
String getIdName();
|
||||
|
||||
String getLogName();
|
||||
|
||||
void setName(String name);
|
||||
|
||||
default List<CardType> getCardType() {
|
||||
|
|
@ -66,7 +71,11 @@ public interface MageObject extends MageItem, Serializable, Copyable<MageObject>
|
|||
|
||||
boolean hasSubtype(SubType subtype, Game game);
|
||||
|
||||
Set<SuperType> getSuperType();
|
||||
default List<SuperType> getSuperType() {
|
||||
return getSuperType(null);
|
||||
}
|
||||
|
||||
List<SuperType> getSuperType(Game game);
|
||||
|
||||
/**
|
||||
* For cards: return basic abilities (without dynamic added)
|
||||
|
|
@ -143,7 +152,7 @@ public interface MageObject extends MageItem, Serializable, Copyable<MageObject>
|
|||
|
||||
default boolean isHistoric(Game game) {
|
||||
return getCardType(game).contains(CardType.ARTIFACT)
|
||||
|| getSuperType().contains(SuperType.LEGENDARY)
|
||||
|| getSuperType(game).contains(SuperType.LEGENDARY)
|
||||
|| hasSubtype(SubType.SAGA, game);
|
||||
}
|
||||
|
||||
|
|
@ -236,30 +245,85 @@ public interface MageObject extends MageItem, Serializable, Copyable<MageObject>
|
|||
}
|
||||
|
||||
default boolean isLegendary() {
|
||||
return getSuperType().contains(SuperType.LEGENDARY);
|
||||
return isLegendary(null);
|
||||
}
|
||||
|
||||
default boolean isLegendary(Game game) {
|
||||
return getSuperType(game).contains(SuperType.LEGENDARY);
|
||||
}
|
||||
|
||||
default boolean isSnow() {
|
||||
return getSuperType().contains(SuperType.SNOW);
|
||||
return isSnow(null);
|
||||
}
|
||||
|
||||
default void addSuperType(SuperType superType) {
|
||||
if (getSuperType().contains(superType)) {
|
||||
return;
|
||||
}
|
||||
getSuperType().add(superType);
|
||||
}
|
||||
|
||||
default void removeSuperType(SuperType superType) {
|
||||
getSuperType().remove(superType);
|
||||
default boolean isSnow(Game game) {
|
||||
return getSuperType(game).contains(SuperType.SNOW);
|
||||
}
|
||||
|
||||
default boolean isBasic() {
|
||||
return getSuperType().contains(SuperType.BASIC);
|
||||
return isBasic(null);
|
||||
}
|
||||
|
||||
default boolean isBasic(Game game) {
|
||||
return getSuperType(game).contains(SuperType.BASIC);
|
||||
}
|
||||
|
||||
default boolean isWorld() {
|
||||
return getSuperType().contains(SuperType.WORLD);
|
||||
return isWorld(null);
|
||||
}
|
||||
|
||||
default boolean isWorld(Game game) {
|
||||
return getSuperType(game).contains(SuperType.WORLD);
|
||||
}
|
||||
|
||||
default void addSuperType(SuperType superType) {
|
||||
addSuperType(null, superType);
|
||||
}
|
||||
|
||||
default void addSuperType(Game game, SuperType superType) {
|
||||
List<SuperType> currentSuperTypes;
|
||||
if (game != null) {
|
||||
// dynamic
|
||||
currentSuperTypes = game.getState().getCreateMageObjectAttribute(this, game).getSuperType();
|
||||
} else {
|
||||
// static
|
||||
currentSuperTypes = getSuperType();
|
||||
}
|
||||
if (!currentSuperTypes.contains(superType)) {
|
||||
currentSuperTypes.add(superType);
|
||||
}
|
||||
}
|
||||
|
||||
default void removeAllSuperTypes() {
|
||||
removeAllSuperTypes(null);
|
||||
}
|
||||
|
||||
default void removeAllSuperTypes(Game game) {
|
||||
List<SuperType> currentSuperTypes;
|
||||
if (game != null) {
|
||||
// dynamic
|
||||
currentSuperTypes = game.getState().getCreateMageObjectAttribute(this, game).getSuperType();
|
||||
} else {
|
||||
// static
|
||||
currentSuperTypes = getSuperType();
|
||||
}
|
||||
currentSuperTypes.clear();
|
||||
}
|
||||
|
||||
default void removeSuperType(SuperType superType) {
|
||||
removeSuperType(null, superType);
|
||||
}
|
||||
|
||||
default void removeSuperType(Game game, SuperType superType) {
|
||||
List<SuperType> currentSuperTypes;
|
||||
if (game != null) {
|
||||
// dynamic
|
||||
currentSuperTypes = game.getState().getCreateMageObjectAttribute(this, game).getSuperType();
|
||||
} else {
|
||||
// static
|
||||
currentSuperTypes = getSuperType();
|
||||
}
|
||||
currentSuperTypes.remove(superType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ public abstract class MageObjectImpl implements MageObject {
|
|||
private String cardNumber = "";
|
||||
private int imageNumber = 0;
|
||||
|
||||
protected List<SuperType> supertype = new ArrayList<>();
|
||||
protected List<CardType> cardType = new ArrayList<>();
|
||||
protected SubTypes subtype = new SubTypes();
|
||||
protected Set<SuperType> supertype = EnumSet.noneOf(SuperType.class);
|
||||
protected Abilities<Ability> abilities;
|
||||
|
||||
protected String text;
|
||||
|
|
@ -146,7 +146,14 @@ public abstract class MageObjectImpl implements MageObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<SuperType> getSuperType() {
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
if (game != null) {
|
||||
// dynamic
|
||||
MageObjectAttribute mageObjectAttribute = game.getState().getMageObjectAttribute(getId());
|
||||
if (mageObjectAttribute != null) {
|
||||
return mageObjectAttribute.getSuperType();
|
||||
}
|
||||
}
|
||||
return supertype;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ public class EquippedHasSupertypeCondition implements Condition {
|
|||
}
|
||||
if (attachedTo != null) {
|
||||
if (superType != null) {
|
||||
if (attachedTo.getSuperType().contains(this.superType)) {
|
||||
if (attachedTo.getSuperType(game).contains(this.superType)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
for (SuperType s : superTypes) {
|
||||
if (attachedTo.getSuperType().contains(s)) {
|
||||
if (attachedTo.getSuperType(game).contains(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class TargetHasSuperTypeCondition implements Condition {
|
|||
if (!source.getTargets().isEmpty()) {
|
||||
MageObject mageObject = game.getObject(source.getFirstTarget());
|
||||
if (mageObject != null) {
|
||||
return mageObject.getSuperType().contains(superType);
|
||||
return mageObject.getSuperType(game).contains(superType);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import mage.abilities.effects.ContinuousEffectImpl;
|
|||
import mage.cards.Card;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.CommandObject;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
|
|
@ -112,9 +111,9 @@ public class CopyEffect extends ContinuousEffectImpl {
|
|||
permanent.removeAllSubTypes(game);
|
||||
permanent.copySubTypesFrom(game, copyFromObject);
|
||||
|
||||
permanent.getSuperType().clear();
|
||||
for (SuperType type : copyFromObject.getSuperType()) {
|
||||
permanent.addSuperType(type);
|
||||
permanent.removeAllSuperTypes(game);
|
||||
for (SuperType type : copyFromObject.getSuperType(game)) {
|
||||
permanent.addSuperType(game, type);
|
||||
}
|
||||
|
||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ public class CopyTokenEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
permanent.removeAllSubTypes(game);
|
||||
permanent.copySubTypesFrom(game, token);
|
||||
permanent.getSuperType().clear();
|
||||
for (SuperType type : token.getSuperType()) {
|
||||
permanent.addSuperType(type);
|
||||
permanent.removeAllSuperTypes(game);
|
||||
for (SuperType type : token.getSuperType(game)) {
|
||||
permanent.addSuperType(game, type);
|
||||
}
|
||||
permanent.getAbilities().clear();
|
||||
for (Ability ability : token.getAbilities()) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.Locale;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
|
@ -34,8 +34,8 @@ public class AddCardSuperTypeAttachedEffect extends ContinuousEffectImpl {
|
|||
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
Permanent target = game.getPermanent(equipment.getAttachedTo());
|
||||
if (target != null && !target.getSuperType().contains(addedSuperType)) {
|
||||
target.addSuperType(addedSuperType);
|
||||
if (target != null) {
|
||||
target.addSuperType(game, addedSuperType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -106,10 +106,8 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
permanent.copySubTypesFrom(game, token);
|
||||
|
||||
for (SuperType t : token.getSuperType()) {
|
||||
if (!permanent.getSuperType().contains(t)) {
|
||||
permanent.addSuperType(t);
|
||||
}
|
||||
for (SuperType t : token.getSuperType(game)) {
|
||||
permanent.addSuperType(game, t);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -62,9 +62,8 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
for (SuperType t : token.getSuperType()) {
|
||||
permanent.addSuperType(t);
|
||||
|
||||
for (SuperType t : token.getSuperType(game)) {
|
||||
permanent.addSuperType(game, t);
|
||||
}
|
||||
// card type
|
||||
switch (loseType) {
|
||||
|
|
|
|||
|
|
@ -108,10 +108,8 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
permanent.copySubTypesFrom(game, token);
|
||||
|
||||
for (SuperType t : token.getSuperType()) {
|
||||
if (!permanent.getSuperType().contains(t)) {
|
||||
permanent.addSuperType(t);
|
||||
}
|
||||
for (SuperType t : token.getSuperType(game)) {
|
||||
permanent.addSuperType(game, t);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
permanent.setName("");
|
||||
permanent.getSuperType().clear();
|
||||
permanent.removeAllSuperTypes(game);
|
||||
permanent.removeAllCardTypes(game);
|
||||
permanent.addCardType(game, CardType.CREATURE);
|
||||
permanent.removeAllSubTypes(game);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
permanent.setName("");
|
||||
permanent.getSuperType().clear();
|
||||
permanent.removeAllSuperTypes(game);
|
||||
permanent.removeAllCardTypes(game);
|
||||
permanent.addCardType(game, CardType.CREATURE);
|
||||
permanent.removeAllSubTypes(game);
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ public class MorphAbility extends AlternativeSourceCostsImpl {
|
|||
targetObject.removeAllCardTypes(game);
|
||||
targetObject.addCardType(game, CardType.CREATURE);
|
||||
targetObject.removeAllSubTypes(game);
|
||||
targetObject.getSuperType().clear();
|
||||
targetObject.removeAllSuperTypes(game);
|
||||
targetObject.getManaCost().clear();
|
||||
|
||||
Token emptyImage = new EmptyToken();
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ public class TransformAbility extends SimpleStaticAbility {
|
|||
}
|
||||
permanent.removeAllSubTypes(game);
|
||||
permanent.copySubTypesFrom(game, sourceCard);
|
||||
permanent.getSuperType().clear();
|
||||
for (SuperType type : sourceCard.getSuperType()) {
|
||||
permanent.addSuperType(type);
|
||||
permanent.removeAllSuperTypes(game);
|
||||
for (SuperType type : sourceCard.getSuperType(game)) {
|
||||
permanent.addSuperType(game, type);
|
||||
}
|
||||
|
||||
CardUtil.copySetAndCardNumber(permanent, sourceCard);
|
||||
|
|
@ -81,15 +81,11 @@ public class TransformAbility extends SimpleStaticAbility {
|
|||
// TODO: must be removed after transform cards (one side) migrated to MDF engine (multiple sides)
|
||||
Card newCard = mainSide.copy();
|
||||
newCard.setName(otherSide.getName());
|
||||
newCard.getSuperType().clear();
|
||||
|
||||
// mana value must be from main side only
|
||||
newCard.getManaCost().clear();
|
||||
newCard.getManaCost().add(mainSide.getManaCost().copy());
|
||||
|
||||
for (SuperType type : otherSide.getSuperType()) {
|
||||
newCard.addSuperType(type);
|
||||
}
|
||||
game.getState().getCardState(newCard.getId()).clearAbilities();
|
||||
for (Ability ability : otherSide.getAbilities()) {
|
||||
game.getState().addOtherAbility(newCard, ability);
|
||||
|
|
@ -108,6 +104,8 @@ public class TransformAbility extends SimpleStaticAbility {
|
|||
moa.getColor().setColor(otherSide.getColor(game));
|
||||
moa.getCardType().clear();
|
||||
moa.getCardType().addAll(otherSide.getCardType(game));
|
||||
moa.getSuperType().clear();
|
||||
moa.getSuperType().addAll(otherSide.getSuperType(game));
|
||||
moa.getSubtype().clear();
|
||||
moa.getSubtype().addAll(otherSide.getSubtype(game));
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import mage.util.CardUtil;
|
|||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -181,10 +180,10 @@ public abstract class ModalDoubleFacesCard extends CardImpl implements CardWithH
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<SuperType> getSuperType() {
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
// CardImpl's constructor can call some code on init, so you must check left/right before
|
||||
// it's a bad workaround
|
||||
return leftHalfCard != null ? leftHalfCard.getSuperType() : supertype;
|
||||
return leftHalfCard != null ? leftHalfCard.getSuperType(game) : supertype;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ import mage.util.CardUtil;
|
|||
import mage.util.SubTypes;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -363,8 +365,8 @@ public class CardInfo {
|
|||
this.subtypes = joinList(subtypes);
|
||||
}
|
||||
|
||||
public final Set<SuperType> getSupertypes() {
|
||||
Set<SuperType> list = EnumSet.noneOf(SuperType.class);
|
||||
public final List<SuperType> getSupertypes() {
|
||||
List<SuperType> list = new ArrayList<>();
|
||||
for (String type : this.supertypes.split(SEPARATOR)) {
|
||||
try {
|
||||
list.add(SuperType.valueOf(type));
|
||||
|
|
@ -374,7 +376,7 @@ public class CardInfo {
|
|||
return list;
|
||||
}
|
||||
|
||||
public final void setSuperTypes(Set<SuperType> superTypes) {
|
||||
public final void setSuperTypes(List<SuperType> superTypes) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (SuperType item : superTypes) {
|
||||
sb.append(item.name()).append(SEPARATOR);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public enum SuperType {
|
|||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
return input.getSuperType().contains(supertype);
|
||||
return input.getSuperType(game).contains(supertype);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import mage.MageInt;
|
|||
import mage.MageObject;
|
||||
import mage.MageObjectImpl;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -16,17 +14,17 @@ import mage.constants.SubType;
|
|||
import mage.constants.SuperType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public abstract class Designation extends MageObjectImpl {
|
||||
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCostsImpl emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
|
|
@ -93,7 +91,7 @@ public abstract class Designation extends MageObjectImpl {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptyList;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -112,8 +110,8 @@ public abstract class Designation extends MageObjectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<SuperType> getSuperType() {
|
||||
return EnumSet.noneOf(SuperType.class);
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class CardTextPredicate implements Predicate<Card> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
for (SuperType superType : input.getSuperType()) {
|
||||
for (SuperType superType : input.getSuperType(game)) {
|
||||
if (superType.toString().equalsIgnoreCase(token)) {
|
||||
found = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2397,7 +2397,7 @@ public abstract class GameImpl implements Game {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (perm.isWorld()) {
|
||||
if (perm.isWorld(this)) {
|
||||
worldEnchantment.add(perm);
|
||||
}
|
||||
if (perm.hasSubtype(SubType.AURA, this)) {
|
||||
|
|
@ -2569,7 +2569,7 @@ public abstract class GameImpl implements Game {
|
|||
}
|
||||
}
|
||||
|
||||
if (perm.isLegendary() && perm.legendRuleApplies()) {
|
||||
if (perm.isLegendary(this) && perm.legendRuleApplies()) {
|
||||
legendary.add(perm);
|
||||
}
|
||||
if (StaticFilters.FILTER_PERMANENT_EQUIPMENT.match(perm, this)) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package mage.game;
|
|||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -17,20 +18,23 @@ import java.util.List;
|
|||
*/
|
||||
public class MageObjectAttribute implements Serializable {
|
||||
|
||||
protected ObjectColor color;
|
||||
protected SubTypes subtype;
|
||||
protected List<CardType> cardType;
|
||||
protected final ObjectColor color;
|
||||
protected final SubTypes subtype;
|
||||
protected final List<CardType> cardType;
|
||||
protected final List<SuperType> superType;
|
||||
|
||||
public MageObjectAttribute(MageObject mageObject, Game game) {
|
||||
color = mageObject.getColor().copy();
|
||||
subtype = new SubTypes(mageObject.getSubtype(game));
|
||||
cardType = new ArrayList<>(mageObject.getCardType(game));
|
||||
superType = new ArrayList<>(mageObject.getSuperType(game));
|
||||
}
|
||||
|
||||
public MageObjectAttribute(MageObjectAttribute mageObjectAttribute) {
|
||||
this.color = mageObjectAttribute.color;
|
||||
this.subtype = mageObjectAttribute.subtype;
|
||||
this.cardType = mageObjectAttribute.cardType;
|
||||
this.superType = mageObjectAttribute.superType;
|
||||
}
|
||||
|
||||
public MageObjectAttribute copy() {
|
||||
|
|
@ -48,4 +52,8 @@ public class MageObjectAttribute implements Serializable {
|
|||
public List<CardType> getCardType() {
|
||||
return cardType;
|
||||
}
|
||||
|
||||
public List<SuperType> getSuperType() {
|
||||
return superType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,11 +134,11 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
}
|
||||
}
|
||||
if (ability.getSupertype() != null) {
|
||||
if (perm.getSuperType().contains(ability.getSupertype())) {
|
||||
if (perm.getSuperType(game).contains(ability.getSupertype())) {
|
||||
for (UUID bandedId : creatureIds) {
|
||||
if (!bandedId.equals(creatureId)) {
|
||||
Permanent banded = game.getPermanent(bandedId);
|
||||
if (banded != null && banded.getSuperType().contains(ability.getSupertype())) {
|
||||
if (banded != null && banded.getSuperType(game).contains(ability.getSupertype())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import mage.constants.SubType;
|
|||
import mage.constants.SuperType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
@ -181,8 +180,8 @@ public class Commander extends CommandObjectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<SuperType> getSuperType() {
|
||||
return sourceObject.getSuperType();
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
return sourceObject.getSuperType(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import mage.game.command.dungeons.TombOfAnnihilationDungeon;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -45,7 +44,7 @@ public class Dungeon extends CommandObjectImpl {
|
|||
dungeonNames.add("Dungeon of the Mad Mage");
|
||||
}
|
||||
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(Arrays.asList(CardType.DUNGEON));
|
||||
private static final List<CardType> cardTypes = Collections.unmodifiableList(Arrays.asList(CardType.DUNGEON));
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
|
|
@ -204,7 +203,7 @@ public class Dungeon extends CommandObjectImpl {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptyList;
|
||||
return cardTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -223,8 +222,8 @@ public class Dungeon extends CommandObjectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<SuperType> getSuperType() {
|
||||
return EnumSet.noneOf(SuperType.class);
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import mage.abilities.costs.mana.ManaCosts;
|
|||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.FrameStyle;
|
||||
import mage.cards.repository.TokenInfo;
|
||||
import mage.cards.repository.TokenRepository;
|
||||
|
|
@ -20,19 +19,17 @@ import mage.constants.SubType;
|
|||
import mage.constants.SuperType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.RandomUtil;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
public abstract class Emblem extends CommandObjectImpl {
|
||||
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
|
|
@ -121,7 +118,7 @@ public abstract class Emblem extends CommandObjectImpl {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptyList;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -140,8 +137,8 @@ public abstract class Emblem extends CommandObjectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<SuperType> getSuperType() {
|
||||
return EnumSet.noneOf(SuperType.class);
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import mage.abilities.costs.mana.ManaCosts;
|
|||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.FrameStyle;
|
||||
import mage.cards.repository.TokenInfo;
|
||||
import mage.cards.repository.TokenRepository;
|
||||
|
|
@ -21,19 +20,19 @@ import mage.constants.SubType;
|
|||
import mage.constants.SuperType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.RandomUtil;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
*/
|
||||
public abstract class Plane extends CommandObjectImpl {
|
||||
|
||||
private static final List<CardType> emptyList = Collections.unmodifiableList(new ArrayList<>());
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
|
|
@ -144,7 +143,7 @@ public abstract class Plane extends CommandObjectImpl {
|
|||
|
||||
@Override
|
||||
public List<CardType> getCardType(Game game) {
|
||||
return emptyList;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -163,8 +162,8 @@ public abstract class Plane extends CommandObjectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<SuperType> getSuperType() {
|
||||
return EnumSet.noneOf(SuperType.class);
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class TheRingEmblemLegendaryEffect extends ContinuousEffectImpl {
|
|||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
permanent.addSuperType(SuperType.LEGENDARY);
|
||||
permanent.addSuperType(game, SuperType.LEGENDARY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public class PermanentToken extends PermanentImpl {
|
|||
this.frameColor = token.getFrameColor(game);
|
||||
this.frameStyle = token.getFrameStyle();
|
||||
this.supertype.clear();
|
||||
this.supertype.addAll(token.getSuperType());
|
||||
this.supertype.addAll(token.getSuperType(game));
|
||||
this.subtype.copyFrom(token.getSubtype(game));
|
||||
this.startingLoyalty = token.getStartingLoyalty();
|
||||
this.startingDefense = token.getStartingDefense();
|
||||
|
|
|
|||
|
|
@ -568,8 +568,8 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<SuperType> getSuperType() {
|
||||
return card.getSuperType();
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
return card.getSuperType(game);
|
||||
}
|
||||
|
||||
public List<SpellAbility> getSpellAbilities() {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ import mage.util.SubTypes;
|
|||
import mage.util.functions.StackObjectCopyApplier;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -199,8 +202,8 @@ public class StackAbility extends StackObjectImpl implements Ability {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<SuperType> getSuperType() {
|
||||
return EnumSet.noneOf(SuperType.class);
|
||||
public List<SuperType> getSuperType(Game game) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class ManaPaidSourceWatcher extends Watcher {
|
|||
if (sourceObject != null && sourceObject.isCreature(game)) {
|
||||
creature++;
|
||||
}
|
||||
if (sourceObject != null && !sourceObject.isSnow()) {
|
||||
if (sourceObject != null && !sourceObject.isSnow(game)) {
|
||||
return;
|
||||
}
|
||||
switch (manaType) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue