Exemplo n.º 1
0
 private static void PropertyOwnershipChange(int propertyID, GameState State, GamePlayer NewOwner, GamePlayer Oldowner = null)
 {
     if (Oldowner == null)
     {
         State.IsBought[propertyID] = true;
         State.Ownership[propertyID] = NewOwner.OrderNumber;
         NewOwner.PlayerProperty.Add(new OwnedProperty(propertyID));
         //State.EventNotification = NewOwner.MyPlayer.PlayerName + " koopt " + State.LocalCardData[propertyID].Name 
            // + " van de bank";
     }
     else
     {
         OwnedProperty toRemove = null;
         State.Ownership[propertyID] = NewOwner.OrderNumber;
         NewOwner.PlayerProperty.Add(new OwnedProperty(propertyID));
         for (int i = 0; i < Oldowner.PlayerProperty.Count; i++)
         {
             if (Oldowner.PlayerProperty[i].ID == propertyID)
             {
                 toRemove = Oldowner.PlayerProperty[i];
             }
         }
         if (toRemove != null)
         {
             Oldowner.PlayerProperty.Remove(toRemove);
         }
     }
     SetlevelChange(NewOwner, propertyID);
 }
Exemplo n.º 2
0
        private static void Morguage(GamePlayer Player, int propID, bool undo = false)
        {
            HouseCardData thishouse = (from h in Player.MyState.LocalCardData
                                       where h.ID == propID
                                       select h).FirstOrDefault();

            OwnedProperty local = (from h in Player.PlayerProperty
                                   where h.ID == propID
                                   select h).FirstOrDefault();
            if (!undo)
            {
                if (!local.Morguage)
                {
                    int updatedcash = 0;
                    local.Morguage = true;
                    updatedcash += local.HouseLevel * thishouse.HouseCost / 2;
                    local.HouseLevel = 0;
                    updatedcash += thishouse.BuyCost / 2;
                    Player.Cash += updatedcash;
                }
            }
            else
            {
                Player.Cash -= thishouse.BuyCost / 2;
                Player.Cash -= thishouse.BuyCost / 20;
                local.Morguage = false;
            }
        }
Exemplo n.º 3
0
 public static void BuyHouse(GamePlayer gPlayer, byte PropID)
 {            
     OwnedProperty prop = (from h in gPlayer.PlayerProperty
                           where h.ID == PropID
                           select h).FirstOrDefault();
     var house = (from h in gPlayer.MyState.LocalCardData
                          where h.ID == PropID
                          select h).FirstOrDefault();            
     if (prop.HouseLevel <= 5 && prop.Morguage == false && prop.SetLevel == 1 && house.Type == "Standard")
     {
         gPlayer.Cash -= house.HouseCost;
         prop.HouseLevel++;
     }
     gPlayer.MyState.EventNotification = gPlayer.MyPlayer.PlayerName + " koopt een huis op " + gPlayer.MyState.LocalCardData[PropID].Name;
 }
Exemplo n.º 4
0
 public static void ToggleMorguage(Player P, GameState State, int ID)
 {
     GamePlayer local = State.ReturnPlayerByBasePlayer(P);
     OwnedProperty mProp = (from h in local.PlayerProperty
                            where h.ID == ID
                            select h).FirstOrDefault();
     if (mProp.Morguage)
     {
         Morguage(local, ID, true);
         State.EventNotification = P.PlayerName + " zet " + State.LocalCardData[ID].Name + " in hypoteek";
     }
     else
     {
         Morguage(local, ID);
         State.EventNotification = P.PlayerName + " betaalt de hypoteek op " + State.LocalCardData[ID].Name;
     }
 }
Exemplo n.º 5
0
        private static void ReturnPropertyToBank(GamePlayer gPlayer, int PropId)
        {
            gPlayer.MyState.IsBought[PropId] = false;
            gPlayer.MyState.Ownership[PropId] = null;
            OwnedProperty toRemove = null;
            for (int i = 0; i < gPlayer.PlayerProperty.Count; i++)
            {
                if (gPlayer.PlayerProperty[i].ID == PropId)
                {
                    toRemove = gPlayer.PlayerProperty[i];
                }
            }
            if (toRemove != null)
            {
                gPlayer.PlayerProperty.Remove(toRemove);
            }

        }
