Advertisement
kolton

Untitled

Nov 1st, 2011
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. room = getRoom(me.x, me.y);
  2. monsterList = [];
  3.  
  4. target = NTC_GetUnit(NTC_UNIT_MONSTER, null, MODE_ALIVE);
  5.  
  6. if (target) { // build monster list. all monsters within getUnit range.
  7. do {
  8. monsterList.push(copyUnit(target));
  9. } while (target.getNext());
  10. }
  11.  
  12. print("mon list: " + monsterList.length);
  13.  
  14. MainLoop : while (monsterList.length > 0) {
  15. monsterList.sort(NTA_SortMonsters);
  16.  
  17. target = monsterList[0];
  18.  
  19. if (room.unitInRoom(target) && (!spectype || target.spectype & spectype) && NTA_IsValidTarget(target)) {
  20. result = NTA_Attack(target, attackCount % 30 === 0);
  21.  
  22. switch (result) {
  23. case 1:
  24. print("att fail");
  25. monsterList.shift();
  26. break;
  27. case 2:
  28. case 3:
  29. if (!target.spectype & 0x7) {
  30. if(!gidAttack[target.gid]) {
  31. gidAttack[target.gid] = 0;
  32. }
  33.  
  34. gidAttack[target.gid] += 1;
  35.  
  36. if (gidAttack[target.gid] > 8) {
  37. print("Skipping " + target.name);
  38. monsterList.shift();
  39. }
  40. }
  41.  
  42. attackCount += 1;
  43.  
  44. if (target.mode === 0 || target.mode === 12) {
  45. NTA_FastPick();
  46. }
  47.  
  48. break;
  49. default:
  50. return false;
  51. }
  52. } else {
  53. monsterList.shift();
  54. }
  55. }
  56.  
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement