Beispiel #1
0
        public bool GoToFighting(bool isSkip = false)
        {
            Delegater.WaitTrue(() =>
            {
                //_dm.FindPicAndClick(395, 311, 574, 393, @"\bmp\上阵.bmp");
                if (!_dm.FindPicAndClick(116, 72, 936, 351, @"\bmp\战斗.bmp"))
                {
                    _dm.FindMultiColorAndClick(122, 58, 318, 196, "ffb40b", "19|-17|ffb814,35|0|ffb40b-202020,34|-34|fff303-202020,25|-25|ffdd12,26|-4|ff8804,8|-7|ff9907,28|-29|ffe009", -17, 59);
                }
                if (_dm.IsExistPic(405, 190, 525, 251, @"\bmp\达到上限.bmp"))
                {
                    _dm.MoveToClick(548, 360);
                    _dm.Delay(1000);
                }
                if (_dm.IsExistPic(394, 216, 567, 307, @"\bmp\VS.bmp"))
                {
                    _dm.Delay(500);
                    _dm.MoveToClick(64, 50);  //清除教程提示
                    Delegater.WaitTrue(() =>
                    {
                        //补充兵力
                        SupplementarySoldier(696, 156, 792, 180, 747, 112);
                        SupplementarySoldier(564, 154, 658, 180, 610, 118);
                        SupplementarySoldier(433, 156, 531, 179, 485, 111);
                        SupplementarySoldier(304, 157, 395, 178, 355, 106);
                        SupplementarySoldier(175, 157, 263, 180, 219, 111);
                        _dm.Delay(500);
                        _dm.MoveToClick(807, 259);   //点击开战
                        _dm.Delay(1000);
                        if (_dm.IsExistPic(319, 197, 448, 247, @"\bmp\兵力不足.bmp"))
                        {
                            _dm.MoveToClick(548, 360);
                            _dm.Delay(1000);
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }, () => _dm.IsExistPic(5, 40, 48, 102, @"\bmp\攻方.bmp", 0.7),
                                       () => _dm.Delay(1000)); //点击战斗

                    战术 tactics, recentTactics = 战术.无法识别;
                    while (true)
                    {
                        if (!_dm.IsExistPic(394, 216, 567, 307, @"\bmp\VS.bmp", 0.8, false) && _dm.IsExistPic(762, 4, 953, 87, @"\bmp\返回.bmp", 0.8, false) && isSkip)
                        {
                            _dm.MoveToClick(840, 43);   //点击跳过
                            _dm.Delay(3000);
                        }
                        if (_dm.IsExistPic(330, 45, 639, 184, @"\bmp\胜利.bmp", 0.8, false))
                        {
                            return(true);
                        }
                        if (_dm.IsExistPic(318, 36, 637, 195, @"\bmp\失败.bmp", 0.8, false))
                        {
                            return(true);
                        }
                        tactics = GetLastTactics();    //获取战术
                        if (tactics >= 0)
                        {
                            recentTactics = tactics;
                        }
                        if (_dm.IsExistPic(310, 132, 445, 295, @"\bmp\战斗选择.bmp", 0.8, false))
                        {
                            if (!_dm.FindMultiColorAndClick(330, 119, 637, 416, "828175", "-53|53|a5a5a0,56|42|828274-202020,37|11|443a3b-202020,-42|21|fffeff,57|62|685b5a,-39|18|fffefe,-49|37|dbd8cd", 0, 0, 0.9))
                            {
                                switch (recentTactics)
                                {
                                case 战术.防御:
                                    _dm.MoveToClick(581, 316);      //点击攻击
                                    break;

                                case 战术.突击:
                                    _dm.MoveToClick(370, 318);      //点击防御
                                    break;

                                case 战术.攻击:
                                    _dm.MoveToClick(474, 152);      //点击突击
                                    break;

                                default:
                                    _dm.DebugPrint("战术无法识别!");
                                    break;
                                }
                            }
                        }
                        _dm.Delay(1000);
                    }
                }
                return(false);
            });
            if (_dm.IsExistPic(330, 45, 639, 184, @"\bmp\胜利.bmp"))
            {
                _dm.MoveToClick(916, 45); //点击返回
                _dm.Delay(1000);
                return(true);
            }
            if (_dm.IsExistPic(318, 36, 637, 195, @"\bmp\失败.bmp"))
            {
                Delegater.WaitTrue(() => _dm.MoveToClick(916, 45),
                                   () => _dm.IsExistPic(818, 281, 953, 447, @"\bmp\主城.bmp") || _dm.IsExistPic(818, 281, 953, 447, @"\bmp\副本.bmp"),
                                   () => _dm.Delay(1000));
                return(false);
            }
            return(false);
        }