private void refreshValues() { IPlayer player = client.getLocalPlayer(); texInit.setText(Integer.toString(player.getConstantInitBonus())); fldConventional.setText(Integer.toString(player.getNbrMFConventional())); fldVibrabomb.setText(Integer.toString(player.getNbrMFVibra())); fldActive.setText(Integer.toString(player.getNbrMFActive())); fldInferno.setText(Integer.toString(player.getNbrMFInferno())); }
/** * cycle through players team and select the best initiative * take negatives only if the current bonus is zero */ public int getTotalInitBonus(boolean bInitiativeCompensationBonus) { int turnb = 0; int constantb = Integer.MIN_VALUE; int commandb = Integer.MIN_VALUE; constantb = Integer.MIN_VALUE; for (IPlayer player : getPlayersVector()) { turnb += player.getTurnInitBonus(); if (player.getCommandBonus() > commandb) { commandb = player.getCommandBonus(); } if (player.getConstantInitBonus() > constantb) { constantb = player.getConstantInitBonus(); } } return constantb + turnb + commandb + getInitCompensationBonus(bInitiativeCompensationBonus); }
@Override public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); int colIndex = columnAtPoint(p); int realColIndex = convertColumnIndexToModel(colIndex); IPlayer player = playerModel.getPlayerAt(rowIndex); if (player == null) { return null; } int mines = player.getNbrMFConventional() + player.getNbrMFActive() + player.getNbrMFInferno() + player.getNbrMFVibra(); if (realColIndex == PlayerTableModel.COL_PLAYER) { return Messages.getString("ChatLounge.tipPlayer", new Object[] { getValueAt(rowIndex, colIndex), player.getConstantInitBonus(), mines }); } else if (realColIndex == PlayerTableModel.COL_TON) { return ((Double) getValueAt(rowIndex, colIndex)).toString(); } else if (realColIndex == PlayerTableModel.COL_COST) { return Messages.getString("ChatLounge.tipCost", new Object[] { (Integer) getValueAt(rowIndex, colIndex) }); } else if (realColIndex == PlayerTableModel.COL_START) { return (String) getValueAt(rowIndex, colIndex); } else { return Integer.toString((Integer) getValueAt(rowIndex, colIndex)); } } };
Mockito.when(mockPlayer1.getConstantInitBonus()).thenReturn(0); Mockito.when(mockPlayer1.getTurnInitBonus()).thenReturn(0); Mockito.when(mockPlayer1.getInitCompensationBonus()).thenReturn(0); Mockito.when(mockPlayer2.getConstantInitBonus()).thenReturn(0); Mockito.when(mockPlayer2.getTurnInitBonus()).thenReturn(0); Mockito.when(mockPlayer2.getInitCompensationBonus()).thenReturn(0); Mockito.when(mockPlayer2.getConstantInitBonus()).thenReturn(0); Mockito.when(mockPlayer2.getTurnInitBonus()).thenReturn(0); Mockito.when(mockPlayer2.getInitCompensationBonus()).thenReturn(0); Mockito.when(mockPlayer1.getConstantInitBonus()).thenReturn(-1); Mockito.when(mockPlayer2.getConstantInitBonus()).thenReturn(-2); Mockito.when(mockPlayer3.getConstantInitBonus()).thenReturn(-3); initBonus = testTeam.getTotalInitBonus(useInitCompBonus); Assert.assertEquals(-1, initBonus); Mockito.when(mockPlayer1.getConstantInitBonus()).thenReturn(0); initBonus = testTeam.getTotalInitBonus(useInitCompBonus); Assert.assertEquals(0, initBonus); Mockito.when(mockPlayer1.getConstantInitBonus()).thenReturn(1); initBonus = testTeam.getTotalInitBonus(useInitCompBonus); Assert.assertEquals(1, initBonus); Mockito.when(mockPlayer1.getConstantInitBonus()).thenReturn(-1); Mockito.when(mockPlayer2.getCommandBonus()).thenReturn(2); initBonus = testTeam.getTotalInitBonus(useInitCompBonus);