I have this script there:
if hasWorkingAbility(:CONTRARY)
pbIncreaseStatBasic(PBStats::ATTACK,1)
@battle.pbCommonAnimation("StatUp",self,nil)
@battle.pbDisplay(_INTL("{1}'s Attack rose beacause of its Contrary!",pbThis))
return false
end
if you add it above the line with the code:
if !opponent.hasWorkingAbility(:CONTRARY)
it might fix the problem. It's not 100% sure to fix the problem though...