mirror of
https://github.com/correl/mage.git
synced 2024-11-14 11:09:31 +00:00
[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
|
@ -1,12 +1,11 @@
|
|||
package mage.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.SuperType;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -30,7 +29,7 @@ public class AbilityView extends CardView {
|
|||
this.defense = "";
|
||||
this.cardTypes = new ArrayList<>();
|
||||
this.subTypes = new SubTypes();
|
||||
this.superTypes = EnumSet.noneOf(SuperType.class);
|
||||
this.superTypes = new ArrayList<>();
|
||||
this.color = new ObjectColor();
|
||||
this.manaCostLeftStr = String.join("", ability.getManaCostSymbols());
|
||||
this.manaCostRightStr = "";
|
||||
|
|
|
@ -71,7 +71,7 @@ public class CardView extends SimpleCardView {
|
|||
protected String startingDefense;
|
||||
protected List<CardType> cardTypes;
|
||||
protected SubTypes subTypes;
|
||||
protected Set<SuperType> superTypes;
|
||||
protected List<SuperType> superTypes;
|
||||
protected ObjectColor color;
|
||||
protected ObjectColor frameColor;
|
||||
protected FrameStyle frameStyle;
|
||||
|
@ -256,7 +256,7 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
private static String getCardTypeLine(Game game, Card card) {
|
||||
StringBuilder sbType = new StringBuilder();
|
||||
for (SuperType superType : card.getSuperType()) {
|
||||
for (SuperType superType : card.getSuperType(game)) {
|
||||
sbType.append(superType).append(' ');
|
||||
}
|
||||
for (CardType cardType : card.getCardType(game)) {
|
||||
|
@ -479,7 +479,7 @@ public class CardView extends SimpleCardView {
|
|||
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||
this.cardTypes = new ArrayList<>(card.getCardType(game));
|
||||
this.subTypes = new SubTypes(card.getSubtype(game));
|
||||
this.superTypes = card.getSuperType();
|
||||
this.superTypes = card.getSuperType(game);
|
||||
this.color = card.getColor(game).copy();
|
||||
this.flipCard = card.isFlipCard();
|
||||
this.faceDown = !showFaceUp;
|
||||
|
@ -626,7 +626,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
this.cardTypes = new ArrayList<>(object.getCardType(game));
|
||||
this.subTypes = new SubTypes(object.getSubtype(game));
|
||||
this.superTypes = object.getSuperType();
|
||||
this.superTypes = new ArrayList<>(object.getSuperType(game));
|
||||
this.color = object.getColor(game).copy();
|
||||
this.manaCostLeftStr = String.join("", object.getManaCostSymbols());
|
||||
this.manaCostRightStr = "";
|
||||
|
@ -778,7 +778,7 @@ public class CardView extends SimpleCardView {
|
|||
this.startingDefense = "";
|
||||
this.cardTypes = new ArrayList<>();
|
||||
this.subTypes = new SubTypes();
|
||||
this.superTypes = EnumSet.noneOf(SuperType.class);
|
||||
this.superTypes = new ArrayList<>();
|
||||
this.color = new ObjectColor();
|
||||
this.frameColor = new ObjectColor();
|
||||
this.frameStyle = FrameStyle.M15_NORMAL;
|
||||
|
@ -830,7 +830,7 @@ public class CardView extends SimpleCardView {
|
|||
this.startingDefense = "";
|
||||
this.cardTypes = new ArrayList<>(token.getCardType(game));
|
||||
this.subTypes = new SubTypes(token.getSubtype(game));
|
||||
this.superTypes = token.getSuperType();
|
||||
this.superTypes = new ArrayList<>(token.getSuperType(game));
|
||||
this.color = token.getColor(game).copy();
|
||||
this.frameColor = token.getFrameColor(game).copy();
|
||||
this.frameStyle = token.getFrameStyle();
|
||||
|
@ -939,7 +939,7 @@ public class CardView extends SimpleCardView {
|
|||
return subTypes;
|
||||
}
|
||||
|
||||
public Set<SuperType> getSuperTypes() {
|
||||
public List<SuperType> getSuperTypes() {
|
||||
return superTypes;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,13 +47,13 @@ public class StackAbilityView extends CardView {
|
|||
|
||||
this.cardTypes = ability.getCardType(game);
|
||||
this.subTypes = ability.getSubtype(game);
|
||||
this.superTypes = ability.getSuperType();
|
||||
this.superTypes = ability.getSuperType(game);
|
||||
this.color = ability.getColor(game);
|
||||
this.manaCostLeftStr = String.join("", ability.getManaCostSymbols());
|
||||
this.manaCostRightStr = "";
|
||||
this.cardTypes = ability.getCardType(game);
|
||||
this.subTypes = ability.getSubtype(game);
|
||||
this.superTypes = ability.getSuperType();
|
||||
this.superTypes = ability.getSuperType(game);
|
||||
this.color = ability.getColor(game);
|
||||
this.power = ability.getPower().toString();
|
||||
this.toughness = ability.getToughness().toString();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
|
@ -8,10 +7,10 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.constants.*;
|
||||
import mage.abilities.keyword.StormAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
|
@ -19,8 +18,9 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class AeveProgenitorOoze extends CardImpl {
|
||||
|
@ -82,7 +82,7 @@ class AeveProgenitorOozeNonLegendaryEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent instanceof PermanentToken) {
|
||||
permanent.getSuperType().remove(SuperType.LEGENDARY);
|
||||
permanent.removeSuperType(game, SuperType.LEGENDARY);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class AugmenterPugilist extends ModalDoubleFacesCard {
|
|||
super(ownerId, setInfo,
|
||||
new CardType[]{CardType.CREATURE}, new SubType[]{SubType.TROLL, SubType.DRUID}, "{1}{G}{G}",
|
||||
"Echoing Equation", new CardType[]{CardType.SORCERY}, new SubType[]{}, "{3}{U}{U}");
|
||||
|
||||
|
||||
// 1.
|
||||
// Augmenter Pugilist
|
||||
// Creature — Troll Druid
|
||||
|
@ -99,7 +99,7 @@ class EchoingEquationEffect extends OneShotEffect {
|
|||
.forEach(copyTo -> game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new CopyApplier() {
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID targetObjectId) {
|
||||
blueprint.getSuperType().remove(SuperType.LEGENDARY);
|
||||
blueprint.removeSuperType(SuperType.LEGENDARY);
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -100,7 +100,7 @@ class BardClassReplacementEffect extends ReplacementEffectImpl {
|
|||
return creature != null
|
||||
&& creature.isControlledBy(source.getControllerId())
|
||||
&& creature.isCreature(game)
|
||||
&& creature.isLegendary();
|
||||
&& creature.isLegendary(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -56,7 +56,7 @@ enum BreakTheIcePredicate implements Predicate<Permanent> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return input.isSnow()
|
||||
return input.isSnow(game)
|
||||
|| input
|
||||
.getAbilities()
|
||||
.getActivatedManaAbilities(Zone.BATTLEFIELD)
|
||||
|
|
|
@ -69,7 +69,7 @@ class ChokingSandsEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
|
||||
if (permanent != null && !permanent.isBasic()) {
|
||||
if (permanent != null && !permanent.isBasic(game)) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
player.damage(2, source.getSourceId(), source, game);
|
||||
|
|
|
@ -80,7 +80,7 @@ class CorneredMarketReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
|||
}
|
||||
// play land check
|
||||
if (card.isLand(game)
|
||||
&& !card.isBasic()) {
|
||||
&& !card.isBasic(game)) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||
if (permanent != null) {
|
||||
if (CardUtil.haveSameNames(card, permanent.getName(), game)) {
|
||||
|
|
|
@ -83,7 +83,7 @@ enum DoubleMajorApplier implements StackObjectCopyApplier {
|
|||
|
||||
@Override
|
||||
public void modifySpell(StackObject stackObject, Game game) {
|
||||
stackObject.getSuperType().remove(SuperType.LEGENDARY);
|
||||
stackObject.removeSuperType(SuperType.LEGENDARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -193,7 +193,7 @@ class DraugrNecromancerSpendAnyManaEffect extends AsThoughEffectImpl implements
|
|||
|
||||
@Override
|
||||
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
|
||||
if (mana.getSourceObject() != null && mana.getSourceObject().isSnow()) {
|
||||
if (mana.getSourceObject() != null && mana.getSourceObject().isSnow(game)) {
|
||||
return mana.getFirstAvailable();
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -82,7 +82,7 @@ class EllywickTumblestrumEffect extends OneShotEffect {
|
|||
player.revealCards(source, new CardsImpl(card), game);
|
||||
player.moveCards(card, Zone.HAND, source, game);
|
||||
cards.remove(card);
|
||||
if (card.isLegendary()) {
|
||||
if (card.isLegendary(game)) {
|
||||
player.gainLife(3, game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class EmbiggenEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
int count = permanent
|
||||
.getSuperType()
|
||||
.getSuperType(game)
|
||||
.size()
|
||||
+ permanent
|
||||
.getCardType(game)
|
||||
|
|
|
@ -126,7 +126,7 @@ class EyeOfSingularityTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (permanent != null && !permanent.isBasic()) {
|
||||
if (permanent != null && !permanent.isBasic(game)) {
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class FeastOfWormsEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
targetPlayer = game.getPlayer(permanent.getControllerId());
|
||||
}
|
||||
if (targetPlayer != null && permanent != null && (permanent.isLegendary())) {
|
||||
if (targetPlayer != null && permanent != null && (permanent.isLegendary(game))) {
|
||||
FilterControlledPermanent filter = new FilterControlledLandPermanent("land to sacrifice");
|
||||
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
|
||||
|
|
|
@ -74,7 +74,7 @@ class FrostAugurEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
player.lookAtCards("", card, game);
|
||||
if (card.isSnow() && player.chooseUse(
|
||||
if (card.isSnow(game) && player.chooseUse(
|
||||
outcome, "Reveal " + card.getName() + " and put it into your hand?", source, game
|
||||
)) {
|
||||
player.revealCards(source, new CardsImpl(card), game);
|
||||
|
|
|
@ -84,7 +84,7 @@ class GauntletOfPowerTapForManaAllTriggeredAbility extends TriggeredManaAbility
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
TappedForManaEvent mEvent = (TappedForManaEvent) event;
|
||||
Permanent permanent = mEvent.getPermanent();
|
||||
if (permanent == null || !permanent.isLand() || !permanent.isBasic()) {
|
||||
if (permanent == null || !permanent.isLand() || !permanent.isBasic(game)) {
|
||||
return false;
|
||||
}
|
||||
ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color");
|
||||
|
|
|
@ -60,7 +60,7 @@ class AttachedToBasicMountainCondition implements Condition {
|
|||
if (enchantment != null) {
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (enchanted != null) {
|
||||
if (enchanted.hasSubtype(SubType.MOUNTAIN, game) && enchanted.isBasic()) {
|
||||
if (enchanted.hasSubtype(SubType.MOUNTAIN, game) && enchanted.isBasic(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class GoblinFurrierPreventEffectEffect extends PreventionEffectImpl {
|
|||
if (super.applies(event, source, game)) {
|
||||
if (event.getSourceId().equals(source.getSourceId())) {
|
||||
Permanent damageTo = game.getPermanent(event.getTargetId());
|
||||
return damageTo != null && damageTo.isSnow();
|
||||
return damageTo != null && damageTo.isSnow(game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -64,7 +64,7 @@ class HauntingEchoesEffect extends OneShotEffect {
|
|||
.getCards(game)
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(card -> !card.isBasic() || !card.isLand(game))
|
||||
.filter(card -> !card.isBasic(game) || !card.isLand(game))
|
||||
.forEach(cards::add);
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
cards.removeIf(uuid -> game.getState().getZone(uuid) != Zone.EXILED);
|
||||
|
|
|
@ -73,7 +73,7 @@ class HelldozerEffect extends OneShotEffect {
|
|||
Permanent helldozer = game.getPermanent(source.getSourceId());
|
||||
Permanent landTarget = game.getPermanent(source.getFirstTarget());
|
||||
if (landTarget != null) {
|
||||
boolean wasNonBasic = !landTarget.isBasic();
|
||||
boolean wasNonBasic = !landTarget.isBasic(game);
|
||||
landTarget.destroy(source, game, false);
|
||||
if (wasNonBasic
|
||||
&& helldozer != null) {
|
||||
|
|
|
@ -70,7 +70,7 @@ class HiddenHerdAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent land = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
return game.getOpponents(controllerId).contains(event.getPlayerId()) && !land.getSuperType().contains(SuperType.BASIC);
|
||||
return game.getOpponents(controllerId).contains(event.getPlayerId()) && !land.isBasic(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -76,7 +76,7 @@ enum HiveheartShamanPredicate implements ObjectSourcePlayerPredicate<Card> {
|
|||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
if (!input.getObject().isBasic() || !input.getObject().isLand(game)) {
|
||||
if (!input.getObject().isBasic(game) || !input.getObject().isLand(game)) {
|
||||
return false;
|
||||
}
|
||||
return game.getBattlefield()
|
||||
|
|
|
@ -63,7 +63,7 @@ class IcequakeEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(permanent.getControllerId());
|
||||
if (controller != null) {
|
||||
permanent.destroy(source, game, false);
|
||||
if (permanent.isSnow()) {
|
||||
if (permanent.isSnow(game)) {
|
||||
controller.damage(1, source.getSourceId(), source, game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -82,7 +82,7 @@ class IllusionaryTerrainEffect extends ContinuousEffectImpl {
|
|||
&& firstChoice != null
|
||||
&& secondChoice != null) {
|
||||
for (Permanent land : lands) {
|
||||
if (land.isBasic()) {
|
||||
if (land.isBasic(game)) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
// the land mana ability is intrinsic, so add it here, not layer 6
|
||||
|
|
|
@ -92,7 +92,7 @@ class InstrumentOfTheBardsEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
controller.revealCards(permanent.getIdName(), new CardsImpl(card), game);
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
if (card.isLegendary()) {
|
||||
if (card.isLegendary(game)) {
|
||||
new TreasureToken().putOntoBattlefield(1, game, source, source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class IsolatedWatchtowerEffect extends OneShotEffect {
|
|||
}
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
player.revealCards(source, new CardsImpl(card), game);
|
||||
if (card.isBasic() && card.isLand(game)) {
|
||||
if (card.isBasic(game) && card.isLand(game)) {
|
||||
player.moveCards(
|
||||
card, Zone.BATTLEFIELD, source,
|
||||
game, true, false, true, null
|
||||
|
|
|
@ -102,7 +102,7 @@ class JodahTheUnifierEffect extends OneShotEffect {
|
|||
exiledCards.add(card);
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
game.getState().processAction(game);
|
||||
if (card.isLegendary() && !card.isLand(game) && card.getManaValue() < manaValue) {
|
||||
if (card.isLegendary(game) && !card.isLand(game) && card.getManaValue() < manaValue) {
|
||||
CardUtil.castSpellWithAttributesForFree(controller, source, game, card);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -121,14 +121,14 @@ class JourneyForTheElixirLibraryTarget extends TargetCardInLibrary {
|
|||
return true;
|
||||
}
|
||||
Cards cards = new CardsImpl(this.getTargets());
|
||||
if (card.isBasic()
|
||||
if (card.isBasic(game)
|
||||
&& card.isLand(game)
|
||||
&& cards
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(MageObject::isBasic)
|
||||
.anyMatch(card1 -> card1.isLand(game))) {
|
||||
.filter(c -> c.isBasic(game))
|
||||
.anyMatch(c -> c.isLand(game))) {
|
||||
return false;
|
||||
}
|
||||
if (name.equals(card.getName())
|
||||
|
@ -185,14 +185,14 @@ class JourneyForTheElixirGraveyardTarget extends TargetCardInYourGraveyard {
|
|||
.getCards(game)
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(card1 -> card1.isLand(game))
|
||||
.anyMatch(MageObject::isBasic);
|
||||
.filter(c -> c.isLand(game))
|
||||
.anyMatch(c -> c.isBasic(game));
|
||||
possibleTargets.removeIf(uuid -> {
|
||||
Card card = game.getCard(uuid);
|
||||
return card != null
|
||||
&& hasBasic
|
||||
&& card.isLand(game)
|
||||
&& card.isBasic();
|
||||
&& card.isBasic(game);
|
||||
});
|
||||
boolean hasYanggu = alreadyTargeted
|
||||
.getCards(game)
|
||||
|
|
|
@ -9,7 +9,6 @@ import mage.abilities.costs.common.ExileFromGraveCost;
|
|||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
|
@ -90,7 +89,7 @@ class KethisTheHiddenHandEffect extends ContinuousEffectImpl {
|
|||
.stream()
|
||||
.map(game::getCard)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(Card::isLegendary)
|
||||
.filter(card1 -> card1.isLegendary(game))
|
||||
.forEach(card -> affectedObjectList.add(new MageObjectReference(card, game)));
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ class TheRinghartCrestManaCondition extends CreatureCastManaCondition {
|
|||
if (super.apply(game, source)) {
|
||||
MageObject object = game.getObject(source);
|
||||
if (object != null) {
|
||||
if (object.isLegendary()) {
|
||||
if (object.isLegendary(game)) {
|
||||
return true;
|
||||
}
|
||||
return creatureType != null && object.hasSubtype(creatureType, game);
|
||||
|
|
|
@ -61,7 +61,7 @@ class SetSupertypeAllEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
permanent.addSuperType(SuperType.LEGENDARY);
|
||||
permanent.addSuperType(game, SuperType.LEGENDARY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,18 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Melting extends CardImpl {
|
||||
|
@ -63,7 +55,7 @@ class MeltingEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
permanent.getSuperType().remove(SuperType.SNOW);
|
||||
permanent.removeSuperType(game, SuperType.SNOW);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -127,9 +127,9 @@ class MetamorphicAlterationEffect extends ContinuousEffectImpl {
|
|||
|
||||
CardUtil.copySetAndCardNumber(permanent, copied);
|
||||
|
||||
permanent.getSuperType().clear();
|
||||
for (SuperType t : copied.getSuperType()) {
|
||||
permanent.addSuperType(t);
|
||||
permanent.removeAllCardTypes(game);
|
||||
for (SuperType t : copied.getSuperType(game)) {
|
||||
permanent.addSuperType(game, t);
|
||||
}
|
||||
permanent.removeAllCardTypes(game);
|
||||
for (CardType cardType : copied.getCardType(game)) {
|
||||
|
|
|
@ -161,7 +161,7 @@ class MindlinkMechWatcher extends Watcher {
|
|||
.stream()
|
||||
.filter(mor -> {
|
||||
Permanent permanent = mor.getPermanent(game);
|
||||
return permanent != null && !permanent.isLegendary() && permanent.isCreature(game);
|
||||
return permanent != null && !permanent.isLegendary(game) && permanent.isCreature(game);
|
||||
}).map(MageObjectReferencePredicate::new)
|
||||
.collect(Collectors.toSet());
|
||||
if (predicates.isEmpty()) {
|
||||
|
|
|
@ -60,7 +60,7 @@ class MoltenRainEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
|
||||
if (permanent != null && !permanent.isBasic()) {
|
||||
if (permanent != null && !permanent.isBasic(game)) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
player.damage(2, source.getSourceId(), source, game);
|
||||
|
|
|
@ -57,7 +57,7 @@ enum MoonsilverKeyPredicate implements Predicate<Card> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
if (input.isLand(game) && input.isBasic()) {
|
||||
if (input.isLand(game) && input.isBasic(game)) {
|
||||
return true;
|
||||
}
|
||||
return input.isArtifact(game)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.StaticAbility;
|
||||
|
@ -15,9 +12,9 @@ import mage.abilities.effects.common.DrawCardTargetEffect;
|
|||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.*;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.mageobject.MageObjectReferencePredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -30,8 +27,10 @@ import mage.target.TargetPlayer;
|
|||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.util.functions.StackObjectCopyApplier;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class ObNixilisTheAdversary extends CardImpl {
|
||||
|
@ -170,7 +169,7 @@ class ObNixilisTheAdversaryApplier implements StackObjectCopyApplier {
|
|||
|
||||
@Override
|
||||
public void modifySpell(StackObject stackObject, Game game) {
|
||||
stackObject.getSuperType().remove(SuperType.LEGENDARY);
|
||||
stackObject.removeSuperType(SuperType.LEGENDARY);
|
||||
stackObject.setStartingLoyalty(loyalty);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,6 @@ class PaleMoonReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = ((TappedForManaEvent) event).getPermanent();
|
||||
return permanent != null && permanent.isLand(game) && !permanent.isBasic();
|
||||
return permanent != null && permanent.isLand(game) && !permanent.isBasic(game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class PlarggDeanOfChaosEffect extends OneShotEffect {
|
|||
Card eligibleCard = null;
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
toReveal.add(card);
|
||||
if (!card.isLand(game) && !card.isLegendary() && card.getManaValue() < 4) {
|
||||
if (!card.isLand(game) && !card.isLegendary(game) && card.getManaValue() < 4) {
|
||||
eligibleCard = card;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class PlazaOfHeroesManaCondition extends ManaCondition implements Condition {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
MageObject object = game.getObject(source);
|
||||
if (object != null && object.isLegendary()) {
|
||||
if (object != null && object.isLegendary(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,6 @@ class PulseOfLlanowarReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = ((TappedForManaEvent) event).getPermanent();
|
||||
return permanent != null && permanent.isLand(game) && permanent.isBasic() && permanent.isControlledBy(source.getControllerId());
|
||||
return permanent != null && permanent.isLand(game) && permanent.isBasic(game) && permanent.isControlledBy(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class RegentsAuthorityEffect extends OneShotEffect {
|
|||
}
|
||||
if (!permanent.isEnchantment(game)
|
||||
&& (!permanent.isCreature(game)
|
||||
|| !permanent.isLegendary())) {
|
||||
|| !permanent.isLegendary(game))) {
|
||||
game.addEffect(new BoostTargetEffect(2, 2), source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class RimefeatherOwlEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
permanent.addSuperType(SuperType.SNOW);
|
||||
permanent.addSuperType(game, SuperType.SNOW);
|
||||
|
||||
}
|
||||
return true;
|
||||
|
|
80
Mage.Sets/src/mage/cards/r/RootpathPurifier.java
Normal file
80
Mage.Sets/src/mage/cards/r/RootpathPurifier.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class RootpathPurifier extends CardImpl {
|
||||
|
||||
public RootpathPurifier(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.ELF);
|
||||
this.subtype.add(SubType.DRUID);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Lands you control and land cards in your library are basic.
|
||||
this.addAbility(new SimpleStaticAbility(new RootpathPurifierEffect()));
|
||||
}
|
||||
|
||||
private RootpathPurifier(final RootpathPurifier card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RootpathPurifier copy() {
|
||||
return new RootpathPurifier(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RootpathPurifierEffect extends ContinuousEffectImpl {
|
||||
|
||||
RootpathPurifierEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "lands you control and land cards in your library are basic";
|
||||
}
|
||||
|
||||
private RootpathPurifierEffect(final RootpathPurifierEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RootpathPurifierEffect copy() {
|
||||
return new RootpathPurifierEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND,
|
||||
source.getControllerId(), source, game
|
||||
)) {
|
||||
permanent.addSuperType(game, SuperType.BASIC);
|
||||
}
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
if (card.isLand(game)) {
|
||||
card.addSuperType(game, SuperType.BASIC);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -72,7 +72,7 @@ class RowenAbility extends TriggeredAbilityImpl {
|
|||
lastTriggeredTurn = game.getTurnNum();
|
||||
controller.revealCards(sourcePermanent.getName(), new CardsImpl(card), game);
|
||||
this.getEffects().clear();
|
||||
if (card.isLand(game) && card.isBasic()) {
|
||||
if (card.isLand(game) && card.isBasic(game)) {
|
||||
this.addEffect(new DrawCardSourceControllerEffect(1));
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -21,6 +20,8 @@ import mage.game.command.emblems.SarkhanTheDragonspeakerEmblem;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* import mage.game.command.emblems.SarkhanTheDragonspeakerEmblem;
|
||||
*
|
||||
|
@ -92,8 +93,8 @@ class SarkhanTheDragonspeakerEffect extends ContinuousEffectImpl {
|
|||
permanent.addCardType(game, CardType.CREATURE);
|
||||
permanent.removeAllSubTypes(game);
|
||||
permanent.addSubType(game, SubType.DRAGON);
|
||||
permanent.getSuperType().clear();
|
||||
permanent.addSuperType(SuperType.LEGENDARY);
|
||||
permanent.removeAllSuperTypes(game);
|
||||
permanent.addSuperType(game, SuperType.LEGENDARY);
|
||||
}
|
||||
break;
|
||||
case ColorChangingEffects_5:
|
||||
|
|
|
@ -75,7 +75,7 @@ class ScryingSheetsEffect extends OneShotEffect {
|
|||
CardsImpl cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
controller.lookAtCards(sourceObject.getIdName(), cards, game);
|
||||
if (card.isSnow()) {
|
||||
if (card.isSnow(game)) {
|
||||
if (controller.chooseUse(outcome, "Reveal " + card.getLogName() + " and put it into your hand?", source, game)) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
|
|
@ -13,7 +13,6 @@ import mage.filter.FilterCard;
|
|||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.watchers.common.ManaPaidSourceWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -59,8 +58,8 @@ enum SearchForGloryPredicate implements Predicate<Card> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
return (input.isPermanent(game) && input.isSnow())
|
||||
|| input.isLegendary()
|
||||
return (input.isPermanent(game) && input.isSnow(game))
|
||||
|| input.isLegendary(game)
|
||||
|| input.hasSubtype(SubType.SAGA, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
|
@ -70,7 +69,7 @@ class ShelteringPrayersEffect extends ContinuousEffectImpl {
|
|||
&& game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), playerId, game).size() < 4) {
|
||||
for (Permanent land : game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), playerId, game)) {
|
||||
if (land != null
|
||||
&& land.isBasic()) {
|
||||
&& land.isBasic(game)) {
|
||||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
|
|
|
@ -77,7 +77,7 @@ class SparkDoubleCopyApplier extends CopyApplier {
|
|||
// (2019-05-03)
|
||||
//
|
||||
// So, it's must make changes in blueprint (for farther copyable)
|
||||
blueprint.getSuperType().remove(SuperType.LEGENDARY);
|
||||
blueprint.removeSuperType(SuperType.LEGENDARY);
|
||||
|
||||
// TODO: Blood Moon problem, can't apply on type changing effects (same as TeferisTimeTwist)
|
||||
// see https://magic.wizards.com/en/articles/archive/feature/war-spark-release-notes-2019-04-19
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -58,6 +57,6 @@ enum SplittingThePowerstoneCondition implements Condition {
|
|||
.map(SacrificeTargetCost::getPermanents)
|
||||
.flatMap(Collection::stream)
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(MageObject::isLegendary);
|
||||
.anyMatch(permanent -> permanent.isLegendary(game));
|
||||
}
|
||||
}
|
|
@ -48,6 +48,6 @@ enum TalesEndPredicate implements Predicate<StackObject> {
|
|||
|
||||
@Override
|
||||
public boolean apply(StackObject input, Game game) {
|
||||
return !(input instanceof Spell) || input.isLegendary();
|
||||
return !(input instanceof Spell) || input.isLegendary(game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,11 +131,10 @@ class TezzeretCruelMachinistCardTypeEffect extends ContinuousEffectImpl {
|
|||
continue;
|
||||
}
|
||||
flag = true;
|
||||
target.getSuperType().clear();
|
||||
target.removeAllSuperTypes(game);
|
||||
target.removeAllCardTypes(game);
|
||||
target.removeAllSubTypes(game);
|
||||
target.addCardType(game, CardType.ARTIFACT);
|
||||
target.addCardType(game, CardType.CREATURE);
|
||||
target.addCardType(game, CardType.ARTIFACT, CardType.CREATURE);
|
||||
target.getPower().setModifiedBaseValue(5);
|
||||
target.getToughness().setModifiedBaseValue(5);
|
||||
}
|
||||
|
|
|
@ -128,11 +128,11 @@ class TheKenrithsRoyalFuneralCostEffect extends CostModificationEffectImpl {
|
|||
}
|
||||
if (!game.inCheckPlayableState()) {
|
||||
Spell spell = (Spell) game.getSpell(abilityToModify.getId());
|
||||
return spell != null && spell.isLegendary();
|
||||
return spell != null && spell.isLegendary(game);
|
||||
}
|
||||
// Spell is not on the stack yet, but possible playable spells are determined
|
||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||
return sourceCard != null && sourceCard.isLegendary();
|
||||
return sourceCard != null && sourceCard.isLegendary(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,7 +75,7 @@ enum ThePeregrineDynamoPredicate implements ObjectSourcePlayerPredicate<StackObj
|
|||
MageObject sourceObject = ((StackAbility) input.getObject()).getSourceObject(game);
|
||||
return sourceObject != null
|
||||
&& !sourceObject.getId().equals(input.getSourceId())
|
||||
&& sourceObject.isLegendary()
|
||||
&& sourceObject.isLegendary(game)
|
||||
&& !CommanderPredicate.instance.apply(sourceObject, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,24 @@
|
|||
|
||||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.constants.SuperType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801 & L_J
|
||||
*/
|
||||
public final class ThermalFlux extends CardImpl {
|
||||
|
@ -91,9 +86,9 @@ class ThermalFluxEffect extends ContinuousEffectImpl {
|
|||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
if (addSnow) {
|
||||
permanent.addSuperType(SuperType.SNOW);
|
||||
permanent.addSuperType(game, SuperType.SNOW);
|
||||
} else {
|
||||
permanent.getSuperType().remove(SuperType.SNOW);
|
||||
permanent.removeSuperType(game, SuperType.SNOW);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -59,7 +59,7 @@ class ThermokarstEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null && controller != null) {
|
||||
permanent.destroy(source, game, false);
|
||||
if (permanent.isSnow()) {
|
||||
if (permanent.isSnow(game)) {
|
||||
controller.gainLife(1, game, source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -78,7 +78,7 @@ class LegendaryCastManaCondition extends ManaCondition implements Condition {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
MageObject object = game.getObject(source);
|
||||
if (object != null && object.isLegendary()) {
|
||||
if (object != null && object.isLegendary(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ class VolrathsShapeshifterEffect extends ContinuousEffectImpl {
|
|||
permanent.removeAllSubTypes(game);
|
||||
permanent.copySubTypesFrom(game, card);
|
||||
|
||||
permanent.getSuperType().clear();
|
||||
for (SuperType type : card.getSuperType()) {
|
||||
permanent.addSuperType(type);
|
||||
permanent.removeAllSuperTypes(game);
|
||||
for (SuperType type : card.getSuperType(game)) {
|
||||
permanent.addSuperType(game, type);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class YedoraGraveGardenerContinuousEffect extends ContinuousEffectImpl {
|
|||
discard();
|
||||
return false;
|
||||
}
|
||||
target.getSuperType().clear();
|
||||
target.removeAllSuperTypes(game);
|
||||
target.removeAllCardTypes(game);
|
||||
target.removeAllSubTypes(game);
|
||||
target.addCardType(game, CardType.LAND);
|
||||
|
|
|
@ -73,11 +73,11 @@ class YouCannotPassWatcher extends Watcher {
|
|||
return;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isLegendary()) {
|
||||
if (permanent != null && permanent.isLegendary(game)) {
|
||||
set.add(new MageObjectReference(event.getSourceId(), game));
|
||||
}
|
||||
permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent != null && permanent.isLegendary()) {
|
||||
if (permanent != null && permanent.isLegendary(game)) {
|
||||
set.add(new MageObjectReference(event.getTargetId(), game));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ public final class TheBrothersWarCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Relic of Progenitus", 157, Rarity.UNCOMMON, mage.cards.r.RelicOfProgenitus.class));
|
||||
cards.add(new SetCardInfo("Reliquary Tower", 196, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class));
|
||||
cards.add(new SetCardInfo("River of Tears", 197, Rarity.RARE, mage.cards.r.RiverOfTears.class));
|
||||
cards.add(new SetCardInfo("Rootpath Purifier", 24, Rarity.MYTHIC, mage.cards.r.RootpathPurifier.class));
|
||||
cards.add(new SetCardInfo("Sai, Master Thopterist", 93, Rarity.RARE, mage.cards.s.SaiMasterThopterist.class));
|
||||
cards.add(new SetCardInfo("Sanwell, Avenger Ace", 5, Rarity.RARE, mage.cards.s.SanwellAvengerAce.class));
|
||||
cards.add(new SetCardInfo("Sardian Avenger", 23, Rarity.RARE, mage.cards.s.SardianAvenger.class));
|
||||
|
|
|
@ -112,7 +112,7 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase {
|
|||
Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId());
|
||||
Assert.assertTrue(lazav.getAbilities().contains(FlyingAbility.getInstance()));
|
||||
Assert.assertTrue(lazav.hasSubtype(SubType.SPECTER, currentGame));
|
||||
Assert.assertTrue(lazav.isLegendary());
|
||||
Assert.assertTrue(lazav.isLegendary(currentGame));
|
||||
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
assertPowerToughness(playerA, "Silvercoat Lion", 2, 2);
|
||||
|
@ -142,7 +142,7 @@ public class LazavDimirMastermindTest extends CardTestPlayerBase {
|
|||
|
||||
Permanent lazav = getPermanent("Lazav, Dimir Mastermind", playerA.getId());
|
||||
Assert.assertTrue(lazav.hasSubtype(SubType.CAT, currentGame));
|
||||
Assert.assertTrue(lazav.isLegendary());
|
||||
Assert.assertTrue(lazav.isLegendary(currentGame));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ public class ModalDoubleFacesCardsTest extends CardTestPlayerBase {
|
|||
|
||||
// stats in hand - mdf
|
||||
card = getHandCards(playerA).stream().filter(c -> CardUtil.haveSameNames(c, "Halvar, God of Battle", currentGame)).findFirst().get();
|
||||
Assert.assertTrue("must be legendary", card.isLegendary());
|
||||
Assert.assertTrue("must be legendary", card.isLegendary(currentGame));
|
||||
Assert.assertTrue("must be creature", card.isCreature(currentGame));
|
||||
Assert.assertTrue("must be god", card.hasSubtype(SubType.GOD, currentGame));
|
||||
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
package org.mage.test.cards.single.brc;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class RootpathPurifierTest extends CardTestPlayerBase {
|
||||
|
||||
private static final String purifier = "Rootpath Purifier";
|
||||
private static final String growth = "Rampant Growth";
|
||||
private static final String lay = "Lay of the Land";
|
||||
private static final String tree = "Tree of Tales";
|
||||
private static final String murder = "Murder";
|
||||
|
||||
private void checkSupertypes() {
|
||||
Assert.assertTrue(
|
||||
"All lands in library should be basic",
|
||||
playerA.getLibrary()
|
||||
.getCards(currentGame)
|
||||
.stream()
|
||||
.filter(card -> card.isLand(currentGame))
|
||||
.allMatch(card -> card.isBasic(currentGame))
|
||||
);
|
||||
for (Permanent permanent : currentGame.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, playerA.getId(), currentGame
|
||||
)) {
|
||||
Assert.assertTrue(permanent.getName() + " should be basic", permanent.isBasic(currentGame));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangeSupertypeInLibrary() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, purifier);
|
||||
addCard(Zone.LIBRARY, playerA, tree);
|
||||
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, purifier, 1);
|
||||
checkSupertypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchToBattlefield() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, purifier);
|
||||
addCard(Zone.HAND, playerA, growth);
|
||||
addCard(Zone.LIBRARY, playerA, tree);
|
||||
|
||||
addTarget(playerA, tree);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, growth);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, tree, 1);
|
||||
assertPermanentCount(playerA, purifier, 1);
|
||||
checkSupertypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchToHand() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, purifier);
|
||||
addCard(Zone.HAND, playerA, lay);
|
||||
addCard(Zone.LIBRARY, playerA, tree);
|
||||
|
||||
addTarget(playerA, tree);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, lay);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, tree, 1);
|
||||
assertPermanentCount(playerA, purifier, 1);
|
||||
checkSupertypes();
|
||||
Assert.assertTrue(
|
||||
tree + " should not be basic in hand",
|
||||
playerA.getHand()
|
||||
.getCards(currentGame)
|
||||
.stream()
|
||||
.filter(card -> tree.equals(card.getName()))
|
||||
.noneMatch(card -> card.isBasic(currentGame))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemove() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, purifier);
|
||||
addCard(Zone.HAND, playerA, murder);
|
||||
addCard(Zone.LIBRARY, playerA, tree);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, murder, purifier);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, purifier, 0);
|
||||
assertGraveyardCount(playerA, purifier, 1);
|
||||
assertGraveyardCount(playerA, murder, 1);
|
||||
Assert.assertTrue(
|
||||
tree + " should not be basic",
|
||||
playerA.getLibrary()
|
||||
.getCards(currentGame)
|
||||
.stream()
|
||||
.filter(card -> tree.equals(card.getName()))
|
||||
.noneMatch(card -> card.isBasic(currentGame))
|
||||
);
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ import mage.cards.repository.*;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.game.command.Dungeon;
|
||||
import mage.game.command.Plane;
|
||||
import mage.game.draft.DraftCube;
|
||||
|
@ -1064,7 +1063,7 @@ public class VerifyCardDataTest {
|
|||
}
|
||||
|
||||
// CHECK: all planeswalkers must be legendary
|
||||
if (card.isPlaneswalker() && !card.getSuperType().contains(SuperType.LEGENDARY)) {
|
||||
if (card.isPlaneswalker() && !card.isLegendary()) {
|
||||
errorsList.add("Error: planeswalker must have legendary type: " + set.getCode() + " - " + set.getName() + " - " + card.getName() + " - " + card.getCardNumber());
|
||||
}
|
||||
|
||||
|
@ -2248,12 +2247,12 @@ public class VerifyCardDataTest {
|
|||
fail(card, "rarity", "basic land must be Rarity.LAND");
|
||||
}
|
||||
|
||||
if (!card.getSuperType().contains(SuperType.BASIC)) {
|
||||
if (!card.isBasic()) {
|
||||
fail(card, "supertype", "basic land must be SuperType.BASIC");
|
||||
}
|
||||
} else if (name.equals("Wastes")) {
|
||||
// Wastes are SuperType.BASIC but not necessarily Rarity.LAND
|
||||
if (!card.getSuperType().contains(SuperType.BASIC)) {
|
||||
if (!card.isBasic()) {
|
||||
fail(card, "supertype", "Wastes must be SuperType.BASIC");
|
||||
}
|
||||
} else {
|
||||
|
@ -2262,7 +2261,7 @@ public class VerifyCardDataTest {
|
|||
fail(card, "rarity", "only basic land can be Rarity.LAND");
|
||||
}
|
||||
|
||||
if (card.getSuperType().contains(SuperType.BASIC)) {
|
||||
if (card.isBasic()) {
|
||||
fail(card, "supertype", "only basic land can be SuperType.BASIC");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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…
Reference in a new issue