Пример #1
0
        // Rule: When a player is bankruptad by another player, all his properties go to the other player
        public void OnPlayerLiquidated(object sender, PlayerLiquidatedEventArgs e)
        {
            foreach (var field in e.AllPlayerFields)
            {
                SellField(e.PlayerLiquidated, field, 0);

                if (e.StakeHolders.Count == 1)
                {
                    BuyField(e.StakeHolders[0], field, 0); // Rule: All bankrupted player's fields are transfered to the player who bankrupted him
                }
                else
                {
                    // Rule: When the player is bankrupted by the bank, his properties are auctioned off by the bank to the other players
                    foreach (var player in e.StakeHolders) // So the players know how much they can bid
                    {
                        player.PrintStats();
                    }

                    Console.WriteLine("Auction!");
                    var highestBidder = Prompt.ChoosePlayer(e.StakeHolders, $"Who won the auction for {field.FieldName}?");
                    var highestBid    = Prompt.EnterAmount(highestBidder, "What was the highest bid?");

                    BuyField(highestBidder, field, highestBid);
                }
            }
        }
Пример #2
0
 public void OnPlayerLiquidated(object sender, PlayerLiquidatedEventArgs e)
 {
     foreach (var field in e.PropertyFieldsWithHouses)
     {
         SellHouse(e.PlayerLiquidated, field);
     }
 }
 // Rule: When the player is bankrupt all his remaining fields are mortgaged to settle the debt
 public void OnPlayerLiquidated(object sender, PlayerLiquidatedEventArgs e)
 {
     foreach (var field in e.AllPlayerFields)
     {
         if (!field.UnderMortgage)
         {
             PutUnderMortgage(e.PlayerLiquidated, field);
         }
     }
 }
Пример #4
0
        public void OnPlayerLiquidated(object sender, PlayerLiquidatedEventArgs e)
        {
            if (e.BankruptDuringOwnTurn)
            {
                EndTurn();
            }

            Players.Remove(e.PlayerLiquidated);

            if (Players.Count == 1)
            {
                Console.WriteLine($"{Players[0].PlayerName.ToUpper()} has won the game!");
                GameOver = true;
            }
        }