Added support for Lens of Clarity.

This commit is contained in:
Krazy
2014-09-13 22:56:30 +00:00
parent 23fc246ea5
commit 20ef2a9d27
3 changed files with 14 additions and 6 deletions

View File

@@ -8918,7 +8918,8 @@ public class Card extends GameEntity implements Comparable<Card> {
case Graveyard:
case Stack:
//cards in these zones are visible to all
if (isFaceDown() && getController().isOpponentOf(viewer) && !hasKeyword("Your opponent may look at this card.")) {
if (isFaceDown() && getController().isOpponentOf(viewer) && !hasKeyword("Your opponent may look at this card.")
&& !isVisibleToWhileFaceDown(viewer)) { //Support Lens of Clarity
break; //exception is face down cards controlled by opponents
}
return true;
@@ -8964,6 +8965,10 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
public boolean isVisibleToWhileFaceDown(final Player viewer) {
return viewer != null && viewer.getAmountOfKeyword("CanSeeOpponentsFaceDownCards") > 0;
}
/**
* <p>

View File

@@ -194,8 +194,7 @@ public enum FControl implements KeyEventDispatcher {
return true;
}
/** After view and model have been initialized, control can start.
* @param isHeadlessMode */
/** After view and model have been initialized, control can start.*/
public void initialize() {
// Preloads skin components (using progress bar).
FSkin.loadFull(true);
@@ -372,6 +371,10 @@ public enum FControl implements KeyEventDispatcher {
public boolean mayShowCard(Card c) {
return game == null || !gameHasHumanPlayer || ForgePreferences.DEV_MODE || c.canBeShownTo(getCurrentPlayer());
}
public boolean maySeeFaceDownCard(Card c) {
return game == null || !gameHasHumanPlayer || ForgePreferences.DEV_MODE || c.isVisibleToWhileFaceDown(getCurrentPlayer());
}
/**
* TODO: Write javadoc for this method.

View File

@@ -177,10 +177,10 @@ public class CardDetailPanel extends SkinnedPanel {
boolean canShowThis = false;
if (card.isFaceDown()) {
if (card.isFaceDown() && !Singletons.getControl().maySeeFaceDownCard(card)) {
if (card.isInZone(ZoneType.Battlefield)) {
this.nameCostLabel.setText("???");
this.typeLabel.setText("Creature");
this.nameCostLabel.setText("???");
this.typeLabel.setText("Creature");
}
}
else if (Singletons.getControl().mayShowCard(card) || FDialog.isModalOpen()) { //allow showing cards while modal open to account for revealing, picking, and ordering cards