Advertisement
kolton

Untitled

May 7th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. // Kill a monster based on its classId
  2. kill: function (classId) {
  3. if (Config.AttackSkill[1] < 0) {
  4. return false;
  5. }
  6.  
  7. var i, dodgeList, target,
  8. attackCount = 0;
  9.  
  10. for (i = 0; i < 3; i += 1) {
  11. target = getUnit(1, classId);
  12.  
  13. if (target) {
  14. break;
  15. }
  16.  
  17. delay(50);
  18. }
  19.  
  20. if (!target) {
  21. throw new Error("Attack.kill: Target not found");
  22. }
  23.  
  24. if (Config.MFLeader) {
  25. Pather.makePortal();
  26. say("kill " + classId);
  27. }
  28.  
  29. while (attackCount < 300 && this.checkMonster(target) && this.skipCheck(target)) {
  30. if (Config.Dodge) {
  31. dodgeList = this.buildDodgeList();
  32.  
  33. if (dodgeList.length) {
  34. dodgeList.sort(Sort.units);
  35.  
  36. if (getDistance(me, dodgeList[0]) < 13) {
  37. this.dodge(target, 20, dodgeList);
  38. }
  39.  
  40. dodgeList.sort(Sort.units);
  41.  
  42. if (getDistance(me, dodgeList[0]) < 13) {
  43. continue;
  44. }
  45. }
  46. }
  47.  
  48. Misc.townCheck(true);
  49.  
  50. if (ClassAttack.doAttack(target, attackCount % 15 === 0) < 2) {
  51. break;
  52. }
  53.  
  54. if (!copyUnit(target).x) { // Check if unit got invalidated, happens if necro raises a skeleton from the boss's corpse.
  55. return true;
  56. }
  57.  
  58. attackCount += 1;
  59. }
  60.  
  61. return (target.mode === 0 || target.mode === 12);
  62. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement