예제 #1
0
        public void BuyInAuction(Player player, int auctionPrice)
        {
            if (Owner != null)
            {
                throw new InvalidOperationException("The Street is already owned by Player " + Owner.Name);
            }

            player.AddToOwnerShip(this);
            player.PayMoney(auctionPrice);
            SetOwner(player);
        }
예제 #2
0
        public void Buy(Player player)
        {
            if (Owner != null)
            {
                throw new InvalidOperationException("The Street is already owned by Player " + Owner.Name);
            }

            player.PayMoney(Cost.Ground);
            player.AddToOwnerShip(this);
            SetOwner(player);
        }
 public void ExchangeField(Player owner, Player buyer, int negotiatetprice)
 {
     if (owner.Name == buyer.Name)
     {
         throw new ArgumentException("You can't Exchange with yourself");
     }
     if (owner.Name != this.Owner.Name)
     {
         throw new ArgumentException("The Player " + owner.Name + " does not own this field");
     }
     owner.GetMoney(negotiatetprice);
     buyer.PayMoney(negotiatetprice);
     owner.RemoveFromOwnerShip(this);
     buyer.AddToOwnerShip(this);
     this.Owner = buyer;
 }
예제 #4
0
 public void ExchangeField(Player owner, Player buyer, int negotiatetprice)
 {
     if (Level > 0)
     {
         throw new InvalidOperationException("You have to sell all your houses before its possible to exchange with other players");
     }
     if (owner.Name == buyer.Name)
     {
         throw new ArgumentException("You can't Exchange with yourself");
     }
     if (owner.Name != this.Owner.Name)
     {
         throw new ArgumentException("The Player " + owner.Name + " does not own this field");
     }
     owner.GetMoney(negotiatetprice);
     buyer.PayMoney(negotiatetprice);
     owner.RemoveFromOwnerShip(this);
     buyer.AddToOwnerShip(this);
     this.Owner = buyer;
 }
 public void ExchangeField(Player owner, Player buyer, IRentableField field)
 {
     if (owner.Name == buyer.Name)
     {
         throw new ArgumentException("You can't Exchange with yourself");
     }
     if (field.Owner.Name != buyer.Name)
     {
         throw new ArgumentException("The Buyer has to own the " + field.Name);
     }
     if (owner.Name != this.Owner.Name)
     {
         throw new ArgumentException("The Player " + owner.Name + " does not own this field");
     }
     owner.AddToOwnerShip(field);
     buyer.RemoveFromOwnerShip(field);
     owner.RemoveFromOwnerShip(this);
     buyer.AddToOwnerShip(this);
     this.Owner = buyer;
     field.SetOwner(owner);
 }