Refactoring, documenting deprecated methods

This commit is contained in:
Maruno17
2021-02-01 22:53:03 +00:00
parent 1209b804e9
commit 66494b0044
27 changed files with 188 additions and 109 deletions

View File

@@ -38,5 +38,7 @@ end
# Well done for finding this place. # Well done for finding this place.
# DO NOT EDIT THESE # DO NOT EDIT THESE
ESSENTIALS_VERSION = "18.1.dev" module Essentials
ERROR_TEXT = "" VERSION = "18.1.dev"
ERROR_TEXT = ""
end

View File

@@ -31,8 +31,8 @@ def pbPrintException(e)
e.backtrace[0,maxlength].each { |i| btrace += "#{i}\r\n" } e.backtrace[0,maxlength].each { |i| btrace += "#{i}\r\n" }
end end
btrace.gsub!(/Section(\d+)/) { $RGSS_SCRIPTS[$1.to_i][1] } btrace.gsub!(/Section(\d+)/) { $RGSS_SCRIPTS[$1.to_i][1] }
message = "[Pokémon Essentials version #{ESSENTIALS_VERSION}]\r\n" message = "[Pokémon Essentials version #{Essentials::VERSION}]\r\n"
message += "#{ERROR_TEXT}" # For third party scripts to add to message += "#{Essentials::ERROR_TEXT}" # For third party scripts to add to
message += "Exception: #{e.class}\r\n" message += "Exception: #{e.class}\r\n"
message += "Message: #{emessage}\r\n" message += "Message: #{emessage}\r\n"
message += "\r\nBacktrace:\r\n#{btrace}" message += "\r\nBacktrace:\r\n#{btrace}"

View File

@@ -4,8 +4,6 @@
# features Boushy # features Boushy
# Modified by Peter O. to be compatible with Pokémon Essentials # Modified by Peter O. to be compatible with Pokémon Essentials
#=============================================================================== #===============================================================================
SHADOW_WARN = true
class Sprite_Shadow < RPG::Sprite class Sprite_Shadow < RPG::Sprite
attr_accessor :character attr_accessor :character
@@ -193,7 +191,7 @@ class Spriteset_Map
params = XPML_read(map,"Shadow Source", ev, 4) params = XPML_read(map,"Shadow Source", ev, 4)
@shadows.push([ev] + params) if params != nil @shadows.push([ev] + params) if params != nil
end 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" p "Warning : At least one event on this map uses the obsolete way to add shadows"
end end
shadow_initialize(map) shadow_initialize(map)

View File

@@ -30,7 +30,7 @@ class AnimatedBitmap
if file==nil if file==nil
raise "Filename is nil (missing graphic)." raise "Filename is nil (missing graphic)."
end 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) @bitmap = PngAnimatedBitmap.new(file,hue)
else else
@bitmap = GifBitmap.new(file,hue) @bitmap = GifBitmap.new(file,hue)
@@ -62,7 +62,7 @@ class PngAnimatedBitmap
@currentFrame=0 @currentFrame=0
@framecount=0 @framecount=0
panorama=BitmapCache.load_bitmap(file,hue) 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 # File has a frame count
numFrames = $1.to_i numFrames = $1.to_i
delay = $2.to_i delay = $2.to_i

View File

