public void LandedOn(int?diceRoll = null) { string landedOnText = "landed on " + board.locations[PlayerManager.location].name; SendActivityMessage(landedOnText, currentPlayer); if (board.locations[PlayerManager.location] is Property) { Property currentLocation = (Property)board.locations[PlayerManager.location]; // Unowned if (currentLocation.owner == null) { if (PlayerManager.balance >= currentLocation.price) { EnableButton("buyPropertyButton"); } } else // Owned { if (currentLocation.owner != players[currentPlayer]) // By other { int rent = currentLocation.GetRent(); bool paid = PayMoney(rent, currentLocation.owner); if (paid) { string text = "paid $" + rent + " in rent to " + currentLocation.owner.NickName; SendActivityMessage(text, currentPlayer); } else { isRent = true; } } } } else if (board.locations[PlayerManager.location] is Railroad) { Railroad currentLocation = (Railroad)board.locations[PlayerManager.location]; if (currentLocation.owner == null) { if (PlayerManager.balance >= currentLocation.price) { EnableButton("buyPropertyButton"); } } else // Owned { if (currentLocation.owner != players[currentPlayer]) // By other { int rent = currentLocation.GetRent(); bool paid = PayMoney(rent, currentLocation.owner); if (paid) { string text = "paid $" + rent + " in rent to " + currentLocation.owner.NickName; SendActivityMessage(text, currentPlayer); } else { isRent = true; } } } } else if (board.locations[PlayerManager.location] is Utility) { Utility currentLocation = (Utility)board.locations[PlayerManager.location]; if (currentLocation.owner == null) { if (PlayerManager.balance >= currentLocation.price) { EnableButton("buyPropertyButton"); } } else // Owned { if (currentLocation.owner != players[currentPlayer]) // By other { int rent = currentLocation.GetRent((int)diceRoll); bool paid = PayMoney(rent, currentLocation.owner); if (paid) { string text = "paid $" + rent + " in rent to " + currentLocation.owner.NickName; SendActivityMessage(text, currentPlayer); } else { isRent = true; } } } } else if (board.locations[PlayerManager.location] is Tax) { Tax currentLocation = (Tax)board.locations[PlayerManager.location]; bool paid = PayMoney(currentLocation.tax); if (paid) { string text = "paid $" + currentLocation.tax + " in taxes"; SendActivityMessage(text, currentPlayer); } } else if (board.locations[PlayerManager.location] is Location) { switch (board.locations[PlayerManager.location].name) { case "GO": ReceiveMoney(200); break; case "Jail": break; case "Free Parking": break; case "Go To Jail": MoveToLocation(10); LandedOn(); bool paid = PayMoney(50); if (paid) { int amountPaid = 50; string paidMessage = "paid $" + amountPaid.ToString(); SendActivityMessage(paidMessage, currentPlayer); } break; case "Chance": Card drawnCard = board.DrawChance(); string[] data = { "Chance", drawnCard.description }; SendEvent(CardCode, data); // If receive money if (drawnCard.amountMoney > 0) { ReceiveMoney(drawnCard.amountMoney); string receivedMessage = "received $" + drawnCard.amountMoney.ToString(); SendActivityMessage(receivedMessage, currentPlayer); } else if (drawnCard.amountMoney < 0) { bool paid2 = PayMoney(Math.Abs(drawnCard.amountMoney)); if (paid2) { string paidMessage = "paid $" + Math.Abs(drawnCard.amountMoney).ToString(); SendActivityMessage(paidMessage, currentPlayer); } } if (drawnCard.moveTo != null) { MoveToLocation((int)drawnCard.moveTo); LandedOn(); } break; case "Community Chest": Card drawnCard2 = board.DrawCommunityChest(); string[] data2 = { "Community Chance", drawnCard2.description }; SendEvent(CardCode, data2); // If receive money if (drawnCard2.amountMoney > 0) { ReceiveMoney(drawnCard2.amountMoney); string receivedMessage2 = "received $" + drawnCard2.amountMoney.ToString(); SendActivityMessage(receivedMessage2, currentPlayer); } else if (drawnCard2.amountMoney < 0) { bool paid3 = PayMoney(Math.Abs(drawnCard2.amountMoney)); if (paid3) { string paidMessage2 = "paid $" + Math.Abs(drawnCard2.amountMoney).ToString(); SendActivityMessage(paidMessage2, currentPlayer); } } if (drawnCard2.moveTo != null) { MoveToLocation((int)drawnCard2.moveTo); LandedOn(); } break; } } }