Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Character$AIAccessor


    {
      if (Config.ENABLE_ALL_EXCEPTIONS)
        e.printStackTrace();
    }
   
    L2Character target = null;
   
    for (L2Object target2 : targets)
    {
      target = (L2Character) target2;
     
      // We should not heal if char is dead or invulnerable (celestial?)
      if (target == null || target.isDead() || target.isInvul())
        continue;
     
      // We should not heal walls and door
      if (target instanceof L2DoorInstance)
        continue;
     
      // We should not heal siege flags
      if (target instanceof L2NpcInstance && ((L2NpcInstance) target).getNpcId() == 35062)
      {
        activeChar.getActingPlayer().sendMessage("You cannot heal siege flags!");
        continue;
      }
     
      // Player holding a cursed weapon can't be healed and can't heal
      if (target != activeChar)
      {
        if (target instanceof L2PcInstance && ((L2PcInstance) target).isCursedWeaponEquiped())
          continue;
        else if (player != null && player.isCursedWeaponEquiped())
          continue;
      }
     
      double hp = skill.getPower();
     
      if (skill.getSkillType() == SkillType.HEAL_PERCENT)
      {
        hp = target.getMaxHp() * hp / 100.0;
      }
      else
      {
        if (bss)
        {
          hp *= 1.5;
        }
        else if (sps)
        {
          hp *= 1.3;
        }   
      }
     
      if (skill.getSkillType() == SkillType.HEAL_STATIC)
        hp = skill.getPower();
      else if (skill.getSkillType() != SkillType.HEAL_PERCENT)
        hp *= target.calcStat(Stats.HEAL_EFFECTIVNESS, 100, null, null) / 100;
     
      target.setCurrentHp(hp + target.getCurrentHp());
      target.setLastHealAmount((int) hp);
      StatusUpdate su = new StatusUpdate(target.getObjectId());
      su.addAttribute(StatusUpdate.CUR_HP, (int) target.getCurrentHp());
      target.sendPacket(su);
      su = null;
     
      if (target instanceof L2PcInstance)
      {
        if (skill.getId() == 4051)
        {
          SystemMessage sm = new SystemMessage(SystemMessageId.REJUVENATING_HP);
          target.sendPacket(sm);
          sm = null;
        }
        else
        {
          if (activeChar instanceof L2PcInstance && activeChar != target)
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S2_HP_RESTORED_BY_S1);
            sm.addString(activeChar.getName());
            sm.addNumber((int) hp);
            target.sendPacket(sm);
            sm = null;
          }
          else
          {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_HP_RESTORED);
            sm.addNumber((int) hp);
            target.sendPacket(sm);
            sm = null;
          }
        }
      }
      target = null;
