mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
Merged class PokemonTemp into class Game_Temp
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
module Game
|
module Game
|
||||||
# Initializes various global variables and loads the game data.
|
# Initializes various global variables and loads the game data.
|
||||||
def self.initialize
|
def self.initialize
|
||||||
$PokemonTemp = PokemonTemp.new
|
|
||||||
$game_temp = Game_Temp.new
|
$game_temp = Game_Temp.new
|
||||||
$game_system = Game_System.new
|
$game_system = Game_System.new
|
||||||
$data_animations = load_data('Data/Animations.rxdata')
|
$data_animations = load_data('Data/Animations.rxdata')
|
||||||
@@ -43,7 +42,7 @@ module Game
|
|||||||
$game_map.events.each_value { |event| event.clear_starting }
|
$game_map.events.each_value { |event| event.clear_starting }
|
||||||
end
|
end
|
||||||
$game_temp.common_event_id = 0 if $game_temp
|
$game_temp.common_event_id = 0 if $game_temp
|
||||||
$PokemonTemp.begunNewGame = true
|
$game_temp.begun_new_game = true
|
||||||
$scene = Scene_Map.new
|
$scene = Scene_Map.new
|
||||||
SaveData.load_new_game_values
|
SaveData.load_new_game_values
|
||||||
$map_factory = PokemonMapFactory.new($data_system.start_map_id)
|
$map_factory = PokemonMapFactory.new($data_system.start_map_id)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class Scene_Map
|
|||||||
when 8 then $game_player.turn_up
|
when 8 then $game_player.turn_up
|
||||||
end
|
end
|
||||||
$game_player.straighten
|
$game_player.straighten
|
||||||
$PokemonTemp.followers.map_transfer_followers
|
$game_temp.followers.map_transfer_followers
|
||||||
$game_map.update
|
$game_map.update
|
||||||
disposeSpritesets
|
disposeSpritesets
|
||||||
RPG::Cache.clear
|
RPG::Cache.clear
|
||||||
@@ -117,7 +117,7 @@ class Scene_Map
|
|||||||
end
|
end
|
||||||
|
|
||||||
def miniupdate
|
def miniupdate
|
||||||
$PokemonTemp.miniupdate = true
|
$game_temp.in_mini_update = true
|
||||||
loop do
|
loop do
|
||||||
$game_player.update
|
$game_player.update
|
||||||
updateMaps
|
updateMaps
|
||||||
@@ -128,7 +128,7 @@ class Scene_Map
|
|||||||
break if $game_temp.transition_processing
|
break if $game_temp.transition_processing
|
||||||
end
|
end
|
||||||
updateSpritesets
|
updateSpritesets
|
||||||
$PokemonTemp.miniupdate = false
|
$game_temp.in_mini_update = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def updateMaps
|
def updateMaps
|
||||||
@@ -171,8 +171,8 @@ class Scene_Map
|
|||||||
break if $game_temp.transition_processing
|
break if $game_temp.transition_processing
|
||||||
end
|
end
|
||||||
updateSpritesets
|
updateSpritesets
|
||||||
if $game_temp.to_title
|
if $game_temp.title_screen_calling
|
||||||
$game_temp.to_title = false
|
$game_temp.title_screen_calling = false
|
||||||
SaveData.mark_values_as_unloaded
|
SaveData.mark_values_as_unloaded
|
||||||
$scene = pbCallTitle
|
$scene = pbCallTitle
|
||||||
return
|
return
|
||||||
@@ -188,7 +188,7 @@ class Scene_Map
|
|||||||
return if $game_temp.message_window_showing
|
return if $game_temp.message_window_showing
|
||||||
if !pbMapInterpreterRunning?
|
if !pbMapInterpreterRunning?
|
||||||
if Input.trigger?(Input::USE)
|
if Input.trigger?(Input::USE)
|
||||||
$PokemonTemp.hiddenMoveEventCalling = true
|
$game_temp.interact_calling = true
|
||||||
elsif Input.trigger?(Input::ACTION)
|
elsif Input.trigger?(Input::ACTION)
|
||||||
unless $game_system.menu_disabled || $game_player.moving?
|
unless $game_system.menu_disabled || $game_player.moving?
|
||||||
$game_temp.menu_calling = true
|
$game_temp.menu_calling = true
|
||||||
@@ -196,7 +196,7 @@ class Scene_Map
|
|||||||
end
|
end
|
||||||
elsif Input.trigger?(Input::SPECIAL)
|
elsif Input.trigger?(Input::SPECIAL)
|
||||||
unless $game_player.moving?
|
unless $game_player.moving?
|
||||||
$PokemonTemp.keyItemCalling = true
|
$game_temp.ready_menu_calling = true
|
||||||
end
|
end
|
||||||
elsif Input.press?(Input::F9)
|
elsif Input.press?(Input::F9)
|
||||||
$game_temp.debug_calling = true if $DEBUG
|
$game_temp.debug_calling = true if $DEBUG
|
||||||
@@ -207,12 +207,12 @@ class Scene_Map
|
|||||||
call_menu
|
call_menu
|
||||||
elsif $game_temp.debug_calling
|
elsif $game_temp.debug_calling
|
||||||
call_debug
|
call_debug
|
||||||
elsif $PokemonTemp.keyItemCalling
|
elsif $game_temp.ready_menu_calling
|
||||||
$PokemonTemp.keyItemCalling = false
|
$game_temp.ready_menu_calling = false
|
||||||
$game_player.straighten
|
$game_player.straighten
|
||||||
pbUseKeyItem
|
pbUseKeyItem
|
||||||
elsif $PokemonTemp.hiddenMoveEventCalling
|
elsif $game_temp.interact_calling
|
||||||
$PokemonTemp.hiddenMoveEventCalling = false
|
$game_temp.interact_calling = false
|
||||||
$game_player.straighten
|
$game_player.straighten
|
||||||
Events.onAction.trigger(self)
|
Events.onAction.trigger(self)
|
||||||
end
|
end
|
||||||
@@ -230,7 +230,7 @@ class Scene_Map
|
|||||||
end
|
end
|
||||||
Graphics.freeze
|
Graphics.freeze
|
||||||
disposeSpritesets
|
disposeSpritesets
|
||||||
if $game_temp.to_title
|
if $game_temp.title_screen_calling
|
||||||
Graphics.transition
|
Graphics.transition
|
||||||
Graphics.freeze
|
Graphics.freeze
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1012,7 +1012,7 @@ class Interpreter
|
|||||||
# * Return to Title Screen
|
# * Return to Title Screen
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def command_354
|
def command_354
|
||||||
$game_temp.to_title = true
|
$game_temp.title_screen_calling = true
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -5,53 +5,82 @@
|
|||||||
# Refer to "$game_temp" for the instance of this class.
|
# Refer to "$game_temp" for the instance of this class.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Game_Temp
|
class Game_Temp
|
||||||
attr_accessor :message_window_showing # message window showing
|
# Flags requesting something to happen
|
||||||
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
|
|
||||||
attr_accessor :menu_calling # menu calling flag
|
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 :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_transferring # player place movement flag
|
||||||
attr_accessor :player_new_map_id # player destination: map ID
|
attr_accessor :player_new_map_id # player destination: map ID
|
||||||
attr_accessor :player_new_x # player destination: x-coordinate
|
attr_accessor :player_new_x # player destination: x-coordinate
|
||||||
attr_accessor :player_new_y # player destination: y-coordinate
|
attr_accessor :player_new_y # player destination: y-coordinate
|
||||||
attr_accessor :player_new_direction # player destination: direction
|
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_processing # transition processing flag
|
||||||
attr_accessor :transition_name # transition file name
|
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 :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
|
attr_accessor :mart_prices
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# * Object Initialization
|
# * Object Initialization
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def initialize
|
def initialize
|
||||||
@message_window_showing = false
|
# Flags requesting something to happen
|
||||||
@common_event_id = 0
|
|
||||||
@in_battle = false
|
|
||||||
@in_storage = false
|
|
||||||
@battle_abort = false
|
|
||||||
@battleback_name = ''
|
|
||||||
@in_menu = false
|
|
||||||
@menu_beep = false
|
|
||||||
@menu_calling = false
|
@menu_calling = false
|
||||||
|
@ready_menu_calling = false
|
||||||
@debug_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_transferring = false
|
||||||
@player_new_map_id = 0
|
@player_new_map_id = 0
|
||||||
@player_new_x = 0
|
@player_new_x = 0
|
||||||
@player_new_y = 0
|
@player_new_y = 0
|
||||||
@player_new_direction = 0
|
@player_new_direction = 0
|
||||||
|
# Transitions
|
||||||
@transition_processing = false
|
@transition_processing = false
|
||||||
@transition_name = ""
|
@transition_name = ""
|
||||||
@to_title = false
|
|
||||||
@fadestate = 0
|
@fadestate = 0
|
||||||
@background_bitmap = nil
|
# Other
|
||||||
@message_window_showing = false
|
@begun_new_game = false
|
||||||
@transition_processing = false
|
@menu_beep = false
|
||||||
|
@menu_last_choice = 0
|
||||||
@mart_prices = {}
|
@mart_prices = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -85,14 +85,14 @@ class Game_Player < Game_Character
|
|||||||
|
|
||||||
def move_generic(dir, turn_enabled = true)
|
def move_generic(dir, turn_enabled = true)
|
||||||
turn_generic(dir, true) if turn_enabled
|
turn_generic(dir, true) if turn_enabled
|
||||||
if !$PokemonTemp.encounterTriggered
|
if !$game_temp.encounter_triggered
|
||||||
if can_move_in_direction?(dir)
|
if can_move_in_direction?(dir)
|
||||||
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
|
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
|
||||||
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
|
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
|
||||||
return if pbLedge(x_offset, y_offset)
|
return if pbLedge(x_offset, y_offset)
|
||||||
return if pbEndSurf(x_offset, y_offset)
|
return if pbEndSurf(x_offset, y_offset)
|
||||||
turn_generic(dir, true)
|
turn_generic(dir, true)
|
||||||
if !$PokemonTemp.encounterTriggered
|
if !$game_temp.encounter_triggered
|
||||||
@x += x_offset
|
@x += x_offset
|
||||||
@y += y_offset
|
@y += y_offset
|
||||||
increase_steps
|
increase_steps
|
||||||
@@ -101,7 +101,7 @@ class Game_Player < Game_Character
|
|||||||
bump_into_object
|
bump_into_object
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
$PokemonTemp.encounterTriggered = false
|
$game_temp.encounter_triggered = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def turn_generic(dir, keep_enc_indicator = false)
|
def turn_generic(dir, keep_enc_indicator = false)
|
||||||
@@ -109,7 +109,7 @@ class Game_Player < Game_Character
|
|||||||
super(dir)
|
super(dir)
|
||||||
if @direction != old_direction && !@move_route_forcing && !pbMapInterpreterRunning?
|
if @direction != old_direction && !@move_route_forcing && !pbMapInterpreterRunning?
|
||||||
Events.onChangeDirection.trigger(self, self)
|
Events.onChangeDirection.trigger(self, self)
|
||||||
$PokemonTemp.encounterTriggered = false if !keep_enc_indicator
|
$game_temp.encounter_triggered = false if !keep_enc_indicator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -359,16 +359,16 @@ class Game_Player < Game_Character
|
|||||||
# Update dependent events
|
# Update dependent events
|
||||||
if (!@moved_last_frame || @stopped_last_frame ||
|
if (!@moved_last_frame || @stopped_last_frame ||
|
||||||
(@stopped_this_frame && $PokemonGlobal.sliding)) && (moving? || jumping?)
|
(@stopped_this_frame && $PokemonGlobal.sliding)) && (moving? || jumping?)
|
||||||
$PokemonTemp.followers.move_followers
|
$game_temp.followers.move_followers
|
||||||
end
|
end
|
||||||
$PokemonTemp.followers.update
|
$game_temp.followers.update
|
||||||
# Count down the time between allowed bump sounds
|
# Count down the time between allowed bump sounds
|
||||||
@bump_se -= 1 if @bump_se && @bump_se>0
|
@bump_se -= 1 if @bump_se && @bump_se>0
|
||||||
# Finish up dismounting from surfing
|
# Finish up dismounting from surfing
|
||||||
if $PokemonTemp.endSurf && !moving?
|
if $game_temp.ending_surf && !moving?
|
||||||
pbCancelVehicles
|
pbCancelVehicles
|
||||||
$PokemonTemp.surfJump = nil
|
$game_temp.surf_base_coords = nil
|
||||||
$PokemonTemp.endSurf = false
|
$game_temp.ending_surf = false
|
||||||
end
|
end
|
||||||
update_event_triggering
|
update_event_triggering
|
||||||
end
|
end
|
||||||
@@ -376,7 +376,7 @@ class Game_Player < Game_Character
|
|||||||
def update_command_new
|
def update_command_new
|
||||||
dir = Input.dir4
|
dir = Input.dir4
|
||||||
unless pbMapInterpreterRunning? || $game_temp.message_window_showing ||
|
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
|
# Move player in the direction the directional button is being pressed
|
||||||
if @moved_last_frame ||
|
if @moved_last_frame ||
|
||||||
(dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20)
|
(dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20)
|
||||||
@@ -469,7 +469,7 @@ class Game_Player < Game_Character
|
|||||||
return if moving?
|
return if moving?
|
||||||
# Try triggering events upon walking into them/in front of them
|
# Try triggering events upon walking into them/in front of them
|
||||||
if @moved_this_frame
|
if @moved_this_frame
|
||||||
$PokemonTemp.followers.turn_followers
|
$game_temp.followers.turn_followers
|
||||||
result = pbCheckEventTriggerFromDistance([2])
|
result = pbCheckEventTriggerFromDistance([2])
|
||||||
# Event determinant is via touch of same position event
|
# Event determinant is via touch of same position event
|
||||||
result |= check_event_trigger_here([1,2])
|
result |= check_event_trigger_here([1,2])
|
||||||
@@ -477,7 +477,7 @@ class Game_Player < Game_Character
|
|||||||
pbOnStepTaken(result)
|
pbOnStepTaken(result)
|
||||||
end
|
end
|
||||||
# Try to manually interact with events
|
# 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
|
# Same position and front event determinant
|
||||||
check_event_trigger_here([0])
|
check_event_trigger_here([0])
|
||||||
check_event_trigger_there([0,2])
|
check_event_trigger_there([0,2])
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ class FollowerSprites
|
|||||||
def refresh
|
def refresh
|
||||||
@sprites.each { |sprite| sprite.dispose }
|
@sprites.each { |sprite| sprite.dispose }
|
||||||
@sprites.clear
|
@sprites.clear
|
||||||
$PokemonTemp.followers.each_follower do |event, follower|
|
$game_temp.followers.each_follower do |event, follower|
|
||||||
$map_factory.maps.each do |map|
|
$map_factory.maps.each do |map|
|
||||||
map.events[follower.event_id].erase if follower.original_map_id == map.map_id
|
map.events[follower.event_id].erase if follower.original_map_id == map.map_id
|
||||||
end
|
end
|
||||||
@@ -249,9 +249,9 @@ class FollowerSprites
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if $PokemonTemp.followers.last_update != @last_update
|
if $game_temp.followers.last_update != @last_update
|
||||||
refresh
|
refresh
|
||||||
@last_update = $PokemonTemp.followers.last_update
|
@last_update = $game_temp.followers.last_update
|
||||||
end
|
end
|
||||||
@sprites.each { |sprite| sprite.update }
|
@sprites.each { |sprite| sprite.update }
|
||||||
end
|
end
|
||||||
@@ -260,7 +260,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Stores Game_Follower instances just for the current play session.
|
# Stores Game_Follower instances just for the current play session.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokemonTemp
|
class Game_Temp
|
||||||
attr_writer :followers
|
attr_writer :followers
|
||||||
|
|
||||||
def followers
|
def followers
|
||||||
@@ -292,35 +292,35 @@ module Followers
|
|||||||
# @param name [String] identifier name of the follower to be added
|
# @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
|
# @param common_event_id [Integer] ID of the Common Event triggered when interacting with this follower
|
||||||
def add(event_id, name, common_event_id)
|
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
|
end
|
||||||
|
|
||||||
# @param event [Game_Event] map event to be added as a follower
|
# @param event [Game_Event] map event to be added as a follower
|
||||||
def add_event(event)
|
def add_event(event)
|
||||||
$PokemonTemp.followers.add_follower(event)
|
$game_temp.followers.add_follower(event)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param name [String] identifier name of the follower to be removed
|
# @param name [String] identifier name of the follower to be removed
|
||||||
def remove(name)
|
def remove(name)
|
||||||
$PokemonTemp.followers.remove_follower_by_name(name)
|
$game_temp.followers.remove_follower_by_name(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param event [Game_Event] map event to be removed as a follower
|
# @param event [Game_Event] map event to be removed as a follower
|
||||||
def remove_event(event)
|
def remove_event(event)
|
||||||
$PokemonTemp.followers.remove_follower_by_event(event)
|
$game_temp.followers.remove_follower_by_event(event)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Removes all followers.
|
# Removes all followers.
|
||||||
def clear
|
def clear
|
||||||
$PokemonTemp.followers.remove_all_followers
|
$game_temp.followers.remove_all_followers
|
||||||
pbDeregisterPartner rescue nil
|
pbDeregisterPartner rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param name [String, nil] name of the follower to get, or nil for the first follower
|
# @param name [String, nil] name of the follower to get, or nil for the first follower
|
||||||
# @return [Game_Follower, nil] follower object
|
# @return [Game_Follower, nil] follower object
|
||||||
def get(name = nil)
|
def get(name = nil)
|
||||||
return $PokemonTemp.followers.get_follower_by_name(name) if name
|
return $game_temp.followers.get_follower_by_name(name) if name
|
||||||
$PokemonTemp.followers.get_follower_by_index
|
$game_temp.followers.get_follower_by_index
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ class Sprite_SurfBase
|
|||||||
sx = @event.pattern_surf*cw
|
sx = @event.pattern_surf*cw
|
||||||
sy = ((@event.direction-2)/2)*ch
|
sy = ((@event.direction-2)/2)*ch
|
||||||
@sprite.src_rect.set(sx,sy,cw,ch)
|
@sprite.src_rect.set(sx,sy,cw,ch)
|
||||||
if $PokemonTemp.surfJump
|
if $game_temp.surf_base_coords
|
||||||
@sprite.x = ($PokemonTemp.surfJump[0]*Game_Map::REAL_RES_X-@event.map.display_x+3)/4+(Game_Map::TILE_WIDTH/2)
|
@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 = ($PokemonTemp.surfJump[1]*Game_Map::REAL_RES_Y-@event.map.display_y+3)/4+(Game_Map::TILE_HEIGHT/2)+16
|
@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
|
else
|
||||||
@sprite.x = @rsprite.x
|
@sprite.x = @rsprite.x
|
||||||
@sprite.y = @rsprite.y
|
@sprite.y = @rsprite.y
|
||||||
|
|||||||
@@ -625,9 +625,9 @@ GameData::Evolution.register({
|
|||||||
:id => :BattleDealCriticalHit,
|
:id => :BattleDealCriticalHit,
|
||||||
:parameter => Integer,
|
:parameter => Integer,
|
||||||
:after_battle_proc => proc { |pkmn, party_index, parameter|
|
:after_battle_proc => proc { |pkmn, party_index, parameter|
|
||||||
next $PokemonTemp.party_critical_hits_dealt &&
|
next $game_temp.party_critical_hits_dealt &&
|
||||||
$PokemonTemp.party_critical_hits_dealt[party_index] &&
|
$game_temp.party_critical_hits_dealt[party_index] &&
|
||||||
$PokemonTemp.party_critical_hits_dealt[party_index] >= parameter
|
$game_temp.party_critical_hits_dealt[party_index] >= parameter
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Data caches.
|
# Data caches.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokemonTemp
|
class Game_Temp
|
||||||
attr_accessor :townMapData
|
attr_accessor :town_map_data
|
||||||
attr_accessor :phoneData
|
attr_accessor :phone_messages_data
|
||||||
attr_accessor :speciesShadowMovesets
|
attr_accessor :shadow_movesets_data
|
||||||
attr_accessor :regionalDexes
|
attr_accessor :regional_dexes_data
|
||||||
attr_accessor :battleAnims
|
attr_accessor :battle_animations_data
|
||||||
attr_accessor :moveToAnim
|
attr_accessor :move_to_battle_animation_data
|
||||||
attr_accessor :mapInfos
|
attr_accessor :map_infos
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbClearData
|
def pbClearData
|
||||||
if $PokemonTemp
|
if $game_temp
|
||||||
$PokemonTemp.townMapData = nil
|
$game_temp.town_map_data = nil
|
||||||
$PokemonTemp.phoneData = nil
|
$game_temp.phone_messages_data = nil
|
||||||
$PokemonTemp.speciesShadowMovesets = nil
|
$game_temp.shadow_movesets_data = nil
|
||||||
$PokemonTemp.regionalDexes = nil
|
$game_temp.regional_dexes_data = nil
|
||||||
$PokemonTemp.battleAnims = nil
|
$game_temp.battle_animations_data = nil
|
||||||
$PokemonTemp.moveToAnim = nil
|
$game_temp.move_to_battle_animation_data = nil
|
||||||
$PokemonTemp.mapInfos = nil
|
$game_temp.map_infos = nil
|
||||||
end
|
end
|
||||||
MapFactoryHelper.clear
|
MapFactoryHelper.clear
|
||||||
$PokemonEncounters.setup($game_map.map_id) if $game_map && $PokemonEncounters
|
$PokemonEncounters.setup($game_map.map_id) if $game_map && $PokemonEncounters
|
||||||
@@ -32,76 +32,76 @@ end
|
|||||||
# Method to get Town Map data.
|
# Method to get Town Map data.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLoadTownMapData
|
def pbLoadTownMapData
|
||||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
$game_temp = Game_Temp.new if !$game_temp
|
||||||
if !$PokemonTemp.townMapData
|
if !$game_temp.town_map_data
|
||||||
$PokemonTemp.townMapData = load_data("Data/town_map.dat")
|
$game_temp.town_map_data = load_data("Data/town_map.dat")
|
||||||
end
|
end
|
||||||
return $PokemonTemp.townMapData
|
return $game_temp.town_map_data
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Method to get phone call data.
|
# Method to get phone call data.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLoadPhoneData
|
def pbLoadPhoneData
|
||||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
$game_temp = Game_Temp.new if !$game_temp
|
||||||
if !$PokemonTemp.phoneData
|
if !$game_temp.phone_messages_data
|
||||||
if pbRgssExists?("Data/phone.dat")
|
if pbRgssExists?("Data/phone.dat")
|
||||||
$PokemonTemp.phoneData = load_data("Data/phone.dat")
|
$game_temp.phone_messages_data = load_data("Data/phone.dat")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return $PokemonTemp.phoneData
|
return $game_temp.phone_messages_data
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Method to get Shadow Pokémon moveset data.
|
# Method to get Shadow Pokémon moveset data.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLoadShadowMovesets
|
def pbLoadShadowMovesets
|
||||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
$game_temp = Game_Temp.new if !$game_temp
|
||||||
if !$PokemonTemp.speciesShadowMovesets
|
if !$game_temp.shadow_movesets_data
|
||||||
$PokemonTemp.speciesShadowMovesets = load_data("Data/shadow_movesets.dat") || []
|
$game_temp.shadow_movesets_data = load_data("Data/shadow_movesets.dat") || []
|
||||||
end
|
end
|
||||||
return $PokemonTemp.speciesShadowMovesets
|
return $game_temp.shadow_movesets_data
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Method to get Regional Dexes data.
|
# Method to get Regional Dexes data.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLoadRegionalDexes
|
def pbLoadRegionalDexes
|
||||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
$game_temp = Game_Temp.new if !$game_temp
|
||||||
if !$PokemonTemp.regionalDexes
|
if !$game_temp.regional_dexes_data
|
||||||
$PokemonTemp.regionalDexes = load_data("Data/regional_dexes.dat")
|
$game_temp.regional_dexes_data = load_data("Data/regional_dexes.dat")
|
||||||
end
|
end
|
||||||
return $PokemonTemp.regionalDexes
|
return $game_temp.regional_dexes_data
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Methods relating to battle animations data.
|
# Methods relating to battle animations data.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLoadBattleAnimations
|
def pbLoadBattleAnimations
|
||||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
$game_temp = Game_Temp.new if !$game_temp
|
||||||
if !$PokemonTemp.battleAnims
|
if !$game_temp.battle_animations_data
|
||||||
if pbRgssExists?("Data/PkmnAnimations.rxdata")
|
if pbRgssExists?("Data/PkmnAnimations.rxdata")
|
||||||
$PokemonTemp.battleAnims = load_data("Data/PkmnAnimations.rxdata")
|
$game_temp.battle_animations_data = load_data("Data/PkmnAnimations.rxdata")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return $PokemonTemp.battleAnims
|
return $game_temp.battle_animations_data
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbLoadMoveToAnim
|
def pbLoadMoveToAnim
|
||||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
$game_temp = Game_Temp.new if !$game_temp
|
||||||
if !$PokemonTemp.moveToAnim
|
if !$game_temp.move_to_battle_animation_data
|
||||||
$PokemonTemp.moveToAnim = load_data("Data/move2anim.dat") || []
|
$game_temp.move_to_battle_animation_data = load_data("Data/move2anim.dat") || []
|
||||||
end
|
end
|
||||||
return $PokemonTemp.moveToAnim
|
return $game_temp.move_to_battle_animation_data
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Method relating to map infos data.
|
# Method relating to map infos data.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbLoadMapInfos
|
def pbLoadMapInfos
|
||||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
$game_temp = Game_Temp.new if !$game_temp
|
||||||
if !$PokemonTemp.mapInfos
|
if !$game_temp.map_infos
|
||||||
$PokemonTemp.mapInfos = load_data("Data/MapInfos.rxdata")
|
$game_temp.map_infos = load_data("Data/MapInfos.rxdata")
|
||||||
end
|
end
|
||||||
return $PokemonTemp.mapInfos
|
return $game_temp.map_infos
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ class PokeBattle_Move
|
|||||||
@battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true)))
|
@battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true)))
|
||||||
end
|
end
|
||||||
if target.damageState.critical
|
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
|
if numTargets>1
|
||||||
@battle.pbDisplay(_INTL("A critical hit on {1}!",target.pbThis(true)))
|
@battle.pbDisplay(_INTL("A critical hit on {1}!",target.pbThis(true)))
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
# module PokeBattle_SceneConstants
|
# module PokeBattle_SceneConstants
|
||||||
# def self.pbBattlerPosition
|
# def self.pbBattlerPosition
|
||||||
# def self.pbTrainerPosition
|
# def self.pbTrainerPosition
|
||||||
# class PokemonTemp
|
# class Game_Temp
|
||||||
# def recordBattleRule
|
# def add_battle_rule
|
||||||
# (There is no guarantee that this list is complete.)
|
# (There is no guarantee that this list is complete.)
|
||||||
|
|
||||||
class PokeBattle_Battle
|
class PokeBattle_Battle
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battl
|
|||||||
|
|
||||||
BallHandlers::ModifyCatchRate.add(:LUREBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
BallHandlers::ModifyCatchRate.add(:LUREBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||||
multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 5 : 3
|
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
|
next [catchRate,255].min
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PokemonTemp
|
class Game_Temp
|
||||||
attr_accessor :batterywarning
|
attr_accessor :warned_low_battery
|
||||||
attr_accessor :cueBGM
|
attr_accessor :cue_bgm
|
||||||
attr_accessor :cueFrames
|
attr_accessor :cue_bgm_frame_delay
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -47,22 +47,22 @@ def pbBatteryLow?
|
|||||||
end
|
end
|
||||||
|
|
||||||
Events.onMapUpdate += proc { |_sender,_e|
|
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 &&
|
if !$game_temp.in_menu && !$game_temp.in_battle &&
|
||||||
!$game_player.move_route_forcing && !$game_temp.message_window_showing &&
|
!$game_player.move_route_forcing && !$game_temp.message_window_showing &&
|
||||||
!pbMapInterpreterRunning?
|
!pbMapInterpreterRunning?
|
||||||
if pbGetTimeNow.sec==0
|
if pbGetTimeNow.sec==0
|
||||||
pbMessage(_INTL("The game has detected that the battery is low. You should save soon to avoid losing your progress."))
|
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
|
end
|
||||||
end
|
end
|
||||||
if $PokemonTemp.cueFrames
|
if $game_temp.cue_bgm_frame_delay
|
||||||
$PokemonTemp.cueFrames -= 1
|
$game_temp.cue_bgm_frame_delay -= 1
|
||||||
if $PokemonTemp.cueFrames<=0
|
if $game_temp.cue_bgm_frame_delay <= 0
|
||||||
$PokemonTemp.cueFrames = nil
|
$game_temp.cue_bgm_frame_delay = nil
|
||||||
if $game_system.getPlayingBGM==nil
|
if $game_system.getPlayingBGM == nil
|
||||||
pbBGMPlay($PokemonTemp.cueBGM)
|
pbBGMPlay($game_temp.cue_bgm)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -177,7 +177,7 @@ def pbOnStepTaken(eventTriggered)
|
|||||||
Events.onStepTakenTransferPossible.trigger(nil,handled)
|
Events.onStepTakenTransferPossible.trigger(nil,handled)
|
||||||
return if handled[0]
|
return if handled[0]
|
||||||
pbBattleOnStepTaken(repel_active) if !eventTriggered && !$game_temp.in_menu
|
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
|
end
|
||||||
|
|
||||||
# Start wild encounters while turning on the spot
|
# Start wild encounters while turning on the spot
|
||||||
@@ -192,7 +192,7 @@ def pbBattleOnStepTaken(repel_active)
|
|||||||
encounter_type = $PokemonEncounters.encounter_type
|
encounter_type = $PokemonEncounters.encounter_type
|
||||||
return if !encounter_type
|
return if !encounter_type
|
||||||
return if !$PokemonEncounters.encounter_triggered?(encounter_type, repel_active)
|
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 = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
||||||
encounter = EncounterModifier.trigger(encounter)
|
encounter = EncounterModifier.trigger(encounter)
|
||||||
if $PokemonEncounters.allow_encounter?(encounter, repel_active)
|
if $PokemonEncounters.allow_encounter?(encounter, repel_active)
|
||||||
@@ -203,10 +203,10 @@ def pbBattleOnStepTaken(repel_active)
|
|||||||
else
|
else
|
||||||
pbWildBattle(encounter[0], encounter[1])
|
pbWildBattle(encounter[0], encounter[1])
|
||||||
end
|
end
|
||||||
$PokemonTemp.encounterType = nil
|
$game_temp.encounter_type = nil
|
||||||
$PokemonTemp.encounterTriggered = true
|
$game_temp.encounter_triggered = true
|
||||||
end
|
end
|
||||||
$PokemonTemp.forceSingleBattle = false
|
$game_temp.force_single_battle = false
|
||||||
EncounterModifier.triggerEncounterEnd
|
EncounterModifier.triggerEncounterEnd
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -267,15 +267,15 @@ Events.onMapSceneChange += proc { |_sender, e|
|
|||||||
# Display darkness circle on dark maps
|
# Display darkness circle on dark maps
|
||||||
map_metadata = $game_map.metadata
|
map_metadata = $game_map.metadata
|
||||||
if map_metadata && map_metadata.dark_map
|
if map_metadata && map_metadata.dark_map
|
||||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
$game_temp.darkness_sprite = DarknessSprite.new
|
||||||
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
|
scene.spriteset.addUserSprite($game_temp.darkness_sprite)
|
||||||
if $PokemonGlobal.flashUsed
|
if $PokemonGlobal.flashUsed
|
||||||
$PokemonTemp.darknessSprite.radius = $PokemonTemp.darknessSprite.radiusMax
|
$game_temp.darkness_sprite.radius = $game_temp.darkness_sprite.radiusMax
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
$PokemonGlobal.flashUsed = false
|
$PokemonGlobal.flashUsed = false
|
||||||
$PokemonTemp.darknessSprite.dispose if $PokemonTemp.darknessSprite
|
$game_temp.darkness_sprite.dispose if $game_temp.darkness_sprite
|
||||||
$PokemonTemp.darknessSprite = nil
|
$game_temp.darkness_sprite = nil
|
||||||
end
|
end
|
||||||
# Show location signpost
|
# Show location signpost
|
||||||
if mapChanged && map_metadata && map_metadata.announce_location
|
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
|
playingBGM = $game_system.playing_bgm
|
||||||
if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch
|
if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch
|
||||||
pbBGMFade(seconds)
|
pbBGMFade(seconds)
|
||||||
if !$PokemonTemp.cueFrames
|
if !$game_temp.cue_bgm_frame_delay
|
||||||
$PokemonTemp.cueFrames = (seconds*Graphics.frame_rate)*3/5
|
$game_temp.cue_bgm_frame_delay = (seconds * Graphics.frame_rate) * 3 / 5
|
||||||
end
|
end
|
||||||
$PokemonTemp.cueBGM=bgm
|
$game_temp.cue_bgm = bgm
|
||||||
elsif playingBGM
|
elsif playingBGM
|
||||||
pbBGMPlay(bgm)
|
pbBGMPlay(bgm)
|
||||||
end
|
end
|
||||||
@@ -546,7 +546,7 @@ end
|
|||||||
|
|
||||||
def pbSlideOnIce
|
def pbSlideOnIce
|
||||||
return if !$game_player.pbTerrainTag.ice
|
return if !$game_player.pbTerrainTag.ice
|
||||||
$PokemonTemp.followers.update
|
$game_temp.followers.update
|
||||||
$PokemonGlobal.sliding = true
|
$PokemonGlobal.sliding = true
|
||||||
direction = $game_player.direction
|
direction = $game_player.direction
|
||||||
oldwalkanime = $game_player.walk_anime
|
oldwalkanime = $game_player.walk_anime
|
||||||
@@ -557,7 +557,7 @@ def pbSlideOnIce
|
|||||||
break if !$game_player.can_move_in_direction?(direction)
|
break if !$game_player.can_move_in_direction?(direction)
|
||||||
break if !$game_player.pbTerrainTag.ice
|
break if !$game_player.pbTerrainTag.ice
|
||||||
$game_player.move_forward
|
$game_player.move_forward
|
||||||
$PokemonTemp.followers.move_followers if first_loop
|
$game_temp.followers.move_followers if first_loop
|
||||||
while $game_player.moving?
|
while $game_player.moving?
|
||||||
pbUpdateSceneMap
|
pbUpdateSceneMap
|
||||||
Graphics.update
|
Graphics.update
|
||||||
@@ -621,7 +621,7 @@ def pbJumpToward(dist=1,playSound=false,cancelSurf=false)
|
|||||||
if $game_player.x!=x || $game_player.y!=y
|
if $game_player.x!=x || $game_player.y!=y
|
||||||
pbSEPlay("Player jump") if playSound
|
pbSEPlay("Player jump") if playSound
|
||||||
$PokemonEncounters.reset_step_count if cancelSurf
|
$PokemonEncounters.reset_step_count if cancelSurf
|
||||||
$PokemonTemp.endSurf = true if cancelSurf
|
$game_temp.ending_surf = true if cancelSurf
|
||||||
while $game_player.jumping?
|
while $game_player.jumping?
|
||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
|
|||||||
@@ -10,23 +10,23 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PokemonTemp
|
class Game_Temp
|
||||||
attr_accessor :encounterTriggered
|
attr_accessor :encounter_triggered
|
||||||
attr_accessor :encounterType
|
attr_accessor :encounter_type
|
||||||
attr_accessor :party_levels_before_battle
|
attr_accessor :party_levels_before_battle
|
||||||
attr_accessor :party_critical_hits_dealt
|
attr_accessor :party_critical_hits_dealt
|
||||||
|
|
||||||
def battleRules
|
def battle_rules
|
||||||
@battleRules = {} if !@battleRules
|
@battle_rules = {} if !@battle_rules
|
||||||
return @battleRules
|
return @battle_rules
|
||||||
end
|
end
|
||||||
|
|
||||||
def clearBattleRules
|
def clear_battle_rules
|
||||||
self.battleRules.clear
|
self.battle_rules.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def recordBattleRule(rule,var=nil)
|
def add_battle_rule(rule, var = nil)
|
||||||
rules = self.battleRules
|
rules = self.battle_rules
|
||||||
case rule.to_s.downcase
|
case rule.to_s.downcase
|
||||||
when "single", "1v1", "1v2", "2v1", "1v3", "3v1",
|
when "single", "1v1", "1v2", "2v1", "1v3", "3v1",
|
||||||
"double", "2v2", "2v3", "3v2", "triple", "3v3"
|
"double", "2v2", "2v3", "3v2", "triple", "3v3"
|
||||||
@@ -67,7 +67,7 @@ def setBattleRule(*args)
|
|||||||
r = nil
|
r = nil
|
||||||
for arg in args
|
for arg in args
|
||||||
if r
|
if r
|
||||||
$PokemonTemp.recordBattleRule(r,arg)
|
$game_temp.add_battle_rule(r, arg)
|
||||||
r = nil
|
r = nil
|
||||||
else
|
else
|
||||||
case arg.downcase
|
case arg.downcase
|
||||||
@@ -76,7 +76,7 @@ def setBattleRule(*args)
|
|||||||
r = arg
|
r = arg
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
$PokemonTemp.recordBattleRule(arg)
|
$game_temp.add_battle_rule(arg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
raise _INTL("Argument {1} expected a variable after it but didn't have one.",r) if r
|
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.
|
# Sets up various battle parameters and applies special rules.
|
||||||
def pbPrepareBattle(battle)
|
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")
|
# The size of the battle, i.e. how many Pokémon on each side (default: "single")
|
||||||
battle.setBattleMode(battleRules["size"]) if !battleRules["size"].nil?
|
battle.setBattleMode(battleRules["size"]) if !battleRules["size"].nil?
|
||||||
# Whether the game won't black out even if the player loses (default: false)
|
# Whether the game won't black out even if the player loses (default: false)
|
||||||
@@ -172,8 +172,8 @@ def pbGetEnvironment
|
|||||||
ret = :None
|
ret = :None
|
||||||
map_env = $game_map.metadata&.battle_environment
|
map_env = $game_map.metadata&.battle_environment
|
||||||
ret = map_env if map_env
|
ret = map_env if map_env
|
||||||
if $PokemonTemp.encounterType &&
|
if $game_temp.encounter_type &&
|
||||||
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
|
GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
|
||||||
terrainTag = $game_player.pbFacingTerrainTag
|
terrainTag = $game_player.pbFacingTerrainTag
|
||||||
else
|
else
|
||||||
terrainTag = $game_player.terrain_tag
|
terrainTag = $game_player.terrain_tag
|
||||||
@@ -190,11 +190,11 @@ end
|
|||||||
Events.onStartBattle += proc { |_sender|
|
Events.onStartBattle += proc { |_sender|
|
||||||
# Record current levels of Pokémon in party, to see if they gain a level
|
# Record current levels of Pokémon in party, to see if they gain a level
|
||||||
# during battle and may need to evolve afterwards
|
# during battle and may need to evolve afterwards
|
||||||
$PokemonTemp.party_levels_before_battle = []
|
$game_temp.party_levels_before_battle = []
|
||||||
$PokemonTemp.party_critical_hits_dealt = []
|
$game_temp.party_critical_hits_dealt = []
|
||||||
$player.party.each_with_index do |pkmn, i|
|
$player.party.each_with_index do |pkmn, i|
|
||||||
$PokemonTemp.party_levels_before_battle[i] = pkmn.level
|
$game_temp.party_levels_before_battle[i] = pkmn.level
|
||||||
$PokemonTemp.party_critical_hits_dealt[i] = 0
|
$game_temp.party_critical_hits_dealt[i] = 0
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,13 +211,13 @@ end
|
|||||||
# Start a wild battle
|
# Start a wild battle
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbWildBattleCore(*args)
|
def pbWildBattleCore(*args)
|
||||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
outcomeVar = $game_temp.battle_rules["outcomeVar"] || 1
|
||||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
canLose = $game_temp.battle_rules["canLose"] || false
|
||||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
# 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))
|
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $player.pokemon_count > 0
|
pbMessage(_INTL("SKIPPING BATTLE...")) if $player.pokemon_count > 0
|
||||||
pbSet(outcomeVar,1) # Treat it as a win
|
pbSet(outcomeVar,1) # Treat it as a win
|
||||||
$PokemonTemp.clearBattleRules
|
$game_temp.clear_battle_rules
|
||||||
$PokemonGlobal.nextBattleBGM = nil
|
$PokemonGlobal.nextBattleBGM = nil
|
||||||
$PokemonGlobal.nextBattleME = nil
|
$PokemonGlobal.nextBattleME = nil
|
||||||
$PokemonGlobal.nextBattleCaptureME = nil
|
$PokemonGlobal.nextBattleCaptureME = nil
|
||||||
@@ -253,11 +253,11 @@ def pbWildBattleCore(*args)
|
|||||||
playerParty = $player.party
|
playerParty = $player.party
|
||||||
playerPartyStarts = [0]
|
playerPartyStarts = [0]
|
||||||
room_for_partner = (foeParty.length > 1)
|
room_for_partner = (foeParty.length > 1)
|
||||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
if !room_for_partner && $game_temp.battle_rules["size"] &&
|
||||||
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
|
!["single", "1v1", "1v2", "1v3"].include?($game_temp.battle_rules["size"])
|
||||||
room_for_partner = true
|
room_for_partner = true
|
||||||
end
|
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 = NPCTrainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||||
ally.id = $PokemonGlobal.partner[2]
|
ally.id = $PokemonGlobal.partner[2]
|
||||||
ally.party = $PokemonGlobal.partner[3]
|
ally.party = $PokemonGlobal.partner[3]
|
||||||
@@ -266,7 +266,7 @@ def pbWildBattleCore(*args)
|
|||||||
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
||||||
playerPartyStarts.push(playerParty.length)
|
playerPartyStarts.push(playerParty.length)
|
||||||
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
||||||
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
|
setBattleRule("double") if !$game_temp.battle_rules["size"]
|
||||||
end
|
end
|
||||||
# Create the battle scene (the visual side of it)
|
# Create the battle scene (the visual side of it)
|
||||||
scene = pbNewBattleScene
|
scene = pbNewBattleScene
|
||||||
@@ -275,7 +275,7 @@ def pbWildBattleCore(*args)
|
|||||||
battle.party1starts = playerPartyStarts
|
battle.party1starts = playerPartyStarts
|
||||||
# Set various other properties in the battle class
|
# Set various other properties in the battle class
|
||||||
pbPrepareBattle(battle)
|
pbPrepareBattle(battle)
|
||||||
$PokemonTemp.clearBattleRules
|
$game_temp.clear_battle_rules
|
||||||
# Perform the battle itself
|
# Perform the battle itself
|
||||||
decision = 0
|
decision = 0
|
||||||
pbBattleAnimation(pbGetWildBattleBGM(foeParty),(foeParty.length==1) ? 0 : 2,foeParty) {
|
pbBattleAnimation(pbGetWildBattleBGM(foeParty),(foeParty.length==1) ? 0 : 2,foeParty) {
|
||||||
@@ -349,14 +349,14 @@ end
|
|||||||
# Start a trainer battle
|
# Start a trainer battle
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbTrainerBattleCore(*args)
|
def pbTrainerBattleCore(*args)
|
||||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
outcomeVar = $game_temp.battle_rules["outcomeVar"] || 1
|
||||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
canLose = $game_temp.battle_rules["canLose"] || false
|
||||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
# 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))
|
if $player.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
|
pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
|
||||||
pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $player.able_pokemon_count > 0
|
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
|
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.nextBattleBGM = nil
|
||||||
$PokemonGlobal.nextBattleME = nil
|
$PokemonGlobal.nextBattleME = nil
|
||||||
$PokemonGlobal.nextBattleCaptureME = nil
|
$PokemonGlobal.nextBattleCaptureME = nil
|
||||||
@@ -399,11 +399,11 @@ def pbTrainerBattleCore(*args)
|
|||||||
playerParty = $player.party
|
playerParty = $player.party
|
||||||
playerPartyStarts = [0]
|
playerPartyStarts = [0]
|
||||||
room_for_partner = (foeParty.length > 1)
|
room_for_partner = (foeParty.length > 1)
|
||||||
if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
if !room_for_partner && $game_temp.battle_rules["size"] &&
|
||||||
!["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
|
!["single", "1v1", "1v2", "1v3"].include?($game_temp.battle_rules["size"])
|
||||||
room_for_partner = true
|
room_for_partner = true
|
||||||
end
|
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 = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
|
||||||
ally.id = $PokemonGlobal.partner[2]
|
ally.id = $PokemonGlobal.partner[2]
|
||||||
ally.party = $PokemonGlobal.partner[3]
|
ally.party = $PokemonGlobal.partner[3]
|
||||||
@@ -412,7 +412,7 @@ def pbTrainerBattleCore(*args)
|
|||||||
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
$player.party.each { |pkmn| playerParty.push(pkmn) }
|
||||||
playerPartyStarts.push(playerParty.length)
|
playerPartyStarts.push(playerParty.length)
|
||||||
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
ally.party.each { |pkmn| playerParty.push(pkmn) }
|
||||||
setBattleRule("double") if !$PokemonTemp.battleRules["size"]
|
setBattleRule("double") if !$game_temp.battle_rules["size"]
|
||||||
end
|
end
|
||||||
# Create the battle scene (the visual side of it)
|
# Create the battle scene (the visual side of it)
|
||||||
scene = pbNewBattleScene
|
scene = pbNewBattleScene
|
||||||
@@ -424,7 +424,7 @@ def pbTrainerBattleCore(*args)
|
|||||||
battle.endSpeeches = foeEndSpeeches
|
battle.endSpeeches = foeEndSpeeches
|
||||||
# Set various other properties in the battle class
|
# Set various other properties in the battle class
|
||||||
pbPrepareBattle(battle)
|
pbPrepareBattle(battle)
|
||||||
$PokemonTemp.clearBattleRules
|
$game_temp.clear_battle_rules
|
||||||
# End the trainer intro music
|
# End the trainer intro music
|
||||||
Audio.me_stop
|
Audio.me_stop
|
||||||
# Perform the battle itself
|
# 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
|
# 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
|
# 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
|
# 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
|
# then trigger and cause the battle to happen against this first trainer and
|
||||||
# themselves.
|
# themselves.
|
||||||
if !$PokemonTemp.waitingTrainer && pbMapInterpreterRunning? &&
|
if !$game_temp.waiting_trainer && pbMapInterpreterRunning? &&
|
||||||
($player.able_pokemon_count > 1 ||
|
($player.able_pokemon_count > 1 ||
|
||||||
($player.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
($player.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
||||||
thisEvent = pbMapInterpreter.get_character(0)
|
thisEvent = pbMapInterpreter.get_character(0)
|
||||||
@@ -482,27 +482,27 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
|||||||
# other triggered trainer event
|
# other triggered trainer event
|
||||||
if otherEvent.length == 1 && trainer.party.length <= Settings::MAX_PARTY_SIZE
|
if otherEvent.length == 1 && trainer.party.length <= Settings::MAX_PARTY_SIZE
|
||||||
trainer.lose_text = endSpeech if endSpeech && !endSpeech.empty?
|
trainer.lose_text = endSpeech if endSpeech && !endSpeech.empty?
|
||||||
$PokemonTemp.waitingTrainer = [trainer, thisEvent.id]
|
$game_temp.waiting_trainer = [trainer, thisEvent.id]
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||||
setBattleRule("canLose") if canLose
|
setBattleRule("canLose") if canLose
|
||||||
setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer
|
setBattleRule("double") if doubleBattle || $game_temp.waiting_trainer
|
||||||
# Perform the battle
|
# Perform the battle
|
||||||
if $PokemonTemp.waitingTrainer
|
if $game_temp.waiting_trainer
|
||||||
decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer[0],
|
decision = pbTrainerBattleCore($game_temp.waiting_trainer[0],
|
||||||
[trainerID,trainerName,trainerPartyID,endSpeech]
|
[trainerID,trainerName,trainerPartyID,endSpeech]
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
decision = pbTrainerBattleCore([trainerID,trainerName,trainerPartyID,endSpeech])
|
decision = pbTrainerBattleCore([trainerID,trainerName,trainerPartyID,endSpeech])
|
||||||
end
|
end
|
||||||
# Finish off the recorded waiting trainer, because they have now been battled
|
# Finish off the recorded waiting trainer, because they have now been battled
|
||||||
if decision==1 && $PokemonTemp.waitingTrainer # Win
|
if decision==1 && $game_temp.waiting_trainer # Win
|
||||||
pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1], "A", true)
|
pbMapInterpreter.pbSetSelfSwitch($game_temp.waiting_trainer[1], "A", true)
|
||||||
end
|
end
|
||||||
$PokemonTemp.waitingTrainer = nil
|
$game_temp.waiting_trainer = nil
|
||||||
# Return true if the player won the battle, and false if any other result
|
# Return true if the player won the battle, and false if any other result
|
||||||
return (decision==1)
|
return (decision==1)
|
||||||
end
|
end
|
||||||
@@ -574,8 +574,8 @@ Events.onEndBattle += proc { |_sender,e|
|
|||||||
# Check for evolutions
|
# Check for evolutions
|
||||||
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
pbEvolutionCheck if Settings::CHECK_EVOLUTION_AFTER_ALL_BATTLES ||
|
||||||
(decision!=2 && decision!=5) # not a loss or a draw
|
(decision!=2 && decision!=5) # not a loss or a draw
|
||||||
$PokemonTemp.party_levels_before_battle = nil
|
$game_temp.party_levels_before_battle = nil
|
||||||
$PokemonTemp.party_critical_hits_dealt = nil
|
$game_temp.party_critical_hits_dealt = nil
|
||||||
# Check for blacking out or gaining Pickup/Huney Gather items
|
# Check for blacking out or gaining Pickup/Huney Gather items
|
||||||
case decision
|
case decision
|
||||||
when 1, 4 # Win, capture
|
when 1, 4 # Win, capture
|
||||||
@@ -598,9 +598,9 @@ def pbEvolutionCheck
|
|||||||
next if pkmn.fainted? && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON
|
next if pkmn.fainted? && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON
|
||||||
# Find an evolution
|
# Find an evolution
|
||||||
new_species = nil
|
new_species = nil
|
||||||
if new_species.nil? && $PokemonTemp.party_levels_before_battle &&
|
if new_species.nil? && $game_temp.party_levels_before_battle &&
|
||||||
$PokemonTemp.party_levels_before_battle[i] &&
|
$game_temp.party_levels_before_battle[i] &&
|
||||||
$PokemonTemp.party_levels_before_battle[i] < pkmn.level
|
$game_temp.party_levels_before_battle[i] < pkmn.level
|
||||||
new_species = pkmn.check_evolution_on_level_up
|
new_species = pkmn.check_evolution_on_level_up
|
||||||
end
|
end
|
||||||
new_species = pkmn.check_evolution_after_battle(i) if new_species.nil?
|
new_species = pkmn.check_evolution_after_battle(i) if new_species.nil?
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
|||||||
location = 0 # 0=outside, 1=inside, 2=cave, 3=water
|
location = 0 # 0=outside, 1=inside, 2=cave, 3=water
|
||||||
if $PokemonGlobal.surfing || $PokemonGlobal.diving
|
if $PokemonGlobal.surfing || $PokemonGlobal.diving
|
||||||
location = 3
|
location = 3
|
||||||
elsif $PokemonTemp.encounterType &&
|
elsif $game_temp.encounter_type &&
|
||||||
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
|
GameData::EncounterType.get($game_temp.encounter_type).type == :fishing
|
||||||
location = 3
|
location = 3
|
||||||
elsif $PokemonEncounters.has_cave_encounters?
|
elsif $PokemonEncounters.has_cave_encounters?
|
||||||
location = 2
|
location = 2
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ class PokemonEncounters
|
|||||||
# Returns whether a wild encounter should be turned into a double wild
|
# Returns whether a wild encounter should be turned into a double wild
|
||||||
# encounter.
|
# encounter.
|
||||||
def have_double_wild_battle?
|
def have_double_wild_battle?
|
||||||
return false if $PokemonTemp.forceSingleBattle
|
return false if $game_temp.force_single_battle
|
||||||
return false if pbInSafari?
|
return false if pbInSafari?
|
||||||
return true if $PokemonGlobal.partner
|
return true if $PokemonGlobal.partner
|
||||||
return false if $player.able_pokemon_count <= 1
|
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
|
# Used by fishing rods and Headbutt/Rock Smash/Sweet Scent to generate a wild
|
||||||
# Pokémon (or two) for a triggered wild encounter.
|
# Pokémon (or two) for a triggered wild encounter.
|
||||||
def pbEncounter(enc_type)
|
def pbEncounter(enc_type)
|
||||||
$PokemonTemp.encounterType = enc_type
|
$game_temp.encounter_type = enc_type
|
||||||
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
|
encounter1 = $PokemonEncounters.choose_wild_pokemon(enc_type)
|
||||||
encounter1 = EncounterModifier.trigger(encounter1)
|
encounter1 = EncounterModifier.trigger(encounter1)
|
||||||
return false if !encounter1
|
return false if !encounter1
|
||||||
@@ -471,8 +471,8 @@ def pbEncounter(enc_type)
|
|||||||
else
|
else
|
||||||
pbWildBattle(encounter1[0], encounter1[1])
|
pbWildBattle(encounter1[0], encounter1[1])
|
||||||
end
|
end
|
||||||
$PokemonTemp.encounterType = nil
|
$game_temp.encounter_type = nil
|
||||||
$PokemonTemp.forceSingleBattle = false
|
$game_temp.force_single_battle = false
|
||||||
EncounterModifier.triggerEncounterEnd
|
EncounterModifier.triggerEncounterEnd
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ Events.onMapChange += proc { |_sender,e|
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Encountering a roaming Pokémon in a wild battle.
|
# Encountering a roaming Pokémon in a wild battle.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokemonTemp
|
class Game_Temp
|
||||||
attr_accessor :roamerIndex # Index of roaming Pokémon to encounter next
|
attr_accessor :roamer_index_for_encounter # Index of roaming Pokémon to encounter next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -136,12 +136,12 @@ def pbRoamingMethodAllowed(roamer_method)
|
|||||||
end
|
end
|
||||||
|
|
||||||
EncounterModifier.register(proc { |encounter|
|
EncounterModifier.register(proc { |encounter|
|
||||||
$PokemonTemp.roamerIndex = nil
|
$game_temp.roamer_index_for_encounter = nil
|
||||||
next nil if !encounter
|
next nil if !encounter
|
||||||
# Give the regular encounter if encountering a roaming Pokémon isn't possible
|
# Give the regular encounter if encountering a roaming Pokémon isn't possible
|
||||||
next encounter if $PokemonGlobal.roamedAlready
|
next encounter if $PokemonGlobal.roamedAlready
|
||||||
next encounter if $PokemonGlobal.partner
|
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
|
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
|
# Look at each roaming Pokémon in turn and decide whether it's possible to
|
||||||
# encounter it
|
# encounter it
|
||||||
@@ -179,9 +179,9 @@ EncounterModifier.register(proc { |encounter|
|
|||||||
# Pick a roaming Pokémon to encounter out of those available
|
# Pick a roaming Pokémon to encounter out of those available
|
||||||
roamer = possible_roamers[rand(possible_roamers.length)]
|
roamer = possible_roamers[rand(possible_roamers.length)]
|
||||||
$PokemonGlobal.roamEncounter = roamer
|
$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?
|
$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
|
next [roamer[1], roamer[2]] # Species, level
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -190,14 +190,14 @@ Events.onWildBattleOverride += proc { |_sender,e|
|
|||||||
level = e[1]
|
level = e[1]
|
||||||
handled = e[2]
|
handled = e[2]
|
||||||
next if handled[0]!=nil
|
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)
|
handled[0] = pbRoamingPokemonBattle(species, level)
|
||||||
}
|
}
|
||||||
|
|
||||||
def pbRoamingPokemonBattle(species, level)
|
def pbRoamingPokemonBattle(species, level)
|
||||||
# Get the roaming Pokémon to encounter; generate it based on the species and
|
# Get the roaming Pokémon to encounter; generate it based on the species and
|
||||||
# level if it doesn't already exist
|
# level if it doesn't already exist
|
||||||
idxRoamer = $PokemonTemp.roamerIndex
|
idxRoamer = $game_temp.roamer_index_for_encounter
|
||||||
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
||||||
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
||||||
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species,level,true)
|
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species,level,true)
|
||||||
@@ -221,5 +221,5 @@ def pbRoamingPokemonBattle(species, level)
|
|||||||
end
|
end
|
||||||
|
|
||||||
EncounterModifier.registerEncounterEnd(proc {
|
EncounterModifier.registerEncounterEnd(proc {
|
||||||
$PokemonTemp.roamerIndex = nil
|
$game_temp.roamer_index_for_encounter = nil
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -173,32 +173,3 @@ class PokemonMapMetadata
|
|||||||
end
|
end
|
||||||
end
|
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
|
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLASH,proc { |move,pkmn,showmsg|
|
|||||||
})
|
})
|
||||||
|
|
||||||
HiddenMoveHandlers::UseMove.add(:FLASH,proc { |move,pokemon|
|
HiddenMoveHandlers::UseMove.add(:FLASH,proc { |move,pokemon|
|
||||||
darkness = $PokemonTemp.darknessSprite
|
darkness = $game_temp.darkness_sprite
|
||||||
next false if !darkness || darkness.disposed?
|
next false if !darkness || darkness.disposed?
|
||||||
if !pbHiddenMoveAnimation(pokemon)
|
if !pbHiddenMoveAnimation(pokemon)
|
||||||
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||||
@@ -507,10 +507,10 @@ def pbCanFly?(pkmn = nil, show_messages = false)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbFlyToNewLocation(pkmn = nil, move = :FLY)
|
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
|
pkmn = $player.get_pokemon_with_move(move) if !pkmn
|
||||||
if !$DEBUG && !pkmn
|
if !$DEBUG && !pkmn
|
||||||
$PokemonTemp.flydata = nil
|
$game_temp.fly_destination = nil
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -520,11 +520,11 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
|
|||||||
end
|
end
|
||||||
pbFadeOutIn {
|
pbFadeOutIn {
|
||||||
pbSEPlay("Fly")
|
pbSEPlay("Fly")
|
||||||
$game_temp.player_new_map_id = $PokemonTemp.flydata[0]
|
$game_temp.player_new_map_id = $game_temp.fly_destination[0]
|
||||||
$game_temp.player_new_x = $PokemonTemp.flydata[1]
|
$game_temp.player_new_x = $game_temp.fly_destination[1]
|
||||||
$game_temp.player_new_y = $PokemonTemp.flydata[2]
|
$game_temp.player_new_y = $game_temp.fly_destination[2]
|
||||||
$game_temp.player_new_direction = 2
|
$game_temp.player_new_direction = 2
|
||||||
$PokemonTemp.flydata = nil
|
$game_temp.fly_destination = nil
|
||||||
$scene.transfer_player
|
$scene.transfer_player
|
||||||
$game_map.autoplay
|
$game_map.autoplay
|
||||||
$game_map.refresh
|
$game_map.refresh
|
||||||
@@ -540,7 +540,7 @@ HiddenMoveHandlers::CanUseMove.add(:FLY,proc { |move, pkmn, showmsg|
|
|||||||
})
|
})
|
||||||
|
|
||||||
HiddenMoveHandlers::UseMove.add(:FLY,proc { |move, pkmn|
|
HiddenMoveHandlers::UseMove.add(:FLY,proc { |move, pkmn|
|
||||||
if !$PokemonTemp.flydata
|
if $game_temp.fly_destination.nil?
|
||||||
pbMessage(_INTL("Can't use that here."))
|
pbMessage(_INTL("Can't use that here."))
|
||||||
next false
|
next false
|
||||||
end
|
end
|
||||||
@@ -741,9 +741,9 @@ def pbStartSurfing
|
|||||||
$PokemonEncounters.reset_step_count
|
$PokemonEncounters.reset_step_count
|
||||||
$PokemonGlobal.surfing = true
|
$PokemonGlobal.surfing = true
|
||||||
pbUpdateVehicle
|
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
|
pbJumpToward
|
||||||
$PokemonTemp.surfJump = nil
|
$game_temp.surf_base_coords = nil
|
||||||
$game_player.check_event_trigger_here([1,2])
|
$game_player.check_event_trigger_here([1,2])
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -752,14 +752,14 @@ def pbEndSurf(_xOffset,_yOffset)
|
|||||||
x = $game_player.x
|
x = $game_player.x
|
||||||
y = $game_player.y
|
y = $game_player.y
|
||||||
if $game_map.terrain_tag(x,y).can_surf && !$game_player.pbFacingTerrainTag.can_surf
|
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)
|
if pbJumpToward(1,false,true)
|
||||||
$game_map.autoplayAsCue
|
$game_map.autoplayAsCue
|
||||||
$game_player.increase_steps
|
$game_player.increase_steps
|
||||||
result = $game_player.check_event_trigger_here([1,2])
|
result = $game_player.check_event_trigger_here([1,2])
|
||||||
pbOnStepTaken(result)
|
pbOnStepTaken(result)
|
||||||
end
|
end
|
||||||
$PokemonTemp.surfJump = nil
|
$game_temp.surf_base_coords = nil
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ ItemHandlers::UseFromBag.add(:TOWNMAP, proc { |item|
|
|||||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||||
screen = PokemonRegionMapScreen.new(scene)
|
screen = PokemonRegionMapScreen.new(scene)
|
||||||
ret = screen.pbStartScreen
|
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 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.copy(:ITEMFINDER,:DOWSINGMCHN,:DOWSINGMACHINE)
|
||||||
|
|
||||||
ItemHandlers::UseInField.add(:TOWNMAP, proc { |item|
|
ItemHandlers::UseInField.add(:TOWNMAP, proc { |item|
|
||||||
pbShowMap(-1, false) if !$PokemonTemp.flydata
|
pbShowMap(-1, false) if $game_temp.fly_destination.nil?
|
||||||
pbFlyToNewLocation
|
pbFlyToNewLocation
|
||||||
next true
|
next true
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PokemonTemp
|
class Game_Temp
|
||||||
attr_accessor :pokeradar # [species, level, chain count, grasses (x,y,ring,rarity)]
|
attr_accessor :poke_radar_data # [species, level, chain count, grasses (x,y,ring,rarity)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -43,15 +43,15 @@ end
|
|||||||
|
|
||||||
def pbUsePokeRadar
|
def pbUsePokeRadar
|
||||||
return false if !pbCanUsePokeRadar?
|
return false if !pbCanUsePokeRadar?
|
||||||
$PokemonTemp.pokeradar = [0,0,0,[],false] if !$PokemonTemp.pokeradar
|
$game_temp.poke_radar_data = [0, 0, 0, [], false] if !$game_temp.poke_radar_data
|
||||||
$PokemonTemp.pokeradar[4] = false
|
$game_temp.poke_radar_data[4] = false
|
||||||
$PokemonGlobal.pokeradarBattery = 50
|
$PokemonGlobal.pokeradarBattery = 50
|
||||||
pbPokeRadarHighlightGrass
|
pbPokeRadarHighlightGrass
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPokeRadarCancel
|
def pbPokeRadarCancel
|
||||||
$PokemonTemp.pokeradar = nil
|
$game_temp.poke_radar_data = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPokeRadarHighlightGrass(showmessage=true)
|
def pbPokeRadarHighlightGrass(showmessage=true)
|
||||||
@@ -79,8 +79,8 @@ def pbPokeRadarHighlightGrass(showmessage=true)
|
|||||||
if terrain.land_wild_encounters && terrain.shows_grass_rustle
|
if terrain.land_wild_encounters && terrain.shows_grass_rustle
|
||||||
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
|
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
|
||||||
s = (rand(100) < 25) ? 1 : 0
|
s = (rand(100) < 25) ? 1 : 0
|
||||||
if $PokemonTemp.pokeradar && $PokemonTemp.pokeradar[2] > 0
|
if $game_temp.poke_radar_data && $game_temp.poke_radar_data[2] > 0
|
||||||
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - $PokemonTemp.pokeradar[2] * 200, 200].max
|
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - $game_temp.poke_radar_data[2] * 200, 200].max
|
||||||
v = (65536 / v.to_f).ceil
|
v = (65536 / v.to_f).ceil
|
||||||
s = 2 if rand(65536) < v
|
s = 2 if rand(65536) < v
|
||||||
end
|
end
|
||||||
@@ -104,14 +104,14 @@ def pbPokeRadarHighlightGrass(showmessage=true)
|
|||||||
$scene.spriteset.addUserAnimation(Settings::RUSTLE_SHINY_ANIMATION_ID,grass[0],grass[1],true,1)
|
$scene.spriteset.addUserAnimation(Settings::RUSTLE_SHINY_ANIMATION_ID,grass[0],grass[1],true,1)
|
||||||
end
|
end
|
||||||
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)
|
pbWait(Graphics.frame_rate/2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPokeRadarGetShakingGrass
|
def pbPokeRadarGetShakingGrass
|
||||||
return -1 if !$PokemonTemp.pokeradar
|
return -1 if !$game_temp.poke_radar_data
|
||||||
grasses = $PokemonTemp.pokeradar[3]
|
grasses = $game_temp.poke_radar_data[3]
|
||||||
return -1 if grasses.length == 0
|
return -1 if grasses.length == 0
|
||||||
for i in grasses
|
for i in grasses
|
||||||
return i[2] if $game_player.x == i[0] && $game_player.y == i[1]
|
return i[2] if $game_player.x == i[0] && $game_player.y == i[1]
|
||||||
@@ -151,7 +151,7 @@ end
|
|||||||
# Event handlers
|
# Event handlers
|
||||||
################################################################################
|
################################################################################
|
||||||
EncounterModifier.register(proc { |encounter|
|
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
|
$PokemonGlobal.bicycle || $PokemonGlobal.partner
|
||||||
pbPokeRadarCancel
|
pbPokeRadarCancel
|
||||||
next encounter
|
next encounter
|
||||||
@@ -160,22 +160,22 @@ EncounterModifier.register(proc { |encounter|
|
|||||||
if ring >= 0 # Encounter triggered by stepping into rustling grass
|
if ring >= 0 # Encounter triggered by stepping into rustling grass
|
||||||
# Get rarity of shaking grass
|
# Get rarity of shaking grass
|
||||||
rarity = 0 # 0 = rustle, 1 = vigorous rustle, 2 = shiny rustle
|
rarity = 0 # 0 = rustle, 1 = vigorous rustle, 2 = shiny rustle
|
||||||
$PokemonTemp.pokeradar[3].each { |g| rarity = g[3] if g[2] == ring }
|
$game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring }
|
||||||
if $PokemonTemp.pokeradar[2] > 0 # Chain count, i.e. is chaining
|
if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining
|
||||||
if rarity == 2 ||
|
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
|
# Continue the chain
|
||||||
encounter = [$PokemonTemp.pokeradar[0], $PokemonTemp.pokeradar[1]]
|
encounter = [$game_temp.poke_radar_data[0], $game_temp.poke_radar_data[1]]
|
||||||
$PokemonTemp.forceSingleBattle = true
|
$game_temp.force_single_battle = true
|
||||||
else
|
else
|
||||||
# Break the chain, force an encounter with a different species
|
# Break the chain, force an encounter with a different species
|
||||||
100.times do
|
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)
|
encounter = $PokemonEncounters.choose_wild_pokemon($PokemonEncounters.encounter_type)
|
||||||
end
|
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
|
# Chain couldn't be broken somehow; continue it after all
|
||||||
$PokemonTemp.forceSingleBattle = true
|
$game_temp.force_single_battle = true
|
||||||
else
|
else
|
||||||
pbPokeRadarCancel
|
pbPokeRadarCancel
|
||||||
end
|
end
|
||||||
@@ -183,7 +183,7 @@ EncounterModifier.register(proc { |encounter|
|
|||||||
else # Not chaining; will start one
|
else # Not chaining; will start one
|
||||||
# Force random wild encounter, vigorous shaking means rarer species
|
# Force random wild encounter, vigorous shaking means rarer species
|
||||||
encounter = pbPokeRadarGetEncounter(rarity)
|
encounter = pbPokeRadarGetEncounter(rarity)
|
||||||
$PokemonTemp.forceSingleBattle = true
|
$game_temp.force_single_battle = true
|
||||||
end
|
end
|
||||||
else # Encounter triggered by stepping in non-rustling grass
|
else # Encounter triggered by stepping in non-rustling grass
|
||||||
pbPokeRadarCancel if encounter
|
pbPokeRadarCancel if encounter
|
||||||
@@ -193,8 +193,8 @@ EncounterModifier.register(proc { |encounter|
|
|||||||
|
|
||||||
Events.onWildPokemonCreate += proc { |_sender,e|
|
Events.onWildPokemonCreate += proc { |_sender,e|
|
||||||
pokemon = e[0]
|
pokemon = e[0]
|
||||||
next if !$PokemonTemp.pokeradar
|
next if !$game_temp.poke_radar_data
|
||||||
grasses = $PokemonTemp.pokeradar[3]
|
grasses = $game_temp.poke_radar_data[3]
|
||||||
next if !grasses
|
next if !grasses
|
||||||
for grass in grasses
|
for grass in grasses
|
||||||
next if $game_player.x!=grass[0] || $game_player.y!=grass[1]
|
next if $game_player.x!=grass[0] || $game_player.y!=grass[1]
|
||||||
@@ -207,12 +207,12 @@ Events.onWildBattleEnd += proc { |_sender,e|
|
|||||||
species = e[0]
|
species = e[0]
|
||||||
level = e[1]
|
level = e[1]
|
||||||
decision = e[2]
|
decision = e[2]
|
||||||
if $PokemonTemp.pokeradar && (decision==1 || decision==4) # Defeated/caught
|
if $game_temp.poke_radar_data && (decision==1 || decision==4) # Defeated/caught
|
||||||
$PokemonTemp.pokeradar[0] = species
|
$game_temp.poke_radar_data[0] = species
|
||||||
$PokemonTemp.pokeradar[1] = level
|
$game_temp.poke_radar_data[1] = level
|
||||||
$PokemonTemp.pokeradar[2] = [$PokemonTemp.pokeradar[2] + 1, 40].min
|
$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
|
# 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)
|
pbPokeRadarHighlightGrass(false)
|
||||||
else
|
else
|
||||||
pbPokeRadarCancel
|
pbPokeRadarCancel
|
||||||
@@ -221,7 +221,7 @@ Events.onWildBattleEnd += proc { |_sender,e|
|
|||||||
|
|
||||||
Events.onStepTaken += proc { |_sender,_e|
|
Events.onStepTaken += proc { |_sender,_e|
|
||||||
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery > 0 &&
|
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery > 0 &&
|
||||||
!$PokemonTemp.pokeradar
|
!$game_temp.poke_radar_data
|
||||||
$PokemonGlobal.pokeradarBattery -= 1
|
$PokemonGlobal.pokeradarBattery -= 1
|
||||||
end
|
end
|
||||||
terrain = $game_map.terrain_tag($game_player.x,$game_player.y)
|
terrain = $game_map.terrain_tag($game_player.x,$game_player.y)
|
||||||
|
|||||||
@@ -398,8 +398,8 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class PokemonTemp
|
class Game_Temp
|
||||||
attr_accessor :heart_gauges
|
attr_accessor :party_heart_gauges_before_battle
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -407,14 +407,14 @@ end
|
|||||||
# Record current heart gauges of Pokémon in party, to see if they drop to zero
|
# 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
|
# during battle and need to say they're ready to be purified afterwards
|
||||||
Events.onStartBattle += proc { |_sender|
|
Events.onStartBattle += proc { |_sender|
|
||||||
$PokemonTemp.heart_gauges = []
|
$game_temp.party_heart_gauges_before_battle = []
|
||||||
$player.party.each_with_index do |pkmn, i|
|
$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
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.onEndBattle += proc { |_sender,_e|
|
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]
|
pkmn = $player.party[i]
|
||||||
next if !pkmn || !value || value == 0
|
next if !pkmn || !value || value == 0
|
||||||
pkmn.check_ready_to_purify if pkmn.heart_gauge == 0
|
pkmn.check_ready_to_purify if pkmn.heart_gauge == 0
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class PokemonPauseMenu_Scene
|
|||||||
ret = -1
|
ret = -1
|
||||||
cmdwindow = @sprites["cmdwindow"]
|
cmdwindow = @sprites["cmdwindow"]
|
||||||
cmdwindow.commands = commands
|
cmdwindow.commands = commands
|
||||||
cmdwindow.index = $PokemonTemp.menuLastChoice
|
cmdwindow.index = $game_temp.menu_last_choice
|
||||||
cmdwindow.resizeToFit(commands)
|
cmdwindow.resizeToFit(commands)
|
||||||
cmdwindow.x = Graphics.width-cmdwindow.width
|
cmdwindow.x = Graphics.width-cmdwindow.width
|
||||||
cmdwindow.y = 0
|
cmdwindow.y = 0
|
||||||
@@ -64,7 +64,7 @@ class PokemonPauseMenu_Scene
|
|||||||
break
|
break
|
||||||
elsif Input.trigger?(Input::USE)
|
elsif Input.trigger?(Input::USE)
|
||||||
ret = cmdwindow.index
|
ret = cmdwindow.index
|
||||||
$PokemonTemp.menuLastChoice = ret
|
$game_temp.menu_last_choice = ret
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -212,7 +212,7 @@ class PokemonPauseMenu
|
|||||||
scene = PokemonPokegear_Scene.new
|
scene = PokemonPokegear_Scene.new
|
||||||
screen = PokemonPokegearScreen.new(scene)
|
screen = PokemonPokegearScreen.new(scene)
|
||||||
screen.pbStartScreen
|
screen.pbStartScreen
|
||||||
($PokemonTemp.flydata) ? @scene.pbEndScene : @scene.pbRefresh
|
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
|
||||||
}
|
}
|
||||||
return if pbFlyToNewLocation
|
return if pbFlyToNewLocation
|
||||||
elsif cmdTownMap>=0 && command==cmdTownMap
|
elsif cmdTownMap>=0 && command==cmdTownMap
|
||||||
@@ -220,8 +220,8 @@ class PokemonPauseMenu
|
|||||||
scene = PokemonRegionMap_Scene.new(-1, false)
|
scene = PokemonRegionMap_Scene.new(-1, false)
|
||||||
screen = PokemonRegionMapScreen.new(scene)
|
screen = PokemonRegionMapScreen.new(scene)
|
||||||
ret = screen.pbStartScreen
|
ret = screen.pbStartScreen
|
||||||
$PokemonTemp.flydata = ret if ret
|
$game_temp.fly_destination = ret if ret
|
||||||
($PokemonTemp.flydata) ? @scene.pbEndScene : @scene.pbRefresh
|
($game_temp.fly_destination) ? @scene.pbEndScene : @scene.pbRefresh
|
||||||
}
|
}
|
||||||
return if pbFlyToNewLocation
|
return if pbFlyToNewLocation
|
||||||
elsif cmdTrainer>=0 && command==cmdTrainer
|
elsif cmdTrainer>=0 && command==cmdTrainer
|
||||||
|
|||||||
@@ -1244,7 +1244,7 @@ class PokemonPartyScreen
|
|||||||
screen = PokemonRegionMapScreen.new(scene)
|
screen = PokemonRegionMapScreen.new(scene)
|
||||||
ret = screen.pbStartFlyScreen
|
ret = screen.pbStartFlyScreen
|
||||||
if ret
|
if ret
|
||||||
$PokemonTemp.flydata=ret
|
$game_temp.fly_destination = ret
|
||||||
return [pkmn,pkmn.moves[i].id]
|
return [pkmn,pkmn.moves[i].id]
|
||||||
end
|
end
|
||||||
@scene.pbStartScene(@party,
|
@scene.pbStartScene(@party,
|
||||||
|
|||||||
@@ -567,7 +567,7 @@ class PokemonBagScreen
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
($PokemonTemp.flydata) ? @scene.dispose : @scene.pbEndScene
|
($game_temp.fly_destination) ? @scene.dispose : @scene.pbEndScene
|
||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -148,11 +148,11 @@ class PokemonPokegearScreen
|
|||||||
screen = PokemonRegionMapScreen.new(scene)
|
screen = PokemonRegionMapScreen.new(scene)
|
||||||
ret = screen.pbStartScreen
|
ret = screen.pbStartScreen
|
||||||
if ret
|
if ret
|
||||||
$PokemonTemp.flydata = ret
|
$game_temp.fly_destination = ret
|
||||||
next 99999 # Ugly hack to make Pokégear scene not reappear if flying
|
next 99999 # Ugly hack to make Pokégear scene not reappear if flying
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
break if $PokemonTemp.flydata
|
break if $game_temp.fly_destination
|
||||||
elsif cmdPhone>=0 && cmd==cmdPhone
|
elsif cmdPhone>=0 && cmd==cmdPhone
|
||||||
pbFadeOutIn {
|
pbFadeOutIn {
|
||||||
PokemonPhoneScene.new.start
|
PokemonPhoneScene.new.start
|
||||||
@@ -165,6 +165,6 @@ class PokemonPokegearScreen
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
($PokemonTemp.flydata) ? @scene.dispose : @scene.pbEndScene
|
($game_temp.fly_destination) ? @scene.dispose : @scene.pbEndScene
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -358,6 +358,6 @@ def pbShowMap(region = -1, wallmap = true)
|
|||||||
scene = PokemonRegionMap_Scene.new(region, wallmap)
|
scene = PokemonRegionMap_Scene.new(region, wallmap)
|
||||||
screen = PokemonRegionMapScreen.new(scene)
|
screen = PokemonRegionMapScreen.new(scene)
|
||||||
ret = screen.pbStartScreen
|
ret = screen.pbStartScreen
|
||||||
$PokemonTemp.flydata = ret if ret && !wallmap
|
$game_temp.fly_destination = ret if ret && !wallmap
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class PokemonSaveScreen
|
|||||||
ret = false
|
ret = false
|
||||||
@scene.pbStartScreen
|
@scene.pbStartScreen
|
||||||
if pbConfirmMessage(_INTL('Would you like to save the game?'))
|
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('WARNING!'))
|
||||||
pbMessage(_INTL('There is a different game file that is already saved.'))
|
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."))
|
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
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
$PokemonTemp.begunNewGame = false
|
$game_temp.begun_new_game = false
|
||||||
pbSEPlay('GUI save choice')
|
pbSEPlay('GUI save choice')
|
||||||
if Game.save
|
if Game.save
|
||||||
pbMessage(_INTL("\\se[]{1} saved the game.\\me[GUI save game]\\wtnp[30]", $player.name))
|
pbMessage(_INTL("\\se[]{1} saved the game.\\me[GUI save game]\\wtnp[30]", $player.name))
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ class PokemonReadyMenu
|
|||||||
pbShowMenu if !ret
|
pbShowMenu if !ret
|
||||||
}
|
}
|
||||||
if ret
|
if ret
|
||||||
$PokemonTemp.flydata = ret
|
$game_temp.fly_destination = ret
|
||||||
$game_temp.in_menu = false
|
$game_temp.in_menu = false
|
||||||
pbUseHiddenMove(user,move)
|
pbUseHiddenMove(user,move)
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ def pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin)
|
|||||||
pbMessage(_INTL("SKIPPING BATTLE..."))
|
pbMessage(_INTL("SKIPPING BATTLE..."))
|
||||||
pbMessage(_INTL("AFTER WINNING..."))
|
pbMessage(_INTL("AFTER WINNING..."))
|
||||||
pbMessage(endspeech || "...")
|
pbMessage(endspeech || "...")
|
||||||
$PokemonTemp.lastbattle = nil
|
$game_temp.last_battle_record = nil
|
||||||
pbMEStop
|
pbMEStop
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -86,9 +86,9 @@ def pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin)
|
|||||||
pkmn.item = olditems2[i]
|
pkmn.item = olditems2[i]
|
||||||
end
|
end
|
||||||
# Save the record of the battle
|
# 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
|
if decision == 1 || decision == 2 || decision == 5 # if win, loss or draw
|
||||||
$PokemonTemp.lastbattle = battle.pbDumpRecord
|
$game_temp.last_battle_record = battle.pbDumpRecord
|
||||||
end
|
end
|
||||||
# Return true if the player won the battle, and false if any other result
|
# Return true if the player won the battle, and false if any other result
|
||||||
return (decision == 1)
|
return (decision == 1)
|
||||||
@@ -98,8 +98,8 @@ end
|
|||||||
# Methods that record and play back a battle.
|
# Methods that record and play back a battle.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def pbRecordLastBattle
|
def pbRecordLastBattle
|
||||||
$PokemonGlobal.lastbattle = $PokemonTemp.lastbattle
|
$PokemonGlobal.lastbattle = $game_temp.last_battle_record
|
||||||
$PokemonTemp.lastbattle = nil
|
$game_temp.last_battle_record = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbPlayLastBattle
|
def pbPlayLastBattle
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ def pbTrainerName(name = nil, outfit = 0)
|
|||||||
end
|
end
|
||||||
$player.name = name
|
$player.name = name
|
||||||
$player.outfit = outfit
|
$player.outfit = outfit
|
||||||
$PokemonTemp.begunNewGame = true
|
$game_temp.begun_new_game = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbSuggestTrainerName(gender)
|
def pbSuggestTrainerName(gender)
|
||||||
|
|||||||
@@ -1366,7 +1366,7 @@ def pbRegionalDexEditorMain
|
|||||||
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
|
||||||
when 0 # Save all changes to Dexes
|
when 0 # Save all changes to Dexes
|
||||||
save_data(dex_lists, "Data/regional_dexes.dat")
|
save_data(dex_lists, "Data/regional_dexes.dat")
|
||||||
$PokemonTemp.regionalDexes = nil
|
$game_temp.regional_dexes_data = nil
|
||||||
Compiler.write_regional_dexes
|
Compiler.write_regional_dexes
|
||||||
pbMessage(_INTL("Data saved."))
|
pbMessage(_INTL("Data saved."))
|
||||||
break
|
break
|
||||||
@@ -1489,7 +1489,7 @@ def pbAnimationsOrganiser
|
|||||||
if cmd2==0
|
if cmd2==0
|
||||||
# Save animations here
|
# Save animations here
|
||||||
save_data(list,"Data/PkmnAnimations.rxdata")
|
save_data(list,"Data/PkmnAnimations.rxdata")
|
||||||
$PokemonTemp.battleAnims = nil
|
$game_temp.battle_animations_data = nil
|
||||||
pbMessage(_INTL("Data saved."))
|
pbMessage(_INTL("Data saved."))
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ def pbConvertAnimsToNewFormat
|
|||||||
end
|
end
|
||||||
if count>0
|
if count>0
|
||||||
save_data(animations,"Data/PkmnAnimations.rxdata")
|
save_data(animations,"Data/PkmnAnimations.rxdata")
|
||||||
$PokemonTemp.battleAnims = nil
|
$game_temp.battle_animations_data = nil
|
||||||
end
|
end
|
||||||
pbMessage(_INTL("{1} animations converted to new format.",count))
|
pbMessage(_INTL("{1} animations converted to new format.",count))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1021,7 +1021,7 @@ def animationEditorMain(animation)
|
|||||||
save_data(animation,"Data/PkmnAnimations.rxdata")
|
save_data(animation,"Data/PkmnAnimations.rxdata")
|
||||||
end
|
end
|
||||||
if pbConfirmMessage(_INTL("Exit from the editor?"))
|
if pbConfirmMessage(_INTL("Exit from the editor?"))
|
||||||
$PokemonTemp.battleAnims = nil
|
$game_temp.battle_animations_data = nil
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ DebugMenuCommands.register("testwildbattle", {
|
|||||||
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",
|
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",
|
||||||
GameData::Species.get(species).name), params)
|
GameData::Species.get(species).name), params)
|
||||||
if level > 0
|
if level > 0
|
||||||
$PokemonTemp.encounterType = nil
|
$game_temp.encounter_type = nil
|
||||||
pbWildBattle(species, level)
|
pbWildBattle(species, level)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -242,7 +242,7 @@ DebugMenuCommands.register("testwildbattleadvanced", {
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
setBattleRule(sprintf("%dv%d", size0, pkmn.length))
|
setBattleRule(sprintf("%dv%d", size0, pkmn.length))
|
||||||
$PokemonTemp.encounterType = nil
|
$game_temp.encounter_type = nil
|
||||||
pbWildBattleCore(*pkmn)
|
pbWildBattleCore(*pkmn)
|
||||||
break
|
break
|
||||||
elsif pkmnCmd == pkmnCmds.length - 2 # Set player side size
|
elsif pkmnCmd == pkmnCmds.length - 2 # Set player side size
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ def pbImportAllAnimations
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
save_data(animations,"Data/PkmnAnimations.rxdata")
|
save_data(animations,"Data/PkmnAnimations.rxdata")
|
||||||
$PokemonTemp.battleAnims = nil
|
$game_temp.battle_animations_data = nil
|
||||||
pbDisposeMessageWindow(msgwindow)
|
pbDisposeMessageWindow(msgwindow)
|
||||||
pbMessage(_INTL("All animations were imported."))
|
pbMessage(_INTL("All animations were imported."))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ module Compiler
|
|||||||
end
|
end
|
||||||
if imported
|
if imported
|
||||||
save_data(mapinfos,"Data/MapInfos.rxdata")
|
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))
|
pbMessage(_INTL("{1} new map(s) copied to the Data folder were successfully imported.",count))
|
||||||
end
|
end
|
||||||
return imported
|
return imported
|
||||||
|
|||||||
Reference in New Issue
Block a user