armark1ng

Untitled

Sep 4th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. package com.rs.game.npc.vorago;
  2.  
  3. import com.rs.game.Animation;
  4. import com.rs.game.Entity;
  5. import com.rs.game.WorldTile;
  6. import com.rs.game.npc.NPC;
  7. import com.rs.game.npc.combat.NPCCombatDefinitions;
  8. import com.rs.game.player.Player;
  9. import com.rs.game.tasks.WorldTask;
  10. import com.rs.game.tasks.WorldTasksManager;
  11.  
  12. @SuppressWarnings("serial")
  13. public class Scopulus extends NPC {
  14.  
  15. private transient Vorago vorago;
  16.  
  17. public Scopulus(int id, WorldTile tile, int mapAreaNameHash, boolean canBeAttackFromOutOfArea, Vorago vorago) {
  18. super(id, tile, mapAreaNameHash, canBeAttackFromOutOfArea);
  19. this.vorago = vorago;
  20. setForceFollowClose(true);
  21. setIntelligentRouteFinder(true);
  22. }
  23.  
  24. @Override
  25. public boolean isStunImmune() {
  26. return true;
  27. }
  28.  
  29. public boolean isEnraged() {
  30. return vorago.getScopuliCount() < 2;
  31. }
  32.  
  33. @Override
  34. public void sendDeath(Entity source) {
  35. final NPCCombatDefinitions defs = getCombatDefinitions();
  36. resetWalkSteps();
  37. getCombat().removeTarget();
  38. setNextAnimation(null);
  39. if (!isDead())
  40. setHitpoints(0);
  41. final int deathDelay = defs.getDeathDelay() - (getId() == 50 ? 2 : 1);
  42. Scopulus thisNPC = this;
  43. WorldTasksManager.schedule(new WorldTask() {
  44. int loop;
  45.  
  46. @Override
  47. public void run() {
  48. if (loop == 0) {
  49. setNextAnimation(new Animation(defs.getDeathEmote()));
  50. } else if (loop >= deathDelay) {
  51. if (source instanceof Player)
  52. ((Player) source).getControlerManager().processNPCDeath(thisNPC);
  53. vorago.sendScopulusDeath(thisNPC);
  54. reset();
  55. finish();
  56. stop();
  57. }
  58. loop++;
  59. }
  60. }, 0, 1);
  61. }
  62.  
  63. public Vorago getVorago() {
  64. return vorago;
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment