PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

When catching a pokemon a berry can only be used for the first throw.

Open Qudyjac opened this issue 9 years ago • 1 comments

Description: On subsequent throws ( in case of CATCH_ESCAPE ) no berries can be used because activeItem is not null.

Change: file: Encounter.java line 150 ff

try {
	CatchPokemonResponse response = CatchPokemonResponse.parseFrom(responseData);
	status = response.getStatus();

	if (hasCaptured()) {
		captureAward = response.getCaptureAward();
		capturedPokemon = response.getCapturedPokemonId();
		captureReason = response.getCaptureReason();
	}

	if (status == CatchStatus.CATCH_SUCCESS || status == CatchStatus.CATCH_FLEE) {
		pokemon.setDespawned(true);
	}

	if (status == CatchStatus.CATCH_SUCCESS) {
		api.getPlayerProfile().updateProfile();
	}

	if (status != CatchStatus.CATCH_ERROR) {
		item.setCount(item.getCount() - 1);
	}
} catch (InvalidProtocolBufferException e) {
	throw new RequestFailedException(e);
}

insert at the end of the try block ( line 171 ):

if (status == CatchStatus.CATCH_ESCAPE) {
	activeItem = null;
}

worked for me.

Qudyjac avatar Apr 10 '17 17:04 Qudyjac

This should be fixed in #906

Gegy avatar Apr 12 '17 11:04 Gegy