Merged class PokemonTemp into class Game_Temp

This commit is contained in:
Maruno17
2021-10-21 22:01:59 +01:00
parent 5e51f702b3
commit ca680c9feb
37 changed files with 310 additions and 311 deletions

View File

@@ -2,7 +2,6 @@
module Game
# Initializes various global variables and loads the game data.
def self.initialize
$PokemonTemp = PokemonTemp.new
$game_temp = Game_Temp.new
$game_system = Game_System.new
$data_animations = load_data('Data/Animations.rxdata')
@@ -43,7 +42,7 @@ module Game
$game_map.events.each_value { |event| event.clear_starting }
end
$game_temp.common_event_id = 0 if $game_temp
$PokemonTemp.begunNewGame = true
$game_temp.begun_new_game = true
$scene = Scene_Map.new
SaveData.load_new_game_values
$map_factory = PokemonMapFactory.new($data_system.start_map_id)

View File

@@ -84,7 +84,7 @@ class Scene_Map
when 8 then $game_player.turn_up
end
$game_player.straighten
$PokemonTemp.followers.map_transfer_followers
$game_temp.followers.map_transfer_followers
$game_map.update
disposeSpritesets
RPG::Cache.clear
@@ -117,7 +117,7 @@ class Scene_Map
end
def miniupdate
$PokemonTemp.miniupdate = true
$game_temp.in_mini_update = true
loop do
$game_player.update
updateMaps
@@ -128,7 +128,7 @@ class Scene_Map
break if $game_temp.transition_processing
end
updateSpritesets
$PokemonTemp.miniupdate = false
$game_temp.in_mini_update = false
end
def updateMaps
@@ -171,8 +171,8 @@ class Scene_Map
break if $game_temp.transition_processing
end
updateSpritesets
if $game_temp.to_title
$game_temp.to_title = false
if $game_temp.title_screen_calling
$game_temp.title_screen_calling = false
SaveData.mark_values_as_unloaded
$scene = pbCallTitle
return
@@ -188,7 +188,7 @@ class Scene_Map
return if $game_temp.message_window_showing
if !pbMapInterpreterRunning?
if Input.trigger?(Input::USE)
$PokemonTemp.hiddenMoveEventCalling = true
$game_temp.interact_calling = true
elsif Input.trigger?(Input::ACTION)
unless $game_system.menu_disabled || $game_player.moving?
$game_temp.menu_calling = true
@@ -196,7 +196,7 @@ class Scene_Map
end
elsif Input.trigger?(Input::SPECIAL)
unless $game_player.moving?
$PokemonTemp.keyItemCalling = true
$game_temp.ready_menu_calling = true
end
elsif Input.press?(Input::F9)
$game_temp.debug_calling = true if $DEBUG
@@ -207,12 +207,12 @@ class Scene_Map
call_menu
elsif $game_temp.debug_calling
call_debug
elsif $PokemonTemp.keyItemCalling
$PokemonTemp.keyItemCalling = false
elsif $game_temp.ready_menu_calling
$game_temp.ready_menu_calling = false
$game_player.straighten
pbUseKeyItem
elsif $PokemonTemp.hiddenMoveEventCalling
$PokemonTemp.hiddenMoveEventCalling = false
elsif $game_temp.interact_calling
$game_temp.interact_calling = false
$game_player.straighten
Events.onAction.trigger(self)
end
@@ -230,7 +230,7 @@ class Scene_Map
end
Graphics.freeze
disposeSpritesets
if $game_temp.to_title
if $game_temp.title_screen_calling
Graphics.transition
Graphics.freeze
end

View File

@@ -1012,7 +1012,7 @@ class Interpreter
# * Return to Title Screen
#-----------------------------------------------------------------------------
def command_354
$game_temp.to_title = true
$game_temp.title_screen_calling = true
return false
end
#-----------------------------------------------------------------------------

View File

@@ -5,53 +5,82 @@
# Refer to "$game_temp" for the instance of this class.
#===============================================================================
class Game_Temp
attr_accessor :message_window_showing # message window showing
attr_accessor :common_event_id # common event ID
attr_accessor :in_battle # in-battle flag
attr_accessor :in_storage # in-Pokémon storage flag
attr_accessor :battle_abort # battle flag: interrupt
attr_accessor :battleback_name # battleback file name
attr_accessor :in_menu # menu is open
attr_accessor :menu_beep # menu: play sound effect flag
# Flags requesting something to happen
attr_accessor :menu_calling # menu calling flag
attr_accessor :ready_menu_calling # ready menu calling flag
attr_accessor :debug_calling # debug calling flag
attr_accessor :interact_calling # trigger Events.onAction flag
attr_accessor :battle_abort # battle flag: interrupt (unused)
attr_accessor :title_screen_calling # return to title screen flag
attr_accessor :common_event_id # common event ID to start
# Flags indicating something is happening
attr_accessor :in_menu # menu is open
attr_accessor :in_storage # in-Pokémon storage flag
attr_accessor :in_battle # in-battle flag
attr_accessor :message_window_showing # message window showing
attr_accessor :ending_surf # jumping off surf base flag
attr_accessor :surf_base_coords # [x, y] while jumping on/off, or nil
attr_accessor :in_mini_update # performing mini update flag
# Battle
attr_accessor :battleback_name # battleback file name
attr_accessor :force_single_battle # force next battle to be 1v1 flag
attr_accessor :waiting_trainer # [trainer, event ID] or nil
attr_accessor :last_battle_record # record of actions in last recorded battle
# Player transfers
attr_accessor :player_transferring # player place movement flag
attr_accessor :player_new_map_id # player destination: map ID
attr_accessor :player_new_x # player destination: x-coordinate
attr_accessor :player_new_y # player destination: y-coordinate
attr_accessor :player_new_direction # player destination: direction
attr_accessor :fly_destination # [map ID, x, y] or nil
# Transitions
attr_accessor :transition_processing # transition processing flag
attr_accessor :transition_name # transition file name
attr_accessor :to_title # return to title screen flag
attr_accessor :fadestate # for sprite hashes
attr_accessor :background_bitmap
attr_accessor :fadestate # for sprite hashes
# Other
attr_accessor :begun_new_game # new game flag (true fron new game until saving)
attr_accessor :menu_beep # menu: play sound effect flag
attr_accessor :menu_last_choice # pause menu: index of last selection
attr_accessor :darkness_sprite # DarknessSprite or nil
attr_accessor :mart_prices
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@message_window_showing = false
@common_event_id = 0
@in_battle = false
@in_storage = false
@battle_abort = false
@battleback_name = ''
@in_menu = false
@menu_beep = false
# Flags requesting something to happen
@menu_calling = false
@ready_menu_calling = false
@debug_calling = false
@interact_calling = false
@battle_abort = false
@title_screen_calling = false
@common_event_id = 0
# Flags indicating something is happening
@in_menu = false
@in_storage = false
@in_battle = false
@message_window_showing = false
@ending_surf = false
@in_mini_update = false
# Battle
@battleback_name = ''
@force_single_battle = false
# Player transfers
@player_transferring = false
@player_new_map_id = 0
@player_new_x = 0
@player_new_y = 0
@player_new_direction = 0
# Transitions
@transition_processing = false
@transition_name = ""
@to_title = false
@fadestate = 0
@background_bitmap = nil
@message_window_showing = false
@transition_processing = false
# Other
@begun_new_game = false
@menu_beep = false
@menu_last_choice = 0
@mart_prices = {}
end

View File

