diff --git a/Data/Scripts/001_Technical/005_Win32API.rb b/Data/Scripts/001_Technical/005_Win32API.rb index 0b5b13836..a6c30fd07 100644 --- a/Data/Scripts/001_Technical/005_Win32API.rb +++ b/Data/Scripts/001_Technical/005_Win32API.rb @@ -38,5 +38,7 @@ end # Well done for finding this place. # DO NOT EDIT THESE -ESSENTIALS_VERSION = "18.1.dev" -ERROR_TEXT = "" +module Essentials + VERSION = "18.1.dev" + ERROR_TEXT = "" +end diff --git a/Data/Scripts/001_Technical/008_Errors.rb b/Data/Scripts/001_Technical/008_Errors.rb index 35df2b640..2c92944fa 100644 --- a/Data/Scripts/001_Technical/008_Errors.rb +++ b/Data/Scripts/001_Technical/008_Errors.rb @@ -31,8 +31,8 @@ def pbPrintException(e) e.backtrace[0,maxlength].each { |i| btrace += "#{i}\r\n" } end btrace.gsub!(/Section(\d+)/) { $RGSS_SCRIPTS[$1.to_i][1] } - message = "[Pokémon Essentials version #{ESSENTIALS_VERSION}]\r\n" - message += "#{ERROR_TEXT}" # For third party scripts to add to + message = "[Pokémon Essentials version #{Essentials::VERSION}]\r\n" + message += "#{Essentials::ERROR_TEXT}" # For third party scripts to add to message += "Exception: #{e.class}\r\n" message += "Message: #{emessage}\r\n" message += "\r\nBacktrace:\r\n#{btrace}" diff --git a/Data/Scripts/004_Sprites/009_Sprite_DynamicShadows.rb b/Data/Scripts/004_Sprites/009_Sprite_DynamicShadows.rb index de02b9cd7..3c180124c 100644 --- a/Data/Scripts/004_Sprites/009_Sprite_DynamicShadows.rb +++ b/Data/Scripts/004_Sprites/009_Sprite_DynamicShadows.rb @@ -4,8 +4,6 @@ # features Boushy # Modified by Peter O. to be compatible with Pokémon Essentials #=============================================================================== -SHADOW_WARN = true - class Sprite_Shadow < RPG::Sprite attr_accessor :character @@ -193,7 +191,7 @@ class Spriteset_Map params = XPML_read(map,"Shadow Source", ev, 4) @shadows.push([ev] + params) if params != nil end - if warn == true and SHADOW_WARN + if warn == true p "Warning : At least one event on this map uses the obsolete way to add shadows" end shadow_initialize(map) diff --git a/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb b/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb index cdcb2c127..bcf238c90 100644 --- a/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb +++ b/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb @@ -30,7 +30,7 @@ class AnimatedBitmap if file==nil raise "Filename is nil (missing graphic)." end - if file.split(/[\\\/]/)[-1][/^\[\d+(?:,\d+)?]/] # Starts with 1 or more digits in square brackets + if file.split(/[\\\/]/)[-1][/^\[\d+(?:,\d+)?\]/] # Starts with 1 or 2 numbers in square brackets @bitmap = PngAnimatedBitmap.new(file,hue) else @bitmap = GifBitmap.new(file,hue) @@ -62,7 +62,7 @@ class PngAnimatedBitmap @currentFrame=0 @framecount=0 panorama=BitmapCache.load_bitmap(file,hue) - if file.split(/[\\\/]/)[-1][/^\[(\d+)(?:,(\d+))?]/] # Starts with 1 or more digits in brackets + if file.split(/[\\\/]/)[-1][/^\[(\d+)(?:,(\d+))?\]/] # Starts with 1 or 2 numbers in brackets # File has a frame count numFrames = $1.to_i delay = $2.to_i diff --git a/Data/Scripts/011_Data/001_Game data/003_Item.rb b/Data/Scripts/011_Data/001_Game data/003_Item.rb index 31f39ec42..1d5fd90c7 100644 --- a/Data/Scripts/011_Data/001_Game data/003_Item.rb +++ b/Data/Scripts/011_Data/001_Game data/003_Item.rb @@ -165,121 +165,145 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbGetPocket(item) Deprecation.warn_method('pbGetPocket', 'v20', 'GameData::Item.get(item).pocket') return GameData::Item.get(item).pocket end +# @deprecated This alias is slated to be removed in v20. def pbGetPrice(item) Deprecation.warn_method('pbGetPrice', 'v20', 'GameData::Item.get(item).price') return GameData::Item.get(item).price end +# @deprecated This alias is slated to be removed in v20. def pbGetMachine(item) Deprecation.warn_method('pbGetMachine', 'v20', 'GameData::Item.get(item).move') return GameData::Item.get(item).move end +# @deprecated This alias is slated to be removed in v20. def pbIsTechnicalMachine?(item) Deprecation.warn_method('pbIsTechnicalMachine?', 'v20', 'GameData::Item.get(item).is_TM?') return GameData::Item.get(item).is_TM? end +# @deprecated This alias is slated to be removed in v20. def pbIsHiddenMachine?(item) Deprecation.warn_method('pbIsHiddenMachine?', 'v20', 'GameData::Item.get(item).is_HM?') return GameData::Item.get(item).is_HM? end +# @deprecated This alias is slated to be removed in v20. def pbIsMachine?(item) Deprecation.warn_method('pbIsMachine?', 'v20', 'GameData::Item.get(item).is_machine?') return GameData::Item.get(item).is_machine? end +# @deprecated This alias is slated to be removed in v20. def pbIsMail?(item) Deprecation.warn_method('pbIsMail?', 'v20', 'GameData::Item.get(item).is_mail?') return GameData::Item.get(item).is_mail? end +# @deprecated This alias is slated to be removed in v20. def pbIsMailWithPokemonIcons?(item) Deprecation.warn_method('pbIsMailWithPokemonIcons?', 'v20', 'GameData::Item.get(item).is_icon_mail?') return GameData::Item.get(item).is_icon_mail? end +# @deprecated This alias is slated to be removed in v20. def pbIsPokeBall?(item) Deprecation.warn_method('pbIsPokeBall?', 'v20', 'GameData::Item.get(item).is_poke_ball?') return GameData::Item.get(item).is_poke_ball? end +# @deprecated This alias is slated to be removed in v20. def pbIsSnagBall?(item) Deprecation.warn_method('pbIsSnagBall?', 'v20', 'GameData::Item.get(item).is_snag_ball?') return GameData::Item.get(item).is_snag_ball? end +# @deprecated This alias is slated to be removed in v20. def pbIsBerry?(item) Deprecation.warn_method('pbIsBerry?', 'v20', 'GameData::Item.get(item).is_berry?') return GameData::Item.get(item).is_berry? end +# @deprecated This alias is slated to be removed in v20. def pbIsKeyItem?(item) Deprecation.warn_method('pbIsKeyItem?', 'v20', 'GameData::Item.get(item).is_key_item?') return GameData::Item.get(item).is_key_item? end +# @deprecated This alias is slated to be removed in v20. def pbIsEvolutionStone?(item) Deprecation.warn_method('pbIsEvolutionStone?', 'v20', 'GameData::Item.get(item).is_evolution_stone?') return GameData::Item.get(item).is_evolution_stone? end +# @deprecated This alias is slated to be removed in v20. def pbIsFossil?(item) Deprecation.warn_method('pbIsFossil?', 'v20', 'GameData::Item.get(item).is_fossil?') return GameData::Item.get(item).is_fossil? end +# @deprecated This alias is slated to be removed in v20. def pbIsApricorn?(item) Deprecation.warn_method('pbIsApricorn?', 'v20', 'GameData::Item.get(item).is_apricorn?') return GameData::Item.get(item).is_apricorn? end +# @deprecated This alias is slated to be removed in v20. def pbIsGem?(item) Deprecation.warn_method('pbIsGem?', 'v20', 'GameData::Item.get(item).is_gem?') return GameData::Item.get(item).is_gem? end +# @deprecated This alias is slated to be removed in v20. def pbIsMulch?(item) Deprecation.warn_method('pbIsMulch?', 'v20', 'GameData::Item.get(item).is_mulch?') return GameData::Item.get(item).is_mulch? end +# @deprecated This alias is slated to be removed in v20. def pbIsMegaStone?(item) Deprecation.warn_method('pbIsMegaStone?', 'v20', 'GameData::Item.get(item).is_mega_stone?') return GameData::Item.get(item).is_mega_stone? end +# @deprecated This alias is slated to be removed in v20. def pbIsImportantItem?(item) Deprecation.warn_method('pbIsImportantItem?', 'v20', 'GameData::Item.get(item).is_important?') return GameData::Item.get(item).is_important? end +# @deprecated This alias is slated to be removed in v20. def pbCanHoldItem?(item) Deprecation.warn_method('pbCanHoldItem?', 'v20', 'GameData::Item.get(item).can_hold?') return GameData::Item.get(item).can_hold? end +# @deprecated This alias is slated to be removed in v20. def pbIsUnlosableItem?(check_item, species, ability) Deprecation.warn_method('pbIsUnlosableItem?', 'v20', 'GameData::Item.get(item).unlosable?') return GameData::Item.get(check_item).unlosable?(species, ability) end +# @deprecated This alias is slated to be removed in v20. def pbItemIconFile(item) Deprecation.warn_method('pbItemIconFile', 'v20', 'GameData::Item.icon_filename(item)') return GameData::Item.icon_filename(item) end +# @deprecated This alias is slated to be removed in v20. def pbHeldItemIconFile(item) Deprecation.warn_method('pbHeldItemIconFile', 'v20', 'GameData::Item.held_icon_filename(item)') return GameData::Item.held_icon_filename(item) end +# @deprecated This alias is slated to be removed in v20. def pbMailBackFile(item) Deprecation.warn_method('pbMailBackFile', 'v20', 'GameData::Item.mail_filename(item)') return GameData::Item.mail_filename(item) diff --git a/Data/Scripts/011_Data/001_Game data/004_Berry plant.rb b/Data/Scripts/011_Data/001_Game data/004_Berry plant.rb index 322da1066..ad47a4e75 100644 --- a/Data/Scripts/011_Data/001_Game data/004_Berry plant.rb +++ b/Data/Scripts/011_Data/001_Game data/004_Berry plant.rb @@ -29,6 +29,7 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbGetBerryPlantData(item) Deprecation.warn_method('pbGetBerryPlantData', 'v20', 'GameData::BerryPlant.get(item)') return GameData::BerryPlant.get(item) diff --git a/Data/Scripts/011_Data/001_Game data/005_Metadata.rb b/Data/Scripts/011_Data/001_Game data/005_Metadata.rb index bf51c3bbc..51e7a3962 100644 --- a/Data/Scripts/011_Data/001_Game data/005_Metadata.rb +++ b/Data/Scripts/011_Data/001_Game data/005_Metadata.rb @@ -129,11 +129,13 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbLoadMetadata Deprecation.warn_method('pbLoadMetadata', 'v20', 'GameData::Metadata.get or GameData::MapMetadata.get(map_id)') return nil end +# @deprecated This alias is slated to be removed in v20. def pbGetMetadata(map_id, metadata_type) if map_id == 0 # Global metadata Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::Metadata.get.something') diff --git a/Data/Scripts/011_Data/001_Game data/007_Move.rb b/Data/Scripts/011_Data/001_Game data/007_Move.rb index 9945e293c..eeff3c73f 100644 --- a/Data/Scripts/011_Data/001_Game data/007_Move.rb +++ b/Data/Scripts/011_Data/001_Game data/007_Move.rb @@ -72,11 +72,13 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbGetMoveData(move_id, move_data_type = -1) Deprecation.warn_method('pbGetMoveData', 'v20', 'GameData::Move.get(move_id)') return GameData::Move.get(move_id) end +# @deprecated This alias is slated to be removed in v20. def pbIsHiddenMove?(move) Deprecation.warn_method('pbIsHiddenMove?', 'v20', 'GameData::Move.get(move).hidden_move?') return GameData::Move.get(move).hidden_move? diff --git a/Data/Scripts/011_Data/001_Game data/008_Trainer type.rb b/Data/Scripts/011_Data/001_Game data/008_Trainer type.rb index b74b2293a..3a825d07c 100644 --- a/Data/Scripts/011_Data/001_Game data/008_Trainer type.rb +++ b/Data/Scripts/011_Data/001_Game data/008_Trainer type.rb @@ -96,46 +96,55 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbGetTrainerTypeData(tr_type) Deprecation.warn_method('pbGetTrainerTypeData', 'v20', 'GameData::TrainerType.get(trainer_type)') return GameData::TrainerType.get(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbTrainerCharFile(tr_type) # Used by the phone Deprecation.warn_method('pbTrainerCharFile', 'v20', 'GameData::TrainerType.charset_filename(trainer_type)') return GameData::TrainerType.charset_filename(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbTrainerCharNameFile(tr_type) # Used by Battle Frontier and compiler Deprecation.warn_method('pbTrainerCharNameFile', 'v20', 'GameData::TrainerType.charset_filename_brief(trainer_type)') return GameData::TrainerType.charset_filename_brief(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbTrainerSpriteFile(tr_type) Deprecation.warn_method('pbTrainerSpriteFile', 'v20', 'GameData::TrainerType.front_sprite_filename(trainer_type)') return GameData::TrainerType.front_sprite_filename(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbTrainerSpriteBackFile(tr_type) Deprecation.warn_method('pbTrainerSpriteBackFile', 'v20', 'GameData::TrainerType.back_sprite_filename(trainer_type)') return GameData::TrainerType.back_sprite_filename(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbPlayerSpriteFile(tr_type) Deprecation.warn_method('pbPlayerSpriteFile', 'v20', 'GameData::TrainerType.player_front_sprite_filename(trainer_type)') return GameData::TrainerType.player_front_sprite_filename(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbPlayerSpriteBackFile(tr_type) Deprecation.warn_method('pbPlayerSpriteBackFile', 'v20', 'GameData::TrainerType.player_back_sprite_filename(trainer_type)') return GameData::TrainerType.player_back_sprite_filename(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbTrainerHeadFile(tr_type) Deprecation.warn_method('pbTrainerHeadFile', 'v20', 'GameData::TrainerType.map_icon_filename(trainer_type)') return GameData::TrainerType.map_icon_filename(tr_type) end +# @deprecated This alias is slated to be removed in v20. def pbPlayerHeadFile(tr_type) Deprecation.warn_method('pbPlayerHeadFile', 'v20', 'GameData::TrainerType.player_map_icon_filename(trainer_type)') return GameData::TrainerType.player_map_icon_filename(tr_type) diff --git a/Data/Scripts/011_Data/001_Game data/010_Species.rb b/Data/Scripts/011_Data/001_Game data/010_Species.rb index d185ca34e..c519d51d1 100644 --- a/Data/Scripts/011_Data/001_Game data/010_Species.rb +++ b/Data/Scripts/011_Data/001_Game data/010_Species.rb @@ -223,31 +223,37 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbGetSpeciesData(species, form = 0, species_data_type = -1) Deprecation.warn_method('pbGetSpeciesData', 'v20', 'GameData::Species.get_species_form(species, form).something') return GameData::Species.get_species_form(species, form) end +# @deprecated This alias is slated to be removed in v20. def pbGetSpeciesEggMoves(species, form = 0) Deprecation.warn_method('pbGetSpeciesEggMoves', 'v20', 'GameData::Species.get_species_form(species, form).egg_moves') return GameData::Species.get_species_form(species, form).egg_moves end +# @deprecated This alias is slated to be removed in v20. def pbGetSpeciesMoveset(species, form = 0) Deprecation.warn_method('pbGetSpeciesMoveset', 'v20', 'GameData::Species.get_species_form(species, form).moves') return GameData::Species.get_species_form(species, form).moves end +# @deprecated This alias is slated to be removed in v20. def pbGetEvolutionData(species) Deprecation.warn_method('pbGetEvolutionData', 'v20', 'GameData::Species.get(species).evolutions') return GameData::Species.get(species).evolutions end +# @deprecated This alias is slated to be removed in v20. def pbApplyBattlerMetricsToSprite(sprite, index, species_data, shadow = false, metrics = nil) Deprecation.warn_method('pbApplyBattlerMetricsToSprite', 'v20', 'GameData::Species.get(species).apply_metrics_to_sprite') GameData::Species.get(species).apply_metrics_to_sprite(sprite, index, shadow) end +# @deprecated This alias is slated to be removed in v20. def showShadow?(species) Deprecation.warn_method('showShadow?', 'v20', 'GameData::Species.get(species).shows_shadow?') return GameData::Species.get(species).shows_shadow? diff --git a/Data/Scripts/011_Data/001_Game data/011_Species files.rb b/Data/Scripts/011_Data/001_Game data/011_Species files.rb index c505d64a7..ffddb21bb 100644 --- a/Data/Scripts/011_Data/001_Game data/011_Species files.rb +++ b/Data/Scripts/011_Data/001_Game data/011_Species files.rb @@ -261,46 +261,55 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbLoadSpeciesBitmap(species, gender = 0, form = 0, shiny = false, shadow = false, back = false , egg = false) Deprecation.warn_method('pbLoadSpeciesBitmap', 'v20', 'GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg)') return GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg) end +# @deprecated This alias is slated to be removed in v20. def pbLoadPokemonBitmap(pkmn, back = false) Deprecation.warn_method('pbLoadPokemonBitmap', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn)') return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back) end +# @deprecated This alias is slated to be removed in v20. def pbLoadPokemonBitmapSpecies(pkmn, species, back = false) Deprecation.warn_method('pbLoadPokemonBitmapSpecies', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species)') return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species) end +# @deprecated This alias is slated to be removed in v20. def pbPokemonIconFile(pkmn) Deprecation.warn_method('pbPokemonIconFile', 'v20', 'GameData::Species.icon_filename_from_pokemon(pkmn)') return GameData::Species.icon_filename_from_pokemon(pkmn) end +# @deprecated This alias is slated to be removed in v20. def pbLoadPokemonIcon(pkmn) Deprecation.warn_method('pbLoadPokemonIcon', 'v20', 'GameData::Species.icon_bitmap_from_pokemon(pkmn)') return GameData::Species.icon_bitmap_from_pokemon(pkmn) end +# @deprecated This alias is slated to be removed in v20. def pbPokemonFootprintFile(species, form = 0) Deprecation.warn_method('pbPokemonFootprintFile', 'v20', 'GameData::Species.footprint_filename(species, form)') return GameData::Species.footprint_filename(species, form) end +# @deprecated This alias is slated to be removed in v20. def pbCheckPokemonShadowBitmapFiles(species, form = 0) Deprecation.warn_method('pbCheckPokemonShadowBitmapFiles', 'v20', 'GameData::Species.shadow_filename(species, form)') return GameData::Species.shadow_filename(species, form) end +# @deprecated This alias is slated to be removed in v20. def pbLoadPokemonShadowBitmap(pkmn) Deprecation.warn_method('pbLoadPokemonShadowBitmap', 'v20', 'GameData::Species.shadow_bitmap_from_pokemon(pkmn)') return GameData::Species.shadow_bitmap_from_pokemon(pkmn) end +# @deprecated This alias is slated to be removed in v20. def pbCryFile(species, form = 0) if species.is_a?(Pokemon) Deprecation.warn_method('pbCryFile', 'v20', 'GameData::Species.cry_filename_from_pokemon(pkmn)') @@ -310,21 +319,25 @@ def pbCryFile(species, form = 0) return GameData::Species.cry_filename(species, form) end +# @deprecated This alias is slated to be removed in v20. def pbPlayCry(pkmn, volume = 90, pitch = nil) Deprecation.warn_method('pbPlayCry', 'v20', 'GameData::Species.play_cry(pkmn)') GameData::Species.play_cry(pkmn, volume, pitch) end +# @deprecated This alias is slated to be removed in v20. def pbPlayCrySpecies(species, form = 0, volume = 90, pitch = nil) Deprecation.warn_method('pbPlayCrySpecies', 'v20', 'GameData::Species.play_cry_from_species(species, form)') GameData::Species.play_cry_from_species(species, form, volume, pitch) end +# @deprecated This alias is slated to be removed in v20. def pbPlayCryPokemon(pkmn, volume = 90, pitch = nil) Deprecation.warn_method('pbPlayCryPokemon', 'v20', 'GameData::Species.play_cry_from_pokemon(pkmn)') GameData::Species.play_cry_from_pokemon(pkmn, volume, pitch) end +# @deprecated This alias is slated to be removed in v20. def pbCryFrameLength(species, form = 0, pitch = 100) Deprecation.warn_method('pbCryFrameLength', 'v20', 'GameData::Species.cry_length(species, form)') return GameData::Species.cry_length(species, form, pitch) diff --git a/Data/Scripts/011_Data/001_Game data/012_Trainer.rb b/Data/Scripts/011_Data/001_Game data/012_Trainer.rb index cdbb443ff..d3f0e2786 100644 --- a/Data/Scripts/011_Data/001_Game data/012_Trainer.rb +++ b/Data/Scripts/011_Data/001_Game data/012_Trainer.rb @@ -37,7 +37,7 @@ module GameData # @param tr_type [Symbol, String] # @param tr_name [String] - # @param tr_version [Integer] + # @param tr_version [Integer, nil] # @return [Boolean] whether the given other is defined as a self def self.exists?(tr_type, tr_name, tr_version = 0) validate tr_type => [Symbol, String] @@ -48,7 +48,7 @@ module GameData # @param tr_type [Symbol, String] # @param tr_name [String] - # @param tr_version [Integer] + # @param tr_version [Integer, nil] # @return [self] def self.get(tr_type, tr_name, tr_version = 0) validate tr_type => [Symbol, String] @@ -58,7 +58,9 @@ module GameData return self::DATA[key] end - # @param other [Symbol, self, String, Integer] + # @param tr_type [Symbol, String] + # @param tr_name [String] + # @param tr_version [Integer, nil] # @return [self, nil] def try_get(tr_type, tr_name, tr_version = 0) validate tr_type => [Symbol, String] @@ -166,6 +168,7 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbGetTrainerData(tr_type, tr_name, tr_version = 0) Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)') return GameData::Trainer.get(tr_type, tr_name, tr_version) diff --git a/Data/Scripts/011_Data/001_Game data/013_Encounter.rb b/Data/Scripts/011_Data/001_Game data/013_Encounter.rb index d018ed8dd..de2df8931 100644 --- a/Data/Scripts/011_Data/001_Game data/013_Encounter.rb +++ b/Data/Scripts/011_Data/001_Game data/013_Encounter.rb @@ -15,7 +15,7 @@ module GameData include InstanceMethods # @param map_id [Integer] - # @param map_version [Integer] + # @param map_version [Integer, nil] # @return [Boolean] whether there is encounter data for the given map ID/version def self.exists?(map_id, map_version = 0) validate map_id => [Integer] @@ -25,7 +25,7 @@ module GameData end # @param map_id [Integer] - # @param version [Integer] + # @param map_version [Integer, nil] # @return [self, nil] def self.get(map_id, map_version = 0) validate map_id => Integer @@ -72,6 +72,7 @@ end #=============================================================================== # Deprecated methods #=============================================================================== +# @deprecated This alias is slated to be removed in v20. def pbLoadEncountersData Deprecation.warn_method('pbLoadEncountersData', 'v20', 'GameData::Encounter.get(map_id, version)') return nil diff --git a/Data/Scripts/011_Data/Hardcoded game data/001_PBExperience.rb b/Data/Scripts/011_Data/Hardcoded game data/001_PBExperience.rb index 336fdaebf..a1b049c8a 100644 --- a/Data/Scripts/011_Data/Hardcoded game data/001_PBExperience.rb +++ b/Data/Scripts/011_Data/Hardcoded game data/001_PBExperience.rb @@ -96,16 +96,18 @@ module PBExperience end # Erratic (600000): - # For levels 0-50: n**3([100-n]/50) - # For levels 51-68: n**3([150-n]/100) - # For levels 69-98: n**3(1.274-[1/50][n/3]-p(n mod 3)) - # where p(x) = array(0.000,0.008,0.014)[x] - # For levels 99-100: n**3([160-n]/100) + # For levels 0-50: n**3 * (100 - n) / 50 + # For levels 51-68: n**3 * (150 - n) / 100 + # For levels 69-98: n**3 * 1.274 - (n / 150) - p(n mod 3) + # where p(x) = array(0.000, 0.008, 0.014)[x] + # For levels 99-100: n**3 * (160 - n) / 100 # Fluctuating (1640000): - # For levels 0-15 : n**3([24+{(n+1)/3}]/50) - # For levels 16-35: n**3([14+n]/50) - # For levels 36-100: n**3([32+{n/2}]/50) + # For levels 0-15 : n**3 * (24 + ((n + 1) / 3)) / 50 + # For levels 16-35: n**3 * (14 + n) / 50 + # For levels 36-100: n**3 * (32 + (n / 2)) / 50 + # @param level [Integer] + # @param growth [Integer] growth rate def self.pbGetExpInternal(level,growth) if level <= 100 # Refer to experience table for levels 100 and less @@ -138,7 +140,7 @@ module PBExperience end # Gets the maximum Exp Points possible for the given growth rate. - # growth -- Growth rate. + # @param growth [Integer] growth rate def self.pbGetMaxExperience(growth) if growth<0 || growth>PBGrowthRates.maxValue return ArgumentError.new("The growth rate is invalid.") @@ -148,7 +150,8 @@ module PBExperience # Gets the number of Exp Points needed to reach the given # level with the given growth rate. - # growth -- Growth rate. + # @param level [Integer] + # @param growth [Integer] growth rate def self.pbGetStartExperience(level,growth) if growth<0 || growth>PBGrowthRates.maxValue return ArgumentError.new("The growth rate is invalid.") @@ -163,9 +166,9 @@ module PBExperience # Adds experience points ensuring that the new total doesn't # exceed the maximum Exp. Points for the given growth rate. - # currexp -- Current Exp Points. - # expgain -- Exp. Points to add - # growth -- Growth rate. + # @param currexp [Integer] current Exp. points + # @param expgain [Integer] Exp. points to add + # @param growth [Integer] growth rate def self.pbAddExperience(currexp,expgain,growth) if growth<0 || growth>PBGrowthRates.maxValue return ArgumentError.new("The growth rate is invalid.") @@ -177,7 +180,7 @@ module PBExperience end # Calculates a level given the number of Exp Points and growth rate. - # growth -- Growth rate. + # @param growth [Integer] growth rate def self.pbGetLevelFromExperience(exp,growth) if growth<0 || growth>PBGrowthRates.maxValue return ArgumentError.new("The growth rate is invalid.") diff --git a/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb b/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb index 2482309aa..28e486ff3 100644 --- a/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb +++ b/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb @@ -553,8 +553,8 @@ class PokemonBattlerSprite < RPG::Sprite # This method plays the battle entrance animation of a Pokémon. By default # this is just playing the Pokémon's cry, but you can expand on it. The - # recommendation is to create a PictureEx animation and push it into the - # @battleAnimations array. + # recommendation is to create a PictureEx animation and push it into + # the @battleAnimations array. def pbPlayIntroAnimation(pictureEx=nil) return if !@pkmn GameData::Species.play_cry_from_pokemon(@pkmn) diff --git a/Data/Scripts/013_Overworld/006_PField_Battles.rb b/Data/Scripts/013_Overworld/006_PField_Battles.rb index c210240ce..efb7f88e5 100644 --- a/Data/Scripts/013_Overworld/006_PField_Battles.rb +++ b/Data/Scripts/013_Overworld/006_PField_Battles.rb @@ -605,7 +605,7 @@ def pbEvolutionCheck(currentLevels) pkmn = $Trainer.party[i] next if !pkmn || (pkmn.hp==0 && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON) next if currentLevels[i] && pkmn.level==currentLevels[i] - newSpecies = pbCheckEvolution(pkmn) + newSpecies = EvolutionCheck.check(pkmn) next if !newSpecies evo = PokemonEvolutionScene.new evo.pbStartScreen(pkmn,newSpecies) diff --git a/Data/Scripts/013_Overworld/015_PField_Time.rb b/Data/Scripts/013_Overworld/015_PField_Time.rb index d91abb7cf..665954855 100644 --- a/Data/Scripts/013_Overworld/015_PField_Time.rb +++ b/Data/Scripts/013_Overworld/015_PField_Time.rb @@ -38,45 +38,45 @@ module PBDayNight @dayNightToneLastUpdate = nil @oneOverSixty = 1/60.0 -# Returns true if it's day. + # Returns true if it's day. def self.isDay?(time=nil) time = pbGetTimeNow if !time return (time.hour>=5 && time.hour<20) end -# Returns true if it's night. + # Returns true if it's night. def self.isNight?(time=nil) time = pbGetTimeNow if !time return (time.hour>=20 || time.hour<5) end -# Returns true if it's morning. + # Returns true if it's morning. def self.isMorning?(time=nil) time = pbGetTimeNow if !time return (time.hour>=5 && time.hour<10) end -# Returns true if it's the afternoon. + # Returns true if it's the afternoon. def self.isAfternoon?(time=nil) time = pbGetTimeNow if !time return (time.hour>=14 && time.hour<17) end -# Returns true if it's the evening. + # Returns true if it's the evening. def self.isEvening?(time=nil) time = pbGetTimeNow if !time return (time.hour>=17 && time.hour<20) end -# Gets a number representing the amount of daylight (0=full night, 255=full day). + # Gets a number representing the amount of daylight (0=full night, 255=full day). def self.getShade time = pbGetDayNightMinutes time = (24*60)-time if time>(12*60) return 255*time/(12*60) end -# Gets a Tone object representing a suggested shading -# tone for the current time of day. + # Gets a Tone object representing a suggested shading + # tone for the current time of day. def self.getTone @cachedTone = Tone.new(0,0,0) if !@cachedTone return @cachedTone if !Settings::TIME_SHADING @@ -95,8 +95,6 @@ module PBDayNight private -# Internal function - def self.getToneInternal # Calculates the tone for the current frame, used for day/night effects realMinutes = pbGetDayNightMinutes diff --git a/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb b/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb index 8f4f97b12..123d7f14d 100644 --- a/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb +++ b/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb @@ -76,49 +76,49 @@ class PokeBattle_Trainer end end -# @deprecated Use {PlayerTrainer#remove_pokemon_at_index} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#remove_pokemon_at_index} instead. This alias is slated to be removed in v20. def pbRemovePokemonAt(index) Deprecation.warn_method('pbRemovePokemonAt', 'v20', 'PlayerTrainer#remove_pokemon_at_index') return $Trainer.remove_pokemon_at_index(index) end -# @deprecated Use {PlayerTrainer#has_other_able_pokemon?} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#has_other_able_pokemon?} instead. This alias is slated to be removed in v20. def pbCheckAble(index) Deprecation.warn_method('pbCheckAble', 'v20', 'PlayerTrainer#has_other_able_pokemon?') return $Trainer.has_other_able_pokemon?(index) end -# @deprecated Use {PlayerTrainer#all_fainted?} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#all_fainted?} instead. This alias is slated to be removed in v20. def pbAllFainted Deprecation.warn_method('pbAllFainted', 'v20', 'PlayerTrainer#all_fainted?') return $Trainer.all_fainted? end -# @deprecated Use {PlayerTrainer#has_species?} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#has_species?} instead. This alias is slated to be removed in v20. def pbHasSpecies?(species, form = -1) Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_species?') return $Trainer.has_species?(species, form) end -# @deprecated Use {PlayerTrainer#has_fateful_species?} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#has_fateful_species?} instead. This alias is slated to be removed in v20. def pbHasFatefulSpecies?(species) Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_fateful_species?') return $Trainer.has_fateful_species?(species) end -# @deprecated Use {PlayerTrainer#has_pokemon_of_type?} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#has_pokemon_of_type?} instead. This alias is slated to be removed in v20. def pbHasType?(type) Deprecation.warn_method('pbHasType?', 'v20', 'PlayerTrainer#has_pokemon_of_type?') return $Trainer.has_pokemon_of_type?(type) end -# @deprecated Use {PlayerTrainer#get_pokemon_with_move} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#get_pokemon_with_move} instead. This alias is slated to be removed in v20. def pbCheckMove(move) Deprecation.warn_method('pbCheckMove', 'v20', 'PlayerTrainer#get_pokemon_with_move') return $Trainer.get_pokemon_with_move(move) end -# @deprecated Use {PlayerTrainer#heal_party} instead. This alias is slated to be removed in v20. +# @deprecated Use {Trainer#heal_party} instead. This alias is slated to be removed in v20. def pbHealAll Deprecation.warn_method('pbHealAll', 'v20', 'PlayerTrainer#heal_party') $Trainer.heal_party diff --git a/Data/Scripts/015_Items/001_PItem_Items.rb b/Data/Scripts/015_Items/001_PItem_Items.rb index e19d16cfb..a6b21ba86 100644 --- a/Data/Scripts/015_Items/001_PItem_Items.rb +++ b/Data/Scripts/015_Items/001_PItem_Items.rb @@ -177,7 +177,7 @@ def pbChangeLevel(pkmn,newlevel,scene) pbLearnMove(pkmn,i[1],true) { scene.pbUpdate } end # Check for evolution - newspecies = pbCheckEvolution(pkmn) + newspecies = EvolutionCheck.check(pkmn) if newspecies pbFadeOutInWithMusic { evo = PokemonEvolutionScene.new @@ -490,7 +490,7 @@ def pbUseItem(bag,item,bagscene=nil) if itm.is_evolution_stone? annot = [] for pkmn in $Trainer.party - elig = pbCheckEvolution(pkmn,item) + elig = EvolutionCheck.check(pkmn, item) annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE")) end end diff --git a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb index 11280ce9f..cf513c10f 100644 --- a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb +++ b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb @@ -348,7 +348,7 @@ ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_evolu scene.pbDisplay(_INTL("It won't have any effect.")) next false end - newspecies = pbCheckEvolution(pkmn,item) + newspecies = EvolutionCheck.check(pkmn,item) if newspecies pbFadeOutInWithMusic { evo = PokemonEvolutionScene.new @@ -356,7 +356,7 @@ ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_evolu evo.pbEvolution(false) evo.pbEndScreen if scene.is_a?(PokemonPartyScreen) - scene.pbRefreshAnnotations(proc { |p| !pbCheckEvolution(p,item).nil? }) + scene.pbRefreshAnnotations(proc { |p| !EvolutionCheck.check(p, item).nil? }) scene.pbRefresh end } diff --git a/Data/Scripts/016_Pokemon/001_Pokemon-related/005_Pokemon_Evolution.rb b/Data/Scripts/016_Pokemon/001_Pokemon-related/005_Pokemon_Evolution.rb index 0705faa18..570b0e171 100644 --- a/Data/Scripts/016_Pokemon/001_Pokemon-related/005_Pokemon_Evolution.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon-related/005_Pokemon_Evolution.rb @@ -194,6 +194,8 @@ module EvolutionHelper return false end + # Used by the Moon Ball when checking if a Pokémon's evolution family includes + # an evolution that uses the Moon Stone. def check_family_for_method_item(species, param = nil) species = self.baby_species(species) evos = self.family_evolutions(species) @@ -209,38 +211,43 @@ end +# @deprecated Use {EvolutionHelper#evolutions} instead. This alias is slated to be removed in v20. def pbGetEvolvedFormData(species, ignore_none = false) Deprecation.warn_method('pbGetEvolvedFormData', 'v20', 'EvolutionHelper.evolutions(species)') return EvolutionHelper.evolutions(species, ignore_none) end +# @deprecated Use {EvolutionHelper#family_evolutions} instead. This alias is slated to be removed in v20. def pbGetEvolutionFamilyData(species) # Unused Deprecation.warn_method('pbGetEvolutionFamilyData', 'v20', 'EvolutionHelper.family_evolutions(species)') return EvolutionHelper.family_evolutions(species, ignore_none) end +# @deprecated Use {EvolutionHelper#previous_species} instead. This alias is slated to be removed in v20. def pbGetPreviousForm(species) # Unused Deprecation.warn_method('pbGetPreviousForm', 'v20', 'EvolutionHelper.previous_species(species)') return EvolutionHelper.previous_species(species) end +# @deprecated Use {EvolutionHelper#baby_species} instead. This alias is slated to be removed in v20. def pbGetBabySpecies(species, check_items = false, item1 = nil, item2 = nil) Deprecation.warn_method('pbGetBabySpecies', 'v20', 'EvolutionHelper.baby_species(species)') return EvolutionHelper.baby_species(species, check_items, item1, item2) end +# @deprecated Use {EvolutionHelper#minimum_level} instead. This alias is slated to be removed in v20. def pbGetMinimumLevel(species) Deprecation.warn_method('pbGetMinimumLevel', 'v20', 'EvolutionHelper.minimum_level(species)') return EvolutionHelper.minimum_level(species) end +# @deprecated Use {EvolutionHelper#check_family_for_method} instead. This alias is slated to be removed in v20. def pbCheckEvolutionFamilyForMethod(species, method, param = nil) Deprecation.warn_method('pbCheckEvolutionFamilyForMethod', 'v20', 'EvolutionHelper.check_family_for_method(species, method)') return EvolutionHelper.check_family_for_method(species, method, param) end -# Used by the Moon Ball when checking if a Pokémon's evolution family includes -# an evolution that uses the Moon Stone. +# @deprecated Use {EvolutionHelper#check_family_for_method_item} instead. This alias is slated to be removed in v20. def pbCheckEvolutionFamilyForItemMethodItem(species, param = nil) Deprecation.warn_method('pbCheckEvolutionFamilyForItemMethodItem', 'v20', 'EvolutionHelper.check_family_for_method_item(species, item)') return EvolutionHelper.check_family_for_method_item(species, param) @@ -249,44 +256,62 @@ end #=============================================================================== # Evolution checks #=============================================================================== -def pbMiniCheckEvolution(pkmn, method, parameter, new_species) - success = PBEvolution.call("levelUpCheck", method, pkmn, parameter) - return (success) ? new_species : nil -end - -def pbMiniCheckEvolutionItem(pkmn, method, parameter, new_species, item) - success = PBEvolution.call("itemCheck", method, pkmn, parameter, item) - return (success) ? new_species : nil -end - -# Checks whether a Pokemon can evolve now. If a block is given, calls the block -# with the following parameters: -# Pokemon to check; evolution method; parameter; ID of the new species -def pbCheckEvolutionEx(pkmn) - return nil if !pkmn.species || pokemon.egg? || pokemon.shadowPokemon? - return nil if pkmn.hasItem?(:EVERSTONE) - return nil if pkmn.hasAbility?(:BATTLEBOND) - ret = nil - pkmn.species_data.evolutions.each do |evo| - next if evo[3] # Prevolution - ret = yield pkmn, evo[1], evo[2], evo[0] # pkmn, method, parameter, new_species - break if ret +module EvolutionCheck + # The core method that performs evolution checks. Needs a block given to it, + # which will provide either a GameData::Species ID (the species to evolve + # into) or nil (keep checking). + # @param pkmn [Pokemon] the Pokémon trying to evolve + def self.check_ex(pkmn) + return nil if !pkmn.species || pokemon.egg? || pokemon.shadowPokemon? + return nil if pkmn.hasItem?(:EVERSTONE) + return nil if pkmn.hasAbility?(:BATTLEBOND) + ret = nil + pkmn.species_data.evolutions.each do |evo| # [new_species, method, parameter, boolean] + next if evo[3] # Prevolution + ret = yield pkmn, evo[1], evo[2], evo[0] # pkmn, method, parameter, new_species + break if ret + end + return ret end - return ret -end -# Checks whether a Pokemon can evolve now. If an item is used on the Pokémon, -# checks whether the Pokemon can evolve with the given item. -def pbCheckEvolution(pkmn, item = nil) - if item - return pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species| - next pbMiniCheckEvolutionItem(pkmn, method, parameter, new_species, item) + # Checks whether a Pokemon can evolve because of levelling up. If the item + # parameter is not nil, instead checks whether a Pokémon can evolve because of + # using the item on it. + # @param pkmn [Pokemon] the Pokémon trying to evolve + # @param item [Symbol, GameData::Item, nil] the item being used + def self.check(pkmn, item = nil) + if item + return self.check_ex(pkmn) { |pkmn, method, parameter, new_species| + success = PBEvolution.call("itemCheck", method, pkmn, parameter, item) + return (success) ? new_species : nil + } + end + return self.check_ex(pkmn) { |pkmn, method, parameter, new_species| + success = PBEvolution.call("levelUpCheck", method, pkmn, parameter) + next (success) ? new_species : nil } - else - return pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species| - next pbMiniCheckEvolution(pkmn, method, parameter, new_species) + end + + # Checks whether a Pokemon can evolve because of being traded. + # @param pkmn [Pokemon] the Pokémon trying to evolve + # @param other_pkmn [Pokemon] the other Pokémon involved in the trade + def self.check_trade_methods(pkmn, other_pkmn) + return self.check_ex(pkmn) { |pkmn, method, parameter, new_species| + success = PBEvolution.call("tradeCheck", method, pkmn, parameter, other_pkmn) + next (success) ? new_species : nil } end + + # Called after a Pokémon evolves, to remove its held item (if the evolution + # required it to have a held item) or duplicate the Pokémon (Shedinja only). + # @param pkmn [Pokemon] the Pokémon trying to evolve + # @param evolved_species [Pokemon] the species that the Pokémon evolved into + def self.check_after_evolution(pkmn, evolved_species) + pkmn.species_data.evolutions.each do |evo| # [new_species, method, parameter, boolean] + next if evo[3] # Prevolution + break if PBEvolution.call("afterEvolution", evo[1], pkmn, evo[0], evo[2], evolved_species) + end + end end #=============================================================================== @@ -705,7 +730,7 @@ PBEvolution.register(:ItemNight, { PBEvolution.register(:ItemHappiness, { "parameterType" => :Item, - "levelUpCheck" => proc { |pkmn, parameter, item| + "itemCheck" => proc { |pkmn, parameter, item| next item == parameter && pkmn.happiness >= 220 } }) diff --git a/Data/Scripts/016_Pokemon/001_Pokemon.rb b/Data/Scripts/016_Pokemon/001_Pokemon.rb index 8fc773fd3..2f0b2dd22 100644 --- a/Data/Scripts/016_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon.rb @@ -479,7 +479,7 @@ class Pokemon # Returns whether this Pokémon has a particular nature. If no value is given, # returns whether this Pokémon has a nature set. - # @param nature [Integer] nature ID to check + # @param check_nature [Integer] nature ID to check # @return [Boolean] whether this Pokémon has a particular nature or a nature # at all def hasNature?(check_nature = nil) diff --git a/Data/Scripts/016_Pokemon/006_Pokemon_Owner.rb b/Data/Scripts/016_Pokemon/006_Pokemon_Owner.rb index ff65698fe..b2679532f 100644 --- a/Data/Scripts/016_Pokemon/006_Pokemon_Owner.rb +++ b/Data/Scripts/016_Pokemon/006_Pokemon_Owner.rb @@ -9,13 +9,13 @@ class Pokemon attr_reader :name # @return [Integer] the gender of the owner (0 = male, 1 = female, 2 = unknown) attr_reader :gender - # @return [Integer] the language of the owner (see {pbGetLanguage} for language IDs) + # @return [Integer] the language of the owner (see pbGetLanguage for language IDs) attr_reader :language # @param id [Integer] the ID of the owner # @param name [String] the name of the owner # @param gender [Integer] the gender of the owner (0 = male, 1 = female, 2 = unknown) - # @param language [Integer] the language of the owner (see {pbGetLanguage} for language IDs) + # @param language [Integer] the language of the owner (see pbGetLanguage for language IDs) def initialize(id, name, gender, language) validate id => Integer, name => String, gender => Integer, language => Integer @id = id diff --git a/Data/Scripts/017_UI/014_PScreen_Save.rb b/Data/Scripts/017_UI/014_PScreen_Save.rb index 6eda9dbb4..bf5727ccc 100644 --- a/Data/Scripts/017_UI/014_PScreen_Save.rb +++ b/Data/Scripts/017_UI/014_PScreen_Save.rb @@ -26,7 +26,7 @@ def pbSave(safesave=false) Marshal.dump($PokemonMap,f) Marshal.dump($PokemonBag,f) Marshal.dump($PokemonStorage,f) - Marshal.dump(ESSENTIALS_VERSION,f) + Marshal.dump(Essentials::VERSION, f) } Graphics.frame_reset rescue diff --git a/Data/Scripts/017_UI/021_PScreen_Evolution.rb b/Data/Scripts/017_UI/021_PScreen_Evolution.rb index 607e8a583..17dd6321e 100644 --- a/Data/Scripts/017_UI/021_PScreen_Evolution.rb +++ b/Data/Scripts/017_UI/021_PScreen_Evolution.rb @@ -600,10 +600,7 @@ class PokemonEvolutionScene end def pbEvolutionMethodAfterEvolution - pbCheckEvolutionEx(@pokemon) { |pkmn, method, parameter, new_species| - success = PBEvolution.call("afterEvolution", method, pkmn, new_species, parameter, @newspecies) - next (success) ? 1 : -1 - } + EvolutionCheck.check_after_evolution(@pokemon, @newspecies) end def self.pbDuplicatePokemon(pkmn, new_species) diff --git a/Data/Scripts/017_UI/022_PScreen_Trading.rb b/Data/Scripts/017_UI/022_PScreen_Trading.rb index fe898d35b..6c71307d3 100644 --- a/Data/Scripts/017_UI/022_PScreen_Trading.rb +++ b/Data/Scripts/017_UI/022_PScreen_Trading.rb @@ -173,7 +173,7 @@ class PokemonTrade_Scene pbFadeOutAndHide(@sprites) pbDisposeSpriteHash(@sprites) @viewport.dispose - newspecies = pbTradeCheckEvolution(@pokemon2,@pokemon) + newspecies = EvolutionCheck.check_trade_methods(@pokemon2,@pokemon) if newspecies evo = PokemonEvolutionScene.new evo.pbStartScreen(@pokemon2,newspecies) @@ -239,10 +239,3 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0) } $Trainer.party[pokemonIndex] = yourPokemon end - -def pbTradeCheckEvolution(pkmn, other_pkmn) - return pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species| - success = PBEvolution.call("tradeCheck", method, pkmn, parameter, other_pkmn) - next (success) ? new_species : -1 - } -end diff --git a/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb b/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb index c67980861..13a73ca1a 100644 --- a/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb +++ b/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb @@ -6,8 +6,10 @@ # You should change it to your file's url once you upload it. # NOTE: Essentials cannot handle https addresses. You must use a http address. #=============================================================================== -MYSTERY_GIFT_URL = "http://images1.wikia.nocookie.net/pokemonessentials/images/e/e7/MysteryGift.txt" -# MYSTERY_GIFT_URL = "http://pastebin.com/raw/w6BqqUsm" +module MysteryGift + URL = "http://images1.wikia.nocookie.net/pokemonessentials/images/e/e7/MysteryGift.txt" + # URL = "http://pastebin.com/raw/w6BqqUsm" +end #=============================================================================== # Creating a new Mystery Gift for the Master file, and editing an existing one. @@ -135,7 +137,7 @@ def pbManageMysteryGifts # Download all gifts from online msgwindow=pbCreateMessageWindow pbMessageDisplay(msgwindow,_INTL("Searching for online gifts...\\wtnp[0]")) - online=pbDownloadToString(MYSTERY_GIFT_URL) + online = pbDownloadToString(MysteryGift::URL) pbDisposeMessageWindow(msgwindow) if online=="" pbMessage(_INTL("No online Mystery Gifts found.\\wtnp[20]")) @@ -243,7 +245,7 @@ def pbDownloadMysteryGift(trainer) pbFadeInAndShow(sprites) sprites["msgwindow"]=pbCreateMessageWindow pbMessageDisplay(sprites["msgwindow"],_INTL("Searching for a gift.\nPlease wait...\\wtnp[0]")) - string=pbDownloadToString(MYSTERY_GIFT_URL) + string = pbDownloadToString(MysteryGift::URL) if string=="" pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available.")) else