Planechase: refactor planes;

This commit is contained in:
Oleg Agafonov 2020-04-13 21:50:40 +04:00
parent b6557201b4
commit 823d677068
25 changed files with 229 additions and 241 deletions

View file

@ -13,6 +13,7 @@ import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Planes;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
@ -538,12 +539,11 @@ public final class SystemUtil {
break; break;
} }
} }
Class<?> c = Class.forName("mage.game.command.planes." + command.cardName); Planes planeType = Planes.fromClassName(command.cardName);
Constructor<?> cons = c.getConstructor(); Plane plane = Plane.createPlane(planeType);
Object plane = cons.newInstance(); if (plane != null) {
if (plane instanceof mage.game.command.Plane) { plane.setControllerId(player.getId());
((mage.game.command.Plane) plane).setControllerId(player.getId()); game.addPlane(plane, null, player.getId());
game.addPlane((mage.game.command.Plane) plane, null, player.getId());
continue; continue;
} }
} else if ("loyalty".equalsIgnoreCase(command.zone)) { } else if ("loyalty".equalsIgnoreCase(command.zone)) {

View file

@ -1,7 +1,5 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.List;
import java.util.stream.Collectors;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
@ -18,8 +16,10 @@ import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.List;
import java.util.stream.Collectors;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class RollPlanarDieEffect extends OneShotEffect { public class RollPlanarDieEffect extends OneShotEffect {
@ -98,8 +98,8 @@ public class RollPlanarDieEffect extends OneShotEffect {
// Steps: 1) Remove the last plane and set its effects to discarded // Steps: 1) Remove the last plane and set its effects to discarded
for (CommandObject cobject : game.getState().getCommand()) { for (CommandObject cobject : game.getState().getCommand()) {
if (cobject instanceof Plane) { if (cobject instanceof Plane) {
if (((Plane) cobject).getAbilities() != null) { if (cobject.getAbilities() != null) {
for (Ability ability : ((Plane) cobject).getAbilities()) { for (Ability ability : cobject.getAbilities()) {
for (Effect effect : ability.getEffects()) { for (Effect effect : ability.getEffects()) {
if (effect instanceof ContinuousEffect) { if (effect instanceof ContinuousEffect) {
((ContinuousEffect) effect).discard(); ((ContinuousEffect) effect).discard();
@ -107,7 +107,7 @@ public class RollPlanarDieEffect extends OneShotEffect {
} }
} }
} }
game.getState().removeTriggersOfSourceId(((Plane) cobject).getId()); game.getState().removeTriggersOfSourceId(cobject.getId());
game.getState().getCommand().remove(cobject); game.getState().getCommand().remove(cobject);
break; break;
} }
@ -123,7 +123,7 @@ public class RollPlanarDieEffect extends OneShotEffect {
boolean foundNextPlane = false; boolean foundNextPlane = false;
while (!foundNextPlane) { while (!foundNextPlane) {
Plane plane = Plane.getRandomPlane(); Plane plane = Plane.createRandomPlane();
try { try {
if (plane != null && !planesVisited.contains(plane.getName())) { if (plane != null && !planesVisited.contains(plane.getName())) {
foundNextPlane = true; foundNextPlane = true;

View file

@ -1,41 +1,69 @@
package mage.constants; package mage.constants;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public enum Planes { public enum Planes {
PLANE_ACADEMY_AT_TOLARIA_WEST("AcademyAtTolariaWestPlane"), PLANE_ACADEMY_AT_TOLARIA_WEST("AcademyAtTolariaWestPlane", "Plane - Academy at Tolaria West"),
PLANE_AGYREM("AgyremPlane"), PLANE_AGYREM("AgyremPlane", "Plane - Agyrem"),
PLANE_AKOUM("AkoumPlane"), PLANE_AKOUM("AkoumPlane", "Plane - Akoum"),
PLANE_ASTRAL_ARENA("AstralArenaPlane"), PLANE_ASTRAL_ARENA("AstralArenaPlane", "Plane - Astral Arena"),
PLANE_BANT("BantPlane"), PLANE_BANT("BantPlane", "Plane - Bant"),
PLANE_EDGE_OF_MALACOL("EdgeOfMalacolPlane"), PLANE_EDGE_OF_MALACOL("EdgeOfMalacolPlane", "Plane - Edge of Malacol"),
PLANE_FEEDING_GROUNDS("FeedingGroundsPlane"), PLANE_FEEDING_GROUNDS("FeedingGroundsPlane", "Plane - Feeding Grounds"),
PLANE_FIELDS_OF_SUMMER("FieldsOfSummerPlane"), PLANE_FIELDS_OF_SUMMER("FieldsOfSummerPlane", "Plane - Fields of Summer"),
PLANE_HEDRON_FIELDS_OF_AGADEEM("HedronFieldsOfAgadeemPlane"), PLANE_HEDRON_FIELDS_OF_AGADEEM("HedronFieldsOfAgadeemPlane", "Plane - Hedron Fields of Agadeem"),
PLANE_LETHE_LAKE("LetheLakePlane"), PLANE_LETHE_LAKE("LetheLakePlane", "Plane - Lethe Lake"),
PLANE_NAYA("NayaPlane"), PLANE_NAYA("NayaPlane", "Plane - Naya"),
PLANE_PANOPTICON("PanopticonPlane"), PLANE_PANOPTICON("PanopticonPlane", "Plane - Panopticon"),
PLANE_TAZEEM("TazeemPlane"), PLANE_TAZEEM("TazeemPlane", "Plane - Tazeem"),
PLANE_THE_DARK_BARONY("TheDarkBaronyPlane"), PLANE_THE_DARK_BARONY("TheDarkBaronyPlane", "Plane - The Dark Barony"),
PLANE_THE_EON_FOG("TheEonFogPlane"), PLANE_THE_EON_FOG("TheEonFogPlane", "Plane - The Eon Fog"),
PLANE_THE_GREAT_FOREST("TheGreatForestPlane"), PLANE_THE_GREAT_FOREST("TheGreatForestPlane", "Plane - The Great Forest"),
PLANE_THE_ZEPHYR_MAZE_FOG("TheZephyrMazePlane"), PLANE_THE_ZEPHYR_MAZE_FOG("TheZephyrMazePlane", "Plane - The Zephyr Maze"),
PLANE_TRUGA_JUNGLE("TrugaJunglePlane"), PLANE_TRUGA_JUNGLE("TrugaJunglePlane", "Plane - Truga Jungle"),
PLANE_TRAIL_OF_THE_MAGE_RINGS("TrailOfTheMageRingsPlane"), PLANE_TRAIL_OF_THE_MAGE_RINGS("TrailOfTheMageRingsPlane", "Plane - Trail of the Mage-Rings"),
PLANE_TURRI_ISLAND("TurriIslandPlane"), PLANE_TURRI_ISLAND("TurriIslandPlane", "Plane - Turri Island"),
PLANE_UNDERCITY_REACHES("UndercityReachesPlane"); PLANE_UNDERCITY_REACHES("UndercityReachesPlane", "Plane - Undercity Reaches");
private final String text; private final String className;
private final String fullName;
Planes(String text) { Planes(String className, String fullName) {
this.text = text; this.className = className;
this.fullName = fullName;
} }
@Override @Override
public String toString() { public String toString() {
return text; return className;
}
public String getClassName() {
return className;
}
public String getFullName() {
return fullName;
}
public static Planes fromFullName(String fullName) {
for (Planes p : Planes.values()) {
if (p.fullName.equals(fullName)) {
return p;
}
}
return null;
}
public static Planes fromClassName(String className) {
for (Planes p : Planes.values()) {
if (p.className.equals(className)) {
return p;
}
}
return null;
} }
} }

View file

@ -38,7 +38,7 @@ public class Plane implements CommandObject {
private static ObjectColor emptyColor = new ObjectColor(); private static ObjectColor emptyColor = new ObjectColor();
private static ManaCosts emptyCost = new ManaCostsImpl(); private static ManaCosts emptyCost = new ManaCostsImpl();
private String name = ""; private Planes planeType = null;
private UUID id; private UUID id;
private UUID controllerId; private UUID controllerId;
private MageObject sourceObject; private MageObject sourceObject;
@ -55,7 +55,7 @@ public class Plane implements CommandObject {
public Plane(final Plane plane) { public Plane(final Plane plane) {
this.id = plane.id; this.id = plane.id;
this.name = plane.name; this.planeType = plane.planeType;
this.frameStyle = plane.frameStyle; this.frameStyle = plane.frameStyle;
this.controllerId = plane.controllerId; this.controllerId = plane.controllerId;
this.sourceObject = plane.sourceObject; this.sourceObject = plane.sourceObject;
@ -78,9 +78,6 @@ public class Plane implements CommandObject {
public void setSourceObject(MageObject sourceObject) { public void setSourceObject(MageObject sourceObject) {
this.sourceObject = sourceObject; this.sourceObject = sourceObject;
if (sourceObject instanceof Card) { if (sourceObject instanceof Card) {
if (name.isEmpty()) {
name = sourceObject.getSubtype(null).toString();
}
if (expansionSetCodeForImage.isEmpty()) { if (expansionSetCodeForImage.isEmpty()) {
expansionSetCodeForImage = ((Card) sourceObject).getExpansionSetCode(); expansionSetCodeForImage = ((Card) sourceObject).getExpansionSetCode();
} }
@ -128,7 +125,7 @@ public class Plane implements CommandObject {
@Override @Override
public String getName() { public String getName() {
return name; return planeType != null ? planeType.getFullName() : "";
} }
@Override @Override
@ -143,12 +140,20 @@ public class Plane implements CommandObject {
@Override @Override
public String getImageName() { public String getImageName() {
return this.name; return planeType != null ? planeType.getFullName() : "";
} }
@Override @Override
public void setName(String name) { public void setName(String name) {
this.name = name; throw new UnsupportedOperationException("Planes don't use setName, use setPlaneType instead");
}
public void setPlaneType(Planes planeType) {
this.planeType = planeType;
}
public Planes getPlaneType() {
return this.planeType;
} }
@Override @Override
@ -288,12 +293,11 @@ public class Plane implements CommandObject {
public void removePTCDA() { public void removePTCDA() {
} }
public static Plane getRandomPlane() { public static Plane createPlane(Planes planeType) {
int pick = RandomUtil.nextInt(Planes.values().length); if (planeType != null) {
String planeName = Planes.values()[pick].toString(); String planeFullClass = "mage.game.command.planes." + planeType.getClassName();
planeName = "mage.game.command.planes." + planeName;
try { try {
Class<?> c = Class.forName(planeName); Class<?> c = Class.forName(planeFullClass);
Constructor<?> cons = c.getConstructor(); Constructor<?> cons = c.getConstructor();
Object plane = cons.newInstance(); Object plane = cons.newInstance();
if (plane instanceof Plane) { if (plane instanceof Plane) {
@ -301,6 +305,18 @@ public class Plane implements CommandObject {
} }
} catch (Exception ex) { } catch (Exception ex) {
} }
}
return null; return null;
} }
public static Plane createPlaneByFullName(String fullName) {
Planes planeType = Planes.fromFullName(fullName);
return createPlane(planeType);
}
public static Plane createRandomPlane() {
int pick = RandomUtil.nextInt(Planes.values().length);
Planes planeType = Planes.values()[pick];
return createPlane(planeType);
}
} }

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
@ -17,6 +14,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.discard.DiscardHandControllerEffect; import mage.abilities.effects.common.discard.DiscardHandControllerEffect;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
@ -26,14 +24,16 @@ import mage.target.Target;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class AcademyAtTolariaWestPlane extends Plane { public class AcademyAtTolariaWestPlane extends Plane {
public AcademyAtTolariaWestPlane() { public AcademyAtTolariaWestPlane() {
this.setName("Plane - Academy at Tolaria West"); this.setPlaneType(Planes.PLANE_ACADEMY_AT_TOLARIA_WEST);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// At the beginning of your end step, if you have 0 cards in hand, draw seven cards // At the beginning of your end step, if you have 0 cards in hand, draw seven cards
@ -88,7 +88,7 @@ class DrawCardsActivePlayerEffect extends OneShotEffect {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - Academy at Tolaria West")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_ACADEMY_AT_TOLARIA_WEST)) {
return false; return false;
} }
Player player = game.getPlayer(game.getActivePlayerId()); Player player = game.getPlayer(game.getActivePlayerId());

View file

@ -15,10 +15,7 @@ import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.Duration; import mage.constants.*;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
@ -47,7 +44,7 @@ public class AgyremPlane extends Plane {
} }
public AgyremPlane() { public AgyremPlane() {
this.setName("Plane - Agyrem"); this.setPlaneType(Planes.PLANE_AGYREM);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Whenever a white creature dies, return it to the battlefield under its owner's control at the beginning of the next end step // Whenever a white creature dies, return it to the battlefield under its owner's control at the beginning of the next end step
@ -156,7 +153,7 @@ class AgyremRestrictionEffect extends RestrictionEffect {
} }
Plane cPlane = game.getState().getCurrentPlane(); Plane cPlane = game.getState().getCurrentPlane();
if (cPlane != null && cPlane.getName().equalsIgnoreCase("Plane - Agyrem")) { if (cPlane != null && cPlane.getPlaneType().equals(Planes.PLANE_AGYREM)) {
return !defenderId.equals(source.getControllerId()); return !defenderId.equals(source.getControllerId());
} }
return true; return true;

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MainPhaseStackEmptyCondition; import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
@ -11,10 +8,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect; import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -24,8 +18,10 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class AkoumPlane extends Plane { public class AkoumPlane extends Plane {
@ -39,7 +35,7 @@ public class AkoumPlane extends Plane {
} }
public AkoumPlane() { public AkoumPlane() {
this.setName("Plane - Akoum"); this.setPlaneType(Planes.PLANE_AKOUM);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Players may cast enchantment spells as if they had flash // Players may cast enchantment spells as if they had flash

View file

@ -10,6 +10,7 @@ import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.DamageAllEffect; import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -30,7 +31,7 @@ import java.util.UUID;
public class AstralArenaPlane extends Plane { public class AstralArenaPlane extends Plane {
public AstralArenaPlane() { public AstralArenaPlane() {
this.setName("Plane - Astral Arena"); this.setPlaneType(Planes.PLANE_ASTRAL_ARENA);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// No more than one creature can attack each turn. No more than one creature can block each turn. // No more than one creature can attack each turn. No more than one creature can block each turn.
@ -80,7 +81,7 @@ class AstralArenaAttackRestrictionEffect extends RestrictionEffect {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
return cPlane.getName().equalsIgnoreCase("Plane - Astral Arena"); return cPlane.getPlaneType().equals(Planes.PLANE_ASTRAL_ARENA);
} }
@Override @Override
@ -111,7 +112,7 @@ class AstralArenaBlockRestrictionEffect extends RestrictionEffect {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
return cPlane.getName().equalsIgnoreCase("Plane - Astral Arena"); return cPlane.getPlaneType().equals(Planes.PLANE_ASTRAL_ARENA);
} }
@Override @Override

View file

@ -1,9 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -21,11 +17,7 @@ import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.ExaltedAbility; import mage.abilities.keyword.ExaltedAbility;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.constants.CostModificationType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -39,8 +31,11 @@ import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class BantPlane extends Plane { public class BantPlane extends Plane {
@ -56,7 +51,7 @@ public class BantPlane extends Plane {
private static final String exaltedRule = "All creatures have exalted"; private static final String exaltedRule = "All creatures have exalted";
public BantPlane() { public BantPlane() {
this.setName("Plane - Bant"); this.setPlaneType(Planes.PLANE_BANT);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// All creatures have exalted // All creatures have exalted

View file

@ -1,27 +1,16 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MainPhaseStackEmptyCondition; import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.SkipUntapStepEffect;
import mage.abilities.effects.common.UntapAllControllerEffect; import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.constants.Duration; import mage.constants.*;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -34,14 +23,18 @@ import mage.target.Target;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class EdgeOfMalacolPlane extends Plane { public class EdgeOfMalacolPlane extends Plane {
public EdgeOfMalacolPlane() { public EdgeOfMalacolPlane() {
this.setName("Plane - Edge Of Malacol"); this.setPlaneType(Planes.PLANE_EDGE_OF_MALACOL);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// If a creature you control would untap during your untap step, put two +1/+1 counters on it instead. // If a creature you control would untap during your untap step, put two +1/+1 counters on it instead.
@ -101,7 +94,7 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - Edge of Malacol")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_EDGE_OF_MALACOL)) {
return false; return false;
} }
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.MageObject; import mage.MageObject;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -17,11 +14,7 @@ import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.CostModificationType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -35,8 +28,10 @@ import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class FeedingGroundsPlane extends Plane { public class FeedingGroundsPlane extends Plane {
@ -45,7 +40,7 @@ public class FeedingGroundsPlane extends Plane {
private static final String rule = "put X +1/+1 counters on target creature, where X is that creature's converted mana cost"; private static final String rule = "put X +1/+1 counters on target creature, where X is that creature's converted mana cost";
public FeedingGroundsPlane() { public FeedingGroundsPlane() {
this.setName("Plane - Feeding Grounds"); this.setPlaneType(Planes.PLANE_FEEDING_GROUNDS);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Red spells cost {1} less to cast. Green spells cost {1} less to cast // Red spells cost {1} less to cast. Green spells cost {1} less to cast
@ -133,7 +128,7 @@ class FeedingGroundsEffect extends CostModificationEffectImpl {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - Feeding Grounds")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_FEEDING_GROUNDS)) {
return false; return false;
} }

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -14,10 +11,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.GainLifeTargetEffect; import mage.abilities.effects.common.GainLifeTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.constants.Outcome; import mage.constants.*;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.game.Game; import mage.game.Game;
import mage.game.command.Plane; import mage.game.command.Plane;
@ -26,8 +20,10 @@ import mage.target.Target;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class FieldsOfSummerPlane extends Plane { public class FieldsOfSummerPlane extends Plane {
@ -35,7 +31,7 @@ public class FieldsOfSummerPlane extends Plane {
private static final FilterSpell filter = new FilterSpell("a spell"); private static final FilterSpell filter = new FilterSpell("a spell");
public FieldsOfSummerPlane() { public FieldsOfSummerPlane() {
this.setName("Plane - Fields of Summer"); this.setPlaneType(Planes.PLANE_FIELDS_OF_SUMMER);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Whenever a player casts a spell, that player may gain 2 life // Whenever a player casts a spell, that player may gain 2 life
@ -78,7 +74,7 @@ class FieldsOfSummerEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Plane cPlane = game.getState().getCurrentPlane(); Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null || !cPlane.getName().equalsIgnoreCase("Plane - Fields of Summer")) { if (cPlane == null || !cPlane.getPlaneType().equals(Planes.PLANE_FIELDS_OF_SUMMER)) {
return false; return false;
} }
Player owner = game.getPlayer(this.getTargetPointer().getFirst(game, source)); Player owner = game.getPlayer(this.getTargetPointer().getFirst(game, source));

View file

@ -9,10 +9,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.constants.ComparisonType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate; import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game; import mage.game.Game;
@ -31,7 +28,7 @@ import java.util.List;
public class HedronFieldsOfAgadeemPlane extends Plane { public class HedronFieldsOfAgadeemPlane extends Plane {
public HedronFieldsOfAgadeemPlane() { public HedronFieldsOfAgadeemPlane() {
this.setName("Plane - Hedron Fields of Agadeem"); this.setPlaneType(Planes.PLANE_HEDRON_FIELDS_OF_AGADEEM);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Creatures with power 7 or greater can't attack or block // Creatures with power 7 or greater can't attack or block
@ -94,7 +91,7 @@ class HedronFieldsOfAgadeemRestrictionEffect extends RestrictionEffect {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - Hedron Fields of Agadeem")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_HEDRON_FIELDS_OF_AGADEEM)) {
return false; return false;
} }
return filter.match(permanent, source.getSourceId(), source.getControllerId(), game); return filter.match(permanent, source.getSourceId(), source.getControllerId(), game);

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -13,6 +10,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect; import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.command.Plane; import mage.game.command.Plane;
@ -20,14 +18,16 @@ import mage.target.Target;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class LetheLakePlane extends Plane { public class LetheLakePlane extends Plane {
public LetheLakePlane() { public LetheLakePlane() {
this.setName("Plane - Lethe Lake"); this.setPlaneType(Planes.PLANE_LETHE_LAKE);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// At the beginning of your upkeep, put the top ten cards of your libary into your graveyard // At the beginning of your upkeep, put the top ten cards of your libary into your graveyard

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -16,6 +13,7 @@ import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.PlayAdditionalLandsAllEffect; import mage.abilities.effects.common.continuous.PlayAdditionalLandsAllEffect;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
@ -27,8 +25,10 @@ import mage.target.Target;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class NayaPlane extends Plane { public class NayaPlane extends Plane {
@ -40,7 +40,7 @@ public class NayaPlane extends Plane {
} }
public NayaPlane() { public NayaPlane() {
this.setName("Plane - Naya"); this.setPlaneType(Planes.PLANE_NAYA);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// You may play any number of lands on each of your turns // You may play any number of lands on each of your turns

View file

@ -1,7 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -13,6 +11,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.DrawCardTargetEffect; import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
@ -24,8 +23,10 @@ import mage.target.Target;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class PanopticonPlane extends Plane { public class PanopticonPlane extends Plane {
@ -33,7 +34,7 @@ public class PanopticonPlane extends Plane {
private static final String rule = "At the beginning of your draw step, draw an additional card"; private static final String rule = "At the beginning of your draw step, draw an additional card";
public PanopticonPlane() { public PanopticonPlane() {
this.setName("Plane - Panopticon"); this.setPlaneType(Planes.PLANE_PANOPTICON);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// When you planeswalk to Panopticon, draw a card // When you planeswalk to Panopticon, draw a card
@ -80,7 +81,7 @@ class PanopticonTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Plane cPlane = game.getState().getCurrentPlane(); Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null || !cPlane.getName().equalsIgnoreCase("Plane - Panopticon")) { if (cPlane == null || !cPlane.getPlaneType().equals(Planes.PLANE_PANOPTICON)) {
return false; return false;
} }

View file

@ -12,6 +12,7 @@ import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledLandPermanent;
@ -33,7 +34,7 @@ public class TazeemPlane extends Plane {
private static final String rule = "Creatures can't block"; private static final String rule = "Creatures can't block";
public TazeemPlane() { public TazeemPlane() {
this.setName("Plane - Tazeem"); this.setPlaneType(Planes.PLANE_TAZEEM);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Creatures can't block // Creatures can't block
@ -75,7 +76,7 @@ class TazeemCantBlockAllEffect extends RestrictionEffect {
public boolean applies(Permanent permanent, Ability source, Game game) { public boolean applies(Permanent permanent, Ability source, Game game) {
Plane cPlane = game.getState().getCurrentPlane(); Plane cPlane = game.getState().getCurrentPlane();
if (cPlane == null || !cPlane.getName().equalsIgnoreCase("Plane - Tazeem")) { if (cPlane == null || !cPlane.getPlaneType().equals(Planes.PLANE_TAZEEM)) {
return false; return false;
} }
return filter.match(permanent, source.getSourceId(), source.getControllerId(), game); return filter.match(permanent, source.getSourceId(), source.getControllerId(), game);

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -14,6 +11,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect; import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.constants.Planes;
import mage.constants.SetTargetPointer; import mage.constants.SetTargetPointer;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
@ -24,8 +22,10 @@ import mage.game.command.Plane;
import mage.target.Target; import mage.target.Target;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class TheDarkBaronyPlane extends Plane { public class TheDarkBaronyPlane extends Plane {
@ -37,7 +37,7 @@ public class TheDarkBaronyPlane extends Plane {
} }
public TheDarkBaronyPlane() { public TheDarkBaronyPlane() {
this.setName("Plane - The Dark Barony"); this.setPlaneType(Planes.PLANE_THE_DARK_BARONY);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Whenever a nonblack card is put into a player's graveyard from anywhere, that player loses 1 life // Whenever a nonblack card is put into a player's graveyard from anywhere, that player loses 1 life

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -12,10 +9,7 @@ import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.UntapAllControllerEffect; import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.constants.Duration; import mage.constants.*;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.command.Plane; import mage.game.command.Plane;
@ -23,14 +17,16 @@ import mage.game.events.GameEvent;
import mage.target.Target; import mage.target.Target;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class TheEonFogPlane extends Plane { public class TheEonFogPlane extends Plane {
public TheEonFogPlane() { public TheEonFogPlane() {
this.setName("Plane - The Eon Fog"); this.setPlaneType(Planes.PLANE_THE_EON_FOG);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// All players miss their untap step // All players miss their untap step
@ -87,7 +83,7 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - The Eon Fog")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_THE_EON_FOG)) {
return false; return false;
} }
return event.getType() == GameEvent.EventType.UNTAP_STEP; return event.getType() == GameEvent.EventType.UNTAP_STEP;

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -13,22 +10,18 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.constants.Duration; import mage.constants.*;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.command.Plane; import mage.game.command.Plane;
import mage.target.Target; import mage.target.Target;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class TheGreatForestPlane extends Plane { public class TheGreatForestPlane extends Plane {
@ -36,7 +29,7 @@ public class TheGreatForestPlane extends Plane {
private static final String rule = "Each creature assigns combat damage equal to its toughness rather than its power"; private static final String rule = "Each creature assigns combat damage equal to its toughness rather than its power";
public TheGreatForestPlane() { public TheGreatForestPlane() {
this.setName("Plane - The Great Forest"); this.setPlaneType(Planes.PLANE_THE_GREAT_FOREST);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Each creature assigns combat damage equal to its toughness rather than its power // Each creature assigns combat damage equal to its toughness rather than its power
@ -86,7 +79,7 @@ class TheGreatForestCombatDamageRuleEffect extends ContinuousEffectImpl {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - The Great Forest")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_THE_GREAT_FOREST)) {
return false; return false;
} }

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -16,6 +13,7 @@ import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -26,8 +24,10 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class TheZephyrMazePlane extends Plane { public class TheZephyrMazePlane extends Plane {
@ -44,7 +44,7 @@ public class TheZephyrMazePlane extends Plane {
private static final String walkingRule = "Creatures without flying get -2/-0"; private static final String walkingRule = "Creatures without flying get -2/-0";
public TheZephyrMazePlane() { public TheZephyrMazePlane() {
this.setName("Plane - The Zephyr Maze"); this.setPlaneType(Planes.PLANE_THE_ZEPHYR_MAZE_FOG);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Creatures with flying get +2/+0 // Creatures with flying get +2/+0

View file

@ -1,10 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -16,13 +11,7 @@ import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.keyword.ReboundAbility; import mage.abilities.keyword.ReboundAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterInstantOrSorceryCard; import mage.filter.common.FilterInstantOrSorceryCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -35,8 +24,12 @@ import mage.target.Target;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class TrailOfTheMageRingsPlane extends Plane { public class TrailOfTheMageRingsPlane extends Plane {
@ -48,7 +41,7 @@ public class TrailOfTheMageRingsPlane extends Plane {
} }
public TrailOfTheMageRingsPlane() { public TrailOfTheMageRingsPlane() {
this.setName("Plane - Trail of the Mage-Rings"); this.setPlaneType(Planes.PLANE_TRAIL_OF_THE_MAGE_RINGS);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Instant and sorcery spells have rebound // Instant and sorcery spells have rebound
@ -100,7 +93,7 @@ class TrailOfTheMageRingsReboundEffect extends ContinuousEffectImpl {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - Trail of the Mage-Rings")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_TRAIL_OF_THE_MAGE_RINGS)) {
return false; return false;
} }
@ -110,7 +103,7 @@ class TrailOfTheMageRingsReboundEffect extends ContinuousEffectImpl {
for (Card card : player.getHand().getCards(filter, game)) { for (Card card : player.getHand().getCards(filter, game)) {
addReboundAbility(card, source, game); addReboundAbility(card, source, game);
} }
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext();) { for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext(); ) {
StackObject stackObject = iterator.next(); StackObject stackObject = iterator.next();
if (stackObject instanceof Spell && stackObject.isControlledBy(source.getControllerId())) { if (stackObject instanceof Spell && stackObject.isControlledBy(source.getControllerId())) {
Spell spell = (Spell) stackObject; Spell spell = (Spell) stackObject;

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.IsStillOnPlaneCondition; import mage.abilities.condition.common.IsStillOnPlaneCondition;
@ -15,6 +12,7 @@ import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.mana.AnyColorManaAbility; import mage.abilities.mana.AnyColorManaAbility;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Planes;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
@ -23,8 +21,10 @@ import mage.game.command.Plane;
import mage.target.Target; import mage.target.Target;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class TrugaJunglePlane extends Plane { public class TrugaJunglePlane extends Plane {
@ -32,7 +32,7 @@ public class TrugaJunglePlane extends Plane {
private static final String rule = "All lands have '{t}: Add one mana of any color"; private static final String rule = "All lands have '{t}: Add one mana of any color";
public TrugaJunglePlane() { public TrugaJunglePlane() {
this.setName("Plane - Truga Jungle"); this.setPlaneType(Planes.PLANE_TRUGA_JUNGLE);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
SimpleStaticAbility ability SimpleStaticAbility ability

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -14,12 +11,7 @@ import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.game.Game; import mage.game.Game;
@ -29,14 +21,16 @@ import mage.target.Target;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class TurriIslandPlane extends Plane { public class TurriIslandPlane extends Plane {
public TurriIslandPlane() { public TurriIslandPlane() {
this.setName("Plane - Turri Island"); this.setPlaneType(Planes.PLANE_TURRI_ISLAND);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Creature spells cost {2} less to cast. // Creature spells cost {2} less to cast.
@ -112,7 +106,7 @@ class TurriIslandEffect extends CostModificationEffectImpl {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - Turri Island")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_TURRI_ISLAND)) {
return false; return false;
} }

View file

@ -1,8 +1,5 @@
package mage.game.command.planes; package mage.game.command.planes;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -15,10 +12,7 @@ import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.abilities.effects.common.RollPlanarDieEffect; import mage.abilities.effects.common.RollPlanarDieEffect;
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification; import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.game.Game; import mage.game.Game;
import mage.game.command.Plane; import mage.game.command.Plane;
@ -30,8 +24,10 @@ import mage.target.Target;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public class UndercityReachesPlane extends Plane { public class UndercityReachesPlane extends Plane {
@ -43,7 +39,7 @@ public class UndercityReachesPlane extends Plane {
} }
public UndercityReachesPlane() { public UndercityReachesPlane() {
this.setName("Plane - Undercity Reaches"); this.setPlaneType(Planes.PLANE_UNDERCITY_REACHES);
this.setExpansionSetCodeForImage("PCA"); this.setExpansionSetCodeForImage("PCA");
// Whenever a creature deals combat damage to a player, its controller may a draw a card // Whenever a creature deals combat damage to a player, its controller may a draw a card
@ -94,7 +90,7 @@ class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl {
if (cPlane == null) { if (cPlane == null) {
return false; return false;
} }
if (!cPlane.getName().equalsIgnoreCase("Plane - Undercity Reaches")) { if (!cPlane.getPlaneType().equals(Planes.PLANE_UNDERCITY_REACHES)) {
return false; return false;
} }