當前位置: 首頁>>代碼示例>>Java>>正文


Java CatchResult類代碼示例

本文整理匯總了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;
}
 
開發者ID:mackenzieg,項目名稱:PokemonGoBot,代碼行數:10,代碼來源:CatchPokemon.java

示例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;

}
 
開發者ID:mackenzieg,項目名稱:PokemonGoBot,代碼行數:29,代碼來源:CatchPokemon.java

示例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);
}
 
開發者ID:mackenzieg,項目名稱:PokemonGoBot,代碼行數:10,代碼來源:SimplePokemonBot.java

示例4: catchNearbyPokemon

import com.pokegoapi.api.map.pokemon.CatchResult; //導入依賴的package包/類
public List<CatchResult> catchNearbyPokemon() {
    return CatchPokemon.catchPokemon(logger, pokemonBot.getCatchablePokemon());
}
 
開發者ID:mackenzieg,項目名稱:PokemonGoBot,代碼行數:4,代碼來源:CatchPokemonActivity.java


注:本文中的com.pokegoapi.api.map.pokemon.CatchResult類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。