Пример #1
0
  @Override
  protected void drawOnContainer(Graphics g) {
    // draw target arrows immediately above stack for active item only
    if (activeItem != null) {
      Vector2 arrowOrigin =
          new Vector2(
              activeItem.getLeft()
                  + VStack.CARD_WIDTH * FCardPanel.TARGET_ORIGIN_FACTOR_X
                  + VStack.PADDING
                  + VStack.BORDER_THICKNESS,
              activeItem.getTop()
                  + VStack.CARD_HEIGHT * FCardPanel.TARGET_ORIGIN_FACTOR_Y
                  + VStack.PADDING
                  + VStack.BORDER_THICKNESS);

      PlayerView activator = activeStackInstance.getActivatingPlayer();
      arrowOrigin = arrowOrigin.add(screenPos.x, screenPos.y);

      StackItemView instance = activeStackInstance;
      while (instance != null) {
        for (CardView c : instance.getTargetCards()) {
          TargetingOverlay.drawArrow(g, arrowOrigin, c, activator.isOpponentOf(c.getController()));
        }
        for (PlayerView p : instance.getTargetPlayers()) {
          TargetingOverlay.drawArrow(g, arrowOrigin, p, activator.isOpponentOf(p));
        }
        instance = instance.getSubInstance();
      }
    }
  }
Пример #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;
  }