Fix so cards in library update if you have to select multiple cards

This commit is contained in:
drdev
2014-10-03 18:02:38 +00:00
parent e0aca90d0e
commit fe33235f08
2 changed files with 24 additions and 10 deletions

View File

@@ -783,7 +783,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
if (c == null) {
final int num = Math.min(fetchList.size(), changeNum - i);
String message = String.format("Cancel Search? Up to %d more cards can change zones.", num);
String message = "Cancel Search? Up to " + num + " more card" + (num != 1 ? "s" : "") + " can be selected.";
if (fetchList.isEmpty() || decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message)) {
break;
@@ -793,6 +793,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
fetchList.remove(c);
if (delayedReveal != null) {
delayedReveal.remove(c);
}
chosenCards.add(c);
if (totalcmc != null) {
@@ -838,7 +841,8 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
Card attachedTo = null;
if (list.size() > 1) {
attachedTo = decider.getController().chooseSingleEntityForEffect(list, sa, c + " - Select a card to attach to.");
} else {
}
else {
attachedTo = list.get(0);
}
if (c.isAura()) {
@@ -849,14 +853,16 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
c.removeEnchanting(oldEnchanted);
}
c.enchantEntity(attachedTo);
} else if (c.isEquipment()) { //Equipment
}
else if (c.isEquipment()) { //Equipment
if (c.isEquipping()) {
final Card oldEquiped = c.getEquippingCard();
if ( null != oldEquiped )
c.unEquipCard(oldEquiped);
}
c.equipCard(attachedTo);
} else {
}
else {
if (c.isFortifying()) {
final Card oldFortified = c.getFortifyingCard();
if ( null != oldFortified )
@@ -864,7 +870,8 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
c.fortifyCard(attachedTo);
}
} else { // When it should enter the battlefield attached to an illegal permanent it fails
}
else { // When it should enter the battlefield attached to an illegal permanent it fails
continue;
}
}
@@ -882,7 +889,8 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
c.enchantEntity(attachedTo);
}
} else { // When it should enter the battlefield attached to an illegal permanent it fails
}
else { // When it should enter the battlefield attached to an illegal permanent it fails
continue;
}
}
@@ -918,12 +926,14 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
movedCard.setState(CardCharacteristicName.FaceDown);
}
movedCard.setTimestamp(ts);
} else if (destination.equals(ZoneType.Exile)) {
}
else if (destination.equals(ZoneType.Exile)) {
movedCard = game.getAction().exile(c);
if (sa.hasParam("ExileFaceDown")) {
movedCard.setState(CardCharacteristicName.FaceDown);
}
} else {
}
else {
movedCard = game.getAction().moveTo(destination, c);
}

View File

@@ -1,7 +1,7 @@
package forge.game.player;
import java.util.ArrayList;
import java.util.Collection;
import forge.game.card.Card;
import forge.game.zone.ZoneType;
@@ -17,7 +17,7 @@ public class DelayedReveal {
this(cards0, zone0, owner0, null);
}
public DelayedReveal(Collection<Card> cards0, ZoneType zone0, Player owner0, String messagePrefix0) {
cards = cards0;
cards = new ArrayList<Card>(cards0); //create copy of list to allow modification
zone = zone0;
owner = owner0;
messagePrefix = messagePrefix0;
@@ -35,6 +35,10 @@ public class DelayedReveal {
return owner;
}
public void remove(Card card) {
cards.remove(card);
}
public void reveal(PlayerController controller) {
if (revealed) { return; } //avoid revealing more than once
revealed = true;