From 8db079f430e78c1fe264f25855b5ce975dce6824 Mon Sep 17 00:00:00 2001 From: spjspj Date: Thu, 19 Apr 2018 18:01:46 +1000 Subject: [PATCH] Fix for Planes (Incorrectly appending continuous effects) --- .../planes/AcademyAtTolariaWestPlane.java | 10 ++++++---- .../game/command/planes/AstralArenaPlane.java | 19 +++++++++++++++++++ .../command/planes/EdgeOfMalacolPlane.java | 8 ++++++-- .../command/planes/FieldsOfSummerPlane.java | 9 +++++++++ .../planes/HedronFieldsOfAgadeemPlane.java | 8 ++++++-- .../game/command/planes/TheEonFogPlane.java | 8 ++++++-- .../command/planes/UndercityReachesPlane.java | 10 ++++++++++ 7 files changed, 62 insertions(+), 10 deletions(-) diff --git a/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java b/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java index 63b6894692..3e8085dc3c 100644 --- a/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/AcademyAtTolariaWestPlane.java @@ -110,12 +110,15 @@ class DrawCardsActivePlayerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - if (game.getState().getCurrentPlane() != null) { - if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Academy at Tolaria West")) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - Academy at Tolaria West")) { return false; } } - Player player = game.getPlayer(game.getActivePlayerId()); if (player != null) { player.drawCards(amount.calculate(game, source, this), game); @@ -129,7 +132,6 @@ class DrawCardsActivePlayerEffect extends OneShotEffect { sb.append("draw ").append(CardUtil.numberToText(amount.toString())).append(" cards"); staticText = sb.toString(); } - } enum HellbentAPCondition implements Condition { diff --git a/Mage/src/main/java/mage/game/command/planes/AstralArenaPlane.java b/Mage/src/main/java/mage/game/command/planes/AstralArenaPlane.java index 22af6de23d..cd34a0acbd 100644 --- a/Mage/src/main/java/mage/game/command/planes/AstralArenaPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/AstralArenaPlane.java @@ -103,6 +103,16 @@ class AstralArenaAttackRestrictionEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) { + return false; + } + } + return true; } @@ -130,6 +140,15 @@ class AstralArenaBlockRestrictionEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) { + return false; + } + } return true; } diff --git a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java index 56cf30cd30..9caa2b5677 100644 --- a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java @@ -122,8 +122,12 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { // Prevent untap event of creatures of target player if (game.getTurn().getStepType() == PhaseStep.UNTAP) { - if (game.getState().getCurrentPlane() != null) { - if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Edge of Malacol")) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - Edge of Malacol")) { return false; } } diff --git a/Mage/src/main/java/mage/game/command/planes/FieldsOfSummerPlane.java b/Mage/src/main/java/mage/game/command/planes/FieldsOfSummerPlane.java index aa8bc003bc..1880011cd3 100644 --- a/Mage/src/main/java/mage/game/command/planes/FieldsOfSummerPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/FieldsOfSummerPlane.java @@ -103,6 +103,15 @@ class FieldsOfSummerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - Fields of Summer")) { + return false; + } + } Player controller = game.getPlayer(source.getControllerId()); Player owner = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (owner != null && owner.canRespond() && owner.chooseUse(Outcome.Benefit, "Gain 2 life?", source, game)) { diff --git a/Mage/src/main/java/mage/game/command/planes/HedronFieldsOfAgadeemPlane.java b/Mage/src/main/java/mage/game/command/planes/HedronFieldsOfAgadeemPlane.java index 0b3b3ca70f..201595b857 100644 --- a/Mage/src/main/java/mage/game/command/planes/HedronFieldsOfAgadeemPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/HedronFieldsOfAgadeemPlane.java @@ -117,8 +117,12 @@ class HedronFieldsOfAgadeemRestrictionEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { - if (game.getState().getCurrentPlane() != null) { - if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - Hedron Fields of Agadeem")) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - Hedron Fields of Agadeem")) { return false; } } diff --git a/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java b/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java index f952056ac7..9f00d535f5 100644 --- a/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java @@ -109,8 +109,12 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (game.getState().getCurrentPlane() != null) { - if (!game.getState().getCurrentPlane().getName().equalsIgnoreCase("Plane - The Eon Fog")) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - The Eon Fog")) { return false; } } diff --git a/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java b/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java index d15724ba1b..b95470634b 100644 --- a/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/UndercityReachesPlane.java @@ -118,6 +118,16 @@ class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { + Plane cPlane = game.getState().getCurrentPlane(); + if (cPlane == null) { + return false; + } + if (cPlane != null) { + if (!cPlane.getName().equalsIgnoreCase("Plane - Undercity Reaches")) { + return false; + } + } + if (((DamagedPlayerEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); if (creature != null) {