Yo guys, anyone able to help me make an ability that draws in sound-based moves like Lightningrod, and boosts Sp.Atk? I've tried a variety of approaches and can't get it to work :P
The methods that abilities like Lightning Rod use are all type-based, and don't check for move categories, so you'll have to build your own methods to check for Sound to get this to work. It doesn't look hard, though.
For the re-targeting effect, you'll probably have to create a new method thats nearly identical to
def pbChangeTargetByAbility. Except change/remove everything related to "drawnType" and make it so that it checks whether the move is sound-based instead, rather than checking for a specific type. Then just include this new check at the end of
def pbChangeTargets in the same way the checks for Lightning Rod and Storm Drain are handled.
For the stat boost effect, again, you'll have to just create a new method that is nearly identical to
def pbBattleMoveImmunityStatAbility. But again, remove/change all the code related to type, and instead make it check for whether or not the move is Sound-based. Then create a new
BattleHandlers::MoveImmunityTargetAbility ability in the same way Lightning Rod is handled, except have it check for your new sound-based immunity method, rather than the type-based one.
Then finally, just copy the
BattleHandlers::AccuracyCalcTargetAbility effect abilities like Lightning Rod use, except have it check for a Sound move rather than a move type. This'll prevent the drawn-in moves from missing.
If you wanna be extra fancy, you could make this a bit more generalized so that you can use these new methods to check for other move categories too (Dance moves, Biting moves, bomb moves, etc) just in case you want to create other abilities with the same concept later on, but for different kinds of move categories. But that might be jumping the gun a bit.