Package lineage2.gameserver.model.instances

Examples of lineage2.gameserver.model.instances.MonsterInstance


    if (target != null)
    {
      _oldGilmoreRef = target.getRef();
      target.decayMe();
      NpcTemplate template = NpcHolder.getInstance().getTemplate(Gilmore);
      MonsterInstance monster = new MonsterInstance(IdFactory.getInstance().getNextId(), template);
      monster.setCurrentHpMp(monster.getMaxHp(), monster.getMaxMp(), true);
      monster.setXYZ(73329, 117705, -3741);
      GilmoreAI ai = new GilmoreAI(monster);
      monster.setAI(ai);
      monster.spawnMe();
      _spawns.add(monster);
    }
  }
View Full Code Here


      {
        if (target.isMonster())
        {
          if (!((MonsterInstance) target).isSpoiled())
          {
            MonsterInstance monster = (MonsterInstance) target;
            boolean success;
            success = Formulas.calcSkillSuccess(activeChar, target, this, getActivateRate());
            if (success && monster.setSpoiled((Player) activeChar))
            {
              activeChar.sendPacket(new SystemMessage(SystemMessage.S1_HAS_SUCCEEDED).addSkillName(_id, getDisplayLevel()));
            }
            else
            {
              activeChar.sendPacket(new SystemMessage(SystemMessage.S1_HAS_FAILED).addSkillName(_id, getDisplayLevel()));
              return;
            }
          }
        }
        if (getPower() > 0)
        {
          double damage, reflectableDamage = 0;
          if (isMagic())
          {
            AttackInfo info = Formulas.calcMagicDam(activeChar, target, this, ss);
            damage = info.damage;
            reflectableDamage = info.reflectableDamage;
          }
          else
          {
            AttackInfo info = Formulas.calcPhysDam(activeChar, target, this, false, false, ss > 0, false);
            damage = info.damage;
            reflectableDamage = info.reflectableDamage;
            if (info.lethal_dmg > 0)
            {
              target.reduceCurrentHp(info.lethal_dmg, reflectableDamage, activeChar, this, true, true, false, false, false, false, false);
            }
          }
          target.reduceCurrentHp(damage, reflectableDamage, activeChar, this, true, true, false, true, false, false, true);
          target.doCounterAttack(this, activeChar, false);
        }
        getEffects(activeChar, target, false, false);
        target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, Math.max(_effectPoint, 1));
      }
      //SWEEP PART
      Player player = (Player) activeChar;
      if ((target == null) || !target.isMonster())
      {
        continue;
      }
      MonsterInstance targetMonster = (MonsterInstance) target;
      List<RewardItem> items = targetMonster.takeSweep();
      if (items == null)
      {
        continue;
      }
      for (RewardItem item : items)
View Full Code Here

   * Method onStart.
   */
  @Override
  public void onStart()
  {
    MonsterInstance monster = (MonsterInstance) getEffected();
    Creature mostHated = monster.getAggroList().getMostHated();
    if (mostHated == null)
    {
      return;
    }
    AggroList.AggroInfo mostAggroInfo = monster.getAggroList().get(mostHated);
    List<Creature> hateList = monster.getAggroList().getHateList();
    hateList.remove(mostHated);
    if (!hateList.isEmpty())
    {
      AggroList.AggroInfo newAggroInfo = monster.getAggroList().get(hateList.get(Rnd.get(hateList.size())));
      final int oldHate = newAggroInfo.hate;
      newAggroInfo.hate = mostAggroInfo.hate;
      mostAggroInfo.hate = oldHate;
    }
  }
View Full Code Here

        }
      }
    }
    if (actor.isMinion())
    {
      MonsterInstance leader = ((MinionInstance) actor).getLeader();
      if (leader != null)
      {
        double distance = actor.getDistance(leader.getX(), leader.getY());
        if (distance > 1000)
        {
          actor.teleToLocation(leader.getMinionPosition());
        }
        else if (distance > 200)
        {
          addTaskMove(leader.getMinionPosition(), false);
        }
        return true;
      }
    }
    if (randomAnimation())
View Full Code Here

    if (transformer > 0)
    {
      int chance = actor.getParameter("transformChance", 5);
      if ((chance == 100) || ((((MonsterInstance) actor).getChampion() == 0) && (actor.getCurrentHpPercents() > 50) && Rnd.chance(chance)))
      {
        MonsterInstance npc = (MonsterInstance) NpcHolder.getInstance().getTemplate(transformer).getNewInstance();
        npc.setSpawnedLoc(actor.getLoc());
        npc.setReflection(actor.getReflection());
        npc.setChampion(((MonsterInstance) actor).getChampion());
        npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp(), true);
        npc.spawnMe(npc.getSpawnedLoc());
        npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, attacker, 100);
        actor.doDie(actor);
        actor.decayMe();
        attacker.setTarget(npc);
        attacker.sendPacket(new StatusUpdate(npc).addAttribute(StatusUpdateField.CUR_HP, StatusUpdateField.MAX_HP));
        return;
