Exemplo n.º 1
0
  @Override
  public String onSpellFinished(L2NpcInstance npc, L2PcInstance player, L2Skill skill) {
    if (npc.getNpcId() == ZAKEN) {
      int skillId = skill.getId();
      if (skillId == 4222) {
        // npc.teleToLocation(_ai1, _ai2, _ai3);
        npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      } else if (skillId == 4216) {
        // int i1 = Rnd.get(15);
        // player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
        // Zcoords[i1]);
        ((L2Attackable) npc).stopHating(player);
        L2Character nextTarget = ((L2Attackable) npc).getMostHated();
        if (nextTarget != null)
          npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);

      } else if (skillId == 4217) {
        int i0 = 0;
        // int i1 = Rnd.get(15);
        // player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
        // Zcoords[i1]);
        ((L2Attackable) npc).stopHating(player);

        if (c_quest0 != null
            && _quest0 > 0
            && c_quest0 != player
            && c_quest0.getZ() > (player.getZ() - 100)
            && c_quest0.getZ() < (player.getZ() + 100)) {
          if ((((c_quest0.getX() - player.getX()) * (c_quest0.getX() - player.getX()))
                  + ((c_quest0.getY() - player.getY()) * (c_quest0.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest0.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest0);
          }
        }
        if (c_quest1 != null
            && _quest0 > 1
            && c_quest1 != player
            && c_quest1.getZ() > (player.getZ() - 100)
            && c_quest1.getZ() < (player.getZ() + 100)) {
          if ((((c_quest1.getX() - player.getX()) * (c_quest1.getX() - player.getX()))
                  + ((c_quest1.getY() - player.getY()) * (c_quest1.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest1.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest1);
          }
        }
        if (c_quest2 != null
            && _quest0 > 2
            && c_quest2 != player
            && c_quest2.getZ() > (player.getZ() - 100)
            && c_quest2.getZ() < (player.getZ() + 100)) {
          if ((((c_quest2.getX() - player.getX()) * (c_quest2.getX() - player.getX()))
                  + ((c_quest2.getY() - player.getY()) * (c_quest2.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest2.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest2);
          }
        }
        if (c_quest3 != null
            && _quest0 > 3
            && c_quest3 != player
            && c_quest3.getZ() > (player.getZ() - 100)
            && c_quest3.getZ() < (player.getZ() + 100)) {
          if ((((c_quest3.getX() - player.getX()) * (c_quest3.getX() - player.getX()))
                  + ((c_quest3.getY() - player.getY()) * (c_quest3.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest3.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest3);
          }
        }
        if (c_quest4 != null
            && _quest0 > 4
            && c_quest4 != player
            && c_quest4.getZ() > (player.getZ() - 100)
            && c_quest4.getZ() < (player.getZ() + 100)) {
          if ((((c_quest4.getX() - player.getX()) * (c_quest4.getX() - player.getX()))
                  + ((c_quest4.getY() - player.getY()) * (c_quest4.getY() - player.getY())))
              > (250 * 250)) {
            i0 = 1;
          } else {
            i0 = 0;
          }
          if (i0 == 0) {
            // i1 = Rnd.get(15);
            // c_quest4.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650),
            // Zcoords[i1]);
            ((L2Attackable) npc).stopHating(c_quest4);
          }
        }
        L2Character nextTarget = ((L2Attackable) npc).getMostHated();
        if (nextTarget != null)
          npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
      }
    }
    return super.onSpellFinished(npc, player, skill);
  }