a few more triggered ability text fixes

This commit is contained in:
Evan Kranzler 2021-07-20 19:06:44 -04:00
parent aac4cd00ce
commit e2f1743c6b
4 changed files with 9 additions and 140 deletions

View file

@ -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));
}

View file

@ -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 "";
}
}

View file

@ -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, ";

View file

@ -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 "";
}
}