Fix flashback zone to work more like other zones and not crash for desktop game

This commit is contained in:
drdev
2014-10-15 19:53:29 +00:00
parent e9c0e600ec
commit 8aa9fd050e
10 changed files with 32 additions and 71 deletions

View File

@@ -1,7 +1,6 @@
package forge.screens.match;
import java.awt.event.ActionEvent;
import forge.game.card.CardView;
import forge.game.player.PlayerView;
import forge.game.zone.ZoneType;
import forge.gui.ForgeAction;
@@ -32,27 +31,5 @@ public class ZoneAction extends ForgeAction {
@Override
public void actionPerformed(final ActionEvent e) {
FloatingCardArea.show(player, zone);
/*final Iterable<CardView> choices = getCardsAsIterable();
if (choices == null || !choices.iterator().hasNext()) {
GuiChoose.reveal(title, "no cards");
return;
}
final List<CardStateView> choices2 = Lists.newLinkedList();
for (final CardView cv : choices) {
choices2.add(cv.getCurrentState());
}
final CardStateView choice = GuiChoose.oneOrNone(title, choices2);
if (choice != null) {
doAction(choice.getCard());
}*/
}
protected Iterable<CardView> getCardsAsIterable() {
return player.getCards(zone);
}
protected void doAction(final CardView c) {
}
}

View File

@@ -25,7 +25,6 @@ import com.google.common.base.Function;
import forge.Singletons;
import forge.UiCommand;
import forge.game.card.CardView;
import forge.game.player.PlayerView;
import forge.game.zone.ZoneType;
import forge.gui.framework.ICDoc;
@@ -66,22 +65,7 @@ public class CField implements ICDoc {
final ZoneAction libraryAction = new ZoneAction(player, ZoneType.Library, MatchConstants.HUMANLIBRARY);
final ZoneAction exileAction = new ZoneAction(player, ZoneType.Exile, MatchConstants.HUMANEXILED);
final ZoneAction graveAction = new ZoneAction(player, ZoneType.Graveyard, MatchConstants.HUMANGRAVEYARD);
@SuppressWarnings("serial")
final ZoneAction flashBackAction = new ZoneAction(player, null, MatchConstants.HUMANFLASHBACK) {
@Override
protected void doAction(final CardView c) {
// activate cards only via your own flashback button
if (player.getLobbyPlayer() != Singletons.getControl().getGuiPlayer()) {
return;
}
CPrompt.SINGLETON_INSTANCE.selectCard(c, null);
}
@Override
protected Iterable<CardView> getCardsAsIterable() {
return player.getFlashback();
}
};
final ZoneAction flashBackAction = new ZoneAction(player, ZoneType.Flashback, MatchConstants.HUMANFLASHBACK);
Function<Byte, Void> manaAction = new Function<Byte, Void>() {
public Void apply(Byte colorCode) {

View File

@@ -62,6 +62,17 @@ public class FloatingCardArea extends CardArea {
if (cardArea != null) {
cardArea.refresh();
}
//refresh flashback zone when graveyard, library, or exile zones updated
switch (zone) {
case Graveyard:
case Library:
case Exile:
refresh(player, ZoneType.Flashback);
break;
default:
break;
}
}
private final PlayerView player;