@@ -165,121 +165,145 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetPocket(item) def pbGetPocket(item)
Deprecation.warn_method('pbGetPocket', 'v20', 'GameData::Item.get(item).pocket') Deprecation.warn_method('pbGetPocket', 'v20', 'GameData::Item.get(item).pocket')
return GameData::Item.get(item).pocket return GameData::Item.get(item).pocket
end end
# @deprecated This alias is slated to be removed in v20.
def pbGetPrice(item) def pbGetPrice(item)
Deprecation.warn_method('pbGetPrice', 'v20', 'GameData::Item.get(item).price') Deprecation.warn_method('pbGetPrice', 'v20', 'GameData::Item.get(item).price')
return GameData::Item.get(item).price return GameData::Item.get(item).price
end end
# @deprecated This alias is slated to be removed in v20.
def pbGetMachine(item) def pbGetMachine(item)
Deprecation.warn_method('pbGetMachine', 'v20', 'GameData::Item.get(item).move') Deprecation.warn_method('pbGetMachine', 'v20', 'GameData::Item.get(item).move')
return GameData::Item.get(item).move return GameData::Item.get(item).move
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsTechnicalMachine?(item) def pbIsTechnicalMachine?(item)
Deprecation.warn_method('pbIsTechnicalMachine?', 'v20', 'GameData::Item.get(item).is_TM?') Deprecation.warn_method('pbIsTechnicalMachine?', 'v20', 'GameData::Item.get(item).is_TM?')
return GameData::Item.get(item).is_TM? return GameData::Item.get(item).is_TM?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsHiddenMachine?(item) def pbIsHiddenMachine?(item)
Deprecation.warn_method('pbIsHiddenMachine?', 'v20', 'GameData::Item.get(item).is_HM?') Deprecation.warn_method('pbIsHiddenMachine?', 'v20', 'GameData::Item.get(item).is_HM?')
return GameData::Item.get(item).is_HM? return GameData::Item.get(item).is_HM?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsMachine?(item) def pbIsMachine?(item)
Deprecation.warn_method('pbIsMachine?', 'v20', 'GameData::Item.get(item).is_machine?') Deprecation.warn_method('pbIsMachine?', 'v20', 'GameData::Item.get(item).is_machine?')
return GameData::Item.get(item).is_machine? return GameData::Item.get(item).is_machine?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsMail?(item) def pbIsMail?(item)
Deprecation.warn_method('pbIsMail?', 'v20', 'GameData::Item.get(item).is_mail?') Deprecation.warn_method('pbIsMail?', 'v20', 'GameData::Item.get(item).is_mail?')
return GameData::Item.get(item).is_mail? return GameData::Item.get(item).is_mail?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsMailWithPokemonIcons?(item) def pbIsMailWithPokemonIcons?(item)
Deprecation.warn_method('pbIsMailWithPokemonIcons?', 'v20', 'GameData::Item.get(item).is_icon_mail?') Deprecation.warn_method('pbIsMailWithPokemonIcons?', 'v20', 'GameData::Item.get(item).is_icon_mail?')
return GameData::Item.get(item).is_icon_mail? return GameData::Item.get(item).is_icon_mail?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsPokeBall?(item) def pbIsPokeBall?(item)
Deprecation.warn_method('pbIsPokeBall?', 'v20', 'GameData::Item.get(item).is_poke_ball?') Deprecation.warn_method('pbIsPokeBall?', 'v20', 'GameData::Item.get(item).is_poke_ball?')
return GameData::Item.get(item).is_poke_ball? return GameData::Item.get(item).is_poke_ball?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsSnagBall?(item) def pbIsSnagBall?(item)
Deprecation.warn_method('pbIsSnagBall?', 'v20', 'GameData::Item.get(item).is_snag_ball?') Deprecation.warn_method('pbIsSnagBall?', 'v20', 'GameData::Item.get(item).is_snag_ball?')
return GameData::Item.get(item).is_snag_ball? return GameData::Item.get(item).is_snag_ball?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsBerry?(item) def pbIsBerry?(item)
Deprecation.warn_method('pbIsBerry?', 'v20', 'GameData::Item.get(item).is_berry?') Deprecation.warn_method('pbIsBerry?', 'v20', 'GameData::Item.get(item).is_berry?')
return GameData::Item.get(item).is_berry? return GameData::Item.get(item).is_berry?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsKeyItem?(item) def pbIsKeyItem?(item)
Deprecation.warn_method('pbIsKeyItem?', 'v20', 'GameData::Item.get(item).is_key_item?') Deprecation.warn_method('pbIsKeyItem?', 'v20', 'GameData::Item.get(item).is_key_item?')
return GameData::Item.get(item).is_key_item? return GameData::Item.get(item).is_key_item?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsEvolutionStone?(item) def pbIsEvolutionStone?(item)
Deprecation.warn_method('pbIsEvolutionStone?', 'v20', 'GameData::Item.get(item).is_evolution_stone?') Deprecation.warn_method('pbIsEvolutionStone?', 'v20', 'GameData::Item.get(item).is_evolution_stone?')
return GameData::Item.get(item).is_evolution_stone? return GameData::Item.get(item).is_evolution_stone?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsFossil?(item) def pbIsFossil?(item)
Deprecation.warn_method('pbIsFossil?', 'v20', 'GameData::Item.get(item).is_fossil?') Deprecation.warn_method('pbIsFossil?', 'v20', 'GameData::Item.get(item).is_fossil?')
return GameData::Item.get(item).is_fossil? return GameData::Item.get(item).is_fossil?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsApricorn?(item) def pbIsApricorn?(item)
Deprecation.warn_method('pbIsApricorn?', 'v20', 'GameData::Item.get(item).is_apricorn?') Deprecation.warn_method('pbIsApricorn?', 'v20', 'GameData::Item.get(item).is_apricorn?')
return GameData::Item.get(item).is_apricorn? return GameData::Item.get(item).is_apricorn?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsGem?(item) def pbIsGem?(item)
Deprecation.warn_method('pbIsGem?', 'v20', 'GameData::Item.get(item).is_gem?') Deprecation.warn_method('pbIsGem?', 'v20', 'GameData::Item.get(item).is_gem?')
return GameData::Item.get(item).is_gem? return GameData::Item.get(item).is_gem?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsMulch?(item) def pbIsMulch?(item)
Deprecation.warn_method('pbIsMulch?', 'v20', 'GameData::Item.get(item).is_mulch?') Deprecation.warn_method('pbIsMulch?', 'v20', 'GameData::Item.get(item).is_mulch?')
return GameData::Item.get(item).is_mulch? return GameData::Item.get(item).is_mulch?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsMegaStone?(item) def pbIsMegaStone?(item)
Deprecation.warn_method('pbIsMegaStone?', 'v20', 'GameData::Item.get(item).is_mega_stone?') Deprecation.warn_method('pbIsMegaStone?', 'v20', 'GameData::Item.get(item).is_mega_stone?')
return GameData::Item.get(item).is_mega_stone? return GameData::Item.get(item).is_mega_stone?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsImportantItem?(item) def pbIsImportantItem?(item)
Deprecation.warn_method('pbIsImportantItem?', 'v20', 'GameData::Item.get(item).is_important?') Deprecation.warn_method('pbIsImportantItem?', 'v20', 'GameData::Item.get(item).is_important?')
return GameData::Item.get(item).is_important? return GameData::Item.get(item).is_important?
end end
# @deprecated This alias is slated to be removed in v20.
def pbCanHoldItem?(item) def pbCanHoldItem?(item)
Deprecation.warn_method('pbCanHoldItem?', 'v20', 'GameData::Item.get(item).can_hold?') Deprecation.warn_method('pbCanHoldItem?', 'v20', 'GameData::Item.get(item).can_hold?')
return GameData::Item.get(item).can_hold? return GameData::Item.get(item).can_hold?
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsUnlosableItem?(check_item, species, ability) def pbIsUnlosableItem?(check_item, species, ability)
Deprecation.warn_method('pbIsUnlosableItem?', 'v20', 'GameData::Item.get(item).unlosable?') Deprecation.warn_method('pbIsUnlosableItem?', 'v20', 'GameData::Item.get(item).unlosable?')
return GameData::Item.get(check_item).unlosable?(species, ability) return GameData::Item.get(check_item).unlosable?(species, ability)
end end
# @deprecated This alias is slated to be removed in v20.
def pbItemIconFile(item) def pbItemIconFile(item)
Deprecation.warn_method('pbItemIconFile', 'v20', 'GameData::Item.icon_filename(item)') Deprecation.warn_method('pbItemIconFile', 'v20', 'GameData::Item.icon_filename(item)')
return GameData::Item.icon_filename(item) return GameData::Item.icon_filename(item)
end end
# @deprecated This alias is slated to be removed in v20.
def pbHeldItemIconFile(item) def pbHeldItemIconFile(item)
Deprecation.warn_method('pbHeldItemIconFile', 'v20', 'GameData::Item.held_icon_filename(item)') Deprecation.warn_method('pbHeldItemIconFile', 'v20', 'GameData::Item.held_icon_filename(item)')
return GameData::Item.held_icon_filename(item) return GameData::Item.held_icon_filename(item)
end end
# @deprecated This alias is slated to be removed in v20.
def pbMailBackFile(item) def pbMailBackFile(item)
Deprecation.warn_method('pbMailBackFile', 'v20', 'GameData::Item.mail_filename(item)') Deprecation.warn_method('pbMailBackFile', 'v20', 'GameData::Item.mail_filename(item)')
return GameData::Item.mail_filename(item) return GameData::Item.mail_filename(item)

View File

@@ -29,6 +29,7 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetBerryPlantData(item) def pbGetBerryPlantData(item)
Deprecation.warn_method('pbGetBerryPlantData', 'v20', 'GameData::BerryPlant.get(item)') Deprecation.warn_method('pbGetBerryPlantData', 'v20', 'GameData::BerryPlant.get(item)')
return GameData::BerryPlant.get(item) return GameData::BerryPlant.get(item)

View File

@@ -129,11 +129,13 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbLoadMetadata def pbLoadMetadata
Deprecation.warn_method('pbLoadMetadata', 'v20', 'GameData::Metadata.get or GameData::MapMetadata.get(map_id)') Deprecation.warn_method('pbLoadMetadata', 'v20', 'GameData::Metadata.get or GameData::MapMetadata.get(map_id)')
return nil return nil
end end
# @deprecated This alias is slated to be removed in v20.
def pbGetMetadata(map_id, metadata_type) def pbGetMetadata(map_id, metadata_type)
if map_id == 0 # Global metadata if map_id == 0 # Global metadata
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::Metadata.get.something') Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::Metadata.get.something')

