Added class GameData::BattleWeather

This commit is contained in:
Maruno17
2021-02-21 19:04:36 +00:00
parent 63e640c79b
commit 611d0a74eb
22 changed files with 229 additions and 208 deletions

View File

@@ -0,0 +1,79 @@
module GameData
class BattleWeather
attr_reader :id
attr_reader :real_name
attr_reader :animation
DATA = {}
extend ClassMethodsSymbols
include InstanceMethods
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@animation = hash[:animation]
end
# @return [String] the translated name of this battle weather
def name
return _INTL(@real_name)
end
end
end
GameData::BattleWeather.register({
:id => :None,
:name => _INTL("None")
})
GameData::BattleWeather.register({
:id => :Sun,
:name => _INTL("Sun"),
:animation => "Sun"
})
GameData::BattleWeather.register({
:id => :Rain,
:name => _INTL("Rain"),
:animation => "Rain"
})
GameData::BattleWeather.register({
:id => :Sandstorm,
:name => _INTL("Sandstorm"),
:animation => "Sandstorm"
})
GameData::BattleWeather.register({
:id => :Hail,
:name => _INTL("Hail"),
:animation => "Hail"
})
GameData::BattleWeather.register({
:id => :HarshSun,
:name => _INTL("Harsh Sun"),
:animation => "HarshSun"
})
GameData::BattleWeather.register({
:id => :HeavyRain,
:name => _INTL("Heavy Rain"),
:animation => "HeavyRain"
})
GameData::BattleWeather.register({
:id => :StrongWinds,
:name => _INTL("Strong Winds"),
:animation => "StrongWinds"
})
GameData::BattleWeather.register({
:id => :ShadowSky,
:name => _INTL("Shadow Sky"),
:animation => "ShadowSky"
})

View File

@@ -1,32 +0,0 @@
begin
module PBWeather
None = 0
Sun = 1
Rain = 2
Sandstorm = 3
Hail = 4
HarshSun = 5
HeavyRain = 6
StrongWinds = 7
ShadowSky = 8
def self.animationName(weather)
case weather
when Sun then return "Sun"
when Rain then return "Rain"
when Sandstorm then return "Sandstorm"
when Hail then return "Hail"
when HarshSun then return "HarshSun"
when HeavyRain then return "HeavyRain"
when StrongWinds then return "StrongWinds"
when ShadowSky then return "ShadowSky"
end
return nil
end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
end
end

View File

@@ -170,9 +170,9 @@ class PokeBattle_Battler
if hasActiveAbility?(:FORECAST) if hasActiveAbility?(:FORECAST)
newForm = 0 newForm = 0
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun then newForm = 1 when :Sun, :HarshSun then newForm = 1
when PBWeather::Rain, PBWeather::HeavyRain then newForm = 2 when :Rain, :HeavyRain then newForm = 2
when PBWeather::Hail then newForm = 3 when :Hail then newForm = 3
end end
if @form!=newForm if @form!=newForm
@battle.pbShowAbilitySplash(self,true) @battle.pbShowAbilitySplash(self,true)
@@ -187,7 +187,7 @@ class PokeBattle_Battler
if isSpecies?(:CHERRIM) if isSpecies?(:CHERRIM)
if hasActiveAbility?(:FLOWERGIFT) if hasActiveAbility?(:FLOWERGIFT)
newForm = 0 newForm = 0
newForm = 1 if [PBWeather::Sun, PBWeather::HarshSun].include?(@battle.pbWeather) newForm = 1 if [:Sun, :HarshSun].include?(@battle.pbWeather)
if @form!=newForm if @form!=newForm
@battle.pbShowAbilitySplash(self,true) @battle.pbShowAbilitySplash(self,true)
@battle.pbHideAbilitySplash(self) @battle.pbHideAbilitySplash(self)

View File

@@ -52,8 +52,7 @@ class PokeBattle_Battler
return false return false
end end
# Weather immunity # Weather immunity
if newStatus == :FROZEN && if newStatus == :FROZEN && [:Sun, :HarshSun].include?(@battle.pbWeather)
(@battle.pbWeather==PBWeather::Sun || @battle.pbWeather==PBWeather::HarshSun)
@battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
return false return false
end end

View File

@@ -323,8 +323,7 @@ class PokeBattle_Battler
@battle.pbCommonAnimation("Powder",user) @battle.pbCommonAnimation("Powder",user)
@battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!")) @battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
user.lastMoveFailed = true user.lastMoveFailed = true
w = @battle.pbWeather if ![:Rain, :HeavyRain].include?(@battle.pbWeather) && user.takesIndirectDamage?
if w!=PBWeather::Rain && w!=PBWeather::HeavyRain && user.takesIndirectDamage?
oldHP = user.hp oldHP = user.hp
user.pbReduceHP((user.totalhp/4.0).round,false) user.pbReduceHP((user.totalhp/4.0).round,false)
user.pbFaint if user.fainted? user.pbFaint if user.fainted?
@@ -341,7 +340,7 @@ class PokeBattle_Battler
# Primordial Sea, Desolate Land # Primordial Sea, Desolate Land
if move.damagingMove? if move.damagingMove?
case @battle.pbWeather case @battle.pbWeather
when PBWeather::HeavyRain when :HeavyRain
if move.calcType == :FIRE if move.calcType == :FIRE
@battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!")) @battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))
user.lastMoveFailed = true user.lastMoveFailed = true
@@ -349,7 +348,7 @@ class PokeBattle_Battler
pbEndTurn(choice) pbEndTurn(choice)
return return
end end
when PBWeather::HarshSun when :HarshSun
if move.calcType == :WATER if move.calcType == :WATER
@battle.pbDisplay(_INTL("The Water-type attack evaporated in the harsh sunlight!")) @battle.pbDisplay(_INTL("The Water-type attack evaporated in the harsh sunlight!"))
user.lastMoveFailed = true user.lastMoveFailed = true

View File

@@ -46,7 +46,7 @@ class PokeBattle_Move
PBTypes.ineffective?(moveType,defType) PBTypes.ineffective?(moveType,defType)
end end
# Delta Stream's weather # Delta Stream's weather
if @battle.pbWeather==PBWeather::StrongWinds if @battle.pbWeather == :StrongWinds
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
PBTypes.superEffective?(moveType,defType) PBTypes.superEffective?(moveType,defType)
end end
@@ -373,19 +373,19 @@ class PokeBattle_Move
end end
# Weather # Weather
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
if type == :FIRE if type == :FIRE
multipliers[:final_damage_multiplier] *= 1.5 multipliers[:final_damage_multiplier] *= 1.5
elsif type == :WATER elsif type == :WATER
multipliers[:final_damage_multiplier] /= 2 multipliers[:final_damage_multiplier] /= 2
end end
when PBWeather::Rain, PBWeather::HeavyRain when :Rain, :HeavyRain
if type == :FIRE if type == :FIRE
multipliers[:final_damage_multiplier] /= 2 multipliers[:final_damage_multiplier] /= 2
elsif type == :WATER elsif type == :WATER
multipliers[:final_damage_multiplier] *= 1.5 multipliers[:final_damage_multiplier] *= 1.5
end end
when PBWeather::Sandstorm when :Sandstorm
if target.pbHasType?(:ROCK) && specialMove? && @function != "122" # Psyshock if target.pbHasType?(:ROCK) && specialMove? && @function != "122" # Psyshock
multipliers[:defense_multiplier] *= 1.5 multipliers[:defense_multiplier] *= 1.5
end end

View File

@@ -596,17 +596,18 @@ end
class PokeBattle_WeatherMove < PokeBattle_Move class PokeBattle_WeatherMove < PokeBattle_Move
def initialize(battle,move) def initialize(battle,move)
super super
@weatherType = PBWeather::None @weatherType = :None
end end
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
case @battle.field.weather case @battle.field.weather
when PBWeather::HarshSun when :HarshSun
@battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!")) @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
return true return true
when PBWeather::HeavyRain when :HeavyRain
@battle.pbDisplay(_INTL("There is no relief from this heavy rain!")) @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
return true return true
when PBWeather::StrongWinds when :StrongWinds
@battle.pbDisplay(_INTL("The mysterious air current blows on regardless!")) @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
return true return true
when @weatherType when @weatherType

View File

@@ -131,9 +131,9 @@ class PokeBattle_Move_008 < PokeBattle_ParalysisMove
def pbBaseAccuracy(user,target) def pbBaseAccuracy(user,target)
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
return 50 return 50
when PBWeather::Rain, PBWeather::HeavyRain when :Rain, :HeavyRain
return 0 return 0
end end
return super return super
@@ -201,7 +201,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_00D < PokeBattle_FreezeMove class PokeBattle_Move_00D < PokeBattle_FreezeMove
def pbBaseAccuracy(user,target) def pbBaseAccuracy(user,target)
return 0 if @battle.pbWeather==PBWeather::Hail return 0 if @battle.pbWeather == :Hail
return super return super
end end
end end
@@ -308,9 +308,9 @@ class PokeBattle_Move_015 < PokeBattle_ConfuseMove
def pbBaseAccuracy(user,target) def pbBaseAccuracy(user,target)
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
return 50 return 50
when PBWeather::Rain, PBWeather::HeavyRain when :Rain, :HeavyRain
return 0 return 0
end end
return super return super
@@ -731,10 +731,7 @@ class PokeBattle_Move_028 < PokeBattle_MultiStatUpMove
def pbOnStartUse(user,targets) def pbOnStartUse(user,targets)
increment = 1 increment = 1
if @battle.pbWeather==PBWeather::Sun || increment = 2 if [:Sun, :HarshSun].include?(@battle.pbWeather)
@battle.pbWeather==PBWeather::HarshSun
increment = 2
end
@statUp[1] = @statUp[3] = increment @statUp[1] = @statUp[3] = increment
end end
end end

View File

@@ -105,20 +105,20 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_087 < PokeBattle_Move class PokeBattle_Move_087 < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target) def pbBaseDamage(baseDmg,user,target)
baseDmg *= 2 if @battle.pbWeather!=PBWeather::None baseDmg *= 2 if @battle.pbWeather != :None
return baseDmg return baseDmg
end end
def pbBaseType(user) def pbBaseType(user)
ret = :NORMAL ret = :NORMAL
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
ret = :FIRE if GameData::Type.exists?(:FIRE) ret = :FIRE if GameData::Type.exists?(:FIRE)
when PBWeather::Rain, PBWeather::HeavyRain when :Rain, :HeavyRain
ret = :WATER if GameData::Type.exists?(:WATER) ret = :WATER if GameData::Type.exists?(:WATER)
when PBWeather::Sandstorm when :Sandstorm
ret = :ROCK if GameData::Type.exists?(:ROCK) ret = :ROCK if GameData::Type.exists?(:ROCK)
when PBWeather::Hail when :Hail
ret = :ICE if GameData::Type.exists?(:ICE) ret = :ICE if GameData::Type.exists?(:ICE)
end end
return ret return ret
@@ -2035,8 +2035,7 @@ class PokeBattle_Move_0C4 < PokeBattle_TwoTurnMove
def pbIsChargingTurn?(user) def pbIsChargingTurn?(user)
ret = super ret = super
if !user.effects[PBEffects::TwoTurnAttack] if !user.effects[PBEffects::TwoTurnAttack]
w = @battle.pbWeather if [:Sun, :HarshSun].include?(@battle.pbWeather)
if w==PBWeather::Sun || w==PBWeather::HarshSun
@powerHerb = false @powerHerb = false
@chargingTurn = true @chargingTurn = true
@damagingTurn = true @damagingTurn = true
@@ -2051,8 +2050,7 @@ class PokeBattle_Move_0C4 < PokeBattle_TwoTurnMove
end end
def pbBaseDamageMultiplier(damageMult,user,target) def pbBaseDamageMultiplier(damageMult,user,target)
w = @battle.pbWeather damageMult /= 2 if ![:None, :Sun, :HarshSun].include?(@battle.pbWeather)
damageMult /= 2 if w>0 && w!=PBWeather::Sun && w!=PBWeather::HarshSun
return damageMult return damageMult
end end
end end
@@ -2533,9 +2531,9 @@ end
class PokeBattle_Move_0D8 < PokeBattle_HealingMove class PokeBattle_Move_0D8 < PokeBattle_HealingMove
def pbOnStartUse(user,targets) def pbOnStartUse(user,targets)
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
@healAmount = (user.totalhp*2/3.0).round @healAmount = (user.totalhp*2/3.0).round
when PBWeather::None, PBWeather::StrongWinds when :None, :StrongWinds
@healAmount = (user.totalhp/2.0).round @healAmount = (user.totalhp/2.0).round
else else
@healAmount = (user.totalhp/4.0).round @healAmount = (user.totalhp/4.0).round
@@ -3717,6 +3715,6 @@ end
class PokeBattle_Move_0FF < PokeBattle_WeatherMove class PokeBattle_Move_0FF < PokeBattle_WeatherMove
def initialize(battle,move) def initialize(battle,move)
super super
@weatherType = PBWeather::Sun @weatherType = :Sun
end end
end end

View File

@@ -4,7 +4,7 @@
class PokeBattle_Move_100 < PokeBattle_WeatherMove class PokeBattle_Move_100 < PokeBattle_WeatherMove
def initialize(battle,move) def initialize(battle,move)
super super
@weatherType = PBWeather::Rain @weatherType = :Rain
end end
end end
@@ -16,7 +16,7 @@ end
class PokeBattle_Move_101 < PokeBattle_WeatherMove class PokeBattle_Move_101 < PokeBattle_WeatherMove
def initialize(battle,move) def initialize(battle,move)
super super
@weatherType = PBWeather::Sandstorm @weatherType = :Sandstorm
end end
end end
@@ -28,7 +28,7 @@ end
class PokeBattle_Move_102 < PokeBattle_WeatherMove class PokeBattle_Move_102 < PokeBattle_WeatherMove
def initialize(battle,move) def initialize(battle,move)
super super
@weatherType = PBWeather::Hail @weatherType = :Hail
end end
end end
@@ -2210,7 +2210,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_167 < PokeBattle_Move class PokeBattle_Move_167 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if @battle.pbWeather!=PBWeather::Hail if @battle.pbWeather != :Hail
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -2382,7 +2382,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_16D < PokeBattle_HealingMove class PokeBattle_Move_16D < PokeBattle_HealingMove
def pbHealAmount(user) def pbHealAmount(user)
return (user.totalhp*2/3.0).round if @battle.pbWeather==PBWeather::Sandstorm return (user.totalhp*2/3.0).round if @battle.pbWeather == :Sandstorm
return (user.totalhp/2.0).round return (user.totalhp/2.0).round
end end
end end

