Advertisement
kolton

Untitled

Nov 1st, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.77 KB | None | 0 0
  1. var NTA_DAMAGE_NONE = 0;
  2. var NTA_DAMAGE_PHYSICAL = 1;
  3. var NTA_DAMAGE_MAGIC = 2;
  4. var NTA_DAMAGE_FIRE = 3;
  5. var NTA_DAMAGE_LIGHTNING = 4;
  6. var NTA_DAMAGE_COLD = 5;
  7. var NTA_DAMAGE_POISON = 6;
  8.  
  9. var MODE_DEAD = (1<<29)|(1<<12);
  10. var MODE_ALIVE = (1<<29)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<13)|(1<<14)|(1<<15);
  11. var TYPE_NOT_NORMAL = 0xf;
  12.  
  13. var _NTA_SkillHand = [];
  14. var _NTA_SkillDamage = [];
  15. var _NTA_SkillRange = [];
  16. var _NTA_SkillDelay = [];
  17.  
  18. var _NTA_NovaTick;
  19.  
  20. var gidList = [];
  21.  
  22. function NTA_FastPick() {
  23. if (!NTConfig_FastPick || !gidList.length) {
  24. return;
  25. }
  26.  
  27. var i, item, string, result,
  28. gidListLength = gidList.length;
  29.  
  30. for (i = 0; i < gidListLength; i += 1) {
  31. if (!gidList[i]) {
  32. continue;
  33. }
  34.  
  35. item = NTC_GetUnit(NTC_UNIT_ITEM, null, null, gidList[i]);
  36.  
  37. if (item && (item.mode === 3 || item.mode === 5)) {
  38. result = NTSI_CheckItem(item, false);
  39.  
  40. if (result && !NTSI_IsLimitedItemInt(item) && NTT_CheckSpace(item.sizex, item.sizey)) {
  41. string = ("ÿc2Fast Pick ÿc8:: " + NTC_ItemQualityToD2Color[item.quality] + item.name);
  42.  
  43. if (NTSI_PickUpItemInt(item)) {
  44. print(string);
  45.  
  46. if (result === 1 && item.itemType !== 4 && (item.itemType < 76 || item.itemType > 81)) {
  47. DDE.logItem(item);
  48. }
  49. }
  50. }
  51. }
  52. }
  53.  
  54. gidList = [];
  55. }
  56.  
  57. function NTA_Initialize()
  58. {
  59. /* FIX
  60. if(NTConfig_AttackSkill[1] == -1 || NTConfig_AttackSkill[3] == -1)
  61. NTA_DetectAttackPattern();
  62. */
  63.  
  64. for(var i = 0 ; i < NTConfig_AttackSkill.length ; i++)
  65. {
  66. if(NTConfig_AttackSkill[i] > -1)
  67. {
  68. _NTA_SkillHand[i] = NTC_IsLeftSkill(NTConfig_AttackSkill[i]) ? 2 : NTC_HAND_RIGHT;
  69. _NTA_SkillDamage[i] = NTA_GetDamageType(NTConfig_AttackSkill[i]);
  70. _NTA_SkillDelay[i] = NTC_GetCastDelay(NTConfig_AttackSkill[i]);
  71.  
  72. switch(NTConfig_AttackSkill[i])
  73. {
  74. case 0: // Normal Attack
  75. case 10: // Jab
  76. case 14: // Power Strike
  77. case 19: // Impale
  78. case 24: // Charged Strike
  79. case 73: // Poison Dagger
  80. case 96: // Sacrifice
  81. case 97: // Smite
  82. case 106: // Zeal
  83. case 111: // Vengeance
  84. case 116: // Conversion
  85. case 126: // Bash
  86. case 133: // Double Swing
  87. case 139: // Stun
  88. case 144: // Concentrate
  89. case 147: // Frenzy
  90. case 152: // Berserk
  91. case 255: // Dragon Talon
  92. case 260: // Dragon Claw
  93. case 270: // Dragon Tail
  94. _NTA_SkillRange[i] = 2;
  95. _NTA_SkillHand[i] = 1; // bypass shift
  96. break;
  97. case 42: // Static
  98. _NTA_SkillRange[i] = Math.floor((5 + NTC_CheckSkill(42) - 1) * 2/3);
  99. _NTA_SkillHand[i] = 2;
  100. break;
  101. case 49: // lightning
  102. case 53: // chain lightning
  103. _NTA_SkillRange[i] = 15;
  104. break;
  105. case 44: // Frost Nova
  106. case 48: // Nova
  107. _NTA_SkillRange[i] = 7;
  108. break;
  109. case 51: // Fire Wall
  110. _NTA_SkillRange[i] = 10;
  111. break;
  112. case 64: // Frozen Orb
  113. _NTA_SkillRange[i] = 15;
  114. break;
  115. case 92: // Poison Nova
  116. _NTA_SkillRange[i] = 12;
  117. break;
  118. case 112: // Blessed Hammer
  119. _NTA_SkillRange[i] = 3;
  120. break;
  121. case 151: // Whirlwind
  122. _NTA_SkillRange[i] = 8;
  123. break;
  124. case 245: // Tornado
  125. _NTA_SkillRange[i] = 6;
  126. break;
  127. default:
  128. _NTA_SkillRange[i] = 30;
  129. break;
  130. }
  131. }
  132. }
  133. }
  134.  
  135. function NTA_KillBoss(classid)
  136. {
  137. var _target;
  138.  
  139. if(NTConfig_AttackSkill[1] < 0)
  140. return false;
  141.  
  142. _target = NTC_GetUnit(NTC_UNIT_MONSTER, classid);
  143.  
  144. if(!_target)
  145. return false;
  146.  
  147. //print("ÿc4" + _target.name + "ÿc3 Cold Res: ÿc0" + NTA_GetResistance(_target, NTA_DAMAGE_COLD) + "ÿc9 Light Res:ÿc0 " + NTA_GetResistance(_target, NTA_DAMAGE_LIGHTNING) + " ÿc1Fire Res: ÿc0" + NTA_GetResistance(_target, NTA_DAMAGE_FIRE))
  148.  
  149. var _attackcount = 0;
  150.  
  151. while (_attackcount < 300 && NTA_IsValidTarget(_target)) {
  152. if (NTA_Attack(_target, (_attackcount%30) == 0) < 2) {
  153. break;
  154. }
  155.  
  156. _attackcount++;
  157. }
  158.  
  159. NTA_FastPick();
  160.  
  161. return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
  162. }
  163.  
  164. function NTA_ClearPosition(range, spectype, sortFunc) {
  165. if (arguments.length < 1) {
  166. range = 25;
  167. }
  168.  
  169. if (arguments.length < 2) {
  170. spectype = false;
  171. }
  172.  
  173. var orgx, orgy, target, result, monsterList, ignoreList, dodgeList,
  174. gidAttack = [],
  175. dodgeIDs = [310, 362],
  176. attackCount = 0;
  177.  
  178. if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
  179. return false;
  180. }
  181.  
  182. orgx = me.x;
  183. orgy = me.y;
  184. ignoreList = [];
  185.  
  186. while (attackCount < 300) {
  187. if (attackCount % 5 === 0) { // testing
  188. monsterList = [];
  189. dodgeList = [];
  190.  
  191. target = NTC_GetUnit(NTC_UNIT_MONSTER, null, MODE_ALIVE);
  192.  
  193. if (target) {
  194. do {
  195. if (ignoreList.indexOf(target.gid) === -1 && getDistance(orgx, orgy, target.x, target.y) <= range && (!spectype || target.spectype & spectype)) {
  196. monsterList.push(copyUnit(target));
  197. }
  198.  
  199. if (NTConfig_Dodge && dodgeIDs.indexOf(target.classid) > -1) {
  200. dodgeList.push(copyUnit(target));
  201. }
  202. } while (target.getNext());
  203. }
  204. }
  205.  
  206. if (monsterList.length === 0) {
  207. break;
  208. }
  209.  
  210. if (arguments.length >= 3 && typeof(sortFunc) === 'function') {
  211. monsterList.sort(sortFunc);
  212. } else {
  213. monsterList.sort(NTA_SortMonsters);
  214. }
  215.  
  216. target = monsterList[0];
  217.  
  218. if (NTA_IsValidTarget(target)) {
  219. if (me.classid === 1) {
  220. NTA_Dodge(target, 15, dodgeList);
  221. }
  222.  
  223. result = NTA_Attack(target, attackCount % 30 === 0);
  224.  
  225. switch (result) {
  226. case 1:
  227. print("att fail");
  228. monsterList.shift();
  229. ignoreList.push(target.gid);
  230. break;
  231. case 2:
  232. case 3:
  233. if (!target.spectype & 0x7) {
  234. if(!gidAttack[target.gid]) {
  235. gidAttack[target.gid] = 0;
  236. }
  237.  
  238. gidAttack[target.gid] += 1;
  239.  
  240. if (gidAttack[target.gid] > 8) {
  241. print("Skipping " + target.name);
  242. monsterList.shift();
  243. ignoreList.push(target.gid);
  244. }
  245. }
  246.  
  247. attackCount += 1;
  248.  
  249. if (target.mode === 0 || target.mode === 12) {
  250. NTA_FastPick();
  251. }
  252.  
  253. break;
  254. default:
  255. return false;
  256. }
  257. } else {
  258. monsterList.shift();
  259. ignoreList.push(target.gid);
  260. }
  261. }
  262.  
  263. switch (me.classid) {
  264. case NTC_CHAR_CLASS_PALADIN:
  265. if (attackCount > 2 && NTConfig_Redemption != false) {
  266. if (Math.round(me.hp * 100 / me.hpmax) < NTConfig_Redemption[0] || Math.round(me.mp * 100 / me.mpmax) < NTConfig_Redemption[1]) {
  267. NTC_PutSkill(124, NTC_HAND_RIGHT);
  268. NTC_PingDelay(1000);
  269. }
  270. }
  271.  
  272. break;
  273. }
  274.  
  275. if (attackCount > 0) {
  276. NTSI_PickItems();
  277. NTT_CleanPotions();
  278. }
  279.  
  280. return true;
  281. }
  282.  
  283. function NTA_Dodge(target, distance, list) { // experimental dodge function
  284. if (!NTConfig_Dodge) {
  285. return true;
  286. }
  287.  
  288. var i, j, coordx, coordy, monster, count,
  289. maxcount = 99,
  290. coords = [],
  291. goodCoords = [],
  292. angles = [45, 90, 135, 180, 225, 270, 305, 360];
  293.  
  294. // step 1 - build possible dodge positions based on angles
  295.  
  296. for (i = 0; i < angles.length; i = i + 1) {
  297. coordx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * distance + target.x);
  298. coordy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * distance + target.y);
  299.  
  300. if (NTA_IsValidSpot(coordx, coordy)) {
  301. coords.push([coordx, coordy]);
  302. }
  303. }
  304.  
  305. if (coords.length === 0) { // no valid positions - don't move
  306. me.overhead("Can't dodge :(");
  307. return true;
  308. }
  309.  
  310. coords.sort(NTA_SortRoomInt);
  311.  
  312. for (i = 0; i < coords.length; i += 1) {
  313. count = 0;
  314.  
  315. for (j = 0; j < list.length; j += 1) {
  316. if (list[j].hp > 0 && getDistance(list[j].x, list[j].y, coords[i][0], coords[i][1]) < 8) {
  317. count += 1;
  318. }
  319. }
  320.  
  321. if (count < maxcount) {
  322. goodCoords = [coords[i][0], coords[i][1]];
  323. maxcount = count;
  324.  
  325. if (count === 0) {
  326. break;
  327. }
  328. }
  329. }
  330.  
  331. if (goodCoords.length > 0) { // just in case goodCoords is empty (shouldn't happen)
  332. if (Math.abs(me.x - goodCoords[0]) < 5 && Math.abs(me.y - goodCoords[1]) < 5) { // close enough
  333. return true;
  334. }
  335.  
  336. me.overhead("Dodge " + target.name);
  337. NTM_MoveTo(goodCoords[0], goodCoords[1], 0, false, "dodge");
  338. }
  339.  
  340. return true;
  341. }
  342.  
  343. function NTA_ClearRooms(spectype) {
  344. var i, j, coll, room, rooms;
  345.  
  346. room = getRoom();
  347.  
  348. if (!room) {
  349. return false;
  350. }
  351.  
  352. if (arguments.length < 1) {
  353. spectype = false;
  354. }
  355.  
  356. rooms = [];
  357.  
  358. do {
  359. coll = room.getCollision();
  360.  
  361. main: for (i = 0; i < coll.length; i++) {
  362. for (j = 0; j < coll[i].length; j++) {
  363. if (coll[i][j] === 0) {
  364. rooms.push([room.x * 5 + j, room.y * 5 + i]); // sizes are reversed
  365. break main;
  366. }
  367. }
  368. }
  369. } while (room.getNext());
  370.  
  371. while (rooms.length > 0) {
  372. rooms.sort(NTA_SortRoomInt);
  373.  
  374. room = rooms.shift();
  375.  
  376. NTM_MoveTo(room[0], room[1], 3, false, "clearrooms");
  377.  
  378. if (!NTA_ClearRoom(spectype)) {
  379. return false;
  380. }
  381. }
  382.  
  383. return true;
  384. }
  385.  
  386. function NTA_ClearRoom(spectype) {
  387. if (arguments.length < 1) {
  388. spectype = false;
  389. }
  390.  
  391. var i, target, result, monsterList, dodgeList, room, isValid,
  392. gidAttack = [],
  393. dodgeIDs = [0, 6, 310, 362],
  394. attackCount = 0;
  395.  
  396. if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
  397. return false;
  398. }
  399.  
  400. room = getRoom(me.x, me.y);
  401. monsterList = [];
  402. dodgeList = [];
  403.  
  404. target = NTC_GetUnit(NTC_UNIT_MONSTER, null, MODE_ALIVE);
  405.  
  406. if (target) { // build monster list. all monsters within getUnit range.
  407. do {
  408. monsterList.push(copyUnit(target));
  409.  
  410. if (NTConfig_Dodge) {
  411. dodgeList.push(copyUnit(target));
  412. }
  413. } while (target.getNext());
  414. }
  415.  
  416. print("mon list: " + monsterList.length);
  417. //print("dodge list: " + dodgeList.length);
  418.  
  419. MainLoop : while (monsterList.length > 0) {
  420. monsterList.sort(NTA_SortMonsters);
  421.  
  422. target = monsterList[0];
  423.  
  424. if (NTConfig_Dodge && attackCount > 0) {
  425. dodgeList.sort(NTA_SortMonsters);
  426.  
  427. for (i = 0; i < dodgeList.length; i += 1) {
  428. if (NTA_IsValidTarget(dodgeList[i])) {
  429. if (getDistance(me, target) < 8) {
  430. NTA_Dodge(dodgeList[i], 15, dodgeList);
  431. }
  432.  
  433. break;
  434. }
  435. }
  436. }
  437.  
  438. if (room.unitInRoom(target) && (!spectype || target.spectype & spectype) && NTA_IsValidTarget(target)) {
  439. result = NTA_Attack(target, attackCount % 30 === 0);
  440.  
  441. switch (result) {
  442. case 1:
  443. print("att fail");
  444. monsterList.shift();
  445. break;
  446. case 2:
  447. case 3:
  448. if (!target.spectype & 0x7) {
  449. if(!gidAttack[target.gid]) {
  450. gidAttack[target.gid] = 0;
  451. }
  452.  
  453. gidAttack[target.gid] += 1;
  454.  
  455. if (gidAttack[target.gid] > 8) {
  456. print("Skipping " + target.name);
  457. monsterList.shift();
  458. }
  459. }
  460.  
  461. attackCount += 1;
  462.  
  463. if (target.mode === 0 || target.mode === 12) {
  464. NTA_FastPick();
  465. }
  466.  
  467. break;
  468. default:
  469. return false;
  470. }
  471. } else {
  472. monsterList.shift();
  473. }
  474. }
  475.  
  476. switch (me.classid) {
  477. case NTC_CHAR_CLASS_PALADIN:
  478. if (attackCount > 2 && NTConfig_Redemption != false) {
  479. if (Math.round(me.hp * 100 / me.hpmax) < NTConfig_Redemption[0] || Math.round(me.mp * 100 / me.mpmax) < NTConfig_Redemption[1]) {
  480. NTC_PutSkill(124, NTC_HAND_RIGHT);
  481. NTC_PingDelay(1000);
  482. }
  483. }
  484.  
  485. break;
  486. }
  487.  
  488. NTA_OpenChests(room);
  489.  
  490. if (attackCount > 0) {
  491. NTSI_PickItems();
  492. NTT_CleanPotions();
  493. }
  494.  
  495. return true;
  496. }
  497.  
  498. function NTA_OpenChests(arg) {
  499. var i, unit,
  500. ids = ["chest", "WeaponRack", "ArmorStand"];
  501.  
  502. for (i = 0; i < ids.length; i += 1) {
  503. unit = getUnit(2, ids[i]);
  504.  
  505. if (unit) {
  506. do {
  507. if ((isNaN(arg) ? arg.unitInRoom(unit) : arg) && NTC_OpenChest(unit)) { // room or range
  508. NTSI_PickItems();
  509. }
  510. } while (unit.getNext());
  511. }
  512. }
  513. }
  514.  
  515. function NTA_IsValidTarget(monster, simple)
  516. {
  517. if(monster && monster.type == 0 && NT_HostileAction ==2)
  518. return true;
  519.  
  520. if(!monster || monster.type != NTC_UNIT_MONSTER) // added for pking
  521. return false;
  522.  
  523. if(monster.mode == 0 || monster.mode == 12 || monster.hp <= 0)
  524. return false;
  525.  
  526. if(arguments.length < 2)
  527. simple = false;
  528.  
  529. if(!simple)
  530. {
  531. if(!monster.name)
  532. return false;
  533.  
  534. switch(monster.name.toLowerCase())
  535. {
  536. case "dummy":
  537. case "an evil force":
  538. return false;
  539. }
  540.  
  541. switch(monster.classid)
  542. {
  543. case 271: // Merc
  544. case 338:
  545. case 359:
  546. case 561:
  547. case 356: // Decoy
  548. case 357: // Valkyrie
  549. case 418: // Shadow Warrior
  550. case 419: // Shadow Master
  551. case 363: // Necro Skeleton
  552. case 364: // Necro Mage
  553. case 366: // Compelling Orb
  554. case 406: // Izual's Spirit
  555. case 266: // Act1: Flavie (Navi) -> Between BloodMoor & ColdPlains
  556. case 408: // Act4: Hadriel (Malachai) -> Entrance of River of Flames
  557. case 516: // Act5: Impact point for Catapults (Invisible) -> Frigid Highlands
  558. case 517: // Act5: Impact point for Catapults (Invisible)
  559. case 518: // Act5: Impact point for Catapults (Invisible) -> Bloodyfoot Hill
  560. case 519: // Act5: Impact point for Catapults (Invisible)
  561. case 522: // Act5: Combatant Barbarian
  562. case 523: // Act5: Combatant Barbarian
  563. case 543: // Baal on stairs outside Worldstone Chamber
  564. case 545: // Baal taunts
  565. return false;
  566. }
  567.  
  568. if(monster.classid >= 289 && monster.classid <= 292) // Necro's Golem
  569. return false;
  570.  
  571. if((monster.classid >= 326 && monster.classid <= 330) || (monster.classid >= 410 && monster.classid <= 417)) // Traps
  572. return false;
  573.  
  574. if(monster.classid >= 351 && monster.classid <= 353) // Hydra
  575. return false;
  576.  
  577. if(monster.classid >= 420 && monster.classid <= 432) // Druid's friend
  578. return false;
  579. }
  580.  
  581. if(((monster.classid >= 110 && monster.classid <= 113) || monster.classid == 608) && monster.mode == 8)
  582. return false;
  583.  
  584. if(monster.classid == 68 && monster.mode == 14)
  585. return false;
  586.  
  587. if((monster.classid == 258 || monster.classid == 261) && monster.mode == 14)
  588. return false;
  589.  
  590. if(monster.getStat(172) == 2 || monster.getState(105) == 0)
  591. return false;
  592.  
  593. if(monster.getState(53) || monster.getState(96)) // Conversion, Revive
  594. return false;
  595.  
  596. if((me.classid === 3 || monster.spectype & 0x7) && monster.classid == 306 && getCollision(me.area, monster.x, monster.y) & 0x1) {
  597. return false;
  598. }
  599.  
  600. return true;
  601. }
  602.  
  603. function NTA_GetDamageType(skillid)
  604. {
  605. switch(skillid)
  606. {
  607. case 74: // Corpse Explosion
  608. case 106: // Zeal
  609. case 107: // Charge
  610. case 151: // Whirlwind
  611. case 245: // tornado
  612. return NTA_DAMAGE_PHYSICAL;
  613. case 112: // Blessed Hammer
  614. return NTA_DAMAGE_MAGIC;
  615. case 47: // Fire Ball
  616. case 56: // Meteor
  617. return NTA_DAMAGE_FIRE;
  618. case 48: // Nova
  619. case 49: // Lightning
  620. case 53: // Chain Lightning
  621. return NTA_DAMAGE_LIGHTNING;
  622. case 59: // Blizzard
  623. case 64: // Frozen Orb
  624. return NTA_DAMAGE_COLD;
  625. case 92: // Poison Nova
  626. return NTA_DAMAGE_POISON;
  627. }
  628.  
  629. var _etype;
  630.  
  631. if(skillid == 74)
  632. return NTA_DAMAGE_PHYSICAL;
  633. if(skillid == 101)
  634. return NTA_DAMAGE_NONE;
  635.  
  636. _etype = getBaseStat(3, parseInt(skillid, 10), 211);
  637.  
  638. switch(_etype)
  639. {
  640. case 0: return NTA_DAMAGE_PHYSICAL;
  641. case 1: return NTA_DAMAGE_FIRE;
  642. case 2: return NTA_DAMAGE_LIGHTNING;
  643. case 3: return NTA_DAMAGE_MAGIC;
  644. case 4: return NTA_DAMAGE_COLD;
  645. case 5: return NTA_DAMAGE_POISON;
  646. }
  647.  
  648. return NTA_DAMAGE_NONE;
  649. }
  650.  
  651. function NTA_GetResistance(enemy, type) {
  652. if (enemy.type === 0) { // PK optimization
  653. return 0;
  654. }
  655.  
  656. switch (type) {
  657. case NTA_DAMAGE_PHYSICAL:
  658. return enemy.getStat(36);
  659. case NTA_DAMAGE_MAGIC:
  660. return enemy.getStat(37);
  661. case NTA_DAMAGE_FIRE:
  662. return enemy.getStat(39);
  663. case NTA_DAMAGE_LIGHTNING:
  664. return enemy.getStat(41);
  665. case NTA_DAMAGE_COLD:
  666. return enemy.getStat(43);
  667. case NTA_DAMAGE_POISON:
  668. return enemy.getStat(45);
  669. }
  670.  
  671. return 0;
  672. }
  673.  
  674. function NTA_Attack(target, firstorder)
  675. {
  676. me.overhead(target.name + " " + target.classid);
  677.  
  678. switch(me.classid)
  679. {
  680. case NTC_CHAR_CLASS_AMAZON:
  681. return NTA_AmazonAttackInt(target, firstorder);
  682. case NTC_CHAR_CLASS_SORCERESS:
  683. return NTA_SorceressAttackInt(target, firstorder);
  684. case NTC_CHAR_CLASS_NECROMANCER:
  685. return NTA_NecromancerAttackInt(target, firstorder);
  686. case NTC_CHAR_CLASS_PALADIN:
  687. return NTA_PaladinAttackInt(target, firstorder);
  688. case NTC_CHAR_CLASS_BARBARIAN:
  689. return NTA_BarbarianAttackInt(target, firstorder);
  690. case NTC_CHAR_CLASS_DRUID:
  691. return NTA_DruidAttackInt(target, firstorder);
  692. case NTC_CHAR_CLASS_ASSASSIN:
  693. return NTA_AssassinAttackInt(target, firstorder);
  694. }
  695.  
  696. return 0;
  697. }
  698.  
  699. function NTA_AmazonAttackInt(target, firstorder)
  700. {
  701. var primaryindex;
  702.  
  703. if(firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && !me.getState(121)) {
  704. if(getDistance(me, target) > _NTA_SkillRange[0] || checkCollision(me, target, 0x4))
  705. NTA_GetToOptimalPosition(target, _NTA_SkillRange[0], 0x4);
  706.  
  707. if(!NTC_DoCast(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
  708. return 2;
  709.  
  710. return 3;
  711. }
  712.  
  713. primaryindex = target.spectype & 0x7 ? 1 : 3;
  714.  
  715. if (NTA_GetResistance(target, _NTA_SkillDamage[primaryindex]) < 100) {
  716. if (!NTA_AmazonCastSkillInt(primaryindex, target)) {
  717. return 2;
  718. }
  719.  
  720. return 3;
  721. }
  722.  
  723. if (NTConfig_AttackSkill[5] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[5]) <= 80) {
  724. if (!NTA_AmazonCastSkillInt(5, target)) {
  725. return 2;
  726. }
  727.  
  728. return 3;
  729. }
  730.  
  731. if (NTA_GetResistance(target, _NTA_SkillDamage[primaryindex]) < 100 || (NTA_GetResistance(target, NTA_DAMAGE_PHYSICAL) < 100 && primaryindex == 1 && NTC_GetMerc())) {
  732. if (!NTA_AmazonCastSkillInt(primaryindex, target)) {
  733. return 2;
  734. }
  735.  
  736. return 3;
  737. }
  738.  
  739. return 1;
  740. }
  741.  
  742. function NTA_AmazonCastSkillInt(index, target) {
  743. if (NTConfig_AttackSkill[index] === 24) {
  744. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  745. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  746. }
  747.  
  748. return Farcast(target);
  749. }
  750.  
  751. if (!me.getState(121)) {
  752. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  753. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  754. }
  755.  
  756. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  757. }
  758.  
  759. if (NTConfig_AttackSkill[index+1] > -1) {
  760. if (getDistance(me, target) > _NTA_SkillRange[index+1] || checkCollision(me, target, 0x4)) {
  761. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index+1], 0x4);
  762. }
  763.  
  764. return NTC_DoCast(NTConfig_AttackSkill[index+1], _NTA_SkillHand[index+1], target);
  765. }
  766.  
  767. if (me.getState(121)) {
  768. for (var i = 0; i < 200; i++) {
  769. NTC_Delay(NTC_DELAY_FRAME);
  770.  
  771. if (!me.getState(121)) {
  772. return true;
  773. }
  774. }
  775. }
  776.  
  777. return false;
  778. }
  779.  
  780. function Farcast (target) {
  781. if (NTC_PutSkill(24, NTC_HAND_RIGHT)) {
  782. var i, n, mode;
  783.  
  784. me.castUnit(24, NTC_HAND_RIGHT, target, true);
  785.  
  786. for(n = 0; n < 4; n = n + 1) {
  787. NTC_Delay(NTC_DELAY_FRAME);
  788.  
  789. mode = me.mode;
  790.  
  791. if (mode === 7 || mode === 8 || (mode >= 10 && mode <= 16) || mode === 18) {
  792. NTC_Delay(NTC_DELAY_FRAME);
  793. break;
  794. }
  795. }
  796.  
  797. if (n < 4) {
  798. for (i = 0; i < 100; i = i + 1) {
  799. NTC_Delay(20);
  800.  
  801. if (me.mode !== mode) {
  802. break;
  803. }
  804. }
  805.  
  806. return true;
  807. }
  808. }
  809.  
  810. return false;
  811. }
  812.  
  813. function NTA_SorceressAttackInt(target, firstorder)
  814. {
  815. var _primaryindex;
  816.  
  817. if (firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && !me.getState(121)) {
  818. if (getDistance(me, target) > _NTA_SkillRange[0] || checkCollision(me, target, 0x4)) {
  819. if (!NTA_GetToOptimalPosition(target, _NTA_SkillRange[0], 0x4)) {
  820. return 2;
  821. }
  822. }
  823.  
  824. if (!NTC_DoCast(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target)) {
  825. return 2;
  826. }
  827.  
  828. return 3;
  829. }
  830.  
  831. if(NTConfig_CastStatic < 100 && parseInt(target.hp*100/target.hpmax) > NTConfig_CastStatic && NTA_GetResistance(target, NTA_DAMAGE_LIGHTNING) <= 80 && (target.classid == 242 || target.classid == 544 || target.classid == 243 || target.classid == 156))
  832. {
  833. var _staticlevel = NTC_CheckSkill(42);
  834.  
  835. if(_staticlevel > 0)
  836. {
  837. var _staticrange;
  838. var _castx, _casty;
  839.  
  840. _staticrange = Math.floor((5+_staticlevel-1)*2/3);
  841.  
  842. if(getDistance(me, target) > _staticrange || checkCollision(me, target, 0x4))
  843. NTA_GetToOptimalPosition(target, _staticrange, 0x4);
  844.  
  845. if(!NTC_DoCast(42, NTC_HAND_RIGHT, me.x, me.y))
  846. return 2;
  847.  
  848. return 3;
  849. }
  850. }
  851.  
  852. _primaryindex = (target.spectype&0x7) ? 1 : 3;
  853.  
  854. var timedIndex, untimedIndex, immuneResist;
  855.  
  856. if (NTConfig_Infinity) {
  857. immuneResist = 117;
  858. } else {
  859. immuneResist = 100;
  860. }
  861.  
  862. if (NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < immuneResist) {
  863. timedIndex = _primaryindex;
  864. } else if (NTConfig_AttackSkill[5] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < immuneResist) {
  865. timedIndex = 5;
  866. }
  867.  
  868. if (NTConfig_AttackSkill[_primaryindex + 1] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex + 1]) < immuneResist && (NTConfig_AttackSkill[_primaryindex + 1] !== 42 || Math.round(target.hp * 100 / target.hpmax) > NTConfig_CastStatic)) {
  869. untimedIndex = _primaryindex + 1;
  870. } else if (NTConfig_AttackSkill[6] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[6]) < immuneResist && (NTConfig_AttackSkill[6] !== 42 || Math.round(target.hp * 100 / target.hpmax) > NTConfig_CastStatic)) {
  871. untimedIndex = 6;
  872. }
  873.  
  874. if (!timedIndex && !untimedIndex) {
  875. if (NTConfig_TeleStomp && _primaryindex === 1 && NTC_GetMerc() && NTA_GetResistance(target, NTA_DAMAGE_PHYSICAL) < 100) {
  876. NTM_GetCloserInt(target);
  877. timedIndex = 1;
  878. untimedIndex = NTConfig_AttackSkill[2] > -1 ? 2 : null;
  879. } else {
  880. print("Target " + target.name + " immune to all attacks.")
  881. return 1;
  882. }
  883. }
  884.  
  885. if (!NTA_SorceressCastSkillInt(timedIndex, untimedIndex, target)) {
  886. return 2;
  887. }
  888.  
  889. return 3;
  890. }
  891.  
  892. function NTA_SorceressCastSkillInt(timed, untimed, target) {
  893. if (timed && !me.getState(121)) {
  894. if (getDistance(me, target) > _NTA_SkillRange[timed] || checkCollision(me, target, 0x4)) {
  895. if (!NTA_GetToOptimalPosition(target, _NTA_SkillRange[timed], 0x4)) {
  896. return false;
  897. }
  898. }
  899.  
  900. return NTC_DoCast(NTConfig_AttackSkill[timed], _NTA_SkillHand[timed], target);
  901. }
  902.  
  903. if (untimed && NTConfig_AttackSkill[untimed] > -1) {
  904. if (getDistance(me, target) > _NTA_SkillRange[untimed] || checkCollision(me, target, 0x4)) {
  905. if (NTA_GetToOptimalPosition(target, _NTA_SkillRange[untimed], 0x4)) {
  906. return false;
  907. }
  908. }
  909.  
  910. return NTC_DoCast(NTConfig_AttackSkill[untimed], _NTA_SkillHand[untimed], target);
  911. }
  912.  
  913. for (var i = 0 ; i < 25 ; i += 1) {
  914. NTC_Delay(NTC_DELAY_FRAME);
  915.  
  916. if (!me.getState(121)) {
  917. break;
  918. }
  919. }
  920.  
  921. return false;
  922. }
  923.  
  924. /*function NTA_SorceressCastSkillInt(index, target)
  925. {
  926. if(!me.getState(121))
  927. {
  928. if(NTA_GetResistance(target, _NTA_SkillDamage[index]) < 100)
  929. {
  930. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  931. if (!NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4)) {
  932. return false;
  933. }
  934. }
  935.  
  936. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  937. }
  938. else if(NTConfig_AttackSkill[5] > -1)
  939. {
  940. if (getDistance(me, target) > _NTA_SkillRange[5] || checkCollision(me, target, 0x4)) {
  941. if (!NTA_GetToOptimalPosition(target, _NTA_SkillRange[5], 0x4)) {
  942. return false
  943. }
  944. }
  945.  
  946. return NTC_DoCast(NTConfig_AttackSkill[5], _NTA_SkillHand[5], target);
  947. }
  948. }
  949.  
  950. if(NTConfig_AttackSkill[index+1] > -1)
  951. {
  952. if(NTA_GetResistance(target, _NTA_SkillDamage[index+1]) < 100)
  953. {
  954. if (getDistance(me, target) > _NTA_SkillRange[index+1] || checkCollision(me, target, 0x4)) {
  955. if (NTA_GetToOptimalPosition(target, _NTA_SkillRange[index+1], 0x4)) {
  956. return false;
  957. }
  958. }
  959.  
  960. return NTC_DoCast(NTConfig_AttackSkill[index+1], _NTA_SkillHand[index+1], target);
  961. }
  962. else if(NTConfig_AttackSkill[6] > -1)
  963. {
  964. if (getDistance(me, target) > _NTA_SkillRange[6] || checkCollision(me, target, 0x4)) {
  965. if (NTA_GetToOptimalPosition(target, _NTA_SkillRange[6], 0x4)) {
  966. return false;
  967. }
  968. }
  969.  
  970. return NTC_DoCast(NTConfig_AttackSkill[6], _NTA_SkillHand[6], target);
  971. }
  972. }
  973.  
  974. if(me.getState(121))
  975. {
  976. for(var i = 0; i < 200; i++)
  977. {
  978. NTC_Delay(NTC_DELAY_FRAME);
  979.  
  980. if(!me.getState(121))
  981. return true;
  982. }
  983. }
  984.  
  985. return false;
  986. }*/
  987.  
  988. function NTA_NecromancerAttackInt(target, firstorder) {
  989. var _primaryindex,
  990. currentLife = me.hp;
  991.  
  992. /*if (NTTMGR_CheckCurse(NTConfig_CheckSelfSafe & 0x10, NTConfig_CheckMercSafe & 0x10)) {
  993. if (!NTTMGR_VisitTown()) {
  994. return 0;
  995. }
  996. }*/
  997.  
  998. //NTTMGR_CheckSafe(false, 0x01); //instant merc revive
  999.  
  1000. if (!me.getState(14)) { // bone armor recast
  1001. NTC_DoCast(68, NTC_HAND_RIGHT);
  1002. }
  1003.  
  1004. if (firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && me.GetSkillStatus(NTConfig_AttackSkill[0]) !== 8) {
  1005. if (GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4)) {
  1006. NTA_GetToOptimalPosition(target, _NTA_SkillRange[0], 0x4);
  1007. }
  1008.  
  1009. if (!NTC_DoCast(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target)) {
  1010. return 2;
  1011. }
  1012.  
  1013. return 3;
  1014. }
  1015.  
  1016. if (NTConfig_Curse[2] > 0 && NTConfig_CurseList.indexOf(target.classid) > -1 && NTA_IsCursable(target)) {
  1017. if (!target.getState(_NTA_CurseState[2])) {
  1018. if (GetDistance(me, target) > 25 || !CheckCollision(me, target, 4)) {
  1019. NTA_GetToOptimalPosition(target, 25, 0x4);
  1020. }
  1021.  
  1022. if (!NTC_DoCast(NTConfig_Curse[2], NTC_HAND_RIGHT, target)) {
  1023. return 2;
  1024. }
  1025.  
  1026. return 3;
  1027. }
  1028. } else if (NTConfig_Curse[1] > 0 && NTA_IsCursable(target) && !(target.spectype & 0x0A)) {
  1029. if (!target.getState(_NTA_CurseState[1])) {
  1030. if (GetDistance(me, target) > 25 || !CheckCollision(me, target, 4)) {
  1031. NTA_GetToOptimalPosition(target, 25, 0x4);
  1032. }
  1033.  
  1034. if (!NTC_DoCast(NTConfig_Curse[1], NTC_HAND_RIGHT, target)) {
  1035. return 2;
  1036. }
  1037.  
  1038. return 3;
  1039. }
  1040. } else if (NTConfig_Curse[0] > 0 && NTA_IsCursable(target) && target.spectype & 0x0A) {
  1041. if (!target.getState(_NTA_CurseState[0])) {
  1042. if (GetDistance(me, target) > 25 || !CheckCollision(me, target, 4)) {
  1043. NTA_GetToOptimalPosition(target, 25, 0x4);
  1044. }
  1045.  
  1046. if (!NTC_DoCast(NTConfig_Curse[0], NTC_HAND_RIGHT, target)) {
  1047. return 2;
  1048. }
  1049.  
  1050. return 3;
  1051. }
  1052. }
  1053.  
  1054. _primaryindex = (target.spectype & 0x7) ? 1 : 3;
  1055.  
  1056. if (NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100) {
  1057. if (NTConfig_TeleStomp) {
  1058. NTM_GetCloserInt(target);
  1059. }
  1060.  
  1061. if (!NTA_NecromancerCastSkillInt(_primaryindex, target)) {
  1062. return 2;
  1063. }
  1064.  
  1065. /*if (NTConfig_ActiveSummon) {
  1066. NTA_RaiseArmy();
  1067. }
  1068.  
  1069. NTA_ExplodeCorpses(target);*/
  1070.  
  1071. return 3;
  1072. }
  1073.  
  1074. if (NTConfig_AttackSkill[5] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < 100) {
  1075. if (!NTA_NecromancerCastSkillInt(5, target)) {
  1076. return 2;
  1077. }
  1078.  
  1079. /*if (NTConfig_ActiveSummon) {
  1080. NTA_RaiseArmy();
  1081. }
  1082.  
  1083. NTA_ExplodeCorpses(target);*/
  1084.  
  1085. return 3;
  1086. }
  1087.  
  1088. if (NTConfig_TeleStomp && NTC_GetMerc() && NTA_GetResistance(target, NTA_DAMAGE_PHYSICAL) < 100) {
  1089. NTM_GetCloserInt(target);
  1090.  
  1091. if (target.mode === 12) {
  1092. return 2;
  1093. }
  1094.  
  1095. NTC_Delay(300);
  1096.  
  1097. /*if (NTConfig_ActiveSummon) {
  1098. NTA_RaiseArmy();
  1099. }
  1100.  
  1101. NTA_ExplodeCorpses(target);*/
  1102.  
  1103. return 3;
  1104. }
  1105.  
  1106. return 1;
  1107. }
  1108.  
  1109. function NTA_NecromancerCastSkillInt(index, target) {
  1110. var i, _pos;
  1111.  
  1112. if (NTConfig_AttackSkill[index] === 92) {
  1113. if (!_NTA_NovaTick || GetTickCount() > _NTA_NovaTick + NTConfig_PoisonNovaDelay) {
  1114. if (getDistance(me, target) > _NTA_SkillRange[index] || !checkCollision(me, target, 4)) {
  1115. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  1116. }
  1117.  
  1118. _NTA_NovaTick = getTickCount();
  1119.  
  1120. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  1121. }
  1122. } else if (NTConfig_AttackSkill[index] === SUMMONER) { // summoners, fishymancers, overlords... any necro that doesn't use direct attacks
  1123. if (getDistance(me, target) > _NTA_SkillRange[index] || !checkCollision(me, target, 0x4)) {
  1124. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  1125. }
  1126.  
  1127. NTC_Delay(300);
  1128.  
  1129. return true;
  1130. } else if (!me.getState(121)) {
  1131. if (getDistance(me, target) > _NTA_SkillRange[index] || !checkCollision(me, target, 0x4)) {
  1132. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  1133. }
  1134.  
  1135. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  1136. }
  1137.  
  1138. if (NTConfig_AttackSkill[index+1] > -1) {
  1139. if (getDistance(me, target) > _NTA_SkillRange[index + 1] || !checkCollision(me, target, 0x4)) {
  1140. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index + 1], 0x4);
  1141. }
  1142.  
  1143. return NTC_DoCast(NTConfig_AttackSkill[index+1], _NTA_SkillHand[index+1], target);
  1144. }
  1145.  
  1146. for (i = 0; i < 25; i+= 1) {
  1147. NTC_Delay(NTC_DELAY_FRAME);
  1148.  
  1149. if (!me.getState(121) && (GetTickCount() > _NTA_NovaTick + NTConfig_PoisonNovaDelay || !_NTA_NovaTick)) {
  1150. break;
  1151. }
  1152. }
  1153.  
  1154. return false;
  1155. }
  1156.  
  1157. function NTA_RaiseArmy() {
  1158. if (me.classid !== 2) {
  1159. return false;
  1160. }
  1161.  
  1162. var corpse, corpseList, skill, maxSkeletons, maxMages, maxRevives;
  1163.  
  1164. if (NTConfig_SkeletonArmy === 'max') {
  1165. skill = NTC_CheckSkill(70);
  1166. maxSkeletons = skill < 4 ? skill : (Math.floor(skill / 3) + 2);
  1167. } else {
  1168. maxSkeletons = NTConfig_SkeletonArmy || 0;
  1169. }
  1170.  
  1171. if (NTConfig_MageArmy === 'max') {
  1172. skill = NTC_CheckSkill(80);
  1173. maxMages = skill < 4 ? skill : (Math.floor(skill / 3) + 2);
  1174. } else {
  1175. maxMages = NTConfig_MageArmy || 0;
  1176. }
  1177.  
  1178. if (NTConfig_ReviveArmy === 'max') {
  1179. skill = NTC_CheckSkill(95);
  1180. maxRevives = skill;
  1181. } else {
  1182. maxRevives = NTConfig_ReviveArmy || 0;
  1183. }
  1184.  
  1185. corpse = NTC_GetUnit(1, null, MODE_DEAD);
  1186. corpseList = [];
  1187.  
  1188. if (corpse) {
  1189. do {
  1190. if (getDistance(me, corpse) <= 25 && !checkCollision(me, corpse, 0x4)) {
  1191. corpseList.push(copyUnit(corpse));
  1192. }
  1193. } while (corpse.getNext());
  1194. }
  1195.  
  1196. MainLoop : while (corpseList.length > 0) {
  1197. corpse = corpseList.shift();
  1198.  
  1199. if (NTA_IsValidCorpse(corpse)) {
  1200. if (me.getMinionCount(4) < maxSkeletons) {
  1201. if (!NTC_DoCast(70, NTC_HAND_RIGHT, corpse)) {
  1202. return false;
  1203. }
  1204.  
  1205. NTC_Delay(200);
  1206. } else if (me.getMinionCount(5) < maxMages) {
  1207. if (!NTC_DoCast(80, NTC_HAND_RIGHT, corpse)) {
  1208. return false;
  1209. }
  1210.  
  1211. NTC_Delay(200);
  1212. } else if (me.getMinionCount(6) < maxRevives) {
  1213. if (corpse.spectype & 0x7) {
  1214. continue MainLoop;
  1215. }
  1216.  
  1217. if (!NTC_DoCast(95, NTC_HAND_RIGHT, corpse)) {
  1218. return false;
  1219. }
  1220.  
  1221. NTC_Delay(200);
  1222. } else {
  1223. break MainLoop;
  1224. }
  1225. }
  1226. }
  1227.  
  1228. return true;
  1229. }
  1230.  
  1231. function NTA_GetMinionCount(type) { // 0 - skeleton, 1 - mage, 2 - revive
  1232. var minion,
  1233. num = 0;
  1234.  
  1235. switch (type) {
  1236. case 0:
  1237. minion = NTC_GetUnit(NTC_UNIT_MONSTER, 363);
  1238. break;
  1239. case 1:
  1240. minion = NTC_GetUnit(NTC_UNIT_MONSTER, 364);
  1241. break;
  1242. case 2:
  1243. minion = NTC_GetUnit(NTC_UNIT_MONSTER);
  1244. break;
  1245. }
  1246.  
  1247. if (minion) {
  1248. do {
  1249. if (NTC_CheckOwner(minion) && minion.hp > 0) {
  1250. if (type === 2) {
  1251. if (minion.getState(96)) {
  1252. num += 1;
  1253. }
  1254. } else {
  1255. num += 1;
  1256. }
  1257. }
  1258. } while (minion.getNext());
  1259. }
  1260.  
  1261. return num;
  1262. }
  1263.  
  1264. function NTA_IsValidCorpse(unit) {
  1265. switch (unit.classid) { // muddys
  1266. case 151: // An evil force
  1267. case 156: // Andariel
  1268. case 159: // An evil force
  1269. case 180: // Sand Maggot Young
  1270. case 181: // Rock Worm Young
  1271. case 182: // Devourer Young
  1272. case 183: // Giant Lamprey Young
  1273. case 184: // World Killer Young
  1274. case 190: // Sand Maggot Egg
  1275. case 191: // Rock Worm Egg
  1276. case 192: // Devourer Egg
  1277. case 193: // Giant Lamprey Egg
  1278. case 194: // World Killer Egg
  1279. case 206: // Fould Crow Nest
  1280. case 207: // Blood Hawk Nest
  1281. case 208: // Black Vulture Nest
  1282. case 209: // Cloud Stalker Nest
  1283. case 221: // Duriel
  1284. case 227: // Maggot
  1285. case 228: // Mummy Generator
  1286. case 234: // Flying Scimitar
  1287. case 242: // Mephisto
  1288. case 243: // Diablo
  1289. case 250: // Summoner
  1290. case 258: // Water Watcher Limb
  1291. case 259: // River Stalker Limb
  1292. case 260: // Sygain Watcher Limb
  1293. case 261: // Water Watcher Head
  1294. case 262: // River Stalker Head
  1295. case 263: // Sygain Watcher Head
  1296. case 267: // Blood Raven
  1297. case 269: // An evil force
  1298. case 270: // Rogue Scout (== Merc)
  1299. case 273: // Gargoyle Trap
  1300. case 289: // Clay Golem
  1301. case 290: // Blood Golem
  1302. case 291: // Iron Golem
  1303. case 292: // Fire Golem
  1304. case 301: // Flesh Beast
  1305. case 302: // Stygian Dog
  1306. case 303: // Grotesque Wyrm
  1307. case 318: // An Evil Force
  1308. case 319: // An Evil Force
  1309. case 326: // A Trap
  1310. case 327: // A Trap
  1311. case 328: // A Trap
  1312. case 329: // A Trap
  1313. case 330: // A Trap
  1314. case 334: // Sucker Nest
  1315. case 335: // Fleeder Nest
  1316. case 336: // Blood Hook Nest
  1317. case 337: // Blood Wing Nest
  1318. case 338: // Act 2 guard (== Merc)
  1319. case 348: // Turret
  1320. case 349: // Turret
  1321. case 350: // Turret
  1322. case 351: // Hydra
  1323. case 352: // Hydra
  1324. case 353: // Hydra
  1325. case 354: // A Trap
  1326. case 356: // Dopplezon
  1327. case 357: // Valkyrie
  1328. case 359: // Iron Wolf (== Merc)
  1329. case 363: // Necro Skeleton
  1330. case 364: // Necro Skeletal Mage
  1331. case 366: // Compelling Orb
  1332. case 369: // A Trap
  1333. case 371: // Lightning Spire
  1334. case 372: // Fire Tower
  1335. case 403: // Traped Soul
  1336. case 404: // Traped Soul
  1337. case 406: // Izual
  1338. case 410: // Wake Of Destruction
  1339. case 411: // Charged Bolt Sentry
  1340. case 412: // Lightning Sentry
  1341. case 413: // Blade Creeper
  1342. case 414: // Invisible Pet
  1343. case 415: // Inferno Sentry
  1344. case 416: // Death Sentry
  1345. case 417: // Shadow Warrior
  1346. case 418: // Shadow Master
  1347. case 419: // Druid Hawk
  1348. case 420: // Druid Spirit Wolf
  1349. case 421: // Druid Fenris
  1350. case 422: // Spirit of Barbs
  1351. case 423: // Heart Of Wolverine
  1352. case 424: // Oak Sage
  1353. case 425: // Druid Plague Poppy
  1354. case 426: // Druid Cycle of Life
  1355. case 427: // Vine Creature
  1356. case 428: // Druid Bear
  1357. case 429: // Eagle
  1358. case 430: // Wolf
  1359. case 431: // Bear
  1360. case 432: // Barricaded Door
  1361. case 433: // Barricaded Door
  1362. case 434: // Prison Door
  1363. case 435: // Barricaded Door
  1364. case 461: // Fanatic Minion
  1365. case 462: // Beserk Slayer
  1366. case 463: // Consumed Fire Boar
  1367. case 464: // Consumed Ice Boar
  1368. case 465: // Frenzied Hell Spawn
  1369. case 466: // Frenzied Hell Spawn
  1370. case 467: // Insane Hell Spawn
  1371. case 468: // Insane Ice Spawn
  1372. case 497: // Catapult
  1373. case 498: // Catapult
  1374. case 499: // Catapult
  1375. case 500: // Catapult
  1376. case 501: // Frozen Horror 1
  1377. case 502: // Frozen Horror 2
  1378. case 503: // Frozen Horror 3
  1379. case 504: // Frozen Horror 4
  1380. case 505: // Frozen Horror 5
  1381. case 516: // Catapult
  1382. case 517: // Catapult
  1383. case 518: // Catapult
  1384. case 519: // Catapult
  1385. case 522: // Barbarian Fighter
  1386. case 523: // Barbarian Fighter
  1387. case 524: // Barricade Wall Right
  1388. case 525: // Barricade Wall Left
  1389. case 526: // Nihlatak
  1390. case 528: // Evil Hut
  1391. case 535: // Barbarian Fighter
  1392. case 536: // Barbarian Fighter
  1393. case 537: // Ancient Statue 1
  1394. case 538: // Ancient Statue 2
  1395. case 539: // Ancient Statue 3
  1396. case 540: // Ancient Barbarian 1
  1397. case 541: // Ancient Barbarian 2
  1398. case 542: // Ancient Barbarian 3
  1399. case 543: // Baal Throne
  1400. case 544: // Baal Crab
  1401. case 545: // Baal Taunt
  1402. case 551: // Pain Worm
  1403. case 552: // Pain Worm
  1404. case 553: // Pain Worm
  1405. case 554: // Pain Worm
  1406. case 555: // Pain Worm
  1407. case 556: // Bunny
  1408. case 559: // Baal Crab to Stairs
  1409. case 560: // Hireling
  1410. case 561: // Hireling
  1411. case 562: // Baal Tentacle
  1412. case 563: // Baal Tentacle
  1413. case 564: // Baal Tentacle
  1414. case 565: // Baal Tentacle
  1415. case 566: // Baal Tentacle
  1416. case 567: // Injured Barbarian
  1417. case 568: // Injured Barbarian
  1418. case 569: // Injured Barbarian
  1419. case 570: // Baal Crab Clone
  1420. case 571: // Baals Minions
  1421. case 572: // Baals Minions
  1422. case 573: // Baals Minions
  1423. case 574: // Worldstone Effect
  1424. case 662: // Flayer Shaman
  1425. return false;
  1426. }
  1427.  
  1428. if(!unit.getState(107) // Shattered
  1429. && !unit.getState(104) // Corpse Explosion
  1430. && !unit.getState(1) // Freeze
  1431. && !unit.getState(118) // Already Looted/Unlootable
  1432. && !unit.getState(99) // Redeemed
  1433. && !unit.getState(2) // Freezed
  1434. && !unit.getState(96) // Revived
  1435. && (unit.hp <= 0 || unit.mode === 0 || unit.mode === 12)) { // Dead
  1436. return true;
  1437. }
  1438.  
  1439. return false;
  1440. }
  1441.  
  1442. function NTA_PaladinAttackInt(target, firstorder)
  1443. {
  1444. if (!me.getState(101)) {
  1445. NTC_DoCast(117, NTC_HAND_RIGHT); // Holy Shield Recast
  1446. }
  1447.  
  1448. var _primaryindex;
  1449.  
  1450. if(firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100)
  1451. {
  1452. if(getDistance(me, target) > _NTA_SkillRange[0] || checkCollision(me, target, 0x4))
  1453. NTA_MoveCloseInt(target, _NTA_SkillRange[0]);
  1454.  
  1455. if(!NTC_DoCast(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
  1456. return 2;
  1457.  
  1458. return 3;
  1459. }
  1460.  
  1461. _primaryindex = (target.spectype & 0x7) ? 1 : 3;
  1462.  
  1463. if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100)
  1464. {
  1465. if(_NTA_SkillRange[_primaryindex] < 4 && !NTA_IsValidSpot(target.x, target.y))
  1466. return 1;
  1467.  
  1468. if(!NTA_PaladinCastSkillInt(_primaryindex, target))
  1469. return 2;
  1470.  
  1471. return 3;
  1472. }
  1473.  
  1474. if(NTConfig_AttackSkill[5] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < 100)
  1475. {
  1476. if(_NTA_SkillRange[5] < 4 && !NTA_IsValidSpot(target.x, target.y))
  1477. return 1;
  1478.  
  1479. if(!NTA_PaladinCastSkillInt(5, target))
  1480. return 2;
  1481.  
  1482. return 3;
  1483. }
  1484.  
  1485. return 1;
  1486. }
  1487.  
  1488. function NTA_PaladinCastSkillInt(index, target) {
  1489. if (NTConfig_AttackSkill[index] === 112) {
  1490. if (!NTA_CheckHammerPosition(target)) {
  1491. NTA_GetHammerPosition(target);
  1492. }
  1493. } else {
  1494. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  1495. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  1496. }
  1497. }
  1498.  
  1499. if (NTConfig_AttackSkill[index+1] > -1) {
  1500. NTC_PutSkill(NTConfig_AttackSkill[index+1], NTC_HAND_RIGHT);
  1501. }
  1502.  
  1503. if (target.hp <= 0 || target.mode === 0 || target.mode === 12) {
  1504. return true;
  1505. }
  1506.  
  1507. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  1508. }
  1509.  
  1510. function NTA_CheckHammerPosition(unit) {
  1511. var i,
  1512. offsets = [[3, 2], [3, 1], [-3, 3], [0, 3], [-3, 2], [-4, 0]];
  1513.  
  1514. for (i = 0; i < offsets.length; i += 1) {
  1515. if (Math.abs(unit.x + offsets[i][0] - me.x) < 1 && Math.abs(unit.y + offsets[i][1] - me.y) < 1) {
  1516. return true;
  1517. }
  1518. }
  1519.  
  1520. return false;
  1521. }
  1522.  
  1523. function NTA_GetHammerPosition(unit) {
  1524. var i,
  1525. positions = [],
  1526. offsets = [[3, 2], [3, 1], [-3, 3], [0, 3], [-3, 2], [-4, 0]];
  1527.  
  1528. for (i = 0; i < offsets.length; i += 1) {
  1529. if (NTA_IsValidSpot(unit.x + offsets[i][0], unit.y + offsets[i][1])) {
  1530. return NTM_MoveTo(unit.x + offsets[i][0], unit.y + offsets[i][1]);
  1531. }
  1532. }
  1533.  
  1534. return false;
  1535. }
  1536.  
  1537. function NTA_BarbarianAttackInt(target, firstorder)
  1538. {
  1539. var primaryindex;
  1540.  
  1541. if(firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && !me.getState(121)) {
  1542. if(getDistance(me, target) > _NTA_SkillRange[0] || checkCollision(me, target, 0x4))
  1543. NTA_GetToOptimalPosition(target, _NTA_SkillRange[0], 0x4);
  1544.  
  1545. if(!NTC_DoCast(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
  1546. return 2;
  1547.  
  1548. return 3;
  1549. }
  1550.  
  1551. primaryindex = target.spectype & 0x7 ? 1 : 3;
  1552.  
  1553. if (NTA_GetResistance(target, _NTA_SkillDamage[primaryindex]) < 100) {
  1554. if (!NTA_BarbarianCastSkillInt(primaryindex, target)) {
  1555. return 2;
  1556. }
  1557.  
  1558. return 3;
  1559. }
  1560.  
  1561. if (NTConfig_AttackSkill[5] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[5]) <= 80) {
  1562. if (!NTA_BarbarianCastSkillInt(5, target)) {
  1563. return 2;
  1564. }
  1565.  
  1566. return 3;
  1567. }
  1568.  
  1569. if (NTA_GetResistance(target, _NTA_SkillDamage[primaryindex]) < 100 || (NTA_GetResistance(target, NTA_DAMAGE_PHYSICAL) < 100 && primaryindex == 1 && NTC_GetMerc())) {
  1570. if (!NTA_BarbarianCastSkillInt(primaryindex, target)) {
  1571. return 2;
  1572. }
  1573.  
  1574. return 3;
  1575. }
  1576.  
  1577. return 1;
  1578. }
  1579.  
  1580. function NTA_BarbarianCastSkillInt(index, target) {
  1581. if (NTConfig_AttackSkill[index] === 24) {
  1582. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  1583. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  1584. }
  1585.  
  1586. return Farcast(target);
  1587. }
  1588.  
  1589. if (!me.getState(121)) {
  1590. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  1591. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4);
  1592. }
  1593.  
  1594. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  1595. }
  1596.  
  1597. if (NTConfig_AttackSkill[index+1] > -1) {
  1598. if (getDistance(me, target) > _NTA_SkillRange[index+1] || checkCollision(me, target, 0x4)) {
  1599. NTA_GetToOptimalPosition(target, _NTA_SkillRange[index+1], 0x4);
  1600. }
  1601.  
  1602. return NTC_DoCast(NTConfig_AttackSkill[index+1], _NTA_SkillHand[index+1], target);
  1603. }
  1604.  
  1605. if (me.getState(121)) {
  1606. for (var i = 0; i < 200; i++) {
  1607. NTC_Delay(NTC_DELAY_FRAME);
  1608.  
  1609. if (!me.getState(121)) {
  1610. return true;
  1611. }
  1612. }
  1613. }
  1614.  
  1615. return false;
  1616. }
  1617.  
  1618.  
  1619. function NTA_DruidAttackInt(target, firstorder)
  1620. {
  1621. if (!me.getState(144)) {
  1622. NTC_DoCast(250, NTC_HAND_RIGHT); // Hurricane Recast
  1623. }
  1624.  
  1625. if (!me.getState(151)) {
  1626. NTC_DoCast(235, NTC_HAND_RIGHT); // Cyclone Armor Recast
  1627. }
  1628.  
  1629. if (!me.getState(149)) {
  1630. NTC_DoCast(226, NTC_HAND_RIGHT); // Oak Sage Recast
  1631. }
  1632.  
  1633. var _primaryindex;
  1634.  
  1635. if (firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100) {
  1636. if (getDistance(me, target) > _NTA_SkillRange[0] || checkCollision(me, target, 0x4)) {
  1637. if (!NTA_GetToOptimalPosition(target, _NTA_SkillRange[0], 0x4)) {
  1638. return false;
  1639. }
  1640. }
  1641.  
  1642. if (!NTC_DoCast(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target)) {
  1643. return 2;
  1644. }
  1645.  
  1646. return 3;
  1647. }
  1648.  
  1649. _primaryindex = (target.spectype & 0x7) ? 1 : 3;
  1650.  
  1651. if (NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100 || NTC_CheckSkill(250) && NTA_GetResistance(target, NTA_DAMAGE_COLD) < 100) { // hurricane optimization
  1652. if (!NTA_DruidCastSkillInt(_primaryindex, target)) {
  1653. return 2;
  1654. }
  1655.  
  1656. return 3;
  1657. }
  1658.  
  1659. if (NTConfig_AttackSkill[5] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < 100) {
  1660. if (!NTA_DruidCastSkillInt(5, target)) {
  1661. return 2;
  1662. }
  1663.  
  1664. return 3;
  1665. }
  1666.  
  1667. return 1;
  1668. }
  1669.  
  1670. function NTA_DruidCastSkillInt(index, target) {
  1671. if (NTConfig_AttackSkill[index] === 245) {
  1672. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  1673. NTA_GetTornadoPosition(target);
  1674. }
  1675.  
  1676. if (getDistance(me, target) <= _NTA_SkillRange[index] && !checkCollision(me, target, 0x4)) {
  1677. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  1678. } else {
  1679. return false;
  1680. }
  1681. } else if (!me.getState(121)) {
  1682. if (getDistance(me, target) > _NTA_SkillRange[index] || checkCollision(me, target, 0x4)) {
  1683. if (!NTA_GetToOptimalPosition(target, _NTA_SkillRange[index], 0x4)) {
  1684. return false;
  1685. }
  1686. }
  1687.  
  1688. return NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
  1689. }
  1690.  
  1691. if (NTConfig_AttackSkill[index + 1] > -1) {
  1692. if (getDistance(me, target) > _NTA_SkillRange[index + 1] || checkCollision(me, target, 0x4)) {
  1693. if (!NTA_GetToOptimalPosition(target, _NTA_SkillRange[index + 1], 0x4)) {
  1694. return false;
  1695. }
  1696. }
  1697.  
  1698. return NTC_DoCast(NTConfig_AttackSkill[index + 1], _NTA_SkillHand[index + 1], target);
  1699. }
  1700.  
  1701. if (me.getState(121)) {
  1702. for (var i = 0; i < 200; i += 1) {
  1703. NTC_Delay(NTC_DELAY_FRAME);
  1704.  
  1705. if (!me.getState(121)) {
  1706. return true;
  1707. }
  1708. }
  1709. }
  1710.  
  1711. return false;
  1712. }
  1713.  
  1714. function NTA_GetTornadoPosition(unit) {
  1715. var i,
  1716. positions = [],
  1717. offsets = [[4,4], [4, -4], [-4, 0], [0, 4]];
  1718.  
  1719. for (i = 0; i < offsets.length; i += 1) {
  1720. if (NTA_IsValidSpot(unit.x + offsets[i][0], unit.y + offsets[i][1])) {
  1721. positions.push([unit.x + offsets[i][0], unit.y + offsets[i][1]]);
  1722. }
  1723. }
  1724.  
  1725. positions.sort(NTA_SortRoomInt);
  1726.  
  1727. for (i = 0; i < positions.length; i += 1) { // lazy style!
  1728. NTM_MoveTo(positions[i][0], positions[i][1]);
  1729.  
  1730. if (!checkCollision(me, unit, 0x4)) {
  1731. return true;
  1732. }
  1733. }
  1734.  
  1735. return false;
  1736. }
  1737.  
  1738. function NTA_AssassinAttackInt(target, boss, maxattacks)
  1739. {
  1740. return false;
  1741. }
  1742.  
  1743. function NTA_MoveCloseInt(target, maxrange)
  1744. {
  1745. var _dist = parseInt(getDistance(me, target));
  1746.  
  1747. if(_dist > maxrange)
  1748. {
  1749. var _destx, _desty;
  1750.  
  1751. _destx = me.x + Math.round((_dist-maxrange)*(target.x-me.x) / _dist);
  1752. _desty = me.y + Math.round((_dist-maxrange)*(target.y-me.y) / _dist);
  1753.  
  1754. NTM_MoveTo(_destx, _desty);
  1755.  
  1756. /*if(getDistance(me, target) > maxrange)
  1757. NTM_MoveTo(target.x,target.y);*/
  1758. }
  1759.  
  1760. return true;
  1761. }
  1762.  
  1763. function NTA_SortRoomInt(a, b)
  1764. {
  1765. if(getDistance(me.x, me.y, a[0], a[1]) < getDistance(me.x, me.y, b[0], b[1]))
  1766. return -1;
  1767.  
  1768. return 1;
  1769. }
  1770.  
  1771. function NTA_SortMonsters(unitA, unitB) {
  1772. var monID = [58, 59, 60, 61, 62, 101, 102, 103, 104, 105, 229, 278, 279, 280, 281, 282, 645, 646, 647, 667, 668, 669, 670];
  1773.  
  1774. if (monID.indexOf(unitA.classid) > -1) { // priority monsters
  1775. return -1;
  1776. } else if (!checkCollision(me, unitA, 0x4) && getDistance(me, unitA) < getDistance(me, unitB)) { // closest visible target
  1777. return -1;
  1778. }
  1779.  
  1780. return 1;
  1781. }
  1782.  
  1783. function NTA_IsValidSpot(x, y) {
  1784. var result = getCollision(me.area, x, y);
  1785.  
  1786. if (result === undefined || result & 0x1) {
  1787. return false;
  1788. }
  1789.  
  1790. return true;
  1791. }
  1792.  
  1793. function NTA_GetToOptimalPosition(target, distance, coll) {
  1794. var n, i, j, cx, cy, t, room, map,
  1795. coords = [],
  1796. goodCoords = [],
  1797. angles = [0, 45, 90, 135, 180, 225, 270, 305];
  1798.  
  1799. t = getTickCount();
  1800. room = getRoom(target.x, target.y);
  1801.  
  1802. if (!room) {
  1803. return false;
  1804. }
  1805.  
  1806. map = room.getCollision();
  1807.  
  1808. for (n = 0; n < 3; n += 1) {
  1809. if (n > 0) {
  1810. distance = Math.round(distance / 2);
  1811. }
  1812.  
  1813. for (i = 0; i < angles.length; i += 1) {
  1814. cx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * distance + target.x);
  1815. cy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * distance + target.y);
  1816.  
  1817. if (NTA_IsValidSpot(cx, cy)) {
  1818. coords.push([cx, cy, angles[i]]); // push angles to be sorted
  1819. }
  1820. }
  1821.  
  1822. if (coords.length > 0) {
  1823. coords.sort(NTA_SortRoomInt); // sort angles by final spot distance
  1824. } else { // no good final spots
  1825. return false;
  1826. }
  1827.  
  1828. MainLoop: for (i = 0; i < coords.length; i += 1) { // sorted angles are coords[i][2]
  1829. for (j = 1; j <= distance; j += 1) {
  1830. cx = Math.round((Math.cos(coords[i][2] * Math.PI / 180)) * j + target.x);
  1831. cy = Math.round((Math.sin(coords[i][2] * Math.PI / 180)) * j + target.y);
  1832.  
  1833. //if (getCollision(me.area, cx, cy) & coll) {
  1834. if (getCollisionEx(room.x * 5, room.y * 5, map, cx, cy) & coll) {
  1835. continue MainLoop; // skip if path is blocked
  1836. }
  1837. }
  1838.  
  1839. if (NTA_IsValidSpot(cx, cy)) { // just in case
  1840. print(getTickCount() - t);
  1841. NTM_MoveTo(cx, cy, 0, false, "gettooptimalpos"); // first good spot is the closest
  1842.  
  1843. if (!checkCollision(me, target, coll)) {
  1844. return true;
  1845. }
  1846. }
  1847. }
  1848. }
  1849.  
  1850. return false;
  1851. }
  1852.  
  1853. function getCollisionEx(roomx, roomy, map, x, y) {
  1854. for (var i = 0; i < map.length; i += 1) {
  1855. for (var j = 0; j < map[i].length; j += 1) {
  1856. if (roomx + j === x && roomy + i === y) {
  1857. return map[i][j];
  1858. }
  1859. }
  1860. }
  1861.  
  1862. return 1;
  1863. }
  1864.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement