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())); }
@Override protected Vector<Minefield> calculateMinefieldDeployment() { Vector<Minefield> deployedMinefields = new Vector<Minefield>(); deployMinefields(deployedMinefields, getLocalPlayer() .getNbrMFConventional(), 0); deployMinefields(deployedMinefields, getLocalPlayer().getNbrMFCommand(), 1); deployMinefields(deployedMinefields, getLocalPlayer().getNbrMFVibra(), 2); return deployedMinefields; }
@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)); } } };
/** * Enables relevant buttons and sets up for your turn. */ private void beginMyTurn() { p = clientgui.getClient().getLocalPlayer();// necessary to make it work after resets. setConventionalEnabled(p.getNbrMFConventional()); setCommandEnabled(p.getNbrMFCommand()); setVibrabombEnabled(p.getNbrMFVibra()); setActiveEnabled(p.getNbrMFActive()); setInfernoEnabled(p.getNbrMFInferno()); setRemoveMineEnabled(true); if (!p.hasMinefields()) { butDone.setEnabled(true); } }
deployedMinefields.removeElement(mf); if (mf.getType() == Minefield.TYPE_CONVENTIONAL) { p.setNbrMFConventional(p.getNbrMFConventional() + 1); } else if (mf.getType() == Minefield.TYPE_COMMAND_DETONATED) { p.setNbrMFCommand(p.getNbrMFCommand() + 1); Minefield.TYPE_CONVENTIONAL, mfd.getDensity(), sea, depth); p.setNbrMFConventional(p.getNbrMFConventional() - 1); if ((p.getNbrMFConventional() == 0) && (p.getNbrMFCommand() == 0) && (p.getNbrMFVibra() == 0) && (p.getNbrMFActive() == 0) && (p.getNbrMFInferno() == 0)) { setConventionalEnabled(p.getNbrMFConventional()); setCommandEnabled(p.getNbrMFCommand()); setVibrabombEnabled(p.getNbrMFVibra()); setInfernoEnabled(p.getNbrMFInferno()); if (p.getNbrMFConventional() == 0) { deployM = false;