# v19Pursuit-like Ability

This thread pertains to v19 of Pokémon Essentials.

#### Thundercats464

##### Rookie
Member
I have an idea to make an ability that gives a pokemon’s moves base 40 power also act like pursuit when an opponent is switching out. I've looked through the code to understand how the logic on this works, but just checking if anyone might have any ideas on where to start on making this possible?

#### Astralneko

##### Creator of Pokémon Azure and Rose
Member
First, just a factor to consider, why not make this apply to all moves with AT MOST 40 power, rather than exactly 40 power? This is how Abilities such as Technician work.

But onto the coding help. Performing the move damage and accuracy changes (Pursuit always hits and deals double damage if the opponent switches) is easy, as these are very similar effects to those of Technician (move damage) and No Guard (specifically the AccuracyCalcUserAbility battle handler, as the other handler No Guard uses is for someone targeting the Pokémon with No Guard with a move). Just copy and paste those, making sure the Technician and No Guard copies are edited to check for the move's power (whether you go with 40 or less or exactly 40) and the opponent's switching state.

The difficult bit is to make moves that fit the rule go before switching. The pbPursuit method in Battle_Phase_Attack subsection does all the checking to make Pursuit go before switching out. This particular line:

Ruby:
next if b.movedThisRound? || !pbChoseMoveFunctionCode?(b.index,"088")   # Pursuit

Is going to skip everything for non-Pursuit moves. You're gonna wanna make sure this line in particular doesn't skip the special Pursuit case if the user has your Ability. Also you're gonna wanna add a statement that DOES skip if the Pokémon DOES have the ability, but the move they're using is too high power. Something along the lines of
Ruby:
next if [user has ability code here] && [user's move power is too low]
. You can also make it so that if the Technician-like check succeeds, apply a (unique) status effect to the user that is then checked for in the pbPursuit method instead of trying to check the move power itself, similarly to how Beak Blast works. This would also make it so that if you decide to change the requirements for the Ability to activate, you just have to change two lines of code in one script section (the modified No Guard and Technician codes) rather than three lines of code in two script sections. Just remember to get rid of said status effect at the end of the turn! That'll be somewhere along with Destiny Bond and other effects that do something when the turn ends.

Happy coding!