public void applyAction() { Player currentPlayer = GameMaster.instance().getCurrentPlayer(); Cell currentPosition = currentPlayer.getPosition(); int newCell = GameMaster.instance().getGameBoard().queryCellIndex(destination); int currentCell = GameMaster.instance().getGameBoard().queryCellIndex(currentPosition.getName()); int diceValue = 0; if (currentCell > newCell) { diceValue = (GameMaster.instance().getGameBoard().getCellNumber() + (newCell - currentCell)); } else if (currentCell <= newCell) { diceValue = newCell - currentCell; } System.out.println(diceValue); GameMaster.instance().movePlayer(currentPlayer, diceValue); }
public TradeDeal getTradeDeal() { TradeDeal deal = new TradeDeal(); deal.setAmount(200); deal.setSellerIndex(0); deal.setPropertyName(GameMaster.instance().getGameBoard().getCell(1).toString()); return deal; }
/* (non-Javadoc) * @see edu.towson.cis.cosc442.project1.monopoly.Cell#playAction(java.lang.String) */ public boolean playAction(String msg) { Player currentPlayer = null; if (!isAvailable()) { currentPlayer = GameMaster.instance().getCurrentPlayer(); if (theOwner != currentPlayer) { currentPlayer.payRentTo(theOwner, getRent()); } } return true; }
public boolean playAction(String msg) { Player currentPlayer = null; if (!isAvailable()) { currentPlayer = GameMaster.instance().getCurrentPlayer(); if (theOwner != currentPlayer) { currentPlayer.payRentTo(theOwner, getRent()); } } boolean result = false; if (msg != null) result = true; else result = false; return result; }