Advertisement
DewiColeman

Untitled

Dec 11th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. package com.rs.game.npc.combat.impl;
  2.  
  3. import com.rs.game.Animation;
  4. import com.rs.game.Entity;
  5. import com.rs.game.ForceTalk;
  6. import com.rs.game.Graphics;
  7. import com.rs.game.Hit;
  8. import com.rs.game.World;
  9. import com.rs.game.WorldTile;
  10. import com.rs.game.Hit.HitLook;
  11. import com.rs.game.npc.NPC;
  12. import com.rs.game.npc.combat.CombatScript;
  13. import com.rs.game.npc.combat.NPCCombatDefinitions;
  14. import com.rs.game.player.Equipment;
  15. import com.rs.game.player.Player;
  16. import com.rs.game.player.actions.PlayerCombat;
  17. import com.rs.game.tasks.WorldTask;
  18. import com.rs.game.tasks.WorldTasksManager;
  19. import com.rs.net.decoders.handlers.ButtonHandler;
  20. import com.rs.utils.NPCBonuses;
  21. import com.rs.utils.Utils;
  22.  
  23. import java.util.HashMap;
  24.  
  25. public class Korasi extends CombatScript {
  26.  
  27. @Override
  28. public Object[] getKeys() {
  29. return new Object[] { 263 };
  30. }
  31.  
  32.  
  33. public int attack(final NPC npc, final Entity target) {
  34. final Player player = (Player) target;
  35. final NPCCombatDefinitions defs = npc.getCombatDefinitions();
  36. int attackStyle = Utils.random(10);
  37. if(attackStyle == 0) { //Constant hit 100
  38. npc.setNextAnimation(new Animation(1979));
  39. npc.setNextForceTalk(new ForceTalk("I will end you!!!"));
  40. WorldTasksManager.schedule(new WorldTask() {
  41. int count = 0;
  42. @Override
  43. public void run() {
  44. for(Entity t : npc.getPossibleTargets()) { //lets just loop all players for massive moves
  45. t.applyHit(new Hit(npc, (int) 100, HitLook.MAGIC_DAMAGE));
  46. delayHit(npc, 0, t, new Hit(npc, 100, HitLook.REGULAR_DAMAGE));
  47. }
  48. if(count++ == 4) {
  49. stop();
  50. return;
  51. }
  52. }
  53. }, 0, 0);
  54.  
  55. }else if(attackStyle == 1) { //heal
  56. npc.setNextForceTalk(new ForceTalk("Justice!!!"));
  57. npc.setNextAnimation(new Animation(14788));
  58. npc.setNextGraphics(new Graphics(1729));
  59. delayHit(npc, 0, player, new Hit(npc, 500, HitLook.MAGIC_DAMAGE));
  60.  
  61.  
  62. }else if(attackStyle == 2) { //heal
  63. npc.setNextForceTalk(new ForceTalk("Heal me almighty Saradomin"));
  64. npc.setNextGraphics(new Graphics(3067));
  65. player.getPackets().sendGameMessage("You've been injured and you can't use protective curses!");
  66. player.setPrayerDelay(Utils.getRandom(20000) + 5);
  67. npc.heal(500);
  68.  
  69. }else if(attackStyle == 3) { //to be decided
  70. npc.setCantInteract(true);
  71. npc.getCombat().removeTarget();
  72. WorldTasksManager.schedule(new WorldTask() {
  73.  
  74. @Override
  75. public void run() {
  76. for (Entity t : npc.getPossibleTargets()) {
  77. t.setNextGraphics(new Graphics(2741, 0, 100));
  78. //delayHit(npc, 0, t, new Hit(npc, 500, HitLook.MAGIC_DAMAGE));
  79. t.applyHit(new Hit(npc, (int) 400, HitLook.MAGIC_DAMAGE));
  80.  
  81. }
  82. npc.getCombat().addCombatDelay(3);
  83. npc.setCantInteract(false);
  84. npc.setTarget(target);
  85. }
  86.  
  87. }, 4);
  88.  
  89. }else if(attackStyle == 4) { //Ring attack
  90. npc.setNextForceTalk(new ForceTalk("Gahhhh!!!!!"));
  91. npc.setNextAnimation(new Animation(11364));
  92. npc.setNextGraphics(new Graphics(2600));
  93. npc.setCantInteract(true);
  94. npc.getCombat().removeTarget();
  95. WorldTasksManager.schedule(new WorldTask() {
  96.  
  97. @Override
  98. public void run() {
  99. for (Entity t : npc.getPossibleTargets()) {
  100. t.applyHit(new Hit(npc, (int) (t.getHitpoints() * Math.random()), HitLook.REGULAR_DAMAGE, 0));
  101. }
  102. npc.getCombat().addCombatDelay(3);
  103. npc.setCantInteract(false);
  104. npc.setTarget(target);
  105. }
  106.  
  107. }, 4);
  108. } else if (attackStyle == 5) { // freeze
  109. npc.setNextForceTalk(new ForceTalk("Arghhh!!!"));
  110. npc.setNextAnimation(new Animation(1979));
  111. playSound(171, player, target);
  112. target.addFreezeDelay(20000, true);
  113. delayHit(npc, 0, player, new Hit(npc, Utils.getRandom(200), HitLook.MAGIC_DAMAGE));
  114. target.getPoison().makePoisoned(180);
  115.  
  116. } else if (attackStyle == 6) { //Jad range attack
  117. npc.setNextForceTalk(new ForceTalk("This will do!"));
  118. target.setNextGraphics(new Graphics(3000));
  119. delayHit(npc, 0, player, new Hit(npc, 300, HitLook.RANGE_DAMAGE));
  120.  
  121. } else if (attackStyle == 7) { //to be decided
  122.  
  123.  
  124. } else if (attackStyle == 8 && player.getInventory().getFreeSlots() > 0) { //removes weapon
  125.  
  126. npc.setNextForceTalk(new ForceTalk("Your weapon is weak!!!"));
  127. ButtonHandler.sendRemove(player, Equipment.SLOT_WEAPON);
  128. delayHit(npc, 0, player, new Hit(npc, 100, HitLook.RANGE_DAMAGE));
  129.  
  130. } else if (attackStyle == 9) { //teleports
  131. npc.setCantInteract(true);
  132. npc.getCombat().removeTarget();
  133. WorldTasksManager.schedule(new WorldTask() {
  134. @Override
  135. public void run() {
  136. npc.setCantInteract(false);
  137. npc.setTarget(target);
  138. int size = npc.getSize();
  139. int[][] dirs = Utils.getCoordOffsetsNear(size);
  140. for (int dir = 0; dir < dirs[0].length; dir++) {
  141. final WorldTile tile = new WorldTile(new WorldTile(
  142. target.getX() + dirs[0][dir], target.getY()
  143. + dirs[1][dir], target.getPlane()));
  144. if (World.canMoveNPC(tile.getPlane(), tile.getX(),
  145. tile.getY(), size)) { // if found done
  146. npc.setNextWorldTile(tile);
  147. }
  148. }
  149. }
  150. }, 3);
  151. return defs.getAttackDelay();
  152. }
  153. return 10;
  154. }
  155.  
  156.  
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement