- 143
- Posts
- 11
- Years
- Seen Jun 11, 2021
I'm trying to create a move that causes a random weather effect whenever it's used. However, when I try to use it in battle, it just skips the move completely.
Did I enter something incorrectly?
Code:
class PokeBattle_Move_178 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
case @battle.weather
when PBWeather::HEAVYRAIN
@battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
return -1
when PBWeather::HARSHSUN
@battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
return -1
when PBWeather::STRONGWINDS
@battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
return -1
[email protected](4)
end
case rnd
when 0
if PBWeather::RAINDANCE
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
@battle.weather=PBWeather::RAINDANCE
@battle.weatherduration=5
@battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
@battle.pbCommonAnimation("Rain",nil,nil)
@battle.pbDisplay(_INTL("It started to rain!"))
return 0
when 1
if PBWeather::SUNNYDAY
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
@battle.weather=PBWeather::SUNNYDAY
@battle.weatherduration=5
@battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
@battle.pbCommonAnimation("Sunny",nil,nil)
@battle.pbDisplay(_INTL("The sunlight turned harsh!"))
return 0
when 2
if PBWeather::SANDSTORM
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
@battle.weather=PBWeather::SANDSTORM
@battle.weatherduration=5
@battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
@battle.pbCommonAnimation("Sandstorm",nil,nil)
@battle.pbDisplay(_INTL("A sandstorm brewed!"))
return 0
when 3
if PBWeather::HAIL
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
@battle.weather=PBWeather::HAIL
@battle.weatherduration=5
@battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
@battle.pbCommonAnimation("Hail",nil,nil)
@battle.pbDisplay(_INTL("It started to hail!"))
return 0
end
return true
end
end