private void ShowActions(Player player, BoardSpace space) { if (space is Property prop) { var options = new List <string>(); var action = PromptMemberOf($"Enter action for {prop.Name}", new List <string> { "None", "Buy a house" }); if (action == "Buy a house") { if (prop.CanAddHouse()) { player.Charge(prop.HouseCost); player.NumHouses++; prop.NumHouses++; } else { Console.WriteLine("Can't add a house!"); } } } }
public bool CheckPlayerBuy(Player player, BoardSpace property, decimal cost) { if (player.Auto) { return(cost < player.Money); } var shouldBuy = PromptBool($"Does {player} ({player.Money:C}) want to buy property {property.Name} {cost:C}? (true / false)\n"); if (shouldBuy) { var props = player.OwnedProperties.Count == 0 ? "no" : string.Join(", ", player.OwnedProperties.Select(p => p.Name)); Console.WriteLine($"{player} bought {property.Name}. Now has {player.Money - cost:C} and owns {props}"); } return(shouldBuy); }
internal void AddProperty(BoardSpace space) { ownedProperties.Add(space); }
public void ShowPlayerPaidRent(Player player, Player owner, BoardSpace space, decimal amount) { Console.WriteLine($"{player} gave {space.Name} owner {owner} {amount:C}!"); }
public void ShowPlayerLanded(Player player, BoardSpace space) { Console.WriteLine($"{player} moved by {player.LastSpacesMoved}: landed on {space.Name}!"); }