kwsch / pk3DS

Pokémon (3DS) ROM Editor & Randomizer
https://projectpokemon.org/forums/forums/topic/34377-pk3ds-xyoras-rom-editor-randomizer/
Other
404 stars 150 forks source link

Fixed logic for Type Themed Trainers. #477

Closed zmarotrix closed 3 years ago

zmarotrix commented 3 years ago

The logic failed to properly detect "GYM6" as a GYM trainer that needed to have Type themed Pokemon. Same for ELITE trainers.

Type themed trainers still sometimes have non-typed Pokemon. I plan to continue looking into this.

Also want to reduce duplicate Pokemon because it seems to be happening very often.

kwsch commented 3 years ago

Rather than hardcoding 3 separate string checks and not using the allocated ImportantClasses array:

ImportantClasses.Contains(rImportant[i]));

should have been

ImportantClasses.Any(rImportant[i].Contains));

"entry's type contains any of the important class names"

Had things been designed better, we would be using enums instead of strings and could have an extension class to check if the enum value was important :P

zmarotrix commented 3 years ago

I never knew about that .any thing, that would be a lot cleaner. I was rooting around to see if I could find a enum for the pokemon but I never found it so that would explain why. At least I didn't find it because it simply does not exist.