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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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