Exemplo n.º 6
0
        private static void SetlevelChange(GamePlayer gPlayer, int ID)
        {
            var house = (from h in gPlayer.MyState.LocalCardData
                         where h.ID == ID
                         select h).FirstOrDefault();
            int toCheck = house.Group;
            byte locallevel = 0;
            foreach (var item in gPlayer.PlayerProperty)
            {
                var Lhouse = (from h in gPlayer.MyState.LocalCardData
                              where h.ID == item.ID
                              select h).FirstOrDefault();
                if (Lhouse.Group == toCheck)
                {
                    locallevel++;
                }
            }
            bool updateLevel = false;
            byte leveltoset = 0;
            switch (toCheck)
            {
                case 1:
                case 8:
                case 10:
                    if (locallevel == 2)
                    {
                        updateLevel = true;
                        leveltoset = 1;
                    }
                    break;
                case 9:
                    if (locallevel == 2)
                    {
                        updateLevel = true;
                        leveltoset = 1;
                    }
                    if (locallevel == 3)
                    {
                        updateLevel = true;
                        leveltoset = 2;
                    }
                    if (locallevel == 4)
                    {
                        updateLevel = true;
                        leveltoset = 3;
                    }
                    break;
                default:
                    if (locallevel == 3)
                    {
                        updateLevel = true;
                        leveltoset = 1;
                    }
                    break;
            }
            if (updateLevel)
            {
                for (int i = 0; i < gPlayer.PlayerProperty.Count; i++)
                {
                    OwnedProperty temp = gPlayer.PlayerProperty[i];
                    var Thouse = (from h in gPlayer.MyState.LocalCardData
                                  where h.ID == temp.ID
                                  select h).FirstOrDefault();
                    if (Thouse.Group == leveltoset)
                    {
                        temp.SetLevel = leveltoset;
                    }

                }
            }


        }
Exemplo n.º 7
0
 private static void PayRent(HouseCardData house, GamePlayer payingPlayer, GamePlayer landLord)
 {
     int cashToPay = 0;
     int diceout = 0;
     foreach (var item in payingPlayer.MyState.lastDieRoll)
     {
         diceout += item;
     }
     OwnedProperty prop = (from h in landLord.PlayerProperty
                           where h.ID == house.ID
                           select h).FirstOrDefault();
     if (!prop.Morguage)
     {
         switch (house.Type)
         {
             case "Standard":
                 switch (prop.HouseLevel)
                 {
                     case 0:
                         if (prop.SetLevel == 1)
                         {
                             cashToPay = house.Rent0 * 2;
                         }
                         else
                         {
                             cashToPay = house.Rent0;
                         }
                         break;
                     case 1:
                         cashToPay = house.Rent1;
                         break;
                     case 2:
                         cashToPay = house.Rent2;
                         break;
                     case 3:
                         cashToPay = house.Rent3;
                         break;
                     case 4:
                         cashToPay = house.Rent4;
                         break;
                     case 5:
                         cashToPay = house.Rent5;
                         break;
                     default:
                         break;
                 }
                 break;
             case "Station":
                 switch (prop.SetLevel)
                 {
                     case 0:
                         cashToPay = house.Rent0;
                         break;
                     case 1:
                         cashToPay = house.Rent1;
                         break;
                     case 2:
                         cashToPay = house.Rent2;
                         break;
                     case 3:
                         cashToPay = house.Rent3;
                         break;
                     default:
                         break;
                 }
                 break;
             case "NutsVoorziening":
                 if (prop.SetLevel == 1)
                 {
                     cashToPay = house.Rent1 * diceout;
                 }
                 else
                 {
                     cashToPay = house.Rent0 * diceout;
                 }
                 break;
             default:
                 break;
         }
     }
     payingPlayer.Cash -= cashToPay;
     payingPlayer.MyState.EventNotification = payingPlayer.MyPlayer.PlayerName + " betaalt " + cashToPay.ToString() +
         " huur aan " + landLord.MyPlayer.PlayerName;
 }