Closed umamaistempo closed 11 months ago
Next improvement I intend to do to improve readability is keeping the collection of overrides as a map/dict instead of several position-based lists.
Eg:
{
2: [-1, -1],
30: [2, -1]
}
Looks good! One other small improvement would be to replace the paired pokemonList.find()
pokemonList.indexOf()
calls with pokemonList.findIndex()
. From a quick glance it looks like most of the uses only need the index, not the full pokemon object, and when the latter is used might as well access it via the index.
Good catch, will apply that change later today.
Additionally, when I work on the map refactor, this will be replaced by
just a simple pokeballFilters.get(id)
On Mon, 5 Jun 2023 at 19:36 umbralOptimatum @.***> wrote:
Looks good! One other small improvement would be to replace the paired pokemonList.find() pokemonList.indexOf() calls with pokemonList.findIndex(). From a quick glance it looks like most of the uses only need the index, not the full pokemon object, and when the latter is used might as well access it via the index.
— Reply to this email directly, view it on GitHub https://github.com/Ephenia/Pokeclicker-Scripts/pull/316#issuecomment-1577573789, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWQ4JNUVDURLE3WTY3CI6DXJZNQTANCNFSM6AAAAAAY3QZ3PU . You are receiving this because you authored the thread.Message ID: @.***>
--
Charlotte Lorelei Oliveira LinkedIn https://www.linkedin.com/in/umamaistempo/
Approved!
This PR superseeds #315
By just overloading the
calculatePokeballToUse
instead of overriding thedefeatPokemon
method we become more future-proof and don't do more than the minimal necessary to apply the catch filter.This should fix #314, you can check that now on dungeons the number of enemies defeated (top-right corner of dungeon map box) is now displayed correctly as the game original
defeatPokemon
procedure is being executed.Thanks to @umbralOptimatum for suggesting this change
Tests