Various text fixes

This commit is contained in:
Alex W. Jackson 2022-04-26 07:10:13 -04:00
parent 4304b4a66a
commit d95d8378fb
57 changed files with 224 additions and 708 deletions

View file

@ -51,11 +51,11 @@ public class EntersBattlefieldControlledTriggeredAbility extends EntersBattlefie
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (super.checkTrigger(event, game)) {
Permanent permanent = game.getPermanent(event.getTargetId());
return permanent != null && permanent.isControlledBy(this.getControllerId());
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null || !permanent.isControlledBy(getControllerId())) {
return false;
}
return false;
return super.checkTrigger(event, game);
}
@Override

View file

@ -79,14 +79,14 @@ public class DetainTargetEffect extends OneShotEffect {
sb.append("detain up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName());
}
sb.append(". <i>(Until your next turn, ");
if (target instanceof TargetCreaturePermanent) {
sb.append(target.getMaxNumberOfTargets() == 1 ? "that creature" : "those creatures");
} else {
sb.append(target.getMaxNumberOfTargets() == 1 ? "that permanent" : "those permanents");
boolean plural = target.getMaxNumberOfTargets() > 1;
sb.append(plural ? "those " : "that ");
sb.append(target.getTargetName().contains("creature") ? "creature" : "permanent");
if (plural) {
sb.append('s');
}
sb.append(" can't attack or block and ");
sb.append(target.getMaxNumberOfTargets() == 1 ? "its" : "their");
sb.append(plural ? "their" : "its");
sb.append(" activated abilities can't be activated.)</i>");
return sb.toString();
}

View file

@ -5,9 +5,7 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.PreventionEffectImpl;
import mage.constants.Duration;
import static mage.constants.Duration.EndOfTurn;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
@ -29,7 +27,7 @@ public class PreventAllDamageByAllPermanentsEffect extends PreventionEffectImpl
this(null, duration, onlyCombat);
}
public PreventAllDamageByAllPermanentsEffect(FilterCreaturePermanent filter, Duration duration, boolean onlyCombat) {
public PreventAllDamageByAllPermanentsEffect(FilterPermanent filter, Duration duration, boolean onlyCombat) {
super(duration, Integer.MAX_VALUE, onlyCombat);
this.filter = filter;
}
@ -68,24 +66,17 @@ public class PreventAllDamageByAllPermanentsEffect extends PreventionEffectImpl
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder("Prevent all ");
StringBuilder sb = new StringBuilder("prevent all ");
if (onlyCombat) {
sb.append("combat ");
}
sb.append("damage ");
if (duration == EndOfTurn) {
if (filter != null) {
sb.append(filter.getMessage());
sb.append(" would deal this turn");
} else {
sb.append("that would be dealt this turn");
}
} else {
sb.append(duration.toString());
if (filter != null) {
sb.append(" dealt by ");
sb.append(filter.getMessage());
}
sb.append("damage that would be dealt");
if (duration == Duration.EndOfTurn) {
sb.append(" this turn");
}
if (filter != null) {
sb.append(" by ");
sb.append(filter.getMessage());
}
return sb.toString();
}

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common;
import mage.constants.Outcome;
@ -9,8 +7,6 @@ import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
@ -22,7 +18,7 @@ public class TapAllEffect extends OneShotEffect {
public TapAllEffect(FilterPermanent filter) {
super(Outcome.Tap);
this.filter = filter;
setText();
staticText = "tap all " + filter.getMessage();
}
public TapAllEffect(final TapAllEffect effect) {
@ -42,9 +38,4 @@ public class TapAllEffect extends OneShotEffect {
}
return true;
}
private void setText() {
staticText = "tap all " + filter.getMessage();
}
}

View file

@ -4,7 +4,7 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.RequirementEffect;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.AttackedThisTurnWatcher;
@ -15,26 +15,27 @@ import mage.watchers.common.AttackedThisTurnWatcher;
*/
public class AttacksIfAbleAllEffect extends RequirementEffect {
private final FilterCreaturePermanent filter;
private final FilterPermanent filter;
private boolean eachCombat;
public AttacksIfAbleAllEffect(FilterCreaturePermanent filter) {
public AttacksIfAbleAllEffect(FilterPermanent filter) {
this(filter, Duration.WhileOnBattlefield);
}
boolean eachCombat;
public AttacksIfAbleAllEffect(FilterCreaturePermanent filter, Duration duration) {
this(filter, duration, false);
}
public AttacksIfAbleAllEffect(FilterCreaturePermanent filter, Duration duration, boolean eachCombat) {
public AttacksIfAbleAllEffect(FilterPermanent filter, Duration duration) {
super(duration);
this.filter = filter;
this.eachCombat = eachCombat;
if (this.duration == Duration.EndOfTurn) {
staticText = filter.getMessage() + " attack " + (eachCombat ? "each combat" : "this turn") + " if able";
eachCombat = false;
staticText = filter.getMessage() + " attack this turn if able";
} else {
staticText = filter.getMessage() + " attack each " + (eachCombat ? "combat" : "turn") + " if able";
eachCombat = true;
String durationString = this.duration.toString();
if (durationString.isEmpty()) {
staticText = filter.getMessage() + " attack each combat if able";
} else {
staticText = durationString + ", " + filter.getMessage() + " attack each combat if able";
}
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.combat;
import mage.abilities.Ability;
@ -23,11 +22,8 @@ public class BlocksIfAbleAllEffect extends RequirementEffect {
public BlocksIfAbleAllEffect(FilterCreaturePermanent filter, Duration duration) {
super(duration);
staticText = new StringBuilder(filter.getMessage())
.append(" block ")
.append(duration == Duration.EndOfTurn ? "this":"each")
.append(" turn if able").toString();
this.filter = filter;
staticText = filter.getMessage() + " block " + (duration == Duration.EndOfTurn ? "this turn" : "each combat") + " if able";
}
public BlocksIfAbleAllEffect(final BlocksIfAbleAllEffect effect) {
super(effect);
@ -58,7 +54,4 @@ public class BlocksIfAbleAllEffect extends RequirementEffect {
public boolean mustAttack(Game game) {
return false;
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -8,6 +7,7 @@ import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -22,11 +22,15 @@ public class CreaturesCantGetOrHaveAbilityEffect extends ContinuousEffectImpl {
private final Ability ability;
private final FilterCreaturePermanent filter;
public CreaturesCantGetOrHaveAbilityEffect(Ability ability, Duration duration) {
this(ability, duration, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURES);
}
public CreaturesCantGetOrHaveAbilityEffect(Ability ability, Duration duration, FilterCreaturePermanent filter) {
super(duration, Outcome.Detriment);
this.ability = ability;
this.filter = filter;
setText();
staticText = filter.getMessage() + " lose " + ability.getRule() + " and can't have or gain " + ability.getRule();
addDependedToType(DependencyType.AddingAbility);
}
@ -65,14 +69,4 @@ public class CreaturesCantGetOrHaveAbilityEffect extends ContinuousEffectImpl {
public boolean hasLayer(Layer layer) {
return layer == Layer.AbilityAddingRemovingEffects_6;
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage());
sb.append(" lose ");
sb.append(ability.getRule());
sb.append(" can't have or gain ");
sb.append(ability.getRule());
staticText = sb.toString();
}
}

View file

@ -433,17 +433,15 @@ public final class StaticFilters {
FILTER_OPPONENTS_PERMANENT.setLockedFilter(true);
}
public static final FilterCreaturePermanent FILTER_OPPONENTS_PERMANENT_CREATURE = new FilterCreaturePermanent("creature an opponent controls");
public static final FilterCreaturePermanent FILTER_OPPONENTS_PERMANENT_CREATURE = new FilterOpponentsCreaturePermanent();
static {
FILTER_OPPONENTS_PERMANENT_CREATURE.add(TargetController.OPPONENT.getControllerPredicate());
FILTER_OPPONENTS_PERMANENT_CREATURE.setLockedFilter(true);
}
public static final FilterCreaturePermanent FILTER_OPPONENTS_PERMANENT_CREATURES = new FilterCreaturePermanent("creatures an opponent controls");
public static final FilterCreaturePermanent FILTER_OPPONENTS_PERMANENT_CREATURES = new FilterOpponentsCreaturePermanent("creatures your opponents control");
static {
FILTER_OPPONENTS_PERMANENT_CREATURES.add(TargetController.OPPONENT.getControllerPredicate());
FILTER_OPPONENTS_PERMANENT_CREATURES.setLockedFilter(true);
}

View file

@ -7,8 +7,7 @@ import mage.abilities.effects.common.combat.CantBlockSourceEffect;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
import java.util.Arrays;
@ -17,12 +16,6 @@ import java.util.Arrays;
*/
public final class PursuedWhaleToken extends TokenImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public PursuedWhaleToken() {
super("Pirate Token", "1/1 red Pirate creature token with \"This creature can't block\" and \"Creatures you control attack each combat if able.\"");
cardType.add(CardType.CREATURE);
@ -33,9 +26,7 @@ public final class PursuedWhaleToken extends TokenImpl {
this.addAbility(new SimpleStaticAbility(new CantBlockSourceEffect(Duration.WhileOnBattlefield)
.setText("this creature can't block")));
this.addAbility(new SimpleStaticAbility(new AttacksIfAbleAllEffect(
filter, Duration.WhileOnBattlefield, true
)));
this.addAbility(new SimpleStaticAbility(new AttacksIfAbleAllEffect(StaticFilters.FILTER_CONTROLLED_CREATURES)));
availableImageSetCodes = Arrays.asList("M21");
}

View file

@ -1,16 +1,13 @@
package mage.game.permanent.token;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.constants.SubType;
import mage.filter.StaticFilters;
/**
*
@ -18,12 +15,6 @@ import mage.filter.common.FilterCreaturePermanent;
*/
public final class SpyMasterGoblinToken extends TokenImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control");
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public SpyMasterGoblinToken() {
super("Goblin Token", "1/1 red Goblin creature token with \"Creatures you control attack each combat if able.\"");
cardType.add(CardType.CREATURE);
@ -32,8 +23,7 @@ public final class SpyMasterGoblinToken extends TokenImpl {
power = new MageInt(1);
toughness = new MageInt(1);
Effect effect = new AttacksIfAbleAllEffect(filter, Duration.WhileOnBattlefield, true);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
this.addAbility(new SimpleStaticAbility(new AttacksIfAbleAllEffect(StaticFilters.FILTER_CONTROLLED_CREATURES)));
}
public SpyMasterGoblinToken(final SpyMasterGoblinToken token) {

View file

@ -1,32 +1,24 @@
package mage.target.common;
import mage.filter.common.FilterOpponentsCreaturePermanent;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
/**
*
* @author Styxo
* @author awjackson
*/
public class TargetOpponentsCreaturePermanent extends TargetCreaturePermanent {
public class TargetOpponentsCreaturePermanent extends TargetPermanent {
public TargetOpponentsCreaturePermanent() {
this(1, 1, new FilterOpponentsCreaturePermanent(), false);
this(1);
}
public TargetOpponentsCreaturePermanent(int numTargets) {
this(numTargets, numTargets, new FilterOpponentsCreaturePermanent(), false);
this(numTargets, numTargets);
}
public TargetOpponentsCreaturePermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, new FilterOpponentsCreaturePermanent(), false);
}
public TargetOpponentsCreaturePermanent(FilterOpponentsCreaturePermanent filter) {
super(1, 1, filter, false);
}
public TargetOpponentsCreaturePermanent(int minNumTargets, int maxNumTargets, FilterOpponentsCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage();
super(minNumTargets, maxNumTargets, maxNumTargets > 1 ? StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURES : StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE);
}
public TargetOpponentsCreaturePermanent(final TargetOpponentsCreaturePermanent target) {