Package l2p.gameserver.skills.conditions

Source Code of l2p.gameserver.skills.conditions.ConditionTargetHasBuff

package l2p.gameserver.skills.conditions;

import l2p.gameserver.model.L2Character;
import l2p.gameserver.model.L2Effect;
import l2p.gameserver.skills.EffectType;
import l2p.gameserver.skills.Env;

public final class ConditionTargetHasBuff extends Condition
{
  private final EffectType _effectType;
  private final int _level;

  public ConditionTargetHasBuff(EffectType effectType, int level)
  {
    _effectType = effectType;
    _level = level;
  }

  @Override
  protected boolean testImpl(Env env)
  {
    L2Character target = env.target;
    if(target == null)
    {
      return false;
    }
    L2Effect effect = target.getEffectList().getEffectByType(_effectType);
    if(effect == null)
    {
      return false;
    }
    if(_level == -1 || effect.getSkill().getLevel() >= _level)
    {
      return true;
    }
    return false;
  }
}
TOP

Related Classes of l2p.gameserver.skills.conditions.ConditionTargetHasBuff

TOP
Copyright © 2018 www.massapi.com. 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.