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(" ");
}
final String conditionDesc = params.get("ConditionDescription");
if (conditionDesc != null) {
sb.append(conditionDesc).append(" ");
if (params.containsKey("StackDescription")) {
sb.append(params.get("StackDescription"));
}
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();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
final Target tgt = sa.getTarget();
if (tgt != null) {
tgtPlayers = tgt.getTargetPlayers();
} else {
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();
if (abSub != null) {
sb.append(abSub.getStackDescription());

View File

@@ -413,16 +413,10 @@ public class AbilityFactoryToken extends AbilityFactory {
* @return a {@link java.lang.String} object.
*/
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 Card host = this.abilityFactory.getHostCard();
if (sa instanceof AbilitySub) {
sb.append(" ");
@@ -430,17 +424,30 @@ public class AbilityFactoryToken extends AbilityFactory {
sb.append(host.getName()).append(" - ");
}
sb.append("Put (").append(finalAmount).append(") ").append(finalPower).append("/").append(finalToughness);
sb.append(" ").append(substitutedName).append(" token");
if (finalAmount != 1) {
sb.append("s");
if (params.containsKey("StackDescription")) {
sb.append(params.get("StackDescription"));
}
sb.append(" onto the battlefield");
else {
if (this.tokenOwner.equals("Opponent")) {
sb.append(" under your opponent's control.");
} else {
sb.append(".");
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;
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) {