- Fixed r23523 LibraryPosition

This commit is contained in:
swordshine
2013-10-21 02:56:07 +00:00
parent fb7a61ab30
commit d0173a2341
2 changed files with 4 additions and 5 deletions

View File

@@ -23,7 +23,6 @@ import forge.card.ability.AbilityUtils;
import forge.card.ability.ApiType; import forge.card.ability.ApiType;
import forge.card.ability.SpellAbilityAi; import forge.card.ability.SpellAbilityAi;
import forge.card.ability.effects.AttachEffect; import forge.card.ability.effects.AttachEffect;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.cost.Cost; import forge.card.cost.Cost;
import forge.card.cost.CostDiscard; import forge.card.cost.CostDiscard;
import forge.card.cost.CostPart; import forge.card.cost.CostPart;
@@ -1315,7 +1314,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
for (final Card c : fetched) { for (final Card c : fetched) {
Card movedCard = null; Card movedCard = null;
if (ZoneType.Library.equals(destination)) { if (ZoneType.Library.equals(destination)) {
final int libraryPos = sa.hasParam("LibraryPosition") ? CardFactoryUtil.xCount(source, source.getSVar(sa.getParam("LibraryPosition"))) : 0; final int libraryPos = sa.hasParam("LibraryPosition") ? AbilityUtils.calculateAmount(source, sa.getParam("LibraryPosition"), sa) : 0;
movedCard = game.getAction().moveToLibrary(c, libraryPos); movedCard = game.getAction().moveToLibrary(c, libraryPos);
} else if (ZoneType.Battlefield.equals(destination)) { } else if (ZoneType.Battlefield.equals(destination)) {
if (sa.hasParam("Tapped")) { if (sa.hasParam("Tapped")) {

View File

@@ -193,7 +193,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
} }
} }
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") ? AbilityUtils.calculateAmount(host, sa.getParam("LibraryPosition"), sa) : 0;
if (libraryPos == 0) { if (libraryPos == 0) {
sb.append(" on top"); sb.append(" on top");
@@ -300,7 +300,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
// this needs to be zero indexed. Top = 0, Third = 2, -1 = // this needs to be zero indexed. Top = 0, Third = 2, -1 =
// Bottom // Bottom
final int libraryPosition = sa.hasParam("LibraryPosition") ? CardFactoryUtil.xCount(host, host.getSVar(sa.getParam("LibraryPosition"))) : 0; final int libraryPosition = sa.hasParam("LibraryPosition") ? AbilityUtils.calculateAmount(host, sa.getParam("LibraryPosition"), sa) : 0;
if (libraryPosition == -1) { if (libraryPosition == -1) {
sb.append(" on the bottom of").append(pronoun).append("owner's library."); sb.append(" on the bottom of").append(pronoun).append("owner's library.");
@@ -433,7 +433,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (destination.equals(ZoneType.Library)) { if (destination.equals(ZoneType.Library)) {
// library position is zero indexed // library position is zero indexed
final int libraryPosition = sa.hasParam("LibraryPosition") ? CardFactoryUtil.xCount(hostCard, hostCard.getSVar(sa.getParam("LibraryPosition"))) : 0; final int libraryPosition = sa.hasParam("LibraryPosition") ? AbilityUtils.calculateAmount(hostCard, sa.getParam("LibraryPosition"), sa) : 0;
movedCard = game.getAction().moveToLibrary(tgtC, libraryPosition); movedCard = game.getAction().moveToLibrary(tgtC, libraryPosition);