Exemplo n.º 1
0
        //找到最近的玩家
        Player GetNearstPlayer()
        {
            Player best = null;
            float  len  = 999999;

            others.ForEach(x =>
            {
                if (!x.dead && Pt.Len(x.pos, me.pos) < len)
                {
                    best = x;
                    len  = Pt.Len(x.pos, me.pos);
                }
            });
            return(best);
        }
Exemplo n.º 2
0
 bool IsAnyBoomerHere()
 {
     return(others.Exists(x => Pt.Len(x.pos, me.pos) <= 2 && x.bomb_cd > 0));
 }
Exemplo n.º 3
0
        /// <summary>
        /// 人工智能的崛起,根据环境只适应变化,并主动迭代升级
        /// </summary>
        void RefreshSetting()
        {
            Player aim = GetNearstPlayer();

            nearst_enemy_len = Pt.Len(aim.pos, me.pos);
            //1000为平常
            if (nearst_enemy_len < 8)
            {
                enemy_bonus = 500 + (8 - (int)nearst_enemy_len) * 250;   //max:2500
            }
            if (GetBoxCount() < 7 || go.GetRemainingTime() < 30)
            {
                //enemy_bonus += (10 - GetBoxCount()) * 200;  //max:2000
                if (GetBoxCount() < 10)
                {
                    bonus_box = 1500 + (10 - GetBoxCount()) * 50;
                }
            }


            if (others.Exists(x => x.hp - me.hp >= 20) && me.hp < 50)
            {
                enemy_bonus += -1000 - (50 - me.hp) * 60;  //max:-4000
            }
            //保重身体
            if (me.hp < 20 && go.GetRemainingTime() > 10 && GetBoxCount() > 4)
            {
                enemy_bonus += -2000;
            }


            if (me.shoot_cd > 0)
            {
                enemy_bonus += -(int)(me.shoot_cd * 500);
            }
            if (me.bomb_cd == 0)
            {
                enemy_bonus += -2000;
            }



            //移动消耗动态变化
            if (go.CanBomb())
            {
                move_bonus = -250;
            }
            else
            {
                move_bonus = -200;
            }

            //不要挨近我!
            if (disgust > 4000)
            {
                disgust = 4000;
            }
            if (disgust > 0)
            {
                disgust -= 15;
            }
            if (disgust < 0)
            {
                disgust = 0;
            }
            //1s---->+1500
            if (nearst_enemy_len < 1)
            {
                disgust += 45;
            }

            enemy_bonus -= disgust;
        }