- Improved stack description for hidden origin ChangeZone abilities. Probably still room for improvement, but it should be way better than it was.

This commit is contained in:
moomarc
2013-04-02 13:55:33 +00:00
parent 397d2ce3cd
commit f7a5217d69

View File

@@ -64,10 +64,51 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
final Card host = sa.getSourceCard(); final Card host = sa.getSourceCard();
if (!(sa instanceof AbilitySub)) { if (!(sa instanceof AbilitySub)) {
sb.append(host.getName()).append(" -"); sb.append(" -");
} }
sb.append(" "); sb.append(" ");
// Player whose cards will change zones
List<Player> fetchers = new ArrayList<Player>();
if (sa.hasParam("DefinedPlayer")) {
fetchers = AbilityUtils.getDefinedPlayers(sa.getSourceCard(), sa.getParam("DefinedPlayer"), sa);
}
if (fetchers.isEmpty() && sa.hasParam("ValidTgts") && sa.getTarget() != null) {
fetchers = sa.getTarget().getTargetPlayers();
}
if (fetchers.isEmpty()) {
fetchers.add(sa.getSourceCard().getController());
}
final StringBuilder fetcherSB = new StringBuilder();
for (int i = 0; i < fetchers.size(); i++) {
fetcherSB.append(fetchers.get(i).getName());
fetcherSB.append((i + 2) == fetchers.size() ? " and " : (i + 1) == fetchers.size() ? "" : ", ");
}
final String fetcherNames = fetcherSB.toString();
// Player who chooses the cards to move
List<Player> choosers = new ArrayList<Player>();
if (sa.hasParam("Chooser")) {
choosers = AbilityUtils.getDefinedPlayers(sa.getSourceCard(), sa.getParam("Chooser"), sa);
}
if (choosers.isEmpty()) {
choosers.add(sa.getActivatingPlayer());
}
final StringBuilder chooserSB = new StringBuilder();
for (int i = 0; i < choosers.size(); i++) {
chooserSB.append(choosers.get(i).getName());
chooserSB.append((i + 2) == choosers.size() ? " and " : (i + 1) == choosers.size() ? "" : ", ");
}
final String chooserNames = chooserSB.toString();
String fetchPlayer = fetcherNames;
if (chooserNames.equals(fetcherNames)) {
fetchPlayer = fetchers.size() > 1 ? "their" : "his/her";
}
String origin = ""; String origin = "";
if (sa.hasParam("Origin")) { if (sa.hasParam("Origin")) {
origin = sa.getParam("Origin"); origin = sa.getParam("Origin");
@@ -91,12 +132,22 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
} }
sb.append("."); sb.append(".");
} else if (origin.equals("Library")) { } else if (origin.equals("Library")) {
sb.append("Search your library for ").append(num).append(" ").append(type).append(" and "); sb.append(chooserNames);
sb.append(" search").append(choosers.size() > 1 ? " " : "es ");
sb.append(fetchPlayer);
sb.append("'s library for ").append(num).append(" ").append(type).append(" and ");
if (destination.equals("Exile")) {
if (num == 1) { if (num == 1) {
sb.append("put that card "); sb.append("exiles that card ");
} else { } else {
sb.append("put those cards "); sb.append("exiles those cards ");
}
} else {
if (num == 1) {
sb.append("puts that card ");
} else {
sb.append("puts those cards ");
} }
if (destination.equals("Battlefield")) { if (destination.equals("Battlefield")) {
@@ -104,23 +155,41 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (sa.hasParam("Tapped")) { if (sa.hasParam("Tapped")) {
sb.append(" tapped"); sb.append(" tapped");
} }
if (sa.hasParam("GainControl")) {
sb.append(" under ").append(chooserNames).append("'s control");
}
sb.append("."); sb.append(".");
} }
if (destination.equals("Hand")) { if (destination.equals("Hand")) {
sb.append("into your hand."); sb.append("into its owner's hand.");
} }
if (destination.equals("Graveyard")) { if (destination.equals("Graveyard")) {
sb.append("into your graveyard."); sb.append("into its owners's graveyard.");
}
}
sb.append(" Then shuffle that library.");
} else if (origin.equals("Hand")) {
sb.append(chooserNames);
if (!chooserNames.equals(fetcherNames)) {
sb.append(" looks at " + fetcherNames + "'s hand and ");
sb.append(destination.equals("Exile") ? "exiles " : "puts ");
sb.append(num).append(" of those ").append(type).append(" card(s)");
} else {
sb.append(destination.equals("Exile") ? " exiles " : " puts ");
sb.append(num).append(" ").append(type).append(" card(s) from");
sb.append(fetchPlayer).append(" hand");
} }
sb.append(" Then shuffle your library.");
} else if (origin.equals("Hand")) {
sb.append("Put ").append(num).append(" ").append(type).append(" card(s) from your hand ");
if (destination.equals("Battlefield")) { if (destination.equals("Battlefield")) {
sb.append("onto the battlefield."); sb.append(" onto the battlefield");
if (sa.hasParam("Tapped")) {
sb.append(" tapped");
}
if (sa.hasParam("GainControl")) {
sb.append(" under ").append(chooserNames).append("'s control");
}
} }
if (destination.equals("Library")) { if (destination.equals("Library")) {
final int libraryPos = sa.hasParam("LibraryPosition") ? Integer.parseInt(sa.getParam("LibraryPosition")) : 0; final int libraryPos = sa.hasParam("LibraryPosition") ? Integer.parseInt(sa.getParam("LibraryPosition")) : 0;
@@ -129,11 +198,13 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
sb.append(" on top"); sb.append(" on top");
} }
if (libraryPos == -1) { if (libraryPos == -1) {
sb.append("on bottom"); sb.append(" on the bottom");
} }
sb.append(" of your library."); sb.append(" of ").append(fetchPlayer).append("'s library");
} }
sb.append(".");
} else if (origin.equals("Battlefield")) { } else if (origin.equals("Battlefield")) {
// TODO Expand on this Description as more cards use it // TODO Expand on this Description as more cards use it
// for the non-targeted SAs when you choose what is returned on // for the non-targeted SAs when you choose what is returned on