View Full Code Here

    if ((System.currentTimeMillis() - _lastFactionNotifyTime) > _minFactionNotifyInterval)
    {
      _lastFactionNotifyTime = System.currentTimeMillis();
      if (actor.isMinion())
      {
        MonsterInstance master = ((MinionInstance) actor).getLeader();
        if (master != null)
        {
          if (!master.isDead() && master.isVisible())
          {
            master.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, attacker, damage);
          }
          MinionList minionList = master.getMinionList();
          if (minionList != null)
          {
            for (MinionInstance minion : minionList.getAliveMinions())
            {
              if (minion != actor)
View Full Code Here

    player.sendPacket(SystemMessage2.removeItems(seedId, 1L));
    for (Creature target : targets)
    {
      if (target != null)
      {
        MonsterInstance monster = (MonsterInstance) target;
        if (monster.isSeeded())
        {
          continue;
        }
        double SuccessRate = Config.MANOR_SOWING_BASIC_SUCCESS;
        double diffPlayerTarget = Math.abs(activeChar.getLevel() - target.getLevel());
        double diffSeedTarget = Math.abs(Manor.getInstance().getSeedLevel(seedId) - target.getLevel());
        if (diffPlayerTarget > Config.MANOR_DIFF_PLAYER_TARGET)
        {
          SuccessRate -= (diffPlayerTarget - Config.MANOR_DIFF_PLAYER_TARGET) * Config.MANOR_DIFF_PLAYER_TARGET_PENALTY;
        }
        if (diffSeedTarget > Config.MANOR_DIFF_SEED_TARGET)
        {
          SuccessRate -= (diffSeedTarget - Config.MANOR_DIFF_SEED_TARGET) * Config.MANOR_DIFF_SEED_TARGET_PENALTY;
        }
        if (altSeed)
        {
          SuccessRate *= Config.MANOR_SOWING_ALT_BASIC_SUCCESS / Config.MANOR_SOWING_BASIC_SUCCESS;
        }
        if (SuccessRate < 1)
        {
          SuccessRate = 1;
        }
        if (player.isGM())
        {
          activeChar.sendMessage(new CustomMessage("lineage2.gameserver.skills.skillclasses.Sowing.Chance", player).addNumber((long) SuccessRate));
        }
        if (Rnd.chance(SuccessRate) && monster.setSeeded(player, seedId, altSeed))
        {
          activeChar.sendPacket(Msg.THE_SEED_WAS_SUCCESSFULLY_SOWN);
        }
        else
        {
View Full Code Here

      {
        if (!target.isMonster())
        {
          continue;
        }
        MonsterInstance monster = (MonsterInstance) target;
        if (!monster.isSeeded())
        {
          activeChar.sendPacket(Msg.THE_HARVEST_FAILED_BECAUSE_THE_SEED_WAS_NOT_SOWN);
          continue;
        }
        if (!monster.isSeeded(player))
        {
          activeChar.sendPacket(Msg.YOU_ARE_NOT_AUTHORIZED_TO_HARVEST);
          continue;
        }
        double SuccessRate = Config.MANOR_HARVESTING_BASIC_SUCCESS;
        int diffPlayerTarget = Math.abs(activeChar.getLevel() - monster.getLevel());
        if (diffPlayerTarget > Config.MANOR_DIFF_PLAYER_TARGET)
        {
          SuccessRate -= (diffPlayerTarget - Config.MANOR_DIFF_PLAYER_TARGET) * Config.MANOR_DIFF_PLAYER_TARGET_PENALTY;
        }
        if (SuccessRate < 1)
        {
          SuccessRate = 1;
        }
        if (player.isGM())
        {
          player.sendMessage(new CustomMessage("lineage2.gameserver.skills.skillclasses.Harvesting.Chance", player).addNumber((long) SuccessRate));
        }
        if (!Rnd.chance(SuccessRate))
        {
          activeChar.sendPacket(Msg.THE_HARVEST_HAS_FAILED);
          monster.clearHarvest();
          continue;
        }
        RewardItem item = monster.takeHarvest();
        if (item == null)
        {
          continue;
        }
        ItemInstance harvest;
View Full Code Here

   * Method spawnClone.
   * @param id int
   */
  static void spawnClone(int id)
  {
    final MonsterInstance clone;
    clone = (MonsterInstance) spawn(CLONE, _cloneLoc[id].x, _cloneLoc[id].y, locZ, 49152);
    _clones.put(clone, clone.getLoc());
  }
View Full Code Here

    {
      if ((_clones == null) || _clones.isEmpty())
      {
        return;
      }
      MonsterInstance nextclone;
      for (MonsterInstance clone : _clones.keySet())
      {
        if (clone.isDead() || clone.isDeleted())
        {
          nextclone = (MonsterInstance) spawn(CLONE, _clones.get(clone).x, _clones.get(clone).y, locZ, 49152);
          _clones.put(nextclone, nextclone.getLoc());
          _clones.remove(clone);
        }
      }
    }
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.