Some bughunting: replaced expressions Zone.equals(String_literal) for those equals would return false always, and zone names should not be magic-strings.

This commit is contained in:
Maxmtg
2011-09-19 02:39:06 +00:00
parent e6094843f4
commit 8db13b6cd5
5 changed files with 58 additions and 60 deletions

View File

@@ -501,7 +501,7 @@ public class GameAction {
* @param libPosition a int. * @param libPosition a int.
* @return a {@link forge.Card} object. * @return a {@link forge.Card} object.
*/ */
public final Card moveTo(final String name, final Card c, final int libPosition) { public final Card moveTo(final Zone name, final Card c, final int libPosition) {
// Call specific functions to set PlayerZone, then move onto moveTo // Call specific functions to set PlayerZone, then move onto moveTo
if (name.equals(Constant.Zone.Hand)) { if (name.equals(Constant.Zone.Hand)) {
return moveToHand(c); return moveToHand(c);

View File

@@ -15,6 +15,7 @@ import forge.CombatUtil;
import forge.Command; import forge.Command;
import forge.ComputerUtil; import forge.ComputerUtil;
import forge.Constant; import forge.Constant;
import forge.Constant.Zone;
import forge.GameEntity; import forge.GameEntity;
import forge.MyRandom; import forge.MyRandom;
import forge.Player; import forge.Player;
@@ -159,7 +160,7 @@ public class AbilityFactory_Attach {
// TODO: If Attaching without casting, don't need to actually target. // TODO: If Attaching without casting, don't need to actually target.
// I believe this is the only case where mandatory will be true, so just check that when starting that work // I believe this is the only case where mandatory will be true, so just check that when starting that work
// But we shouldn't attach to things with Protection // But we shouldn't attach to things with Protection
if (tgt.getZone().equals("Battlefield") && !mandatory){ if (tgt.getZone().contains(Zone.Battlefield) && !mandatory){
list = list.getTargetableCards(attachSource); list = list.getTargetableCards(attachSource);
} }
else{ else{

View File

@@ -179,7 +179,7 @@ public final class AbilityFactory_ChangeZone {
} }
if (!(sa instanceof Ability_Sub)) { if (!(sa instanceof Ability_Sub)) {
if (origin.equals("Battlefield") || params.get("Destination").equals("Battlefield")) { if (origin.contains(Zone.Battlefield) || params.get("Destination").equals("Battlefield")) {
af.getHostCard().setSVar("PlayMain1", "TRUE"); af.getHostCard().setSVar("PlayMain1", "TRUE");
} }
} }
@@ -798,9 +798,9 @@ public final class AbilityFactory_ChangeZone {
c = basicManaFixing(fetchList, type); c = basicManaFixing(fetchList, type);
} else if (fetchList.getNotType("Creature").size() == 0) { } else if (fetchList.getNotType("Creature").size() == 0) {
c = CardFactoryUtil.AI_getBestCreature(fetchList); //if only creatures take the best c = CardFactoryUtil.AI_getBestCreature(fetchList); //if only creatures take the best
} else if ("Battlefield".equals(destination) || "Graveyard".equals(destination)) { } else if (Zone.Battlefield.equals(destination) || Zone.Graveyard.equals(destination)) {
c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false); c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false);
} else if ("Exile".equals(destination)) { } else if (Zone.Exile.equals(destination)) {
// Exiling your own stuff, if Exiling opponents stuff choose best // Exiling your own stuff, if Exiling opponents stuff choose best
if (destZone.getPlayer().isHuman()) { if (destZone.getPlayer().isHuman()) {
c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false); c = CardFactoryUtil.AI_getMostExpensivePermanent(fetchList, af.getHostCard(), false);
@@ -809,7 +809,7 @@ public final class AbilityFactory_ChangeZone {
} }
} else { } else {
//Don't fetch another tutor with the same name //Don't fetch another tutor with the same name
if (origin.contains("Library") && !fetchList.getNotName(card.getName()).isEmpty()) { if (origin.contains(Zone.Library) && !fetchList.getNotName(card.getName()).isEmpty()) {
fetchList = fetchList.getNotName(card.getName()); fetchList = fetchList.getNotName(card.getName());
} }
@@ -827,10 +827,10 @@ public final class AbilityFactory_ChangeZone {
for (Card c : fetched) { for (Card c : fetched) {
Card newCard = null; Card newCard = null;
if ("Library".equals(destination)) { if (Zone.Library.equals(destination)) {
int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0; int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
AllZone.getGameAction().moveToLibrary(c, libraryPos); AllZone.getGameAction().moveToLibrary(c, libraryPos);
} else if ("Battlefield".equals(destination)) { } else if (Zone.Battlefield.equals(destination)) {
if (params.containsKey("Tapped")) { if (params.containsKey("Tapped")) {
c.tap(); c.tap();
} }
@@ -862,7 +862,7 @@ public final class AbilityFactory_ChangeZone {
} }
} }
if (!"Battlefield".equals(destination) && !"Card".equals(type)) { if (!Zone.Battlefield.equals(destination) && !"Card".equals(type)) {
String picked = af.getHostCard().getName() + " - Computer picked:"; String picked = af.getHostCard().getName() + " - Computer picked:";
if (fetched.size() > 0) { if (fetched.size() > 0) {
GuiUtils.getChoice(picked, fetched.toArray()); GuiUtils.getChoice(picked, fetched.toArray());
@@ -970,7 +970,7 @@ public final class AbilityFactory_ChangeZone {
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
Zone origin = Zone.smartValueOf(params.get("Origin")); Zone origin = Zone.smartValueOf(params.get("Origin"));
String destination = params.get("Destination"); Zone destination = Zone.smartValueOf(params.get("Destination"));
float pct = origin.equals(Zone.Battlefield) ? .8f : .667f; float pct = origin.equals(Zone.Battlefield) ? .8f : .667f;
@@ -1029,8 +1029,8 @@ public final class AbilityFactory_ChangeZone {
} }
//only use blink or bounce effects //only use blink or bounce effects
if (!(destination.equals("Exile") && (subAPI.equals("DelayedTrigger") || subAPI.equals("ChangeZone"))) if (!(destination.equals(Zone.Exile) && (subAPI.equals("DelayedTrigger") || subAPI.equals("ChangeZone")))
&& !destination.equals("Hand")) && !destination.equals(Zone.Hand))
{ {
return false; return false;
} }
@@ -1085,7 +1085,7 @@ public final class AbilityFactory_ChangeZone {
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
Zone origin = Zone.smartValueOf(params.get("Origin")); Zone origin = Zone.smartValueOf(params.get("Origin"));
String destination = params.get("Destination"); Zone destination = Zone.smartValueOf(params.get("Destination"));
Target tgt = af.getAbTgt(); Target tgt = af.getAbTgt();
Ability_Sub abSub = sa.getSubAbility(); Ability_Sub abSub = sa.getSubAbility();
@@ -1156,13 +1156,13 @@ public final class AbilityFactory_ChangeZone {
} }
} }
} else if (origin.equals("Graveyard")) { } else if (origin.equals(Zone.Graveyard)) {
// Retrieve from Graveyard to: // Retrieve from Graveyard to:
} }
//blink human targets only during combat //blink human targets only during combat
if (origin.equals("Battlefield") && destination.equals("Exile") if (origin.equals(Zone.Battlefield) && destination.equals(Zone.Exile)
&& (subAPI.equals("DelayedTrigger") || (subAPI.equals("ChangeZone") && subAffected.equals("Remembered"))) && (subAPI.equals("DelayedTrigger") || (subAPI.equals("ChangeZone") && subAffected.equals("Remembered")))
&& !(AllZone.getPhase().is(Constant.Phase.Combat_Declare_Attackers_InstantAbility) || sa.isAbility())) && !(AllZone.getPhase().is(Constant.Phase.Combat_Declare_Attackers_InstantAbility) || sa.isAbility()))
{ {
@@ -1170,7 +1170,7 @@ public final class AbilityFactory_ChangeZone {
} }
// Exile and bounce opponents stuff // Exile and bounce opponents stuff
if (destination.equals("Exile") || origin.equals("Battlefield")) { if (destination.equals(Zone.Exile) || origin.equals(Zone.Battlefield)) {
list = list.getController(AllZone.getHumanPlayer()); list = list.getController(AllZone.getHumanPlayer());
} }
@@ -1194,10 +1194,10 @@ public final class AbilityFactory_ChangeZone {
if (!list.isEmpty()) { if (!list.isEmpty()) {
Card mostExpensive = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false); Card mostExpensive = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false);
if (destination.equals("Battlefield") || origin.equals("Battlefield")) { if (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield)) {
if (mostExpensive.isCreature()) { if (mostExpensive.isCreature()) {
//if a creature is most expensive take the best one //if a creature is most expensive take the best one
if (destination.equals("Exile")) { if (destination.equals(Zone.Exile)) {
// If Exiling things, don't give bonus to Tokens // If Exiling things, don't give bonus to Tokens
choice = CardFactoryUtil.AI_getBestCreature(list); choice = CardFactoryUtil.AI_getBestCreature(list);
} else { } else {
@@ -1249,7 +1249,7 @@ public final class AbilityFactory_ChangeZone {
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
Card source = sa.getSourceCard(); Card source = sa.getSourceCard();
Zone origin = Zone.smartValueOf(params.get("Origin")); Zone origin = Zone.smartValueOf(params.get("Origin"));
String destination = params.get("Destination"); Zone destination = Zone.smartValueOf(params.get("Destination"));
Target tgt = af.getAbTgt(); Target tgt = af.getAbTgt();
CardList list = AllZoneUtil.getCardsIn(origin); CardList list = AllZoneUtil.getCardsIn(origin);
@@ -1257,14 +1257,14 @@ public final class AbilityFactory_ChangeZone {
// Narrow down the list: // Narrow down the list:
if (origin.equals("Battlefield")) { if (origin.equals(Zone.Battlefield)) {
// filter out untargetables // filter out untargetables
list = list.getTargetableCards(source); list = list.getTargetableCards(source);
// if Destination is hand, either bounce opponents dangerous stuff or save my about to die stuff // if Destination is hand, either bounce opponents dangerous stuff or save my about to die stuff
// if Destination is exile, filter out my cards // if Destination is exile, filter out my cards
} else if (origin.equals("Graveyard")) { } else if (origin.equals(Zone.Graveyard)) {
// Retrieve from Graveyard to: // Retrieve from Graveyard to:
} }
@@ -1284,11 +1284,11 @@ public final class AbilityFactory_ChangeZone {
if (!list.isEmpty()) { if (!list.isEmpty()) {
if (CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false).isCreature() if (CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false).isCreature()
&& (destination.equals("Battlefield") || origin.equals("Battlefield"))) && (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield)))
{ {
//if a creature is most expensive take the best //if a creature is most expensive take the best
choice = CardFactoryUtil.AI_getBestCreatureToBounce(list); choice = CardFactoryUtil.AI_getBestCreatureToBounce(list);
} else if (destination.equals("Battlefield") || origin.equals("Battlefield")) { } else if (destination.equals(Zone.Battlefield) || origin.equals(Zone.Battlefield)) {
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false); choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false);
} else { } else {
// TODO AI needs more improvement to it's retrieval (reuse some code from spReturn here) // TODO AI needs more improvement to it's retrieval (reuse some code from spReturn here)
@@ -1365,7 +1365,7 @@ public final class AbilityFactory_ChangeZone {
sb.append(" "); sb.append(" ");
String destination = params.get("Destination"); Zone destination = Zone.smartValueOf(params.get("Destination"));
Zone origin = Zone.smartValueOf(params.get("Origin")); Zone origin = Zone.smartValueOf(params.get("Origin"));
StringBuilder sbTargets = new StringBuilder(); StringBuilder sbTargets = new StringBuilder();
@@ -1391,9 +1391,9 @@ public final class AbilityFactory_ChangeZone {
String fromGraveyard = " from the graveyard"; String fromGraveyard = " from the graveyard";
if (destination.equals("Battlefield")) { if (destination.equals(Zone.Battlefield)) {
sb.append("Put").append(targetname); sb.append("Put").append(targetname);
if (origin.equals("Graveyard")) { if (origin.equals(Zone.Graveyard)) {
sb.append(fromGraveyard); sb.append(fromGraveyard);
} }
@@ -1407,22 +1407,22 @@ public final class AbilityFactory_ChangeZone {
sb.append("."); sb.append(".");
} }
if (destination.equals("Hand")) { if (destination.equals(Zone.Hand)) {
sb.append("Return").append(targetname); sb.append("Return").append(targetname);
if (origin.equals("Graveyard")) { if (origin.equals(Zone.Graveyard)) {
sb.append(fromGraveyard); sb.append(fromGraveyard);
} }
sb.append(" to").append(pronoun).append("owners hand."); sb.append(" to").append(pronoun).append("owners hand.");
} }
if (destination.equals("Library")) { if (destination.equals(Zone.Library)) {
if (params.containsKey("Shuffle")) { // for things like Gaea's Blessing if (params.containsKey("Shuffle")) { // for things like Gaea's Blessing
sb.append("Shuffle").append(targetname); sb.append("Shuffle").append(targetname);
sb.append(" into").append(pronoun).append("owner's library."); sb.append(" into").append(pronoun).append("owner's library.");
} else { } else {
sb.append("Put").append(targetname); sb.append("Put").append(targetname);
if (origin.equals("Graveyard")) { if (origin.equals(Zone.Graveyard)) {
sb.append(fromGraveyard); sb.append(fromGraveyard);
} }
@@ -1440,15 +1440,15 @@ public final class AbilityFactory_ChangeZone {
} }
} }
if (destination.equals("Exile")) { if (destination.equals(Zone.Exile)) {
sb.append("Exile").append(targetname); sb.append("Exile").append(targetname);
if (origin.equals("Graveyard")) { if (origin.equals(Zone.Graveyard)) {
sb.append(fromGraveyard); sb.append(fromGraveyard);
} }
sb.append("."); sb.append(".");
} }
if (destination.equals("Graveyard")) { if (destination.equals(Zone.Graveyard)) {
sb.append("Put").append(targetname); sb.append("Put").append(targetname);
sb.append(" from ").append(origin); sb.append(" from ").append(origin);
sb.append(" into").append(pronoun).append("owner's graveyard."); sb.append(" into").append(pronoun).append("owner's graveyard.");
@@ -1502,7 +1502,7 @@ public final class AbilityFactory_ChangeZone {
continue; continue;
} }
if (tgt != null && origin.equals("Battlefield")) { if (tgt != null && origin.equals(Zone.Battlefield)) {
// check targeting // check targeting
if (!CardFactoryUtil.canTarget(sa.getSourceCard(), tgtC)) { if (!CardFactoryUtil.canTarget(sa.getSourceCard(), tgtC)) {
continue; continue;
@@ -1511,11 +1511,11 @@ public final class AbilityFactory_ChangeZone {
Card movedCard = null; Card movedCard = null;
Player pl = player; Player pl = player;
if (!destination.equals("Battlefield")) { if (!destination.equals(Zone.Battlefield)) {
pl = tgtC.getOwner(); pl = tgtC.getOwner();
} }
if (destination.equals("Library")) { if (destination.equals(Zone.Library)) {
// library position is zero indexed // library position is zero indexed
int libraryPosition = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0; int libraryPosition = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
@@ -1526,7 +1526,7 @@ public final class AbilityFactory_ChangeZone {
tgtC.getOwner().shuffle(); tgtC.getOwner().shuffle();
} }
} else { } else {
if (destination.equals("Battlefield")) { if (destination.equals(Zone.Battlefield)) {
if (params.containsKey("Tapped") || params.containsKey("Ninjutsu")) { if (params.containsKey("Tapped") || params.containsKey("Ninjutsu")) {
tgtC.tap(); tgtC.tap();
} }
@@ -1740,11 +1740,11 @@ public final class AbilityFactory_ChangeZone {
// TODO improve restrictions on when the AI would want to use this // TODO improve restrictions on when the AI would want to use this
// spBounceAll has some AI we can compare to. // spBounceAll has some AI we can compare to.
if (origin.equals("Hand")) { if (origin.equals(Zone.Hand)) {
} else if (origin.equals("Library")) { } else if (origin.equals(Zone.Library)) {
} else if (origin.equals("Battlefield")) { } else if (origin.equals(Zone.Battlefield)) {
// this statement is assuming the AI is trying to use this spell offensively // this statement is assuming the AI is trying to use this spell offensively
// if the AI is using it defensively, then something else needs to occur // if the AI is using it defensively, then something else needs to occur
// if only creatures are affected evaluate both lists and pass only if human creatures are more valuable // if only creatures are affected evaluate both lists and pass only if human creatures are more valuable
@@ -1759,7 +1759,7 @@ public final class AbilityFactory_ChangeZone {
if (AllZone.getPhase().is(Constant.Phase.Main1, AllZone.getComputerPlayer())) { if (AllZone.getPhase().is(Constant.Phase.Main1, AllZone.getComputerPlayer())) {
return false; return false;
} }
} else if (origin.equals("Graveyard")) { } else if (origin.equals(Zone.Graveyard)) {
Target tgt = af.getAbTgt(); Target tgt = af.getAbTgt();
if (tgt != null) { if (tgt != null) {
if (AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard).isEmpty()) { if (AllZone.getHumanPlayer().getCardsIn(Zone.Graveyard).isEmpty()) {
@@ -1768,17 +1768,14 @@ public final class AbilityFactory_ChangeZone {
tgt.resetTargets(); tgt.resetTargets();
tgt.addTarget(AllZone.getHumanPlayer()); tgt.addTarget(AllZone.getHumanPlayer());
} }
} else if (origin.equals("Exile")) { } else if (origin.equals(Zone.Exile)) {
} else if (origin.equals("Stack")) { } else if (origin.equals(Zone.Stack)) {
// time stop can do something like this: // time stop can do something like this:
// Origin$ Stack | Destination$ Exile | SubAbility$ DBSkip // Origin$ Stack | Destination$ Exile | SubAbility$ DBSkip
// DBSKipToPhase | DB$SkipToPhase | Phase$ Cleanup // DBSKipToPhase | DB$SkipToPhase | Phase$ Cleanup
// otherwise, this situation doesn't exist // otherwise, this situation doesn't exist
return false; return false;
} else if (origin.equals("Sideboard")) {
// This situation doesn't exist
return false;
} }
if (destination.equals(Constant.Zone.Battlefield)) { if (destination.equals(Constant.Zone.Battlefield)) {
@@ -1866,7 +1863,7 @@ public final class AbilityFactory_ChangeZone {
*/ */
private static void changeZoneAllResolve(final AbilityFactory af, final SpellAbility sa) { private static void changeZoneAllResolve(final AbilityFactory af, final SpellAbility sa) {
HashMap<String, String> params = af.getMapParams(); HashMap<String, String> params = af.getMapParams();
String destination = params.get("Destination"); Zone destination = Zone.smartValueOf(params.get("Destination"));
Zone origin = Zone.smartValueOf(params.get("Origin")); Zone origin = Zone.smartValueOf(params.get("Origin"));
CardList cards = null; CardList cards = null;
@@ -1897,7 +1894,7 @@ public final class AbilityFactory_ChangeZone {
// I don't know if library position is necessary. It's here if it is, just in case // I don't know if library position is necessary. It's here if it is, just in case
int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0; int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
for (Card c : cards) { for (Card c : cards) {
if (destination.equals("Battlefield")) { if (destination.equals(Zone.Battlefield)) {
// Auras without Candidates stay in their current location // Auras without Candidates stay in their current location
if (c.isAura()) { if (c.isAura()) {
SpellAbility saAura = AbilityFactory_Attach.getAttachSpellAbility(c); SpellAbility saAura = AbilityFactory_Attach.getAttachSpellAbility(c);

View File

@@ -376,10 +376,10 @@ public final class AbilityFactory_Reveal {
//let user get choice //let user get choice
Card chosen = null; Card chosen = null;
String prompt = "Choose a card to put into the "; String prompt = "Choose a card to put into the ";
if (destZone1.equals("Library") && libraryPosition == -1) { if (destZone1.equals(Zone.Library) && libraryPosition == -1) {
prompt = "Put the rest on the bottom of the "; prompt = "Put the rest on the bottom of the ";
} }
if (destZone1.equals("Library") && libraryPosition == 0) { if (destZone1.equals(Zone.Library) && libraryPosition == 0) {
prompt = "Put the rest on top of the "; prompt = "Put the rest on top of the ";
} }
if (anyNumber || optional) { if (anyNumber || optional) {
@@ -397,7 +397,7 @@ public final class AbilityFactory_Reveal {
AllZone.getGameAction().moveToLibrary(chosen, libraryPosition); AllZone.getGameAction().moveToLibrary(chosen, libraryPosition);
} else { } else {
Card c = AllZone.getGameAction().moveTo(zone, chosen); Card c = AllZone.getGameAction().moveTo(zone, chosen);
if (destZone1.equals("Battlefield") && !keywords.isEmpty()) { if (destZone1.equals(Zone.Battlefield) && !keywords.isEmpty()) {
for (String kw : keywords) { for (String kw : keywords) {
c.addExtrinsicKeyword(kw); c.addExtrinsicKeyword(kw);
} }
@@ -422,7 +422,7 @@ public final class AbilityFactory_Reveal {
AllZone.getGameAction().moveToLibrary(chosen, libraryPosition); AllZone.getGameAction().moveToLibrary(chosen, libraryPosition);
} else { } else {
AllZone.getGameAction().moveTo(zone, chosen); AllZone.getGameAction().moveTo(zone, chosen);
if (destZone1.equals("Battlefield") && !keywords.isEmpty()) { if (destZone1.equals(Zone.Battlefield) && !keywords.isEmpty()) {
for (String kw : keywords) { for (String kw : keywords) {
chosen.addExtrinsicKeyword(kw); chosen.addExtrinsicKeyword(kw);
} }
@@ -445,7 +445,7 @@ public final class AbilityFactory_Reveal {
} }
//now, move the rest to destZone2 //now, move the rest to destZone2
if (destZone2.equals("Library")) { if (destZone2.equals(Zone.Library)) {
if (player.isHuman()) { if (player.isHuman()) {
//put them in any order //put them in any order
while (rest.size() > 0) { while (rest.size() > 0) {
@@ -473,7 +473,7 @@ public final class AbilityFactory_Reveal {
Card c = rest.get(i); Card c = rest.get(i);
PlayerZone toZone = c.getOwner().getZone(destZone2); PlayerZone toZone = c.getOwner().getZone(destZone2);
c = AllZone.getGameAction().moveTo(toZone, c); c = AllZone.getGameAction().moveTo(toZone, c);
if (destZone2.equals("Battlefield") && !keywords.isEmpty()) { if (destZone2.equals(Zone.Battlefield) && !keywords.isEmpty()) {
for (String kw : keywords) { for (String kw : keywords) {
c.addExtrinsicKeyword(kw); c.addExtrinsicKeyword(kw);
} }
@@ -793,9 +793,9 @@ public final class AbilityFactory_Reveal {
tgtPlayers = AbilityFactory.getDefinedPlayers(host, params.get("Defined"), sa); tgtPlayers = AbilityFactory.getDefinedPlayers(host, params.get("Defined"), sa);
} }
String foundDest = params.get("FoundDestination"); Zone foundDest = Zone.smartValueOf(params.get("FoundDestination"));
int foundLibPos = AbilityFactory.calculateAmount(host, params.get("FoundLibraryPosition"), sa); int foundLibPos = AbilityFactory.calculateAmount(host, params.get("FoundLibraryPosition"), sa);
String revealedDest = params.get("RevealedDestination"); Zone revealedDest = Zone.smartValueOf(params.get("RevealedDestination"));
int revealedLibPos = AbilityFactory.calculateAmount(host, params.get("RevealedLibraryPosition"), sa); int revealedLibPos = AbilityFactory.calculateAmount(host, params.get("RevealedLibraryPosition"), sa);
for (Player p : tgtPlayers) { for (Player p : tgtPlayers) {

View File

@@ -46,13 +46,13 @@ public class CostExile extends CostPartWithList {
if (getThis()) { if (getThis()) {
sb.append(type); sb.append(type);
if (!from.equals("Battlefield")){ if (!from.equals(Zone.Battlefield)){
sb.append(" from your ").append(from); sb.append(" from your ").append(from);
} }
return sb.toString(); return sb.toString();
} }
if (from.equals("Battlefield")){ if (from.equals(Zone.Battlefield)){
String desc = typeDescription == null ? type : typeDescription; String desc = typeDescription == null ? type : typeDescription;
sb.append(Cost.convertAmountTypeToWords(i, amount, desc)); sb.append(Cost.convertAmountTypeToWords(i, amount, desc));