Some changes to rule text generation, minor format changes.

This commit is contained in:
LevelX2 2013-01-06 11:19:01 +01:00
parent 11e2df7a86
commit 2e31aacfaf
8 changed files with 54 additions and 23 deletions

View file

@ -44,6 +44,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import java.util.UUID; import java.util.UUID;
import mage.filter.common.FilterControlledCreaturePermanent;
/** /**
* *
@ -70,7 +71,7 @@ public class CraterhoofBehemoth extends CardImpl<CraterhoofBehemoth> {
// When Craterhoof Behemoth enters the battlefield, creatures you control gain trample and get +X/+X until end of turn, where X is the number of creatures you control. // When Craterhoof Behemoth enters the battlefield, creatures you control gain trample and get +X/+X until end of turn, where X is the number of creatures you control.
Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, filter)); Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, filter));
PermanentsOnBattlefieldCount controlledCreatures = new PermanentsOnBattlefieldCount(filter); PermanentsOnBattlefieldCount controlledCreatures = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("the number of creatures you control"), null);
ability.addEffect(new BoostControlledEffect(controlledCreatures, controlledCreatures, Duration.EndOfTurn, filter, false, true)); ability.addEffect(new BoostControlledEffect(controlledCreatures, controlledCreatures, Duration.EndOfTurn, filter, false, true));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -45,7 +45,7 @@ import mage.target.common.TargetCreaturePermanent;
* @author Loki * @author Loki
*/ */
public class StrengthOfCedars extends CardImpl<StrengthOfCedars> { public class StrengthOfCedars extends CardImpl<StrengthOfCedars> {
private final static FilterControlledPermanent filter = new FilterControlledLandPermanent("lands you control"); private final static FilterControlledPermanent filter = new FilterControlledLandPermanent("the number of lands you control");
public StrengthOfCedars (UUID ownerId) { public StrengthOfCedars (UUID ownerId) {
super(ownerId, 245, "Strength of Cedars", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{G}"); super(ownerId, 245, "Strength of Cedars", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{G}");
@ -54,7 +54,7 @@ public class StrengthOfCedars extends CardImpl<StrengthOfCedars> {
this.color.setGreen(true); this.color.setGreen(true);
// Target creature gets +X/+X until end of turn, where X is the number of lands you control. // Target creature gets +X/+X until end of turn, where X is the number of lands you control.
DynamicValue controlledLands = new PermanentsOnBattlefieldCount(filter); DynamicValue controlledLands = new PermanentsOnBattlefieldCount(filter, null);
this.getSpellAbility().addEffect(new BoostTargetEffect(controlledLands, controlledLands, Duration.EndOfTurn, true)); this.getSpellAbility().addEffect(new BoostTargetEffect(controlledLands, controlledLands, Duration.EndOfTurn, true));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }

View file

@ -33,16 +33,21 @@ public class DomainValue implements DynamicValue {
int haveForests = 0; int haveForests = 0;
for (Permanent p : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { for (Permanent p : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
if (p.getCardType().contains(Constants.CardType.LAND)) { if (p.getCardType().contains(Constants.CardType.LAND)) {
if (havePlains == 0 && p.getSubtype().contains("Plains")) if (havePlains == 0 && p.getSubtype().contains("Plains")) {
havePlains = 1; havePlains = 1;
if (haveIslands == 0 && p.getSubtype().contains("Island")) }
if (haveIslands == 0 && p.getSubtype().contains("Island")) {
haveIslands = 1; haveIslands = 1;
if (haveMountains == 0 && p.getSubtype().contains("Mountain")) }
if (haveMountains == 0 && p.getSubtype().contains("Mountain")) {
haveMountains = 1; haveMountains = 1;
if (haveSwamps == 0 && p.getSubtype().contains("Swamp")) }
if (haveSwamps == 0 && p.getSubtype().contains("Swamp")) {
haveSwamps = 1; haveSwamps = 1;
if (haveForests == 0 && p.getSubtype().contains("Forest")) }
if (haveForests == 0 && p.getSubtype().contains("Forest")) {
haveForests = 1; haveForests = 1;
}
} }
} }
return amount * (haveForests + haveIslands + haveMountains + havePlains + haveSwamps); return amount * (haveForests + haveIslands + haveMountains + havePlains + haveSwamps);
@ -64,6 +69,6 @@ public class DomainValue implements DynamicValue {
@Override @Override
public String getMessage() { public String getMessage() {
return "each basic land type among lands you control"; return "basic land type among lands you control";
} }
} }

View file

@ -34,7 +34,11 @@ public class PermanentsOnBattlefieldCount implements DynamicValue {
@Override @Override
public int calculate(Game game, Ability sourceAbility) { public int calculate(Game game, Ability sourceAbility) {
return amount * game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); int value = game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
if (amount != null) {
value *= amount;
}
return value;
} }
@Override @Override
@ -47,7 +51,7 @@ public class PermanentsOnBattlefieldCount implements DynamicValue {
if (amount != null) { if (amount != null) {
return amount.toString(); return amount.toString();
} }
return ""; return "X";
} }
@Override @Override

View file

@ -16,9 +16,9 @@ public class SourcePermanentPowerCount implements DynamicValue {
if (sourcePermanent == null) { if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Constants.Zone.BATTLEFIELD); sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Constants.Zone.BATTLEFIELD);
} }
if (sourcePermanent != null) if (sourcePermanent != null) {
return sourcePermanent.getPower().getValue(); return sourcePermanent.getPower().getValue();
}
return 0; return 0;
} }
@ -32,9 +32,8 @@ public class SourcePermanentPowerCount implements DynamicValue {
return "X"; return "X";
} }
@Override @Override
public String getMessage() { public String getMessage() {
return "point of power that {source} had"; return "{source}'s power";
} }
} }

View file

@ -59,11 +59,11 @@ public class TargetPermanentPowerCount implements DynamicValue {
@Override @Override
public String toString() { public String toString() {
return "1"; return "X";
} }
@Override @Override
public String getMessage() { public String getMessage() {
return "point of power it has"; return "its power";
} }
} }

View file

@ -133,12 +133,13 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
} }
private void setText() { private void setText() {
String message = null;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (excludeSource) { if (excludeSource) {
sb.append("Other "); sb.append("each other ");
} }
sb.append(filter.getMessage()); sb.append(filter.getMessage());
sb.append(" you control get "); sb.append(" you control gets ");
String p = power.toString(); String p = power.toString();
if(!p.startsWith("-")) { if(!p.startsWith("-")) {
@ -156,6 +157,14 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
sb.append(t); sb.append(t);
sb.append((duration==Duration.EndOfTurn?" until end of turn":"")); sb.append((duration==Duration.EndOfTurn?" until end of turn":""));
if (t.equals("X")) {
message = toughness.getMessage();
} else if (p.equals("X")) {
message = power.getMessage();
}
if (message != null && !message.isEmpty()) {
sb.append(", where X is ").append(message);
}
staticText = sb.toString(); staticText = sb.toString();
} }

View file

@ -133,11 +133,24 @@ public class BoostTargetEffect extends ContinuousEffectImpl<BoostTargetEffect> {
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;
sb.append(" for each "); if (t.equals("X")) {
message = toughness.getMessage();
fixedPart = ", where X is ";
} else if (p.equals("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 != null && fixedPart != null) {
sb.append(fixedPart).append(message);
} }
sb.append(message);
return sb.toString(); return sb.toString();
} }
} }