Advertisement
Guest User

hope dev

a guest
Nov 16th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. package com.rs.game.npc.combat.impl;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5.  
  6. import com.rs.Settings;
  7. import com.rs.game.Animation;
  8. import com.rs.game.Entity;
  9. import com.rs.game.ForceTalk;
  10. import com.rs.game.Graphics;
  11. import com.rs.game.Hit;
  12. import com.rs.game.Hit.HitLook;
  13. import com.rs.game.World;
  14. import com.rs.game.WorldObject;
  15. import com.rs.game.WorldTile;
  16. import com.rs.game.npc.NPC;
  17. import com.rs.game.npc.combat.CombatScript;
  18. import com.rs.game.npc.combat.NPCCombatDefinitions;
  19. import com.rs.game.npc.familiar.Familiar;
  20. import com.rs.game.player.Player;
  21. import com.rs.game.tasks.WorldTask;
  22. import com.rs.game.tasks.WorldTasksManager;
  23. import com.rs.utils.Colors;
  24. import com.rs.utils.Utils;
  25.  
  26. /**
  27. *
  28. *
  29. * @author Mr_Joopz
  30. *
  31. */
  32.  
  33. public class HopeDevourerCombat extends CombatScript {
  34.  
  35. //Combat Definitions
  36. //12900 - 35000 14456 -1 14455 5 3 120 400 SPECIAL -1 -1 AGRESSIVE
  37. //Bonuses
  38. //12900 - 420 420 420 420 420 250 250 235 250 270
  39.  
  40. @Override
  41. public Object[] getKeys() {
  42. return new Object[] { 21348 };
  43. }
  44.  
  45. @Override
  46. public int attack(final NPC npc, final Entity target) {
  47. final NPCCombatDefinitions defs = npc.getCombatDefinitions();
  48. npc.setForceMultiArea(true);
  49. npc.setForceMultiAttacked(true);
  50. int attackStyle = Utils.getRandom(15);
  51. Hit damage1 = getMeleeHit(npc, 10000);
  52.  
  53.  
  54. /**
  55. * Special attack that stops players from damaging until the vials have been added
  56. */
  57. if (attackStyle == 0) {
  58. ArrayList<Entity> possibleTargets = npc.getPossibleTargets();
  59. final HashMap<String, int[]> tiles = new HashMap<String, int[]>();
  60. for (Entity t : possibleTargets) {
  61. if (t instanceof Player) {
  62. Player p = (Player) t;
  63. p.sendMessage(Colors.ORANGE + "Hope Devourer won't take any damage until you put 3 vials of water on the Lava Crater!");
  64. }
  65. String key = t.getX() + "_" + t.getY();
  66. npc.setNextAnimation(new Animation(26901));
  67. if (!tiles.containsKey(t.getX() + "_" + t.getY())) {
  68. tiles.put(key, new int[] { t.getX(), t.getY() });
  69. npc.setCapDamage(0);
  70. Settings.WaterAdded = 1;
  71. npc.setNextForceTalk(new ForceTalk("3 vials of pure water is all that save you now!"));
  72.  
  73. World.spawnTemporaryObject(new WorldObject(224,
  74. 10, 0, t.getX(), t.getY(), 0), 1400);
  75. World.spawnTemporaryObject(new WorldObject(20232,//Change these coords below to fit the location of Devourer
  76. 10, 0, 4431, 885, 0), 15000);
  77. }
  78. }
  79. WorldTasksManager.schedule(new WorldTask() {
  80. @Override
  81. public void run() {
  82. ArrayList<Entity> possibleTargets = npc
  83. .getPossibleTargets();
  84. for (int[] tile : tiles.values()) {
  85.  
  86. World.sendGraphics(null, new Graphics(1903),
  87. new WorldTile(tile[0], tile[1], 0));
  88. for (Entity t : possibleTargets)
  89. if (t.getX() == tile[0] && t.getY() == tile[1])
  90. t.applyHit(new Hit(npc,
  91. 200,
  92. HitLook.REGULAR_DAMAGE));
  93. }
  94. stop();
  95. }
  96.  
  97. }, 5);
  98. return defs.getAttackDelay();
  99. /**
  100. * Healing attack
  101. */
  102. } else if (attackStyle == 1 || attackStyle == 5) {
  103. if (target instanceof Familiar) {
  104. target.applyHit(damage1);
  105. }
  106. if (Settings.WaterAdded > 0 && Settings.WaterAdded < 3) {
  107. npc.setCapDamage(0);
  108. } else if (Settings.WaterAdded == 0 || Settings.WaterAdded > 3) {
  109. npc.setCapDamage(700);
  110. }
  111. npc.setNextAnimation(new Animation(26901));
  112. npc.setNextGraphics(new Graphics(444));
  113. target.setNextGraphics(new Graphics(482));
  114.  
  115. delayHit(
  116. npc,
  117. defs.getAttackDelay(),
  118. target,
  119. getRangeHit(
  120. npc,
  121. getRandomMaxHit(npc, defs.getMaxHit(),
  122. NPCCombatDefinitions.RANGE, target)));
  123. int damage = getRandomMaxHit(npc,
  124. defs.getMaxHit(), NPCCombatDefinitions.RANGE, target);
  125. npc.heal(damage * 3 + 300);
  126. return defs.getAttackDelay();
  127. }
  128. /**
  129. * Basic melee attack
  130. */
  131. if (attackStyle == 2 || attackStyle == 3 || attackStyle == 4 || attackStyle == 15 || attackStyle == 13 || attackStyle == 12) { // normal Melee move
  132. if (target instanceof Familiar) {
  133. target.applyHit(damage1);
  134. }
  135. if (Settings.WaterAdded > 0 && Settings.WaterAdded < 3) {
  136. npc.setCapDamage(0);
  137. } else if (Settings.WaterAdded == 0 || Settings.WaterAdded >= 3) {
  138. npc.setCapDamage(700);
  139. }
  140. npc.setNextAnimation(new Animation(26901));
  141. delayHit(
  142. npc,
  143. defs.getAttackDelay(),
  144. target,
  145. getMeleeHit(
  146. npc,
  147. getRandomMaxHit(npc, defs.getMaxHit(),
  148. NPCCombatDefinitions.MELEE, target)));
  149. return defs.getAttackDelay();
  150. /**
  151. * Basic ranged attack
  152. */
  153. } else if (attackStyle == 6 || attackStyle == 7 || attackStyle == 8 || attackStyle == 10 || attackStyle == 14) { // normal Ranged move
  154. if (target instanceof Familiar) {
  155. target.applyHit(damage1);
  156. }
  157. if (Settings.WaterAdded > 0 && Settings.WaterAdded < 3) {
  158. npc.setCapDamage(0);
  159. } else if (Settings.WaterAdded == 0 || Settings.WaterAdded >= 3) {
  160. npc.setCapDamage(700);
  161. }
  162. npc.setNextAnimation(new Animation(26901));
  163. delayHit(
  164. npc,
  165. defs.getAttackDelay(),
  166. target,
  167. getRangeHit(
  168. npc,
  169. getRandomMaxHit(npc, defs.getMaxHit(),
  170. NPCCombatDefinitions.RANGE, target)));
  171. World.sendProjectile(npc, target, 1936, 34, 16, 30, 35, 16, 0);
  172. return defs.getAttackDelay();
  173. /**
  174. * Prayer attack
  175. */
  176. } else if (attackStyle == 9 || attackStyle == 11) {
  177. if (target instanceof Familiar) {
  178. target.applyHit(damage1);
  179. }
  180. if (Settings.WaterAdded > 0 && Settings.WaterAdded < 3) {
  181. npc.setCapDamage(0);
  182. } else if (Settings.WaterAdded == 0 || Settings.WaterAdded >= 3) {
  183. npc.setCapDamage(700);
  184. }
  185. npc.setNextAnimation(new Animation(26901));
  186. target.setNextGraphics(new Graphics(741));
  187. //target.moveLocation(target.getChunkX() - 1, target.getChunkY() - 1, 0);
  188. target.addFreezeDelay(600);
  189. npc.setNextGraphics(new Graphics(499));
  190. target.applyHit(new Hit(npc,
  191. Utils.getRandom(600),
  192. HitLook.REGULAR_DAMAGE));
  193. final int damage = 600;
  194.  
  195. // target.getPrayer().drainPrayer((Math.round(damage / 10)));
  196. // player.setPrayerDelay(Utils.getRandom(5) + 5);
  197. return defs.getAttackDelay();
  198.  
  199. }
  200. return defs.getAttackDelay();
  201. }
  202.  
  203. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement