mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Improved text generation for CreateTokenEffect
This commit is contained in:
parent
bee9d63dec
commit
255f839397
5 changed files with 14 additions and 28 deletions
|
@ -53,8 +53,10 @@ public class EndlessRanksOfTheDead extends CardImpl<EndlessRanksOfTheDead> {
|
|||
|
||||
this.color.setBlack(true);
|
||||
|
||||
// At the beginning of your upkeep, put X 2/2 black Zombie creature tokens onto the battlefield, where X is half the number of Zombies you control, rounded down.
|
||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new CreateTokenEffect(new ZombieToken(), HalfZombiesCount.getInstance())));
|
||||
// At the beginning of your upkeep, put X 2/2 black Zombie creature tokens onto the battlefield,
|
||||
// where X is half the number of Zombies you control, rounded down.
|
||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep",
|
||||
new CreateTokenEffect(new ZombieToken(), new HalfZombiesCount())));
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,20 +72,12 @@ public class EndlessRanksOfTheDead extends CardImpl<EndlessRanksOfTheDead> {
|
|||
|
||||
class HalfZombiesCount implements DynamicValue {
|
||||
|
||||
private static HalfZombiesCount instance;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Zombie"));
|
||||
}
|
||||
|
||||
public static HalfZombiesCount getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new HalfZombiesCount();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2;
|
||||
|
@ -92,12 +86,12 @@ class HalfZombiesCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public DynamicValue clone() {
|
||||
return getInstance();
|
||||
return new HalfZombiesCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
return "X";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -116,8 +116,9 @@ class FreshMeatDynamicValue implements DynamicValue {
|
|||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
FreshMeatWatcher watcher = (FreshMeatWatcher) game.getState().getWatchers().get("YourCreaturesDied", sourceAbility.getControllerId());
|
||||
if (watcher != null)
|
||||
if (watcher != null) {
|
||||
return watcher.getCreaturesCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -133,6 +134,6 @@ class FreshMeatDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "for each creature put into your graveyard from the battlefield this turn";
|
||||
return "creature put into your graveyard from the battlefield this turn";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class PhyrexianSwarmlord extends CardImpl<PhyrexianSwarmlord> {
|
|||
|
||||
this.addAbility(InfectAbility.getInstance());
|
||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep",
|
||||
new CreateTokenEffect(new InsectInfectToken(), OpponentsPoisonCountersCount.getInstance())));
|
||||
new CreateTokenEffect(new InsectInfectToken(), new OpponentsPoisonCountersCount())));
|
||||
}
|
||||
|
||||
public PhyrexianSwarmlord(final PhyrexianSwarmlord card) {
|
||||
|
@ -77,15 +77,6 @@ public class PhyrexianSwarmlord extends CardImpl<PhyrexianSwarmlord> {
|
|||
|
||||
class OpponentsPoisonCountersCount implements DynamicValue {
|
||||
|
||||
private static OpponentsPoisonCountersCount instance;
|
||||
|
||||
public static OpponentsPoisonCountersCount getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new OpponentsPoisonCountersCount();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
int amount = 0;
|
||||
|
@ -101,7 +92,7 @@ class OpponentsPoisonCountersCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public DynamicValue clone() {
|
||||
return getInstance();
|
||||
return new OpponentsPoisonCountersCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,6 +27,6 @@ public class ControllerLifeCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class CreateTokenEffect extends OneShotEffect<CreateTokenEffect> {
|
|||
sb.append(" onto the battlefield");
|
||||
String message = amount.getMessage();
|
||||
if (message.length() > 0) {
|
||||
if (message.startsWith("the ") || message.contains("number ")) {
|
||||
if (amount.toString().equals("X")) {
|
||||
sb.append(", where X is ");
|
||||
} else {
|
||||
sb.append(" for each ");
|
||||
|
|
Loading…
Reference in a new issue