BoostSourceEffect: format X like BoostTargetEffect

primarily to fix Chameleon Colossus and friends, but also updated
Terra Ravager's ability to match the corrected format, and now
both Source and Target support -X, for Death's Shadow.
This commit is contained in:
Neil Gentleman 2015-11-07 12:27:02 -08:00
parent 7830dc1098
commit eda5d1a1ef
4 changed files with 20 additions and 9 deletions

View file

@ -106,6 +106,6 @@ class TerraRavagerLandCount implements DynamicValue {
@Override @Override
public String getMessage() { public String getMessage() {
return "land defending player controls"; return "the number of lands defending player controls";
} }
} }

View file

@ -55,7 +55,8 @@ public class DeathsShadow extends CardImpl {
this.toughness = new MageInt(13); this.toughness = new MageInt(13);
// Death's Shadow gets -X/-X, where X is your life total. // Death's Shadow gets -X/-X, where X is your life total.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(new SignInversionDynamicValue(new ControllerLifeCount()), new SignInversionDynamicValue(new ControllerLifeCount()), Duration.WhileOnBattlefield))); SignInversionDynamicValue x = new SignInversionDynamicValue(new ControllerLifeCount());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(x, x, Duration.WhileOnBattlefield)));
} }
public DeathsShadow(final DeathsShadow card) { public DeathsShadow(final DeathsShadow card) {

View file

@ -137,14 +137,24 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff
if (duration != Duration.WhileOnBattlefield) { if (duration != Duration.WhileOnBattlefield) {
sb.append(" ").append(duration.toString()); sb.append(" ").append(duration.toString());
} }
String message = power.getMessage(); String message = null;
if (message.length() == 0) { String fixedPart = null;
if (t.contains("X")) {
message = toughness.getMessage(); message = toughness.getMessage();
fixedPart = ", where X is ";
} else if (p.contains("X")) {
message = power.getMessage();
fixedPart = ", where X is ";
} else if (!power.getMessage().isEmpty()) {
message = power.getMessage();
fixedPart = " for each ";
} else if (!toughness.getMessage().isEmpty()) {
message = toughness.getMessage();
fixedPart = " for each ";
} }
if (message.length() > 0) { if (message != null && !message.isEmpty() && fixedPart != null) {
sb.append(" for each "); sb.append(fixedPart).append(message);
} }
sb.append(message);
staticText = sb.toString(); staticText = sb.toString();
} }

View file

@ -150,10 +150,10 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
} }
String message = null; String message = null;
String fixedPart = null; String fixedPart = null;
if (t.equals("X")) { if (t.contains("X")) {
message = toughness.getMessage(); message = toughness.getMessage();
fixedPart = ", where X is "; fixedPart = ", where X is ";
} else if (p.equals("X")) { } else if (p.contains("X")) {
message = power.getMessage(); message = power.getMessage();
fixedPart = ", where X is "; fixedPart = ", where X is ";
} else if (!power.getMessage().isEmpty()) { } else if (!power.getMessage().isEmpty()) {