Package l2p.gameserver.skills.conditions

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

package l2p.gameserver.skills.conditions;

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

public class ConditionInstanceOf extends Condition
{
  private final String _instance_name;
  private final boolean _istarget;

  public ConditionInstanceOf(String instance_name, boolean istarget)
  {
    _instance_name = instance_name;
    _istarget = istarget;
  }

  @Override
  protected boolean testImpl(Env env)
  {
    L2Character obj = _istarget ? env.target : env.character;
    if(obj == null)
    {
      return false;
    }
    String target_class = obj.getClass().getSimpleName();
    return target_class.equalsIgnoreCase(_instance_name);
  }
}
TOP

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

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.