View File

@@ -642,7 +642,7 @@ class PokeBattle_Battle
# Returns the effective weather (note that weather effects can be negated) # Returns the effective weather (note that weather effects can be negated)
def pbWeather def pbWeather
eachBattler { |b| return PBWeather::None if b.hasActiveAbility?([:CLOUDNINE,:AIRLOCK]) } eachBattler { |b| return :None if b.hasActiveAbility?([:CLOUDNINE, :AIRLOCK]) }
return @field.weather return @field.weather
end end
@@ -656,17 +656,18 @@ class PokeBattle_Battle
@field.weather,duration,user,self) @field.weather,duration,user,self)
end end
@field.weatherDuration = duration @field.weatherDuration = duration
pbCommonAnimation(PBWeather.animationName(@field.weather)) if showAnim weather_data = GameData::BattleWeather.try_get(@field.weather)
pbCommonAnimation(weather_data.animation) if showAnim && weather_data
pbHideAbilitySplash(user) if user pbHideAbilitySplash(user) if user
case @field.weather case @field.weather
when PBWeather::Sun then pbDisplay(_INTL("The sunlight turned harsh!")) when :Sun then pbDisplay(_INTL("The sunlight turned harsh!"))
when PBWeather::Rain then pbDisplay(_INTL("It started to rain!")) when :Rain then pbDisplay(_INTL("It started to rain!"))
when PBWeather::Sandstorm then pbDisplay(_INTL("A sandstorm brewed!")) when :Sandstorm then pbDisplay(_INTL("A sandstorm brewed!"))
when PBWeather::Hail then pbDisplay(_INTL("It started to hail!")) when :Hail then pbDisplay(_INTL("It started to hail!"))
when PBWeather::HarshSun then pbDisplay(_INTL("The sunlight turned extremely harsh!")) when :HarshSun then pbDisplay(_INTL("The sunlight turned extremely harsh!"))
when PBWeather::HeavyRain then pbDisplay(_INTL("A heavy rain began to fall!")) when :HeavyRain then pbDisplay(_INTL("A heavy rain began to fall!"))
when PBWeather::StrongWinds then pbDisplay(_INTL("Mysterious strong winds are protecting Flying-type Pokémon!")) when :StrongWinds then pbDisplay(_INTL("Mysterious strong winds are protecting Flying-type Pokémon!"))
when PBWeather::ShadowSky then pbDisplay(_INTL("A shadow sky appeared!")) when :ShadowSky then pbDisplay(_INTL("A shadow sky appeared!"))
end end
# Check for end of primordial weather, and weather-triggered form changes # Check for end of primordial weather, and weather-triggered form changes
eachBattler { |b| b.pbCheckFormOnWeatherChange } eachBattler { |b| b.pbCheckFormOnWeatherChange }
@@ -677,19 +678,19 @@ class PokeBattle_Battle
oldWeather = @field.weather oldWeather = @field.weather
# End Primordial Sea, Desolate Land, Delta Stream # End Primordial Sea, Desolate Land, Delta Stream
case @field.weather case @field.weather
when PBWeather::HarshSun when :HarshSun
if !pbCheckGlobalAbility(:DESOLATELAND) if !pbCheckGlobalAbility(:DESOLATELAND)
@field.weather = PBWeather::None @field.weather = :None
pbDisplay("The harsh sunlight faded!") pbDisplay("The harsh sunlight faded!")
end end
when PBWeather::HeavyRain when :HeavyRain
if !pbCheckGlobalAbility(:PRIMORDIALSEA) if !pbCheckGlobalAbility(:PRIMORDIALSEA)
@field.weather = PBWeather::None @field.weather = :None
pbDisplay("The heavy rain has lifted!") pbDisplay("The heavy rain has lifted!")
end end
when PBWeather::StrongWinds when :StrongWinds
if !pbCheckGlobalAbility(:DELTASTREAM) if !pbCheckGlobalAbility(:DELTASTREAM)
@field.weather = PBWeather::None @field.weather = :None
pbDisplay("The mysterious air current has dissipated!") pbDisplay("The mysterious air current has dissipated!")
end end
end end
@@ -697,7 +698,7 @@ class PokeBattle_Battle
# Check for form changes caused by the weather changing # Check for form changes caused by the weather changing
eachBattler { |b| b.pbCheckFormOnWeatherChange } eachBattler { |b| b.pbCheckFormOnWeatherChange }
# Start up the default weather # Start up the default weather
pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather!=PBWeather::None pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather != :None
end end
end end

View File

@@ -271,16 +271,17 @@ class PokeBattle_Battle
# Show trainers on both sides sending out Pokémon # Show trainers on both sides sending out Pokémon
pbStartBattleSendOut(sendOuts) pbStartBattleSendOut(sendOuts)
# Weather announcement # Weather announcement
pbCommonAnimation(PBWeather.animationName(@field.weather)) weather_data = GameData::BattleWeather.try_get(@field.weather)
pbCommonAnimation(weather_data.animation) if weather_data
case @field.weather case @field.weather
when PBWeather::Sun then pbDisplay(_INTL("The sunlight is strong.")) when :Sun then pbDisplay(_INTL("The sunlight is strong."))
when PBWeather::Rain then pbDisplay(_INTL("It is raining.")) when :Rain then pbDisplay(_INTL("It is raining."))
when PBWeather::Sandstorm then pbDisplay(_INTL("A sandstorm is raging.")) when :Sandstorm then pbDisplay(_INTL("A sandstorm is raging."))
when PBWeather::Hail then pbDisplay(_INTL("Hail is falling.")) when :Hail then pbDisplay(_INTL("Hail is falling."))
when PBWeather::HarshSun then pbDisplay(_INTL("The sunlight is extremely harsh.")) when :HarshSun then pbDisplay(_INTL("The sunlight is extremely harsh."))
when PBWeather::HeavyRain then pbDisplay(_INTL("It is raining heavily.")) when :HeavyRain then pbDisplay(_INTL("It is raining heavily."))
when PBWeather::StrongWinds then pbDisplay(_INTL("The wind is strong.")) when :StrongWinds then pbDisplay(_INTL("The wind is strong."))
when PBWeather::ShadowSky then pbDisplay(_INTL("The sky is shadowy.")) when :ShadowSky then pbDisplay(_INTL("The sky is shadowy."))
end end
# Terrain announcement # Terrain announcement
terrain_data = GameData::BattleTerrain.try_get(@field.terrain) terrain_data = GameData::BattleTerrain.try_get(@field.terrain)

