From 2e31aacfafae336017ed42018e7774e2fbba0c8b Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 6 Jan 2013 11:19:01 +0100 Subject: [PATCH] Some changes to rule text generation, minor format changes. --- .../avacynrestored/CraterhoofBehemoth.java | 3 ++- .../championsofkamigawa/StrengthOfCedars.java | 4 ++-- .../dynamicvalue/common/DomainValue.java | 17 +++++++++------ .../common/PermanentsOnBattlefieldCount.java | 8 +++++-- .../common/SourcePermanentPowerCount.java | 7 +++---- .../common/TargetPermanentPowerCount.java | 4 ++-- .../continious/BoostControlledEffect.java | 13 ++++++++++-- .../common/continious/BoostTargetEffect.java | 21 +++++++++++++++---- 8 files changed, 54 insertions(+), 23 deletions(-) diff --git a/Mage.Sets/src/mage/sets/avacynrestored/CraterhoofBehemoth.java b/Mage.Sets/src/mage/sets/avacynrestored/CraterhoofBehemoth.java index 09af21350b..d18eb668a8 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/CraterhoofBehemoth.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/CraterhoofBehemoth.java @@ -44,6 +44,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import java.util.UUID; +import mage.filter.common.FilterControlledCreaturePermanent; /** * @@ -70,7 +71,7 @@ public class CraterhoofBehemoth extends CardImpl { // 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)); - 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)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/StrengthOfCedars.java b/Mage.Sets/src/mage/sets/championsofkamigawa/StrengthOfCedars.java index 5568042f49..4531d58b35 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/StrengthOfCedars.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/StrengthOfCedars.java @@ -45,7 +45,7 @@ import mage.target.common.TargetCreaturePermanent; * @author Loki */ public class StrengthOfCedars extends CardImpl { - 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) { super(ownerId, 245, "Strength of Cedars", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{G}"); @@ -54,7 +54,7 @@ public class StrengthOfCedars extends CardImpl { this.color.setGreen(true); // 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().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java index 20c5df35f3..31db6109ba 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java @@ -33,16 +33,21 @@ public class DomainValue implements DynamicValue { int haveForests = 0; for (Permanent p : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { if (p.getCardType().contains(Constants.CardType.LAND)) { - if (havePlains == 0 && p.getSubtype().contains("Plains")) + if (havePlains == 0 && p.getSubtype().contains("Plains")) { havePlains = 1; - if (haveIslands == 0 && p.getSubtype().contains("Island")) + } + if (haveIslands == 0 && p.getSubtype().contains("Island")) { haveIslands = 1; - if (haveMountains == 0 && p.getSubtype().contains("Mountain")) + } + if (haveMountains == 0 && p.getSubtype().contains("Mountain")) { haveMountains = 1; - if (haveSwamps == 0 && p.getSubtype().contains("Swamp")) + } + if (haveSwamps == 0 && p.getSubtype().contains("Swamp")) { haveSwamps = 1; - if (haveForests == 0 && p.getSubtype().contains("Forest")) + } + if (haveForests == 0 && p.getSubtype().contains("Forest")) { haveForests = 1; + } } } return amount * (haveForests + haveIslands + haveMountains + havePlains + haveSwamps); @@ -64,6 +69,6 @@ public class DomainValue implements DynamicValue { @Override public String getMessage() { - return "each basic land type among lands you control"; + return "basic land type among lands you control"; } } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java index 18bbcf44c5..1144a69a30 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java @@ -34,7 +34,11 @@ public class PermanentsOnBattlefieldCount implements DynamicValue { @Override 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 @@ -47,7 +51,7 @@ public class PermanentsOnBattlefieldCount implements DynamicValue { if (amount != null) { return amount.toString(); } - return ""; + return "X"; } @Override diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java index b8b35f33a3..116842949c 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java @@ -16,9 +16,9 @@ public class SourcePermanentPowerCount implements DynamicValue { if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Constants.Zone.BATTLEFIELD); } - if (sourcePermanent != null) + if (sourcePermanent != null) { return sourcePermanent.getPower().getValue(); - + } return 0; } @@ -32,9 +32,8 @@ public class SourcePermanentPowerCount implements DynamicValue { return "X"; } - @Override public String getMessage() { - return "point of power that {source} had"; + return "{source}'s power"; } } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java index cfde5c69ca..00c8bfd8dc 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java @@ -59,11 +59,11 @@ public class TargetPermanentPowerCount implements DynamicValue { @Override public String toString() { - return "1"; + return "X"; } @Override public String getMessage() { - return "point of power it has"; + return "its power"; } } diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java index a716b94a67..9d8847b87d 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java @@ -133,12 +133,13 @@ public class BoostControlledEffect extends ContinuousEffectImpl { if (duration != Duration.WhileOnBattlefield) { sb.append(" ").append(duration.toString()); } - String message = power.getMessage(); - if (message.length() > 0) { - sb.append(" for each "); + String message = null; + String fixedPart = null; + 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(); } }