mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Fix so cards in hidden zones are properly hidden
This commit is contained in:
@@ -54,7 +54,7 @@ public class CardDetailUtil {
|
||||
if (card == null) {
|
||||
return getBorderColors(null, false, false, false).iterator().next();
|
||||
}
|
||||
return getBorderColors(card.getColors(), card.isLand(), card.getCard().mayBeShown(), false).iterator().next();
|
||||
return getBorderColors(card.getColors(), card.isLand(), MatchUtil.canCardBeShown(card.getCard()), false).iterator().next();
|
||||
}
|
||||
public static DetailColors getBorderColor(final ColorSet cardColors, final boolean isLand, boolean canShow) {
|
||||
return getBorderColors(cardColors, isLand, canShow, false).get(0);
|
||||
@@ -63,7 +63,7 @@ public class CardDetailUtil {
|
||||
if (card == null) {
|
||||
return getBorderColors(null, false, false, true);
|
||||
}
|
||||
return getBorderColors(card.getColors(), card.isLand(), card.getCard().mayBeShown(), true);
|
||||
return getBorderColors(card.getColors(), card.isLand(), MatchUtil.canCardBeShown(card.getCard()), true);
|
||||
}
|
||||
private static List<DetailColors> getBorderColors(final ColorSet cardColors, final boolean isLand, boolean canShow, boolean supportMultiple) {
|
||||
List<DetailColors> borderColors = new ArrayList<DetailColors>();
|
||||
|
||||
@@ -5,7 +5,6 @@ package forge.control;
|
||||
|
||||
import forge.LobbyPlayer;
|
||||
import forge.game.Game;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardView;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.player.PlayerView;
|
||||
@@ -91,16 +90,6 @@ public class WatchLocalGame extends PlayerControllerHuman {
|
||||
public void alphaStrike() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mayShowCard(final Card c) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mayShowCardFace(final Card c) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getAutoYields() {
|
||||
return null;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
@@ -29,6 +30,7 @@ import forge.game.GameType;
|
||||
import forge.game.GameView;
|
||||
import forge.game.Match;
|
||||
import forge.game.card.CardView;
|
||||
import forge.game.card.CardView.CardStateView;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.player.PlayerView;
|
||||
import forge.game.player.RegisteredPlayer;
|
||||
@@ -279,6 +281,18 @@ public class MatchUtil {
|
||||
return controller.assignDamage(attacker, blockers, damage, defender, overrideOrder);
|
||||
}
|
||||
|
||||
public static String getCardImageKey(CardStateView csv) {
|
||||
return csv.getImageKey(getCurrentPlayer().getView());
|
||||
}
|
||||
|
||||
public static boolean canCardBeShown(CardView cv) {
|
||||
return cv.canBeShownTo(getCurrentPlayer().getView());
|
||||
}
|
||||
|
||||
public static boolean canFaceDownCardBeShown(CardView cv) {
|
||||
return cv.hasAlternateState() && cv.canFaceDownBeShownTo(getCurrentPlayer().getView());
|
||||
}
|
||||
|
||||
private static Set<PlayerView> highlightedPlayers = new HashSet<PlayerView>();
|
||||
public static void setHighlighted(PlayerView pv, boolean b) {
|
||||
if (b) {
|
||||
|
||||
@@ -176,12 +176,7 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
}
|
||||
private void tempShowCard(Card c) {
|
||||
if (c == null) { return; }
|
||||
|
||||
CardView cv = c.getView();
|
||||
if (!cv.mayBeShown()) {
|
||||
cv.setMayBeShown(true);
|
||||
tempShownCards.add(c);
|
||||
}
|
||||
c.setMayLookAt(player, true, true);
|
||||
}
|
||||
private void tempShowCards(Iterable<Card> cards) {
|
||||
if (mayLookAtAllCards) { return; } //no needed if this is set
|
||||
@@ -194,7 +189,7 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
if (tempShownCards.isEmpty()) { return; }
|
||||
|
||||
for (Card c : tempShownCards) {
|
||||
c.getView().setMayBeShown(false);
|
||||
c.setMayLookAt(player, false, true);
|
||||
}
|
||||
tempShownCards.clear();
|
||||
}
|
||||
@@ -1381,27 +1376,6 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
inputProxy.alphaStrike();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a card may be shown. If {@code mayLookAtAllCards} is
|
||||
* {@code true}, any card may be shown.
|
||||
*
|
||||
* @param c a card.
|
||||
* @return whether the card may be shown.
|
||||
* @see GameView#mayShowCardNoRedirect(CardView)
|
||||
*/
|
||||
public boolean mayShowCard(final Card c) {
|
||||
if (mayLookAtAllCards) {
|
||||
return true;
|
||||
}
|
||||
return c == null || tempShownCards.contains(c) || c.canBeShownTo(player);
|
||||
}
|
||||
public boolean mayShowCardFace(final Card c) {
|
||||
if (mayLookAtAllCards) {
|
||||
return true;
|
||||
}
|
||||
return c == null || !c.isFaceDown() || c.canCardFaceBeShownTo(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetAtEndOfTurn() {
|
||||
// Not used by the human controller
|
||||
|
||||
Reference in New Issue
Block a user