|
@@ -39,7 +39,8 @@ import com.l2jserver.gameserver.model.stats.Env;
|
|
/**
|
|
/**
|
|
* Abstract effect implementation.<br>
|
|
* Abstract effect implementation.<br>
|
|
* Instant effects should not override {@link #onExit(BuffInfo)}.<br>
|
|
* Instant effects should not override {@link #onExit(BuffInfo)}.<br>
|
|
- * Instant effects should not override {@link #canStart(BuffInfo)}, all checks should be done {@link #onStart(BuffInfo)}. Do not call super class methods {@link #onStart(BuffInfo)} nor {@link #onExit(BuffInfo)}.<br>
|
|
|
|
|
|
+ * Instant effects should not override {@link #canStart(BuffInfo)}, all checks should be done {@link #onStart(BuffInfo)}.<br>
|
|
|
|
+ * Do not call super class methods {@link #onStart(BuffInfo)} nor {@link #onExit(BuffInfo)}.
|
|
* @since <a href="http://trac.l2jserver.com/changeset/6249">Changeset 6249</a> the "effect steal constructor" is deprecated.
|
|
* @since <a href="http://trac.l2jserver.com/changeset/6249">Changeset 6249</a> the "effect steal constructor" is deprecated.
|
|
* @author Zoey76
|
|
* @author Zoey76
|
|
*/
|
|
*/
|
|
@@ -48,9 +49,12 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
|
|
protected static final Logger _log = Logger.getLogger(AbstractEffect.class.getName());
|
|
protected static final Logger _log = Logger.getLogger(AbstractEffect.class.getName());
|
|
|
|
|
|
// Conditions
|
|
// Conditions
|
|
|
|
+ /** Attach condition. */
|
|
private final Condition _attachCond;
|
|
private final Condition _attachCond;
|
|
|
|
+ // Apply condition
|
|
// private final Condition _applyCond; // TODO: Use or cleanup.
|
|
// private final Condition _applyCond; // TODO: Use or cleanup.
|
|
private List<FuncTemplate> _funcTemplates;
|
|
private List<FuncTemplate> _funcTemplates;
|
|
|
|
+ /** Effect class name. */
|
|
private final String _name;
|
|
private final String _name;
|
|
private final double _val;
|
|
private final double _val;
|
|
/** Ticks. */
|
|
/** Ticks. */
|
|
@@ -61,10 +65,10 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
|
|
|
|
|
|
/**
|
|
/**
|
|
* Abstract effect constructor.
|
|
* Abstract effect constructor.
|
|
- * @param attachCond
|
|
|
|
- * @param applyCond
|
|
|
|
- * @param set
|
|
|
|
- * @param params
|
|
|
|
|
|
+ * @param attachCond the attach condition
|
|
|
|
+ * @param applyCond the apply condition
|
|
|
|
+ * @param set the attributes
|
|
|
|
+ * @param params the parameters
|
|
*/
|
|
*/
|
|
protected AbstractEffect(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
|
protected AbstractEffect(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
|
{
|
|
{
|
|
@@ -78,6 +82,14 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
|
|
_chanceCondition = ChanceCondition.parse(set.getString("chanceType", null), set.getInt("activationChance", -1), set.getInt("activationMinDamage", -1), set.getString("activationElements", null), set.getString("activationSkills", null), set.getBoolean("pvpChanceOnly", false));
|
|
_chanceCondition = ChanceCondition.parse(set.getString("chanceType", null), set.getInt("activationChance", -1), set.getInt("activationMinDamage", -1), set.getString("activationElements", null), set.getString("activationSkills", null), set.getBoolean("pvpChanceOnly", false));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Creates an effect given the parameters.
|
|
|
|
+ * @param attachCond the attach condition
|
|
|
|
+ * @param applyCond the apply condition
|
|
|
|
+ * @param set the attributes
|
|
|
|
+ * @param params the parameters
|
|
|
|
+ * @return the new effect
|
|
|
|
+ */
|
|
public static final AbstractEffect createEffect(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
|
public static final AbstractEffect createEffect(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params)
|
|
{
|
|
{
|
|
final String name = set.getString("name");
|
|
final String name = set.getString("name");
|
|
@@ -93,10 +105,9 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
|
|
{
|
|
{
|
|
constructor = handler.getConstructor(Condition.class, Condition.class, StatsSet.class, StatsSet.class);
|
|
constructor = handler.getConstructor(Condition.class, Condition.class, StatsSet.class, StatsSet.class);
|
|
}
|
|
}
|
|
- catch (NoSuchMethodException | SecurityException e1)
|
|
|
|
|
|
+ catch (NoSuchMethodException | SecurityException e)
|
|
{
|
|
{
|
|
- _log.warning(AbstractEffect.class.getSimpleName() + ": Requested unexistent constructor for effect handler: " + name);
|
|
|
|
- e1.printStackTrace();
|
|
|
|
|
|
+ _log.warning(AbstractEffect.class.getSimpleName() + ": Requested unexistent constructor for effect handler: " + name + ": " + e.getMessage());
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -106,7 +117,7 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
|
|
}
|
|
}
|
|
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
|
|
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
|
|
{
|
|
{
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ _log.warning(AbstractEffect.class.getSimpleName() + ": Unable to initialize effect handler: " + name + ": " + e.getMessage());
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -122,7 +133,7 @@ public abstract class AbstractEffect implements IChanceSkillTrigger
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Attachs a function template.
|
|
|
|
|
|
+ * Attaches a function template.
|
|
* @param f the function
|
|
* @param f the function
|
|
*/
|
|
*/
|
|
public void attach(FuncTemplate f)
|
|
public void attach(FuncTemplate f)
|