From bb5d601ff41cbdc15f63faa1767c5c824196986c Mon Sep 17 00:00:00 2001 From: spjspj Date: Thu, 31 May 2018 23:14:56 +1000 Subject: [PATCH] New plane (Panopticon) with 'PW to' ability checked --- .../src/main/resources/card-pictures-tok.txt | 1 + Mage/src/main/java/mage/constants/Planes.java | 1 + .../game/command/planes/PanopticonPlane.java | 128 ++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java diff --git a/Mage.Client/src/main/resources/card-pictures-tok.txt b/Mage.Client/src/main/resources/card-pictures-tok.txt index 83df7a8e29..664b4d79c3 100644 --- a/Mage.Client/src/main/resources/card-pictures-tok.txt +++ b/Mage.Client/src/main/resources/card-pictures-tok.txt @@ -97,6 +97,7 @@ |Generate|PLANE:PCA|Plane - Hedron Fields of Agadeem|||HedronFieldsOfAgadeemPlane| |Generate|PLANE:PCA|Plane - Lethe Lake|||LetheLakePlane| |Generate|PLANE:PCA|Plane - Naya|||NayaPlane| +|Generate|PLANE:PCA|Plane - Panopticon|||PanopticonPlane| |Generate|PLANE:PCA|Plane - Tazeem|||TazeemPlane| |Generate|PLANE:PCA|Plane - The Dark Barony|||TheDarkBaronyPlane| |Generate|PLANE:PCA|Plane - The Eon Fog|||TheEonFogPlane| diff --git a/Mage/src/main/java/mage/constants/Planes.java b/Mage/src/main/java/mage/constants/Planes.java index 57b31d49dc..63f1cd3ca4 100644 --- a/Mage/src/main/java/mage/constants/Planes.java +++ b/Mage/src/main/java/mage/constants/Planes.java @@ -43,6 +43,7 @@ public enum Planes { PLANE_HEDRON_FIELDS_OF_AGADEEM("HedronFieldsOfAgadeemPlane"), PLANE_LETHE_LAKE("LetheLakePlane"), PLANE_NAYA("NayaPlane"), + PLANE_PANOPTICON("PanopticonPlane"), PLANE_TAZEEM("TazeemPlane"), PLANE_THE_DARK_BARONY("TheDarkBaronyPlane"), PLANE_THE_EON_FOG("TheEonFogPlane"), diff --git a/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java b/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java new file mode 100644 index 0000000000..e73b4912d7 --- /dev/null +++ b/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java @@ -0,0 +1,128 @@ +/* + * 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.BeginningOfDrawTriggeredAbility; +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.DrawCardTargetEffect; +import mage.abilities.effects.common.RollPlanarDieEffect; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.command.Plane; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.players.Player; +import mage.target.Target; +import mage.watchers.common.PlanarRollWatcher; + +/** + * + * @author spjspj + */ +public class PanopticonPlane extends Plane { + + private static final String rule = "At the beginning of your draw step, draw an additional card"; + + public PanopticonPlane() { + this.setName("Plane - Panopticon"); + this.setExpansionSetCodeForImage("PCA"); + + // At the beginning of your draw step, draw an additional card. + Ability ability = new BeginningOfDrawTriggeredAbility(new DrawCardTargetEffect(1), TargetController.ANY, false); + this.getAbilities().add(ability); + Ability pwability = new PanopticonTriggeredAbility(new DrawCardTargetEffect(1)); + this.getAbilities().add(pwability); + + // Active player can roll the planar die: Whenever you roll {CHAOS}, draw a card + Effect chaosEffect = new DrawCardSourceControllerEffect(1); + 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 PanopticonTriggeredAbility extends TriggeredAbilityImpl { + + public PanopticonTriggeredAbility(Effect effect) { + super(Zone.COMMAND, effect); + } + + public PanopticonTriggeredAbility(final PanopticonTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.PLANESWALKED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null || !cPlane.getName().equalsIgnoreCase("Plane - Panopticon")) { + return false; + } + + Player activePlayer = game.getPlayer(game.getActivePlayerId()); + if (activePlayer != null) { + activePlayer.drawCards(1, game); + return true; + } + return false; + } + + @Override + public String getRule() { + return "When you planeswalk to {this}, draw a card"; + } + + @Override + public PanopticonTriggeredAbility copy() { + return new PanopticonTriggeredAbility(this); + } +}