private int[] getBattlePlayersOnSquare(int squareIndex40, Jail jail) { if (squareIndex40 == 10) { int battlePlayerCount = getNumberOfBattlePlayersOnSquare(squareIndex40, jail); int[] playersOnSquare = new int[getNumberOfPlayersOnSquare(squareIndex40)]; int[] battlePlayers = new int[battlePlayerCount]; int battleIndex = 0; Array.Copy(getPlayersOnSquare(squareIndex40), playersOnSquare, playersOnSquare.Length); for (int index = 0; index < playersOnSquare.Length; index++) { if (!jail.getIsInJail(battlePlayers[index])) { battlePlayers[battleIndex] = playersOnSquare[index]; battleIndex++; } //END IF } //END FOR return(battlePlayers); } else { return(getPlayersOnSquare(squareIndex40)); } }
private int getNumberOfBattlePlayersOnSquare(int squareIndex40, Jail jail) { int battlePlayerCount = getNumberOfPlayersOnSquare(squareIndex40); if (squareIndex40 == 10) { int[] battlePlayers = new int[battlePlayerCount]; Array.Copy(getPlayersOnSquare(squareIndex40), battlePlayers, battlePlayers.Length); for (int index = 0; index < battlePlayers.Length; index++) { if (jail.getIsInJail(battlePlayers[index])) { battlePlayerCount--; } }//END FOR return(battlePlayerCount); } else { return(battlePlayerCount); } }
//--------------------------------------------------------------------- //SET------------------------------------------------------------------ //--------------------------------------------------------------------- public void setState() { // 0 PRE ROLL // 1 DOUBLES // 2 POST ROLL // 3 PRE ROLL IN JAIL // 4 POST ROLL IN JAIL // 5 MORTGAGE // 6 BUY HOUSES // 7 SELL HOUSES // 8 TRADE // 9 OWE MONEY // 10 AUCTION currentState = 0; if (players[currentPlayer].cash < 0) { // 9 OWE MONEY currentState = 9; //System.Windows.Forms.MessageBox.Show("CURRENT STATE OWE MONEY"); } if (jail.getIsInJail(currentPlayer) && dice.getCanRoll()) { // 3 PRE ROLL IN JAIL currentState = 3; //System.Windows.Forms.MessageBox.Show("CURRENT STATE PRE ROLL IN JAIL"); } else if (jail.getIsInJail(currentPlayer) && !dice.getCanRoll()) { // 4 POST ROLL IN JAIL currentState = 4; //System.Windows.Forms.MessageBox.Show("CURRENT STATE POST ROLL IN JAIL"); } else if (!dice.getCanRoll()) { // 2 POST ROLL currentState = 2; //System.Windows.Forms.MessageBox.Show("CURRENT STATE POST ROLL"); } else if (dice.rolledDoubles()) { // 1 DOUBLES currentState = 1; //System.Windows.Forms.MessageBox.Show("CURRENT STATE DOUBLES"); } else if (dice.getCanRoll()) { // 0 PRE ROLL currentState = 0; //System.Windows.Forms.MessageBox.Show("CURRENT STATE PRE ROLL"); }//END IF }