Exemple #1
0
        public static void CheckAuction(Game g, Player bot)
        {
            var p = bot;

            var cell = g.currAuction.cell;

            var sum = g.GetPlayerCash(p.Id);

            var fact = BotBrain.FactorOfBuy(g, p, cell);

            var aucSum = cell.Cost * fact;

            if (sum >= aucSum && aucSum > g.currAuction.nextBid)
            {
                g.currAuction.currBid = g.currAuction.nextBid;
                g.Tlog("Auction.Yes", "@p{0} дает {1}", "@p{0} bid {1}", p.Id, g.currAuction.currBid.PrintMoney());
                g.currAuction.LastBiddedPlayer = p;

            }
            else
            {
                g.Tlog("Auction.No", "@p{0} выбывает", "@p{0} is out", p.Id);
                //g.aucState.allPlayers = g.aucState.allPlayers.Where(x => x.Id != p.Id).ToList();
                p.InAuction = false;
            }
        }
Exemple #2
0
        public static double FactorOfBuy(Game g, Player p, CellInf cell)
        {
            double isNeedBuy = 0;
            if (GameHelper.GetPlayerAssets(g, p.Id) < cell.Cost) return 0;

            var groupsWithHouses = BotBrainHouses.GetGroupsWhereNeedBuildHouses(g, p);
            var needBuild = groupsWithHouses.Any();

            //--buy
            var gg = g.Map.CellsByGroup(cell.Group);

            //other monopoly
            var notMine = gg.Where(x => x.Owner.HasValue && x.Owner != p.Id);

            var myCount = gg.Count(x => x.Owner == p.Id);

            int aCount = 0;
            int? owPid = null;

            if (notMine.Any())
            {
                aCount = notMine.Max(x => x.OwGrCount);
                owPid = notMine.First(x => x.OwGrCount == aCount).Owner;
            }

            var manualFactor = GetManualFactor(g.AucRules, cell.Group, myCount, aCount, groupsWithHouses);
            if (manualFactor.HasValue) return manualFactor.Value;

            var cg = cell.Group;

            //if another monopoly
            if (aCount == 2 && owPid.HasValue)
            {
                var sum = g.GetPlayerCash(owPid.Value);
                if (cg == 2 && sum > 4000000) return 100;
                if (cg == 3 && sum > 4000000) return 100;
                if (cg == 4 && sum > 5000000) return 100;
                if (cg == 5 && sum > 7000000) return 100;

                if (cell.Type == 1) return 1.7;
            }

            if (needBuild) return 0;

            if (cg == 1 || cg == 8)
                isNeedBuy = Factor_1_8(cg, aCount);

            if (cg == 11 && !needBuild)
            {
                if (aCount > 2) isNeedBuy = 2;
                else
                    isNeedBuy = 1.5;

            }
            if (cg == 33)
                isNeedBuy = Factor_11_33(cg, aCount);

            //my second cell
            if (myCount == 1) isNeedBuy = 2.2;

            //my monopoly
            if (myCount == 2) isNeedBuy = 3;

            if (aCount == 1 && cell.Group != 1 && cell.Group != 8) isNeedBuy = 2;

            //first land
            if (gg.Count(x => x.Owner == null) == 3 && !needBuild)
                isNeedBuy = 1.4;

            return isNeedBuy;
        }
Exemple #3
0
        public static void MakeAuctionYes(Game g, string userName)
        {
            var pl = g.GetPlayer(userName);

            if (pl == null) return;

            //StartAction(g);
            g.CleanTimeOut();

            var mm = g.GetPlayerCash(pl.Id);

            var LastBiddedPlayer = g.currAuction.LastBiddedPlayer;

            if (LastBiddedPlayer != null)
            {
                if (LastBiddedPlayer.Id == pl.Id) return;
            }

            if (mm >= g.currAuction.nextBid)
            {
                g.currAuction.currBid += 50000;
                g.Tlog("Auction.Yes", "@p{0} дает {1}", "@p{0} bid {1}", pl.Id, g.currAuction.currBid.PrintMoney());
                g.currAuction.LastBiddedPlayer = pl;

            }
            else
            {
                g.Tlog("PlayerAction.AuctionYes.NoMoney", "@p{0} не хватает денег ", "@p{0} no money", pl.Id);
                pl.InAuction = false;
            }
            //GameManager.CheckAuctionWinner(g);
        }