public final void setInUse(boolean inUse) { _inUse = inUse; if (_inUse) { _startConditionsCorrect = onStart(); if (_template.abnormalEffect != 0) getEffected().startAbnormalEffect(_template.abnormalEffect); } else { if (_template.abnormalEffect != 0) getEffected().stopAbnormalEffect(_template.abnormalEffect); if (_startConditionsCorrect) { onExit(); if (_skill.isItemSkill() && _skill.isActive()) _effected._itemActiveSkill = null; } } }
public final void scheduleEffect() { if (_state == EffectState.CREATED) { if (_skill.isActive() && _skill.getName().startsWith("Item Skill")) { if (_effected._itemActiveSkill != null) _effected._itemActiveSkill.exit(); _effected._itemActiveSkill = this; } _state = EffectState.ACTING; if (_skill.isPvpSkill()) { SystemMessage smsg = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT); smsg.addSkillName(_skill); getEffected().sendPacket(smsg); } if (_count > 1) { startEffectTaskAtFixedRate(5, _period * 1000); return; } if (_period > 0) { startEffectTask(_period * 1000); return; } // effects not having count or period should start setInUse(true); } if (_state == EffectState.ACTING) { if (_count-- > 0) { if (getInUse()) // effect has to be in use { if (onActionTime() && _startConditionsCorrect) return; // false causes effect to finish right away } else if (_count > 0) // do not finish it yet, in case reactivated return; } _state = EffectState.FINISHING; } if (_state == EffectState.FINISHING) { if (getInUse() || !(_count > 1 || _period > 0)) setInUse(false); stopEffectTask(); if (_effectorObject != null) _effectorObject.onEffectFinished(_effected, getSkill()); } }