Exemple #1
0
  private boolean canFaceDownBeShownTo(final PlayerView viewer) {
    if (!isFaceDown()) {
      return true;
    }
    if (viewer.hasKeyword("CanSeeOpponentsFaceDownCards")) {
      return true;
    }

    // special viewing permissions for viewer
    if (mayPlayerLook(viewer)) {
      return true;
    }

    // if viewer is controlled by another player, also check if face can be shown to that player
    final PlayerView mindSlaveMaster = viewer.getMindSlaveMaster();
    if (mindSlaveMaster != null && canFaceDownBeShownTo(mindSlaveMaster)) {
      return true;
    }
    if (isInZone(EnumSet.of(ZoneType.Battlefield, ZoneType.Stack, ZoneType.Sideboard))
        && getController().equals(viewer)) {
      return true;
    }
    if (getController().isOpponentOf(viewer) && getCurrentState().getOpponentMayLook()) {
      return true;
    }
    return false;
  }
Exemple #2
0
  private boolean canBeShownTo(final PlayerView viewer) {
    if (viewer == null) {
      return false;
    }

    ZoneType zone = getZone();
    if (zone == null) {
      return true;
    } // cards outside any zone are visible to all

    final PlayerView controller = getController();
    switch (zone) {
      case Ante:
      case Command:
      case Exile:
      case Battlefield:
      case Graveyard:
      case Flashback:
      case Stack:
        // cards in these zones are visible to all
        return true;
      case Hand:
        if (controller.hasKeyword("Play with your hand revealed.")) {
          return true;
        }
        // $FALL-THROUGH$
      case Sideboard:
        // face-up cards in these zones are hidden to opponents unless they specify otherwise
        if (controller.isOpponentOf(viewer) && !getCurrentState().getOpponentMayLook()) {
          break;
        }
        return true;
      case Library:
      case PlanarDeck:
        // cards in these zones are hidden to all unless they specify otherwise
        if (viewer != null && viewer.equals(controller) && getCurrentState().getYouMayLook()) {
          return true;
        }
        if (controller.isOpponentOf(viewer) && getCurrentState().getOpponentMayLook()) {
          return true;
        }
        break;
      case SchemeDeck:
        // true for now, to actually see the Scheme cards (can't see deck anyway)
        return true;
    }

    // special viewing permissions for viewer
    if (mayPlayerLook(viewer)) {
      return true;
    }

    // if viewer is controlled by another player, also check if card can be shown to that player
    PlayerView mindSlaveMaster = controller.getMindSlaveMaster();
    if (mindSlaveMaster != null && mindSlaveMaster == viewer) {
      return canBeShownTo(controller);
    }
    return false;
  }