Moved some global metadata values to class Player, added battle points property

This commit is contained in:
Maruno17
2021-04-12 20:31:15 +01:00
parent e49ddde198
commit 9f70b29795
24 changed files with 283 additions and 94 deletions

View File

@@ -52,6 +52,10 @@ module Settings
MAX_MONEY = 999_999 MAX_MONEY = 999_999
# The maximum number of Game Corner coins the player can have. # The maximum number of Game Corner coins the player can have.
MAX_COINS = 99_999 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. # The maximum length, in characters, that the player's name can be.
MAX_PLAYER_NAME_SIZE = 10 MAX_PLAYER_NAME_SIZE = 10
# The maximum number of Pokémon that can be in the party. # The maximum number of Pokémon that can be in the party.

View File

@@ -46,7 +46,7 @@ end
SaveData.register_conversion(:v19_move_global_data_to_player) do SaveData.register_conversion(:v19_move_global_data_to_player) do
essentials_version 19 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| to_all do |save_data|
global = save_data[:global_metadata] global = save_data[:global_metadata]
player = save_data[:player] player = save_data[:player]
@@ -57,6 +57,18 @@ SaveData.register_conversion(:v19_move_global_data_to_player) do
player.pokedex.lock(i) player.pokedex.lock(i)
end end
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
end end

View File

@@ -24,7 +24,7 @@ class Game_Player < Game_Character
@move_route_forcing || $game_temp.message_window_showing || @move_route_forcing || $game_temp.message_window_showing ||
pbMapInterpreterRunning? pbMapInterpreterRunning?
input = ($PokemonSystem.runstyle == 1) ^ Input.press?(Input::ACTION) 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.diving && !$PokemonGlobal.surfing &&
!$PokemonGlobal.bicycle && !$game_player.pbTerrainTag.must_walk !$PokemonGlobal.bicycle && !$game_player.pbTerrainTag.must_walk
end end

View File

@@ -436,7 +436,7 @@ def pbDisplayGoldWindow(msgwindow)
end end
def pbDisplayCoinsWindow(msgwindow,goldwindow) 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<ar>{1}</ar>",coinString)) coinwindow=Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>",coinString))
coinwindow.setSkin("Graphics/Windowskins/goldskin") coinwindow.setSkin("Graphics/Windowskins/goldskin")
coinwindow.resizeToFit(coinwindow.text,Graphics.width) coinwindow.resizeToFit(coinwindow.text,Graphics.width)

View File

@@ -89,7 +89,7 @@ module GameData
def is_mail?; return @type == 1 || @type == 2; end def is_mail?; return @type == 1 || @type == 2; end
def is_icon_mail?; return @type == 2; end def is_icon_mail?; return @type == 2; end
def is_poke_ball?; return @type == 3 || @type == 4; 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_berry?; return @type == 5; end
def is_key_item?; return @type == 6; end def is_key_item?; return @type == 6; end
def is_evolution_stone?; return @type == 7; end def is_evolution_stone?; return @type == 7; end

View File

@@ -40,7 +40,7 @@ class PokeBattle_RealBattlePeer
end end
def pbGetStorageCreatorName def pbGetStorageCreatorName
return pbGetStorageCreator if $PokemonGlobal.seenStorageCreator return pbGetStorageCreator if $Trainer.seen_storage_creator
return nil return nil
end end

View File

@@ -135,9 +135,8 @@ Events.onStepTakenFieldMovement += proc { |_sender,e|
tile_id = map.data[thistile[1],thistile[2],i] tile_id = map.data[thistile[1],thistile[2],i]
next if tile_id == nil next if tile_id == nil
next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass next if GameData::TerrainTag.try_get(map.terrain_tags[tile_id]).id != :SootGrass
if event == $game_player && GameData::Item.exists?(:SOOTSACK) && $PokemonBag.pbHasItem?(:SOOTSACK) if event == $game_player && GameData::Item.exists?(:SOOTSACK)
$PokemonGlobal.sootsack = 0 if !$PokemonGlobal.sootsack $Trainer.soot += 1 if $PokemonBag.pbHasItem?(:SOOTSACK)
$PokemonGlobal.sootsack += 1
end end
# map.data[thistile[1], thistile[2], i] = 0 # map.data[thistile[1], thistile[2], i] = 0
# $scene.createSingleSpriteset(map.map_id) # $scene.createSingleSpriteset(map.map_id)

View File

@@ -9,20 +9,15 @@ class PokemonGlobalMetadata
attr_accessor :diving attr_accessor :diving
attr_accessor :sliding attr_accessor :sliding
attr_accessor :fishing attr_accessor :fishing
attr_accessor :runningShoes
# Player data # Player data
attr_accessor :startTime attr_accessor :startTime
attr_accessor :stepcount attr_accessor :stepcount
attr_accessor :playerID attr_accessor :playerID
attr_accessor :coins
attr_accessor :sootsack
attr_accessor :seenStorageCreator
attr_accessor :pcItemStorage attr_accessor :pcItemStorage
attr_accessor :mailbox attr_accessor :mailbox
attr_accessor :phoneNumbers attr_accessor :phoneNumbers
attr_accessor :phoneTime attr_accessor :phoneTime
attr_accessor :partner attr_accessor :partner
attr_accessor :snagMachine
attr_accessor :creditsPlayed attr_accessor :creditsPlayed
# Pokédex # Pokédex
attr_accessor :pokedexUnlocked # Deprecated, replaced with Player::Pokedex#unlocked_dexes attr_accessor :pokedexUnlocked # Deprecated, replaced with Player::Pokedex#unlocked_dexes
@@ -68,20 +63,15 @@ class PokemonGlobalMetadata
@diving = false @diving = false
@sliding = false @sliding = false
@fishing = false @fishing = false
@runningShoes = false
# Player data # Player data
@startTime = Time.now @startTime = Time.now
@stepcount = 0 @stepcount = 0
@playerID = -1 @playerID = -1
@coins = 0
@sootsack = 0
@seenStorageCreator = false
@pcItemStorage = nil @pcItemStorage = nil
@mailbox = nil @mailbox = nil
@phoneNumbers = [] @phoneNumbers = []
@phoneTime = 0 @phoneTime = 0
@partner = nil @partner = nil
@snagMachine = false
@creditsPlayed = false @creditsPlayed = false
# Pokédex # Pokédex
numRegions = pbLoadRegionalDexes.length numRegions = pbLoadRegionalDexes.length
@@ -123,6 +113,70 @@ class PokemonGlobalMetadata
# Save file # Save file
@safesave = false @safesave = false
end 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 end

View File

@@ -2,15 +2,32 @@
# Trainer class for the player # Trainer class for the player
#=============================================================================== #===============================================================================
class Player < Trainer class Player < Trainer
# @param value [Integer] new character ID
attr_writer :character_ID attr_writer :character_ID
# @return [Integer] the player's outfit
attr_accessor :outfit attr_accessor :outfit
# @return [Array<Boolean>] the player's Gym Badges (true if owned)
attr_accessor :badges attr_accessor :badges
# @return [Integer] the player's money
attr_reader :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 attr_reader :pokedex
# @return [Boolean] whether the Pokédex has been obtained
attr_accessor :has_pokedex attr_accessor :has_pokedex
attr_accessor :pokegear # Whether the Pokégear was obtained # @return [Boolean] whether the Pokégear has been obtained
attr_accessor :mystery_gift_unlocked # Whether MG can be used from load screen attr_accessor :has_pokegear
attr_accessor :mystery_gifts # Variable that stores downloaded MG data # @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<Array>] downloaded Mystery Gift data
attr_accessor :mystery_gifts
def inspect def inspect
str = self.to_s.chop str = self.to_s.chop
@@ -19,32 +36,59 @@ class Player < Trainer
return str return str
end end
# @return [Integer] the character ID of the player
def character_ID def character_ID
@character_ID = $PokemonGlobal.playerID || 0 if !@character_ID @character_ID = $PokemonGlobal.playerID || 0 if !@character_ID
return @character_ID return @character_ID
end end
# Sets the player's money. It can not exceed {Settings::MAX_MONEY}.
# @param value [Integer] new money value
def money=(value) def money=(value)
validate value => Integer
@money = value.clamp(0, Settings::MAX_MONEY) @money = value.clamp(0, Settings::MAX_MONEY)
end 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 def badge_count
ret = 0 return @badges.count { |badge| badge == true }
@badges.each { |b| ret += 1 if b }
return ret
end end
#============================================================================= #=============================================================================
# (see Pokedex#seen?)
# Shorthand for +self.pokedex.seen?+.
def seen?(species) def seen?(species)
return @pokedex.seen?(species) return @pokedex.seen?(species)
end end
alias hasSeen? seen?
# (see Pokedex#owned?)
# Shorthand for +self.pokedex.owned?+.
def owned?(species) def owned?(species)
return @pokedex.owned?(species) return @pokedex.owned?(species)
end end
alias hasOwned? owned?
#============================================================================= #=============================================================================
@@ -54,9 +98,14 @@ class Player < Trainer
@outfit = 0 @outfit = 0
@badges = [false] * 8 @badges = [false] * 8
@money = Settings::INITIAL_MONEY @money = Settings::INITIAL_MONEY
@coins = 0
@battle_points = 0
@soot = 0
@pokedex = Pokedex.new @pokedex = Pokedex.new
@pokegear = false
@has_pokedex = false @has_pokedex = false
@has_pokegear = false
@has_running_shoes = false
@seen_storage_creator = false
@mystery_gift_unlocked = false @mystery_gift_unlocked = false
@mystery_gifts = [] @mystery_gifts = []
end end

View File

@@ -1,4 +1,4 @@
class Player class Player < Trainer
# Represents the player's Pokédex. # Represents the player's Pokédex.
class Pokedex class Pokedex
# @return [Array<Integer>] an array of accessible Dexes # @return [Array<Integer>] an array of accessible Dexes
@@ -105,6 +105,9 @@ class Player
return @last_seen_forms[species][0] || 0, @last_seen_forms[species][1] || 0 return @last_seen_forms[species][0] || 0, @last_seen_forms[species][1] || 0
end 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) def set_last_form_seen(species, gender = 0, form = 0)
@last_seen_forms[species] = [gender, form] @last_seen_forms[species] = [gender, form]
end end
@@ -125,7 +128,7 @@ class Player
def set_shadow_pokemon_owned(species) def set_shadow_pokemon_owned(species)
species_id = GameData::Species.try_get(species)&.species species_id = GameData::Species.try_get(species)&.species
return if species_id.nil? return if species_id.nil?
@owned[species_id] = true @owned_shadow[species_id] = true
self.refresh_accessible_dexes self.refresh_accessible_dexes
end end
@@ -137,6 +140,14 @@ class Player
return @owned[species_id] == true return @owned[species_id] == true
end 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. # Returns the amount of owned Pokémon.
# If a region ID is given, returns the amount of owned Pokémon # If a region ID is given, returns the amount of owned Pokémon
# in that region. # in that region.
@@ -217,12 +228,6 @@ class Player
return @unlocked_dexes.length return @unlocked_dexes.length
end 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 # 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 # have at least 1 seen species in them), and saves all accessible Dex region
# numbers into {#accessible_dexes}. National Dex comes after all regional # numbers into {#accessible_dexes}. National Dex comes after all regional

View File

@@ -26,6 +26,7 @@ end
class Player < Trainer class Player < Trainer
class Pokedex class Pokedex
# @deprecated Use {seen?} or {set_seen} instead. This alias is slated to be removed in v20.
attr_reader :seen_forms attr_reader :seen_forms
end end
@@ -33,6 +34,9 @@ class Player < Trainer
deprecated_method_alias :metaID, :character_ID, removal_in: 'v20' deprecated_method_alias :metaID, :character_ID, removal_in: 'v20'
deprecated_method_alias :mysterygiftaccess, :mystery_gift_unlocked, 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 :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. # @deprecated Use {Player::Pokedex#set_seen} instead. This alias is slated to be removed in v20.
def setSeen(species) 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.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.owned.each_with_index { |value, i| ret.pokedex.set_owned(i) if value }
trainer.formseen.each_with_index do |value, i| 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 end
trainer.formlastseen.each_with_index do |value, i| 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 end
if trainer.shadowcaught if trainer.shadowcaught
trainer.shadowcaught.each_with_index do |value, i| trainer.shadowcaught.each_with_index do |value, i|
@@ -102,7 +110,7 @@ class PokeBattle_Trainer
end end
end end
ret.has_pokedex = trainer.pokedex 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_gift_unlocked = trainer.mysterygiftaccess if trainer.mysterygiftaccess
ret.mystery_gifts = trainer.mysterygift.clone if trainer.mysterygift ret.mystery_gifts = trainer.mysterygift.clone if trainer.mysterygift
return ret return ret

View File

@@ -311,7 +311,7 @@ ItemHandlers::UseInField.add(:TOWNMAP,proc { |item|
}) })
ItemHandlers::UseInField.add(:COINCASE,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 next 1
}) })

View File

@@ -40,7 +40,7 @@ def pbPhoneDeleteContact(index)
end end
def pbPhoneRegisterBattle(message,event,trainertype,trainername,maxbattles) 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) return false if !GameData::TrainerType.exists?(trainertype)
trainertype = GameData::TrainerType.get(trainertype) trainertype = GameData::TrainerType.get(trainertype)
contact = pbFindPhoneTrainer(trainertype,trainername) contact = pbFindPhoneTrainer(trainertype,trainername)
@@ -133,7 +133,7 @@ end
# Phone-related counters # Phone-related counters
#=============================================================================== #===============================================================================
Events.onMapUpdate += proc { |_sender,_e| Events.onMapUpdate += proc { |_sender,_e|
next if !$Trainer || !$Trainer.pokegear next if !$Trainer || !$Trainer.has_pokegear
# Reset time to next phone call if necessary # Reset time to next phone call if necessary
if !$PokemonGlobal.phoneTime || $PokemonGlobal.phoneTime<=0 if !$PokemonGlobal.phoneTime || $PokemonGlobal.phoneTime<=0
$PokemonGlobal.phoneTime = 20*60*Graphics.frame_rate $PokemonGlobal.phoneTime = 20*60*Graphics.frame_rate

View File

@@ -1,8 +1,8 @@
class IntroEventScene < EventScene class IntroEventScene < EventScene
# Splash screen images that appear for a few seconds and then disappear. # Splash screen images that appear for a few seconds and then disappear.
SPLASH_IMAGES = ['intro1'] SPLASH_IMAGES = ['splash1']
# The main title screen background image. # The main title screen background image.
TITLE_BG_IMAGE = 'splash' TITLE_BG_IMAGE = 'title'
TITLE_START_IMAGE = 'start' TITLE_START_IMAGE = 'start'
TITLE_START_IMAGE_X = 0 TITLE_START_IMAGE_X = 0
TITLE_START_IMAGE_Y = 322 TITLE_START_IMAGE_Y = 322

View File

@@ -10,27 +10,27 @@ class ButtonEventScene < EventScene
super super
Graphics.freeze Graphics.freeze
@current_screen = 1 @current_screen = 1
addImage(0, 0, "Graphics/Pictures/help_bg") addImage(0, 0, "Graphics/Pictures/Controls help/help_bg")
@labels = [] @labels = []
@label_screens = [] @label_screens = []
@keys = [] @keys = []
@key_screens = [] @key_screens = []
addImageForScreen(1, 44, 122, "Graphics/Pictures/help_f1") addImageForScreen(1, 44, 122, "Graphics/Pictures/Controls help/help_f1")
addImageForScreen(1, 44, 252, "Graphics/Pictures/help_f8") 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, 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.")) 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.")) 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, 106, "Graphics/Pictures/Controls help/help_usekey")
addImageForScreen(3, 16, 236, "Graphics/Pictures/help_backkey") 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, 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)")) 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, 90, "Graphics/Pictures/Controls help/help_actionkey")
addImageForScreen(4, 16, 252, "Graphics/Pictures/help_specialkey") 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, 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)")) addLabelForScreen(4, 134, 212, 352, _INTL("Press to open the Ready Menu, where registered items and available field moves can be used. (Default: D)"))

View File

@@ -113,11 +113,13 @@ class PokemonPauseMenu
cmdDebug = -1 cmdDebug = -1
cmdQuit = -1 cmdQuit = -1
cmdEndGame = -1 cmdEndGame = -1
commands[cmdPokedex = commands.length] = _INTL("Pokédex") if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes_count > 0 if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes.length > 0
commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party.length>0 commands[cmdPokedex = commands.length] = _INTL("Pokédex")
commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest? end
commands[cmdPokegear = commands.length] = _INTL("Pokégear") if $Trainer.pokegear commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party_count > 0
commands[cmdTrainer = commands.length] = $Trainer.name 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 pbInSafari?
if Settings::SAFARI_STEPS <= 0 if Settings::SAFARI_STEPS <= 0
@scene.pbShowInfo(_INTL("Balls: {1}",pbSafariState.ballcount)) @scene.pbShowInfo(_INTL("Balls: {1}",pbSafariState.ballcount))
@@ -125,7 +127,7 @@ class PokemonPauseMenu
@scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}", @scene.pbShowInfo(_INTL("Steps: {1}/{2}\nBalls: {3}",
pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount)) pbSafariState.steps, Settings::SAFARI_STEPS, pbSafariState.ballcount))
end end
commands[cmdQuit = commands.length] = _INTL("Quit") commands[cmdQuit = commands.length] = _INTL("Quit")
elsif pbInBugContest? elsif pbInBugContest?
if pbBugContestState.lastPokemon if pbBugContestState.lastPokemon
@scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}", @scene.pbShowInfo(_INTL("Caught: {1}\nLevel: {2}\nBalls: {3}",
@@ -135,13 +137,13 @@ class PokemonPauseMenu
else else
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}",pbBugContestState.ballcount)) @scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}",pbBugContestState.ballcount))
end end
commands[cmdQuit = commands.length] = _INTL("Quit Contest") commands[cmdQuit = commands.length] = _INTL("Quit Contest")
else 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 end
commands[cmdOption = commands.length] = _INTL("Options") commands[cmdOption = commands.length] = _INTL("Options")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[cmdEndGame = commands.length] = _INTL("Quit Game") commands[cmdEndGame = commands.length] = _INTL("Quit Game")
loop do loop do
command = @scene.pbShowCommands(commands) command = @scene.pbShowCommands(commands)
if cmdPokedex>=0 && command==cmdPokedex if cmdPokedex>=0 && command==cmdPokedex
@@ -154,7 +156,7 @@ class PokemonPauseMenu
@scene.pbRefresh @scene.pbRefresh
} }
else else
if $Trainer.pokedex.accessible_dexes_count == 1 if $Trainer.pokedex.accessible_dexes.length == 1
$PokemonGlobal.pokedexDex = $Trainer.pokedex.accessible_dexes[0] $PokemonGlobal.pokedexDex = $Trainer.pokedex.accessible_dexes[0]
pbFadeOutIn { pbFadeOutIn {
scene = PokemonPokedex_Scene.new scene = PokemonPokedex_Scene.new

View File

@@ -296,9 +296,9 @@ class PokemonPokedex_Scene
# National Dex at the end. # National Dex at the end.
def pbGetSavePositionIndex def pbGetSavePositionIndex
index = pbGetPokedexRegion index = pbGetPokedexRegion
if index==-1 # National Dex if index==-1 # National Dex (comes after regional Dex indices)
index = $Trainer.pokedex.dexes_count - 1 # National Dex index comes index = $Trainer.pokedex.dexes_count - 1
end # after regional Dex indices end
return index return index
end end

View File

@@ -25,7 +25,7 @@ class StorageSystemPC
end end
def name def name
if $PokemonGlobal.seenStorageCreator if $Trainer.seen_storage_creator
return _INTL("{1}'s PC",pbGetStorageCreator) return _INTL("{1}'s PC",pbGetStorageCreator)
else else
return _INTL("Someone's PC") return _INTL("Someone's PC")

View File

@@ -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 class PokemonGlobalMetadata
attr_writer :purifyChamber attr_writer :purifyChamber
attr_accessor :seenPurifyChamber
def purifyChamber def purifyChamber
@purifyChamber = PurifyChamber.new() if !@purifyChamber @purifyChamber = PurifyChamber.new() if !@purifyChamber
return @purifyChamber return @purifyChamber
end 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 end
#=============================================================================== #===============================================================================
@@ -1285,7 +1328,7 @@ end
# #
#=============================================================================== #===============================================================================
def pbPurifyChamber def pbPurifyChamber
$PokemonGlobal.seenPurifyChamber = true $Trainer.seen_purify_chamber = true
pbFadeOutIn { pbFadeOutIn {
scene = PurifyChamberScene.new scene = PurifyChamberScene.new
screen = PurifyChamberScreen.new(scene) screen = PurifyChamberScreen.new(scene)
@@ -1298,7 +1341,7 @@ end
#=============================================================================== #===============================================================================
class PurifyChamberPC class PurifyChamberPC
def shouldShow? def shouldShow?
return $PokemonGlobal.seenPurifyChamber return $Trainer.seen_purify_chamber
end end
def name def name

View File

@@ -269,7 +269,7 @@ class SlotMachineScene
@sprites["window1"].setBitmap(sprintf("Graphics/Pictures/Slot Machine/insert")) @sprites["window1"].setBitmap(sprintf("Graphics/Pictures/Slot Machine/insert"))
@sprites["window1"].src_rect.set(0,0,152,208) @sprites["window1"].src_rect.set(0,0,152,208)
@sprites["window2"]=IconSprite.new(358,96,@viewport) @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) @sprites["payout"]=SlotMachineScore.new(438,66,0)
@wager=0 @wager=0
update update
@@ -289,7 +289,7 @@ class SlotMachineScene
if @sprites["credit"].score == Settings::MAX_COINS if @sprites["credit"].score == Settings::MAX_COINS
pbMessage(_INTL("You've got {1} Coins.", Settings::MAX_COINS.to_s_formatted)) pbMessage(_INTL("You've got {1} Coins.", Settings::MAX_COINS.to_s_formatted))
break break
elsif $PokemonGlobal.coins==0 elsif $Trainer.coins==0
pbMessage(_INTL("You've run out of Coins.\nGame over!")) pbMessage(_INTL("You've run out of Coins.\nGame over!"))
break break
elsif @gameRunning # Reels are spinning elsif @gameRunning # Reels are spinning
@@ -361,7 +361,7 @@ class SlotMachineScene
end end
frame = (frame+1)%(Graphics.frame_rate*4) frame = (frame+1)%(Graphics.frame_rate*4)
end end
$PokemonGlobal.coins = @sprites["credit"].score $Trainer.coins = @sprites["credit"].score
end end
def pbEndScene def pbEndScene
@@ -390,9 +390,9 @@ end
def pbSlotMachine(difficulty=1) def pbSlotMachine(difficulty=1)
if GameData::Item.exists?(:COINCASE) && !$PokemonBag.pbHasItem?(:COINCASE) if GameData::Item.exists?(:COINCASE) && !$PokemonBag.pbHasItem?(:COINCASE)
pbMessage(_INTL("It's a Slot Machine.")) 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!")) 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!")) pbMessage(_INTL("Your Coin Case is full!"))
else else
pbFadeOutIn { pbFadeOutIn {

View File

@@ -108,11 +108,11 @@ class VoltorbFlip
@sprites["curtainL"].visible=false @sprites["curtainL"].visible=false
@sprites["curtainR"].visible=false @sprites["curtainR"].visible=false
@sprites["curtain"].opacity=100 @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)) 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 @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<Settings::MAX_COINS
# @quit=true # @quit=true
else else
@sprites["curtain"].opacity=0 @sprites["curtain"].opacity=0
@@ -370,7 +370,7 @@ class VoltorbFlip
# Update level text # Update level text
@sprites["level"].bitmap.clear @sprites["level"].bitmap.clear
pbDrawShadowText(@sprites["level"].bitmap,8,150,118,28,_INTL("Level {1}",@level.to_s),Color.new(60,60,60),Color.new(150,190,170),1) pbDrawShadowText(@sprites["level"].bitmap,8,150,118,28,_INTL("Level {1}",@level.to_s),Color.new(60,60,60),Color.new(150,190,170),1)
$PokemonGlobal.coins+=@points $Trainer.coins+=@points
@points=0 @points=0
pbUpdateCoins pbUpdateCoins
@sprites["curtain"].opacity=0 @sprites["curtain"].opacity=0
@@ -414,7 +414,7 @@ class VoltorbFlip
end end
elsif pbConfirmMessage(_INTL("If you quit now, you will recieve {1} Coin(s). Will you quit?",@points.to_s_formatted)) elsif pbConfirmMessage(_INTL("If you quit now, you will recieve {1} Coin(s). Will you quit?",@points.to_s_formatted))
pbMessage(_INTL("{1} received {2} Coin(s)!",$Trainer.name,@points.to_s_formatted)) pbMessage(_INTL("{1} received {2} Coin(s)!",$Trainer.name,@points.to_s_formatted))
$PokemonGlobal.coins+=@points $Trainer.coins+=@points
@points=0 @points=0
pbUpdateCoins pbUpdateCoins
@sprites["curtain"].opacity=0 @sprites["curtain"].opacity=0
@@ -479,7 +479,7 @@ class VoltorbFlip
def pbUpdateCoins def pbUpdateCoins
# Update coins display # Update coins display
@sprites["totalCoins"].bitmap.clear @sprites["totalCoins"].bitmap.clear
pbCreateCoins($PokemonGlobal.coins,44) pbCreateCoins($Trainer.coins,44)
pbDrawImagePositions(@sprites["totalCoins"].bitmap,@coins) pbDrawImagePositions(@sprites["totalCoins"].bitmap,@coins)
# Update points display # Update points display
@sprites["currentCoins"].bitmap.clear @sprites["currentCoins"].bitmap.clear
@@ -616,7 +616,7 @@ end
def pbVoltorbFlip def pbVoltorbFlip
if GameData::Item.exists?(:COINCASE) && !$PokemonBag.pbHasItem?(:COINCASE) if GameData::Item.exists?(:COINCASE) && !$PokemonBag.pbHasItem?(:COINCASE)
pbMessage(_INTL("You can't play unless you have a Coin Case.")) pbMessage(_INTL("You can't play unless you have a Coin Case."))
elsif $PokemonGlobal.coins == Settings::MAX_COINS elsif $Trainer.coins == Settings::MAX_COINS
pbMessage(_INTL("Your Coin Case is full!")) pbMessage(_INTL("Your Coin Case is full!"))
else else
scene=VoltorbFlip.new scene=VoltorbFlip.new

View File

@@ -26,7 +26,7 @@ def pbStorePokemon(pkmn)
curboxname = $PokemonStorage[oldcurbox].name curboxname = $PokemonStorage[oldcurbox].name
boxname = $PokemonStorage[storedbox].name boxname = $PokemonStorage[storedbox].name
creator = nil creator = nil
creator = pbGetStorageCreator if $PokemonGlobal.seenStorageCreator creator = pbGetStorageCreator if $Trainer.seen_storage_creator
if storedbox != oldcurbox if storedbox != oldcurbox
if creator if creator
pbMessage(_INTL("Box \"{1}\" on {2}'s PC was full.\1", curboxname, creator)) pbMessage(_INTL("Box \"{1}\" on {2}'s PC was full.\1", curboxname, creator))

View File

@@ -719,9 +719,22 @@ DebugMenuCommands.register("setcoins", {
"effect" => proc { "effect" => proc {
params = ChooseNumberParams.new params = ChooseNumberParams.new
params.setRange(0, Settings::MAX_COINS) params.setRange(0, Settings::MAX_COINS)
params.setDefaultValue($PokemonGlobal.coins) params.setDefaultValue($Trainer.coins)
$PokemonGlobal.coins = pbMessageChooseNumber(_INTL("Set the player's Coin amount."), params) $Trainer.coins = pbMessageChooseNumber(_INTL("Set the player's Coin amount."), params)
pbMessage(_INTL("You now have {1} Coins.", $PokemonGlobal.coins.to_s_formatted)) 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"), "name" => _INTL("Toggle Running Shoes"),
"description" => _INTL("Toggle possession of running shoes."), "description" => _INTL("Toggle possession of running shoes."),
"effect" => proc { "effect" => proc {
$PokemonGlobal.runningShoes = !$PokemonGlobal.runningShoes $Trainer.has_running_shoes = !$Trainer.has_running_shoes
pbMessage(_INTL("Gave Running Shoes.")) if $PokemonGlobal.runningShoes pbMessage(_INTL("Gave Running Shoes.")) if $Trainer.has_running_shoes
pbMessage(_INTL("Lost Running Shoes.")) if !$PokemonGlobal.runningShoes pbMessage(_INTL("Lost Running Shoes.")) if !$Trainer.has_running_shoes
} }
}) })
@@ -741,9 +754,9 @@ DebugMenuCommands.register("togglepokegear", {
"name" => _INTL("Toggle Pokégear"), "name" => _INTL("Toggle Pokégear"),
"description" => _INTL("Toggle possession of the Pokégear."), "description" => _INTL("Toggle possession of the Pokégear."),
"effect" => proc { "effect" => proc {
$Trainer.pokegear = !$Trainer.pokegear $Trainer.has_pokegear = !$Trainer.has_pokegear
pbMessage(_INTL("Gave Pokégear.")) if $Trainer.pokegear pbMessage(_INTL("Gave Pokégear.")) if $Trainer.has_pokegear
pbMessage(_INTL("Lost Pokégear.")) if !$Trainer.pokegear pbMessage(_INTL("Lost Pokégear.")) if !$Trainer.has_pokegear
} }
}) })

View File

@@ -734,9 +734,9 @@ module Compiler
echoln "" echoln ""
echoln _INTL("*** Finished full compile ***") echoln _INTL("*** Finished full compile ***")
echoln "" echoln ""
System.reload_cache
end end
pbSetWindowText(nil) pbSetWindowText(nil)
System.reload_cache
end end
def main def main