public static bool CanOutFromPolice(Game g) { var p = g.Curr; bool rollDouble = p.LastRoll[0] == p.LastRoll[1]; if (rollDouble) return true; if (p.IsBot && BotBrain.ShouldGoFromPolice(g)) { g.Tlogp("step.PoliceOut", "заплатил 500 k$, чтобы выйти", "you paid 500 k$ to out"); PlayerAction.Pay(g, 500000); return true; } else { p.Police++; if (p.Police == 4) { g.Tlogp("ProcessPolice.PoliceOut", "заплатите 500 k$, чтобы выйти", "you need pay 500 k$ to out"); g.PayAmount = 500000; g.ToPay(false); return true; } else { g.Tlogp("ProcessPolice.PoliceCatch", "вы можете заплатить и выйти ", "you can pay 500 k$ and out"); return false; } } return false; }
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(); } }
public static void ProcessPosition(Game g) { var p = g.Curr; //general land var cell = g.Cells[p.Pos]; if (cell.IsLand) { ProcessLand(g, p, cell); } //interpol if (p.Pos == 30) { PlayerStep.MoveFrom30(g); //g.MoveToCell(); } // tax if (cell.Type == 6) { //g.logp(g.Text("ProcessPosition.PayTax", "заплатите налог", "you need pay tax ")); g.ToPay(cell.Rent); } //var offPos = new[] { 2, 7, 17, 22, 33, 36 }; if (cell.Type == 4) { g.Map.TakeRandomCard(); g.FixAction("random"); ProcessRandom(g, p); } else if (p.Pos == 20 || p.Pos == 0 || (p.Pos == 10 && p.Police == 0)) g.FinishStep("cell_" + p.Pos); }
public static void ProcessLand(Game g, Player p, CellInf cell) { if (cell.Owner == null) { g.ToCanBuy(); } else if (cell.Owner != p.Id) { if (cell.IsMortgage) { g.Tlogp("ProcessLand.CellIsMortgaged", "земля {0} заложена", "land {0} is mortgaged ", cell.Name); g.FinishStep("cell_mortgaged"); } else { //pay rent g.PayToUserId = cell.Owner.Value; g.ToPay(cell.Rent); } } else if (cell.Owner == p.Id) { g.Tlogp("ProcessLand.MyCell", "ваше поле {0}", "your cell {0} ", cell.Name); g.FinishStep("mycell"); } }