Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent wrong Evolve behavior, pls do n't change meaning of mnemonic parameters #2213

Merged
merged 1 commit into from
Aug 2, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions PoGo.NecroBot.Logic/Tasks/EvolvePokemonTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,26 @@ public static async Task Execute(ISession session, CancellationToken cancellatio

if (pokemonToEvolve.Any())
{
var totalPokemon = await session.Inventory.GetPokemons();
if (session.LogicSettings.KeepPokemonsThatCanEvolve)
{
var totalPokemon = await session.Inventory.GetPokemons();

var pokemonNeededInInventory = session.Profile.PlayerData.MaxPokemonStorage * session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage / 100.0f;
var needPokemonToStartEvolve = Math.Round(
Math.Max(0,
Math.Min(pokemonNeededInInventory, session.Profile.PlayerData.MaxPokemonStorage)));
var pokemonNeededInInventory = session.Profile.PlayerData.MaxPokemonStorage * session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage / 100.0f;
var needPokemonToStartEvolve = Math.Round(
Math.Max(0,
Math.Min(pokemonNeededInInventory, session.Profile.PlayerData.MaxPokemonStorage)));

var deltaCount = needPokemonToStartEvolve - totalPokemon.Count();
var deltaCount = needPokemonToStartEvolve - totalPokemon.Count();

if (deltaCount > 0)
{
session.EventDispatcher.Send(new NoticeEvent()
if (deltaCount > 0)
{
Message = session.Translation.GetTranslation(TranslationString.WaitingForMorePokemonToEvolve,
pokemonToEvolve.Count, deltaCount, totalPokemon.Count(), needPokemonToStartEvolve, session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage)
});
return;
session.EventDispatcher.Send(new NoticeEvent()
{
Message = session.Translation.GetTranslation(TranslationString.WaitingForMorePokemonToEvolve,
pokemonToEvolve.Count, deltaCount, totalPokemon.Count(), needPokemonToStartEvolve, session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage)
});
return;
}
}

if (await shouldUseLuckyEgg(session, pokemonToEvolve))
Expand Down