@@ -85,14 +85,14 @@ class Game_Player < Game_Character
def move_generic(dir, turn_enabled = true)
turn_generic(dir, true) if turn_enabled
if !$PokemonTemp.encounterTriggered
if !$game_temp.encounter_triggered
if can_move_in_direction?(dir)
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
return if pbLedge(x_offset, y_offset)
return if pbEndSurf(x_offset, y_offset)
turn_generic(dir, true)
if !$PokemonTemp.encounterTriggered
if !$game_temp.encounter_triggered
@x += x_offset
@y += y_offset
increase_steps
@@ -101,7 +101,7 @@ class Game_Player < Game_Character
bump_into_object
end
end
$PokemonTemp.encounterTriggered = false
$game_temp.encounter_triggered = false
end
def turn_generic(dir, keep_enc_indicator = false)
@@ -109,7 +109,7 @@ class Game_Player < Game_Character
super(dir)
if @direction != old_direction && !@move_route_forcing && !pbMapInterpreterRunning?
Events.onChangeDirection.trigger(self, self)
$PokemonTemp.encounterTriggered = false if !keep_enc_indicator
$game_temp.encounter_triggered = false if !keep_enc_indicator
end
end
@@ -359,16 +359,16 @@ class Game_Player < Game_Character
# Update dependent events
if (!@moved_last_frame || @stopped_last_frame ||
(@stopped_this_frame && $PokemonGlobal.sliding)) && (moving? || jumping?)
$PokemonTemp.followers.move_followers
$game_temp.followers.move_followers
end
$PokemonTemp.followers.update
$game_temp.followers.update
# Count down the time between allowed bump sounds
@bump_se -= 1 if @bump_se && @bump_se>0
# Finish up dismounting from surfing
if $PokemonTemp.endSurf && !moving?
if $game_temp.ending_surf && !moving?
pbCancelVehicles
$PokemonTemp.surfJump = nil
$PokemonTemp.endSurf = false
$game_temp.surf_base_coords = nil
$game_temp.ending_surf = false
end
update_event_triggering
end
@@ -376,7 +376,7 @@ class Game_Player < Game_Character
def update_command_new
dir = Input.dir4
unless pbMapInterpreterRunning? || $game_temp.message_window_showing ||
$PokemonTemp.miniupdate || $game_temp.in_menu
$game_temp.in_mini_update || $game_temp.in_menu
# Move player in the direction the directional button is being pressed
if @moved_last_frame ||
(dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20)
@@ -469,7 +469,7 @@ class Game_Player < Game_Character
return if moving?
# Try triggering events upon walking into them/in front of them
if @moved_this_frame
$PokemonTemp.followers.turn_followers
$game_temp.followers.turn_followers
result = pbCheckEventTriggerFromDistance([2])
# Event determinant is via touch of same position event
result |= check_event_trigger_here([1,2])
@@ -477,7 +477,7 @@ class Game_Player < Game_Character
pbOnStepTaken(result)
end
# Try to manually interact with events
if Input.trigger?(Input::USE) && !$PokemonTemp.miniupdate
if Input.trigger?(Input::USE) && !$game_temp.in_mini_update
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,2])

View File

@@ -240,7 +240,7 @@ class FollowerSprites
def refresh
@sprites.each { |sprite| sprite.dispose }
@sprites.clear
$PokemonTemp.followers.each_follower do |event, follower|
$game_temp.followers.each_follower do |event, follower|
$map_factory.maps.each do |map|
map.events[follower.event_id].erase if follower.original_map_id == map.map_id
end
@@ -249,9 +249,9 @@ class FollowerSprites
end
def update
if $PokemonTemp.followers.last_update != @last_update
if $game_temp.followers.last_update != @last_update
refresh
@last_update = $PokemonTemp.followers.last_update
@last_update = $game_temp.followers.last_update
end
@sprites.each { |sprite| sprite.update }
end
@@ -260,7 +260,7 @@ end
#===============================================================================
# Stores Game_Follower instances just for the current play session.
#===============================================================================
class PokemonTemp
class Game_Temp
attr_writer :followers
def followers
@@ -292,35 +292,35 @@ module Followers
# @param name [String] identifier name of the follower to be added
# @param common_event_id [Integer] ID of the Common Event triggered when interacting with this follower
def add(event_id, name, common_event_id)
$PokemonTemp.followers.add_follower($game_map.events[event_id], name, common_event_id)
$game_temp.followers.add_follower($game_map.events[event_id], name, common_event_id)
end
# @param event [Game_Event] map event to be added as a follower
def add_event(event)
$PokemonTemp.followers.add_follower(event)
$game_temp.followers.add_follower(event)
end
# @param name [String] identifier name of the follower to be removed
def remove(name)
$PokemonTemp.followers.remove_follower_by_name(name)
$game_temp.followers.remove_follower_by_name(name)
end
# @param event [Game_Event] map event to be removed as a follower
def remove_event(event)
$PokemonTemp.followers.remove_follower_by_event(event)
$game_temp.followers.remove_follower_by_event(event)
end
# Removes all followers.
def clear
$PokemonTemp.followers.remove_all_followers
$game_temp.followers.remove_all_followers
pbDeregisterPartner rescue nil
end
# @param name [String, nil] name of the follower to get, or nil for the first follower
# @return [Game_Follower, nil] follower object
def get(name = nil)
return $PokemonTemp.followers.get_follower_by_name(name) if name
$PokemonTemp.followers.get_follower_by_index
return $game_temp.followers.get_follower_by_name(name) if name
$game_temp.followers.get_follower_by_index
return nil
end
end

View File

@@ -62,9 +62,9 @@ class Sprite_SurfBase
sx = @event.pattern_surf*cw
sy = ((@event.direction-2)/2)*ch
@sprite.src_rect.set(sx,sy,cw,ch)
if $PokemonTemp.surfJump
@sprite.x = ($PokemonTemp.surfJump[0]*Game_Map::REAL_RES_X-@event.map.display_x+3)/4+(Game_Map::TILE_WIDTH/2)
@sprite.y = ($PokemonTemp.surfJump[1]*Game_Map::REAL_RES_Y-@event.map.display_y+3)/4+(Game_Map::TILE_HEIGHT/2)+16
if $game_temp.surf_base_coords
@sprite.x = ($game_temp.surf_base_coords[0] * Game_Map::REAL_RES_X - @event.map.display_x + 3) / 4 + (Game_Map::TILE_WIDTH / 2)
@sprite.y = ($game_temp.surf_base_coords[1] * Game_Map::REAL_RES_Y - @event.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT / 2) + 16
else
@sprite.x = @rsprite.x
@sprite.y = @rsprite.y

View File

@@ -625,9 +625,9 @@ GameData::Evolution.register({
:id => :BattleDealCriticalHit,
:parameter => Integer,
:after_battle_proc => proc { |pkmn, party_index, parameter|
next $PokemonTemp.party_critical_hits_dealt &&
$PokemonTemp.party_critical_hits_dealt[party_index] &&
$PokemonTemp.party_critical_hits_dealt[party_index] >= parameter
next $game_temp.party_critical_hits_dealt &&
$game_temp.party_critical_hits_dealt[party_index] &&
$game_temp.party_critical_hits_dealt[party_index] >= parameter
}
})

View File

@@ -1,25 +1,25 @@
#===============================================================================
# Data caches.
#===============================================================================
class PokemonTemp
attr_accessor :townMapData
attr_accessor :phoneData
attr_accessor :speciesShadowMovesets
attr_accessor :regionalDexes
attr_accessor :battleAnims
attr_accessor :moveToAnim
attr_accessor :mapInfos
class Game_Temp
attr_accessor :town_map_data
attr_accessor :phone_messages_data
attr_accessor :shadow_movesets_data
attr_accessor :regional_dexes_data
attr_accessor :battle_animations_data
attr_accessor :move_to_battle_animation_data
attr_accessor :map_infos
end
def pbClearData
if $PokemonTemp
$PokemonTemp.townMapData = nil
$PokemonTemp.phoneData = nil
$PokemonTemp.speciesShadowMovesets = nil
$PokemonTemp.regionalDexes = nil
$PokemonTemp.battleAnims = nil
$PokemonTemp.moveToAnim = nil
$PokemonTemp.mapInfos = nil
if $game_temp
$game_temp.town_map_data = nil
$game_temp.phone_messages_data = nil
$game_temp.shadow_movesets_data = nil
$game_temp.regional_dexes_data = nil
$game_temp.battle_animations_data = nil
$game_temp.move_to_battle_animation_data = nil
$game_temp.map_infos = nil
end
MapFactoryHelper.clear
$PokemonEncounters.setup($game_map.map_id) if $game_map && $PokemonEncounters
@@ -32,76 +32,76 @@ end
# Method to get Town Map data.
#===============================================================================
def pbLoadTownMapData
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.townMapData
$PokemonTemp.townMapData = load_data("Data/town_map.dat")
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.town_map_data
$game_temp.town_map_data = load_data("Data/town_map.dat")
end
return $PokemonTemp.townMapData
return $game_temp.town_map_data
end
#===============================================================================
# Method to get phone call data.
#===============================================================================
def pbLoadPhoneData
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.phoneData
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.phone_messages_data
if pbRgssExists?("Data/phone.dat")
$PokemonTemp.phoneData = load_data("Data/phone.dat")
$game_temp.phone_messages_data = load_data("Data/phone.dat")
end
end
return $PokemonTemp.phoneData
return $game_temp.phone_messages_data
end
#===============================================================================
# Method to get Shadow Pokémon moveset data.
#===============================================================================
def pbLoadShadowMovesets
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.speciesShadowMovesets
$PokemonTemp.speciesShadowMovesets = load_data("Data/shadow_movesets.dat") || []
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.shadow_movesets_data
$game_temp.shadow_movesets_data = load_data("Data/shadow_movesets.dat") || []
end
return $PokemonTemp.speciesShadowMovesets
return $game_temp.shadow_movesets_data
end
#===============================================================================
# Method to get Regional Dexes data.
#===============================================================================
def pbLoadRegionalDexes
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.regionalDexes
$PokemonTemp.regionalDexes = load_data("Data/regional_dexes.dat")
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.regional_dexes_data
$game_temp.regional_dexes_data = load_data("Data/regional_dexes.dat")
end
return $PokemonTemp.regionalDexes
return $game_temp.regional_dexes_data
end
#===============================================================================
# Methods relating to battle animations data.
#===============================================================================
def pbLoadBattleAnimations
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.battleAnims
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.battle_animations_data
if pbRgssExists?("Data/PkmnAnimations.rxdata")
$PokemonTemp.battleAnims = load_data("Data/PkmnAnimations.rxdata")
$game_temp.battle_animations_data = load_data("Data/PkmnAnimations.rxdata")
end
end
return $PokemonTemp.battleAnims
return $game_temp.battle_animations_data
end
def pbLoadMoveToAnim
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.moveToAnim
$PokemonTemp.moveToAnim = load_data("Data/move2anim.dat") || []
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.move_to_battle_animation_data
$game_temp.move_to_battle_animation_data = load_data("Data/move2anim.dat") || []
end
return $PokemonTemp.moveToAnim
return $game_temp.move_to_battle_animation_data
end
#===============================================================================
# Method relating to map infos data.
#===============================================================================
def pbLoadMapInfos
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.mapInfos
$PokemonTemp.mapInfos = load_data("Data/MapInfos.rxdata")
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.map_infos
$game_temp.map_infos = load_data("Data/MapInfos.rxdata")
end
return $PokemonTemp.mapInfos
return $game_temp.map_infos
end

View File

@@ -284,7 +284,7 @@ class PokeBattle_Move
@battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true)))
end
if target.damageState.critical
$PokemonTemp.party_critical_hits_dealt[user.pokemonIndex] += 1 if user.pbOwnedByPlayer?
$game_temp.party_critical_hits_dealt[user.pokemonIndex] += 1 if user.pbOwnedByPlayer?
if numTargets>1
@battle.pbDisplay(_INTL("A critical hit on {1}!",target.pbThis(true)))
else

View File

@@ -33,8 +33,8 @@
# module PokeBattle_SceneConstants
# def self.pbBattlerPosition
# def self.pbTrainerPosition
# class PokemonTemp
# def recordBattleRule
# class Game_Temp
# def add_battle_rule
# (There is no guarantee that this list is complete.)
class PokeBattle_Battle

View File

@@ -118,7 +118,7 @@ BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battl
BallHandlers::ModifyCatchRate.add(:LUREBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 5 : 3
catchRate *= multiplier if GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
catchRate *= multiplier if GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
next [catchRate,255].min
})

View File

@@ -26,10 +26,10 @@ end
class PokemonTemp
attr_accessor :batterywarning
attr_accessor :cueBGM
attr_accessor :cueFrames
class Game_Temp
attr_accessor :warned_low_battery
attr_accessor :cue_bgm
attr_accessor :cue_bgm_frame_delay
end
@@ -47,22 +47,22 @@ def pbBatteryLow?
end
Events.onMapUpdate += proc { |_sender,_e|
if !$PokemonTemp.batterywarning && pbBatteryLow?
if !$game_temp.warned_low_battery && pbBatteryLow?
if !$game_temp.in_menu && !$game_temp.in_battle &&
!$game_player.move_route_forcing && !$game_temp.message_window_showing &&
!pbMapInterpreterRunning?
if pbGetTimeNow.sec==0
pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress."))
$PokemonTemp.batterywarning = true
$game_temp.warned_low_battery = true
end
end
end
if $PokemonTemp.cueFrames
$PokemonTemp.cueFrames -= 1
if $PokemonTemp.cueFrames<=0
$PokemonTemp.cueFrames = nil
if $game_system.getPlayingBGM==nil
pbBGMPlay($PokemonTemp.cueBGM)
if $game_temp.cue_bgm_frame_delay
$game_temp.cue_bgm_frame_delay -= 1
if $game_temp.cue_bgm_frame_delay <= 0
$game_temp.cue_bgm_frame_delay = nil
if $game_system.getPlayingBGM == nil
pbBGMPlay($game_temp.cue_bgm)
end
end
end
@@ -177,7 +177,7 @@ def pbOnStepTaken(eventTriggered)
Events.onStepTakenTransferPossible.trigger(nil,handled)
return if handled[0]
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
$PokemonTemp.encounterTriggered = false # This info isn't needed here
$game_temp.encounter_triggered = false # This info isn't needed here
end
# Start wild encounters while turning on the spot
@@ -192,7 +192,7 @@ def pbBattleOnStepTaken(repel_active)
encounter_type = $PokemonEncounters.encounter_type
return if !encounter_type
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
$PokemonTemp.encounterType = encounter_type
$game_temp.encounter_type = encounter_type
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
encounter = EncounterModifier.trigger(encounter)
if $PokemonEncounters.allow_encounter?(encounter, repel_active)
@@ -203,10 +203,10 @@ def pbBattleOnStepTaken(repel_active)
else
pbWildBattle(encounter[0], encounter[1])
end
$PokemonTemp.encounterType = nil
$PokemonTemp.encounterTriggered = true
$game_temp.encounter_type = nil
$game_temp.encounter_triggered = true
end
$PokemonTemp.forceSingleBattle = false
$game_temp.force_single_battle = false
EncounterModifier.triggerEncounterEnd
end
@@ -267,15 +267,15 @@ Events.onMapSceneChange += proc { |_sender, e|
# Display darkness circle on dark maps
map_metadata = $game_map.metadata
if map_metadata && map_metadata.dark_map
$PokemonTemp.darknessSprite = DarknessSprite.new
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
$game_temp.darkness_sprite = DarknessSprite.new
scene.spriteset.addUserSprite($game_temp.darkness_sprite)
if $PokemonGlobal.flashUsed
$PokemonTemp.darknessSprite.radius = $PokemonTemp.darknessSprite.radiusMax
$game_temp.darkness_sprite.radius = $game_temp.darkness_sprite.radiusMax
end
else
$PokemonGlobal.flashUsed = false
$PokemonTemp.darknessSprite.dispose if $PokemonTemp.darknessSprite
$PokemonTemp.darknessSprite = nil
$game_temp.darkness_sprite.dispose if $game_temp.darkness_sprite
$game_temp.darkness_sprite = nil
end
# Show location signpost
if mapChanged && map_metadata && map_metadata.announce_location
@@ -398,10 +398,10 @@ def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
playingBGM = $game_system.playing_bgm
if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch
pbBGMFade(seconds)
if !$PokemonTemp.cueFrames
$PokemonTemp.cueFrames = (seconds*Graphics.frame_rate)*3/5
if !$game_temp.cue_bgm_frame_delay
$game_temp.cue_bgm_frame_delay = (seconds * Graphics.frame_rate) * 3 / 5
end
$PokemonTemp.cueBGM=bgm
$game_temp.cue_bgm = bgm
elsif playingBGM
pbBGMPlay(bgm)
end
@@ -546,7 +546,7 @@ end
def pbSlideOnIce
return if !$game_player.pbTerrainTag.ice
$PokemonTemp.followers.update
$game_temp.followers.update
$PokemonGlobal.sliding = true
direction = $game_player.direction
oldwalkanime = $game_player.walk_anime
@@ -557,7 +557,7 @@ def pbSlideOnIce
break if !$game_player.can_move_in_direction?(direction)
break if !$game_player.pbTerrainTag.ice
$game_player.move_forward
$PokemonTemp.followers.move_followers if first_loop
$game_temp.followers.move_followers if first_loop
while $game_player.moving?
pbUpdateSceneMap
Graphics.update
@@ -621,7 +621,7 @@ def pbJumpToward(dist=1,playSound=false,cancelSurf=false)
if $game_player.x!=x || $game_player.y!=y
pbSEPlay("Player jump") if playSound
$PokemonEncounters.reset_step_count if cancelSurf
$PokemonTemp.endSurf = true if cancelSurf
$game_temp.ending_surf = true if cancelSurf
while $game_player.jumping?
Graphics.update
Input.update

View File

@@ -10,23 +10,23 @@ end
class PokemonTemp
attr_accessor :encounterTriggered
attr_accessor :encounterType
class Game_Temp
attr_accessor :encounter_triggered
attr_accessor :encounter_type
attr_accessor :party_levels_before_battle
attr_accessor :party_critical_hits_dealt
def battleRules
@battleRules = {} if !@battleRules
return @battleRules
def battle_rules
@battle_rules = {} if !@battle_rules
return @battle_rules
end
def clearBattleRules
self.battleRules.clear
def clear_battle_rules
self.battle_rules.clear
end
def recordBattleRule(rule,var=nil)
rules = self.battleRules
def add_battle_rule(rule, var = nil)
rules = self.battle_rules
case rule.to_s.downcase
when "single", "1v1", "1v2", "2v1", "1v3", "3v1",
"double", "2v2", "2v3", "3v2", "triple", "3v3"
@@ -67,7 +67,7 @@ def setBattleRule(*args)
r = nil
for arg in args
if r
$PokemonTemp.recordBattleRule(r,arg)
$game_temp.add_battle_rule(r, arg)
r = nil
else
case arg.downcase
@@ -76,7 +76,7 @@ def setBattleRule(*args)
r = arg
next
end
$PokemonTemp.recordBattleRule(arg)
$game_temp.add_battle_rule(arg)
end
end
raise _INTL("Argument {1} expected a variable after it but didn't have one.",r) if r
@@ -88,7 +88,7 @@ end
# Sets up various battle parameters and applies special rules.
def pbPrepareBattle(battle)
battleRules = $PokemonTemp.battleRules
battleRules = $game_temp.battle_rules
# The size of the battle, i.e. how many Pokémon on each side (default: "single")
battle.setBattleMode(battleRules["size"]) if !battleRules["size"].nil?
# Whether the game won't black out even if the player loses (default: false)
@@ -172,8 +172,8 @@ def pbGetEnvironment
ret = :None
map_env = $game_map.metadata&.battle_environment
ret = map_env if map_env
if $PokemonTemp.encounterType &&
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
if $game_temp.encounter_type &&
GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
terrainTag = $game_player.pbFacingTerrainTag
else
terrainTag = $game_player.terrain_tag
@@ -190,11 +190,11 @@ end
Events.onStartBattle += proc { |_sender|
# Record current levels of Pokémon in party, to see if they gain a level
# during battle and may need to evolve afterwards
$PokemonTemp.party_levels_before_battle = []
$PokemonTemp.party_critical_hits_dealt = []
$game_temp.party_levels_before_battle = []
$game_temp.party_critical_hits_dealt = []
$player.party.each_with_index do |pkmn, i|
$PokemonTemp.party_levels_before_battle[i] = pkmn.level
$PokemonTemp.party_critical_hits_dealt[i] = 0
$game_temp.party_levels_before_battle[i] = pkmn.level
$game_temp.party_critical_hits_dealt[i] = 0
end
}
@@ -211,13 +211,13 @@ end
# Start a wild battle
#===============================================================================
def pbWildBattleCore(*args)
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
canLose = $PokemonTemp.battleRules["canLose"] || false
outcomeVar = $game_temp.battle_rules["outcomeVar"] || 1
canLose = $game_temp.battle_rules["canLose"] || false
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
pbMessage(_INTL("SKIPPING BATTLE...")) if $player.pokemon_count > 0
pbSet(outcomeVar,1) # Treat it as a win
$PokemonTemp.clearBattleRules
$game_temp.clear_battle_rules
$PokemonGlobal.nextBattleBGM = nil
$PokemonGlobal.nextBattleME = nil
$PokemonGlobal.nextBattleCaptureME = nil
@@ -253,11 +253,11 @@ def pbWildBattleCore(*args)
playerParty = $player.party
playerPartyStarts = [0]
room_for_partner = (foeParty.length > 1)
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
if !room_for_partner && $game_temp.battle_rules["size"] &&
!["single", "1v1", "1v2", "1v3"].include?($game_temp.battle_rules["size"])
room_for_partner = true
end
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
if $PokemonGlobal.partner && !$game_temp.battle_rules["noPartner"] && room_for_partner
ally = NPCTrainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
ally.id = $PokemonGlobal.partner[2]
ally.party = $PokemonGlobal.partner[3]
@@ -266,7 +266,7 @@ def pbWildBattleCore(*args)
$player.party.each { |pkmn| playerParty.push(pkmn) }
playerPartyStarts.push(playerParty.length)
ally.party.each { |pkmn| playerParty.push(pkmn) }
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
setBattleRule("double") if !$game_temp.battle_rules["size"]
end
# Create the battle scene (the visual side of it)
scene = pbNewBattleScene
@@ -275,7 +275,7 @@ def pbWildBattleCore(*args)
battle.party1starts = playerPartyStarts
# Set various other properties in the battle class
pbPrepareBattle(battle)
$PokemonTemp.clearBattleRules
$game_temp.clear_battle_rules
# Perform the battle itself
decision = 0
pbBattleAnimation(pbGetWildBattleBGM(foeParty),(foeParty.length==1) ? 0 : 2,foeParty) {
@@ -349,14 +349,14 @@ end
# Start a trainer battle
#===============================================================================
def pbTrainerBattleCore(*args)
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
canLose = $PokemonTemp.battleRules["canLose"] || false
outcomeVar = $game_temp.battle_rules["outcomeVar"] || 1
canLose = $game_temp.battle_rules["canLose"] || false
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $player.able_pokemon_count > 0
pbSet(outcomeVar, ($player.able_pokemon_count == 0) ? 0 : 1) # Treat it as undecided/a win
$PokemonTemp.clearBattleRules
$game_temp.clear_battle_rules
$PokemonGlobal.nextBattleBGM = nil
$PokemonGlobal.nextBattleME = nil
$PokemonGlobal.nextBattleCaptureME = nil
@@ -399,11 +399,11 @@ def pbTrainerBattleCore(*args)
playerParty = $player.party
playerPartyStarts = [0]
room_for_partner = (foeParty.length > 1)
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
if !room_for_partner && $game_temp.battle_rules["size"] &&
!["single", "1v1", "1v2", "1v3"].include?($game_temp.battle_rules["size"])
room_for_partner = true
end
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
if $PokemonGlobal.partner && !$game_temp.battle_rules["noPartner"] && room_for_partner
ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
ally.id = $PokemonGlobal.partner[2]
ally.party = $PokemonGlobal.partner[3]
@@ -412,7 +412,7 @@ def pbTrainerBattleCore(*args)
$player.party.each { |pkmn| playerParty.push(pkmn) }
playerPartyStarts.push(playerParty.length)
ally.party.each { |pkmn| playerParty.push(pkmn) }
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
setBattleRule("double") if !$game_temp.battle_rules["size"]
end
# Create the battle scene (the visual side of it)
scene = pbNewBattleScene
@@ -424,7 +424,7 @@ def pbTrainerBattleCore(*args)
battle.endSpeeches = foeEndSpeeches
# Set various other properties in the battle class
pbPrepareBattle(battle)
$PokemonTemp.clearBattleRules
$game_temp.clear_battle_rules
# End the trainer intro music
Audio.me_stop
# Perform the battle itself
@@ -457,10 +457,10 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
# If there is another NPC trainer who spotted the player at the same time, and
# it is possible to have a double battle (the player has 2+ able Pokémon or
# has a partner trainer), then record this first NPC trainer into
# $PokemonTemp.waitingTrainer and end this method. That second NPC event will
# $game_temp.waiting_trainer and end this method. That second NPC event will
# then trigger and cause the battle to happen against this first trainer and
# themselves.
if !$PokemonTemp.waitingTrainer && pbMapInterpreterRunning? &&
if !$game_temp.waiting_trainer && pbMapInterpreterRunning? &&
($player.able_pokemon_count > 1 ||
($player.able_pokemon_count > 0 && $PokemonGlobal.partner))
thisEvent = pbMapInterpreter.get_character(0)
@@ -482,27 +482,27 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
# other triggered trainer event
if otherEvent.length == 1 && trainer.party.length <= Settings::MAX_PARTY_SIZE
trainer.lose_text = endSpeech if endSpeech && !endSpeech.empty?
$PokemonTemp.waitingTrainer = [trainer, thisEvent.id]
$game_temp.waiting_trainer = [trainer, thisEvent.id]
return false
end
end
# Set some battle rules
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
setBattleRule("canLose") if canLose
setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer
setBattleRule("double") if doubleBattle || $game_temp.waiting_trainer
# Perform the battle
if $PokemonTemp.waitingTrainer
decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer[0],
if $game_temp.waiting_trainer
decision = pbTrainerBattleCore($game_temp.waiting_trainer[0],
[trainerID,trainerName,trainerPartyID,endSpeech]
)
else
decision = pbTrainerBattleCore([trainerID,trainerName,trainerPartyID,endSpeech])
end
# Finish off the recorded waiting trainer, because they have now been battled
if decision==1 && $PokemonTemp.waitingTrainer # Win
pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1], "A", true)
if decision==1 && $game_temp.waiting_trainer # Win
pbMapInterpreter.pbSetSelfSwitch($game_temp.waiting_trainer[1], "A", true)
end
$PokemonTemp.waitingTrainer = nil
$game_temp.waiting_trainer = nil
# Return true if the player won the battle, and false if any other result
return (decision==1)
end
@@ -574,8 +574,8 @@ Events.onEndBattle += proc { |_sender,e|
# Check for evolutions
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
(decision!=2 && decision!=5) # not a loss or a draw
$PokemonTemp.party_levels_before_battle = nil
$PokemonTemp.party_critical_hits_dealt = nil
$game_temp.party_levels_before_battle = nil
$game_temp.party_critical_hits_dealt = nil
# Check for blacking out or gaining Pickup/Huney Gather items
case decision
when 1, 4 # Win, capture
@@ -598,9 +598,9 @@ def pbEvolutionCheck
next if pkmn.fainted? && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON
# Find an evolution
new_species = nil
if new_species.nil? && $PokemonTemp.party_levels_before_battle &&
$PokemonTemp.party_levels_before_battle[i] &&
$PokemonTemp.party_levels_before_battle[i] < pkmn.level
if new_species.nil? && $game_temp.party_levels_before_battle &&
$game_temp.party_levels_before_battle[i] &&
$game_temp.party_levels_before_battle[i] < pkmn.level
new_species = pkmn.check_evolution_on_level_up
end
new_species = pkmn.check_evolution_after_battle(i) if new_species.nil?

View File

@@ -71,8 +71,8 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
location = 0 # 0=outside, 1=inside, 2=cave, 3=water
if $PokemonGlobal.surfing || $PokemonGlobal.diving
location = 3
elsif $PokemonTemp.encounterType &&
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
elsif $game_temp.encounter_type &&
GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
location = 3
elsif $PokemonEncounters.has_cave_encounters?
location = 2

View File

@@ -208,7 +208,7 @@ class PokemonEncounters
# Returns whether a wild encounter should be turned into a double wild
# encounter.
def have_double_wild_battle?
return false if $PokemonTemp.forceSingleBattle
return false if $game_temp.force_single_battle
return false if pbInSafari?
return true if $PokemonGlobal.partner
return false if $player.able_pokemon_count <= 1
@@ -459,7 +459,7 @@ end
# Used by fishing rods and Headbutt/Rock Smash/Sweet Scent to generate a wild
# Pokémon (or two) for a triggered wild encounter.
def pbEncounter(enc_type)
$PokemonTemp.encounterType = enc_type
$game_temp.encounter_type = enc_type
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
encounter1 = EncounterModifier.trigger(encounter1)
return false if !encounter1
@@ -471,8 +471,8 @@ def pbEncounter(enc_type)
else
pbWildBattle(encounter1[0], encounter1[1])
end
$PokemonTemp.encounterType = nil
$PokemonTemp.forceSingleBattle = false
$game_temp.encounter_type = nil
$game_temp.force_single_battle = false
EncounterModifier.triggerEncounterEnd
return true
end

View File

@@ -109,8 +109,8 @@ Events.onMapChange += proc { |_sender,e|
#===============================================================================
# Encountering a roaming Pokémon in a wild battle.
#===============================================================================
class PokemonTemp
attr_accessor :roamerIndex # Index of roaming Pokémon to encounter next
class Game_Temp
attr_accessor :roamer_index_for_encounter # Index of roaming Pokémon to encounter next
end
@@ -136,12 +136,12 @@ def pbRoamingMethodAllowed(roamer_method)
end
EncounterModifier.register(proc { |encounter|
$PokemonTemp.roamerIndex = nil
$game_temp.roamer_index_for_encounter = nil
next nil if !encounter
# Give the regular encounter if encountering a roaming Pokémon isn't possible
next encounter if $PokemonGlobal.roamedAlready
next encounter if $PokemonGlobal.partner
next encounter if $PokemonTemp.pokeradar
next encounter if $game_temp.poke_radar_data
next encounter if rand(100) < 75 # 25% chance of encountering a roaming Pokémon
# Look at each roaming Pokémon in turn and decide whether it's possible to
# encounter it
@@ -179,9 +179,9 @@ EncounterModifier.register(proc { |encounter|
# Pick a roaming Pokémon to encounter out of those available
roamer = possible_roamers[rand(possible_roamers.length)]
$PokemonGlobal.roamEncounter = roamer
$PokemonTemp.roamerIndex = roamer[0]
$game_temp.roamer_index_for_encounter = roamer[0]
$PokemonGlobal.nextBattleBGM = roamer[3] if roamer[3] && !roamer[3].empty?
$PokemonTemp.forceSingleBattle = true
$game_temp.force_single_battle = true
next [roamer[1], roamer[2]] # Species, level
})
@@ -190,14 +190,14 @@ Events.onWildBattleOverride += proc { |_sender,e|
level = e[1]
handled = e[2]
next if handled[0]!=nil
next if !$PokemonGlobal.roamEncounter || $PokemonTemp.roamerIndex.nil?
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
handled[0] = pbRoamingPokemonBattle(species, level)
}
def pbRoamingPokemonBattle(species, level)
# Get the roaming Pokémon to encounter; generate it based on the species and
# level if it doesn't already exist
idxRoamer = $PokemonTemp.roamerIndex
idxRoamer = $game_temp.roamer_index_for_encounter
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species,level,true)
@@ -221,5 +221,5 @@ def pbRoamingPokemonBattle(species, level)
end
EncounterModifier.registerEncounterEnd(proc {
$PokemonTemp.roamerIndex = nil
$game_temp.roamer_index_for_encounter = nil
})

View File

@@ -173,32 +173,3 @@ class PokemonMapMetadata
end
end
end
#===============================================================================
# Temporary data which is not saved and which is erased when a game restarts.
#===============================================================================
class PokemonTemp
attr_accessor :menuLastChoice
attr_accessor :keyItemCalling
attr_accessor :hiddenMoveEventCalling
attr_accessor :begunNewGame
attr_accessor :miniupdate
attr_accessor :waitingTrainer
attr_accessor :darknessSprite
attr_accessor :lastbattle
attr_accessor :flydata
attr_accessor :surfJump
attr_accessor :endSurf
attr_accessor :forceSingleBattle
def initialize
@menuLastChoice = 0
@keyItemCalling = false
@hiddenMoveEventCalling = false
@begunNewGame = false
@miniupdate = false
@forceSingleBattle = false
end
end

View File

@@ -470,7 +470,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
})
HiddenMoveHandlers::UseMove.add(:FLASH,proc { |move,pokemon|
darkness = $PokemonTemp.darknessSprite
darkness = $game_temp.darkness_sprite
next false if !darkness || darkness.disposed?
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
@@ -507,10 +507,10 @@ def pbCanFly?(pkmn = nil, show_messages = false)
end
def pbFlyToNewLocation(pkmn = nil, move = :FLY)
return false if !$PokemonTemp.flydata
return false if $game_temp.fly_destination.nil?
pkmn = $player.get_pokemon_with_move(move) if !pkmn
if !$DEBUG && !pkmn
$PokemonTemp.flydata = nil
$game_temp.fly_destination = nil
yield if block_given?
return false
end
@@ -520,11 +520,11 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
end
pbFadeOutIn {
pbSEPlay("Fly")
$game_temp.player_new_map_id = $PokemonTemp.flydata[0]
$game_temp.player_new_x = $PokemonTemp.flydata[1]
$game_temp.player_new_y = $PokemonTemp.flydata[2]
$game_temp.player_new_map_id = $game_temp.fly_destination[0]
$game_temp.player_new_x = $game_temp.fly_destination[1]
$game_temp.player_new_y = $game_temp.fly_destination[2]
$game_temp.player_new_direction = 2
$PokemonTemp.flydata = nil
$game_temp.fly_destination = nil
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
@@ -540,7 +540,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move, pkmn, showmsg|
})
HiddenMoveHandlers::UseMove.add(:FLY,proc { |move, pkmn|
if !$PokemonTemp.flydata
if $game_temp.fly_destination.nil?
pbMessage(_INTL("Can't use that here."))
next false
end
@@ -741,9 +741,9 @@ def pbStartSurfing
$PokemonEncounters.reset_step_count
$PokemonGlobal.surfing = true
pbUpdateVehicle
$PokemonTemp.surfJump = $map_factory.getFacingCoords($game_player.x, $game_player.y, $game_player.direction)
$game_temp.surf_base_coords = $map_factory.getFacingCoords($game_player.x, $game_player.y, $game_player.direction)
pbJumpToward
$PokemonTemp.surfJump = nil
$game_temp.surf_base_coords = nil
$game_player.check_event_trigger_here([1,2])
end
@@ -752,14 +752,14 @@ def pbEndSurf(_xOffset,_yOffset)
x = $game_player.x
y = $game_player.y
if $game_map.terrain_tag(x,y).can_surf && !$game_player.pbFacingTerrainTag.can_surf
$PokemonTemp.surfJump = [x,y]
$game_temp.surf_base_coords = [x, y]
if pbJumpToward(1,false,true)
$game_map.autoplayAsCue
$game_player.increase_steps
result = $game_player.check_event_trigger_here([1,2])
pbOnStepTaken(result)
end
$PokemonTemp.surfJump = nil
$game_temp.surf_base_coords = nil
return true
end
return false

View File

@@ -58,10 +58,10 @@ ItemHandlers::UseFromBag.add(:TOWNMAP, proc { |item|
scene = PokemonRegionMap_Scene.new(-1, false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
$PokemonTemp.flydata = ret if ret
$game_temp.fly_destination = ret if ret
next 99999 if ret # Ugly hack to make Bag scene not reappear if flying
}
next $PokemonTemp.flydata ? 2 : 0
next ($game_temp.fly_destination) ? 2 : 0
})
#===============================================================================
@@ -312,7 +312,7 @@ ItemHandlers::UseInField.add(:ITEMFINDER,proc { |item|
ItemHandlers::UseInField.copy(:ITEMFINDER,:DOWSINGMCHN,:DOWSINGMACHINE)
ItemHandlers::UseInField.add(:TOWNMAP, proc { |item|
pbShowMap(-1, false) if !$PokemonTemp.flydata
pbShowMap(-1, false) if $game_temp.fly_destination.nil?
pbFlyToNewLocation
next true
})

View File

@@ -4,8 +4,8 @@ end
class PokemonTemp
attr_accessor :pokeradar # [species, level, chain count, grasses (x,y,ring,rarity)]
class Game_Temp
attr_accessor :poke_radar_data # [species, level, chain count, grasses (x,y,ring,rarity)]
end
@@ -43,15 +43,15 @@ end
def pbUsePokeRadar
return false if !pbCanUsePokeRadar?
$PokemonTemp.pokeradar = [0,0,0,[],false] if !$PokemonTemp.pokeradar
$PokemonTemp.pokeradar[4] = false
$game_temp.poke_radar_data = [0, 0, 0, [], false] if !$game_temp.poke_radar_data
$game_temp.poke_radar_data[4] = false
$PokemonGlobal.pokeradarBattery = 50
pbPokeRadarHighlightGrass
return true
end
def pbPokeRadarCancel
$PokemonTemp.pokeradar = nil
$game_temp.poke_radar_data = nil
end
def pbPokeRadarHighlightGrass(showmessage=true)
@@ -79,8 +79,8 @@ def pbPokeRadarHighlightGrass(showmessage=true)
if terrain.land_wild_encounters && terrain.shows_grass_rustle
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
s = (rand(100) < 25) ? 1 : 0
if $PokemonTemp.pokeradar && $PokemonTemp.pokeradar[2] > 0
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - $PokemonTemp.pokeradar[2] * 200, 200].max
if $game_temp.poke_radar_data && $game_temp.poke_radar_data[2] > 0
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - $game_temp.poke_radar_data[2] * 200, 200].max
v = (65536 / v.to_f).ceil
s = 2 if rand(65536) < v
end
@@ -104,14 +104,14 @@ def pbPokeRadarHighlightGrass(showmessage=true)
$scene.spriteset.addUserAnimation(Settings::RUSTLE_SHINY_ANIMATION_ID,grass[0],grass[1],true,1)
end
end
$PokemonTemp.pokeradar[3] = grasses if $PokemonTemp.pokeradar
$game_temp.poke_radar_data[3] = grasses if $game_temp.poke_radar_data
pbWait(Graphics.frame_rate/2)
end
end
def pbPokeRadarGetShakingGrass
return -1 if !$PokemonTemp.pokeradar
grasses = $PokemonTemp.pokeradar[3]
return -1 if !$game_temp.poke_radar_data
grasses = $game_temp.poke_radar_data[3]
return -1 if grasses.length == 0
for i in grasses
return i[2] if $game_player.x == i[0] && $game_player.y == i[1]
@@ -151,7 +151,7 @@ end
# Event handlers
################################################################################
EncounterModifier.register(proc { |encounter|
if GameData::EncounterType.get($PokemonTemp.encounterType).type != :land ||
if GameData::EncounterType.get($game_temp.encounter_type).type != :land ||
$PokemonGlobal.bicycle || $PokemonGlobal.partner
pbPokeRadarCancel
next encounter
@@ -160,22 +160,22 @@ EncounterModifier.register(proc { |encounter|
if ring >= 0 # Encounter triggered by stepping into rustling grass
# Get rarity of shaking grass
rarity = 0 # 0 = rustle, 1 = vigorous rustle, 2 = shiny rustle
$PokemonTemp.pokeradar[3].each { |g| rarity = g[3] if g[2] == ring }
if $PokemonTemp.pokeradar[2] > 0 # Chain count, i.e. is chaining
$game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring }
if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining
if rarity == 2 ||
rand(100) < 58 + ring * 10 + ($PokemonTemp.pokeradar[2] / 4) + ($PokemonTemp.pokeradar[4] ? 10 : 0)
rand(100) < 58 + ring * 10 + ($game_temp.poke_radar_data[2] / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0)
# Continue the chain
encounter = [$PokemonTemp.pokeradar[0], $PokemonTemp.pokeradar[1]]
$PokemonTemp.forceSingleBattle = true
encounter = [$game_temp.poke_radar_data[0], $game_temp.poke_radar_data[1]]
$game_temp.force_single_battle = true
else
# Break the chain, force an encounter with a different species
100.times do
break if encounter && encounter[0] != $PokemonTemp.pokeradar[0]
break if encounter && encounter[0] != $game_temp.poke_radar_data[0]
encounter = $PokemonEncounters.choose_wild_pokemon($PokemonEncounters.encounter_type)
end
if encounter[0] == $PokemonTemp.pokeradar[0] && encounter[1] == $PokemonTemp.pokeradar[1]
if encounter[0] == $game_temp.poke_radar_data[0] && encounter[1] == $game_temp.poke_radar_data[1]
# Chain couldn't be broken somehow; continue it after all
$PokemonTemp.forceSingleBattle = true
$game_temp.force_single_battle = true
else
pbPokeRadarCancel
end
@@ -183,7 +183,7 @@ EncounterModifier.register(proc { |encounter|
else # Not chaining; will start one
# Force random wild encounter, vigorous shaking means rarer species
encounter = pbPokeRadarGetEncounter(rarity)
$PokemonTemp.forceSingleBattle = true
$game_temp.force_single_battle = true
end
else # Encounter triggered by stepping in non-rustling grass
pbPokeRadarCancel if encounter
@@ -193,8 +193,8 @@ EncounterModifier.register(proc { |encounter|
Events.onWildPokemonCreate += proc { |_sender,e|
pokemon = e[0]
next if !$PokemonTemp.pokeradar
grasses = $PokemonTemp.pokeradar[3]
next if !$game_temp.poke_radar_data
grasses = $game_temp.poke_radar_data[3]
next if !grasses
for grass in grasses
next if $game_player.x!=grass[0] || $game_player.y!=grass[1]
@@ -207,12 +207,12 @@ Events.onWildBattleEnd += proc { |_sender,e|
species = e[0]
level = e[1]
decision = e[2]
if $PokemonTemp.pokeradar && (decision==1 || decision==4) # Defeated/caught
$PokemonTemp.pokeradar[0] = species
$PokemonTemp.pokeradar[1] = level
$PokemonTemp.pokeradar[2] = [$PokemonTemp.pokeradar[2] + 1, 40].min
if $game_temp.poke_radar_data && (decision==1 || decision==4) # Defeated/caught
$game_temp.poke_radar_data[0] = species
$game_temp.poke_radar_data[1] = level
$game_temp.poke_radar_data[2] = [$game_temp.poke_radar_data[2] + 1, 40].min
# Catching makes the next Radar encounter more likely to continue the chain
$PokemonTemp.pokeradar[4] = (decision == 4)
$game_temp.poke_radar_data[4] = (decision == 4)
pbPokeRadarHighlightGrass(false)
else
pbPokeRadarCancel
@@ -221,7 +221,7 @@ Events.onWildBattleEnd += proc { |_sender,e|
Events.onStepTaken += proc { |_sender,_e|
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery > 0 &&
!$PokemonTemp.pokeradar
!$game_temp.poke_radar_data
$PokemonGlobal.pokeradarBattery -= 1
end
terrain = $game_map.terrain_tag($game_player.x,$game_player.y)

View File

@@ -398,8 +398,8 @@ end
#===============================================================================
#
#===============================================================================
class PokemonTemp
attr_accessor :heart_gauges
class Game_Temp
attr_accessor :party_heart_gauges_before_battle
end
@@ -407,14 +407,14 @@ end
# Record current heart gauges of Pokémon in party, to see if they drop to zero
# during battle and need to say they're ready to be purified afterwards
Events.onStartBattle += proc { |_sender|
$PokemonTemp.heart_gauges = []
$game_temp.party_heart_gauges_before_battle = []
$player.party.each_with_index do |pkmn, i|
$PokemonTemp.heart_gauges[i] = pkmn.heart_gauge
$game_temp.party_heart_gauges_before_battle[i] = pkmn.heart_gauge
end
}
Events.onEndBattle += proc { |_sender,_e|
$PokemonTemp.heart_gauges.each_with_index do |value, i|
$game_temp.party_heart_gauges_before_battle.each_with_index do |value, i|
pkmn = $player.party[i]
next if !pkmn || !value || value == 0
pkmn.check_ready_to_purify if pkmn.heart_gauge == 0

View File

@@ -49,7 +49,7 @@ class PokemonPauseMenu_Scene
ret = -1
cmdwindow = @sprites["cmdwindow"]
cmdwindow.commands = commands
cmdwindow.index = $PokemonTemp.menuLastChoice
cmdwindow.index = $game_temp.menu_last_choice
cmdwindow.resizeToFit(commands)
cmdwindow.x = Graphics.width-cmdwindow.width
cmdwindow.y = 0
@@ -64,7 +64,7 @@ class PokemonPauseMenu_Scene
break
elsif Input.trigger?(Input::USE)
ret = cmdwindow.index
$PokemonTemp.menuLastChoice = ret
$game_temp.menu_last_choice = ret
break
end
end
@@ -212,7 +212,7 @@ class PokemonPauseMenu
scene = PokemonPokegear_Scene.new
screen = PokemonPokegearScreen.new(scene)
screen.pbStartScreen
($PokemonTemp.flydata) ? @scene.pbEndScene : @scene.pbRefresh
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
}
return if pbFlyToNewLocation
elsif cmdTownMap>=0 && command==cmdTownMap
@@ -220,8 +220,8 @@ class PokemonPauseMenu
scene = PokemonRegionMap_Scene.new(-1, false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
$PokemonTemp.flydata = ret if ret
($PokemonTemp.flydata) ? @scene.pbEndScene : @scene.pbRefresh
$game_temp.fly_destination = ret if ret
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
}
return if pbFlyToNewLocation
elsif cmdTrainer>=0 && command==cmdTrainer

View File

@@ -1244,7 +1244,7 @@ class PokemonPartyScreen
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartFlyScreen
if ret
$PokemonTemp.flydata=ret
$game_temp.fly_destination = ret
return [pkmn,pkmn.moves[i].id]
end
@scene.pbStartScene(@party,

View File

@@ -567,7 +567,7 @@ class PokemonBagScreen
end
end
end
($PokemonTemp.flydata) ? @scene.dispose : @scene.pbEndScene
($game_temp.fly_destination) ? @scene.dispose : @scene.pbEndScene
return item
end

View File

@@ -148,11 +148,11 @@ class PokemonPokegearScreen
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
if ret
$PokemonTemp.flydata = ret
$game_temp.fly_destination = ret
next 99999 # Ugly hack to make Pokégear scene not reappear if flying
end
}
break if $PokemonTemp.flydata
break if $game_temp.fly_destination
elsif cmdPhone>=0 && cmd==cmdPhone
pbFadeOutIn {
PokemonPhoneScene.new.start
@@ -165,6 +165,6 @@ class PokemonPokegearScreen
}
end
end
($PokemonTemp.flydata) ? @scene.dispose : @scene.pbEndScene
($game_temp.fly_destination) ? @scene.dispose : @scene.pbEndScene
end
end

View File

@@ -358,6 +358,6 @@ def pbShowMap(region = -1, wallmap = true)
scene = PokemonRegionMap_Scene.new(region, wallmap)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
$PokemonTemp.flydata = ret if ret && !wallmap
$game_temp.fly_destination = ret if ret && !wallmap
}
end

View File

@@ -83,7 +83,7 @@ class PokemonSaveScreen
ret = false
@scene.pbStartScreen
if pbConfirmMessage(_INTL('Would you like to save the game?'))
if SaveData.exists? && $PokemonTemp.begunNewGame
if SaveData.exists? && $game_temp.begun_new_game
pbMessage(_INTL('WARNING!'))
pbMessage(_INTL('There is a different game file that is already saved.'))
pbMessage(_INTL("If you save now, the other file's adventure, including items and Pokémon, will be entirely lost."))
@@ -94,7 +94,7 @@ class PokemonSaveScreen
return false
end
end
$PokemonTemp.begunNewGame = false
$game_temp.begun_new_game = false
pbSEPlay('GUI save choice')
if Game.save
pbMessage(_INTL("\\se[]{1} saved the game.\\me[GUI save game]\\wtnp[30]", $player.name))

View File

@@ -267,7 +267,7 @@ class PokemonReadyMenu
pbShowMenu if !ret
}
if ret
$PokemonTemp.flydata = ret
$game_temp.fly_destination = ret
$game_temp.in_menu = false
pbUseHiddenMove(user,move)
break

View File

@@ -43,7 +43,7 @@ def pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin)
pbMessage(_INTL("SKIPPING BATTLE..."))
pbMessage(_INTL("AFTER WINNING..."))
pbMessage(endspeech || "...")
$PokemonTemp.lastbattle = nil
$game_temp.last_battle_record = nil
pbMEStop
return true
end
@@ -86,9 +86,9 @@ def pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin)
pkmn.item = olditems2[i]
end
# Save the record of the battle
$PokemonTemp.lastbattle = nil
$game_temp.last_battle_record = nil
if decision == 1 || decision == 2 || decision == 5 # if win, loss or draw
$PokemonTemp.lastbattle = battle.pbDumpRecord
$game_temp.last_battle_record = battle.pbDumpRecord
end
# Return true if the player won the battle, and false if any other result
return (decision == 1)
@@ -98,8 +98,8 @@ end
# Methods that record and play back a battle.
#===============================================================================
def pbRecordLastBattle
$PokemonGlobal.lastbattle = $PokemonTemp.lastbattle
$PokemonTemp.lastbattle = nil
$PokemonGlobal.lastbattle = $game_temp.last_battle_record
$game_temp.last_battle_record = nil
end
def pbPlayLastBattle

View File

@@ -241,7 +241,7 @@ def pbTrainerName(name = nil, outfit = 0)
end
$player.name = name
$player.outfit = outfit
$PokemonTemp.begunNewGame = true
$game_temp.begun_new_game = true
end
def pbSuggestTrainerName(gender)

View File

@@ -1366,7 +1366,7 @@ def pbRegionalDexEditorMain
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0 # Save all changes to Dexes
save_data(dex_lists, "Data/regional_dexes.dat")
$PokemonTemp.regionalDexes = nil
$game_temp.regional_dexes_data = nil
Compiler.write_regional_dexes
pbMessage(_INTL("Data saved."))
break
@@ -1489,7 +1489,7 @@ def pbAnimationsOrganiser
if cmd2==0
# Save animations here
save_data(list,"Data/PkmnAnimations.rxdata")
$PokemonTemp.battleAnims = nil
$game_temp.battle_animations_data = nil
pbMessage(_INTL("Data saved."))
end
break

View File

@@ -138,7 +138,7 @@ def pbConvertAnimsToNewFormat
end
if count>0
save_data(animations,"Data/PkmnAnimations.rxdata")
$PokemonTemp.battleAnims = nil
$game_temp.battle_animations_data = nil
end
pbMessage(_INTL("{1} animations converted to new format.",count))
end

View File

@@ -1021,7 +1021,7 @@ def animationEditorMain(animation)
save_data(animation,"Data/PkmnAnimations.rxdata")
end
if pbConfirmMessage(_INTL("Exit from the editor?"))
$PokemonTemp.battleAnims = nil
$game_temp.battle_animations_data = nil
break
end
end

View File

@@ -212,7 +212,7 @@ DebugMenuCommands.register("testwildbattle", {
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",
GameData::Species.get(species).name), params)
if level > 0
$PokemonTemp.encounterType = nil
$game_temp.encounter_type = nil
pbWildBattle(species, level)
end
end
@@ -242,7 +242,7 @@ DebugMenuCommands.register("testwildbattleadvanced", {
next
end
setBattleRule(sprintf("%dv%d", size0, pkmn.length))
$PokemonTemp.encounterType = nil
$game_temp.encounter_type = nil
pbWildBattleCore(*pkmn)
break
elsif pkmnCmd == pkmnCmds.length - 2 # Set player side size

View File

@@ -676,7 +676,7 @@ def pbImportAllAnimations
}
end
save_data(animations,"Data/PkmnAnimations.rxdata")
$PokemonTemp.battleAnims = nil
$game_temp.battle_animations_data = nil
pbDisposeMessageWindow(msgwindow)
pbMessage(_INTL("All animations were imported."))
end

View File

@@ -62,7 +62,7 @@ module Compiler
end
if imported
save_data(mapinfos,"Data/MapInfos.rxdata")
$PokemonTemp.mapInfos = nil
$game_temp.map_infos = nil
pbMessage(_INTL("{1} new map(s) copied to the Data folder were successfully imported.",count))
end
return imported