Example #1
0
 public override string landOn(ref Player player)
 {
     //if is a benefit player receives amount else pay amount
     if (this.isBenefitNotPenalty)
     {
         player.receive(this.penaltyOrBenefitAmount);
         return base.landOn(ref player) + String.Format("{0} has recieved {2}.", player.getName(), this.getName(), this.penaltyOrBenefitAmount);
     }
     else
     {
         player.pay(this.penaltyOrBenefitAmount);
         return base.landOn(ref player) + String.Format("{0} has paid {2}.", player.getName(), this.getName(), this.penaltyOrBenefitAmount);
     }
 }
Example #2
0
 public override string landOn(ref Player player)
 {
     //if is a benefit player receives amount else pay amount
     if (this.isBenefitNotPenalty)
     {
         player.receive(this.penaltyOrBenefitAmount);
         return(base.landOn(ref player) + String.Format("{0} has recieved {2}.", player.getName(), this.getName(), this.penaltyOrBenefitAmount));
     }
     else
     {
         player.pay(this.penaltyOrBenefitAmount);
         return(base.landOn(ref player) + String.Format("{0} has paid {2}.", player.getName(), this.getName(), this.penaltyOrBenefitAmount));
     }
 }
 public void purchase(ref Player buyer)
 {
     //check that it is owned by bank
     if (this.availableForPurchase())
     {
         //pay price 
         buyer.pay(this.getPrice());
         //set owner to buyer
         this.setOwner(ref buyer);
     }
     else
     {
         throw new ApplicationException("The property is not available from purchase from the Bank.");
     }
 }
Example #4
0
 public void purchase(ref Player buyer)
 {
     //check that it is owned by bank
     if (this.availableForPurchase())
     {
         //pay price
         buyer.pay(this.getPrice());
         //set owner to buyer
         this.setOwner(ref buyer);
     }
     else
     {
         throw new ApplicationException("The property is not available from purchase from the Bank.");
     }
 }
 public virtual void payRent(ref Player player)
 {
     //Need to check if the property has been mortgage before we charge the player rent.
     if (this.isMortgaged == false)
     {
         player.pay(this.getRent());
         this.getOwner().receive(this.getRent());
     }
     //Do not have to pay rent
     else
     {
         //Should change this to an exception
         Console.WriteLine("This property has been mortgaged, you do not need to pay rent: ");
     }
 }
Example #6
0
 public void tradeProperty(ref TradeableProperty property, ref Player purchaser, decimal amount)
 {
     purchaser.pay(amount);
     this.receive(amount);
     property.setOwner(ref purchaser);
 }
Example #7
0
 public void tradeProperty(ref TradeableProperty property, ref Player purchaser, decimal amount)
 {
     purchaser.pay(amount);
     this.receive(amount);
     property.setOwner(ref purchaser);
 }
        public void tradeProperty(ref TradeableProperty property, ref Player purchaser, decimal amount)
        {
            //get property's original mortgage price
            decimal originalMortgagePrice = property.calculateMortgage(property);
            //get 10% of original mortgage price
            decimal originalMortgagePriceTenPercent = originalMortgagePrice * 10 / 100;
            decimal unMortgagePrice = originalMortgagePrice + originalMortgagePriceTenPercent;

            //purchaser.pay(amount);

            //check if purchased property is already mortgaged
            if (property.getMortgagedStatus() == true)
            {
                int userOption = 0;
                //if purchased property is mortgaged then player must unmortgage
                Console.WriteLine("\n\tThis property is currently mortgaged, you must either:\n\t1. Unmortgage it for the mortgage price plus 10%.\n\t2. Pay the bank 10% and keep it mortgaged.\n");

                //get user options input
                userOption = userInput();

                //grab user input value and run appropriate methods
                try
                {
                    switch (userOption)
                    {
                        case 1:
                            purchaser.pay(unMortgagePrice);
                            //---STILL NEED TO MAKE OTHER PLAYER RECEIVE PAYMENT
                            this.receive(unMortgagePrice);
                            property.setPropertyNotMortgaged();
                            property.setOwner(ref purchaser);
                            //property.unMortgage(property);
                            //Console.WriteLine("You've unmortgaged this property and now own it");
                            break;
                        case 2:
                            //pay 10%
                            purchaser.pay(originalMortgagePriceTenPercent);
                            //allocate da moneys to da banker
                            Banker.access().receive(originalMortgagePriceTenPercent);
                            //keep property as mortgaged
                            property.setPropertyIsMortgaged();

                            property.getMortgagedStatus();
                            //set owner
                            property.setOwner(ref purchaser);
                            break;
                    }
                }
                catch (ApplicationException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            else
            {
                this.receive(amount);
                property.setOwner(ref purchaser);
            }
        }
 public virtual void payRent(ref Player player)
 {
     player.pay(this.getRent());
     this.getOwner().receive(this.getRent());
 }
Example #10
0
 public override void payRent(ref Player player)
 {
     player.pay(this.getRent(ref player));
     this.getOwner().receive(this.getRent());
 }
Example #11
0
 public override void payRent(ref Player player)
 {
     player.pay(this.getRent(ref player));
     this.getOwner().receive(this.getRent());
 }
Example #12
0
 public virtual void payRent(ref Player player)
 {
     player.pay(this.getRent());
     this.getOwner().receive(this.getRent());
 }