View File

@@ -72,11 +72,13 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetMoveData(move_id, move_data_type = -1) def pbGetMoveData(move_id, move_data_type = -1)
Deprecation.warn_method('pbGetMoveData', 'v20', 'GameData::Move.get(move_id)') Deprecation.warn_method('pbGetMoveData', 'v20', 'GameData::Move.get(move_id)')
return GameData::Move.get(move_id) return GameData::Move.get(move_id)
end end
# @deprecated This alias is slated to be removed in v20.
def pbIsHiddenMove?(move) def pbIsHiddenMove?(move)
Deprecation.warn_method('pbIsHiddenMove?', 'v20', 'GameData::Move.get(move).hidden_move?') Deprecation.warn_method('pbIsHiddenMove?', 'v20', 'GameData::Move.get(move).hidden_move?')
return GameData::Move.get(move).hidden_move? return GameData::Move.get(move).hidden_move?

View File

@@ -96,46 +96,55 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetTrainerTypeData(tr_type) def pbGetTrainerTypeData(tr_type)
Deprecation.warn_method('pbGetTrainerTypeData', 'v20', 'GameData::TrainerType.get(trainer_type)') Deprecation.warn_method('pbGetTrainerTypeData', 'v20', 'GameData::TrainerType.get(trainer_type)')
return GameData::TrainerType.get(tr_type) return GameData::TrainerType.get(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbTrainerCharFile(tr_type) # Used by the phone def pbTrainerCharFile(tr_type) # Used by the phone
Deprecation.warn_method('pbTrainerCharFile', 'v20', 'GameData::TrainerType.charset_filename(trainer_type)') Deprecation.warn_method('pbTrainerCharFile', 'v20', 'GameData::TrainerType.charset_filename(trainer_type)')
return GameData::TrainerType.charset_filename(tr_type) return GameData::TrainerType.charset_filename(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbTrainerCharNameFile(tr_type) # Used by Battle Frontier and compiler def pbTrainerCharNameFile(tr_type) # Used by Battle Frontier and compiler
Deprecation.warn_method('pbTrainerCharNameFile', 'v20', 'GameData::TrainerType.charset_filename_brief(trainer_type)') Deprecation.warn_method('pbTrainerCharNameFile', 'v20', 'GameData::TrainerType.charset_filename_brief(trainer_type)')
return GameData::TrainerType.charset_filename_brief(tr_type) return GameData::TrainerType.charset_filename_brief(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbTrainerSpriteFile(tr_type) def pbTrainerSpriteFile(tr_type)
Deprecation.warn_method('pbTrainerSpriteFile', 'v20', 'GameData::TrainerType.front_sprite_filename(trainer_type)') Deprecation.warn_method('pbTrainerSpriteFile', 'v20', 'GameData::TrainerType.front_sprite_filename(trainer_type)')
return GameData::TrainerType.front_sprite_filename(tr_type) return GameData::TrainerType.front_sprite_filename(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbTrainerSpriteBackFile(tr_type) def pbTrainerSpriteBackFile(tr_type)
Deprecation.warn_method('pbTrainerSpriteBackFile', 'v20', 'GameData::TrainerType.back_sprite_filename(trainer_type)') Deprecation.warn_method('pbTrainerSpriteBackFile', 'v20', 'GameData::TrainerType.back_sprite_filename(trainer_type)')
return GameData::TrainerType.back_sprite_filename(tr_type) return GameData::TrainerType.back_sprite_filename(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPlayerSpriteFile(tr_type) def pbPlayerSpriteFile(tr_type)
Deprecation.warn_method('pbPlayerSpriteFile', 'v20', 'GameData::TrainerType.player_front_sprite_filename(trainer_type)') Deprecation.warn_method('pbPlayerSpriteFile', 'v20', 'GameData::TrainerType.player_front_sprite_filename(trainer_type)')
return GameData::TrainerType.player_front_sprite_filename(tr_type) return GameData::TrainerType.player_front_sprite_filename(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPlayerSpriteBackFile(tr_type) def pbPlayerSpriteBackFile(tr_type)
Deprecation.warn_method('pbPlayerSpriteBackFile', 'v20', 'GameData::TrainerType.player_back_sprite_filename(trainer_type)') Deprecation.warn_method('pbPlayerSpriteBackFile', 'v20', 'GameData::TrainerType.player_back_sprite_filename(trainer_type)')
return GameData::TrainerType.player_back_sprite_filename(tr_type) return GameData::TrainerType.player_back_sprite_filename(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbTrainerHeadFile(tr_type) def pbTrainerHeadFile(tr_type)
Deprecation.warn_method('pbTrainerHeadFile', 'v20', 'GameData::TrainerType.map_icon_filename(trainer_type)') Deprecation.warn_method('pbTrainerHeadFile', 'v20', 'GameData::TrainerType.map_icon_filename(trainer_type)')
return GameData::TrainerType.map_icon_filename(tr_type) return GameData::TrainerType.map_icon_filename(tr_type)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPlayerHeadFile(tr_type) def pbPlayerHeadFile(tr_type)
Deprecation.warn_method('pbPlayerHeadFile', 'v20', 'GameData::TrainerType.player_map_icon_filename(trainer_type)') Deprecation.warn_method('pbPlayerHeadFile', 'v20', 'GameData::TrainerType.player_map_icon_filename(trainer_type)')
return GameData::TrainerType.player_map_icon_filename(tr_type) return GameData::TrainerType.player_map_icon_filename(tr_type)

View File

@@ -223,31 +223,37 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetSpeciesData(species, form = 0, species_data_type = -1) def pbGetSpeciesData(species, form = 0, species_data_type = -1)
Deprecation.warn_method('pbGetSpeciesData', 'v20', 'GameData::Species.get_species_form(species, form).something') Deprecation.warn_method('pbGetSpeciesData', 'v20', 'GameData::Species.get_species_form(species, form).something')
return GameData::Species.get_species_form(species, form) return GameData::Species.get_species_form(species, form)
end end
# @deprecated This alias is slated to be removed in v20.
def pbGetSpeciesEggMoves(species, form = 0) def pbGetSpeciesEggMoves(species, form = 0)
Deprecation.warn_method('pbGetSpeciesEggMoves', 'v20', 'GameData::Species.get_species_form(species, form).egg_moves') Deprecation.warn_method('pbGetSpeciesEggMoves', 'v20', 'GameData::Species.get_species_form(species, form).egg_moves')
return GameData::Species.get_species_form(species, form).egg_moves return GameData::Species.get_species_form(species, form).egg_moves
end end
# @deprecated This alias is slated to be removed in v20.
def pbGetSpeciesMoveset(species, form = 0) def pbGetSpeciesMoveset(species, form = 0)
Deprecation.warn_method('pbGetSpeciesMoveset', 'v20', 'GameData::Species.get_species_form(species, form).moves') Deprecation.warn_method('pbGetSpeciesMoveset', 'v20', 'GameData::Species.get_species_form(species, form).moves')
return GameData::Species.get_species_form(species, form).moves return GameData::Species.get_species_form(species, form).moves
end end
# @deprecated This alias is slated to be removed in v20.
def pbGetEvolutionData(species) def pbGetEvolutionData(species)
Deprecation.warn_method('pbGetEvolutionData', 'v20', 'GameData::Species.get(species).evolutions') Deprecation.warn_method('pbGetEvolutionData', 'v20', 'GameData::Species.get(species).evolutions')
return GameData::Species.get(species).evolutions return GameData::Species.get(species).evolutions
end end
# @deprecated This alias is slated to be removed in v20.
def pbApplyBattlerMetricsToSprite(sprite, index, species_data, shadow = false, metrics = nil) def pbApplyBattlerMetricsToSprite(sprite, index, species_data, shadow = false, metrics = nil)
Deprecation.warn_method('pbApplyBattlerMetricsToSprite', 'v20', 'GameData::Species.get(species).apply_metrics_to_sprite') Deprecation.warn_method('pbApplyBattlerMetricsToSprite', 'v20', 'GameData::Species.get(species).apply_metrics_to_sprite')
GameData::Species.get(species).apply_metrics_to_sprite(sprite, index, shadow) GameData::Species.get(species).apply_metrics_to_sprite(sprite, index, shadow)
end end
# @deprecated This alias is slated to be removed in v20.
def showShadow?(species) def showShadow?(species)
Deprecation.warn_method('showShadow?', 'v20', 'GameData::Species.get(species).shows_shadow?') Deprecation.warn_method('showShadow?', 'v20', 'GameData::Species.get(species).shows_shadow?')
return GameData::Species.get(species).shows_shadow? return GameData::Species.get(species).shows_shadow?

View File

@@ -261,46 +261,55 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # 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) 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)') 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) return GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg)
end end
# @deprecated This alias is slated to be removed in v20.
def pbLoadPokemonBitmap(pkmn, back = false) def pbLoadPokemonBitmap(pkmn, back = false)
Deprecation.warn_method('pbLoadPokemonBitmap', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn)') Deprecation.warn_method('pbLoadPokemonBitmap', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn)')
return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back) return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back)
end end
# @deprecated This alias is slated to be removed in v20.
def pbLoadPokemonBitmapSpecies(pkmn, species, back = false) def pbLoadPokemonBitmapSpecies(pkmn, species, back = false)
Deprecation.warn_method('pbLoadPokemonBitmapSpecies', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species)') Deprecation.warn_method('pbLoadPokemonBitmapSpecies', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species)')
return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species) return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPokemonIconFile(pkmn) def pbPokemonIconFile(pkmn)
Deprecation.warn_method('pbPokemonIconFile', 'v20', 'GameData::Species.icon_filename_from_pokemon(pkmn)') Deprecation.warn_method('pbPokemonIconFile', 'v20', 'GameData::Species.icon_filename_from_pokemon(pkmn)')
return GameData::Species.icon_filename_from_pokemon(pkmn) return GameData::Species.icon_filename_from_pokemon(pkmn)
end end
# @deprecated This alias is slated to be removed in v20.
def pbLoadPokemonIcon(pkmn) def pbLoadPokemonIcon(pkmn)
Deprecation.warn_method('pbLoadPokemonIcon', 'v20', 'GameData::Species.icon_bitmap_from_pokemon(pkmn)') Deprecation.warn_method('pbLoadPokemonIcon', 'v20', 'GameData::Species.icon_bitmap_from_pokemon(pkmn)')
return GameData::Species.icon_bitmap_from_pokemon(pkmn) return GameData::Species.icon_bitmap_from_pokemon(pkmn)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPokemonFootprintFile(species, form = 0) def pbPokemonFootprintFile(species, form = 0)
Deprecation.warn_method('pbPokemonFootprintFile', 'v20', 'GameData::Species.footprint_filename(species, form)') Deprecation.warn_method('pbPokemonFootprintFile', 'v20', 'GameData::Species.footprint_filename(species, form)')
return GameData::Species.footprint_filename(species, form) return GameData::Species.footprint_filename(species, form)
end end
# @deprecated This alias is slated to be removed in v20.
def pbCheckPokemonShadowBitmapFiles(species, form = 0) def pbCheckPokemonShadowBitmapFiles(species, form = 0)
Deprecation.warn_method('pbCheckPokemonShadowBitmapFiles', 'v20', 'GameData::Species.shadow_filename(species, form)') Deprecation.warn_method('pbCheckPokemonShadowBitmapFiles', 'v20', 'GameData::Species.shadow_filename(species, form)')
return GameData::Species.shadow_filename(species, form) return GameData::Species.shadow_filename(species, form)
end end
# @deprecated This alias is slated to be removed in v20.
def pbLoadPokemonShadowBitmap(pkmn) def pbLoadPokemonShadowBitmap(pkmn)
Deprecation.warn_method('pbLoadPokemonShadowBitmap', 'v20', 'GameData::Species.shadow_bitmap_from_pokemon(pkmn)') Deprecation.warn_method('pbLoadPokemonShadowBitmap', 'v20', 'GameData::Species.shadow_bitmap_from_pokemon(pkmn)')
return GameData::Species.shadow_bitmap_from_pokemon(pkmn) return GameData::Species.shadow_bitmap_from_pokemon(pkmn)
end end
# @deprecated This alias is slated to be removed in v20.
def pbCryFile(species, form = 0) def pbCryFile(species, form = 0)
if species.is_a?(Pokemon) if species.is_a?(Pokemon)
Deprecation.warn_method('pbCryFile', 'v20', 'GameData::Species.cry_filename_from_pokemon(pkmn)') 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) return GameData::Species.cry_filename(species, form)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPlayCry(pkmn, volume = 90, pitch = nil) def pbPlayCry(pkmn, volume = 90, pitch = nil)
Deprecation.warn_method('pbPlayCry', 'v20', 'GameData::Species.play_cry(pkmn)') Deprecation.warn_method('pbPlayCry', 'v20', 'GameData::Species.play_cry(pkmn)')
GameData::Species.play_cry(pkmn, volume, pitch) GameData::Species.play_cry(pkmn, volume, pitch)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPlayCrySpecies(species, form = 0, volume = 90, pitch = nil) def pbPlayCrySpecies(species, form = 0, volume = 90, pitch = nil)
Deprecation.warn_method('pbPlayCrySpecies', 'v20', 'GameData::Species.play_cry_from_species(species, form)') Deprecation.warn_method('pbPlayCrySpecies', 'v20', 'GameData::Species.play_cry_from_species(species, form)')
GameData::Species.play_cry_from_species(species, form, volume, pitch) GameData::Species.play_cry_from_species(species, form, volume, pitch)
end end
# @deprecated This alias is slated to be removed in v20.
def pbPlayCryPokemon(pkmn, volume = 90, pitch = nil) def pbPlayCryPokemon(pkmn, volume = 90, pitch = nil)
Deprecation.warn_method('pbPlayCryPokemon', 'v20', 'GameData::Species.play_cry_from_pokemon(pkmn)') Deprecation.warn_method('pbPlayCryPokemon', 'v20', 'GameData::Species.play_cry_from_pokemon(pkmn)')
GameData::Species.play_cry_from_pokemon(pkmn, volume, pitch) GameData::Species.play_cry_from_pokemon(pkmn, volume, pitch)
end end
# @deprecated This alias is slated to be removed in v20.
def pbCryFrameLength(species, form = 0, pitch = 100) def pbCryFrameLength(species, form = 0, pitch = 100)
Deprecation.warn_method('pbCryFrameLength', 'v20', 'GameData::Species.cry_length(species, form)') Deprecation.warn_method('pbCryFrameLength', 'v20', 'GameData::Species.cry_length(species, form)')
return GameData::Species.cry_length(species, form, pitch) return GameData::Species.cry_length(species, form, pitch)

View File

@@ -37,7 +37,7 @@ module GameData
# @param tr_type [Symbol, String] # @param tr_type [Symbol, String]
# @param tr_name [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 # @return [Boolean] whether the given other is defined as a self
def self.exists?(tr_type, tr_name, tr_version = 0) def self.exists?(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String] validate tr_type => [Symbol, String]
@@ -48,7 +48,7 @@ module GameData
# @param tr_type [Symbol, String] # @param tr_type [Symbol, String]
# @param tr_name [String] # @param tr_name [String]
# @param tr_version [Integer] # @param tr_version [Integer, nil]
# @return [self] # @return [self]
def self.get(tr_type, tr_name, tr_version = 0) def self.get(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String] validate tr_type => [Symbol, String]
@@ -58,7 +58,9 @@ module GameData
return self::DATA[key] return self::DATA[key]
end end
# @param other [Symbol, self, String, Integer] # @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
# @return [self, nil] # @return [self, nil]
def try_get(tr_type, tr_name, tr_version = 0) def try_get(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String] validate tr_type => [Symbol, String]
@@ -166,6 +168,7 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetTrainerData(tr_type, tr_name, tr_version = 0) def pbGetTrainerData(tr_type, tr_name, tr_version = 0)
Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)') Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)')
return GameData::Trainer.get(tr_type, tr_name, tr_version) return GameData::Trainer.get(tr_type, tr_name, tr_version)

