diff --git a/Mage.Client/src/main/resources/card-pictures-tok.txt b/Mage.Client/src/main/resources/card-pictures-tok.txt index 3c848c6247..270ecc6e7e 100644 --- a/Mage.Client/src/main/resources/card-pictures-tok.txt +++ b/Mage.Client/src/main/resources/card-pictures-tok.txt @@ -99,7 +99,9 @@ |Generate|PLANE:PCA|Plane - The Dark Barony|||TheDarkBaronyPlane| |Generate|PLANE:PCA|Plane - Tazeem|||TazeemPlane| |Generate|PLANE:PCA|Plane - The Eon Fog|||TheEonFogPlane| +|Generate|PLANE:PCA|Plane - Truga Jungle|||TrugaJunglePlane| |Generate|PLANE:PCA|Plane - Turri Island|||TurriIslandPlane| +|Generate|PLANE:PCA|Plane - Undercity Reaches|||UndercityReachesPlane| |Generate|TOK:PCA|Eldrazi|||EldraziAnnihilatorToken| |Generate|TOK:10E|Ape|||PongifyApeToken| |Generate|TOK:10E|Dragon|||DragonToken2| diff --git a/Mage.Common/src/main/java/mage/view/CardView.java b/Mage.Common/src/main/java/mage/view/CardView.java index 8349b60716..edef6d7453 100644 --- a/Mage.Common/src/main/java/mage/view/CardView.java +++ b/Mage.Common/src/main/java/mage/view/CardView.java @@ -525,6 +525,7 @@ public class CardView extends SimpleCardView { this.mageObjectType = MageObjectType.PLANE; Plane plane = (Plane) object; this.rarity = Rarity.SPECIAL; + this.frameStyle = FrameStyle.M15_NORMAL; // Display in landscape/rotated/on its side this.rotate = true; this.rules = plane.getAbilities().getRules(plane.getName()); @@ -568,13 +569,13 @@ public class CardView extends SimpleCardView { this(true); this.gameObject = true; this.id = plane.getId(); - this.mageObjectType = MageObjectType.EMBLEM; + this.mageObjectType = MageObjectType.PLANE; this.name = plane.getName(); this.displayName = name; this.rules = plane.getRules(); // Display the plane in landscape (similar to Fused cards) this.rotate = true; - this.frameStyle = FrameStyle.MPRP_FULL_ART_BASIC; + this.frameStyle = FrameStyle.M15_NORMAL; this.expansionSetCode = plane.getExpansionSetCode(); this.rarity = Rarity.COMMON; } diff --git a/Mage/src/main/java/mage/constants/Planes.java b/Mage/src/main/java/mage/constants/Planes.java index 543d3b2749..4ea9df74cd 100644 --- a/Mage/src/main/java/mage/constants/Planes.java +++ b/Mage/src/main/java/mage/constants/Planes.java @@ -35,6 +35,7 @@ public enum Planes { PLANE_ACADEMY_AT_TOLARIA_WEST("AcademyAtTolariaWestPlane"), PLANE_AGYREM("AgyremPlane"), PLANE_AKOUM("AkoumPlane"), + PLANE_ASTRAL_ARENA("AstralArenaPlane"), PLANE_BANT("BantPlane"), PLANE_EDGE_OF_MALACOL("EdgeOfMalacolPlane"), PLANE_FEEDING_GROUNDS("FeedingGroundsPlane"), @@ -42,10 +43,12 @@ public enum Planes { PLANE_HEDRON_FIELDS_OF_AGADEEM("HedronFieldsOfAgadeemPlane"), PLANE_LETHE_LAKE("LetheLakePlane"), PLANE_NAYA("NayaPlane"), - PLANE_THE_DARK_BARONY("TheDarkBaronyPlane"), PLANE_TAZEEM("TazeemPlane"), + PLANE_THE_DARK_BARONY("TheDarkBaronyPlane"), PLANE_THE_EON_FOG("TheEonFogPlane"), - PLANE_TURRI_ISLAND("TurriIslandPlane"); + PLANE_TRUGA_JUNGLE("TrugaJunglePlane"), + PLANE_TURRI_ISLAND("TurriIslandPlane"), + PLANE_UNDERCITY_REACHES("UndercityReachesPlane"); private final String text; diff --git a/Mage/src/main/java/mage/game/command/Plane.java b/Mage/src/main/java/mage/game/command/Plane.java index 6f98d8add6..e4aca7eca7 100644 --- a/Mage/src/main/java/mage/game/command/Plane.java +++ b/Mage/src/main/java/mage/game/command/Plane.java @@ -75,6 +75,7 @@ public class Plane implements CommandObject { public Plane() { this.id = UUID.randomUUID(); + this.frameStyle = FrameStyle.M15_NORMAL; } public Plane(final Plane plane) { diff --git a/Mage/src/main/java/mage/game/command/planes/AgyremPlane.java b/Mage/src/main/java/mage/game/command/planes/AgyremPlane.java index ffe46756b0..0d47827726 100644 --- a/Mage/src/main/java/mage/game/command/planes/AgyremPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/AgyremPlane.java @@ -123,7 +123,7 @@ class AgyremEffect extends OneShotEffect { Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); effect.setText("return that card to the battlefield under its owner's control at the beginning of the next end step"); - game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY), source); + game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect, TargetController.ANY), source); return true; } return false; @@ -153,7 +153,7 @@ class AgyremEffect2 extends OneShotEffect { Effect effect = new ReturnFromGraveyardToHandTargetEffect(); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); effect.setText("return it to its owner's hand at the beginning of the next end step"); - game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.HAND, effect, TargetController.ANY), source); + game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect, TargetController.ANY), source); return true; } return false; diff --git a/Mage/src/main/java/mage/game/command/planes/AstralArenaPlane.java b/Mage/src/main/java/mage/game/command/planes/AstralArenaPlane.java new file mode 100644 index 0000000000..22af6de23d --- /dev/null +++ b/Mage/src/main/java/mage/game/command/planes/AstralArenaPlane.java @@ -0,0 +1,140 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ..AS IS.. AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.game.command.planes; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MainPhaseStackEmptyCondition; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.RollPlanarDieEffect; +import mage.constants.Duration; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.command.Plane; +import mage.game.permanent.Permanent; +import mage.target.Target; +import mage.watchers.common.AttackedThisTurnWatcher; +import mage.watchers.common.PlanarRollWatcher; + +/** + * + * @author spjspj + */ +public class AstralArenaPlane extends Plane { + + public AstralArenaPlane() { + this.setName("Plane - Astral Arena"); + this.setExpansionSetCodeForImage("PCA"); + + // No more than one creature can attack each turn. No more than one creature can block each turn. + SimpleStaticAbility ability = new SimpleStaticAbility(Zone.COMMAND, new AstralArenaAttackRestrictionEffect()); + ability.addWatcher(new AttackedThisTurnWatcher()); + SimpleStaticAbility ability2 = new SimpleStaticAbility(Zone.COMMAND, new AstralArenaBlockRestrictionEffect()); + ability2.addWatcher(new AttackedThisTurnWatcher()); + this.getAbilities().add(ability); + this.getAbilities().add(ability2); + + // Active player can roll the planar die: Whenever you roll {CHAOS}, {this} deals 2 damage to each creature + Effect chaosEffect = new DamageAllEffect(2, new FilterCreaturePermanent()); + Target chaosTarget = null; + + List chaosEffects = new ArrayList(); + chaosEffects.add(chaosEffect); + List chaosTargets = new ArrayList(); + chaosTargets.add(chaosTarget); + + ActivateIfConditionActivatedAbility chaosAbility = new ActivateIfConditionActivatedAbility(Zone.COMMAND, new RollPlanarDieEffect(chaosEffects, chaosTargets), new GenericManaCost(0), MainPhaseStackEmptyCondition.instance); + chaosAbility.addWatcher(new PlanarRollWatcher()); + this.getAbilities().add(chaosAbility); + chaosAbility.setMayActivate(TargetController.ANY); + this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId()))); + } +} + +class AstralArenaAttackRestrictionEffect extends RestrictionEffect { + + AstralArenaAttackRestrictionEffect() { + super(Duration.WhileOnBattlefield); + staticText = "No more than one creature can attack each combat"; + } + + AstralArenaAttackRestrictionEffect(final AstralArenaAttackRestrictionEffect effect) { + super(effect); + } + + @Override + public AstralArenaAttackRestrictionEffect copy() { + return new AstralArenaAttackRestrictionEffect(this); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return true; + } + + @Override + public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) { + return game.getCombat().getAttackers().isEmpty(); + } +} + +class AstralArenaBlockRestrictionEffect extends RestrictionEffect { + + AstralArenaBlockRestrictionEffect() { + super(Duration.WhileOnBattlefield); + staticText = "No more than one creature can block each combat"; + } + + AstralArenaBlockRestrictionEffect(final AstralArenaBlockRestrictionEffect effect) { + super(effect); + } + + @Override + public AstralArenaBlockRestrictionEffect copy() { + return new AstralArenaBlockRestrictionEffect(this); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return true; + } + + @Override + public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { + return game.getCombat().getBlockers().isEmpty(); + } +} diff --git a/Mage/src/main/java/mage/game/command/planes/TazeemPlane.java b/Mage/src/main/java/mage/game/command/planes/TazeemPlane.java new file mode 100644 index 0000000000..d7d811dc23 --- /dev/null +++ b/Mage/src/main/java/mage/game/command/planes/TazeemPlane.java @@ -0,0 +1,81 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ..AS IS.. AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.game.command.planes; + +import java.util.ArrayList; +import java.util.List; +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MainPhaseStackEmptyCondition; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.RollPlanarDieEffect; +import mage.abilities.effects.common.combat.CantBlockAllEffect; +import mage.constants.Duration; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledLandPermanent; +import mage.game.command.Plane; +import mage.target.Target; +import mage.watchers.common.PlanarRollWatcher; + +/** + * + * @author spjspj + */ +public class TazeemPlane extends Plane { + + public TazeemPlane() { + this.setName("Plane - Tazeem"); + this.setExpansionSetCodeForImage("PCA"); + + // Creatures can't block + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES, Duration.WhileOnBattlefield)); + this.getAbilities().add(ability); + + // Active player can roll the planar die: Whenever you roll {CHAOS}, draw a card for each land you control + Effect chaosEffect = new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(new FilterControlledLandPermanent())); + Target chaosTarget = null; + + List chaosEffects = new ArrayList(); + chaosEffects.add(chaosEffect); + + List chaosTargets = new ArrayList(); + chaosTargets.add(chaosTarget); + + ActivateIfConditionActivatedAbility chaosAbility = new ActivateIfConditionActivatedAbility(Zone.COMMAND, new RollPlanarDieEffect(chaosEffects, chaosTargets), new GenericManaCost(0), MainPhaseStackEmptyCondition.instance); + chaosAbility.addWatcher(new PlanarRollWatcher()); + this.getAbilities().add(chaosAbility); + chaosAbility.setMayActivate(TargetController.ANY); + this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId()))); + } +} diff --git a/Mage/src/main/java/mage/game/command/planes/TrugaJunglePlane.java b/Mage/src/main/java/mage/game/command/planes/TrugaJunglePlane.java new file mode 100644 index 0000000000..dde3866195 --- /dev/null +++ b/Mage/src/main/java/mage/game/command/planes/TrugaJunglePlane.java @@ -0,0 +1,80 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ..AS IS.. AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.game.command.planes; + +import java.util.ArrayList; +import java.util.List; +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MainPhaseStackEmptyCondition; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect; +import mage.abilities.effects.common.RollPlanarDieEffect; +import mage.abilities.effects.common.continuous.GainAbilityAllEffect; +import mage.abilities.mana.AnyColorManaAbility; +import mage.constants.Duration; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.filter.common.FilterLandCard; +import mage.game.command.Plane; +import mage.target.Target; +import mage.watchers.common.PlanarRollWatcher; + +/** + * + * @author spjspj + */ +public class TrugaJunglePlane extends Plane { + + public TrugaJunglePlane() { + this.setName("Plane - Truga Jungle"); + this.setExpansionSetCodeForImage("PCA"); + + // All lands have '{t}: Add one mana of any color to your mana pool" + Ability ability = new SimpleStaticAbility(Zone.COMMAND, new GainAbilityAllEffect(new AnyColorManaAbility(), Duration.Custom, StaticFilters.FILTER_LANDS, false)); + this.getAbilities().add(ability); + + // Active player can roll the planar die: Whenever you roll {CHAOS}, reveal the top three cards of your libary. Put all land cards revealed this way into your hand the rest on the bottom of your library in any order. + Effect chaosEffect = new RevealLibraryPutIntoHandEffect(3, new FilterLandCard(), Zone.LIBRARY); + Target chaosTarget = null; + + List chaosEffects = new ArrayList(); + chaosEffects.add(chaosEffect); + List chaosTargets = new ArrayList(); + chaosTargets.add(chaosTarget); + + ActivateIfConditionActivatedAbility chaosAbility = new ActivateIfConditionActivatedAbility(Zone.COMMAND, new RollPlanarDieEffect(chaosEffects, chaosTargets), new GenericManaCost(0), MainPhaseStackEmptyCondition.instance); + chaosAbility.addWatcher(new PlanarRollWatcher()); + this.getAbilities().add(chaosAbility); + chaosAbility.setMayActivate(TargetController.ANY); + this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId()))); + } +} diff --git a/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java b/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java new file mode 100644 index 0000000000..9f3ba9642a --- /dev/null +++ b/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java @@ -0,0 +1,131 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ..AS IS.. AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.game.command.planes; + +import java.util.ArrayList; +import java.util.List; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MainPhaseStackEmptyCondition; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.RollPlanarDieEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.command.Plane; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.Target; +import mage.watchers.common.PlanarRollWatcher; + +/** + * + * @author spjspj + */ +public class UndercityReachesPlane extends Plane { + + private static final FilterCard filter = new FilterCard("creature spells"); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + } + + public UndercityReachesPlane() { + this.setName("Plane - Undercity Reaches"); + this.setExpansionSetCodeForImage("PCA"); + + // Whenever a creature deals combat damage to a player, its controller may a draw a card + Ability ability = new UndercityReachesTriggeredAbility(); + + this.getAbilities().add(ability); + + // Active player can roll the planar die: Whenever you roll {CHAOS}, reveal the top three cards of your library. Put all creature cards revealed this way into your hand and the rest into your graveyard. + Effect chaosEffect = new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Duration.EndOfGame, HandSizeModification.SET); + Target chaosTarget = null; + + List chaosEffects = new ArrayList(); + chaosEffects.add(chaosEffect); + List chaosTargets = new ArrayList(); + chaosTargets.add(chaosTarget); + + ActivateIfConditionActivatedAbility chaosAbility = new ActivateIfConditionActivatedAbility(Zone.COMMAND, new RollPlanarDieEffect(chaosEffects, chaosTargets), new GenericManaCost(0), MainPhaseStackEmptyCondition.instance); + chaosAbility.addWatcher(new PlanarRollWatcher()); + this.getAbilities().add(chaosAbility); + chaosAbility.setMayActivate(TargetController.ANY); + this.getAbilities().add(new SimpleStaticAbility(Zone.ALL, new PlanarDieRollCostIncreasingEffect(chaosAbility.getOriginalId()))); + } +} + +class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl { + + public UndercityReachesTriggeredAbility() { + super(Zone.COMMAND, new DrawCardSourceControllerEffect(1), true); + } + + public UndercityReachesTriggeredAbility(final UndercityReachesTriggeredAbility ability) { + super(ability); + } + + @Override + public UndercityReachesTriggeredAbility copy() { + return new UndercityReachesTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (((DamagedPlayerEvent) event).isCombatDamage()) { + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null) { + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever a creature deals combat damage to a player, its controller may a draw a card"; + } +}