View File

@@ -40,35 +40,31 @@ class PokeBattle_Battle
# Weather wears off # Weather wears off
if @field.weatherDuration==0 if @field.weatherDuration==0
case @field.weather case @field.weather
when PBWeather::Sun when :Sun then pbDisplay(_INTL("The sunlight faded."))
pbDisplay(_INTL("The sunlight faded.")) when :Rain then pbDisplay(_INTL("The rain stopped."))
when PBWeather::Rain when :Sandstorm then pbDisplay(_INTL("The sandstorm subsided."))
pbDisplay(_INTL("The rain stopped.")) when :Hail then pbDisplay(_INTL("The hail stopped."))
when PBWeather::Sandstorm when :ShadowSky then pbDisplay(_INTL("The shadow sky faded."))
pbDisplay(_INTL("The sandstorm subsided."))
when PBWeather::Hail
pbDisplay(_INTL("The hail stopped."))
when PBWeather::ShadowSky
pbDisplay(_INTL("The shadow sky faded."))
end end
@field.weather = PBWeather::None @field.weather = :None
# Check for form changes caused by the weather changing # Check for form changes caused by the weather changing
eachBattler { |b| b.pbCheckFormOnWeatherChange } eachBattler { |b| b.pbCheckFormOnWeatherChange }
# Start up the default weather # Start up the default weather
pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather!=PBWeather::None pbStartWeather(nil,@field.defaultWeather) if @field.defaultWeather != :None
return if @field.weather==PBWeather::None return if @field.weather == :None
end end
# Weather continues # Weather continues
pbCommonAnimation(PBWeather.animationName(@field.weather)) weather_data = GameData::BattleWeather.try_get(@field.weather)
pbCommonAnimation(weather_data.animation) if weather_data
case @field.weather case @field.weather
# when PBWeather::Sun then pbDisplay(_INTL("The sunlight is strong.")) # when :Sun then pbDisplay(_INTL("The sunlight is strong."))
# when PBWeather::Rain then pbDisplay(_INTL("Rain continues to fall.")) # when :Rain then pbDisplay(_INTL("Rain continues to fall."))
when PBWeather::Sandstorm then pbDisplay(_INTL("The sandstorm is raging.")) when :Sandstorm then pbDisplay(_INTL("The sandstorm is raging."))
when PBWeather::Hail then pbDisplay(_INTL("The hail is crashing down.")) when :Hail then pbDisplay(_INTL("The hail is crashing down."))
# when PBWeather::HarshSun then pbDisplay(_INTL("The sunlight is extremely harsh.")) # when :HarshSun then pbDisplay(_INTL("The sunlight is extremely harsh."))
# when PBWeather::HeavyRain then pbDisplay(_INTL("It is raining heavily.")) # when :HeavyRain then pbDisplay(_INTL("It is raining heavily."))
# when PBWeather::StrongWinds then pbDisplay(_INTL("The wind is strong.")) # when :StrongWinds then pbDisplay(_INTL("The wind is strong."))
when PBWeather::ShadowSky then pbDisplay(_INTL("The shadow sky continues.")) when :ShadowSky then pbDisplay(_INTL("The shadow sky continues."))
end end
# Effects due to weather # Effects due to weather
curWeather = pbWeather curWeather = pbWeather
@@ -81,21 +77,21 @@ class PokeBattle_Battle
# Weather damage # Weather damage
# NOTE: # NOTE:
case curWeather case curWeather
when PBWeather::Sandstorm when :Sandstorm
next if !b.takesSandstormDamage? next if !b.takesSandstormDamage?
pbDisplay(_INTL("{1} is buffeted by the sandstorm!",b.pbThis)) pbDisplay(_INTL("{1} is buffeted by the sandstorm!",b.pbThis))
@scene.pbDamageAnimation(b) @scene.pbDamageAnimation(b)
b.pbReduceHP(b.totalhp/16,false) b.pbReduceHP(b.totalhp/16,false)
b.pbItemHPHealCheck b.pbItemHPHealCheck
b.pbFaint if b.fainted? b.pbFaint if b.fainted?
when PBWeather::Hail when :Hail
next if !b.takesHailDamage? next if !b.takesHailDamage?
pbDisplay(_INTL("{1} is buffeted by the hail!",b.pbThis)) pbDisplay(_INTL("{1} is buffeted by the hail!",b.pbThis))
@scene.pbDamageAnimation(b) @scene.pbDamageAnimation(b)
b.pbReduceHP(b.totalhp/16,false) b.pbReduceHP(b.totalhp/16,false)
b.pbItemHPHealCheck b.pbItemHPHealCheck
b.pbFaint if b.fainted? b.pbFaint if b.fainted?
when PBWeather::ShadowSky when :ShadowSky
next if !b.takesShadowSkyDamage? next if !b.takesShadowSkyDamage?
pbDisplay(_INTL("{1} is hurt by the shadow sky!",b.pbThis)) pbDisplay(_INTL("{1} is hurt by the shadow sky!",b.pbThis))
@scene.pbDamageAnimation(b) @scene.pbDamageAnimation(b)
@@ -264,7 +260,7 @@ class PokeBattle_Battle
curWeather = pbWeather curWeather = pbWeather
for side in 0...2 for side in 0...2
next if sides[side].effects[PBEffects::SeaOfFire]==0 next if sides[side].effects[PBEffects::SeaOfFire]==0
next if curWeather==PBWeather::Rain || curWeather==PBWeather::HeavyRain next if [:Rain, :HeavyRain].include?(curWeather)
@battle.pbCommonAnimation("SeaOfFire") if side==0 @battle.pbCommonAnimation("SeaOfFire") if side==0
@battle.pbCommonAnimation("SeaOfFireOpp") if side==1 @battle.pbCommonAnimation("SeaOfFireOpp") if side==1
priority.each do |b| priority.each do |b|

View File

