Advertisement
kolton

Untitled

May 20th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. /**
  2. * @filename Mephisto.js
  3. * @author kolton
  4. * @desc kill Mephisto
  5. */
  6.  
  7. function Mephisto() {
  8. this.killMephisto = function () {
  9. var i, angle, angles,
  10. pos = {},
  11. attackCount = 0,
  12. meph = getUnit(1, 242);
  13.  
  14. if (!meph) {
  15. throw new Error("Mephisto not found!");
  16. }
  17.  
  18. if (Config.MFLeader) {
  19. Pather.makePortal();
  20. say("kill " + meph.classid);
  21. }
  22.  
  23. while (attackCount < 300 && Attack.checkMonster(meph)) {
  24. //if (getUnit(3, 276)) {
  25. if (meph.mode === 5) {
  26. //if (attackCount % 2 === 0) {
  27. angle = Math.round(Math.atan2(me.y - meph.y, me.x - meph.x) * 180 / Math.PI);
  28. angles = me.y > meph.y ? [-30, -60, -90] : [30, 60, 90];
  29.  
  30. for (i = 0; i < angles.length; i += 1) {
  31. //pos.dist = Math.round(getDistance(me, meph));
  32. pos.dist = 18;
  33. pos.x = Math.round((Math.cos((angle + angles[i]) * Math.PI / 180)) * pos.dist + meph.x);
  34. pos.y = Math.round((Math.sin((angle + angles[i]) * Math.PI / 180)) * pos.dist + meph.y);
  35.  
  36. if (Attack.validSpot(pos.x, pos.y)) {
  37. me.overhead("move, bitch!");
  38. Pather.moveTo(pos.x, pos.y);
  39.  
  40. break;
  41. }
  42. }
  43. }
  44.  
  45. if (ClassAttack.doAttack(meph) < 2) {
  46. break;
  47. }
  48.  
  49. attackCount += 1;
  50. }
  51.  
  52. return (meph.mode === 0 || meph.mode === 12);
  53. };
  54.  
  55. this.moat = function () {
  56. var count, distance, mephisto;
  57.  
  58. count = 0;
  59.  
  60. delay(350);
  61. Pather.moveTo(17563, 8072);
  62.  
  63. mephisto = getUnit(1, 242);
  64.  
  65. if (!mephisto) {
  66. throw new Error("Mephisto not found.");
  67. }
  68.  
  69. delay(350);
  70. Pather.moveTo(17575, 8086);
  71. delay(350);
  72. Pather.moveTo(17584, 8091);
  73. delay(1200);
  74. Pather.moveTo(17600, 8095);
  75. delay(550);
  76. Pather.moveTo(17610, 8094);
  77. delay(2500);
  78. Attack.clear(10);
  79. Pather.moveTo(17610, 8094);
  80.  
  81. distance = getDistance(me, mephisto);
  82.  
  83. while (distance > 27) {
  84. count += 1;
  85.  
  86. Pather.moveTo(17600, 8095);
  87. delay(150);
  88. Pather.moveTo(17584, 8091);
  89. delay(150);
  90. Pather.moveTo(17575, 8086);
  91. delay(150);
  92. Pather.moveTo(17563, 8072);
  93. delay(350);
  94. Pather.moveTo(17575, 8086);
  95. delay(350);
  96. Pather.moveTo(17584, 8091);
  97. delay(1200);
  98. Pather.moveTo(17600, 8095);
  99. delay(550);
  100. Pather.moveTo(17610, 8094);
  101. delay(2500);
  102. Attack.clear(10);
  103. Pather.moveTo(17610, 8094);
  104.  
  105. distance = getDistance(me, mephisto);
  106.  
  107. if (count >= 5) {
  108. throw new Error("Failed to lure Mephisto.");
  109. }
  110. }
  111.  
  112. return true;
  113. };
  114.  
  115. this.killCouncil = function () {
  116. var i, list,
  117. pos = [17665, 8096, 17604, 8018, 17605, 8121];
  118.  
  119. for (i = 0; i < pos.length; i += 2) {
  120. Pather.moveTo(pos[i], pos[i + 1]);
  121.  
  122. list = this.getCouncil();
  123.  
  124. if (list) {
  125. Attack.clearList(list);
  126. }
  127. }
  128. };
  129.  
  130. this.getCouncil = function () {
  131. var monsterList = [],
  132. monster = getUnit(1);
  133.  
  134. if (monster) {
  135. do {
  136. if ([345, 346, 347].indexOf(monster.classid) > -1 && Attack.checkMonster(monster)) {
  137. monsterList.push(copyUnit(monster));
  138. }
  139. } while (monster.getNext());
  140. }
  141.  
  142. return monsterList;
  143. };
  144.  
  145. Town.doChores();
  146. Pather.useWaypoint(101);
  147. Precast.doPrecast(true);
  148.  
  149. if (!Pather.moveToExit(102, true)) {
  150. throw new Error("Failed to move to Durance Level 3");
  151. }
  152.  
  153. Pather.moveTo(17566, 8069);
  154. this.killCouncil();
  155.  
  156. if (me.classid === 1) {
  157. if (Config.Mephisto.MoatTrick) {
  158. this.moat();
  159. Attack.kill(242); // Mephisto
  160. } else {
  161. this.killMephisto();
  162. }
  163. } else {
  164. Attack.kill(242); // Mephisto
  165. }
  166.  
  167. Pickit.pickItems();
  168. /*Pather.moveTo(17590, 8068);
  169. delay(1500);
  170. Pather.usePortal(null);*/
  171.  
  172. return true;
  173. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement