mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Some changes to rule text generation, minor format changes.
This commit is contained in:
parent
11e2df7a86
commit
2e31aacfaf
8 changed files with 54 additions and 23 deletions
|
@ -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<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.
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
* @author Loki
|
||||
*/
|
||||
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) {
|
||||
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);
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,12 +133,13 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
|
|||
}
|
||||
|
||||
private void setText() {
|
||||
String message = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (excludeSource) {
|
||||
sb.append("Other ");
|
||||
sb.append("each other ");
|
||||
}
|
||||
sb.append(filter.getMessage());
|
||||
sb.append(" you control get ");
|
||||
sb.append(" you control gets ");
|
||||
|
||||
String p = power.toString();
|
||||
if(!p.startsWith("-")) {
|
||||
|
@ -156,6 +157,14 @@ public class BoostControlledEffect extends ContinuousEffectImpl<BoostControlledE
|
|||
sb.append(t);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -133,11 +133,24 @@ public class BoostTargetEffect extends ContinuousEffectImpl<BoostTargetEffect> {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue