Package lineage2.gameserver.model.instances

Examples of lineage2.gameserver.model.instances.MonsterInstance


        _lastMinionCount = Math.max(actor.getMinionList().getAliveMinions().size(), 1);
    }

    @Override
    protected void onEvtAttacked(Creature attacker, int damage) {
        MonsterInstance actor = (MonsterInstance) getActor();
        if (actor.isDead())
            return;
        _lastMinionCount = Math.max(actor.getMinionList().getAliveMinions().size(), 1);
        super.onEvtAttacked(attacker, damage);
    }
View Full Code Here


   */
  @Override
  protected void onEvtAttacked(Creature attacker, int damage)
  {
    final NpcInstance actor = getActor();
    final MonsterInstance _mob = (MonsterInstance) actor;
    if ((_mob.getNpcId() == CANNIBALISTIC_STAKATO_LEADER) && Rnd.chance(ABSORB_MINION_CHANCE) && (_mob.getCurrentHpPercents() < 30))
    {
      final MonsterInstance _follower = getAliveMinion(actor);
      if ((_follower != null) && (_follower.getCurrentHpPercents() > 30))
      {
        _mob.abortAttack(true, false);
        _mob.abortCast(true, false);
        _mob.setHeading(PositionUtils.getHeadingTo(_mob, _follower));
        _mob.doCast(SkillTable.getInstance().getInfo(4485, 1), _follower, false);
        _mob.setCurrentHp(_mob.getCurrentHp() + _follower.getCurrentHp(), false);
        _follower.doDie(_follower);
        _follower.deleteMe();
      }
    }
    super.onEvtAttacked(attacker, damage);
  }
View Full Code Here

  @Override
  protected void onEvtDead(Creature killer)
  {
    final NpcInstance actor = getActor();
    final MinionInstance _minion = getAliveMinion(actor);
    MonsterInstance _leader = null;
    switch (actor.getNpcId())
    {
      case SPIKE_STAKATO_NURSE:
        if (_minion == null)
        {
          break;
        }
        actor.broadcastPacket(new MagicSkillUse(actor, actor, 2046, 1, 1000, 0));
        for (int i = 0; i < 3; i++)
        {
          spawnMonster(_minion, killer, SPIKED_STAKATO_CAPTAIN);
        }
        break;
      case SPIKED_STAKATO_BABY:
        _leader = ((MinionInstance) actor).getLeader();
        if ((_leader != null) && !_leader.isDead())
        {
          ThreadPoolManager.getInstance().schedule(new ChangeMonster(SPIKE_STAKATO_NURSE_CHANGED, actor, killer), 3000L);
        }
        break;
      case MALE_SPIKED_STAKATO:
        if (_minion == null)
        {
          break;
        }
        actor.broadcastPacket(new MagicSkillUse(actor, actor, 2046, 1, 1000, 0));
        for (int i = 0; i < 3; i++)
        {
          spawnMonster(_minion, killer, SPIKED_STAKATO_GUARD);
        }
        break;
      case FEMALE_SPIKED_STAKATO:
        _leader = ((MinionInstance) actor).getLeader();
        if ((_leader != null) && !_leader.isDead())
        {
          ThreadPoolManager.getInstance().schedule(new ChangeMonster(MALE_SPIKED_STAKATO_2, actor, killer), 3000L);
        }
        break;
      case QUEEN_SHYEED:
View Full Code Here

   * @param fisher Player
   */
  public static void spawnPenaltyMonster(Player fisher)
  {
    int npcId = 18319 + Math.min(fisher.getLevel() / 11, 7);
    MonsterInstance npc = new MonsterInstance(IdFactory.getInstance().getNextId(), NpcHolder.getInstance().getTemplate(npcId));
    npc.setSpawnedLoc(Location.findPointToStay(fisher, 100, 120));
    npc.setReflection(fisher.getReflection());
    npc.setHeading(fisher.getHeading() - 32768);
    npc.spawnMe(npc.getSpawnedLoc());
    npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, fisher, Rnd.get(1, 100));
  }
View Full Code Here

  protected void onEvtSpawn()
  {
    final NpcInstance actor = getActor();
    for (Location loc : _mysticSpawnPoints)
    {
      MonsterInstance mob = new MonsterInstance(IdFactory.getInstance().getNextId(), NpcHolder.getInstance().getTemplate(FOUNDRY_MYSTIC_ID));
      mob.setSpawnedLoc(loc);
      mob.setReflection(actor.getReflection());
      mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp(), true);
      mob.spawnMe(mob.getSpawnedLoc());
    }
    for (Location loc : _spiritGuardSpawnPoints)
    {
      MonsterInstance mob = new MonsterInstance(IdFactory.getInstance().getNextId(), NpcHolder.getInstance().getTemplate(FOUNDRY_SPIRIT_GUARD_ID));
      mob.setSpawnedLoc(loc);
      mob.setReflection(actor.getReflection());
      mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp(), true);
      mob.spawnMe(mob.getSpawnedLoc());
    }
    setZoneInactive();
    super.onEvtSpawn();
  }
