Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Rivixer committed Jun 16, 2023
2 parents d36e812 + fd2e6f8 commit 5a6a3ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions WZIMopoly/Models/GameScene/TileModels/RestroomTileModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Xml;
using WZIMopoly.Enums;

Expand Down Expand Up @@ -36,7 +35,7 @@ internal RestroomTileModel(int id, int price, Dictionary<RestroomAmount, int> ta
TaxPrices = taxPrices;
OnStand += (player) =>
{
if (Owner != null && Owner != player)
if (Owner != null && Owner != player && !IsMortgaged)
{
RestroomAmount ownerRestroomAmount = GetOwnerRestroomAmonut();
int tax = TaxPrices[ownerRestroomAmount];
Expand Down Expand Up @@ -102,7 +101,7 @@ public override int GetValue()
/// </exception>
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,
Expand Down
2 changes: 1 addition & 1 deletion WZIMopoly/Models/GameScene/TileModels/SubjectTileModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal SubjectTileModel(int id, int price, int upgradedPrice, Dictionary<Subje

OnStand += (player) =>
{
if (Owner != null && !player.Equals(Owner))
if (Owner != null && !player.Equals(Owner) && !IsMortgaged)
{
player.TransferMoneyTo(Owner, TaxPrices[Grade]);
}
Expand Down
6 changes: 4 additions & 2 deletions WZIMopoly/Models/PlayerModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PurchasableTileModel>(PurchasedTiles))
{
TransferTileTo(recipient, tile);
}
GoBankrupt();
}

Expand Down

0 comments on commit 5a6a3ce

Please sign in to comment.