added support for StackDescription to Token and AlterLife AFs

This commit is contained in:
ArsenalNut
2012-02-06 08:22:26 +00:00
parent 832dd47f60
commit ba7515e8f5
2 changed files with 44 additions and 32 deletions

View File

@@ -219,26 +219,31 @@ public class AbilityFactoryAlterLife {
sb.append(" "); sb.append(" ");
} }
final String conditionDesc = params.get("ConditionDescription"); if (params.containsKey("StackDescription")) {
if (conditionDesc != null) { sb.append(params.get("StackDescription"));
sb.append(conditionDesc).append(" ");
} }
else {
final String conditionDesc = params.get("ConditionDescription");
if (conditionDesc != null) {
sb.append(conditionDesc).append(" ");
}
ArrayList<Player> tgtPlayers; ArrayList<Player> tgtPlayers;
final Target tgt = sa.getTarget(); final Target tgt = sa.getTarget();
if (tgt != null) { if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers(); tgtPlayers = tgt.getTargetPlayers();
} else { } else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa); tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
}
for (final Player player : tgtPlayers) {
sb.append(player).append(" ");
}
sb.append("gains ").append(amount).append(" life.");
} }
for (final Player player : tgtPlayers) {
sb.append(player).append(" ");
}
sb.append("gains ").append(amount).append(" life.");
final AbilitySub abSub = sa.getSubAbility(); final AbilitySub abSub = sa.getSubAbility();
if (abSub != null) { if (abSub != null) {
sb.append(abSub.getStackDescription()); sb.append(abSub.getStackDescription());

View File

@@ -413,16 +413,10 @@ public class AbilityFactoryToken extends AbilityFactory {
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
private String doStackDescription(final SpellAbility sa) { private String doStackDescription(final SpellAbility sa) {
final Card host = this.abilityFactory.getHostCard();
final int finalPower = AbilityFactory.calculateAmount(this.abilityFactory.getHostCard(), this.tokenPower, sa);
final int finalToughness = AbilityFactory.calculateAmount(this.abilityFactory.getHostCard(),
this.tokenToughness, sa);
final int finalAmount = AbilityFactory.calculateAmount(this.abilityFactory.getHostCard(), this.tokenAmount, sa);
final String substitutedName = this.tokenName.equals("ChosenType") ? host.getChosenType() : this.tokenName;
final HashMap<String, String> params = this.abilityFactory.getMapParams();
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
final Card host = this.abilityFactory.getHostCard();
if (sa instanceof AbilitySub) { if (sa instanceof AbilitySub) {
sb.append(" "); sb.append(" ");
@@ -430,17 +424,30 @@ public class AbilityFactoryToken extends AbilityFactory {
sb.append(host.getName()).append(" - "); sb.append(host.getName()).append(" - ");
} }
sb.append("Put (").append(finalAmount).append(") ").append(finalPower).append("/").append(finalToughness); if (params.containsKey("StackDescription")) {
sb.append(" ").append(substitutedName).append(" token"); sb.append(params.get("StackDescription"));
if (finalAmount != 1) {
sb.append("s");
} }
sb.append(" onto the battlefield"); else {
if (this.tokenOwner.equals("Opponent")) { final int finalPower = AbilityFactory.calculateAmount(this.abilityFactory.getHostCard(), this.tokenPower, sa);
sb.append(" under your opponent's control."); final int finalToughness = AbilityFactory.calculateAmount(this.abilityFactory.getHostCard(),
} else { this.tokenToughness, sa);
sb.append("."); final int finalAmount = AbilityFactory.calculateAmount(this.abilityFactory.getHostCard(), this.tokenAmount, sa);
final String substitutedName = this.tokenName.equals("ChosenType") ? host.getChosenType() : this.tokenName;
sb.append("Put (").append(finalAmount).append(") ").append(finalPower).append("/").append(finalToughness);
sb.append(" ").append(substitutedName).append(" token");
if (finalAmount != 1) {
sb.append("s");
}
sb.append(" onto the battlefield");
if (this.tokenOwner.equals("Opponent")) {
sb.append(" under your opponent's control.");
} else {
sb.append(".");
}
} }
if (sa.getSubAbility() != null) { if (sa.getSubAbility() != null) {