diff --git a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java index 16789e46e6..73ecbb7b1b 100644 --- a/Mage.Server/src/main/java/mage/server/util/SystemUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/SystemUtil.java @@ -1,6 +1,17 @@ package mage.server.util; +import java.io.File; +import java.lang.reflect.Constructor; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; import mage.cards.Card; import mage.cards.repository.CardCriteria; import mage.cards.repository.CardInfo; @@ -13,20 +24,12 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.GameCommanderImpl; +import mage.game.command.CommandObject; +import mage.game.command.Plane; import mage.game.permanent.Permanent; import mage.players.Player; import mage.util.RandomUtil; -import java.io.File; -import java.lang.reflect.Constructor; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - /** * @author JayDi85 */ @@ -233,8 +236,8 @@ public final class SystemUtil { *
* Implementation note:
* 1. Read init.txt line by line
- * 2. Parse line using for searching groups like: [group 1] - * 3. Parse line using the following format: line ::= + * 2. Parse line using for searching groups like: [group 1] 3. Parse line + * using the following format: line ::= * :::
* 4. If zone equals to 'hand', add card to player's library
* 5a. Then swap added card with any card in player's hand
@@ -432,6 +435,23 @@ public final class SystemUtil { } } else if ("plane".equalsIgnoreCase(command.zone)) { // eg: plane:Human:BantPlane:1 + // Steps: 1) Remove the last plane and set its effects to discarded + for (CommandObject cobject : game.getState().getCommand()) { + if (cobject instanceof Plane) { + if (((Plane) cobject).getAbilities() != null) { + for (Ability ability : ((Plane) cobject).getAbilities()) { + for (Effect effect : ability.getEffects()) { + if (effect instanceof ContinuousEffect) { + ((ContinuousEffect) effect).discard(); + } + } + } + } + game.getState().removeTriggersOfSourceId(((Plane) cobject).getId()); + game.getState().getCommand().remove(cobject); + break; + } + } Class c = Class.forName("mage.game.command.planes." + command.cardName); Constructor cons = c.getConstructor(); Object plane = cons.newInstance(); @@ -609,8 +629,8 @@ public final class SystemUtil { /** * Get a diff between two dates * - * @param date1 the oldest date - * @param date2 the newest date + * @param date1 the oldest date + * @param date2 the newest date * @param timeUnit the unit in which you want the diff * @return the diff value, in the provided unit */ diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java index bb91497e55..b67b95b6f4 100644 --- a/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java @@ -1,4 +1,3 @@ - package mage.abilities.common; import mage.abilities.TriggeredAbilityImpl; @@ -86,6 +85,7 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl { } break; case ANY: + case ACTIVE: if (getTargets().isEmpty()) { this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId())); } @@ -97,6 +97,8 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { switch (targetController) { + case ACTIVE: + return "At the beginning of your draw step, " + generateZoneString() + getEffects().getText(modes.getMode()); case YOU: return "At the beginning of your draw step, " + generateZoneString() + getEffects().getText(modes.getMode()); case OPPONENT: diff --git a/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java index 8defc46d6b..f6452f7d54 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RollPlanarDieEffect.java @@ -1,4 +1,3 @@ - package mage.abilities.effects.common; import java.util.List; @@ -102,7 +101,6 @@ public class RollPlanarDieEffect extends OneShotEffect { // Steps: 1) Remove the last plane and set its effects to discarded for (CommandObject cobject : game.getState().getCommand()) { if (cobject instanceof Plane) { - game.getState().addSeenPlane((Plane) cobject, game, id); if (((Plane) cobject).getAbilities() != null) { for (Ability ability : ((Plane) cobject).getAbilities()) { for (Effect effect : ability.getEffects()) { @@ -153,7 +151,7 @@ public class RollPlanarDieEffect extends OneShotEffect { for (int i = 0; i < chaosEffects.size(); i++) { Effect effect = chaosEffects.get(i); if (effect != null) { - try { + try { String emode = effect.getText(mode); emode = emode.substring(0, 1).toLowerCase() + emode.substring(1); sb.append(emode); diff --git a/Mage/src/main/java/mage/constants/PlanarDieRoll.java b/Mage/src/main/java/mage/constants/PlanarDieRoll.java index 344a67b593..db3ecfa274 100644 --- a/Mage/src/main/java/mage/constants/PlanarDieRoll.java +++ b/Mage/src/main/java/mage/constants/PlanarDieRoll.java @@ -1,15 +1,13 @@ - package mage.constants; /** * * @author spjspj */ - public enum PlanarDieRoll { - NIL_ROLL ("Nil Roll"), + NIL_ROLL("Blank Roll"), CHAOS_ROLL("Chaos Roll"), - PLANAR_ROLL ("Planar Roll"); + PLANAR_ROLL("Planar Roll"); private final String text; diff --git a/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java b/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java index 6fbb481414..3f2123ecfb 100644 --- a/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/PanopticonPlane.java @@ -1,4 +1,3 @@ - package mage.game.command.planes; import java.util.ArrayList; @@ -22,6 +21,7 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.Target; +import mage.target.targetpointer.FixedTarget; import mage.watchers.common.PlanarRollWatcher; /** @@ -36,12 +36,14 @@ public class PanopticonPlane extends Plane { 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); + // When you planeswalk to Panopticon, draw a card Ability pwability = new PanopticonTriggeredAbility(new DrawCardTargetEffect(1)); this.getAbilities().add(pwability); + // At the beginning of your draw step, draw an additional card. + Ability ability = new BeginningOfDrawTriggeredAbility(Zone.COMMAND, new DrawCardTargetEffect(1), TargetController.ACTIVE, false); + this.getAbilities().add(ability); + // Active player can roll the planar die: Whenever you roll {CHAOS}, draw a card Effect chaosEffect = new DrawCardSourceControllerEffect(1); Target chaosTarget = null; @@ -84,7 +86,7 @@ class PanopticonTriggeredAbility extends TriggeredAbilityImpl { Player activePlayer = game.getPlayer(game.getActivePlayerId()); if (activePlayer != null) { - activePlayer.drawCards(1, game); + getEffects().setTargetPointer(new FixedTarget(activePlayer.getId())); return true; } return false;