Ejemplo n.º 1
0
        public static void ProcessRandom(Game g, Player p)
        {
            var c = g.LastRandomCard;
            //get money
            if (c.RandomGroup == 1)
            {
                p.Money += c.Money;
                g.Tlogp("ProcessRandom.Random1.GetMoney", "получите {0}", "get money = {0}", c.Money.PrintMoney());

                g.ToRandomCell();
            }

            //go to cell
            if (c.RandomGroup == 2 || c.RandomGroup == 3)
            {
                g.MoveToCell();
            }

            //pay each player
            if (c.RandomGroup == 4)
            {
                g.Tlogp("ProcessRandom.PayEachPlayer", "заплатите каждому игроку 500K", "pay each player 500K");
                g.PayAmount = c.Money * (g.pcount - 1);
                g.Players.Where(x => x.Id != p.Id).ToList().ForEach(x => x.Money += c.Money);

                g.ToPay();

            }
            //key to out from police
            if (c.RandomGroup == 5)
            {
                p.FreePoliceKey++;
                g.ToRandomCell();
            }
            if (c.RandomGroup == -1)
            {
                g.Tlogp("ProcessRandom.PayBank", "заплатите банку", "pay to bank");
                g.ToPay(c.Money);

            }
            //pay for each house and hotel
            if (c.RandomGroup == 15)
            {
                g.Tlogp("ProcessRandom.FixHouses",
                   "Отремонтируйте ваши здания – $100K за дом, $400K за отель",
                   "You are assessed for street repairs – $100K per house, $400K per hotel");

                var hh = g.Map.GetHotelsAndHousesCount(p.Id);
                g.PayAmount = hh[0] * 400000 + hh[1] * 100000;
                g.ToPay();

            }
        }