Ejemplo n.º 1
0
 private void applyNewState(final int newStateLevel, final RunningEffect linkedRE) {
   final int stateUniqueId =
       State.getUniqueIdFromBasicInformation((short) this.m_value, (short) newStateLevel);
   final StateRunningEffect stateRunningEffect =
       StateRunningEffect.checkOut(
           (EffectContext<WakfuEffect>) this.m_context,
           this.m_caster,
           (WakfuEffectContainer) this.m_effectContainer,
           stateUniqueId);
   if (stateRunningEffect == null) {
     StateDecurse.m_logger.error(
         (Object)
             ("Etat inconnu id "
                 + this.m_value
                 + ", level "
                 + newStateLevel
                 + ", effet correspondant : "
                 + ((this.m_genericEffect != null)
                     ? ((WakfuEffect) this.m_genericEffect).getEffectId()
                     : "null")));
     return;
   }
   final WakfuEffectExecutionParameters parameters =
       WakfuEffectExecutionParameters.checkOut(true, false, null);
   stateRunningEffect.setExecutionParameters(parameters);
   ((RunningEffect<FX, WakfuEffectContainer>) stateRunningEffect)
       .setEffectContainer((WakfuEffectContainer) this.m_effectContainer);
   ((RunningEffect<WakfuEffect, EC>) stateRunningEffect)
       .setGenericEffect(this.getStateRunningGenericEffect());
   stateRunningEffect.addEndTriggers(this.getListeningTriggerForUnapplication());
   stateRunningEffect.setParent(linkedRE);
   stateRunningEffect.applyOnTargets(this.m_target);
   stateRunningEffect.release();
 }
Ejemplo n.º 2
0
 protected int computeEffectsToRemove(
     final ArrayList<RunningEffect> effectToRemove,
     final RunningEffectManager effectManager,
     int newStateLevel) {
   for (final RunningEffect effect : effectManager) {
     if (!(effect instanceof StateRunningEffect)) {
       continue;
     }
     final State state = ((StateRunningEffect) effect).getState();
     if (state.getStateBaseId() != this.m_value
         || (state.isInamovable()
             && !ApplyState.UNDECURSABLE_STATE.contains(state.getStateBaseId()))) {
       continue;
     }
     effectToRemove.add(effect);
     newStateLevel = state.getLevel() - this.m_levelToDecrease;
   }
   return newStateLevel;
 }