コード例 #1
0
ファイル: MaxHunt.cs プロジェクト: noobjoker/PokemonTycoon
 bool CheckTarget(Target target, bool print = true)
 {
     try
     {
         if (!print)
         {
             LogEnabled = false;
         }
         var stars = Module <Battle.Raid>().GetStars();
         _vars.StarCount[stars]++;
         var shadows = VideoCapture.GetMatchedShadows();
         UpdateSummary();
         Msg(new string('★', stars));
         if (target != null && target.Stars[stars] == false)
         {
             Msg(Colors.Fail, "星数不匹配");
             return(false);
         }
         bool success = false;
         if (shadows.Length == 0)
         {
             Msg("#??? 未知剪影");
             success = target != null && target.Pokemons.Any(u => u.ID == 0);
         }
         else
         {
             StringBuilder message = new StringBuilder();
             foreach (var shadow in shadows)
             {
                 if (message.Length > 0)
                 {
                     message.Append(" / ");
                 }
                 message.Append(shadow);
                 if (target != null && target.Pokemons.Any(u => u.ID == shadow.ID && u.Variance == shadow.Variance))
                 {
                     success = true;
                 }
             }
             Msg(message);
         }
         if (success)
         {
             Msg(Colors.Success, "已找到目标");
             return(true);
         }
         else if (target != null && target.Pokemons.Count == 0)
         {
             return(true);
         }
         if (target != null)
         {
             Msg(Colors.Fail, "剪影不匹配");
         }
         return(false);
     }
     finally
     {
         if (!print)
         {
             LogEnabled = true;
         }
     }
 }