Grover-c13/PokeGOAPI-Java

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

Qudyjac opened this issue · 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.

Gegy commented

This should be fixed in #906