Snowstorm, forfeiting trainer battles, battle outcome values

This commit is contained in:
Maruno17
2024-06-15 21:29:00 +01:00
parent 22b33ca6c2
commit 8e9417c3b7
41 changed files with 284 additions and 214 deletions

View File

@@ -170,7 +170,7 @@ module Battle::CatchAndStoreMixin
end
battler.pbReset
if pbAllFainted?(battler.index)
@decision = (trainerBattle?) ? 1 : 4 # Battle ended by win/capture
@decision = (trainerBattle?) ? Battle::Outcome::WIN : Battle::Outcome::CATCH
end
# Modify the Pokémon's properties because of the capture
if GameData::Item.get(ball).is_snag_ball?

View File

@@ -12,11 +12,11 @@ class Battle
if @rules["selfkoclause"]
if self.lastMoveUser < 0
# in extreme cases there may be no last move user
return 5 # game is a draw
return Outcome::DRAW
elsif opposes?(self.lastMoveUser)
return 2 # loss
return Outcome::LOSE
else
return 1 # win
return Outcome::WIN
end
end
return __clauses__pbDecisionOnDraw
@@ -27,11 +27,11 @@ class Battle
if @rules["drawclause"] # NOTE: Also includes Life Orb (not implemented)
if !(move && move.function_code == "HealUserByHalfOfDamageDone")
# Not a draw if fainting occurred due to Liquid Ooze
@decision = (user.opposes?) ? 1 : 2 # win / loss
@decision = (user.opposes?) ? Outcome::WIN : Outcome::LOSE
end
elsif @rules["modifiedselfdestructclause"]
if move && move.function_code == "UserFaintsExplosive" # Self-Destruct
@decision = (user.opposes?) ? 1 : 2 # win / loss
@decision = (user.opposes?) ? Outcome::WIN : Outcome::LOSE
end
end
end
@@ -39,13 +39,13 @@ class Battle
def pbEndOfRoundPhase
__clauses__pbEndOfRoundPhase
if @rules["suddendeath"] && @decision == 0
if @rules["suddendeath"] && !decided?
p1able = pbAbleCount(0)
p2able = pbAbleCount(1)
if p1able > p2able
@decision = 1 # loss
@decision = Outcome::WIN
elsif p1able < p2able
@decision = 2 # win
@decision = Outcome::LOSE
end
end
end
@@ -261,7 +261,7 @@ class Battle::Move::UserFaintsExplosive
count += @battle.pbAbleNonActiveCount(user.idxOpposingSide)
if count == 0
@battle.pbDisplay(_INTL("{1}'s team was disqualified!", user.pbThis))
@battle.decision = (user.opposes?) ? 1 : 2
@battle.decision = (user.opposes?) ? Outcome::WIN : Outcome::LOSE
return false
end
end

View File

@@ -322,7 +322,7 @@ Battle::AbilityEffects::SpeedCalc.add(:SLOWSTART,
Battle::AbilityEffects::SpeedCalc.add(:SLUSHRUSH,
proc { |ability, battler, mult|
next mult * 2 if [:Hail].include?(battler.effectiveWeather)
next mult * 2 if [:Hail, :Snowstorm].include?(battler.effectiveWeather)
}
)
@@ -376,7 +376,7 @@ Battle::AbilityEffects::OnHPDroppedBelowHalf.add(:EMERGENCYEXIT,
battle.pbHideAbilitySplash(battler)
pbSEPlay("Battle flee")
battle.pbDisplay(_INTL("{1} fled from battle!", battler.pbThis))
battle.decision = 3 # Escaped
battle.decision = Battle::Outcome::FLEE
next true
end
# In trainer battles
@@ -1204,7 +1204,7 @@ Battle::AbilityEffects::AccuracyCalcFromTarget.add(:SANDVEIL,
Battle::AbilityEffects::AccuracyCalcFromTarget.add(:SNOWCLOAK,
proc { |ability, mods, user, target, move, type|
mods[:evasion_multiplier] *= 1.25 if target.effectiveWeather == :Hail
mods[:evasion_multiplier] *= 1.25 if [:Hail, :Snowstorm].include?(target.effectiveWeather)
}
)
@@ -2391,7 +2391,7 @@ Battle::AbilityEffects::EndOfRoundWeather.add(:DRYSKIN,
Battle::AbilityEffects::EndOfRoundWeather.add(:ICEBODY,
proc { |ability, weather, battler, battle|
next unless weather == :Hail
next if ![:Hail, :Snowstorm].include?(weather)
next if !battler.canHeal?
battle.pbShowAbilitySplash(battler)
battler.pbRecoverHP(battler.totalhp / 16)
@@ -2406,7 +2406,7 @@ Battle::AbilityEffects::EndOfRoundWeather.add(:ICEBODY,
Battle::AbilityEffects::EndOfRoundWeather.add(:ICEFACE,
proc { |ability, weather, battler, battle|
next if weather != :Hail
next if ![:Hail, :Snowstorm].include?(weather)
next if !battler.canRestoreIceFace || battler.form != 1
battle.pbShowAbilitySplash(battler)
if !Battle::Scene::USE_ABILITY_SPLASH
@@ -2936,7 +2936,7 @@ Battle::AbilityEffects::OnSwitchIn.add(:GRASSYSURGE,
Battle::AbilityEffects::OnSwitchIn.add(:ICEFACE,
proc { |ability, battler, battle, switch_in|
next if !battler.isSpecies?(:EISCUE) || battler.form != 1
next if battler.effectiveWeather != :Hail
next if ![:Hail, :Snowstorm].include?(battler.effectiveWeather)
battle.pbShowAbilitySplash(battler)
if !Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1}'s {2} activated!", battler.pbThis, battler.abilityName))
@@ -3145,7 +3145,7 @@ Battle::AbilityEffects::OnSwitchIn.add(:SLOWSTART,
Battle::AbilityEffects::OnSwitchIn.add(:SNOWWARNING,
proc { |ability, battler, battle, switch_in|
battle.pbStartWeatherAbility(:Hail, battler)
battle.pbStartWeatherAbility((Settings::USE_SNOWSTORM_WEATHER_INSTEAD_OF_HAIL ? :Snowstorm : :Hail), battler)
}
)

View File

@@ -1805,7 +1805,7 @@ Battle::ItemEffects::WeatherExtender.add(:HEATROCK,
Battle::ItemEffects::WeatherExtender.add(:ICYROCK,
proc { |item, weather, duration, battler, battle|
next 8 if weather == :Hail
next 8 if [:Hail, :Snowstorm].include?(weather)
}
)