mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Snowstorm, forfeiting trainer battles, battle outcome values
This commit is contained in:
@@ -14,7 +14,7 @@ module Settings
|
||||
# Note that this isn't perfect. Essentials doesn't accurately replicate every
|
||||
# single generation's mechanics. It's considered to be good enough. Only
|
||||
# generations 5 and later are reasonably supported.
|
||||
MECHANICS_GENERATION = 8
|
||||
MECHANICS_GENERATION = 9
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Credits
|
||||
|
||||
@@ -52,20 +52,23 @@ module Settings
|
||||
NUM_BADGES_BOOST_SPEED = (MECHANICS_GENERATION >= 4) ? 999 : 3
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Ability and item effects
|
||||
# Move, ability and item effects
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Whether the in-battle hail weather is replaced by Snowstorm (from Gen 9+)
|
||||
# instead.
|
||||
USE_SNOWSTORM_WEATHER_INSTEAD_OF_HAIL = (MECHANICS_GENERATION >= 9)
|
||||
# Whether weather caused by an ability lasts 5 rounds (true) or forever (false).
|
||||
FIXED_DURATION_WEATHER_FROM_ABILITY = (MECHANICS_GENERATION >= 6)
|
||||
FIXED_DURATION_WEATHER_FROM_ABILITY = (MECHANICS_GENERATION >= 6)
|
||||
# Whether X items (X Attack, etc.) raise their stat by 2 stages (true) or 1
|
||||
# (false).
|
||||
X_STAT_ITEMS_RAISE_BY_TWO_STAGES = (MECHANICS_GENERATION >= 7)
|
||||
X_STAT_ITEMS_RAISE_BY_TWO_STAGES = (MECHANICS_GENERATION >= 7)
|
||||
# Whether some Poké Balls have catch rate multipliers from Gen 7 (true) or
|
||||
# from earlier generations (false).
|
||||
NEW_POKE_BALL_CATCH_RATES = (MECHANICS_GENERATION >= 7)
|
||||
NEW_POKE_BALL_CATCH_RATES = (MECHANICS_GENERATION >= 7)
|
||||
# Whether Soul Dew powers up Psychic and Dragon-type moves by 20% (true) or
|
||||
# raises the holder's Special Attack and Special Defense by 50% (false).
|
||||
SOUL_DEW_POWERS_UP_TYPES = (MECHANICS_GENERATION >= 7)
|
||||
SOUL_DEW_POWERS_UP_TYPES = (MECHANICS_GENERATION >= 7)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Affection
|
||||
@@ -120,6 +123,7 @@ module Settings
|
||||
# End of battle
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
CAN_FORFEIT_TRAINER_BATTLES = (MECHANICS_GENERATION >= 9)
|
||||
# The Game Switch which, while ON, prevents the player from losing money if
|
||||
# they lose a battle (they can still gain money from trainers for winning).
|
||||
NO_MONEY_LOSS = 33
|
||||
|
||||
@@ -56,6 +56,12 @@ GameData::BattleWeather.register({
|
||||
:animation => "Hail"
|
||||
})
|
||||
|
||||
GameData::BattleWeather.register({
|
||||
:id => :Snowstorm,
|
||||
:name => _INTL("Snowstorm"),
|
||||
:animation => "Snowstorm"
|
||||
})
|
||||
|
||||
GameData::BattleWeather.register({
|
||||
:id => :HarshSun,
|
||||
:name => _INTL("Harsh Sun"),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Results of battle:
|
||||
# Results of battle (see module Outcome):
|
||||
# 0 - Undecided or aborted
|
||||
# 1 - Player won
|
||||
# 2 - Player lost
|
||||
@@ -38,6 +38,29 @@
|
||||
# (There is no guarantee that this list is complete.)
|
||||
|
||||
class Battle
|
||||
module Outcome
|
||||
UNDECIDED = 0
|
||||
WIN = 1
|
||||
LOSE = 2 # Also used when player forfeits a trainer battle
|
||||
FLEE = 3 # Player or wild Pokémon ran away, count as a win
|
||||
CATCH = 4 # Counts as a win
|
||||
DRAW = 5
|
||||
|
||||
def self.decided?(decision)
|
||||
return decision != UNDECIDED
|
||||
end
|
||||
|
||||
def self.should_black_out?(decision)
|
||||
return decision == LOSE || decision == DRAW
|
||||
end
|
||||
|
||||
def self.success?(decision)
|
||||
return !self.should_black_out?(decision)
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
attr_reader :scene # Scene object for this battle
|
||||
attr_reader :peer
|
||||
attr_reader :field # Effects common to the whole of a battle
|
||||
@@ -50,7 +73,7 @@ class Battle
|
||||
attr_accessor :time # Time of day (0=day, 1=eve, 2=night)
|
||||
attr_accessor :environment # Battle surroundings (for mechanics purposes)
|
||||
attr_reader :turnCount
|
||||
attr_accessor :decision # Decision: 0=undecided; 1=win; 2=loss; 3=escaped; 4=caught
|
||||
attr_accessor :decision # Outcome of battle
|
||||
attr_reader :player # Player trainer (or array of trainers)
|
||||
attr_reader :opponent # Opponent trainer (or array of trainers)
|
||||
attr_accessor :items # Items held by opponents
|
||||
@@ -114,7 +137,7 @@ class Battle
|
||||
@time = 0
|
||||
@environment = :None # e.g. Tall grass, cave, still water
|
||||
@turnCount = 0
|
||||
@decision = 0
|
||||
@decision = Outcome::UNDECIDED
|
||||
@caughtPokemon = []
|
||||
player = [player] if !player.nil? && !player.is_a?(Array)
|
||||
opponent = [opponent] if !opponent.nil? && !opponent.is_a?(Array)
|
||||
@@ -173,6 +196,10 @@ class Battle
|
||||
@battleAI = AI.new(self)
|
||||
end
|
||||
|
||||
def decided?
|
||||
return Outcome.decided?(@decision)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Information about the type and size of the battle
|
||||
#=============================================================================
|
||||
@@ -730,6 +757,7 @@ class Battle
|
||||
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 :Snowstorm then pbDisplay(_INTL("It started to snow!"))
|
||||
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!"))
|
||||
|
||||
@@ -270,7 +270,7 @@ class Battle
|
||||
begin
|
||||
pbStartBattleCore
|
||||
rescue BattleAbortedException
|
||||
@decision = 0
|
||||
@decision = Outcome::UNDECIDED
|
||||
@scene.pbEndBattle(@decision)
|
||||
end
|
||||
return @decision
|
||||
@@ -292,6 +292,7 @@ class Battle
|
||||
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 :Snowstorm then pbDisplay(_INTL("It is snowing."))
|
||||
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."))
|
||||
@@ -334,13 +335,13 @@ class Battle
|
||||
PBDebug.log("")
|
||||
# Command phase
|
||||
PBDebug.logonerr { pbCommandPhase }
|
||||
break if @decision > 0
|
||||
break if decided?
|
||||
# Attack phase
|
||||
PBDebug.logonerr { pbAttackPhase }
|
||||
break if @decision > 0
|
||||
break if decided?
|
||||
# End of round phase
|
||||
PBDebug.logonerr { pbEndOfRoundPhase }
|
||||
break if @decision > 0
|
||||
break if decided?
|
||||
@turnCount += 1
|
||||
end
|
||||
pbEndOfBattle
|
||||
@@ -404,10 +405,9 @@ class Battle
|
||||
|
||||
def pbEndOfBattle
|
||||
oldDecision = @decision
|
||||
@decision = 4 if @decision == 1 && wildBattle? && @caughtPokemon.length > 0
|
||||
@decision = Outcome::CATCH if @decision == Outcome::WIN && wildBattle? && @caughtPokemon.length > 0
|
||||
case oldDecision
|
||||
##### WIN #####
|
||||
when 1
|
||||
when Outcome::WIN
|
||||
PBDebug.log("")
|
||||
PBDebug.log_header("===== Player won =====")
|
||||
PBDebug.log("")
|
||||
@@ -432,33 +432,34 @@ class Battle
|
||||
PBDebug.log("")
|
||||
end
|
||||
# Gain money from winning a trainer battle, and from Pay Day
|
||||
pbGainMoney if @decision != 4
|
||||
pbGainMoney if @decision != Outcome::CATCH
|
||||
# Hide remaining trainer
|
||||
@scene.pbShowOpponent(@opponent.length) if trainerBattle? && @caughtPokemon.length > 0
|
||||
##### LOSE, DRAW #####
|
||||
when 2, 5
|
||||
when Outcome::LOSE, Outcome::DRAW
|
||||
PBDebug.log("")
|
||||
PBDebug.log_header("===== Player lost =====") if @decision == 2
|
||||
PBDebug.log_header("===== Player drew with opponent =====") if @decision == 5
|
||||
PBDebug.log_header("===== Player lost =====") if @decision == Outcome::LOSE
|
||||
PBDebug.log_header("===== Player drew with opponent =====") if @decision == Outcome::DRAW
|
||||
PBDebug.log("")
|
||||
if @internalBattle
|
||||
pbDisplayPaused(_INTL("You have no more Pokémon that can fight!"))
|
||||
if trainerBattle?
|
||||
case @opponent.length
|
||||
when 1
|
||||
pbDisplayPaused(_INTL("You lost against {1}!", @opponent[0].full_name))
|
||||
when 2
|
||||
pbDisplayPaused(_INTL("You lost against {1} and {2}!",
|
||||
@opponent[0].full_name, @opponent[1].full_name))
|
||||
when 3
|
||||
pbDisplayPaused(_INTL("You lost against {1}, {2} and {3}!",
|
||||
@opponent[0].full_name, @opponent[1].full_name, @opponent[2].full_name))
|
||||
if pbPlayerBattlerCount == 0
|
||||
pbDisplayPaused(_INTL("You have no more Pokémon that can fight!"))
|
||||
if trainerBattle?
|
||||
case @opponent.length
|
||||
when 1
|
||||
pbDisplayPaused(_INTL("You lost against {1}!", @opponent[0].full_name))
|
||||
when 2
|
||||
pbDisplayPaused(_INTL("You lost against {1} and {2}!",
|
||||
@opponent[0].full_name, @opponent[1].full_name))
|
||||
when 3
|
||||
pbDisplayPaused(_INTL("You lost against {1}, {2} and {3}!",
|
||||
@opponent[0].full_name, @opponent[1].full_name, @opponent[2].full_name))
|
||||
end
|
||||
end
|
||||
end
|
||||
# Lose money from losing a battle
|
||||
pbLoseMoney
|
||||
pbDisplayPaused(_INTL("You blacked out!")) if !@canLose
|
||||
elsif @decision == 2 # Lost in a Battle Frontier battle
|
||||
pbDisplayPaused(_INTL("You blacked out!")) if !@canLose && pbPlayerBattlerCount == 0
|
||||
elsif @decision == Outcome::LOSE # Lost in a Battle Frontier battle
|
||||
if @opponent
|
||||
@opponent.each_with_index do |trainer, i|
|
||||
@scene.pbShowOpponent(i)
|
||||
@@ -469,8 +470,7 @@ class Battle
|
||||
PBDebug.log("")
|
||||
end
|
||||
end
|
||||
##### CAUGHT WILD POKÉMON #####
|
||||
when 4
|
||||
when Outcome::CATCH
|
||||
PBDebug.log("")
|
||||
PBDebug.log_header("===== Pokémon caught =====")
|
||||
PBDebug.log("")
|
||||
@@ -479,7 +479,7 @@ class Battle
|
||||
# Register captured Pokémon in the Pokédex, and store them
|
||||
pbRecordAndStoreCaughtPokemon
|
||||
# Collect Pay Day money in a wild battle that ended in a capture
|
||||
pbGainMoney if @decision == 4
|
||||
pbGainMoney if @decision == Outcome::CATCH
|
||||
# Pass on Pokérus within the party
|
||||
if @internalBattle
|
||||
infected = []
|
||||
@@ -526,11 +526,11 @@ class Battle
|
||||
hpTotals[side] += pkmn.hp
|
||||
end
|
||||
end
|
||||
return 1 if counts[0] > counts[1] # Win (player has more able Pokémon)
|
||||
return 2 if counts[0] < counts[1] # Loss (foe has more able Pokémon)
|
||||
return 1 if hpTotals[0] > hpTotals[1] # Win (player has more HP in total)
|
||||
return 2 if hpTotals[0] < hpTotals[1] # Loss (foe has more HP in total)
|
||||
return 5 # Draw
|
||||
return Outcome::WIN if counts[0] > counts[1] # Win (player has more able Pokémon)
|
||||
return Outcome::LOSE if counts[0] < counts[1] # Loss (foe has more able Pokémon)
|
||||
return Outcome::WIN if hpTotals[0] > hpTotals[1] # Win (player has more HP in total)
|
||||
return Outcome::LOSE if hpTotals[0] < hpTotals[1] # Loss (foe has more HP in total)
|
||||
return Outcome::DRAW
|
||||
end
|
||||
|
||||
# Unused
|
||||
@@ -545,24 +545,24 @@ class Battle
|
||||
end
|
||||
hpTotals[side] /= counts[side] if counts[side] > 1
|
||||
end
|
||||
return 1 if counts[0] > counts[1] # Win (player has more able Pokémon)
|
||||
return 2 if counts[0] < counts[1] # Loss (foe has more able Pokémon)
|
||||
return 1 if hpTotals[0] > hpTotals[1] # Win (player has a bigger average HP %)
|
||||
return 2 if hpTotals[0] < hpTotals[1] # Loss (foe has a bigger average HP %)
|
||||
return 5 # Draw
|
||||
return Outcome::WIN if counts[0] > counts[1] # Win (player has more able Pokémon)
|
||||
return Outcome::LOSE if counts[0] < counts[1] # Loss (foe has more able Pokémon)
|
||||
return Outcome::WIN if hpTotals[0] > hpTotals[1] # Win (player has a bigger average HP %)
|
||||
return Outcome::LOSE if hpTotals[0] < hpTotals[1] # Loss (foe has a bigger average HP %)
|
||||
return Outcome::DRAW
|
||||
end
|
||||
|
||||
def pbDecisionOnDraw; return 5; end # Draw
|
||||
def pbDecisionOnDraw; return Outcome::DRAW; end # Draw
|
||||
|
||||
def pbJudge
|
||||
fainted1 = pbAllFainted?(0)
|
||||
fainted2 = pbAllFainted?(1)
|
||||
if fainted1 && fainted2
|
||||
@decision = pbDecisionOnDraw # Draw
|
||||
@decision = pbDecisionOnDraw
|
||||
elsif fainted1
|
||||
@decision = 2 # Loss
|
||||
@decision = Outcome::LOSE
|
||||
elsif fainted2
|
||||
@decision = 1 # Win
|
||||
@decision = Outcome::WIN
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -140,10 +140,10 @@ class Battle
|
||||
# General switching method that checks if any Pokémon need to be sent out and,
|
||||
# if so, does. Called at the end of each round.
|
||||
def pbEORSwitch(favorDraws = false)
|
||||
return if @decision > 0 && !favorDraws
|
||||
return if @decision == 5 && favorDraws
|
||||
return if decided? && !favorDraws
|
||||
return if @decision == Outcome::DRAW && favorDraws
|
||||
pbJudge
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
# Check through each fainted battler to see if that spot can be filled.
|
||||
switched = []
|
||||
loop do
|
||||
|
||||
@@ -32,19 +32,19 @@ class Battle
|
||||
commands.push(_INTL("Treat as a capture")) if wildBattle?
|
||||
commands.push(_INTL("Cancel"))
|
||||
case pbShowCommands(_INTL("Choose the outcome of this battle."), commands)
|
||||
when 0 # Win
|
||||
@decision = 1
|
||||
when 1 # Loss
|
||||
@decision = 2
|
||||
when 2 # Draw
|
||||
@decision = 5
|
||||
when 3 # Run away/forfeit
|
||||
when 0
|
||||
@decision = Outcome::WIN
|
||||
when 1
|
||||
@decision = Outcome::LOSE
|
||||
when 2
|
||||
@decision = Outcome::DRAW
|
||||
when 3
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
when 4 # Capture
|
||||
@decision = Outcome::FLEE
|
||||
when 4
|
||||
return -1 if trainerBattle?
|
||||
@decision = 4
|
||||
@decision = Outcome::CATCH
|
||||
else
|
||||
return -1
|
||||
end
|
||||
@@ -72,11 +72,19 @@ class Battle
|
||||
# Running from trainer battles
|
||||
if trainerBattle?
|
||||
if @internalBattle
|
||||
pbDisplayPaused(_INTL("No! There's no running from a Trainer battle!"))
|
||||
if Settings::CAN_FORFEIT_TRAINER_BATTLES
|
||||
pbDisplayPaused(_INTL("Would you like to give up on this battle and quit now?"))
|
||||
if pbDisplayConfirm(_INTL("Quitting the battle is the same as losing the battle."))
|
||||
@decision = Outcome::LOSE # Treated as a loss
|
||||
return 1
|
||||
end
|
||||
else
|
||||
pbDisplayPaused(_INTL("No! There's no running from a Trainer battle!"))
|
||||
end
|
||||
elsif pbDisplayConfirm(_INTL("Would you like to forfeit the match and quit now?"))
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplay(_INTL("{1} forfeited the match!", self.pbPlayer.name))
|
||||
@decision = 3
|
||||
@decision = Outcome::FLEE
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
@@ -89,7 +97,7 @@ class Battle
|
||||
if battler.pbHasType?(:GHOST) && Settings::MORE_TYPE_EFFECTS
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
@decision = Outcome::FLEE
|
||||
return 1
|
||||
end
|
||||
# Abilities that guarantee escape
|
||||
@@ -99,7 +107,7 @@ class Battle
|
||||
pbHideAbilitySplash(battler)
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
@decision = Outcome::FLEE
|
||||
return 1
|
||||
end
|
||||
# Held items that guarantee escape
|
||||
@@ -107,7 +115,7 @@ class Battle
|
||||
Battle::ItemEffects.triggerCertainEscapeFromBattle(battler.item, battler)
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("{1} fled using its {2}!", battler.pbThis, battler.itemName))
|
||||
@decision = 3
|
||||
@decision = Outcome::FLEE
|
||||
return 1
|
||||
end
|
||||
# Other certain trapping effects
|
||||
@@ -151,7 +159,7 @@ class Battle
|
||||
if rate >= 256 || @battleAI.pbAIRandom(256) < rate
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
@decision = Outcome::FLEE
|
||||
return 1
|
||||
end
|
||||
pbDisplayPaused(_INTL("You couldn't get away!"))
|
||||
|
||||
@@ -187,7 +187,7 @@ class Battle
|
||||
end
|
||||
# Choose actions for the round (player first, then AI)
|
||||
pbCommandPhaseLoop(true) # Player chooses their actions
|
||||
if @decision != 0 # Battle ended, stop choosing actions
|
||||
if decided? # Battle ended, stop choosing actions
|
||||
@command_phase = false
|
||||
return
|
||||
end
|
||||
@@ -201,7 +201,7 @@ class Battle
|
||||
actioned = []
|
||||
idxBattler = -1
|
||||
loop do
|
||||
break if @decision != 0 # Battle ended, stop choosing actions
|
||||
break if decided? # Battle ended, stop choosing actions
|
||||
idxBattler += 1
|
||||
break if idxBattler >= @battlers.length
|
||||
next if !@battlers[idxBattler] || pbOwnedByPlayer?(idxBattler) != isPlayer
|
||||
|
||||
@@ -40,7 +40,7 @@ class Battle
|
||||
# Use Pursuit
|
||||
@choices[b.index][3] = idxSwitcher # Change Pursuit's target
|
||||
b.pbProcessTurn(@choices[b.index], false)
|
||||
break if @decision > 0 || @battlers[idxSwitcher].fainted?
|
||||
break if decided? || @battlers[idxSwitcher].fainted?
|
||||
end
|
||||
@switching = false
|
||||
end
|
||||
@@ -55,7 +55,7 @@ class Battle
|
||||
pbMessageOnRecall(b)
|
||||
# Pursuit interrupts switching
|
||||
pbPursuit(b.index)
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
# Switch Pokémon
|
||||
allBattlers.each do |b2|
|
||||
b2.droppedBelowHalfHP = false
|
||||
@@ -84,7 +84,7 @@ class Battle
|
||||
else
|
||||
next
|
||||
end
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
end
|
||||
pbCalculatePriority if Settings::RECALCULATE_TURN_ORDER_AFTER_SPEED_CHANGES
|
||||
end
|
||||
@@ -118,7 +118,7 @@ class Battle
|
||||
advance = b.pbProcessTurn(@choices[b.index])
|
||||
break if advance
|
||||
end
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
next if advance
|
||||
# Regular priority order
|
||||
priority.each do |b|
|
||||
@@ -128,7 +128,7 @@ class Battle
|
||||
advance = b.pbProcessTurn(@choices[b.index])
|
||||
break if advance
|
||||
end
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
next if advance
|
||||
# Quashed
|
||||
if Settings::MECHANICS_GENERATION >= 8
|
||||
@@ -155,7 +155,7 @@ class Battle
|
||||
break if advance || !moreQuash
|
||||
end
|
||||
end
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
next if advance
|
||||
# Check for all done
|
||||
priority.each do |b|
|
||||
@@ -193,9 +193,9 @@ class Battle
|
||||
pbAttackPhasePriorityChangeMessages
|
||||
pbAttackPhaseCall
|
||||
pbAttackPhaseSwitch
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
pbAttackPhaseItems
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
pbAttackPhaseMegaEvolution
|
||||
pbAttackPhaseMoves
|
||||
end
|
||||
|
||||
@@ -14,6 +14,7 @@ class Battle
|
||||
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 :Snowstorm then pbDisplay(_INTL("The snow stopped."))
|
||||
when :ShadowSky then pbDisplay(_INTL("The shadow sky faded."))
|
||||
end
|
||||
@field.weather = :None
|
||||
@@ -31,6 +32,7 @@ class Battle
|
||||
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 :Snowstorm then pbDisplay(_INTL("The snow is blowing about!"))
|
||||
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."))
|
||||
@@ -390,7 +392,6 @@ class Battle
|
||||
(perishSongUsers.find_all { |idxBattler| !opposes?(idxBattler) }.length == perishSongUsers.length))
|
||||
pbJudgeCheckpoint(@battlers[perishSongUsers[0]])
|
||||
end
|
||||
return if @decision > 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -675,7 +676,7 @@ class Battle
|
||||
# Effects that apply to a battler that wear off after a number of rounds
|
||||
pbEOREndBattlerEffects(priority)
|
||||
# Check for end of battle (i.e. because of Perish Song)
|
||||
if @decision > 0
|
||||
if decided?
|
||||
pbGainExp
|
||||
return
|
||||
end
|
||||
@@ -702,12 +703,12 @@ class Battle
|
||||
end
|
||||
end
|
||||
pbGainExp
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
# Form checks
|
||||
priority.each { |battler| battler.pbCheckForm(true) }
|
||||
# Switch Pokémon in if possible
|
||||
pbEORSwitch
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
# In battles with at least one side of size 3+, move battlers around if none
|
||||
# are near to any foes
|
||||
pbEORShiftDistantBattlers
|
||||
|
||||
@@ -190,7 +190,7 @@ class Battle::Battler
|
||||
case effectiveWeather
|
||||
when :Sun, :HarshSun then newForm = 1
|
||||
when :Rain, :HeavyRain then newForm = 2
|
||||
when :Hail then newForm = 3
|
||||
when :Hail, :Snowstorm then newForm = 3
|
||||
end
|
||||
if @form != newForm
|
||||
@battle.pbShowAbilitySplash(self, true)
|
||||
@@ -217,7 +217,7 @@ class Battle::Battler
|
||||
end
|
||||
# Eiscue - Ice Face
|
||||
if !ability_changed && isSpecies?(:EISCUE) && self.ability == :ICEFACE &&
|
||||
@form == 1 && effectiveWeather == :Hail
|
||||
@form == 1 && [:Hail, :Snowstorm].include?(effectiveWeather)
|
||||
@canRestoreIceFace = true # Changed form at end of round
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ class Battle::Battler
|
||||
pbBeginTurn(choice)
|
||||
pbSEPlay("Battle flee")
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!", pbThis))
|
||||
@battle.decision = 3
|
||||
@battle.decision = Battle::Outcome::FLEE
|
||||
pbEndTurn(choice)
|
||||
return true
|
||||
end
|
||||
@@ -537,7 +537,7 @@ class Battle::Battler
|
||||
end
|
||||
b.lastRoundMoved = oldLastRoundMoved
|
||||
@battle.pbJudge
|
||||
return if @battle.decision > 0
|
||||
return if @battle.decided?
|
||||
end
|
||||
b.effects[PBEffects::Instructed] = false
|
||||
end
|
||||
@@ -573,7 +573,7 @@ class Battle::Battler
|
||||
nextUser.effects[PBEffects::Outrage] = oldOutrage
|
||||
nextUser.currentMove = oldCurrentMove
|
||||
@battle.pbJudge
|
||||
return if @battle.decision > 0
|
||||
return if @battle.decided?
|
||||
end
|
||||
nextUser.effects[PBEffects::Dancer] = false
|
||||
end
|
||||
|
||||
@@ -261,7 +261,7 @@ end
|
||||
class Battle::Move::StartHailWeather < Battle::Move::WeatherMove
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@weatherType = :Hail
|
||||
@weatherType = (Settings::USE_SNOWSTORM_WEATHER_INSTEAD_OF_HAIL) ? :Snowstorm : :Hail
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ end
|
||||
#===============================================================================
|
||||
class Battle::Move::FreezeTargetAlwaysHitsInHail < Battle::Move::FreezeTarget
|
||||
def pbBaseAccuracy(user, target)
|
||||
return 0 if target.effectiveWeather == :Hail
|
||||
return 0 if [:Hail, :Snowstorm].include?(target.effectiveWeather)
|
||||
return super
|
||||
end
|
||||
end
|
||||
|
||||
@@ -821,7 +821,7 @@ class Battle::Move::StartWeakenDamageAgainstUserSideIfHail < Battle::Move
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
if user.effectiveWeather != :Hail
|
||||
if ![:Hail, :Snowstorm].include?(user.effectiveWeather)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1561,7 +1561,7 @@ class Battle::Move::TypeAndPowerDependOnWeather < Battle::Move
|
||||
ret = :WATER if GameData::Type.exists?(:WATER)
|
||||
when :Sandstorm
|
||||
ret = :ROCK if GameData::Type.exists?(:ROCK)
|
||||
when :Hail
|
||||
when :Hail, :Snowstorm
|
||||
ret = :ICE if GameData::Type.exists?(:ICE)
|
||||
when :ShadowSky
|
||||
ret = :NONE
|
||||
|
||||
@@ -12,7 +12,7 @@ class Battle::Move::FleeFromBattle < Battle::Move
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!", user.pbThis))
|
||||
@battle.decision = 3 # Escaped
|
||||
@battle.decision = Battle::Outcome::FLEE
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ class Battle::Move::SwitchOutUserStatusMove < Battle::Move
|
||||
def pbEffectGeneral(user)
|
||||
if user.wild?
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!", user.pbThis))
|
||||
@battle.decision = 3 # Escaped
|
||||
@battle.decision = Battle::Outcome::FLEE
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -196,7 +196,7 @@ class Battle::Move::SwitchOutTargetStatusMove < Battle::Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
@battle.decision = 3 if target.wild? # Escaped from battle
|
||||
@battle.decision = Battle::Outcome::FLEE if target.wild?
|
||||
end
|
||||
|
||||
def pbSwitchOutTargetEffect(user, targets, numHits, switched_battlers)
|
||||
@@ -230,7 +230,7 @@ class Battle::Move::SwitchOutTargetDamagingMove < Battle::Move
|
||||
if target.wild? && target.allAllies.length == 0 && @battle.canRun &&
|
||||
target.level <= user.level &&
|
||||
(target.effects[PBEffects::Substitute] == 0 || ignoresSubstitute?(user))
|
||||
@battle.decision = 3 # Escaped from battle
|
||||
@battle.decision = Battle::Outcome::FLEE
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -593,7 +593,8 @@ class Battle::AI
|
||||
:Sun => :HEATROCK,
|
||||
:Rain => :DAMPROCK,
|
||||
:Sandstorm => :SMOOTHROCK,
|
||||
:Hail => :ICYROCK
|
||||
:Hail => :ICYROCK,
|
||||
:Snowstorm => :ICYROCK
|
||||
}[weather]
|
||||
ret += 4 if weather_extender && move_user.has_active_item?(weather_extender)
|
||||
end
|
||||
@@ -635,6 +636,8 @@ class Battle::AI
|
||||
if b.battler.takesHailDamage? # End of round damage
|
||||
ret += (b.opposes?(move_user)) ? 10 : -10
|
||||
end
|
||||
when :Snowstorm
|
||||
# TODO: Snowstorm AI.
|
||||
when :ShadowSky
|
||||
# Check for battlers affected by Shadow Sky's effects
|
||||
if b.has_damaging_move_of_type?(:SHADOW)
|
||||
@@ -650,13 +653,14 @@ class Battle::AI
|
||||
:Sun => [:CHLOROPHYLL, :FLOWERGIFT, :FORECAST, :HARVEST, :LEAFGUARD, :SOLARPOWER],
|
||||
:Rain => [:DRYSKIN, :FORECAST, :HYDRATION, :RAINDISH, :SWIFTSWIM],
|
||||
:Sandstorm => [:SANDFORCE, :SANDRUSH, :SANDVEIL],
|
||||
:Hail => [:FORECAST, :ICEBODY, :SLUSHRUSH, :SNOWCLOAK]
|
||||
:Hail => [:FORECAST, :ICEBODY, :SLUSHRUSH, :SNOWCLOAK],
|
||||
:Snowstorm => [:FORECAST, :ICEBODY, :SLUSHRUSH, :SNOWCLOAK]
|
||||
}[weather]
|
||||
if beneficial_abilities && beneficial_abilities.length > 0 &&
|
||||
b.has_active_ability?(beneficial_abilities)
|
||||
ret += (b.opposes?(move_user)) ? -5 : 5
|
||||
end
|
||||
if weather == :Hail && b.ability == :ICEFACE
|
||||
if [:Hail, :Snowstorm].include?(weather) && b.ability == :ICEFACE
|
||||
ret += (b.opposes?(move_user)) ? -5 : 5
|
||||
end
|
||||
negative_abilities = {
|
||||
@@ -679,6 +683,9 @@ class Battle::AI
|
||||
:Hail => ["FreezeTargetAlwaysHitsInHail",
|
||||
"StartWeakenDamageAgainstUserSideIfHail",
|
||||
"TypeAndPowerDependOnWeather"],
|
||||
:Snowstorm => ["FreezeTargetAlwaysHitsInHail",
|
||||
"StartWeakenDamageAgainstUserSideIfHail",
|
||||
"TypeAndPowerDependOnWeather"],
|
||||
:ShadowSky => ["TypeAndPowerDependOnWeather"]
|
||||
}[weather]
|
||||
if beneficial_moves && beneficial_moves.length > 0 &&
|
||||
@@ -693,6 +700,8 @@ class Battle::AI
|
||||
:Sandstorm => ["HealUserDependingOnWeather",
|
||||
"TwoTurnAttackOneTurnInSun"],
|
||||
:Hail => ["HealUserDependingOnWeather",
|
||||
"TwoTurnAttackOneTurnInSun"],
|
||||
:Snowstorm => ["HealUserDependingOnWeather",
|
||||
"TwoTurnAttackOneTurnInSun"]
|
||||
}[weather]
|
||||
if negative_moves && negative_moves.length > 0 &&
|
||||
|
||||
@@ -76,7 +76,7 @@ class Battle::AI::AIBattler
|
||||
ret += [self.totalhp / 8, 1].max if [:Sun, :HarshSun].include?(weather) && battler.takesIndirectDamage?
|
||||
ret -= [self.totalhp / 8, 1].max if [:Rain, :HeavyRain].include?(weather) && battler.canHeal?
|
||||
when :ICEBODY
|
||||
ret -= [self.totalhp / 16, 1].max if weather == :Hail && battler.canHeal?
|
||||
ret -= [self.totalhp / 16, 1].max if [:Hail, :Snowstorm].include?(weather) && battler.canHeal?
|
||||
when :RAINDISH
|
||||
ret -= [self.totalhp / 16, 1].max if [:Rain, :HeavyRain].include?(weather) && battler.canHeal?
|
||||
when :SOLARPOWER
|
||||
|
||||
@@ -245,7 +245,7 @@ Battle::AI::Handlers::MoveEffectScore.add("StartHailWeather",
|
||||
if ai.trainer.high_skill? && battle.field.weather != :None
|
||||
score -= ai.get_score_for_weather(battle.field.weather, user)
|
||||
end
|
||||
score += ai.get_score_for_weather(:Hail, user, true)
|
||||
score += ai.get_score_for_weather((Settings::USE_SNOWSTORM_WEATHER_INSTEAD_OF_HAIL ? :Snowstorm : :Hail), user, true)
|
||||
next score
|
||||
}
|
||||
)
|
||||
|
||||
@@ -706,7 +706,7 @@ Battle::AI::Handlers::MoveEffectScore.add("StartWeakenSpecialDamageAgainstUserSi
|
||||
Battle::AI::Handlers::MoveFailureCheck.add("StartWeakenDamageAgainstUserSideIfHail",
|
||||
proc { |move, user, ai, battle|
|
||||
next true if user.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
|
||||
next true if user.battler.effectiveWeather != :Hail
|
||||
next true if ![:Hail, :Snowstorm].include?(user.battler.effectiveWeather)
|
||||
next false
|
||||
}
|
||||
)
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ class SafariBattle
|
||||
@time = 0
|
||||
@environment = :None # e.g. Tall grass, cave, still water
|
||||
@weather = :None
|
||||
@decision = 0
|
||||
@decision = Battle::Outcome::UNDECIDED
|
||||
@caughtPokemon = []
|
||||
@player = [player]
|
||||
@party2 = party2
|
||||
@@ -316,6 +316,10 @@ class SafariBattle
|
||||
@ballCount = 0
|
||||
end
|
||||
|
||||
def decided?
|
||||
return Battle::Outcome.decided?(@decision)
|
||||
end
|
||||
|
||||
def disablePokeBalls=(value); end
|
||||
def sendToBoxes=(value); end
|
||||
def defaultWeather=(value); @weather = value; end
|
||||
@@ -447,7 +451,7 @@ class SafariBattle
|
||||
pbThrowPokeBall(1, safariBall, rare, true)
|
||||
if @caughtPokemon.length > 0
|
||||
pbRecordAndStoreCaughtPokemon
|
||||
@decision = 4
|
||||
@decision = Battle::Outcome::CATCH
|
||||
end
|
||||
end
|
||||
when 1 # Bait
|
||||
@@ -463,22 +467,22 @@ class SafariBattle
|
||||
when 3 # Run
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplayPaused(_INTL("You got away safely!"))
|
||||
@decision = 3
|
||||
@decision = Battle::Outcome::FLEE
|
||||
else
|
||||
next
|
||||
end
|
||||
catchFactor = [[catchFactor, 3].max, 20].min
|
||||
escapeFactor = [[escapeFactor, 2].max, 20].min
|
||||
# End of round
|
||||
if @decision == 0
|
||||
if !decided?
|
||||
if @ballCount <= 0
|
||||
pbSEPlay("Safari Zone end")
|
||||
pbDisplay(_INTL("PA: You have no Safari Balls left! Game over!"))
|
||||
@decision = 2
|
||||
@decision = Battle::Outcome::LOSE
|
||||
elsif pbRandom(100) < 5 * escapeFactor
|
||||
pbSEPlay("Battle flee")
|
||||
pbDisplay(_INTL("{1} fled!", pkmn.name))
|
||||
@decision = 3
|
||||
@decision = Battle::Outcome::FLEE
|
||||
elsif cmd == 1 # Bait
|
||||
pbDisplay(_INTL("{1} is eating!", pkmn.name))
|
||||
elsif cmd == 2 # Rock
|
||||
@@ -490,11 +494,11 @@ class SafariBattle
|
||||
weather_data = GameData::BattleWeather.try_get(@weather)
|
||||
@scene.pbCommonAnimation(weather_data.animation) if weather_data
|
||||
end
|
||||
break if @decision > 0
|
||||
break if decided?
|
||||
end
|
||||
@scene.pbEndBattle(@decision)
|
||||
rescue BattleAbortedException
|
||||
@decision = 0
|
||||
@decision = Battle::Outcome::UNDECIDED
|
||||
@scene.pbEndBattle(@decision)
|
||||
end
|
||||
return @decision
|
||||
|
||||
@@ -78,6 +78,6 @@ class BugContestBattle < Battle
|
||||
|
||||
def pbEndOfRoundPhase
|
||||
super
|
||||
@decision = 3 if @ballCount <= 0 && @decision == 0
|
||||
@decision = Battle::Outcome::FLEE if @ballCount <= 0 && !decided?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -159,7 +159,7 @@ class BattlePalaceBattle < Battle
|
||||
|
||||
def pbEndOfRoundPhase
|
||||
super
|
||||
return if @decision != 0
|
||||
return if decided?
|
||||
allBattlers.each { |b| pbPinchChange(b) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,10 +56,10 @@ class BattleArenaBattle < Battle
|
||||
end
|
||||
|
||||
def pbEORSwitch(favorDraws = false)
|
||||
return if favorDraws && @decision == 5
|
||||
return if !favorDraws && @decision > 0
|
||||
return if favorDraws && @decision == Battle::Outcome::DRAW
|
||||
return if !favorDraws && decided?
|
||||
pbJudge
|
||||
return if @decision > 0
|
||||
return if decided?
|
||||
2.times do |side|
|
||||
next if !@battlers[side].fainted?
|
||||
next if @partyindexes[side] + 1 >= self.pbParty(side).length
|
||||
@@ -115,7 +115,7 @@ class BattleArenaBattle < Battle
|
||||
@count = 0
|
||||
end
|
||||
super
|
||||
return if @decision != 0
|
||||
return if decided?
|
||||
# Update mind rating (asserting that a move was chosen)
|
||||
2.times do |side|
|
||||
if @choices[side][2] && @choices[side][0] == :UseMove
|
||||
@@ -126,7 +126,7 @@ class BattleArenaBattle < Battle
|
||||
|
||||
def pbEndOfRoundPhase
|
||||
super
|
||||
return if @decision != 0
|
||||
return if decided?
|
||||
# Update skill rating
|
||||
2.times do |side|
|
||||
@skill[side] += self.successStates[side].skill
|
||||
|
||||
@@ -77,7 +77,7 @@ end
|
||||
#===============================================================================
|
||||
# Blacking out animation
|
||||
#===============================================================================
|
||||
def pbStartOver(gameover = false)
|
||||
def pbStartOver(game_over = false)
|
||||
if pbInBugContest?
|
||||
pbBugContestStartOver
|
||||
return
|
||||
@@ -85,12 +85,15 @@ def pbStartOver(gameover = false)
|
||||
$stats.blacked_out_count += 1
|
||||
$player.heal_party
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0
|
||||
if gameover
|
||||
if game_over
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("After the unfortunate defeat, you scurry back to a Pokémon Center."))
|
||||
else
|
||||
_INTL("After the unfortunate defeat, you hurry to the Pokémon Center."))
|
||||
elsif $player.all_fainted?
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You scurry back to a Pokémon Center, protecting your exhausted Pokémon from any further harm..."))
|
||||
_INTL("You hurry to the Pokémon Center, shielding your exhausted Pokémon from any further harm..."))
|
||||
else # Forfeited a trainer battle
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You went running to the Pokémon Center to regroup and reconsider your battle strategy..."))
|
||||
end
|
||||
pbCancelVehicles
|
||||
Followers.clear
|
||||
@@ -112,12 +115,15 @@ def pbStartOver(gameover = false)
|
||||
$player.heal_party
|
||||
return
|
||||
end
|
||||
if gameover
|
||||
if game_over
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("After the unfortunate defeat, you scurry back home."))
|
||||
else
|
||||
_INTL("After the unfortunate defeat, you hurry back home."))
|
||||
elsif $player.all_fainted?
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You scurry back home, protecting your exhausted Pokémon from any further harm..."))
|
||||
_INTL("You hurry back home, shielding your exhausted Pokémon from any further harm..."))
|
||||
else # Forfeited a trainer battle
|
||||
pbMessage("\\w[]\\wm\\c[8]\\l[3]" +
|
||||
_INTL("You went running back home to regroup and reconsider your battle strategy..."))
|
||||
end
|
||||
if homedata
|
||||
pbCancelVehicles
|
||||
|
||||
@@ -156,8 +156,8 @@ module BattleCreationHelperMethods
|
||||
$PokemonGlobal.nextBattleCaptureME = nil
|
||||
$PokemonGlobal.nextBattleBack = nil
|
||||
$PokemonEncounters.reset_step_count
|
||||
outcome = 1 # Win
|
||||
outcome = 0 if trainer_battle && $player.able_pokemon_count == 0 # Undecided
|
||||
outcome = Battle::Outcome::WIN
|
||||
outcome = Battle::Outcome::UNDECIDED if trainer_battle && $player.all_fainted?
|
||||
pbSet(outcome_variable, outcome)
|
||||
return outcome
|
||||
end
|
||||
@@ -246,7 +246,7 @@ module BattleCreationHelperMethods
|
||||
when :Rain, :Storm
|
||||
battle.defaultWeather = :Rain
|
||||
when :Hail
|
||||
battle.defaultWeather = :Hail
|
||||
battle.defaultWeather = (Settings::USE_SNOWSTORM_WEATHER_INSTEAD_OF_HAIL ? :Snowstorm : :Hail)
|
||||
when :Sandstorm
|
||||
battle.defaultWeather = :Sandstorm
|
||||
when :Sun
|
||||
@@ -311,7 +311,7 @@ module BattleCreationHelperMethods
|
||||
pkmn.makeUnprimal
|
||||
end
|
||||
end
|
||||
if [2, 5].include?(outcome) && can_lose # if loss or draw
|
||||
if Battle::Outcome.should_black_out?(outcome) && can_lose
|
||||
$player.party.each { |pkmn| pkmn.heal }
|
||||
timer_start = System.uptime
|
||||
until System.uptime - timer_start >= 0.25
|
||||
@@ -331,10 +331,10 @@ module BattleCreationHelperMethods
|
||||
# 5 - Draw
|
||||
def set_outcome(outcome, outcome_variable = 1, trainer_battle = false)
|
||||
case outcome
|
||||
when 1, 4 # Won, caught
|
||||
when Battle::Outcome::WIN, Battle::Outcome::CATCH
|
||||
$stats.wild_battles_won += 1 if !trainer_battle
|
||||
$stats.trainer_battles_won += 1 if trainer_battle
|
||||
when 2, 3, 5 # Lost, fled, draw
|
||||
when Battle::Outcome::LOSE, Battle::Outcome::FLEE, Battle::Outcome::DRAW
|
||||
$stats.wild_battles_lost += 1 if !trainer_battle
|
||||
$stats.trainer_battles_lost += 1 if trainer_battle
|
||||
end
|
||||
@@ -363,7 +363,7 @@ class WildBattle
|
||||
EventHandlers.trigger(:on_wild_battle_end, foe_party[0].species, foe_party[0].level, outcome)
|
||||
end
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return outcome != 2 && outcome != 5
|
||||
return !Battle::Outcome.should_black_out?(outcome)
|
||||
end
|
||||
|
||||
def self.start_core(*args)
|
||||
@@ -391,7 +391,7 @@ class WildBattle
|
||||
BattleCreationHelperMethods.prepare_battle(battle)
|
||||
$game_temp.clear_battle_rules
|
||||
# Perform the battle itself
|
||||
outcome = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
pbBattleAnimation(pbGetWildBattleBGM(foe_party), (foe_party.length == 1) ? 0 : 2, foe_party) do
|
||||
pbSceneStandby { outcome = battle.pbStartBattle }
|
||||
BattleCreationHelperMethods.after_battle(outcome, can_lose)
|
||||
@@ -481,7 +481,7 @@ class TrainerBattle
|
||||
outcome = TrainerBattle.start_core(*args)
|
||||
end
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return outcome == 1
|
||||
return outcome == Battle::Outcome::WIN
|
||||
end
|
||||
|
||||
def self.start_core(*args)
|
||||
@@ -511,7 +511,7 @@ class TrainerBattle
|
||||
BattleCreationHelperMethods.prepare_battle(battle)
|
||||
$game_temp.clear_battle_rules
|
||||
# Perform the battle itself
|
||||
outcome = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
pbBattleAnimation(pbGetTrainerBattleBGM(foe_trainers), (battle.singleBattle?) ? 1 : 3, foe_trainers) do
|
||||
pbSceneStandby { outcome = battle.pbStartBattle }
|
||||
BattleCreationHelperMethods.after_battle(outcome, can_lose)
|
||||
@@ -600,20 +600,20 @@ end
|
||||
# After battles
|
||||
#===============================================================================
|
||||
EventHandlers.add(:on_end_battle, :evolve_and_black_out,
|
||||
proc { |decision, canLose|
|
||||
proc { |outcome, canLose|
|
||||
# Check for evolutions
|
||||
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
||||
(decision != 2 && decision != 5) # not a loss or a draw
|
||||
!Battle::Outcome.should_black_out?(outcome)
|
||||
$game_temp.party_levels_before_battle = nil
|
||||
# Check for blacking out or gaining Pickup/Huney Gather items
|
||||
case decision
|
||||
when 1, 4 # Win, capture
|
||||
case outcome
|
||||
when Battle::Outcome::WIN, Battle::Outcome::CATCH
|
||||
$player.pokemon_party.each do |pkmn|
|
||||
pbPickup(pkmn)
|
||||
pbHoneyGather(pkmn)
|
||||
end
|
||||
when 2, 5 # Lose, draw
|
||||
if !canLose
|
||||
else
|
||||
if Battle::Outcome.should_black_out?(outcome) && !canLose
|
||||
$game_system.bgm_unpause
|
||||
$game_system.bgs_unpause
|
||||
pbStartOver
|
||||
|
||||
@@ -386,7 +386,9 @@ def pbGenerateWildPokemon(species, level, isRoamer = false)
|
||||
items = genwildpoke.wildHoldItems
|
||||
first_pkmn = $player.first_pokemon
|
||||
chances = [50, 5, 1]
|
||||
if first_pkmn
|
||||
if Settings::MECHANICS_GENERATION >= 9
|
||||
chances[0] = 30
|
||||
elsif first_pkmn
|
||||
case first_pkmn.ability_id
|
||||
when :COMPOUNDEYES
|
||||
chances = [60, 20, 5]
|
||||
|
||||
@@ -212,17 +212,17 @@ def pbRoamingPokemonBattle(pkmn, level = 1)
|
||||
setBattleRule("single")
|
||||
setBattleRule("roamerFlees")
|
||||
# Perform the battle
|
||||
decision = WildBattle.start_core($PokemonGlobal.roamPokemon[idxRoamer])
|
||||
outcome = WildBattle.start_core($PokemonGlobal.roamPokemon[idxRoamer])
|
||||
# Update Roaming Pokémon data based on result of battle
|
||||
if [1, 4].include?(decision) # Defeated or caught
|
||||
if [Battle::Outcome::WIN, Battle::Outcome::CATCH].include?(outcome) # Defeated or caught
|
||||
$PokemonGlobal.roamPokemon[idxRoamer] = true
|
||||
$PokemonGlobal.roamPokemonCaught[idxRoamer] = (decision == 4)
|
||||
$PokemonGlobal.roamPokemonCaught[idxRoamer] = (outcome == Battle::Outcome::CATCH)
|
||||
end
|
||||
$PokemonGlobal.roamEncounter = nil
|
||||
$PokemonGlobal.roamedAlready = true
|
||||
$game_temp.roamer_index_for_encounter = nil
|
||||
# Used by the Poké Radar to update/break the chain
|
||||
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, outcome)
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return (decision != 2 && decision != 5)
|
||||
return !Battle::Outcome.should_black_out?(outcome)
|
||||
end
|
||||
|
||||
@@ -52,11 +52,7 @@ ItemHandlers::CanUseInBattle.addIf(:poke_balls,
|
||||
# this case, but only in trainer battles, and the trainer will deflect
|
||||
# them if they are trying to catch a non-Shadow Pokémon.)
|
||||
if battle.pbOpposingBattlerCount > 1 && !(GameData::Item.get(item).is_snag_ball? && battle.trainerBattle?)
|
||||
if battle.pbOpposingBattlerCount == 2
|
||||
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are two Pokémon!")) if showMessages
|
||||
elsif showMessages
|
||||
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there is more than one Pokémon!"))
|
||||
end
|
||||
scene.pbDisplay(_INTL("It's no good! It's impossible to aim unless there is only one Pokémon!")) if showMessages
|
||||
next false
|
||||
end
|
||||
next true
|
||||
@@ -306,7 +302,7 @@ ItemHandlers::UseInBattle.add(:GUARDSPEC, proc { |item, battler, battle|
|
||||
})
|
||||
|
||||
ItemHandlers::UseInBattle.add(:POKEDOLL, proc { |item, battler, battle|
|
||||
battle.decision = 3
|
||||
battle.decision = Battle::Outcome::FLEE
|
||||
battle.pbDisplayPaused(_INTL("You got away safely!"))
|
||||
})
|
||||
|
||||
|
||||
@@ -221,14 +221,14 @@ EventHandlers.add(:on_wild_pokemon_created, :poke_radar_shiny,
|
||||
)
|
||||
|
||||
EventHandlers.add(:on_wild_battle_end, :poke_radar_continue_chain,
|
||||
proc { |species, level, decision|
|
||||
if $game_temp.poke_radar_data && [1, 4].include?(decision) # Defeated/caught
|
||||
proc { |species, level, outcome|
|
||||
if $game_temp.poke_radar_data && [Battle::Outcome::WIN, Battle::Outcome::CATCH].include?(outcome)
|
||||
$game_temp.poke_radar_data[0] = species
|
||||
$game_temp.poke_radar_data[1] = level
|
||||
$game_temp.poke_radar_data[2] += 1
|
||||
$stats.poke_radar_longest_chain = [$game_temp.poke_radar_data[2], $stats.poke_radar_longest_chain].max
|
||||
# Catching makes the next Radar encounter more likely to continue the chain
|
||||
$game_temp.poke_radar_data[4] = (decision == 4)
|
||||
$game_temp.poke_radar_data[4] = (outcome == Battle::Outcome::CATCH)
|
||||
pbPokeRadarHighlightGrass(false)
|
||||
else
|
||||
pbPokeRadarCancel
|
||||
|
||||
@@ -747,6 +747,12 @@ MultipleForms.register(:CALYREX, {
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:BASCULEGION, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next (pkmn.female?) ? 3 : 2
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:LECHONK, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next pkmn.gender
|
||||
|
||||
@@ -432,7 +432,7 @@ EventHandlers.add(:on_start_battle, :record_party_heart_gauges,
|
||||
)
|
||||
|
||||
EventHandlers.add(:on_end_battle, :check_ready_to_purify,
|
||||
proc { |_decision, _canLose|
|
||||
proc { |_outcome, _canLose|
|
||||
$game_temp.party_heart_gauges_before_battle.each_with_index do |value, i|
|
||||
pkmn = $player.party[i]
|
||||
next if !pkmn || !value || value == 0
|
||||
|
||||
@@ -205,7 +205,7 @@ class BattleChallengeData
|
||||
def pbStart(t, numRounds)
|
||||
@inProgress = true
|
||||
@resting = false
|
||||
@decision = 0
|
||||
@decision = Battle::Outcome::UNDECIDED
|
||||
@swaps = t.currentSwaps
|
||||
@wins = t.currentWins
|
||||
@battleNumber = 1
|
||||
@@ -251,7 +251,7 @@ class BattleChallengeData
|
||||
end
|
||||
|
||||
def pbMatchOver?
|
||||
return true if !@inProgress || @decision != 0
|
||||
return true if !@inProgress || @decision != Battle::Outcome::UNDECIDED
|
||||
return @battleNumber > @numRounds
|
||||
end
|
||||
|
||||
@@ -275,7 +275,7 @@ class BattleChallengeData
|
||||
def pbEnd
|
||||
$player.party = @oldParty
|
||||
return if !@inProgress
|
||||
save = (@decision != 0)
|
||||
save = (@decision != Battle::Outcome::UNDECIDED)
|
||||
reset
|
||||
$game_map.need_refresh = true
|
||||
Game.save(safe: true) if save
|
||||
@@ -293,7 +293,7 @@ class BattleChallengeData
|
||||
@inProgress = false
|
||||
@resting = false
|
||||
@start = nil
|
||||
@decision = 0
|
||||
@decision = Battle::Outcome::UNDECIDED
|
||||
@wins = 0
|
||||
@swaps = 0
|
||||
@battleNumber = 0
|
||||
@@ -343,11 +343,11 @@ class BattleChallengeType
|
||||
end
|
||||
|
||||
def saveWins(challenge)
|
||||
if challenge.decision == 0 # if undecided
|
||||
if challenge.decision == Battle::Outcome::UNDECIDED
|
||||
@currentWins = 0
|
||||
@currentSwaps = 0
|
||||
else
|
||||
if challenge.decision == 1 # if won
|
||||
if challenge.decision == Battle::Outcome::WIN
|
||||
@currentWins = challenge.wins
|
||||
@currentSwaps = challenge.swaps
|
||||
else # if lost
|
||||
|
||||
@@ -61,9 +61,9 @@ def pbOrganizedBattleEx(opponent, challengedata)
|
||||
# Set various other properties in the battle class
|
||||
BattleCreationHelperMethods.prepare_battle(battle)
|
||||
# Perform the battle itself
|
||||
decision = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
pbBattleAnimation(pbGetTrainerBattleBGM(opponent)) do
|
||||
pbSceneStandby { decision = battle.pbStartBattle }
|
||||
pbSceneStandby { outcome = battle.pbStartBattle }
|
||||
end
|
||||
Input.update
|
||||
# Restore both parties to their original levels
|
||||
@@ -83,17 +83,17 @@ def pbOrganizedBattleEx(opponent, challengedata)
|
||||
end
|
||||
# Save the record of the battle
|
||||
$game_temp.last_battle_record = nil
|
||||
if [1, 2, 5].include?(decision) # if win, loss or draw
|
||||
if [Battle::Outcome::WIN, Battle::Outcome::LOSE, Battle::Outcome::DRAW].include?(outcome)
|
||||
$game_temp.last_battle_record = battle.pbDumpRecord
|
||||
end
|
||||
case decision
|
||||
when 1 # Won
|
||||
case outcome
|
||||
when Battle::Outcome::WIN # Won
|
||||
$stats.trainer_battles_won += 1
|
||||
when 2, 3, 5 # Lost, fled, draw
|
||||
when Battle::Outcome::LOSE, Battle::Outcome::FLEE, Battle::Outcome::DRAW
|
||||
$stats.trainer_battles_lost += 1
|
||||
end
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
return (decision == 1)
|
||||
return (outcome == Battle::Outcome::WIN)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -128,15 +128,15 @@ def pbSafariBattle(pkmn, level = 1)
|
||||
battle.ballCount = pbSafariState.ballcount
|
||||
BattleCreationHelperMethods.prepare_battle(battle)
|
||||
# Perform the battle itself
|
||||
decision = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
pbBattleAnimation(pbGetWildBattleBGM(foeParty), 0, foeParty) do
|
||||
pbSceneStandby { decision = battle.pbStartBattle }
|
||||
pbSceneStandby { outcome = battle.pbStartBattle }
|
||||
end
|
||||
Input.update
|
||||
# Update Safari game data based on result of battle
|
||||
pbSafariState.ballcount = battle.ballCount
|
||||
if pbSafariState.ballcount <= 0
|
||||
if decision != 2 # Last Safari Ball was used to catch the wild Pokémon
|
||||
if outcome != Battle::Outcome::LOSE # Last Safari Ball was used to catch the wild Pokémon
|
||||
pbMessage(_INTL("Announcer: You're out of Safari Balls! Game over!"))
|
||||
end
|
||||
pbSafariState.decision = 1
|
||||
@@ -147,16 +147,16 @@ def pbSafariBattle(pkmn, level = 1)
|
||||
# 2 - Player ran out of Safari Balls
|
||||
# 3 - Player or wild Pokémon ran from battle, or player forfeited the match
|
||||
# 4 - Wild Pokémon was caught
|
||||
if decision == 4
|
||||
if outcome == Battle::Outcome::CATCH
|
||||
$stats.safari_pokemon_caught += 1
|
||||
pbSafariState.captures += 1
|
||||
$stats.most_captures_per_safari_game = [$stats.most_captures_per_safari_game, pbSafariState.captures].max
|
||||
end
|
||||
pbSet(1, decision)
|
||||
pbSet(1, outcome)
|
||||
# Used by the Poké Radar to update/break the chain
|
||||
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, outcome)
|
||||
# Return the outcome of the battle
|
||||
return decision
|
||||
return outcome
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -378,11 +378,11 @@ def pbBugContestBattle(pkmn, level = 1)
|
||||
setBattleRule("single")
|
||||
BattleCreationHelperMethods.prepare_battle(battle)
|
||||
# Perform the battle itself
|
||||
decision = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
pbBattleAnimation(pbGetWildBattleBGM(foeParty), 0, foeParty) do
|
||||
decision = battle.pbStartBattle
|
||||
BattleCreationHelperMethods.after_battle(decision, true)
|
||||
if [2, 5].include?(decision) # Lost or drew
|
||||
outcome = battle.pbStartBattle
|
||||
BattleCreationHelperMethods.after_battle(outcome, true)
|
||||
if Battle::Outcome.should_black_out?(outcome)
|
||||
$game_system.bgm_unpause
|
||||
$game_system.bgs_unpause
|
||||
pbBugContestStartOver
|
||||
@@ -392,15 +392,15 @@ def pbBugContestBattle(pkmn, level = 1)
|
||||
# Update Bug Contest game data based on result of battle
|
||||
pbBugContestState.ballcount = battle.ballCount
|
||||
if pbBugContestState.ballcount == 0
|
||||
pbMessage(_INTL("ANNOUNCER: The Bug-Catching Contest is over!"))
|
||||
pbMessage(_INTL("ANNOUNCER: The Bug-Catching Contest is over!"))
|
||||
pbBugContestState.pbStartJudging
|
||||
end
|
||||
# Save the result of the battle in Game Variable 1
|
||||
BattleCreationHelperMethods.set_outcome(decision, 1)
|
||||
BattleCreationHelperMethods.set_outcome(outcome, 1)
|
||||
# Used by the Poké Radar to update/break the chain
|
||||
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, outcome)
|
||||
# Return false if the player lost or drew the battle, and true if any other result
|
||||
return (decision != 2 && decision != 5)
|
||||
return !Battle::Outcome.should_black_out?(outcome)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -364,10 +364,10 @@ def pbDecideWinner(party0, party1, rating0, rating1)
|
||||
score0 = pbDecideWinnerScore(party0, party1, rating0)
|
||||
score1 = pbDecideWinnerScore(party1, party0, rating1)
|
||||
if score0 == score1
|
||||
return 5 if rating0 == rating1
|
||||
return (rating0 > rating1) ? 1 : 2
|
||||
return Battle::Outcome::DRAW if rating0 == rating1
|
||||
return (rating0 > rating1) ? Battle::Outcome::WIN : Battle::Outcome::LOSE
|
||||
else
|
||||
return (score0 > score1) ? 1 : 2
|
||||
return (score0 > score1) ? Battle::Outcome::WIN : Battle::Outcome::LOSE
|
||||
end
|
||||
end
|
||||
|
||||
@@ -375,7 +375,7 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
def pbRuledBattle(team1, team2, rule)
|
||||
decision = 0
|
||||
outcome = Battle::Outcome::UNDECIDED
|
||||
if rand(100) == 0
|
||||
level = rule.ruleset.suggestedLevel
|
||||
t_type = GameData::TrainerType.keys.first
|
||||
@@ -406,7 +406,7 @@ def pbRuledBattle(team1, team2, rule)
|
||||
battle.debug = true
|
||||
battle.controlPlayer = true
|
||||
battle.internalBattle = false
|
||||
decision = battle.pbStartBattle
|
||||
outcome = battle.pbStartBattle
|
||||
team1.team.each_with_index do |p, i|
|
||||
next if !p
|
||||
p.heal
|
||||
@@ -422,13 +422,13 @@ def pbRuledBattle(team1, team2, rule)
|
||||
party2 = []
|
||||
team1.length.times { |i| party1.push(team1[i]) }
|
||||
team2.length.times { |i| party2.push(team2[i]) }
|
||||
decision = pbDecideWinner(party1, party2, team1.rating, team2.rating)
|
||||
outcome = pbDecideWinner(party1, party2, team1.rating, team2.rating)
|
||||
end
|
||||
case decision
|
||||
when 1 # Team 1 wins
|
||||
case outcome
|
||||
when Battle::Outcome::WIN # Team 1 wins
|
||||
team1.addMatch(team2, 1)
|
||||
team2.addMatch(team1, 0)
|
||||
when 2 # Team 2 wins
|
||||
when Battle::Outcome::LOSE # Team 2 wins
|
||||
team1.addMatch(team2, 0)
|
||||
team2.addMatch(team1, 1)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user