In that case, what you are looking for the IsUnconditional handler. While the master ball just returns true, no questions asked, we do get the battle and battler objects, so we can check the type.
BallHandlers::IsUnconditional.add(:POISONCRYSTAL,proc{|ball,battle,battler|
next battler.pbHasType?(:POISON)
})
This would make it unconditional in the case of the pokemon having at least one type as poison. But you also want it to always fail if its not. We'd have to edit this bit here in PokeBattle_Battle to not do any shakes if x equals 0 or something. That way we can make a modify capture rate to always return 0 but because of the isUnconditional?, it will still activate properly.
if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
shakes=4
else
x=1 if x<1
y = ( 65536 / ((255.0/x)**0.1875) ).floor
if USECRITICALCAPTURE && pbRandom(256)<c
critical=true
shakes=4 if pbRandom(65536)<y
else
shakes+=1 if pbRandom(65536)<y
shakes+=1 if pbRandom(65536)<y && shakes==1
shakes+=1 if pbRandom(65536)<y && shakes==2
shakes+=1 if pbRandom(65536)<y && shakes==3
end
end
Change that to this instead
if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
shakes=4
elsif x != 0
x=1 if x<1
y = ( 65536 / ((255.0/x)**0.1875) ).floor
if USECRITICALCAPTURE && pbRandom(256)<c
critical=true
shakes=4 if pbRandom(65536)<y
else
shakes+=1 if pbRandom(65536)<y
shakes+=1 if pbRandom(65536)<y && shakes==1
shakes+=1 if pbRandom(65536)<y && shakes==2
shakes+=1 if pbRandom(65536)<y && shakes==3
end
end