@@ -207,37 +207,23 @@ WriteLn Magic.CloseInfo();
207207function TRSMagic.CloseInfo(): Boolean;
208208var
209209 destination: TPoint;
210- timeout: UInt64;
211210begin
212211 destination := GameTab.Bounds.Expand(10).NearestEdge(Target.MouseXY);
213- AsyncMouse.Move(destination);
214212
215- timeout := Time() + 3000;
216-
217- while Self.InfoIsOpen() or (Time() > timeout) do
218- Sleep(20, 100, ERandomDir.LEFT);
219-
220- AsyncMouse.Stop();
221-
222- Result := not Self.InfoIsOpen();
213+ ASyncMouse.Move(destination);
214+ Result := SleepUntil(not Self.InfoIsOpen(), 35, 3000);
215+ ASyncMouse.Stop();
223216end;
224217
225- function TRSMagic.CloseInfo({$H-} spell: ERSSpell): Boolean; overload; {$H+}
218+ function TRSMagic.CloseInfo(spell: ERSSpell): Boolean; overload;
226219var
227220 destination: TPoint;
228- timeout: UInt64;
229221begin
230- destination := GameTab.Bounds.Expand(10).NearestEdge(Target.MouseXY);
231- AsyncMouse.Move(destination);
232-
233- timeout := Time() + 3000;
234-
235- while Self.InfoIsOpen() or (Time() > timeout) do
236- Sleep(20, 100, ERandomDir.LEFT);
237-
238- AsyncMouse.Stop();
222+ destination := Self.SpellCache[spell].Box.RandomPointCenter();
239223
240- Result := not Self.InfoIsOpen();
224+ ASyncMouse.Move(destination);
225+ Result := SleepUntil(not Self.InfoIsOpen(), 35, 3000);
226+ ASyncMouse.Stop();
241227end;
242228
243229
0 commit comments