Package l2p.gameserver.skills.conditions

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

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 class ConditionPlayerHasBuff extends Condition
{
  private final EffectType _effectType;
  private final int _level;

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

  @Override
  protected boolean testImpl(Env env)
  {
    L2Character character = env.character;
    if(character == null)
    {
      return false;
    }
    L2Effect effect = character.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.ConditionPlayerHasBuff

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.