@@ -455,8 +455,7 @@ class PokeBattle_AI
end end
end end
if move.function=="028" # Growth if move.function=="028" # Growth
score += 20 if @battle.pbWeather==PBWeather::Sun || score += 20 if [:Sun, :HarshSun].include?(@battle.pbWeather)
@battle.pbWeather==PBWeather::HarshSun
end end
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -1854,9 +1853,9 @@ class PokeBattle_AI
score -= 90 score -= 90
else else
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
score += 30 score += 30
when PBWeather::None when :None
else else
score -= 30 score -= 30
end end
@@ -2143,7 +2142,7 @@ class PokeBattle_AI
if @battle.pbCheckGlobalAbility(:AIRLOCK) || if @battle.pbCheckGlobalAbility(:AIRLOCK) ||
@battle.pbCheckGlobalAbility(:CLOUDNINE) @battle.pbCheckGlobalAbility(:CLOUDNINE)
score -= 90 score -= 90
elsif @battle.pbWeather==PBWeather::Sun elsif @battle.pbWeather == :Sun
score -= 90 score -= 90
else else
user.eachMove do |m| user.eachMove do |m|
@@ -2156,7 +2155,7 @@ class PokeBattle_AI
if @battle.pbCheckGlobalAbility(:AIRLOCK) || if @battle.pbCheckGlobalAbility(:AIRLOCK) ||
@battle.pbCheckGlobalAbility(:CLOUDNINE) @battle.pbCheckGlobalAbility(:CLOUDNINE)
score -= 90 score -= 90
elsif @battle.pbWeather==PBWeather::Rain elsif @battle.pbWeather == :Rain
score -= 90 score -= 90
else else
user.eachMove do |m| user.eachMove do |m|
@@ -2169,7 +2168,7 @@ class PokeBattle_AI
if @battle.pbCheckGlobalAbility(:AIRLOCK) || if @battle.pbCheckGlobalAbility(:AIRLOCK) ||
@battle.pbCheckGlobalAbility(:CLOUDNINE) @battle.pbCheckGlobalAbility(:CLOUDNINE)
score -= 90 score -= 90
elsif @battle.pbWeather==PBWeather::Sandstorm elsif @battle.pbWeather == :Sandstorm
score -= 90 score -= 90
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -2177,7 +2176,7 @@ class PokeBattle_AI
if @battle.pbCheckGlobalAbility(:AIRLOCK) || if @battle.pbCheckGlobalAbility(:AIRLOCK) ||
@battle.pbCheckGlobalAbility(:CLOUDNINE) @battle.pbCheckGlobalAbility(:CLOUDNINE)
score -= 90 score -= 90
elsif @battle.pbWeather==PBWeather::Hail elsif @battle.pbWeather == :Hail
score -= 90 score -= 90
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -2506,7 +2505,7 @@ class PokeBattle_AI
if @battle.pbCheckGlobalAbility(:AIRLOCK) || if @battle.pbCheckGlobalAbility(:AIRLOCK) ||
@battle.pbCheckGlobalAbility(:CLOUDNINE) @battle.pbCheckGlobalAbility(:CLOUDNINE)
score -= 90 score -= 90
elsif @battle.pbWeather==PBWeather::ShadowSky elsif @battle.pbWeather == :ShadowSky
score -= 90 score -= 90
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -2913,7 +2912,7 @@ class PokeBattle_AI
when "166" when "166"
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "167" when "167"
if user.pbOwnSide.effects[PBEffects::AuroraVeil]>0 || @battle.pbWeather!=PBWeather::Hail if user.pbOwnSide.effects[PBEffects::AuroraVeil]>0 || @battle.pbWeather != :Hail
score -= 90 score -= 90
else else
score += 40 score += 40
@@ -2972,7 +2971,7 @@ class PokeBattle_AI
else else
score += 50 score += 50
score -= user.hp*100/user.totalhp score -= user.hp*100/user.totalhp
score += 30 if @battle.pbWeather==PBWeather::Sandstorm score += 30 if @battle.pbWeather == :Sandstorm
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "16E" when "16E"

View File

@@ -44,7 +44,7 @@ class PokeBattle_AI
PBTypes.ineffective?(moveType,defType) PBTypes.ineffective?(moveType,defType)
end end
# Delta Stream's weather # Delta Stream's weather
if @battle.pbWeather==PBWeather::StrongWinds if @battle.pbWeather == :StrongWinds
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
PBTypes.superEffective?(moveType,defType) PBTypes.superEffective?(moveType,defType)
end end
@@ -432,19 +432,19 @@ class PokeBattle_AI
# Weather # Weather
if skill>=PBTrainerAI.mediumSkill if skill>=PBTrainerAI.mediumSkill
case @battle.pbWeather case @battle.pbWeather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
if type == :FIRE if type == :FIRE
multipliers[:final_damage_multiplier] *= 1.5 multipliers[:final_damage_multiplier] *= 1.5
elsif type == :WATER elsif type == :WATER
multipliers[:final_damage_multiplier] /= 2 multipliers[:final_damage_multiplier] /= 2
end end
when PBWeather::Rain, PBWeather::HeavyRain when :Rain, :HeavyRain
if type == :FIRE if type == :FIRE
multipliers[:final_damage_multiplier] /= 2 multipliers[:final_damage_multiplier] /= 2
elsif type == :WATER elsif type == :WATER
multipliers[:final_damage_multiplier] *= 1.5 multipliers[:final_damage_multiplier] *= 1.5
end end
when PBWeather::Sandstorm when :Sandstorm
if target.pbHasType?(:ROCK) && move.specialMove?(type) && move.function != "122" # Psyshock if target.pbHasType?(:ROCK) && move.specialMove?(type) && move.function != "122" # Psyshock
multipliers[:defense_multiplier] *= 1.5 multipliers[:defense_multiplier] *= 1.5
end end

View File

@@ -588,10 +588,7 @@ def pbBattleTypeWeakingBerry(type,moveType,target,mults)
end end
def pbBattleWeatherAbility(weather,battler,battle,ignorePrimal=false) def pbBattleWeatherAbility(weather,battler,battle,ignorePrimal=false)
return if !ignorePrimal && return if !ignorePrimal && [:HarshSun, :HeavyRain, :StrongWinds].include?(battle.field.weather)
(battle.field.weather==PBWeather::HarshSun ||
battle.field.weather==PBWeather::HeavyRain ||
battle.field.weather==PBWeather::StrongWinds)
return if battle.field.weather==weather return if battle.field.weather==weather
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@@ -599,9 +596,7 @@ def pbBattleWeatherAbility(weather,battler,battle,ignorePrimal=false)
end end
fixedDuration = false fixedDuration = false
fixedDuration = true if Settings::FIXED_DURATION_WEATHER_FROM_ABILITY && fixedDuration = true if Settings::FIXED_DURATION_WEATHER_FROM_ABILITY &&
weather != PBWeather::HarshSun && ![:HarshSun, :HeavyRain, :StrongWinds].include?(weather)
weather != PBWeather::HeavyRain &&
weather != PBWeather::StrongWinds
battle.pbStartWeather(battler,weather,fixedDuration) battle.pbStartWeather(battler,weather,fixedDuration)
# NOTE: The ability splash is hidden again in def pbStartWeather. # NOTE: The ability splash is hidden again in def pbStartWeather.
end end

View File

@@ -322,7 +322,7 @@ class PokeBattle_SafariZone
@backdropBase = nil @backdropBase = nil
@time = 0 @time = 0
@environment = :None # e.g. Tall grass, cave, still water @environment = :None # e.g. Tall grass, cave, still water
@weather = PBWeather::None @weather = :None
@decision = 0 @decision = 0
@caughtPokemon = [] @caughtPokemon = []
@player = [player] @player = [player]
@@ -426,7 +426,8 @@ class PokeBattle_SafariZone
@scene.pbStartBattle(self) @scene.pbStartBattle(self)
pbDisplayPaused(_INTL("Wild {1} appeared!",pkmn.name)) pbDisplayPaused(_INTL("Wild {1} appeared!",pkmn.name))
@scene.pbSafariStart @scene.pbSafariStart
@scene.pbCommonAnimation(PBWeather.animationName(@weather)) weather_data = GameData::BattleWeather.try_get(@weather)
@scene.pbCommonAnimation(weather_data.animation) if weather_data
safariBall = GameData::Item.get(:SAFARIBALL).id safariBall = GameData::Item.get(:SAFARIBALL).id
catch_rate = pkmn.species_data.catch_rate catch_rate = pkmn.species_data.catch_rate
catchFactor = (catch_rate*100)/1275 catchFactor = (catch_rate*100)/1275
@@ -485,7 +486,8 @@ class PokeBattle_SafariZone
pbDisplay(_INTL("{1} is watching carefully!",pkmn.name)) pbDisplay(_INTL("{1} is watching carefully!",pkmn.name))
end end
# Weather continues # Weather continues
@scene.pbCommonAnimation(PBWeather.animationName(@weather)) weather_data = GameData::BattleWeather.try_get(@weather)
@scene.pbCommonAnimation(weather_data.animation) if weather_data
end end
break if @decision > 0 break if @decision > 0
end end