View Full Code Here


  @Override
  public Object onEvent(final String event, Object... params)
  {
    if(event.compareTo(BaseExtender.EventType.SETOWNER.name) == 0)
    {
      L2Character reference = (L2Character) L2World.getInstance().findObject((Integer) params[1]);
      L2Character owner = (L2Character) L2World.getInstance().findObject(_item.getOwnerId());
      EngraveManager.getInstance().logAction(_item, reference, owner, params[0].toString());
    }
    else if(event.compareTo("DESTROY") == 0 || event.compareTo("CRYSTALLIZE") == 0 || event.compareTo("MULTISELL") == 0)
    {
      L2PcInstance owner = (L2PcInstance) L2World.getInstance().findObject(_item.getOwnerId());
      if(EngraveManager.getInstance().getEngraver(_item.getObjectId()) != _item.getOwnerId())
      {
        if(!PowerPakConfig.ENGRAVE_ALLOW_DESTROY)
        {
          if(owner != null)
          {
            owner.sendMessage("You can not destroy the object you are not engraved.");
          }
          return true;
        }
      }
      EngraveManager.getInstance().logAction(_item, owner, null, "Destroy");
View Full Code Here

  /** Notify started */
  @Override
  public void onStart()
  {
    L2Character effected = getEffected();
    if(effected instanceof L2PcInstance)
    {
      setChameleon(true);
      ((L2PcInstance) effected).setSilentMoving(true);
      ((L2PcInstance) effected).sitDown();
    }
    else
    {
      effected.getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
    }
  }
View Full Code Here

  @Override
  public void onExit()
  {
    setChameleon(false);

    L2Character effected = getEffected();
    if(effected instanceof L2PcInstance)
    {
      ((L2PcInstance) effected).setSilentMoving(false);
    }
  }
View Full Code Here

  }

  @Override
  public boolean onActionTime()
  {
    L2Character effected = getEffected();
    boolean retval = true;

    if(effected.isDead())
    {
      retval = false;
    }

    // Only cont skills shouldn't end
    if(getSkill().getSkillType() != SkillType.CONT)
      return false;

    if(effected instanceof L2PcInstance)
    {
      if(!((L2PcInstance) effected).isSitting())
      {
        retval = false;
      }
    }

    double manaDam = calc();

    if(manaDam > effected.getStatus().getCurrentMp())
    {
      effected.sendPacket(new SystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
      return false;
    }

    if(!retval)
    {
      setChameleon(retval);
    }
    else
    {
      effected.reduceCurrentMp(manaDam);
    }

    return retval;
  }
View Full Code Here

    return retval;
  }

  private void setChameleon(boolean val)
  {
    L2Character effected = getEffected();
    if(effected instanceof L2PcInstance)
    {
      ((L2PcInstance) effected).setRelax(val);
    }
  }
View Full Code Here

          int radius = Integer.parseInt(player);
          for(L2Object object : activeChar.getKnownList().getKnownObjects().values())
          {
            if(object instanceof L2Character)
            {
              L2Character character = (L2Character) object;
              character.setCurrentHpMp(character.getMaxHp(), character.getMaxMp());

              if(object instanceof L2PcInstance)
              {
                character.setCurrentCp(character.getMaxCp());
              }

              character = null;
            }
          }
          activeChar.sendMessage("Healed within " + radius + " unit radius.");
          return;
        }
        catch(NumberFormatException nbe)
        {
          //ignore
        }
      }

      plyr = null;
    }

    if(obj == null)
    {
      obj = activeChar;
    }

    if(obj instanceof L2Character)
    {
      L2Character target = (L2Character) obj;
      target.setCurrentHpMp(target.getMaxHp(), target.getMaxMp());

      if(target instanceof L2PcInstance)
      {
        target.setCurrentCp(target.getMaxCp());
      }

      if(Config.DEBUG)
      {
        _log.fine("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") healed character " + target.getName());
      }

    }
    else
    {
View Full Code Here

    }
  }

  protected void thinkAttackGroup()
  {
    L2Character target = getForcedTarget();
    if(target == null || target.isAlikeDead())
    {
      // try to get next group target
      setForcedTarget(findNextGroupTarget());
      clientStopMoving(null);
    }

    if(target == null)
      return;
   
    _actor.setTarget(target);
    // as a response, we put the target in a forced attack mode
    L2ControllableMobInstance theTarget = (L2ControllableMobInstance) target;
    L2ControllableMobAI ctrlAi = (L2ControllableMobAI) theTarget.getAI();
    ctrlAi.forceAttack(_actor);
   
    L2Skill[] skills = _actor.getAllSkills();
    double dist2 = _actor.getPlanDistanceSq(target.getX(), target.getY());
    int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + target.getTemplate().collisionRadius;
    int max_range = range;
   
    if(!_actor.isMuted() && dist2 > (range + 20) * (range + 20))
    {
      // check distant skills
View Full Code Here

        moveToPawn(getAttackTarget(), range);
        return;
      }

      // Force mobs to attack anybody if confused.
      L2Character hated;
      if(_actor.isConfused())
      {
        hated = findNextRndTarget();
      }
      else
View Full Code Here

  }

  private void thinkActive()
  {
    setAttackTarget(findNextRndTarget());
    L2Character hated;

    if(_actor.isConfused())
    {
      hated = findNextRndTarget();
    }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Character$AIAccessor

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.