View Full Code Here

   * @return boolean
   */
  public boolean paralizeOnAttack(Creature attacker)
  {
    int max_attacker_level = 0xFFFF;
    MonsterInstance leader;
    if (isRaid() || (isMinion() && ((leader = ((MinionInstance) this).getLeader()) != null) && leader.isRaid()))
    {
      max_attacker_level = getLevel() + Config.RAID_MAX_LEVEL_DIFF;
    }
    else if (isNpc())
    {
View Full Code Here

    }
    for (NpcInstance npc : World.getAroundNpc(actor, 1000, 200))
    {
      if (Rnd.chance(10) && (npc != null) && (npc.getNpcId() == 20235))
      {
        MonsterInstance monster = (MonsterInstance) npc;
        if (Rnd.chance(20))
        {
          addTaskCast(monster, actor.getKnownSkill(1467));
        }
        else
View Full Code Here

          {
            activeChar.sendPacket(Msg.ALREADY_SPOILED);
          }
          else
          {
            MonsterInstance monster = (MonsterInstance) target;
            boolean success;
            if (!Config.ALT_SPOIL_FORMULA)
            {
              int monsterLevel = monster.getLevel();
              int modifier = Math.abs(monsterLevel - activeChar.getLevel());
              double rateOfSpoil = Config.BASE_SPOIL_RATE;
              if (modifier > 8)
              {
                rateOfSpoil = rateOfSpoil - ((rateOfSpoil * (modifier - 8) * 9) / 100);
              }
              rateOfSpoil = (rateOfSpoil * getMagicLevel()) / monsterLevel;
              if (rateOfSpoil < Config.MINIMUM_SPOIL_RATE)
              {
                rateOfSpoil = Config.MINIMUM_SPOIL_RATE;
              }
              else if (rateOfSpoil > 99.)
              {
                rateOfSpoil = 99.;
              }
              if (((Player) activeChar).isGM())
              {
                activeChar.sendMessage(new CustomMessage("lineage2.gameserver.skills.skillclasses.Spoil.Chance", (Player) activeChar).addNumber((long) rateOfSpoil));
              }
              success = Rnd.chance(rateOfSpoil);
            }
            else
            {
              success = Formulas.calcSkillSuccess(activeChar, target, this, getActivateRate());
            }
            if (success && monster.setSpoiled((Player) activeChar))
            {
              activeChar.sendPacket(Msg.THE_SPOIL_CONDITION_HAS_BEEN_ACTIVATED);
            }
            else
            {
View Full Code Here

    {
      if ((targ == null) || !targ.isMonster() || !targ.isDead() || !((MonsterInstance) targ).isSpoiled())
      {
        continue;
      }
      MonsterInstance target = (MonsterInstance) targ;
      if (!target.isSpoiled(player))
      {
        activeChar.sendPacket(Msg.THERE_ARE_NO_PRIORITY_RIGHTS_ON_A_SWEEPER);
        continue;
      }
      List<RewardItem> items = target.takeSweep();
      if (items == null)
      {
        activeChar.getAI().setAttackTarget(null);
        target.endDecayTask();
        continue;
      }
      for (RewardItem item : items)
      {
        ItemInstance sweep = ItemFunctions.createItem(item.itemId);
        sweep.setCount(item.count);
        if (player.isInParty() && player.getParty().isDistributeSpoilLoot())
        {
          player.getParty().distributeItem(player, sweep, null);
          continue;
        }
        if (!player.getInventory().validateCapacity(sweep) || !player.getInventory().validateWeight(sweep))
        {
          sweep.dropToTheGround(player, target);
          continue;
        }
        player.getInventory().addItem(sweep);
        SystemMessage smsg;
        if (item.count == 1)
        {
          smsg = new SystemMessage(SystemMessage.YOU_HAVE_OBTAINED_S1);
          smsg.addItemName(item.itemId);
          player.sendPacket(smsg);
        }
        else
        {
          smsg = new SystemMessage(SystemMessage.YOU_HAVE_OBTAINED_S2_S1);
          smsg.addItemName(item.itemId);
          smsg.addNumber(item.count);
          player.sendPacket(smsg);
        }
        if (player.isInParty())
        {
          if (item.count == 1)
          {
            smsg = new SystemMessage(SystemMessage.S1_HAS_OBTAINED_S2_BY_USING_SWEEPER);
            smsg.addName(player);
            smsg.addItemName(item.itemId);
            player.getParty().broadcastToPartyMembers(player, smsg);
          }
          else
          {
            smsg = new SystemMessage(SystemMessage.S1_HAS_OBTAINED_3_S2_S_BY_USING_SWEEPER);
            smsg.addName(player);
            smsg.addItemName(item.itemId);
            smsg.addNumber(item.count);
            player.getParty().broadcastToPartyMembers(player, smsg);
          }
        }
      }
      activeChar.getAI().setAttackTarget(null);
      target.endDecayTask();
    }
  }
View Full Code Here

   * @param points List<Location>
   */
  private static void spawn(int id, List<Location> points)
  {
    NpcTemplate template = NpcHolder.getInstance().getTemplate(id);
    MonsterInstance monster = new MonsterInstance(IdFactory.getInstance().getNextId(), template);
    monster.setCurrentHpMp(monster.getMaxHp(), monster.getMaxMp(), true);
    monster.setXYZ(points.get(0).x, points.get(0).y, points.get(0).z);
    MonstersAI ai = new MonstersAI(monster);
    ai.setPoints(points);
    monster.setAI(ai);
    monster.spawnMe();
    _spawns.add(monster);
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.instances.MonsterInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.