View File

@@ -15,7 +15,7 @@ module GameData
include InstanceMethods include InstanceMethods
# @param map_id [Integer] # @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 # @return [Boolean] whether there is encounter data for the given map ID/version
def self.exists?(map_id, map_version = 0) def self.exists?(map_id, map_version = 0)
validate map_id => [Integer] validate map_id => [Integer]
@@ -25,7 +25,7 @@ module GameData
end end
# @param map_id [Integer] # @param map_id [Integer]
# @param version [Integer] # @param map_version [Integer, nil]
# @return [self, nil] # @return [self, nil]
def self.get(map_id, map_version = 0) def self.get(map_id, map_version = 0)
validate map_id => Integer validate map_id => Integer
@@ -72,6 +72,7 @@ end
#=============================================================================== #===============================================================================
# Deprecated methods # Deprecated methods
#=============================================================================== #===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbLoadEncountersData def pbLoadEncountersData
Deprecation.warn_method('pbLoadEncountersData', 'v20', 'GameData::Encounter.get(map_id, version)') Deprecation.warn_method('pbLoadEncountersData', 'v20', 'GameData::Encounter.get(map_id, version)')
return nil return nil

View File

@@ -96,16 +96,18 @@ module PBExperience
end end
# Erratic (600000): # Erratic (600000):
# For levels 0-50: n**3([100-n]/50) # For levels 0-50: n**3 * (100 - n) / 50
# For levels 51-68: n**3([150-n]/100) # 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)) # 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] # where p(x) = array(0.000, 0.008, 0.014)[x]
# For levels 99-100: n**3([160-n]/100) # For levels 99-100: n**3 * (160 - n) / 100
# Fluctuating (1640000): # Fluctuating (1640000):
# For levels 0-15 : n**3([24+{(n+1)/3}]/50) # For levels 0-15 : n**3 * (24 + ((n + 1) / 3)) / 50
# For levels 16-35: n**3([14+n]/50) # For levels 16-35: n**3 * (14 + n) / 50
# For levels 36-100: n**3([32+{n/2}]/50) # For levels 36-100: n**3 * (32 + (n / 2)) / 50
# @param level [Integer]
# @param growth [Integer] growth rate
def self.pbGetExpInternal(level,growth) def self.pbGetExpInternal(level,growth)
if level <= 100 if level <= 100
# Refer to experience table for levels 100 and less # Refer to experience table for levels 100 and less
@@ -138,7 +140,7 @@ module PBExperience
end end
# Gets the maximum Exp Points possible for the given growth rate. # Gets the maximum Exp Points possible for the given growth rate.
# growth -- Growth rate. # @param growth [Integer] growth rate
def self.pbGetMaxExperience(growth) def self.pbGetMaxExperience(growth)
if growth<0 || growth>PBGrowthRates.maxValue if growth<0 || growth>PBGrowthRates.maxValue
return ArgumentError.new("The growth rate is invalid.") 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 # Gets the number of Exp Points needed to reach the given
# level with the given growth rate. # level with the given growth rate.
# growth -- Growth rate. # @param level [Integer]
# @param growth [Integer] growth rate
def self.pbGetStartExperience(level,growth) def self.pbGetStartExperience(level,growth)
if growth<0 || growth>PBGrowthRates.maxValue if growth<0 || growth>PBGrowthRates.maxValue
return ArgumentError.new("The growth rate is invalid.") return ArgumentError.new("The growth rate is invalid.")
@@ -163,9 +166,9 @@ module PBExperience
# Adds experience points ensuring that the new total doesn't # Adds experience points ensuring that the new total doesn't
# exceed the maximum Exp. Points for the given growth rate. # exceed the maximum Exp. Points for the given growth rate.
# currexp -- Current Exp Points. # @param currexp [Integer] current Exp. points
# expgain -- Exp. Points to add # @param expgain [Integer] Exp. points to add
# growth -- Growth rate. # @param growth [Integer] growth rate
def self.pbAddExperience(currexp,expgain,growth) def self.pbAddExperience(currexp,expgain,growth)
if growth<0 || growth>PBGrowthRates.maxValue if growth<0 || growth>PBGrowthRates.maxValue
return ArgumentError.new("The growth rate is invalid.") return ArgumentError.new("The growth rate is invalid.")
@@ -177,7 +180,7 @@ module PBExperience
end end
# Calculates a level given the number of Exp Points and growth rate. # 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) def self.pbGetLevelFromExperience(exp,growth)
if growth<0 || growth>PBGrowthRates.maxValue if growth<0 || growth>PBGrowthRates.maxValue
return ArgumentError.new("The growth rate is invalid.") return ArgumentError.new("The growth rate is invalid.")

