diff --git a/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb b/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb index dbb3761f0..9cdf1b363 100644 --- a/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb +++ b/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb @@ -48,14 +48,14 @@ class PngAnimatedBitmap if filename[/^\[(\d+)(?:,(\d+))?\]/] # Starts with 1 or 2 numbers in brackets # File has a frame count numFrames = $1.to_i - duration = $2.to_i + duration = $2.to_i # In 1/20ths of a second duration = 5 if duration == 0 raise "Invalid frame count in #{filename}" if numFrames <= 0 raise "Invalid frame duration in #{filename}" if duration <= 0 if panorama.width % numFrames != 0 raise "Bitmap's width (#{panorama.width}) is not divisible by frame count: #{filename}" end - @frame_duration = duration + @frame_duration = duration / 20.0 subWidth = panorama.width / numFrames numFrames.times do |i| subBitmap = Bitmap.new(subWidth, panorama.height) @@ -99,7 +99,7 @@ class PngAnimatedBitmap # Actually returns the total number of 1/20ths of a second this animation lasts. def totalFrames - return @frame_duration * @frames.length + return (@frame_duration * @frames.length * 20).to_i end def each diff --git a/Data/Scripts/011_Battle/005_AI/002_AI_Switch.rb b/Data/Scripts/011_Battle/005_AI/002_AI_Switch.rb index f00ca35ad..3867794b8 100644 --- a/Data/Scripts/011_Battle/005_AI/002_AI_Switch.rb +++ b/Data/Scripts/011_Battle/005_AI/002_AI_Switch.rb @@ -408,8 +408,10 @@ Battle::AI::Handlers::ShouldSwitch.add(:asleep, end # Doesn't have sufficiently raised stats that would be lost by switching next false if battler.stages.any? { |key, val| val >= 2 } - # 50% chance to not bother - next false if ai.pbAIRandom(100) < 50 + # A reserve Pokémon is awake and not frozen + next false if reserves.none? { |pkmn| ![:SLEEP, :FROZEN].include?(pkmn.status) } + # 60% chance to not bother + next false if ai.pbAIRandom(100) < 60 PBDebug.log_ai("#{battler.name} wants to switch because it is asleep and can't do anything") next true } diff --git a/Data/Scripts/011_Battle/005_AI/005_AI_ChooseMove.rb b/Data/Scripts/011_Battle/005_AI/005_AI_ChooseMove.rb index 2fc420528..1d02c079d 100644 --- a/Data/Scripts/011_Battle/005_AI/005_AI_ChooseMove.rb +++ b/Data/Scripts/011_Battle/005_AI/005_AI_ChooseMove.rb @@ -342,7 +342,8 @@ class Battle::AI if @trainer.high_skill? && @user.can_switch_lax? badMoves = false if max_score <= MOVE_USELESS_SCORE - badMoves = true + badMoves = user_battler.can_attack? + badMoves = true if !badMoves && pbAIRandom(100) < 25 elsif max_score < MOVE_BASE_SCORE * move_score_threshold && user_battler.turnCount > 2 badMoves = true if pbAIRandom(100) < 80 end diff --git a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb index 25be87921..c5abc1c6c 100644 --- a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb +++ b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb @@ -154,7 +154,7 @@ class PokemonPokedexInfo_Scene def pbGetAvailableForms ret = [] multiple_forms = false - gender_differences = (GameData::Species.front_sprite_filename(@species, 0) == GameData::Species.front_sprite_filename(@species, 0, 1)) + gender_differences = (GameData::Species.front_sprite_filename(@species, 0) != GameData::Species.front_sprite_filename(@species, 0, 1)) # Find all genders/forms of @species that have been seen GameData::Species.each do |sp| next if sp.species != @species diff --git a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb index 99c875507..6dd0c35a3 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb @@ -126,7 +126,7 @@ MenuHandlers.add(:debug_menu, :safari_zone_and_bug_contest, { break end end - when 1 # Safari Balls + when 1 # Sport Balls params = ChooseNumberParams.new params.setRange(0, 99999) params.setDefaultValue(contest.ballcount) @@ -162,7 +162,7 @@ MenuHandlers.add(:debug_menu, :edit_field_effects, { params = ChooseNumberParams.new params.setRange(0, 99999) params.setDefaultValue($PokemonGlobal.repel) - $PokemonGlobal.repel = pbMessageChooseNumber(_INTL("Set the Pokémon's level."), params) + $PokemonGlobal.repel = pbMessageChooseNumber(_INTL("Set the number of steps remaining."), params) when 1 # Strength used $PokemonMap.strengthUsed = !$PokemonMap.strengthUsed when 2 # Flash used