@Override public boolean run(final Item item) { final LocalPlayerCharacter character = WakfuGameEntity.getInstance().getLocalPlayer(); if (character.getBags().getItemFromInventories(item.getUniqueId()) == null) { ReduceDeadStateItemAction.m_logger.error( (Object) "[ItemAction] On essaye de lancer une action avec un item qui n'est pas dans les bags"); return false; } boolean hasDeadState = false; final List<StateRunningEffect> states = character.getRunningEffectManager().getRunningState(); for (int i = 0; i < states.size(); ++i) { final StateRunningEffect effect = states.get(i); if (effect.getState() == null || effect.getState().isStateForDeath()) { hasDeadState = true; break; } } if (!hasDeadState) { ReduceDeadStateItemAction.m_logger.warn( (Object) "Tentative d'utilisation d'un item de reduction de DEAD_STATE sans en avoir"); return false; } this.sendRequest(item.getUniqueId()); return true; }
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(); }