View File

@@ -553,8 +553,8 @@ class PokemonBattlerSprite < RPG::Sprite
# This method plays the battle entrance animation of a Pokémon. By default # 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 # 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 # recommendation is to create a PictureEx animation and push it into
# @battleAnimations array. # the @battleAnimations array.
def pbPlayIntroAnimation(pictureEx=nil) def pbPlayIntroAnimation(pictureEx=nil)
return if !@pkmn return if !@pkmn
GameData::Species.play_cry_from_pokemon(@pkmn) GameData::Species.play_cry_from_pokemon(@pkmn)

View File

@@ -605,7 +605,7 @@ def pbEvolutionCheck(currentLevels)
pkmn = $Trainer.party[i] pkmn = $Trainer.party[i]
next if !pkmn || (pkmn.hp==0 && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON) next if !pkmn || (pkmn.hp==0 && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON)
next if currentLevels[i] && pkmn.level==currentLevels[i] next if currentLevels[i] && pkmn.level==currentLevels[i]
newSpecies = pbCheckEvolution(pkmn) newSpecies = EvolutionCheck.check(pkmn)
next if !newSpecies next if !newSpecies
evo = PokemonEvolutionScene.new evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn,newSpecies) evo.pbStartScreen(pkmn,newSpecies)

View File

@@ -38,45 +38,45 @@ module PBDayNight
@dayNightToneLastUpdate = nil @dayNightToneLastUpdate = nil
@oneOverSixty = 1/60.0 @oneOverSixty = 1/60.0
# Returns true if it's day. # Returns true if it's day.
def self.isDay?(time=nil) def self.isDay?(time=nil)
time = pbGetTimeNow if !time time = pbGetTimeNow if !time
return (time.hour>=5 && time.hour<20) return (time.hour>=5 && time.hour<20)
end end
# Returns true if it's night. # Returns true if it's night.
def self.isNight?(time=nil) def self.isNight?(time=nil)
time = pbGetTimeNow if !time time = pbGetTimeNow if !time
return (time.hour>=20 || time.hour<5) return (time.hour>=20 || time.hour<5)
end end
# Returns true if it's morning. # Returns true if it's morning.
def self.isMorning?(time=nil) def self.isMorning?(time=nil)
time = pbGetTimeNow if !time time = pbGetTimeNow if !time
return (time.hour>=5 && time.hour<10) return (time.hour>=5 && time.hour<10)
end end
# Returns true if it's the afternoon. # Returns true if it's the afternoon.
def self.isAfternoon?(time=nil) def self.isAfternoon?(time=nil)
time = pbGetTimeNow if !time time = pbGetTimeNow if !time
return (time.hour>=14 && time.hour<17) return (time.hour>=14 && time.hour<17)
end end
# Returns true if it's the evening. # Returns true if it's the evening.
def self.isEvening?(time=nil) def self.isEvening?(time=nil)
time = pbGetTimeNow if !time time = pbGetTimeNow if !time
return (time.hour>=17 && time.hour<20) return (time.hour>=17 && time.hour<20)
end 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 def self.getShade
time = pbGetDayNightMinutes time = pbGetDayNightMinutes
time = (24*60)-time if time>(12*60) time = (24*60)-time if time>(12*60)
return 255*time/(12*60) return 255*time/(12*60)
end end
# Gets a Tone object representing a suggested shading # Gets a Tone object representing a suggested shading
# tone for the current time of day. # tone for the current time of day.
def self.getTone def self.getTone
@cachedTone = Tone.new(0,0,0) if !@cachedTone @cachedTone = Tone.new(0,0,0) if !@cachedTone
return @cachedTone if !Settings::TIME_SHADING return @cachedTone if !Settings::TIME_SHADING
@@ -95,8 +95,6 @@ module PBDayNight
private private
# Internal function
def self.getToneInternal def self.getToneInternal
# Calculates the tone for the current frame, used for day/night effects # Calculates the tone for the current frame, used for day/night effects
realMinutes = pbGetDayNightMinutes realMinutes = pbGetDayNightMinutes

View File

@@ -76,49 +76,49 @@ class PokeBattle_Trainer
end end
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) def pbRemovePokemonAt(index)
Deprecation.warn_method('pbRemovePokemonAt', 'v20', 'PlayerTrainer#remove_pokemon_at_index') Deprecation.warn_method('pbRemovePokemonAt', 'v20', 'PlayerTrainer#remove_pokemon_at_index')
return $Trainer.remove_pokemon_at_index(index) return $Trainer.remove_pokemon_at_index(index)
end 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) def pbCheckAble(index)
Deprecation.warn_method('pbCheckAble', 'v20', 'PlayerTrainer#has_other_able_pokemon?') Deprecation.warn_method('pbCheckAble', 'v20', 'PlayerTrainer#has_other_able_pokemon?')
return $Trainer.has_other_able_pokemon?(index) return $Trainer.has_other_able_pokemon?(index)
end 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 def pbAllFainted
Deprecation.warn_method('pbAllFainted', 'v20', 'PlayerTrainer#all_fainted?') Deprecation.warn_method('pbAllFainted', 'v20', 'PlayerTrainer#all_fainted?')
return $Trainer.all_fainted? return $Trainer.all_fainted?
end 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) def pbHasSpecies?(species, form = -1)
Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_species?') Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_species?')
return $Trainer.has_species?(species, form) return $Trainer.has_species?(species, form)
end 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) def pbHasFatefulSpecies?(species)
Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_fateful_species?') Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_fateful_species?')
return $Trainer.has_fateful_species?(species) return $Trainer.has_fateful_species?(species)
end 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) def pbHasType?(type)
Deprecation.warn_method('pbHasType?', 'v20', 'PlayerTrainer#has_pokemon_of_type?') Deprecation.warn_method('pbHasType?', 'v20', 'PlayerTrainer#has_pokemon_of_type?')
return $Trainer.has_pokemon_of_type?(type) return $Trainer.has_pokemon_of_type?(type)
end 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) def pbCheckMove(move)
Deprecation.warn_method('pbCheckMove', 'v20', 'PlayerTrainer#get_pokemon_with_move') Deprecation.warn_method('pbCheckMove', 'v20', 'PlayerTrainer#get_pokemon_with_move')
return $Trainer.get_pokemon_with_move(move) return $Trainer.get_pokemon_with_move(move)
end 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 def pbHealAll
Deprecation.warn_method('pbHealAll', 'v20', 'PlayerTrainer#heal_party') Deprecation.warn_method('pbHealAll', 'v20', 'PlayerTrainer#heal_party')
$Trainer.heal_party $Trainer.heal_party

View File

@@ -177,7 +177,7 @@ def pbChangeLevel(pkmn,newlevel,scene)
pbLearnMove(pkmn,i[1],true) { scene.pbUpdate } pbLearnMove(pkmn,i[1],true) { scene.pbUpdate }
end end
# Check for evolution # Check for evolution
newspecies = pbCheckEvolution(pkmn) newspecies = EvolutionCheck.check(pkmn)
if newspecies if newspecies
pbFadeOutInWithMusic { pbFadeOutInWithMusic {
evo = PokemonEvolutionScene.new evo = PokemonEvolutionScene.new
@@ -490,7 +490,7 @@ def pbUseItem(bag,item,bagscene=nil)
if itm.is_evolution_stone? if itm.is_evolution_stone?
annot = [] annot = []
for pkmn in $Trainer.party for pkmn in $Trainer.party
elig = pbCheckEvolution(pkmn,item) elig = EvolutionCheck.check(pkmn, item)
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE")) annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
end end
end end

View File

@@ -348,7 +348,7 @@ ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_evolu
scene.pbDisplay(_INTL("It won't have any effect.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
newspecies = pbCheckEvolution(pkmn,item) newspecies = EvolutionCheck.check(pkmn,item)
if newspecies if newspecies
pbFadeOutInWithMusic { pbFadeOutInWithMusic {
evo = PokemonEvolutionScene.new evo = PokemonEvolutionScene.new
@@ -356,7 +356,7 @@ ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_evolu
evo.pbEvolution(false) evo.pbEvolution(false)
evo.pbEndScreen evo.pbEndScreen
if scene.is_a?(PokemonPartyScreen) if scene.is_a?(PokemonPartyScreen)
scene.pbRefreshAnnotations(proc { |p| !pbCheckEvolution(p,item).nil? }) scene.pbRefreshAnnotations(proc { |p| !EvolutionCheck.check(p, item).nil? })
scene.pbRefresh scene.pbRefresh
end end
} }

View File

@@ -194,6 +194,8 @@ module EvolutionHelper
return false return false
end 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) def check_family_for_method_item(species, param = nil)
species = self.baby_species(species) species = self.baby_species(species)
evos = self.family_evolutions(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) def pbGetEvolvedFormData(species, ignore_none = false)
Deprecation.warn_method('pbGetEvolvedFormData', 'v20', 'EvolutionHelper.evolutions(species)') Deprecation.warn_method('pbGetEvolvedFormData', 'v20', 'EvolutionHelper.evolutions(species)')
return EvolutionHelper.evolutions(species, ignore_none) return EvolutionHelper.evolutions(species, ignore_none)
end end
# @deprecated Use {EvolutionHelper#family_evolutions} instead. This alias is slated to be removed in v20.
def pbGetEvolutionFamilyData(species) # Unused def pbGetEvolutionFamilyData(species) # Unused
Deprecation.warn_method('pbGetEvolutionFamilyData', 'v20', 'EvolutionHelper.family_evolutions(species)') Deprecation.warn_method('pbGetEvolutionFamilyData', 'v20', 'EvolutionHelper.family_evolutions(species)')
return EvolutionHelper.family_evolutions(species, ignore_none) return EvolutionHelper.family_evolutions(species, ignore_none)
end end
# @deprecated Use {EvolutionHelper#previous_species} instead. This alias is slated to be removed in v20.
def pbGetPreviousForm(species) # Unused def pbGetPreviousForm(species) # Unused
Deprecation.warn_method('pbGetPreviousForm', 'v20', 'EvolutionHelper.previous_species(species)') Deprecation.warn_method('pbGetPreviousForm', 'v20', 'EvolutionHelper.previous_species(species)')
return EvolutionHelper.previous_species(species) return EvolutionHelper.previous_species(species)
end 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) def pbGetBabySpecies(species, check_items = false, item1 = nil, item2 = nil)
Deprecation.warn_method('pbGetBabySpecies', 'v20', 'EvolutionHelper.baby_species(species)') Deprecation.warn_method('pbGetBabySpecies', 'v20', 'EvolutionHelper.baby_species(species)')
return EvolutionHelper.baby_species(species, check_items, item1, item2) return EvolutionHelper.baby_species(species, check_items, item1, item2)
end end
# @deprecated Use {EvolutionHelper#minimum_level} instead. This alias is slated to be removed in v20.
def pbGetMinimumLevel(species) def pbGetMinimumLevel(species)
Deprecation.warn_method('pbGetMinimumLevel', 'v20', 'EvolutionHelper.minimum_level(species)') Deprecation.warn_method('pbGetMinimumLevel', 'v20', 'EvolutionHelper.minimum_level(species)')
return EvolutionHelper.minimum_level(species) return EvolutionHelper.minimum_level(species)
end end
# @deprecated Use {EvolutionHelper#check_family_for_method} instead. This alias is slated to be removed in v20.
def pbCheckEvolutionFamilyForMethod(species, method, param = nil) def pbCheckEvolutionFamilyForMethod(species, method, param = nil)
Deprecation.warn_method('pbCheckEvolutionFamilyForMethod', 'v20', 'EvolutionHelper.check_family_for_method(species, method)') Deprecation.warn_method('pbCheckEvolutionFamilyForMethod', 'v20', 'EvolutionHelper.check_family_for_method(species, method)')
return EvolutionHelper.check_family_for_method(species, method, param) return EvolutionHelper.check_family_for_method(species, method, param)
end end
# Used by the Moon Ball when checking if a Pokémon's evolution family includes # @deprecated Use {EvolutionHelper#check_family_for_method_item} instead. This alias is slated to be removed in v20.
# an evolution that uses the Moon Stone.
def pbCheckEvolutionFamilyForItemMethodItem(species, param = nil) def pbCheckEvolutionFamilyForItemMethodItem(species, param = nil)
Deprecation.warn_method('pbCheckEvolutionFamilyForItemMethodItem', 'v20', 'EvolutionHelper.check_family_for_method_item(species, item)') Deprecation.warn_method('pbCheckEvolutionFamilyForItemMethodItem', 'v20', 'EvolutionHelper.check_family_for_method_item(species, item)')
return EvolutionHelper.check_family_for_method_item(species, param) return EvolutionHelper.check_family_for_method_item(species, param)
@@ -249,44 +256,62 @@ end
#=============================================================================== #===============================================================================
# Evolution checks # Evolution checks
#=============================================================================== #===============================================================================
def pbMiniCheckEvolution(pkmn, method, parameter, new_species) module EvolutionCheck
success = PBEvolution.call("levelUpCheck", method, pkmn, parameter) # The core method that performs evolution checks. Needs a block given to it,
return (success) ? new_species : nil # which will provide either a GameData::Species ID (the species to evolve
end # into) or nil (keep checking).
# @param pkmn [Pokemon] the Pokémon trying to evolve
def pbMiniCheckEvolutionItem(pkmn, method, parameter, new_species, item) def self.check_ex(pkmn)
success = PBEvolution.call("itemCheck", method, pkmn, parameter, item) return nil if !pkmn.species || pokemon.egg? || pokemon.shadowPokemon?
return (success) ? new_species : nil return nil if pkmn.hasItem?(:EVERSTONE)
end return nil if pkmn.hasAbility?(:BATTLEBOND)
ret = nil
# Checks whether a Pokemon can evolve now. If a block is given, calls the block pkmn.species_data.evolutions.each do |evo| # [new_species, method, parameter, boolean]
# with the following parameters: next if evo[3] # Prevolution
# Pokemon to check; evolution method; parameter; ID of the new species ret = yield pkmn, evo[1], evo[2], evo[0] # pkmn, method, parameter, new_species
def pbCheckEvolutionEx(pkmn) break if ret
return nil if !pkmn.species || pokemon.egg? || pokemon.shadowPokemon? end
return nil if pkmn.hasItem?(:EVERSTONE) return ret
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
end end
return ret
end
# Checks whether a Pokemon can evolve now. If an item is used on the Pokémon, # Checks whether a Pokemon can evolve because of levelling up. If the item
# checks whether the Pokemon can evolve with the given item. # parameter is not nil, instead checks whether a Pokémon can evolve because of
def pbCheckEvolution(pkmn, item = nil) # using the item on it.
if item # @param pkmn [Pokemon] the Pokémon trying to evolve
return pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species| # @param item [Symbol, GameData::Item, nil] the item being used
next pbMiniCheckEvolutionItem(pkmn, method, parameter, new_species, item) 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 end
return pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species|
next pbMiniCheckEvolution(pkmn, method, parameter, new_species) # 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 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 end
#=============================================================================== #===============================================================================
@@ -705,7 +730,7 @@ PBEvolution.register(:ItemNight, {
PBEvolution.register(:ItemHappiness, { PBEvolution.register(:ItemHappiness, {
"parameterType" => :Item, "parameterType" => :Item,
"levelUpCheck" => proc { |pkmn, parameter, item| "itemCheck" => proc { |pkmn, parameter, item|
next item == parameter && pkmn.happiness >= 220 next item == parameter && pkmn.happiness >= 220
} }
}) })

View File

@@ -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 particular nature. If no value is given,
# returns whether this Pokémon has a nature set. # 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 # @return [Boolean] whether this Pokémon has a particular nature or a nature
# at all # at all
def hasNature?(check_nature = nil) def hasNature?(check_nature = nil)

View File

@@ -9,13 +9,13 @@ class Pokemon
attr_reader :name attr_reader :name
# @return [Integer] the gender of the owner (0 = male, 1 = female, 2 = unknown) # @return [Integer] the gender of the owner (0 = male, 1 = female, 2 = unknown)
attr_reader :gender 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 attr_reader :language
# @param id [Integer] the ID of the owner # @param id [Integer] the ID of the owner
# @param name [String] the name 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 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) def initialize(id, name, gender, language)
validate id => Integer, name => String, gender => Integer, language => Integer validate id => Integer, name => String, gender => Integer, language => Integer
@id = id @id = id

View File

@@ -26,7 +26,7 @@ def pbSave(safesave=false)
Marshal.dump($PokemonMap,f) Marshal.dump($PokemonMap,f)
Marshal.dump($PokemonBag,f) Marshal.dump($PokemonBag,f)
Marshal.dump($PokemonStorage,f) Marshal.dump($PokemonStorage,f)
Marshal.dump(ESSENTIALS_VERSION,f) Marshal.dump(Essentials::VERSION, f)
} }
Graphics.frame_reset Graphics.frame_reset
rescue rescue

View File

@@ -600,10 +600,7 @@ class PokemonEvolutionScene
end end
def pbEvolutionMethodAfterEvolution def pbEvolutionMethodAfterEvolution
pbCheckEvolutionEx(@pokemon) { |pkmn, method, parameter, new_species| EvolutionCheck.check_after_evolution(@pokemon, @newspecies)
success = PBEvolution.call("afterEvolution", method, pkmn, new_species, parameter, @newspecies)
next (success) ? 1 : -1
}
end end
def self.pbDuplicatePokemon(pkmn, new_species) def self.pbDuplicatePokemon(pkmn, new_species)

View File

@@ -173,7 +173,7 @@ class PokemonTrade_Scene
pbFadeOutAndHide(@sprites) pbFadeOutAndHide(@sprites)
pbDisposeSpriteHash(@sprites) pbDisposeSpriteHash(@sprites)
@viewport.dispose @viewport.dispose
newspecies = pbTradeCheckEvolution(@pokemon2,@pokemon) newspecies = EvolutionCheck.check_trade_methods(@pokemon2,@pokemon)
if newspecies if newspecies
evo = PokemonEvolutionScene.new evo = PokemonEvolutionScene.new
evo.pbStartScreen(@pokemon2,newspecies) evo.pbStartScreen(@pokemon2,newspecies)
@@ -239,10 +239,3 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
} }
$Trainer.party[pokemonIndex] = yourPokemon $Trainer.party[pokemonIndex] = yourPokemon
end 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