View File

@@ -4,8 +4,7 @@
BattleHandlers::SpeedCalcAbility.add(:CHLOROPHYLL, BattleHandlers::SpeedCalcAbility.add(:CHLOROPHYLL,
proc { |ability,battler,mult| proc { |ability,battler,mult|
w = battler.battle.pbWeather next mult * 2 if [:Sun, :HarshSun].include?(battler.battle.pbWeather)
next mult*2 if w==PBWeather::Sun || w==PBWeather::HarshSun
} }
) )
@@ -17,8 +16,7 @@ BattleHandlers::SpeedCalcAbility.add(:QUICKFEET,
BattleHandlers::SpeedCalcAbility.add(:SANDRUSH, BattleHandlers::SpeedCalcAbility.add(:SANDRUSH,
proc { |ability,battler,mult| proc { |ability,battler,mult|
w = battler.battle.pbWeather next mult * 2 if [:Sandstorm].include?(battler.battle.pbWeather)
next mult*2 if w==PBWeather::Sandstorm
} }
) )
@@ -30,8 +28,7 @@ BattleHandlers::SpeedCalcAbility.add(:SLOWSTART,
BattleHandlers::SpeedCalcAbility.add(:SLUSHRUSH, BattleHandlers::SpeedCalcAbility.add(:SLUSHRUSH,
proc { |ability,battler,mult| proc { |ability,battler,mult|
w = battler.battle.pbWeather next mult * 2 if [:Hail].include?(battler.battle.pbWeather)
next mult*2 if w==PBWeather::Hail
} }
) )
@@ -43,8 +40,7 @@ BattleHandlers::SpeedCalcAbility.add(:SURGESURFER,
BattleHandlers::SpeedCalcAbility.add(:SWIFTSWIM, BattleHandlers::SpeedCalcAbility.add(:SWIFTSWIM,
proc { |ability,battler,mult| proc { |ability,battler,mult|
w = battler.battle.pbWeather next mult * 2 if [:Rain, :HeavyRain].include?(battler.battle.pbWeather)
next mult*2 if w==PBWeather::Rain || w==PBWeather::HeavyRain
} }
) )
@@ -151,8 +147,7 @@ BattleHandlers::StatusImmunityAbility.copy(:INSOMNIA,:SWEETVEIL,:VITALSPIRIT)
BattleHandlers::StatusImmunityAbility.add(:LEAFGUARD, BattleHandlers::StatusImmunityAbility.add(:LEAFGUARD,
proc { |ability,battler,status| proc { |ability,battler,status|
w = battler.battle.pbWeather next true if [:Sun, :HarshSun].include?(battler.battle.pbWeather)
next true if w==PBWeather::Sun || w==PBWeather::HarshSun
} }
) )
@@ -830,17 +825,13 @@ BattleHandlers::AccuracyCalcTargetAbility.add(:NOGUARD,
BattleHandlers::AccuracyCalcTargetAbility.add(:SANDVEIL, BattleHandlers::AccuracyCalcTargetAbility.add(:SANDVEIL,
proc { |ability,mods,user,target,move,type| proc { |ability,mods,user,target,move,type|
if target.battle.pbWeather==PBWeather::Sandstorm mods[:evasion_multiplier] *= 1.25 if target.battle.pbWeather == :Sandstorm
mods[:evasion_multiplier] *= 1.25
end
} }
) )
BattleHandlers::AccuracyCalcTargetAbility.add(:SNOWCLOAK, BattleHandlers::AccuracyCalcTargetAbility.add(:SNOWCLOAK,
proc { |ability,mods,user,target,move,type| proc { |ability,mods,user,target,move,type|
if target.battle.pbWeather==PBWeather::Hail mods[:evasion_multiplier] *= 1.25 if target.battle.pbWeather == :Hail
mods[:evasion_multiplier] *= 1.25
end
} }
) )
@@ -924,8 +915,7 @@ BattleHandlers::DamageCalcUserAbility.add(:FLASHFIRE,
BattleHandlers::DamageCalcUserAbility.add(:FLOWERGIFT, BattleHandlers::DamageCalcUserAbility.add(:FLOWERGIFT,
proc { |ability,user,target,move,mults,baseDmg,type| proc { |ability,user,target,move,mults,baseDmg,type|
w = user.battle.pbWeather if move.physicalMove? && [:Sun, :HarshSun].include?(user.battle.pbWeather)
if move.physicalMove? && (w==PBWeather::Sun || w==PBWeather::HarshSun)
mults[:attack_multiplier] *= 1.5 mults[:attack_multiplier] *= 1.5
end end
} }
@@ -1014,7 +1004,7 @@ BattleHandlers::DamageCalcUserAbility.add(:RIVALRY,
BattleHandlers::DamageCalcUserAbility.add(:SANDFORCE, BattleHandlers::DamageCalcUserAbility.add(:SANDFORCE,
proc { |ability,user,target,move,mults,baseDmg,type| proc { |ability,user,target,move,mults,baseDmg,type|
if user.battle.pbWeather==PBWeather::Sandstorm && if user.battle.pbWeather == :Sandstorm &&
[:ROCK, :GROUND, :STEEL].include?(type) [:ROCK, :GROUND, :STEEL].include?(type)
mults[:base_damage_multiplier] *= 1.3 mults[:base_damage_multiplier] *= 1.3
end end
@@ -1035,8 +1025,7 @@ BattleHandlers::DamageCalcUserAbility.add(:SLOWSTART,
BattleHandlers::DamageCalcUserAbility.add(:SOLARPOWER, BattleHandlers::DamageCalcUserAbility.add(:SOLARPOWER,
proc { |ability,user,target,move,mults,baseDmg,type| proc { |ability,user,target,move,mults,baseDmg,type|
w = user.battle.pbWeather if move.specialMove? && [:Sun, :HarshSun].include?(user.battle.pbWeather)
if move.specialMove? && (w == PBWeather::Sun || w == PBWeather::HarshSun)
mults[:attack_multiplier] *= 1.5 mults[:attack_multiplier] *= 1.5
end end
} }
@@ -1132,8 +1121,7 @@ BattleHandlers::DamageCalcUserAllyAbility.add(:BATTERY,
BattleHandlers::DamageCalcUserAllyAbility.add(:FLOWERGIFT, BattleHandlers::DamageCalcUserAllyAbility.add(:FLOWERGIFT,
proc { |ability,user,target,move,mults,baseDmg,type| proc { |ability,user,target,move,mults,baseDmg,type|
w = user.battle.pbWeather if move.physicalMove? && [:Sun, :HarshSun].include?(user.battle.pbWeather)
if move.physicalMove? && (w == PBWeather::Sun || w == PBWeather::HarshSun)
mults[:attack_multiplier] *= 1.5 mults[:attack_multiplier] *= 1.5
end end
} }
@@ -1161,8 +1149,7 @@ BattleHandlers::DamageCalcTargetAbility.copy(:FILTER,:SOLIDROCK)
BattleHandlers::DamageCalcTargetAbility.add(:FLOWERGIFT, BattleHandlers::DamageCalcTargetAbility.add(:FLOWERGIFT,
proc { |ability,user,target,move,mults,baseDmg,type| proc { |ability,user,target,move,mults,baseDmg,type|
w = user.battle.pbWeather if move.specialMove? && [:Sun, :HarshSun].include?(user.battle.pbWeather)
if move.specialMove? && (w == PBWeather::Sun || w == PBWeather::HarshSun)
mults[:defense_multiplier] *= 1.5 mults[:defense_multiplier] *= 1.5
end end
} }
@@ -1247,8 +1234,7 @@ BattleHandlers::DamageCalcTargetAbilityNonIgnorable.add(:SHADOWSHIELD,
BattleHandlers::DamageCalcTargetAllyAbility.add(:FLOWERGIFT, BattleHandlers::DamageCalcTargetAllyAbility.add(:FLOWERGIFT,
proc { |ability,user,target,move,mults,baseDmg,type| proc { |ability,user,target,move,mults,baseDmg,type|
w = user.battle.pbWeather if move.specialMove? && [:Sun, :HarshSun].include?(user.battle.pbWeather)
if move.specialMove? && (w == PBWeather::Sun || w == PBWeather::HarshSun)
mults[:defense_multiplier] *= 1.5 mults[:defense_multiplier] *= 1.5
end end
} }
@@ -1778,14 +1764,14 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:PICKPOCKET,
BattleHandlers::EORWeatherAbility.add(:DRYSKIN, BattleHandlers::EORWeatherAbility.add(:DRYSKIN,
proc { |ability,weather,battler,battle| proc { |ability,weather,battler,battle|
case weather case weather
when PBWeather::Sun, PBWeather::HarshSun when :Sun, :HarshSun
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battle.scene.pbDamageAnimation(battler) battle.scene.pbDamageAnimation(battler)
battler.pbReduceHP(battler.totalhp/8,false) battler.pbReduceHP(battler.totalhp/8,false)
battle.pbDisplay(_INTL("{1} was hurt by the sunlight!",battler.pbThis)) battle.pbDisplay(_INTL("{1} was hurt by the sunlight!",battler.pbThis))
battle.pbHideAbilitySplash(battler) battle.pbHideAbilitySplash(battler)
battler.pbItemHPHealCheck battler.pbItemHPHealCheck
when PBWeather::Rain, PBWeather::HeavyRain when :Rain, :HeavyRain
next if !battler.canHeal? next if !battler.canHeal?
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battler.pbRecoverHP(battler.totalhp/8) battler.pbRecoverHP(battler.totalhp/8)
@@ -1801,7 +1787,7 @@ BattleHandlers::EORWeatherAbility.add(:DRYSKIN,
BattleHandlers::EORWeatherAbility.add(:ICEBODY, BattleHandlers::EORWeatherAbility.add(:ICEBODY,
proc { |ability,weather,battler,battle| proc { |ability,weather,battler,battle|
next unless weather==PBWeather::Hail next unless weather == :Hail
next if !battler.canHeal? next if !battler.canHeal?
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battler.pbRecoverHP(battler.totalhp/16) battler.pbRecoverHP(battler.totalhp/16)
@@ -1816,7 +1802,7 @@ BattleHandlers::EORWeatherAbility.add(:ICEBODY,
BattleHandlers::EORWeatherAbility.add(:RAINDISH, BattleHandlers::EORWeatherAbility.add(:RAINDISH,
proc { |ability,weather,battler,battle| proc { |ability,weather,battler,battle|
next unless weather==PBWeather::Rain || weather==PBWeather::HeavyRain next unless [:Rain, :HeavyRain].include?(weather)
next if !battler.canHeal? next if !battler.canHeal?
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battler.pbRecoverHP(battler.totalhp/16) battler.pbRecoverHP(battler.totalhp/16)
@@ -1831,7 +1817,7 @@ BattleHandlers::EORWeatherAbility.add(:RAINDISH,
BattleHandlers::EORWeatherAbility.add(:SOLARPOWER, BattleHandlers::EORWeatherAbility.add(:SOLARPOWER,
proc { |ability,weather,battler,battle| proc { |ability,weather,battler,battle|
next unless weather==PBWeather::Sun || weather==PBWeather::HarshSun next unless [:Sun, :HarshSun].include?(weather)
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battle.scene.pbDamageAnimation(battler) battle.scene.pbDamageAnimation(battler)
battler.pbReduceHP(battler.totalhp/8,false) battler.pbReduceHP(battler.totalhp/8,false)
@@ -1875,8 +1861,7 @@ BattleHandlers::EORHealingAbility.add(:HEALER,
BattleHandlers::EORHealingAbility.add(:HYDRATION, BattleHandlers::EORHealingAbility.add(:HYDRATION,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battler.status == :NONE next if battler.status == :NONE
curWeather = battle.pbWeather next if ![:Rain, :HeavyRain].include?(battle.pbWeather)
next if curWeather!=PBWeather::Rain && curWeather!=PBWeather::HeavyRain
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
oldStatus = battler.status oldStatus = battler.status
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
@@ -1990,8 +1975,7 @@ BattleHandlers::EORGainItemAbility.add(:HARVEST,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battler.item next if battler.item
next if !battler.recycleItem || !GameData::Item.get(battler.recycleItem).is_berry? next if !battler.recycleItem || !GameData::Item.get(battler.recycleItem).is_berry?
curWeather = battle.pbWeather if ![:Sun, :HarshSun].include?(battle.pbWeather)
if curWeather!=PBWeather::Sun && curWeather!=PBWeather::HarshSun
next unless battle.pbRandom(100)<50 next unless battle.pbRandom(100)<50
end end
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
@@ -2137,13 +2121,13 @@ BattleHandlers::AbilityOnSwitchIn.add(:DARKAURA,
BattleHandlers::AbilityOnSwitchIn.add(:DELTASTREAM, BattleHandlers::AbilityOnSwitchIn.add(:DELTASTREAM,
proc { |ability,battler,battle| proc { |ability,battler,battle|
pbBattleWeatherAbility(PBWeather::StrongWinds,battler,battle,true) pbBattleWeatherAbility(:StrongWinds, battler, battle, true)
} }
) )
BattleHandlers::AbilityOnSwitchIn.add(:DESOLATELAND, BattleHandlers::AbilityOnSwitchIn.add(:DESOLATELAND,
proc { |ability,battler,battle| proc { |ability,battler,battle|
pbBattleWeatherAbility(PBWeather::HarshSun,battler,battle,true) pbBattleWeatherAbility(:HarshSun, battler, battle, true)
} }
) )
@@ -2161,13 +2145,13 @@ BattleHandlers::AbilityOnSwitchIn.add(:DOWNLOAD,
BattleHandlers::AbilityOnSwitchIn.add(:DRIZZLE, BattleHandlers::AbilityOnSwitchIn.add(:DRIZZLE,
proc { |ability,battler,battle| proc { |ability,battler,battle|
pbBattleWeatherAbility(PBWeather::Rain,battler,battle) pbBattleWeatherAbility(:Rain, battler, battle)
} }
) )
BattleHandlers::AbilityOnSwitchIn.add(:DROUGHT, BattleHandlers::AbilityOnSwitchIn.add(:DROUGHT,
proc { |ability,battler,battle| proc { |ability,battler,battle|
pbBattleWeatherAbility(PBWeather::Sun,battler,battle) pbBattleWeatherAbility(:Sun, battler, battle)
} }
) )
@@ -2317,7 +2301,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:PRESSURE,
BattleHandlers::AbilityOnSwitchIn.add(:PRIMORDIALSEA, BattleHandlers::AbilityOnSwitchIn.add(:PRIMORDIALSEA,
proc { |ability,battler,battle| proc { |ability,battler,battle|
pbBattleWeatherAbility(PBWeather::HeavyRain,battler,battle,true) pbBattleWeatherAbility(:HeavyRain, battler, battle, true)
} }
) )
@@ -2332,7 +2316,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:PSYCHICSURGE,
BattleHandlers::AbilityOnSwitchIn.add(:SANDSTREAM, BattleHandlers::AbilityOnSwitchIn.add(:SANDSTREAM,
proc { |ability,battler,battle| proc { |ability,battler,battle|
pbBattleWeatherAbility(PBWeather::Sandstorm,battler,battle) pbBattleWeatherAbility(:Sandstorm, battler, battle)
} }
) )
@@ -2352,7 +2336,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:SLOWSTART,
BattleHandlers::AbilityOnSwitchIn.add(:SNOWWARNING, BattleHandlers::AbilityOnSwitchIn.add(:SNOWWARNING,
proc { |ability,battler,battle| proc { |ability,battler,battle|
pbBattleWeatherAbility(PBWeather::Hail,battler,battle) pbBattleWeatherAbility(:Hail, battler, battle)
} }
) )

View File

@@ -1394,25 +1394,25 @@ BattleHandlers::EVGainModifierItem.add(:POWERWEIGHT,
BattleHandlers::WeatherExtenderItem.add(:DAMPROCK, BattleHandlers::WeatherExtenderItem.add(:DAMPROCK,
proc { |item,weather,duration,battler,battle| proc { |item,weather,duration,battler,battle|
next 8 if weather==PBWeather::Rain next 8 if weather == :Rain
} }
) )
BattleHandlers::WeatherExtenderItem.add(:HEATROCK, BattleHandlers::WeatherExtenderItem.add(:HEATROCK,
proc { |item,weather,duration,battler,battle| proc { |item,weather,duration,battler,battle|
next 8 if weather==PBWeather::Sun next 8 if weather == :Sun
} }
) )
BattleHandlers::WeatherExtenderItem.add(:ICYROCK, BattleHandlers::WeatherExtenderItem.add(:ICYROCK,
proc { |item,weather,duration,battler,battle| proc { |item,weather,duration,battler,battle|
next 8 if weather==PBWeather::Hail next 8 if weather == :Hail
} }
) )
BattleHandlers::WeatherExtenderItem.add(:SMOOTHROCK, BattleHandlers::WeatherExtenderItem.add(:SMOOTHROCK,
proc { |item,weather,duration,battler,battle| proc { |item,weather,duration,battler,battle|
next 8 if weather==PBWeather::Sandstorm next 8 if weather == :Sandstorm
} }
) )

View File

@@ -23,8 +23,8 @@ begin
@effects[PBEffects::TrickRoom] = 0 @effects[PBEffects::TrickRoom] = 0
@effects[PBEffects::WaterSportField] = 0 @effects[PBEffects::WaterSportField] = 0
@effects[PBEffects::WonderRoom] = 0 @effects[PBEffects::WonderRoom] = 0
@defaultWeather = PBWeather::None @defaultWeather = :None
@weather = PBWeather::None @weather = :None
@weatherDuration = 0 @weatherDuration = 0
@defaultTerrain = :None @defaultTerrain = :None
@terrain = :None @terrain = :None

View File

@@ -44,7 +44,9 @@ class PokemonTemp
when "terrain" when "terrain"
terrain_data = GameData::BattleTerrain.try_get(var) terrain_data = GameData::BattleTerrain.try_get(var)
rules["defaultTerrain"] = (terrain_data) ? terrain_data.id : nil rules["defaultTerrain"] = (terrain_data) ? terrain_data.id : nil
when "weather" then rules["defaultWeather"] = getID(PBWeather, var) when "weather"
weather_data = GameData::BattleWeather.try_get(var)
rules["defaultWeather"] = (weather_data) ? weather_data.id : nil
when "environment", "environ" when "environment", "environ"
environment_data = GameData::Environment.try_get(var) environment_data = GameData::Environment.try_get(var)
rules["environment"] = (environment_data) ? environment_data.id : nil rules["environment"] = (environment_data) ? environment_data.id : nil
@@ -110,13 +112,13 @@ def pbPrepareBattle(battle)
if battleRules["defaultWeather"].nil? if battleRules["defaultWeather"].nil?
case $game_screen.weather_type case $game_screen.weather_type
when PBFieldWeather::Rain, PBFieldWeather::HeavyRain, PBFieldWeather::Storm when PBFieldWeather::Rain, PBFieldWeather::HeavyRain, PBFieldWeather::Storm
battle.defaultWeather = PBWeather::Rain battle.defaultWeather = :Rain
when PBFieldWeather::Snow, PBFieldWeather::Blizzard when PBFieldWeather::Snow, PBFieldWeather::Blizzard
battle.defaultWeather = PBWeather::Hail battle.defaultWeather = :Hail
when PBFieldWeather::Sandstorm when PBFieldWeather::Sandstorm
battle.defaultWeather = PBWeather::Sandstorm battle.defaultWeather = :Sandstorm
when PBFieldWeather::Sun when PBFieldWeather::Sun
battle.defaultWeather = PBWeather::Sun battle.defaultWeather = :Sun
end end
else else
battle.defaultWeather = battleRules["defaultWeather"] battle.defaultWeather = battleRules["defaultWeather"]

View File

@@ -450,7 +450,7 @@ end
class PokeBattle_Move_131 < PokeBattle_WeatherMove class PokeBattle_Move_131 < PokeBattle_WeatherMove
def initialize(battle,move) def initialize(battle,move)
super super
@weatherType = PBWeather::ShadowSky @weatherType = :ShadowSky
end end
end end