From e2f1743c6b75d053e991cec916acc7efa6cb7b80 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 20 Jul 2021 19:06:44 -0400 Subject: [PATCH] a few more triggered ability text fixes --- .../src/mage/cards/h/HallOfGemstone.java | 9 +- .../BeginningOfUntapTriggeredAbility.java | 119 ------------------ .../EntersBattlefieldTriggeredAbility.java | 5 - ...ginOfMainPhaseDelayedTriggeredAbility.java | 16 +-- 4 files changed, 9 insertions(+), 140 deletions(-) delete mode 100644 Mage/src/main/java/mage/abilities/common/BeginningOfUntapTriggeredAbility.java diff --git a/Mage.Sets/src/mage/cards/h/HallOfGemstone.java b/Mage.Sets/src/mage/cards/h/HallOfGemstone.java index 41297db54d..42f22fb105 100644 --- a/Mage.Sets/src/mage/cards/h/HallOfGemstone.java +++ b/Mage.Sets/src/mage/cards/h/HallOfGemstone.java @@ -1,11 +1,9 @@ - package mage.cards.h; -import java.util.UUID; import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; -import mage.abilities.common.BeginningOfUntapTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.effects.ReplacementEffectImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -18,8 +16,9 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.util.CardUtil; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class HallOfGemstone extends CardImpl { @@ -30,7 +29,7 @@ public final class HallOfGemstone extends CardImpl { addSuperType(SuperType.WORLD); // At the beginning of each player's upkeep, that player chooses a color. Until end of turn, lands tapped for mana produce mana of the chosen color instead of any other color. - this.addAbility(new BeginningOfUntapTriggeredAbility(new HallOfGemstoneEffect(), TargetController.ANY, false)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new HallOfGemstoneEffect(), TargetController.ACTIVE, false)); } diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfUntapTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfUntapTriggeredAbility.java deleted file mode 100644 index 89d9f87241..0000000000 --- a/Mage/src/main/java/mage/abilities/common/BeginningOfUntapTriggeredAbility.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package mage.abilities.common; - -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -import mage.constants.TargetController; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.target.targetpointer.FixedTarget; - -/** - * @author Jeff - */ -public class BeginningOfUntapTriggeredAbility extends TriggeredAbilityImpl { - - private TargetController targetController; - - public BeginningOfUntapTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) { - this(Zone.BATTLEFIELD, effect, targetController, isOptional); - } - - public BeginningOfUntapTriggeredAbility(Zone zone, Effect effect, TargetController targetController, boolean isOptional) { - super(zone, effect, isOptional); - this.targetController = targetController; - } - - public BeginningOfUntapTriggeredAbility(final BeginningOfUntapTriggeredAbility ability) { - super(ability); - this.targetController = ability.targetController; - } - - @Override - public BeginningOfUntapTriggeredAbility copy() { - return new BeginningOfUntapTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UNTAP_STEP_PRE; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - switch (targetController) { - case YOU: - boolean yours = event.getPlayerId().equals(this.controllerId); - if (yours) { - if (getTargets().isEmpty()) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - } - } - return yours; - case NOT_YOU: - if (game.getState().getPlayersInRange(this.getControllerId(), game).contains(event.getPlayerId()) - && !event.getPlayerId().equals(this.getControllerId())) { - if (getTargets().isEmpty()) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - } - return true; - } - break; - case OPPONENT: - if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) { - if (getTargets().isEmpty()) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - } - return true; - } - break; - case ANY: - if (game.getState().getPlayersInRange(this.getControllerId(), game).contains(event.getPlayerId())) { - if (getTargets().isEmpty()) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - } - return true; - } - break; - } - return false; - } - - @Override - public String getRule() { - StringBuilder sb = new StringBuilder(); - switch (targetController) { - case YOU: - return sb.append("At the beginning of your untap step, ").append(generateZoneString()).append(getEffects().getText(modes.getMode())).toString(); - case NOT_YOU: - return sb.append(getEffects().getText(modes.getMode())).append(" during each other player's untap step").append(generateZoneString()).toString(); - case OPPONENT: - return sb.append("At the beginning of each opponent's untap step, ").append(generateZoneString()).append(getEffects().getText(modes.getMode())).toString(); - case ANY: - return sb.append("At the beginning of each player's untap step, ").append(generateZoneString()).append(getEffects().getText(modes.getMode())).toString(); - - } - return "BeginningOfUntapTriggeredAbility: targetController value not supported"; - } - - private String generateZoneString() { - switch (getZone()) { - case GRAVEYARD: - return "if {this} is in your graveyard, "; - } - return ""; - } - -} diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldTriggeredAbility.java index c383dd4ce9..41f55259af 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldTriggeredAbility.java @@ -47,11 +47,6 @@ public class EntersBattlefieldTriggeredAbility extends TriggeredAbilityImpl { return false; } - @Override - public String getRule() { - return super.getRule(); - } - @Override public String getTriggerPhrase() { return "When {this} enters the battlefield, "; diff --git a/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfMainPhaseDelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfMainPhaseDelayedTriggeredAbility.java index 23b8331c9c..d23bc1098f 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfMainPhaseDelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/AtTheBeginOfMainPhaseDelayedTriggeredAbility.java @@ -102,22 +102,16 @@ public class AtTheBeginOfMainPhaseDelayedTriggeredAbility extends DelayedTrigger @Override public String getRule() { - StringBuilder sb = new StringBuilder(); switch (targetController) { case YOU: - sb.append("At the beginning of your ").append(phaseSelection.toString()).append(", "); - break; + return "At the beginning of your " + phaseSelection + ", "; case OPPONENT: - sb.append("At the beginning of an opponent's ").append(phaseSelection.toString()).append(", "); - break; + return "At the beginning of an opponent's " + phaseSelection + ", "; case ANY: - sb.append("At the beginning of the ").append(phaseSelection.toString()).append(", "); - break; + return "At the beginning of the " + phaseSelection + ", "; case CONTROLLER_ATTACHED_TO: - sb.append("At the beginning of the ").append(phaseSelection.toString()).append(" of enchanted creature's controller, "); - break; + return "At the beginning of the " + phaseSelection + " of enchanted creature's controller, "; } - sb.append(getEffects().getText(modes.getMode())); - return sb.toString(); + return ""; } }