Advertisement
Skanta

Untitled

Apr 22nd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. // Прорвись с боем в святилище вождя огров и убей его.
  2. function attackFriends(friends) {
  3. for(var i = 0; i < friends.length; i++) {
  4. var friend = friends[i];
  5. var enemy = friend.findNearestEnemy();
  6. if(enemy) {
  7. hero.command(friend, "attack", enemy);
  8. }
  9. }
  10. }
  11. function sumUnit() {
  12. if(hero.gold > hero.costOf("soldier")) {
  13. hero.summon("soldier");
  14. }
  15. }
  16. while(hero.time < 28) {
  17. var friends = hero.findFriends();
  18. attackFriends(friends);
  19. var cata = hero.findNearest(hero.findByType("catapult"));
  20. if(hero.pos.x < 80)
  21. hero.move({'x': 73, 'y': 32 });
  22. if(cata && cata.health > 0) {
  23. hero.attack(cata);
  24. }
  25. if(!cata) {
  26. hero.move({ 'x': 96, 'y': 33});
  27. }
  28. }
  29. while(hero.time < 56) {
  30. var friends = hero.findFriends();
  31. if(friends)
  32. attackFriends(friends);
  33. var enemy = hero.findNearestEnemy();
  34. if(enemy && enemy.health > 0 && enemy.pos.x < 163)
  35. hero.attack(enemy);
  36. }
  37. var enemy = hero.findNearestEnemy();
  38. while(enemy.health > 0 && enemy.pos.x < 170) {
  39. hero.attack(enemy);
  40. }
  41. hero.moveXY(153, 34);
  42. hero.moveXY(163, 34);
  43. while (hero.time < 70){
  44. hero.moveXY( 163, 34);
  45. }
  46. hero.moveXY(208, 6);
  47. hero.moveXY(260, 34);
  48. while(hero.time < 100) {
  49. var friends = hero.findFriends();
  50. attackFriends(friends);
  51. var warlock = hero.findNearest(hero.findByType("warlock"));
  52. if (warlock && warlock.health >0) {
  53. hero.attack(warlock);
  54. } else {
  55. hero.shield();
  56. }
  57. }
  58. while(true) {
  59. sumUnit();
  60. var friends = hero.findFriends();
  61. attackFriends(friends);
  62. var enemy = hero.findNearestEnemy();
  63. if(enemy && enemy.health > 0) {
  64. hero.attack(enemy);
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement