diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb
index 41c4c2751..ca984ca37 100644
--- a/Data/Scripts/001_Settings.rb
+++ b/Data/Scripts/001_Settings.rb
@@ -52,6 +52,10 @@ module Settings
MAX_MONEY = 999_999
# The maximum number of Game Corner coins the player can have.
MAX_COINS = 99_999
+ # The maximum number of Battle Points the player can have.
+ MAX_BATTLE_POINTS = 9_999
+ # The maximum amount of soot the player can have.
+ MAX_SOOT = 9_999
# The maximum length, in characters, that the player's name can be.
MAX_PLAYER_NAME_SIZE = 10
# The maximum number of Pokémon that can be in the party.
diff --git a/Data/Scripts/002_Save data/005_BuiltinConversions.rb b/Data/Scripts/002_Save data/005_BuiltinConversions.rb
index 34b2e3f63..2c3cf4701 100644
--- a/Data/Scripts/002_Save data/005_BuiltinConversions.rb
+++ b/Data/Scripts/002_Save data/005_BuiltinConversions.rb
@@ -46,7 +46,7 @@ end
SaveData.register_conversion(:v19_move_global_data_to_player) do
essentials_version 19
- display_title 'Moving some Global Metadata data to Player class'
+ display_title 'Moving some global metadata data to player'
to_all do |save_data|
global = save_data[:global_metadata]
player = save_data[:player]
@@ -57,6 +57,18 @@ SaveData.register_conversion(:v19_move_global_data_to_player) do
player.pokedex.lock(i)
end
end
+ trainer.coins = global.coins
+ global.coins = nil
+ trainer.soot = global.sootsack
+ global.sootsack = nil
+ trainer.has_running_shoes = global.runningShoes
+ global.runningShoes = nil
+ trainer.seen_storage_creator = global.seenStorageCreator
+ global.seenStorageCreator = nil
+ trainer.has_snag_machine = global.snagMachine
+ global.snagMachine = nil
+ trainer.seen_purify_chamber = global.seenPurifyChamber
+ global.seenPurifyChamber = nil
end
end
diff --git a/Data/Scripts/004_Game classes/010_Game_PlayerVisuals.rb b/Data/Scripts/004_Game classes/010_Game_PlayerVisuals.rb
index c6141c4ec..9f819903a 100644
--- a/Data/Scripts/004_Game classes/010_Game_PlayerVisuals.rb
+++ b/Data/Scripts/004_Game classes/010_Game_PlayerVisuals.rb
@@ -24,7 +24,7 @@ class Game_Player < Game_Character
@move_route_forcing || $game_temp.message_window_showing ||
pbMapInterpreterRunning?
input = ($PokemonSystem.runstyle == 1) ^ Input.press?(Input::ACTION)
- return input && $PokemonGlobal.runningShoes && !jumping? &&
+ return input && $Trainer.has_running_shoes && !jumping? &&
!$PokemonGlobal.diving && !$PokemonGlobal.surfing &&
!$PokemonGlobal.bicycle && !$game_player.pbTerrainTag.must_walk
end
diff --git a/Data/Scripts/007_Objects and windows/011_Messages.rb b/Data/Scripts/007_Objects and windows/011_Messages.rb
index 1ca715a41..75913cb47 100644
--- a/Data/Scripts/007_Objects and windows/011_Messages.rb
+++ b/Data/Scripts/007_Objects and windows/011_Messages.rb
@@ -436,7 +436,7 @@ def pbDisplayGoldWindow(msgwindow)
end
def pbDisplayCoinsWindow(msgwindow,goldwindow)
- coinString=($PokemonGlobal) ? $PokemonGlobal.coins.to_s_formatted : "0"
+ coinString=($Trainer) ? $Trainer.coins.to_s_formatted : "0"
coinwindow=Window_AdvancedTextPokemon.new(_INTL("Coins:\n{1}",coinString))
coinwindow.setSkin("Graphics/Windowskins/goldskin")
coinwindow.resizeToFit(coinwindow.text,Graphics.width)
diff --git a/Data/Scripts/011_Data/002_PBS data/006_Item.rb b/Data/Scripts/011_Data/002_PBS data/006_Item.rb
index e057ced9e..1eb740205 100644
--- a/Data/Scripts/011_Data/002_PBS data/006_Item.rb
+++ b/Data/Scripts/011_Data/002_PBS data/006_Item.rb
@@ -89,7 +89,7 @@ module GameData
def is_mail?; return @type == 1 || @type == 2; end
def is_icon_mail?; return @type == 2; end
def is_poke_ball?; return @type == 3 || @type == 4; end
- def is_snag_ball?; return @type == 3 || (@type == 4 && $PokemonGlobal.snagMachine); end
+ def is_snag_ball?; return @type == 3 || (@type == 4 && $Trainer.has_snag_machine); end
def is_berry?; return @type == 5; end
def is_key_item?; return @type == 6; end
def is_evolution_stone?; return @type == 7; end
diff --git a/Data/Scripts/012_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb b/Data/Scripts/012_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb
index 88e7f11c3..bba19ef75 100644
--- a/Data/Scripts/012_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb
+++ b/Data/Scripts/012_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb
@@ -40,7 +40,7 @@ class PokeBattle_RealBattlePeer
end
def pbGetStorageCreatorName
- return pbGetStorageCreator if $PokemonGlobal.seenStorageCreator
+ return pbGetStorageCreator if $Trainer.seen_storage_creator
return nil
end
diff --git a/Data/Scripts/013_Overworld/001_Overworld.rb b/Data/Scripts/013_Overworld/001_Overworld.rb
index 9dd1c73b5..18360ea3d 100644
--- a/Data/Scripts/013_Overworld/001_Overworld.rb
+++ b/Data/Scripts/013_Overworld/001_Overworld.rb
@@ -135,9 +135,8 @@ Events.onStepTakenFieldMovement += proc { |_sender,e|
tile_id = map.data[thistile[1],thistile[2],i]
next if tile_id == nil
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
- if event == $game_player && GameData::Item.exists?(:SOOTSACK) && $PokemonBag.pbHasItem?(:SOOTSACK)
- $PokemonGlobal.sootsack = 0 if !$PokemonGlobal.sootsack
- $PokemonGlobal.sootsack += 1
+ if event == $game_player && GameData::Item.exists?(:SOOTSACK)
+ $Trainer.soot += 1 if $PokemonBag.pbHasItem?(:SOOTSACK)
end
# map.data[thistile[1], thistile[2], i] = 0
# $scene.createSingleSpriteset(map.map_id)
diff --git a/Data/Scripts/013_Overworld/002_Overworld_Metadata.rb b/Data/Scripts/013_Overworld/002_Overworld_Metadata.rb
index 0eef01e33..8c3866681 100644
--- a/Data/Scripts/013_Overworld/002_Overworld_Metadata.rb
+++ b/Data/Scripts/013_Overworld/002_Overworld_Metadata.rb
@@ -9,20 +9,15 @@ class PokemonGlobalMetadata
attr_accessor :diving
attr_accessor :sliding
attr_accessor :fishing
- attr_accessor :runningShoes
# Player data
attr_accessor :startTime
attr_accessor :stepcount
attr_accessor :playerID
- attr_accessor :coins
- attr_accessor :sootsack
- attr_accessor :seenStorageCreator
attr_accessor :pcItemStorage
attr_accessor :mailbox
attr_accessor :phoneNumbers
attr_accessor :phoneTime
attr_accessor :partner
- attr_accessor :snagMachine
attr_accessor :creditsPlayed
# Pokédex
attr_accessor :pokedexUnlocked # Deprecated, replaced with Player::Pokedex#unlocked_dexes
@@ -68,20 +63,15 @@ class PokemonGlobalMetadata
@diving = false
@sliding = false
@fishing = false
- @runningShoes = false
# Player data
@startTime = Time.now
@stepcount = 0
@playerID = -1
- @coins = 0
- @sootsack = 0
- @seenStorageCreator = false
@pcItemStorage = nil
@mailbox = nil
@phoneNumbers = []
@phoneTime = 0
@partner = nil
- @snagMachine = false
@creditsPlayed = false
# Pokédex
numRegions = pbLoadRegionalDexes.length
@@ -123,6 +113,70 @@ class PokemonGlobalMetadata
# Save file
@safesave = false
end
+
+ # @deprecated Use {Player#coins} instead. This alias is slated to be removed in v20.
+ def coins
+ Deprecation.warn_method('PokemonGlobalMetadata#coins', 'v20', '$Trainer.coins')
+ return @coins || $Trainer.coins
+ end
+
+ # @deprecated Use {Player#coins=} instead. This alias is slated to be removed in v20.
+ def coins=(value)
+ Deprecation.warn_method('PokemonGlobalMetadata#coins=', 'v20', '$Trainer.coins=')
+ if value.nil?
+ @coins = value # For setting to nil by a save data conversion
+ else
+ $Trainer.coins = value
+ end
+ end
+
+ # @deprecated Use {Player#soot} instead. This alias is slated to be removed in v20.
+ def sootsack
+ Deprecation.warn_method('PokemonGlobalMetadata#sootsack', 'v20', '$Trainer.soot')
+ return @sootsack || $Trainer.soot
+ end
+
+ # @deprecated Use {Player#soot=} instead. This alias is slated to be removed in v20.
+ def sootsack=(value)
+ Deprecation.warn_method('PokemonGlobalMetadata#sootsack=', 'v20', '$Trainer.soot=')
+ if value.nil?
+ @sootsack = value # For setting to nil by a save data conversion
+ else
+ $Trainer.soot = value
+ end
+ end
+
+ # @deprecated Use {Player#has_running_shoes} instead. This alias is slated to be removed in v20.
+ def runningShoes
+ Deprecation.warn_method('PokemonGlobalMetadata#runningShoes', 'v20', '$Trainer.has_running_shoes')
+ return (!@runningShoes.nil?) ? @runningShoes : $Trainer.has_running_shoes
+ end
+
+ # @deprecated Use {Player#has_running_shoes=} instead. This alias is slated to be removed in v20.
+ def runningShoes=(value)
+ Deprecation.warn_method('PokemonGlobalMetadata#runningShoes=', 'v20', '$Trainer.has_running_shoes=')
+ if value.nil?
+ @runningShoes = value # For setting to nil by a save data conversion
+ else
+ $Trainer.has_running_shoes = value
+ end
+ end
+
+ # @deprecated Use {Player#seen_storage_creator} instead. This alias is slated to be removed in v20.
+ def seenStorageCreator
+ Deprecation.warn_method('PokemonGlobalMetadata#seenStorageCreator', 'v20', '$Trainer.seen_storage_creator')
+ return (!@seenStorageCreator.nil?) ? @seenStorageCreator : $Trainer.seen_storage_creator
+ end
+
+ # @deprecated Use {Player#seen_storage_creator=} instead. This alias is slated to be removed in v20.
+ def seenStorageCreator=(value)
+ Deprecation.warn_method('PokemonGlobalMetadata#seenStorageCreator=', 'v20', '$Trainer.seen_storage_creator=')
+ if value.nil?
+ @seenStorageCreator = value # For setting to nil by a save data conversion
+ else
+ $Trainer.seen_storage_creator = value
+ end
+ end
end
diff --git a/Data/Scripts/014_Trainers/004_Player.rb b/Data/Scripts/014_Trainers/004_Player.rb
index 30b222a3f..b5f1bdd59 100644
--- a/Data/Scripts/014_Trainers/004_Player.rb
+++ b/Data/Scripts/014_Trainers/004_Player.rb
@@ -2,15 +2,32 @@
# Trainer class for the player
#===============================================================================
class Player < Trainer
+ # @param value [Integer] new character ID
attr_writer :character_ID
+ # @return [Integer] the player's outfit
attr_accessor :outfit
+ # @return [Array] the player's Gym Badges (true if owned)
attr_accessor :badges
+ # @return [Integer] the player's money
attr_reader :money
+ # @return [Integer] the player's Game Corner coins
+ attr_reader :coins
+ # @return [Integer] the player's battle points
+ attr_reader :battle_points
+ # @return [Integer] the player's soot
+ attr_reader :soot
+ # @return [Pokedex] the player's Pokédex
attr_reader :pokedex
+ # @return [Boolean] whether the Pokédex has been obtained
attr_accessor :has_pokedex
- attr_accessor :pokegear # Whether the Pokégear was obtained
- attr_accessor :mystery_gift_unlocked # Whether MG can be used from load screen
- attr_accessor :mystery_gifts # Variable that stores downloaded MG data
+ # @return [Boolean] whether the Pokégear has been obtained
+ attr_accessor :has_pokegear
+ # @return [Boolean] whether the creator of the Pokémon Storage System has been seen
+ attr_accessor :seen_storage_creator
+ # @return [Boolean] whether Mystery Gift can be used from the load screen
+ attr_accessor :mystery_gift_unlocked
+ # @return [Array] downloaded Mystery Gift data
+ attr_accessor :mystery_gifts
def inspect
str = self.to_s.chop
@@ -19,32 +36,59 @@ class Player < Trainer
return str
end
+ # @return [Integer] the character ID of the player
def character_ID
@character_ID = $PokemonGlobal.playerID || 0 if !@character_ID
return @character_ID
end
+ # Sets the player's money. It can not exceed {Settings::MAX_MONEY}.
+ # @param value [Integer] new money value
def money=(value)
+ validate value => Integer
@money = value.clamp(0, Settings::MAX_MONEY)
end
+ # Sets the player's coins amount. It can not exceed {Settings::MAX_COINS}.
+ # @param value [Integer] new coins value
+ def coins=(value)
+ validate value => Integer
+ @coins = value.clamp(0, Settings::MAX_COINS)
+ end
+
+ # Sets the player's Battle Points amount. It can not exceed
+ # {Settings::MAX_BATTLE_POINTS}.
+ # @param value [Integer] new Battle Points value
+ def battle_points=(value)
+ validate value => Integer
+ @battle_points = value.clamp(0, Settings::MAX_BATTLE_POINTS)
+ end
+
+ # Sets the player's soot amount. It can not exceed {Settings::MAX_SOOT}.
+ # @param value [Integer] new soot value
+ def soot=(value)
+ validate value => Integer
+ @soot = value.clamp(0, Settings::MAX_SOOT)
+ end
+
+ # @return [Integer] the number of Gym Badges owned by the player
def badge_count
- ret = 0
- @badges.each { |b| ret += 1 if b }
- return ret
+ return @badges.count { |badge| badge == true }
end
#=============================================================================
+ # (see Pokedex#seen?)
+ # Shorthand for +self.pokedex.seen?+.
def seen?(species)
return @pokedex.seen?(species)
end
- alias hasSeen? seen?
+ # (see Pokedex#owned?)
+ # Shorthand for +self.pokedex.owned?+.
def owned?(species)
return @pokedex.owned?(species)
end
- alias hasOwned? owned?
#=============================================================================
@@ -54,9 +98,14 @@ class Player < Trainer
@outfit = 0
@badges = [false] * 8
@money = Settings::INITIAL_MONEY
+ @coins = 0
+ @battle_points = 0
+ @soot = 0
@pokedex = Pokedex.new
- @pokegear = false
@has_pokedex = false
+ @has_pokegear = false
+ @has_running_shoes = false
+ @seen_storage_creator = false
@mystery_gift_unlocked = false
@mystery_gifts = []
end
diff --git a/Data/Scripts/014_Trainers/005_Player_Pokedex.rb b/Data/Scripts/014_Trainers/005_Player_Pokedex.rb
index 63b3293a2..e24ba17cb 100644
--- a/Data/Scripts/014_Trainers/005_Player_Pokedex.rb
+++ b/Data/Scripts/014_Trainers/005_Player_Pokedex.rb
@@ -1,4 +1,4 @@
-class Player
+class Player < Trainer
# Represents the player's Pokédex.
class Pokedex
# @return [Array] an array of accessible Dexes
@@ -105,6 +105,9 @@ class Player
return @last_seen_forms[species][0] || 0, @last_seen_forms[species][1] || 0
end
+ # @param species [Symbol, GameData::Species] Pokémon species
+ # @param gender [Integer] gender (0=male, 1=female, 2=genderless)
+ # @param form [Integer] form number
def set_last_form_seen(species, gender = 0, form = 0)
@last_seen_forms[species] = [gender, form]
end
@@ -125,7 +128,7 @@ class Player
def set_shadow_pokemon_owned(species)
species_id = GameData::Species.try_get(species)&.species
return if species_id.nil?
- @owned[species_id] = true
+ @owned_shadow[species_id] = true
self.refresh_accessible_dexes
end
@@ -137,6 +140,14 @@ class Player
return @owned[species_id] == true
end
+ # @param species [Symbol, GameData::Species] species to check
+ # @return [Boolean] whether a Shadow Pokémon of the species is owned
+ def owned_shadow_pokemon?(species)
+ species_id = GameData::Species.try_get(species)&.species
+ return false if species_id.nil?
+ return @owned_shadow[species_id] == true
+ end
+
# Returns the amount of owned Pokémon.
# If a region ID is given, returns the amount of owned Pokémon
# in that region.
@@ -217,12 +228,6 @@ class Player
return @unlocked_dexes.length
end
- # Shorthand for +self.accessible_dexes.length+.
- # @return [Integer] amount of accessible Dexes
- def accessible_dexes_count
- return @accessible_dexes.length
- end
-
# Decides which Dex lists are able to be viewed (i.e. they are unlocked and
# have at least 1 seen species in them), and saves all accessible Dex region
# numbers into {#accessible_dexes}. National Dex comes after all regional
diff --git a/Data/Scripts/014_Trainers/006_Player_Deprecated.rb b/Data/Scripts/014_Trainers/006_Player_Deprecated.rb
index 7457ed1eb..181686e98 100644
--- a/Data/Scripts/014_Trainers/006_Player_Deprecated.rb
+++ b/Data/Scripts/014_Trainers/006_Player_Deprecated.rb
@@ -26,6 +26,7 @@ end
class Player < Trainer
class Pokedex
+ # @deprecated Use {seen?} or {set_seen} instead. This alias is slated to be removed in v20.
attr_reader :seen_forms
end
@@ -33,6 +34,9 @@ class Player < Trainer
deprecated_method_alias :metaID, :character_ID, removal_in: 'v20'
deprecated_method_alias :mysterygiftaccess, :mystery_gift_unlocked, removal_in: 'v20'
deprecated_method_alias :mysterygift, :mystery_gifts, removal_in: 'v20'
+ deprecated_method_alias :hasSeen?, :seen?, removal_in: 'v20'
+ deprecated_method_alias :hasOwned?, :owned?, removal_in: 'v20'
+ deprecated_method_alias :pokegear, :has_pokegear, removal_in: 'v20'
# @deprecated Use {Player::Pokedex#set_seen} instead. This alias is slated to be removed in v20.
def setSeen(species)
@@ -91,10 +95,14 @@ class PokeBattle_Trainer
trainer.seen.each_with_index { |value, i| ret.pokedex.set_seen(i) if value }
trainer.owned.each_with_index { |value, i| ret.pokedex.set_owned(i) if value }
trainer.formseen.each_with_index do |value, i|
- ret.pokedex.seen_forms[GameData::Species.get(i).species] = [value[0].clone, value[1].clone] if value
+ species_id = GameData::Species.try_get(i)&.species
+ next if species_id.nil? || value.nil?
+ ret.pokedex.seen_forms[species_id] = [value[0].clone, value[1].clone] if value
end
trainer.formlastseen.each_with_index do |value, i|
- ret.pokedex.set_last_form_seen(GameData::Species.get(i).species, value[0], value[1]) if value
+ species_id = GameData::Species.try_get(i)&.species
+ next if species_id.nil? || value.nil?
+ ret.pokedex.set_last_form_seen(species_id, value[0], value[1]) if value
end
if trainer.shadowcaught
trainer.shadowcaught.each_with_index do |value, i|
@@ -102,7 +110,7 @@ class PokeBattle_Trainer
end
end
ret.has_pokedex = trainer.pokedex
- ret.pokegear = trainer.pokegear
+ ret.has_pokegear = trainer.pokegear
ret.mystery_gift_unlocked = trainer.mysterygiftaccess if trainer.mysterygiftaccess
ret.mystery_gifts = trainer.mysterygift.clone if trainer.mysterygift
return ret
diff --git a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb
index d4f013122..366e16c58 100644
--- a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb
+++ b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb
@@ -311,7 +311,7 @@ ItemHandlers::UseInField.add(:TOWNMAP,proc { |item|
})
ItemHandlers::UseInField.add(:COINCASE,proc { |item|
- pbMessage(_INTL("Coins: {1}",$PokemonGlobal.coins.to_s_formatted))
+ pbMessage(_INTL("Coins: {1}", $Trainer.coins.to_s_formatted))
next 1
})
diff --git a/Data/Scripts/015_Items/004_PItem_Phone.rb b/Data/Scripts/015_Items/004_PItem_Phone.rb
index cfed81bac..ffbcdd9d9 100644
--- a/Data/Scripts/015_Items/004_PItem_Phone.rb
+++ b/Data/Scripts/015_Items/004_PItem_Phone.rb
@@ -40,7 +40,7 @@ def pbPhoneDeleteContact(index)
end
def pbPhoneRegisterBattle(message,event,trainertype,trainername,maxbattles)
- return if !$Trainer.pokegear # Can't register without a Pokégear
+ return if !$Trainer.has_pokegear # Can't register without a Pokégear
return false if !GameData::TrainerType.exists?(trainertype)
trainertype = GameData::TrainerType.get(trainertype)
contact = pbFindPhoneTrainer(trainertype,trainername)
@@ -133,7 +133,7 @@ end
# Phone-related counters
#===============================================================================
Events.onMapUpdate += proc { |_sender,_e|
- next if !$Trainer || !$Trainer.pokegear
+ next if !$Trainer || !$Trainer.has_pokegear
# Reset time to next phone call if necessary
if !$PokemonGlobal.phoneTime || $PokemonGlobal.phoneTime<=0
$PokemonGlobal.phoneTime = 20*60*Graphics.frame_rate
diff --git a/Data/Scripts/017_UI/001_Animations/001_UI_SplashesAndTitleScreen.rb b/Data/Scripts/017_UI/001_Animations/001_UI_SplashesAndTitleScreen.rb
index 0c4bdfc2e..19526fdc4 100644
--- a/Data/Scripts/017_UI/001_Animations/001_UI_SplashesAndTitleScreen.rb
+++ b/Data/Scripts/017_UI/001_Animations/001_UI_SplashesAndTitleScreen.rb
@@ -1,8 +1,8 @@
class IntroEventScene < EventScene
# Splash screen images that appear for a few seconds and then disappear.
- SPLASH_IMAGES = ['intro1']
+ SPLASH_IMAGES = ['splash1']
# The main title screen background image.
- TITLE_BG_IMAGE = 'splash'
+ TITLE_BG_IMAGE = 'title'
TITLE_START_IMAGE = 'start'
TITLE_START_IMAGE_X = 0
TITLE_START_IMAGE_Y = 322
diff --git a/Data/Scripts/017_UI/001_Animations/002_UI_Controls.rb b/Data/Scripts/017_UI/001_Animations/002_UI_Controls.rb
index 386043094..bca766999 100644
--- a/Data/Scripts/017_UI/001_Animations/002_UI_Controls.rb
+++ b/Data/Scripts/017_UI/001_Animations/002_UI_Controls.rb
@@ -10,27 +10,27 @@ class ButtonEventScene < EventScene
super
Graphics.freeze
@current_screen = 1
- addImage(0, 0, "Graphics/Pictures/help_bg")
+ addImage(0, 0, "Graphics/Pictures/Controls help/help_bg")
@labels = []
@label_screens = []
@keys = []
@key_screens = []
- addImageForScreen(1, 44, 122, "Graphics/Pictures/help_f1")
- addImageForScreen(1, 44, 252, "Graphics/Pictures/help_f8")
+ addImageForScreen(1, 44, 122, "Graphics/Pictures/Controls help/help_f1")
+ addImageForScreen(1, 44, 252, "Graphics/Pictures/Controls help/help_f8")
addLabelForScreen(1, 134, 84, 352, _INTL("Opens the Key Bindings window, where you can choose which keyboard keys to use for each control."))
addLabelForScreen(1, 134, 244, 352, _INTL("Take a screenshot. It is put in the same folder as the save file."))
- addImageForScreen(2, 16, 158, "Graphics/Pictures/help_arrows")
+ addImageForScreen(2, 16, 158, "Graphics/Pictures/Controls help/help_arrows")
addLabelForScreen(2, 134, 100, 352, _INTL("Use the Arrow keys to move the main character.\r\n\r\nYou can also use the Arrow keys to select entries and navigate menus."))
- addImageForScreen(3, 16, 106, "Graphics/Pictures/help_usekey")
- addImageForScreen(3, 16, 236, "Graphics/Pictures/help_backkey")
+ addImageForScreen(3, 16, 106, "Graphics/Pictures/Controls help/help_usekey")
+ addImageForScreen(3, 16, 236, "Graphics/Pictures/Controls help/help_backkey")
addLabelForScreen(3, 134, 84, 352, _INTL("Used to confirm a choice, interact with people and things, and move through text. (Default: C)"))
addLabelForScreen(3, 134, 212, 352, _INTL("Used to exit, cancel a choice, and cancel a mode. Also used to open the Pause Menu. (Default: X)"))
- addImageForScreen(4, 16, 90, "Graphics/Pictures/help_actionkey")
- addImageForScreen(4, 16, 252, "Graphics/Pictures/help_specialkey")
+ addImageForScreen(4, 16, 90, "Graphics/Pictures/Controls help/help_actionkey")
+ addImageForScreen(4, 16, 252, "Graphics/Pictures/Controls help/help_specialkey")
addLabelForScreen(4, 134, 52, 352, _INTL("Has various functions depending on context. While moving around, hold to move at a different speed. (Default: Z)"))
addLabelForScreen(4, 134, 212, 352, _INTL("Press to open the Ready Menu, where registered items and available field moves can be used. (Default: D)"))
diff --git a/Data/Scripts/017_UI/001_UI_PauseMenu.rb b/Data/Scripts/017_UI/001_UI_PauseMenu.rb
index 271c52e6e..6d43a0a6a 100644
--- a/Data/Scripts/017_UI/001_UI_PauseMenu.rb
+++ b/Data/Scripts/017_UI/001_UI_PauseMenu.rb
@@ -113,11 +113,13 @@ class PokemonPauseMenu
cmdDebug = -1
cmdQuit = -1
cmdEndGame = -1
- commands[cmdPokedex = commands.length] = _INTL("Pokédex") if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes_count > 0
- commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party.length>0
- commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest?
- commands[cmdPokegear = commands.length] = _INTL("Pokégear") if $Trainer.pokegear
- commands[cmdTrainer = commands.length] = $Trainer.name
+ if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes.length > 0
+ commands[cmdPokedex = commands.length] = _INTL("Pokédex")
+ end
+ commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party_count > 0
+ commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest?
+ commands[cmdPokegear = commands.length] = _INTL("Pokégear") if $Trainer.has_pokegear
+ commands[cmdTrainer = commands.length] = $Trainer.name
if pbInSafari?
if Settings::SAFARI_STEPS <= 0
@scene.pbShowInfo(_INTL("Balls: {1}",pbSafariState.ballcount))
@@ -125,7 +127,7 @@ class PokemonPauseMenu
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
end
- commands[cmdQuit = commands.length] = _INTL("Quit")
+ commands[cmdQuit = commands.length] = _INTL("Quit")
elsif pbInBugContest?
if pbBugContestState.lastPokemon
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
@@ -135,13 +137,13 @@ class PokemonPauseMenu
else
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}",pbBugContestState.ballcount))
end
- commands[cmdQuit = commands.length] = _INTL("Quit Contest")
+ commands[cmdQuit = commands.length] = _INTL("Quit Contest")
else
- commands[cmdSave = commands.length] = _INTL("Save") if $game_system && !$game_system.save_disabled
+ commands[cmdSave = commands.length] = _INTL("Save") if $game_system && !$game_system.save_disabled
end
- commands[cmdOption = commands.length] = _INTL("Options")
- commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
- commands[cmdEndGame = commands.length] = _INTL("Quit Game")
+ commands[cmdOption = commands.length] = _INTL("Options")
+ commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
+ commands[cmdEndGame = commands.length] = _INTL("Quit Game")
loop do
command = @scene.pbShowCommands(commands)
if cmdPokedex>=0 && command==cmdPokedex
@@ -154,7 +156,7 @@ class PokemonPauseMenu
@scene.pbRefresh
}
else
- if $Trainer.pokedex.accessible_dexes_count == 1
+ if $Trainer.pokedex.accessible_dexes.length == 1
$PokemonGlobal.pokedexDex = $Trainer.pokedex.accessible_dexes[0]
pbFadeOutIn {
scene = PokemonPokedex_Scene.new
diff --git a/Data/Scripts/017_UI/003_UI_PokedexMain.rb b/Data/Scripts/017_UI/003_UI_PokedexMain.rb
index 0d6195768..7f684f7ef 100644
--- a/Data/Scripts/017_UI/003_UI_PokedexMain.rb
+++ b/Data/Scripts/017_UI/003_UI_PokedexMain.rb
@@ -296,9 +296,9 @@ class PokemonPokedex_Scene
# National Dex at the end.
def pbGetSavePositionIndex
index = pbGetPokedexRegion
- if index==-1 # National Dex
- index = $Trainer.pokedex.dexes_count - 1 # National Dex index comes
- end # after regional Dex indices
+ if index==-1 # National Dex (comes after regional Dex indices)
+ index = $Trainer.pokedex.dexes_count - 1
+ end
return index
end
diff --git a/Data/Scripts/017_UI/019_UI_PC.rb b/Data/Scripts/017_UI/019_UI_PC.rb
index 01eb4c624..53d84b696 100644
--- a/Data/Scripts/017_UI/019_UI_PC.rb
+++ b/Data/Scripts/017_UI/019_UI_PC.rb
@@ -25,7 +25,7 @@ class StorageSystemPC
end
def name
- if $PokemonGlobal.seenStorageCreator
+ if $Trainer.seen_storage_creator
return _INTL("{1}'s PC",pbGetStorageCreator)
else
return _INTL("Someone's PC")
diff --git a/Data/Scripts/017_UI/024_UI_PurifyChamber.rb b/Data/Scripts/017_UI/024_UI_PurifyChamber.rb
index e726601aa..d9f549fb1 100644
--- a/Data/Scripts/017_UI/024_UI_PurifyChamber.rb
+++ b/Data/Scripts/017_UI/024_UI_PurifyChamber.rb
@@ -1,14 +1,57 @@
#===============================================================================
#
#===============================================================================
+class Player < Trainer
+ attr_accessor :has_snag_machine
+ attr_accessor :seen_purify_chamber
+
+ alias __shadowPkmn__initialize initialize
+ def initialize(name, trainer_type)
+ __shadowPkmn__initialize(name, trainer_type)
+ @has_snag_machine = false
+ @seen_purify_chamber = false
+ end
+end
+
class PokemonGlobalMetadata
- attr_writer :purifyChamber
- attr_accessor :seenPurifyChamber
+ attr_writer :purifyChamber
def purifyChamber
@purifyChamber = PurifyChamber.new() if !@purifyChamber
return @purifyChamber
end
+
+ # @deprecated Use {Player#seen_purify_chamber} instead. This alias is slated to be removed in v20.
+ def seenPurifyChamber
+ Deprecation.warn_method('PokemonGlobalMetadata#seenPurifyChamber', 'v20', '$Trainer.seen_purify_chamber')
+ return (!@seenPurifyChamber.nil?) ? @seenPurifyChamber : $Trainer.seen_purify_chamber
+ end
+
+ # @deprecated Use {Player#seen_purify_chamber=} instead. This alias is slated to be removed in v20.
+ def seenPurifyChamber=(value)
+ Deprecation.warn_method('PokemonGlobalMetadata#seenPurifyChamber=', 'v20', '$Trainer.seen_purify_chamber=')
+ if value.nil?
+ @seenPurifyChamber = value # For setting to nil by a save data conversion
+ else
+ $Trainer.seen_purify_chamber = value
+ end
+ end
+
+ # @deprecated Use {Player#has_snag_machine} instead. This alias is slated to be removed in v20.
+ def snagMachine
+ Deprecation.warn_method('PokemonGlobalMetadata#snagMachine', 'v20', '$Trainer.has_snag_machine')
+ return (!@snagMachine.nil?) ? @snagMachine : $Trainer.has_snag_machine
+ end
+
+ # @deprecated Use {Player#has_snag_machine=} instead. This alias is slated to be removed in v20.
+ def snagMachine=(value)
+ Deprecation.warn_method('PokemonGlobalMetadata#snagMachine=', 'v20', '$Trainer.has_snag_machine=')
+ if value.nil?
+ @snagMachine = value # For setting to nil by a save data conversion
+ else
+ $Trainer.has_snag_machine = value
+ end
+ end
end
#===============================================================================
@@ -1285,7 +1328,7 @@ end
#
#===============================================================================
def pbPurifyChamber
- $PokemonGlobal.seenPurifyChamber = true
+ $Trainer.seen_purify_chamber = true
pbFadeOutIn {
scene = PurifyChamberScene.new
screen = PurifyChamberScreen.new(scene)
@@ -1298,7 +1341,7 @@ end
#===============================================================================
class PurifyChamberPC
def shouldShow?
- return $PokemonGlobal.seenPurifyChamber
+ return $Trainer.seen_purify_chamber
end
def name
diff --git a/Data/Scripts/018_Minigames/003_Minigame_SlotMachine.rb b/Data/Scripts/018_Minigames/003_Minigame_SlotMachine.rb
index ab4c12ff2..a460a60ac 100644
--- a/Data/Scripts/018_Minigames/003_Minigame_SlotMachine.rb
+++ b/Data/Scripts/018_Minigames/003_Minigame_SlotMachine.rb
@@ -269,7 +269,7 @@ class SlotMachineScene
@sprites["window1"].setBitmap(sprintf("Graphics/Pictures/Slot Machine/insert"))
@sprites["window1"].src_rect.set(0,0,152,208)
@sprites["window2"]=IconSprite.new(358,96,@viewport)
- @sprites["credit"]=SlotMachineScore.new(360,66,$PokemonGlobal.coins)
+ @sprites["credit"]=SlotMachineScore.new(360,66,$Trainer.coins)
@sprites["payout"]=SlotMachineScore.new(438,66,0)
@wager=0
update
@@ -289,7 +289,7 @@ class SlotMachineScene
if @sprites["credit"].score == Settings::MAX_COINS
pbMessage(_INTL("You've got {1} Coins.", Settings::MAX_COINS.to_s_formatted))
break
- elsif $PokemonGlobal.coins==0
+ elsif $Trainer.coins==0
pbMessage(_INTL("You've run out of Coins.\nGame over!"))
break
elsif @gameRunning # Reels are spinning
@@ -361,7 +361,7 @@ class SlotMachineScene
end
frame = (frame+1)%(Graphics.frame_rate*4)
end
- $PokemonGlobal.coins = @sprites["credit"].score
+ $Trainer.coins = @sprites["credit"].score
end
def pbEndScene
@@ -390,9 +390,9 @@ end
def pbSlotMachine(difficulty=1)
if GameData::Item.exists?(:COINCASE) && !$PokemonBag.pbHasItem?(:COINCASE)
pbMessage(_INTL("It's a Slot Machine."))
- elsif $PokemonGlobal.coins==0
+ elsif $Trainer.coins == 0
pbMessage(_INTL("You don't have any Coins to play!"))
- elsif $PokemonGlobal.coins == Settings::MAX_COINS
+ elsif $Trainer.coins == Settings::MAX_COINS
pbMessage(_INTL("Your Coin Case is full!"))
else
pbFadeOutIn {
diff --git a/Data/Scripts/018_Minigames/004_Minigame_VoltorbFlip.rb b/Data/Scripts/018_Minigames/004_Minigame_VoltorbFlip.rb
index f16bd5f1a..609c78968 100644
--- a/Data/Scripts/018_Minigames/004_Minigame_VoltorbFlip.rb
+++ b/Data/Scripts/018_Minigames/004_Minigame_VoltorbFlip.rb
@@ -108,11 +108,11 @@ class VoltorbFlip
@sprites["curtainL"].visible=false
@sprites["curtainR"].visible=false
@sprites["curtain"].opacity=100
- if $PokemonGlobal.coins >= Settings::MAX_COINS
+ if $Trainer.coins >= Settings::MAX_COINS
pbMessage(_INTL("You've gathered {1} Coins. You cannot gather any more.", Settings::MAX_COINS.to_s_formatted))
- $PokemonGlobal.coins = Settings::MAX_COINS # As a precaution
+ $Trainer.coins = Settings::MAX_COINS # As a precaution
@quit=true
-# elsif !pbConfirmMessage(_INTL("Play Voltorb Flip Lv. {1}?",@level)) && $PokemonGlobal.coins<99999
+# elsif !pbConfirmMessage(_INTL("Play Voltorb Flip Lv. {1}?",@level)) && $Trainer.coins proc {
params = ChooseNumberParams.new
params.setRange(0, Settings::MAX_COINS)
- params.setDefaultValue($PokemonGlobal.coins)
- $PokemonGlobal.coins = pbMessageChooseNumber(_INTL("Set the player's Coin amount."), params)
- pbMessage(_INTL("You now have {1} Coins.", $PokemonGlobal.coins.to_s_formatted))
+ params.setDefaultValue($Trainer.coins)
+ $Trainer.coins = pbMessageChooseNumber(_INTL("Set the player's Coin amount."), params)
+ pbMessage(_INTL("You now have {1} Coins.", $Trainer.coins.to_s_formatted))
+ }
+})
+
+DebugMenuCommands.register("setbp", {
+ "parent" => "playermenu",
+ "name" => _INTL("Set Battle Points"),
+ "description" => _INTL("Edit how many Battle Points you have."),
+ "effect" => proc {
+ params = ChooseNumberParams.new
+ params.setRange(0, Settings::MAX_BATTLE_POINTS)
+ params.setDefaultValue($Trainer.battle_points)
+ $Trainer.battle_points = pbMessageChooseNumber(_INTL("Set the player's BP amount."), params)
+ pbMessage(_INTL("You now have {1} BP.", $Trainer.battle_points.to_s_formatted))
}
})
@@ -730,9 +743,9 @@ DebugMenuCommands.register("toggleshoes", {
"name" => _INTL("Toggle Running Shoes"),
"description" => _INTL("Toggle possession of running shoes."),
"effect" => proc {
- $PokemonGlobal.runningShoes = !$PokemonGlobal.runningShoes
- pbMessage(_INTL("Gave Running Shoes.")) if $PokemonGlobal.runningShoes
- pbMessage(_INTL("Lost Running Shoes.")) if !$PokemonGlobal.runningShoes
+ $Trainer.has_running_shoes = !$Trainer.has_running_shoes
+ pbMessage(_INTL("Gave Running Shoes.")) if $Trainer.has_running_shoes
+ pbMessage(_INTL("Lost Running Shoes.")) if !$Trainer.has_running_shoes
}
})
@@ -741,9 +754,9 @@ DebugMenuCommands.register("togglepokegear", {
"name" => _INTL("Toggle Pokégear"),
"description" => _INTL("Toggle possession of the Pokégear."),
"effect" => proc {
- $Trainer.pokegear = !$Trainer.pokegear
- pbMessage(_INTL("Gave Pokégear.")) if $Trainer.pokegear
- pbMessage(_INTL("Lost Pokégear.")) if !$Trainer.pokegear
+ $Trainer.has_pokegear = !$Trainer.has_pokegear
+ pbMessage(_INTL("Gave Pokégear.")) if $Trainer.has_pokegear
+ pbMessage(_INTL("Lost Pokégear.")) if !$Trainer.has_pokegear
}
})
diff --git a/Data/Scripts/022_Compiler/001_Compiler.rb b/Data/Scripts/022_Compiler/001_Compiler.rb
index f464cc253..0aa8f4dba 100644
--- a/Data/Scripts/022_Compiler/001_Compiler.rb
+++ b/Data/Scripts/022_Compiler/001_Compiler.rb
@@ -734,9 +734,9 @@ module Compiler
echoln ""
echoln _INTL("*** Finished full compile ***")
echoln ""
+ System.reload_cache
end
pbSetWindowText(nil)
- System.reload_cache
end
def main