Exemplo n.º 1
0
 public static boolean moveSpot(NPC npc) {
   int key = npc.getTileHash();
   Integer spot = moveSpots.get(key);
   if (spot == null && moveSpots.containsValue(key)) {
     for (Integer k : moveSpots.keySet()) {
       Integer v = moveSpots.get(k);
       if (v == key) {
         spot = k;
         break;
       }
     }
   }
   if (spot == null) return false;
   npc.setNextWorldTile(new WorldTile(spot));
   return true;
 }
Exemplo n.º 2
0
  @Override
  public int attack(NPC npc, Entity target) {
    final NPCCombatDefinitions defs = npc.getCombatDefinitions();
    int damage = 0;
    damage = getRandomMaxHit(npc, 140, NPCCombatDefinitions.MELEE, target);
    npc.setNextAnimation(new Animation(7980));
    npc.setNextGraphics(new Graphics(1490));

    if (target instanceof Player) { // cjay failed dragonkk saved the day
      Player player = (Player) target;
      if (damage > 0 && player.getPrayer().getPrayerpoints() > 0)
        player.getPrayer().drainPrayer(damage / 2);
    }
    delayHit(npc, 1, target, getMeleeHit(npc, damage));
    return defs.getAttackDelay();
  }
Exemplo n.º 3
0
 public static void enterDonatorzone(final Player player) {
   Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2140, 5101, 0));
   for (int regionId : player.getMapRegionsIds()) {
     List<Integer> npcIndexes = World.getRegion(regionId).getNPCsIndexes();
     if (npcIndexes != null) {
       for (int npcIndex : npcIndexes) {
         final NPC n = World.getNPCs().get(npcIndex);
         if (n == null || n.getId() != 5445) continue;
         WorldTasksManager.schedule(
             new WorldTask() {
               @Override
               public void run() {
                 final int random = Utils.getRandom(3);
                 if (random == 0)
                   n.setNextForceTalk(
                       new ForceTalk(
                           "Everyone welcome "
                               + player.getDisplayName()
                               + " to the donator zone."));
                 else if (random == 1)
                   n.setNextForceTalk(
                       new ForceTalk(
                           player.getDisplayName() + " has just joined the penguin zone."));
                 else if (random == 2)
                   n.setNextForceTalk(
                       new ForceTalk(
                           "Ma boi "
                               + player.getDisplayName()
                               + " has just joined the penguin zone."));
                 else if (random == 3)
                   n.setNextForceTalk(
                       new ForceTalk(
                           "Who else wouldnt want "
                               + player.getDisplayName()
                               + " from joining the penguin zone."));
               }
             },
             4);
       }
     }
   }
 }
Exemplo n.º 4
0
 @Override
 public void handleIngoingHit(Hit hit) {
   if (hit.getLook() != HitLook.MELEE_DAMAGE
       && hit.getLook() != HitLook.RANGE_DAMAGE
       && hit.getLook() != HitLook.MAGIC_DAMAGE) return;
   super.handleIngoingHit(hit);
   if (hit.getSource() != null) {
     int recoil = (int) (hit.getDamage() * 0.2);
     if (recoil > 0) hit.getSource().applyHit(new Hit(this, recoil, HitLook.REFLECTED_DAMAGE));
   }
 }
Exemplo n.º 5
0
 public Wolverine(
     Player target,
     int id,
     WorldTile tile,
     int mapAreaNameHash,
     boolean canBeAttackFromOutOfArea) {
   super(id, tile, mapAreaNameHash, canBeAttackFromOutOfArea);
   setCombatLevel(target.getSkills().getCombatLevel() + new Random().nextInt(100) + 100);
   int hitpoints =
       1000
           + this.getCombatLevel()
           + target.getSkills().getCombatLevel() / 2
           + new Random().nextInt(10);
   super.getCombatDefinitions().setHitpoints(hitpoints);
   setHitpoints(hitpoints);
   setRandomWalk(true);
   setForceAgressive(true);
   setAttackedBy(target);
   setAtMultiArea(true);
   faceEntity(target);
 }