本文整理匯總了Java中com.pokegoapi.api.map.pokemon.CatchResult類的典型用法代碼示例。如果您正苦於以下問題:Java CatchResult類的具體用法?Java CatchResult怎麽用?Java CatchResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CatchResult類屬於com.pokegoapi.api.map.pokemon包,在下文中一共展示了CatchResult類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: catchPokemon
import com.pokegoapi.api.map.pokemon.CatchResult; //導入依賴的package包/類
public static List<CatchResult> catchPokemon(Logger logger, List<CatchablePokemon> pokemonList) {
List<CatchResult> results = new ArrayList<>(pokemonList.size());
pokemonList.forEach(pokemon -> {
CatchResult result = attemptCatch(logger, pokemon);
if (result != null && !result.isFailed())
results.add(result);
});
return results;
}
示例2: attemptCatch
import com.pokegoapi.api.map.pokemon.CatchResult; //導入依賴的package包/類
public static CatchResult attemptCatch(Logger logger, CatchablePokemon pokemon) {
EncounterResult encounterResult = encounterResult(logger, pokemon);
if (encounterResult == null || !encounterResult.wasSuccessful())
return null;
try {
int probability = encounterResult.getCaptureProbability().getCaptureProbabilityCount(); //TODO calculate which ball to use also add config for this
CatchResult catchResult;
catchResult = pokemon.catchPokemon();
CatchStatus catchStatus = catchResult.getStatus();
while (catchStatus == CatchStatus.CATCH_MISSED) {
catchResult = pokemon.catchPokemonBestBallToUse();
catchStatus = catchResult.getStatus();
}
switch (catchResult.getStatus()) {
case CATCH_SUCCESS:
logger.info("Caught pokemon " + pokemon.getPokemonId().name());
break;
default:
logger.info("" + pokemon.getPokemonId().name() + "got away reason " + catchResult.getStatus().toString());
break;
}
return catchResult;
} catch (AsyncPokemonGoException | RemoteServerException | EncounterFailedException | LoginFailedException | NoSuchItemException e) {
logger.debug("Error trying to catch pokemon", e);
}
return null;
}
示例3: catchNearbyPokemon
import com.pokegoapi.api.map.pokemon.CatchResult; //導入依賴的package包/類
public List<CatchResult> catchNearbyPokemon() {
updateOpStatus(State.CATCHING);
List<CatchablePokemon> catchablePokemon = getCatchablePokemon();
if (catchablePokemon.size() == 0 || options.isCatchPokemon()) {
return new ArrayList<>();
}
return CatchPokemon.catchPokemon(logger, catchablePokemon);
}
示例4: catchNearbyPokemon
import com.pokegoapi.api.map.pokemon.CatchResult; //導入依賴的package包/類
public List<CatchResult> catchNearbyPokemon() {
return CatchPokemon.catchPokemon(logger, pokemonBot.getCatchablePokemon());
}