diff --git a/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb b/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb index 9761c0a24..f49a321a7 100644 --- a/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb +++ b/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb @@ -19,7 +19,7 @@ module GameData "Form" => [:form, "u"], "Name" => [:name, "s"], "Moves" => [:moves, "*e", :Move], - "Ability" => [:ability, "s"], + "Ability" => [:ability, "e", :Ability], "AbilityIndex" => [:ability_index, "u"], "Item" => [:item, "e", :Item], "Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0, @@ -30,7 +30,7 @@ module GameData "Happiness" => [:happiness, "u"], "Shiny" => [:shininess, "b"], "Shadow" => [:shadowness, "b"], - "Ball" => [:poke_ball, "s"], + "Ball" => [:poke_ball, "e", :Item], } extend ClassMethods diff --git a/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb b/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb index 8aef52a92..b12a6ff79 100644 --- a/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb +++ b/Data/Scripts/011_Battle/005_BallHandlers_PokeBallEffects.rb @@ -1,50 +1,3 @@ -$BallTypes = { - 0 => :POKEBALL, - 1 => :GREATBALL, - 2 => :SAFARIBALL, - 3 => :ULTRABALL, - 4 => :MASTERBALL, - 5 => :NETBALL, - 6 => :DIVEBALL, - 7 => :NESTBALL, - 8 => :REPEATBALL, - 9 => :TIMERBALL, - 10 => :LUXURYBALL, - 11 => :PREMIERBALL, - 12 => :DUSKBALL, - 13 => :HEALBALL, - 14 => :QUICKBALL, - 15 => :CHERISHBALL, - 16 => :FASTBALL, - 17 => :LEVELBALL, - 18 => :LUREBALL, - 19 => :HEAVYBALL, - 20 => :LOVEBALL, - 21 => :FRIENDBALL, - 22 => :MOONBALL, - 23 => :SPORTBALL, - 24 => :DREAMBALL, - 25 => :BEASTBALL -} - -def pbBallTypeToItem(ball_type) - ret = GameData::Item.try_get($BallTypes[ball_type]) - return ret if ret - ret = GameData::Item.try_get($BallTypes[0]) - return ret if ret - return GameData::Item.get(:POKEBALL) -end - -def pbGetBallType(ball) - ball = GameData::Item.try_get(ball) - $BallTypes.keys.each do |key| - return key if ball == $BallTypes[key] - end - return 0 -end - - - #=============================================================================== # #=============================================================================== diff --git a/Data/Scripts/011_Battle/005_Battle scene/001_PokeBattle_Animation.rb b/Data/Scripts/011_Battle/005_Battle scene/001_PokeBattle_Animation.rb index 77c44d496..d37b03eb6 100644 --- a/Data/Scripts/011_Battle/005_Battle scene/001_PokeBattle_Animation.rb +++ b/Data/Scripts/011_Battle/005_Battle scene/001_PokeBattle_Animation.rb @@ -86,9 +86,6 @@ module PokeBattle_BallAnimationMixin def addBallSprite(ballX, ballY, poke_ball) file_path = sprintf("Graphics/Battle animations/ball_%s", poke_ball) - if !pbResolveBitmap(file_path) - file_path = sprintf("Graphics/Battle animations/ball_%02d", pbGetBallType(poke_ball).id_number) - end ball = addNewSprite(ballX, ballY, file_path, PictureOrigin::Center) @ballSprite = @pictureSprites.last if @ballSprite.bitmap.width >= @ballSprite.bitmap.height @@ -206,9 +203,6 @@ module PokeBattle_BallAnimationMixin def ballSetOpen(ball, delay, poke_ball) file_path = sprintf("Graphics/Battle animations/ball_%s_open", poke_ball) - if !pbResolveBitmap(file_path) - file_path = sprintf("Graphics/Battle animations/ball_%02d_open", pbGetBallType(poke_ball).id_number) - end ball.setName(delay, file_path) if @ballSprite && @ballSprite.bitmap.width >= @ballSprite.bitmap.height ball.setSrcSize(delay, @ballSprite.bitmap.height / 2, @ballSprite.bitmap.height) @@ -217,9 +211,6 @@ module PokeBattle_BallAnimationMixin def ballSetClosed(ball, delay, poke_ball) file_path = sprintf("Graphics/Battle animations/ball_%s", poke_ball) - if !pbResolveBitmap(file_path) - file_path = sprintf("Graphics/Battle animations/ball_%02d", pbGetBallType(poke_ball).id_number) - end ball.setName(delay, file_path) if @ballSprite && @ballSprite.bitmap.width >= @ballSprite.bitmap.height ball.setSrcSize(delay, @ballSprite.bitmap.height / 2, @ballSprite.bitmap.height) diff --git a/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb b/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb index 83d4b42ce..ccee4ebd9 100644 --- a/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb +++ b/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb @@ -57,7 +57,7 @@ class PokeBattle_Pokemon ret.pokerus = pkmn.pokerus if pkmn.pokerus ret.name = pkmn.name if pkmn.name != ret.speciesName ret.happiness = pkmn.happiness - ret.poke_ball = pbBallTypeToItem(pkmn.ballused).id + ret.poke_ball = :POKEBALL # pbBallTypeToItem(pkmn.ballused).id ret.markings = pkmn.markings if pkmn.markings GameData::Stat.each_main do |s| ret.iv[s.id] = pkmn.iv[s.id_number] diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb index 81909cdb1..eb38ca2f5 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb @@ -62,13 +62,7 @@ class PokemonTrade_Scene pictureBall = PictureEx.new(0) picturePoke = PictureEx.new(0) ballimage = sprintf("Graphics/Battle animations/ball_%s", @pokemon.poke_ball) - if !pbResolveBitmap(ballimage) - ballimage = sprintf("Graphics/Battle animations/ball_%02d", pbGetBallType(@pokemon.poke_ball)) - end ballopenimage = sprintf("Graphics/Battle animations/ball_%s_open", @pokemon.poke_ball) - if !pbResolveBitmap(ballimage) - ballopenimage = sprintf("Graphics/Battle animations/ball_%02d_open", pbGetBallType(@pokemon.poke_ball)) - end # Starting position of ball pictureBall.setXY(0,Graphics.width/2,48) pictureBall.setName(0,ballimage) @@ -110,13 +104,7 @@ class PokemonTrade_Scene pictureBall = PictureEx.new(0) picturePoke = PictureEx.new(0) ballimage = sprintf("Graphics/Battle animations/ball_%s", @pokemon2.poke_ball) - if !pbResolveBitmap(ballimage) - ballimage = sprintf("Graphics/Battle animations/ball_%02d", pbGetBallType(@pokemon2.poke_ball)) - end ballopenimage = sprintf("Graphics/Battle animations/ball_%s_open", @pokemon2.poke_ball) - if !pbResolveBitmap(ballimage) - ballopenimage = sprintf("Graphics/Battle animations/ball_%02d_open", pbGetBallType(@pokemon2.poke_ball)) - end # Starting position of ball pictureBall.setXY(0,Graphics.width/2,-32) pictureBall.setName(0,ballimage) diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index 38d8f218c..72779c574 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -304,9 +304,6 @@ class PokemonSummary_Scene imagepos=[] # Show the Poké Ball containing the Pokémon ballimage = sprintf("Graphics/Pictures/Summary/icon_ball_%s", @pokemon.poke_ball) - if !pbResolveBitmap(ballimage) - ballimage = sprintf("Graphics/Pictures/Summary/icon_ball_%02d", pbGetBallType(@pokemon.poke_ball)) - end imagepos.push([ballimage,14,60]) # Show status/fainted/Pokérus infected icon status = 0 @@ -485,9 +482,6 @@ class PokemonSummary_Scene imagepos = [] # Show the Poké Ball containing the Pokémon ballimage = sprintf("Graphics/Pictures/Summary/icon_ball_%s", @pokemon.poke_ball) - if !pbResolveBitmap(ballimage) - ballimage = sprintf("Graphics/Pictures/Summary/icon_ball_%02d", pbGetBallType(@pokemon.poke_ball)) - end imagepos.push([ballimage,14,60]) # Draw all images pbDrawImagePositions(overlay,imagepos) diff --git a/Data/Scripts/020_Debug/001_Editor_Utilities.rb b/Data/Scripts/020_Debug/001_Editor_Utilities.rb index e6098e142..e6a12d296 100644 --- a/Data/Scripts/020_Debug/001_Editor_Utilities.rb +++ b/Data/Scripts/020_Debug/001_Editor_Utilities.rb @@ -210,9 +210,8 @@ def pbChooseBallList(defaultMoveID = nil) cmdwin = pbListWindow([], 200) commands = [] moveDefault = 0 - for key in $BallTypes.keys - item = GameData::Item.try_get($BallTypes[key]) - commands.push([$BallTypes[key], item.name]) if item + GameData::Item.each do |item_data| + commands.push([item_data.id, item_data.name]) if item_data.is_poke_ball? end commands.sort! { |a, b| a[1] <=> b[1] } if defaultMoveID diff --git a/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb index d10fac9ce..3d3300d2c 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb @@ -890,9 +890,8 @@ PokemonDebugMenuCommands.register("setpokeball", { "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| commands = [] balls = [] - for key in $BallTypes.keys - item = GameData::Item.try_get($BallTypes[key]) - balls.push([item.id, item.name]) if item + GameData::Item.each do |item_data| + balls.push([item_data.id, item_data.name]) if item_data.is_poke_ball? end balls.sort! { |a, b| a[1] <=> b[1] } cmd = 0 diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 86f589c8f..7fabc8f43 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -700,8 +700,6 @@ module Compiler compile_pokemon # Depends on Move, Item, Type, Ability yield(_INTL("Compiling Pokémon forms data")) compile_pokemon_forms # Depends on Species, Move, Item, Type, Ability - yield(_INTL("Compiling machine data")) - compile_move_compatibilities # Depends on Species, Move yield(_INTL("Compiling shadow moveset data")) compile_shadow_movesets # Depends on Species, Move yield(_INTL("Compiling Regional Dexes")) diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index c4eccfda7..9def85ae9 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -733,43 +733,6 @@ module Compiler Graphics.update end - #============================================================================= - # Compile TM/TM/Move Tutor compatibilities - #============================================================================= - def compile_move_compatibilities(path = "PBS/tm.txt") - return if !safeExists?(path) - species_hash = {} - move = nil - pbCompilerEachCommentedLine(path) { |line, line_no| - Graphics.update if line_no % 50 == 0 - if line[/^\s*\[\s*(\S+)\s*\]\s*$/] - move = parseMove($~[1]) - pbSetWindowText(_INTL("Processing {1} section [{2}]", FileLineData.file, move)) - else - raise _INTL("Expected a section at the beginning of the file.\r\n{1}", FileLineData.linereport) if !move - species_list = line.split(",") - for species in species_list - next if !species || species.empty? - s = parseSpecies(species) - species_hash[s] = [] if !species_hash[s] - species_hash[s].push(move) - end - end - } - GameData::Species.each do |species_data| - next if !species_hash[species_data.id] - species_hash[species_data.id].sort! { |a, b| a.to_s <=> b.to_s } - species_hash[species_data.id].each { |move| species_data.tutor_moves.push(move) } - end - GameData::Species.save - Compiler.write_pokemon - Compiler.write_pokemon_forms - begin - File.delete(path) if path == "PBS/tm.txt" - rescue SystemCallError - end - end - #============================================================================= # Compile Shadow movesets #============================================================================= @@ -1200,6 +1163,10 @@ module Compiler if property_value > 255 raise _INTL("Bad happiness: {1} (must be 0-255).\r\n{2}", property_value, FileLineData.linereport) end + when "Ball" + if !GameData::Item.get(property_value).is_poke_ball? + raise _INTL("Value {1} isn't a defined Poké Ball.\r\n{2}", property_value, FileLineData.linereport) + end end # Record XXX=YYY setting case property_name @@ -1217,14 +1184,6 @@ module Compiler raise _INTL("Pokémon hasn't been defined yet!\r\n{1}", FileLineData.linereport) end case property_name - when "Ability" - if property_value[/^\d+$/] - current_pkmn[:ability_index] = property_value.to_i - elsif !GameData::Ability.exists?(property_value.to_sym) - raise _INTL("Value {1} isn't a defined Ability.\r\n{2}", property_value, FileLineData.linereport) - else - current_pkmn[line_schema[0]] = property_value.to_sym - end when "IV", "EV" value_hash = {} GameData::Stat.each_main do |s| @@ -1232,15 +1191,6 @@ module Compiler value_hash[s.id] = property_value[s.pbs_order] || property_value[0] end current_pkmn[line_schema[0]] = value_hash - when "Ball" - if property_value[/^\d+$/] - current_pkmn[line_schema[0]] = pbBallTypeToItem(property_value.to_i).id - elsif !GameData::Item.exists?(property_value.to_sym) || - !GameData::Item.get(property_value.to_sym).is_poke_ball? - raise _INTL("Value {1} isn't a defined Poké Ball.\r\n{2}", property_value, FileLineData.linereport) - else - current_pkmn[line_schema[0]] = property_value.to_sym - end else current_pkmn[line_schema[0]] = property_value end @@ -1377,8 +1327,8 @@ module Compiler f.write(0xBB.chr) f.write(0xBF.chr) f.write("[DefaultTrainerList]\r\n") - f.write("Trainers = bttrainers.txt\r\n") - f.write("Pokemon = btpokemon.txt\r\n") + f.write("Trainers = battle_tower_trainers.txt\r\n") + f.write("Pokemon = battle_tower_pokemon.txt\r\n") } end sections = []