View File

@@ -6,8 +6,10 @@
# You should change it to your file's url once you upload it. # 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. # 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" module MysteryGift
# MYSTERY_GIFT_URL = "http://pastebin.com/raw/w6BqqUsm" 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. # 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 # Download all gifts from online
msgwindow=pbCreateMessageWindow msgwindow=pbCreateMessageWindow
pbMessageDisplay(msgwindow,_INTL("Searching for online gifts...\\wtnp[0]")) pbMessageDisplay(msgwindow,_INTL("Searching for online gifts...\\wtnp[0]"))
online=pbDownloadToString(MYSTERY_GIFT_URL) online = pbDownloadToString(MysteryGift::URL)
pbDisposeMessageWindow(msgwindow) pbDisposeMessageWindow(msgwindow)
if online=="" if online==""
pbMessage(_INTL("No online Mystery Gifts found.\\wtnp[20]")) pbMessage(_INTL("No online Mystery Gifts found.\\wtnp[20]"))
@@ -243,7 +245,7 @@ def pbDownloadMysteryGift(trainer)
pbFadeInAndShow(sprites) pbFadeInAndShow(sprites)
sprites["msgwindow"]=pbCreateMessageWindow sprites["msgwindow"]=pbCreateMessageWindow
pbMessageDisplay(sprites["msgwindow"],_INTL("Searching for a gift.\nPlease wait...\\wtnp[0]")) pbMessageDisplay(sprites["msgwindow"],_INTL("Searching for a gift.\nPlease wait...\\wtnp[0]"))
string=pbDownloadToString(MYSTERY_GIFT_URL) string = pbDownloadToString(MysteryGift::URL)
if string=="" if string==""
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available.")) pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
else else