- 143
- Posts
- 11
- Years
- Seen Jun 11, 2021
I'm having difficulty trying to create a new move. It's supposed to poison the opponent, but only if you're poisoned. It also has a chance to slow the opponent down. However, when I try to use it, it doesn't work. Here's what the code looks like:
Can anyone help me clean it up?
Code:
################################################################################
# If user is poisoned, then it poisons the foe. (Sneeze)
################################################################################
class PokeBattle_Move_159 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
return false if !opponent.pbCanPoison?(attacker,false,self)
if attacker.status==PBStatuses::POISON && opponent.status!=PBStatuses::POISON
opponent.pbPoison(attacker)
@battle.pbDisplay(_INTL("{1} was poisoned!",opponent.pbThis))
return true
end
end
def pbAdditionalEffect(attacker,opponent)
if opponent.pbCanReduceStatStage?(PBStats::SPEED,false)
opponent.pbReduceStat(PBStats::SPEED,1,false)
end
return true
end
end