Пример #1
0
 private static bool gapclosePath(Obj_AI_Base target)
 {
     first_unit  = new JumpUnit(player.Position, player);
     second_unit = new JumpUnit(target.Position, target);
     if (player.Distance(target) < 800)
     {
         return(true);
     }
     Chat.Print("First check done. Proceed to find units.");
     foreach (Obj_AI_Base candidate in ObjectManager.Get <Obj_AI_Base>())
     {
         if (candidate.IsValidTarget(R.Range, true) &&
             first_unit.unit.Distance(target, true) > candidate.Distance(target, true))
         {
             first_unit = new JumpUnit(candidate.Position, candidate);
         }
     }
     Chat.Print("First unit found. Checks to return.");
     if (first_unit.unit.Distance(target) < 800)
     {
         return(true);
     }
     Chat.Print("First unit found. Proceed to find another.");
     foreach (Obj_AI_Base candidate in ObjectManager.Get <Obj_AI_Base>())
     {
         if (candidate.IsValidTarget(R.Range, true) &&
             second_unit.unit.Distance(player, true) > candidate.Distance(target, true))
         {
             second_unit = new JumpUnit(candidate.Position, candidate);
         }
     }
     Chat.Print("Second unit found. Proceed to checks.");
     if (first_unit.unit.Distance(second_unit.Position) > 800)
     {
         return(false);
     }
     if (first_unit.unit.Distance(target) < second_unit.unit.Distance(target))
     {
         first_unit  = second_unit;
         second_unit = new JumpUnit(target.Position, target);
     }
     Chat.Print("Checks done. Returning.");
     return(true);
 }
Пример #2
0
 private static bool gapclosePath(Obj_AI_Base target)
 {
     first_unit = new JumpUnit(player.Position, player);
     second_unit = new JumpUnit(target.Position, target);
     if (player.Distance(target) < 800) return true;
     Game.PrintChat("First check done. Proceed to find units.");
     foreach (Obj_AI_Base candidate in ObjectManager.Get<Obj_AI_Base>())
         if (candidate.IsValidTarget(R.Range, true) &&
             first_unit.unit.Distance(target, true) > candidate.Distance(target, true)) first_unit = new JumpUnit(candidate.Position, candidate);
     Game.PrintChat("First unit found. Checks to return.");
     if (first_unit.unit.Distance(target) < 800) return true;
     Game.PrintChat("First unit found. Proceed to find another.");
     foreach (Obj_AI_Base candidate in ObjectManager.Get<Obj_AI_Base>())
         if (candidate.IsValidTarget(R.Range, true) &&
             second_unit.unit.Distance(player, true) > candidate.Distance(target, true)) second_unit = new JumpUnit(candidate.Position, candidate);
     Game.PrintChat("Second unit found. Proceed to checks.");
     if (first_unit.unit.Distance(second_unit.Position) > 800)
         return false;
     if (first_unit.unit.Distance(target) < second_unit.unit.Distance(target))
     {
         first_unit = second_unit;
         second_unit = new JumpUnit(target.Position, target) ;
     }
     Game.PrintChat("Checks done. Returning.");
     return true;
 }