Example #1
0
  public void firstNextPlayer(BottomButtons bb, TopButtons tb) {

    // if player turn and not clicked display error and return

    // set dice view
    Random n = new Random(System.currentTimeMillis());
    int dice = n.nextInt(6) + 1;
    BottomButtons.diceNum = dice;
    diceNum = dice;
    System.out.println(dice + "");
    bb.setDice(dice);

    // if currentPlayer is a human player then show move spaces
    if (currentPlayerIndex == humanPlayerIndex) {
      System.out.println("setting human turn");
      humanTurn = true;
    } else {
      //			Player p[]   = new Player[6];
      //			players.toArray(p);
      //
      //			p[currentPlayerIndex].index = calcTargets(p[currentPlayerIndex].index,dice);

    }
    this.updateUI();
    // print whose turn
    Player p[] = new Player[6];
    players.toArray(p);
    tb.setPlayersName(p[currentPlayerIndex].name);
  }
Example #2
0
  public void nextPlayer(BottomButtons bb, TopButtons tb) {
    //		p[currentPlayerIndex];
    // if it is human players turn and humanTurnWasMade = false
    if (!humanTurnWasMade && currentPlayerIndex == humanPlayerIndex) {
      clueGame.invalidNeedToFinishTurn();
      return;
    }
    humanTurnWasMade = false;
    System.out.println("before incrementing = " + currentPlayerIndex);
    currentPlayerIndex = (currentPlayerIndex + 1) % 6;
    System.out.println("after incrementing = " + currentPlayerIndex);
    // if player turn and not clicked display error and return

    // set dice view
    Random n = new Random(System.currentTimeMillis());
    int dice = n.nextInt(6) + 1;
    BottomButtons.diceNum = dice;
    diceNum = dice;
    System.out.println(dice + "");
    bb.setDice(dice);

    // if currentPlayer is a human player then show move spaces
    if (currentPlayerIndex == humanPlayerIndex) {
      System.out.println("setting human turn");
      humanTurn = true;
    } else {
      Player p[] = new Player[6];
      players.toArray(p);
      Player a = p[currentPlayerIndex];
      BoardCell b = a.pickLocation(getTargets(a.index, dice));
      a.index = calcIndex(b.row, b.col);
      BoardCell bc = getCellAt((a.index));
      if (bc.isDoorway()) {
        Player[] thePlayers = new Player[6];
        players.toArray(thePlayers);
        System.out.println("------------------------------in room");
        clueGame.showSuggestionPanel(rooms.get(bc.getRooomName()), thePlayers[currentPlayerIndex]);
      }
    }
    this.updateUI();
    // print whose turn
    Player p[] = new Player[6];
    players.toArray(p);
    tb.setPlayersName(p[currentPlayerIndex].name);
  }