I was able to adapt this resource for V21.1, and it was exactly what I needed for my project. I want Pokemon for my project's needs to have 2 Abilities and 2 Hidden Abilities. It can cycle through a Pokemon's ability index and not cause problems, compared to other solutions, where it's more tricky to adapt them to allow Pokemon to have 2 Hidden Abilities.
I recommend this resource if you need a Pokemon game that has a no-nonsense and flexible way of cycling through a Pokemon's abilities, that properly shows the player what abilities the Pokemon can learn.