diff --git a/WZIMopoly/Models/GameScene/TileModels/RestroomTileModel.cs b/WZIMopoly/Models/GameScene/TileModels/RestroomTileModel.cs index fc5953d..b3bf840 100644 --- a/WZIMopoly/Models/GameScene/TileModels/RestroomTileModel.cs +++ b/WZIMopoly/Models/GameScene/TileModels/RestroomTileModel.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection.Metadata.Ecma335; using System.Xml; using WZIMopoly.Enums; @@ -36,7 +35,7 @@ internal RestroomTileModel(int id, int price, Dictionary ta TaxPrices = taxPrices; OnStand += (player) => { - if (Owner != null && Owner != player) + if (Owner != null && Owner != player && !IsMortgaged) { RestroomAmount ownerRestroomAmount = GetOwnerRestroomAmonut(); int tax = TaxPrices[ownerRestroomAmount]; @@ -102,7 +101,7 @@ public override int GetValue() /// private RestroomAmount GetOwnerRestroomAmonut() { - int? amount = Owner?.PurchasedTiles.Where(x => x is RestroomTileModel).Count(); + int? amount = Owner?.PurchasedTiles.Where(x => x is RestroomTileModel && !x.IsMortgaged).Count(); return amount switch { 1 => RestroomAmount.One, diff --git a/WZIMopoly/Models/GameScene/TileModels/SubjectTileModel.cs b/WZIMopoly/Models/GameScene/TileModels/SubjectTileModel.cs index 2fb801e..148947e 100644 --- a/WZIMopoly/Models/GameScene/TileModels/SubjectTileModel.cs +++ b/WZIMopoly/Models/GameScene/TileModels/SubjectTileModel.cs @@ -61,7 +61,7 @@ internal SubjectTileModel(int id, int price, int upgradedPrice, Dictionary { - if (Owner != null && !player.Equals(Owner)) + if (Owner != null && !player.Equals(Owner) && !IsMortgaged) { player.TransferMoneyTo(Owner, TaxPrices[Grade]); } diff --git a/WZIMopoly/Models/PlayerModel.cs b/WZIMopoly/Models/PlayerModel.cs index 1e93ec6..8db7df1 100644 --- a/WZIMopoly/Models/PlayerModel.cs +++ b/WZIMopoly/Models/PlayerModel.cs @@ -342,8 +342,10 @@ public void GoBankrupt() public void GoBankrupt(PlayerModel recipient) { TransferMoneyTo(recipient, Money); - recipient.PurchasedTiles.AddRange(PurchasedTiles); - recipient.MortgagedTiles.AddRange(MortgagedTiles); + foreach(var tile in new List(PurchasedTiles)) + { + TransferTileTo(recipient, tile); + } GoBankrupt(); }