Exemplo n.º 1
0
  protected L2Effect(Env env, EffectTemplate template) {
    _state = EffectState.CREATED;
    _skill = env.skill;
    _template = template;
    _effected = env.target;
    _effector = env.player;
    if (env.object != null && env.object instanceof IEffector)
      _effectorObject = (IEffector) env.object;
    else _effectorObject = env.player;
    _count = template.count;
    _triggeredId = template.triggeredId;
    _triggeredLevel = template.triggeredLevel;

    int id = _skill.getId();
    int temp = template.period;
    if ((id > 2277 && id < 2286) || (id >= 2512 && id <= 2514)) {
      if (_effected instanceof L2SummonInstance
          || (_effected.isPlayer() && _effected.getPet() instanceof L2SummonInstance)) temp /= 2;
    }

    if (env.skillMastery) temp *= 2;

    _period = temp;
    _periodStartTicks = GameTimeController.getGameTicks();
    _periodfirsttime = 0;
    scheduleEffect();
  }
Exemplo n.º 2
0
 @Override
 public void run() {
   try {
     if (_periodfirsttime == 0) _periodStartTicks = GameTimeController.getGameTicks();
     else _periodfirsttime = 0;
     scheduleEffect();
   } catch (Exception e) {
     _log.error("Effect fail");
     e.printStackTrace();
   }
 }
Exemplo n.º 3
0
 public void setFirstTime(int newfirsttime) {
   if (_currentFuture != null) {
     _periodStartTicks =
         GameTimeController.getGameTicks() - newfirsttime * GameTimeController.TICKS_PER_SECOND;
     _currentFuture.cancel(false);
     _currentFuture = null;
     _currentTask = null;
     _periodfirsttime = newfirsttime;
     int duration = _period - _periodfirsttime;
     _currentTask = new EffectTask(duration * 1000, -1);
     _currentFuture =
         ThreadPoolManager.getInstance().scheduleEffect(_currentTask, duration * 1000);
   }
 }
Exemplo n.º 4
0
 public int getTime() {
   return (GameTimeController.getGameTicks() - _periodStartTicks)
       / GameTimeController.TICKS_PER_SECOND;
 }