General tidying up

This commit is contained in:
Maruno17
2020-12-28 15:46:08 +00:00
parent d3d7222fd3
commit fb29c6b760
44 changed files with 1822 additions and 2650 deletions

View File

@@ -5,39 +5,14 @@
# Refer to "$game_temp" for the instance of this class.
#===============================================================================
class Game_Temp
attr_accessor :map_bgm # map music (for battle memory)
attr_accessor :message_text # message text
attr_accessor :message_proc # message callback (Proc)
attr_accessor :choice_start # show choices: opening line
attr_accessor :choice_max # show choices: number of items
attr_accessor :choice_cancel_type # show choices: cancel
attr_accessor :choice_proc # show choices: callback (Proc)
attr_accessor :num_input_start # input number: opening line
attr_accessor :num_input_variable_id # input number: variable ID
attr_accessor :num_input_digits_max # input number: digit amount
attr_accessor :message_window_showing # message window showing
attr_accessor :common_event_id # common event ID
attr_accessor :in_battle # in-battle flag
attr_accessor :battle_calling # battle calling flag
attr_accessor :battle_troop_id # battle troop ID
attr_accessor :battle_can_escape # battle flag: escape possible
attr_accessor :battle_can_lose # battle flag: losing possible
attr_accessor :battle_proc # battle callback (Proc)
attr_accessor :battle_turn # number of battle turns
attr_accessor :battle_event_flags # battle event flags: completed
attr_accessor :battle_abort # battle flag: interrupt
attr_accessor :battle_main_phase # battle flag: main phase
attr_accessor :battleback_name # battleback file name
attr_accessor :forcing_battler # battler being forced into action
attr_accessor :shop_calling # shop calling flag
attr_accessor :shop_goods # list of shop goods
attr_accessor :name_calling # name input: calling flag
attr_accessor :name_actor_id # name input: actor ID
attr_accessor :name_max_char # name input: max character count
attr_accessor :menu_calling # menu calling flag
attr_accessor :menu_beep # menu: play sound effect flag
attr_accessor :in_menu # menu is open
attr_accessor :save_calling # save calling flag
attr_accessor :menu_beep # menu: play sound effect flag
attr_accessor :menu_calling # menu calling flag
attr_accessor :debug_calling # debug calling flag
attr_accessor :player_transferring # player place movement flag
attr_accessor :player_new_map_id # player destination: map ID
@@ -46,47 +21,25 @@ class Game_Temp
attr_accessor :player_new_direction # player destination: direction
attr_accessor :transition_processing # transition processing flag
attr_accessor :transition_name # transition file name
attr_accessor :gameover # game over flag
attr_accessor :to_title # return to title screen flag
attr_accessor :last_file_index # last save file no.
attr_accessor :map_refresh # map needs redrawing
attr_accessor :fadestate # for sprite hashes
attr_accessor :background_bitmap
attr_accessor :message_window_showing
attr_accessor :player_transferring
attr_accessor :transition_processing
attr_accessor :mart_prices
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@map_bgm = nil
@message_text = nil
@message_proc = nil
@choice_start = 99
@choice_max = 0
@choice_cancel_type = 0
@choice_proc = nil
@num_input_start = 99
@num_input_variable_id = 0
@num_input_digits_max = 0
@message_window_showing = false
@common_event_id = 0
@in_battle = false
@battle_calling = false
@battle_troop_id = 0
@battle_can_escape = false
@battle_can_lose = false
@battle_proc = nil
@battle_turn = 0
@battle_event_flags = {}
@battle_abort = false
@battle_main_phase = false
@battleback_name = ''
@forcing_battler = nil
@shop_calling = false
@shop_id = 0
@name_calling = false
@name_actor_id = 0
@name_max_char = 0
@menu_calling = false
@menu_beep = false
@in_menu = false
@save_calling = false
@menu_beep = false
@menu_calling = false
@debug_calling = false
@player_transferring = false
@player_new_map_id = 0
@@ -95,10 +48,16 @@ class Game_Temp
@player_new_direction = 0
@transition_processing = false
@transition_name = ""
@gameover = false
@to_title = false
@last_file_index = 0
@debug_top_row = 0
@debug_index = 0
@fadestate = 0
@background_bitmap = nil
@message_window_showing = false
@player_transferring = false
@transition_processing = false
@mart_prices = []
end
def clear_mart_prices
@mart_prices = []
end
end

View File

@@ -5,7 +5,6 @@
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
attr_reader :map_interpreter # map event interpreter
attr_reader :battle_interpreter # battle event interpreter

View File

@@ -106,9 +106,20 @@ class Game_Event < Game_Character
return elapsed>=days
end
def cooledDown?(seconds)
return true if expired?(seconds) && tsOff?("A")
self.need_refresh = true
return false
end
def cooledDownDays?(days)
return true if expiredDays?(days) && tsOff?("A")
self.need_refresh = true
return false
end
def onEvent?
return @map_id==$game_map.map_id &&
$game_player.x==self.x && $game_player.y==self.y
return @map_id == $game_map.map_id && $game_player.x == self.x && $game_player.y == self.y
end
def over_trigger?

View File

@@ -400,8 +400,6 @@ class PokemonMapFactory
end
end
#===============================================================================
# Map Factory Helper (stores map connection and size data and calculations
# involving them)
@@ -506,8 +504,10 @@ module MapFactoryHelper
end
end
#===============================================================================
#
#===============================================================================
# Unused
def updateTilesets
maps = $MapFactory.maps
for map in maps

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -91,12 +91,6 @@ class Scene_Map
Input.update
end
def call_name
$game_temp.name_calling = false
$game_player.straighten
$game_map.update
end
def call_menu
$game_temp.menu_calling = false
$game_temp.in_menu = true
@@ -202,12 +196,8 @@ class Scene_Map
end
end
unless $game_player.moving?
if $game_temp.name_calling; call_name
elsif $game_temp.menu_calling; call_menu
if $game_temp.menu_calling; call_menu
elsif $game_temp.debug_calling; call_debug
# elsif $game_temp.battle_calling; call_battle
# elsif $game_temp.shop_calling; call_shop
# elsif $game_temp.save_calling; call_save
elsif $PokemonTemp.keyItemCalling
$PokemonTemp.keyItemCalling = false
$game_player.straighten

View File

@@ -513,21 +513,9 @@ def pbDisposed?(x)
return false
end
#===============================================================================
# Fades and window activations for sprite hashes
#===============================================================================
class Game_Temp
attr_writer :fadestate
def fadestate
return @fadestate || 0
end
end
def pbPushFade
$game_temp.fadestate = [$game_temp.fadestate+1,0].max if $game_temp
end

View File

@@ -1,30 +1,9 @@
#===============================================================================
# Message variables
#===============================================================================
class Game_Temp
attr_accessor :background
attr_writer :message_window_showing
attr_writer :player_transferring
attr_writer :transition_processing
def message_window_showing
return @message_window_showing || false
end
def player_transferring
return @player_transferring || false
end
def transition_processing
return @transition_processing || false
end
end
class Game_Message
attr_writer :background
attr_writer :visible
attr_writer :background
def visible
return @visible || false
@@ -37,16 +16,6 @@ end
class Game_System
attr_writer :message_position
def message_position
return @message_position || 2
end
end
#===============================================================================
#
#===============================================================================
@@ -155,8 +124,6 @@ def pbUpdateSceneMap
end
end
#===============================================================================
#
#===============================================================================
@@ -189,330 +156,6 @@ def pbCurrentEventCommentInput(elements,trigger)
return pbEventCommentInput(event,elements,trigger)
end
def pbButtonInputProcessing(variableNumber=0,timeoutFrames=0)
ret=0
timeoutFrames = timeoutFrames*Graphics.frame_rate/20
loop do
Graphics.update
Input.update
pbUpdateSceneMap
for i in 1..18
ret=i if Input.trigger?(i)
end
break if ret!=0
if timeoutFrames>0
i+=1
break if i>=timeoutFrames
end
end
Input.update
if variableNumber && variableNumber>0
$game_variables[variableNumber]=ret
$game_map.need_refresh = true if $game_map
end
return ret
end
#===============================================================================
# Interpreter functions for displaying messages
#===============================================================================
module InterpreterMixin
# Freezes all events on the map (for use at the beginning of common events)
def pbGlobalLock
for event in $game_map.events.values
event.minilock
end
end
# Unfreezes all events on the map (for use at the end of common events)
def pbGlobalUnlock
for event in $game_map.events.values
event.unlock
end
end
def pbRepeatAbove(index)
index=@list[index].indent
loop do
index-=1
return index+1 if @list[index].indent==indent
end
end
def pbBreakLoop(index)
indent = @list[index].indent
temp_index=index
# Copy index to temporary variables
loop do
# Advance index
temp_index += 1
# If a fitting loop was not found
return index+1 if temp_index >= @list.size-1
return temp_index+1 if @list[temp_index].code == 413 and
@list[temp_index].indent < indent
end
end
def pbJumpToLabel(index,label_name)
temp_index = 0
loop do
return index+1 if temp_index >= @list.size-1
return temp_index+1 if @list[temp_index].code == 118 and
@list[temp_index].parameters[0] == label_name
temp_index += 1
end
end
# Gets the next index in the interpreter, ignoring
# certain events between messages
def pbNextIndex(index)
return -1 if !@list || @list.length==0
i=index+1
loop do
return i if i>=@list.length-1
case @list[i].code
when 118, 108, 408 # Label, Comment
i+=1
when 413 # Repeat Above
i=pbRepeatAbove(i)
when 113 # Break Loop
i=pbBreakLoop(i)
when 119 # Jump to Label
newI=pbJumpToLabel(i,@list[i].parameters[0])
i = (newI>i) ? newI : i+1
else
return i
end
end
end
# Helper function that shows a picture in a script. To be used in
# a script event command.
def pbShowPicture(number,name,origin,x,y,zoomX=100,zoomY=100,opacity=255,blendType=0)
number = number + ($game_temp.in_battle ? 50 : 0)
$game_screen.pictures[number].show(name,origin,
x, y, zoomX,zoomY,opacity,blendType)
end
# Erases an event and adds it to the list of erased events so that
# it can stay erased when the game is saved then loaded again. To be used in
# a script event command.
def pbEraseThisEvent
if $game_map.events[@event_id]
$game_map.events[@event_id].erase
$PokemonMap.addErasedEvent(@event_id) if $PokemonMap
end
@index+=1
return true
end
# Runs a common event. To be used in a script event command.
def pbCommonEvent(id)
common_event = $data_common_events[id]
if $game_temp.in_battle
if common_event != nil
interp = Interpreter.new
interp.setup(common_event.list,0)
loop do
Graphics.update
Input.update
interp.update
pbUpdateSceneMap
break if !interp.running?
end
end
else
$game_system.battle_interpreter.setup(common_event.list, 0)
end
end
# Sets another event's self switch (eg. pbSetSelfSwitch(20,"A",true) ).
# To be used in a script event command.
def pbSetSelfSwitch(event,swtch,value,mapid=-1)
mapid = @map_id if mapid<0
oldValue = $game_self_switches[[mapid,event,swtch]]
$game_self_switches[[mapid,event,swtch]] = value
if value!=oldValue && $MapFactory.hasMap?(mapid)
$MapFactory.getMap(mapid,false).need_refresh = true
end
end
# Must use this approach to share the methods because the methods already
# defined in a class override those defined in an included module
CustomEventCommands=<<_END_
def command_242
pbBGMFade(pbParams[0])
return true
end
def command_246
pbBGSFade(pbParams[0])
return true
end
def command_251
pbSEStop
return true
end
def command_241
pbBGMPlay(pbParams[0])
return true
end
def command_245
pbBGSPlay(pbParams[0])
return true
end
def command_249
pbMEPlay(pbParams[0])
return true
end
def command_250
pbSEPlay(pbParams[0])
return true
end
_END_
end
class Interpreter # Used by RMXP
include InterpreterMixin
eval(InterpreterMixin::CustomEventCommands)
@@immediateDisplayAfterWait=false
@buttonInput=false
def pbParams
return @parameters
end
def command_105
return false if @buttonInput
@buttonInput=true
pbButtonInputProcessing(@list[@index].parameters[0])
@buttonInput=false
@index+=1
return true
end
def command_101
if $game_temp.message_window_showing
return false
end
message=""
commands=nil
numInputVar=nil
numInputDigitsMax=nil
text=""
firstText=nil
if @list[@index].parameters.length==1
text+=@list[@index].parameters[0]
firstText=@list[@index].parameters[0]
text+=" " if text[text.length-1,1]!=" "
message+=text
else
facename=@list[@index].parameters[0]
faceindex=@list[@index].parameters[1]
if facename && facename!=""
text+="\\ff[#{facename},#{faceindex}]"
message+=text
end
end
messageend=""
loop do
nextIndex=pbNextIndex(@index)
code=@list[nextIndex].code
if code == 401
text=@list[nextIndex].parameters[0]
text+=" " if text[text.length-1,1]!=" "
message+=text
@index=nextIndex
else
if code == 102
commands=@list[nextIndex].parameters
@index=nextIndex
elsif code == 106 && @@immediateDisplayAfterWait
params=@list[nextIndex].parameters
if params[0]<=10
nextcode=@list[nextIndex+1].code
if nextcode==101 || nextcode==102 || nextcode==103
@index=nextIndex
else
break
end
else
break
end
elsif code == 103
numInputVar=@list[nextIndex].parameters[0]
numInputDigitsMax=@list[nextIndex].parameters[1]
@index=nextIndex
elsif code == 101
if @list[@index].parameters.length==1
text=@list[@index].parameters[0]
if text[/\A\\ignr/] && text==firstText
text+=" " if text[text.length-1,1]!=" "
message+=text
@index=nextIndex
continue
end
end
messageend="\1"
end
break
end
end
@message_waiting=true # needed to allow parallel process events to work while
# a message is displayed
message=_MAPINTL($game_map.map_id,message)
if commands
cmdlist=[]
for cmd in commands[0]
cmdlist.push(_MAPINTL($game_map.map_id,cmd))
end
command=pbMessage(message+messageend,cmdlist,commands[1])
@branch[@list[@index].indent] = command
elsif numInputVar
params=ChooseNumberParams.new
params.setMaxDigits(numInputDigitsMax)
params.setDefaultValue($game_variables[numInputVar])
$game_variables[numInputVar]=pbMessageChooseNumber(message+messageend,params)
$game_map.need_refresh = true if $game_map
else
pbMessage(message+messageend,nil)
end
@message_waiting=false
return true
end
def command_102
@message_waiting=true
command=pbShowCommands(nil,@list[@index].parameters[0],@list[@index].parameters[1])
@message_waiting=false
@branch[@list[@index].indent] = command
Input.update # Must call Input.update again to avoid extra triggers
return true
end
def command_103
varnumber=@list[@index].parameters[0]
@message_waiting=true
params=ChooseNumberParams.new
params.setMaxDigits(@list[@index].parameters[1])
params.setDefaultValue($game_variables[varnumber])
$game_variables[varnumber]=pbChooseNumber(nil,params)
$game_map.need_refresh = true if $game_map
@message_waiting=false
return true
end
end
#===============================================================================

View File

@@ -1507,32 +1507,6 @@ end
#===============================================================================
# Interpreter functions for naming the player
#===============================================================================
class Interpreter
def command_303
if $Trainer
$Trainer.name=pbEnterPlayerName(_INTL("Your name?"),1,@parameters[1],$Trainer.name)
return true
end
if $game_actors && $data_actors && $data_actors[@parameters[0]] != nil
# Set battle abort flag
$game_temp.battle_abort = true
pbFadeOutIn {
sscene=PokemonEntryScene.new
sscreen=PokemonEntry.new(sscene)
$game_actors[@parameters[0]].name=sscreen.pbStartScreen(
_INTL("Enter {1}'s name.",$game_actors[@parameters[0]].name),
1,@parameters[1],$game_actors[@parameters[0]].name)
}
end
return true
end
end
#===============================================================================
#
#===============================================================================

View File

@@ -137,92 +137,8 @@ end
def pbGetMetadata(map_id, metadata_type)
if map_id == 0 # Global metadata
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::Metadata.get.something')
ret = GameData::Metadata.get
case metadata_type
when Metadata::HOME then return ret.home
when Metadata::WILD_BATTLE_BGM then return ret.wild_battle_BGM
when Metadata::TRAINER_BATTLE_BGM then return ret.trainer_battle_BGM
when Metadata::WILD_VICTORY_ME then return ret.wild_victory_ME
when Metadata::TRAINER_VICTORY_ME then return ret.trainer_victory_ME
when Metadata::WILD_CAPTURE_ME then return ret.wild_capture_ME
when Metadata::SURF_BGM then return ret.surf_BGM
when Metadata::BICYCLE_BGM then return ret.bicycle_BGM
when Metadata::PLAYER_A then return ret.player_A
when Metadata::PLAYER_B then return ret.player_B
when Metadata::PLAYER_C then return ret.player_C
when Metadata::PLAYER_D then return ret.player_D
when Metadata::PLAYER_E then return ret.player_E
when Metadata::PLAYER_F then return ret.player_F
when Metadata::PLAYER_G then return ret.player_G
when Metadata::PLAYER_H then return ret.player_H
end
else # Map metadata
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::MapMetadata.get(map_id).something')
ret = GameData::MapMetadata.get(map_id)
case metadata_type
when MapMetadata::OUTDOOR then return ret.outdoor_map
when MapMetadata::SHOW_AREA then return ret.announce_location
when MapMetadata::BICYCLE then return ret.can_bicycle
when MapMetadata::BICYCLE_ALWAYS then return ret.always_bicycle
when MapMetadata::HEALING_SPOT then return ret.teleport_destination
when MapMetadata::WEATHER then return ret.weather
when MapMetadata::MAP_POSITION then return ret.town_map_position
when MapMetadata::DIVE_MAP then return ret.dive_map_id
when MapMetadata::DARK_MAP then return ret.dark_map
when MapMetadata::SAFARI_MAP then return ret.safari_map
when MapMetadata::SNAP_EDGES then return ret.snap_edges
when MapMetadata::DUNGEON then return ret.random_dungeon
when MapMetadata::BATTLE_BACK then return ret.battle_background
when MapMetadata::WILD_BATTLE_BGM then return ret.wild_battle_BGM
when MapMetadata::TRAINER_BATTLE_BGM then return ret.trainer_battle_BGM
when MapMetadata::WILD_VICTORY_ME then return ret.wild_victory_ME
when MapMetadata::TRAINER_VICTORY_ME then return ret.trainer_victory_ME
when MapMetadata::WILD_CAPTURE_ME then return ret.wild_capture_ME
when MapMetadata::MAP_SIZE then return ret.town_map_size
when MapMetadata::ENVIRONMENT then return ret.battle_environment
end
end
return nil
end
module Metadata
HOME = 1
WILD_BATTLE_BGM = 2
TRAINER_BATTLE_BGM = 3
WILD_VICTORY_ME = 4
TRAINER_VICTORY_ME = 5
WILD_CAPTURE_ME = 6
SURF_BGM = 7
BICYCLE_BGM = 8
PLAYER_A = 9
PLAYER_B = 10
PLAYER_C = 11
PLAYER_D = 12
PLAYER_E = 13
PLAYER_F = 14
PLAYER_G = 15
PLAYER_H = 16
end
module MapMetadata
OUTDOOR = 1
SHOW_AREA = 2
BICYCLE = 3
BICYCLE_ALWAYS = 4
HEALING_SPOT = 5
WEATHER = 6
MAP_POSITION = 7
DIVE_MAP = 8
DARK_MAP = 9
SAFARI_MAP = 10
SNAP_EDGES = 11
DUNGEON = 12
BATTLE_BACK = 13
WILD_BATTLE_BGM = 14
TRAINER_BATTLE_BGM = 15
WILD_VICTORY_ME = 16
TRAINER_VICTORY_ME = 17
WILD_CAPTURE_ME = 18
MAP_SIZE = 19
ENVIRONMENT = 20
end

View File

@@ -72,23 +72,6 @@ end
#===============================================================================
# Deprecated methods
#===============================================================================
module MoveData
ID = 0
INTERNAL_NAME = 1
NAME = 2
FUNCTION_CODE = 3
BASE_DAMAGE = 4
TYPE = 5
CATEGORY = 6
ACCURACY = 7
TOTAL_PP = 8
EFFECT_CHANCE = 9
TARGET = 10
PRIORITY = 11
FLAGS = 12
DESCRIPTION = 13
end
def pbGetMoveData(move_id, move_data_type = -1)
Deprecation.warn_method('pbGetMoveData', 'v20', 'GameData::Move.get(move_id)')
return GameData::Move.get(move_id)

View File

@@ -56,7 +56,3 @@ module GameData
end
end
end
#===============================================================================
# Deprecated methods
#===============================================================================

View File

@@ -72,7 +72,6 @@ module GameData
return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
end
# TODO: Needs tidying up.
def self.schema(compiling_forms = false)
ret = {
"FormName" => [0, "q"],
@@ -224,92 +223,11 @@ end
#===============================================================================
# Deprecated methods
#===============================================================================
module SpeciesData
TYPE1 = 0
TYPE2 = 1
BASE_STATS = 2
GENDER_RATE = 3
GROWTH_RATE = 4
BASE_EXP = 5
EFFORT_POINTS = 6
RARENESS = 7
HAPPINESS = 8
ABILITIES = 9
HIDDEN_ABILITY = 10
COMPATIBILITY = 11
STEPS_TO_HATCH = 12
HEIGHT = 13
WEIGHT = 14
COLOR = 15
SHAPE = 16
HABITAT = 17
WILD_ITEM_COMMON = 18
WILD_ITEM_UNCOMMON = 19
WILD_ITEM_RARE = 20
INCENSE = 21
POKEDEX_FORM = 22 # For alternate forms
MEGA_STONE = 23 # For alternate forms
MEGA_MOVE = 24 # For alternate forms
UNMEGA_FORM = 25 # For alternate forms
MEGA_MESSAGE = 26 # For alternate forms
METRIC_PLAYER_X = 27
METRIC_PLAYER_Y = 28
METRIC_ENEMY_X = 29
METRIC_ENEMY_Y = 30
METRIC_ALTITUDE = 31
METRIC_SHADOW_X = 32
METRIC_SHADOW_SIZE = 33
end
#===============================================================================
# Methods to get Pokémon species data.
#===============================================================================
def pbGetSpeciesData(species, form = 0, species_data_type = -1)
Deprecation.warn_method('pbGetSpeciesData', 'v20', 'GameData::Species.get_species_form(species, form).something')
ret = GameData::Species.get_species_form(species, form)
return ret if species_data_type == -1
case species_data_type
when SpeciesData::TYPE1 then return ret.type1
when SpeciesData::TYPE2 then return ret.type2
when SpeciesData::BASE_STATS then return ret.base_stats
when SpeciesData::GENDER_RATE then return ret.gender_rate
when SpeciesData::GROWTH_RATE then return ret.growth_rate
when SpeciesData::BASE_EXP then return ret.base_exp
when SpeciesData::EFFORT_POINTS then return ret.evs
when SpeciesData::RARENESS then return ret.catch_rate
when SpeciesData::HAPPINESS then return ret.happiness
when SpeciesData::ABILITIES then return ret.abilities
when SpeciesData::HIDDEN_ABILITY then return ret.hidden_abilities
when SpeciesData::COMPATIBILITY then return ret.egg_groups
when SpeciesData::STEPS_TO_HATCH then return ret.hatch_steps
when SpeciesData::HEIGHT then return ret.height
when SpeciesData::WEIGHT then return ret.weight
when SpeciesData::COLOR then return ret.color
when SpeciesData::SHAPE then return ret.shape
when SpeciesData::HABITAT then return ret.habitat
when SpeciesData::WILD_ITEM_COMMON then return ret.wild_item_common
when SpeciesData::WILD_ITEM_UNCOMMON then return ret.wild_item_uncommon
when SpeciesData::WILD_ITEM_RARE then return ret.wild_item_rare
when SpeciesData::INCENSE then return ret.incense
when SpeciesData::POKEDEX_FORM then return ret.pokedex_form
when SpeciesData::MEGA_STONE then return ret.mega_stone
when SpeciesData::MEGA_MOVE then return ret.mega_move
when SpeciesData::UNMEGA_FORM then return ret.unmega_form
when SpeciesData::MEGA_MESSAGE then return ret.mega_message
when SpeciesData::METRIC_PLAYER_X then return ret.back_sprite_x
when SpeciesData::METRIC_PLAYER_Y then return ret.back_sprite_y
when SpeciesData::METRIC_ENEMY_X then return ret.front_sprite_x
when SpeciesData::METRIC_ENEMY_Y then return ret.front_sprite_y
when SpeciesData::METRIC_ALTITUDE then return ret.front_sprite_altitude
when SpeciesData::METRIC_SHADOW_X then return ret.shadow_x
when SpeciesData::METRIC_SHADOW_SIZE then return ret.shadow_size
end
return 0
return GameData::Species.get_species_form(species, form)
end
#===============================================================================
# Methods to get Pokémon moves data.
#===============================================================================
def pbGetSpeciesEggMoves(species, form = 0)
Deprecation.warn_method('pbGetSpeciesEggMoves', 'v20', 'GameData::Species.get_species_form(species, form).egg_moves')
return GameData::Species.get_species_form(species, form).egg_moves
@@ -325,9 +243,6 @@ def pbGetEvolutionData(species)
return GameData::Species.get(species).evolutions
end
#===============================================================================
# Method to get Pokémon species metrics (sprite positioning) data.
#===============================================================================
def pbApplyBattlerMetricsToSprite(sprite, index, species_data, shadow = false, metrics = nil)
Deprecation.warn_method('pbApplyBattlerMetricsToSprite', 'v20', 'GameData::Species.get(species).apply_metrics_to_sprite')
GameData::Species.get(species).apply_metrics_to_sprite(sprite, index, shadow)

View File

@@ -268,7 +268,7 @@ module GameData
end
#===============================================================================
# Deprecated
# Deprecated methods
#===============================================================================
def pbLoadSpeciesBitmap(species, gender = 0, form = 0, shiny = false, shadow = false, back = false , egg = false)
Deprecation.warn_method('pbLoadSpeciesBitmap', 'v20', 'GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg)')

View File

@@ -634,195 +634,6 @@ end
#===============================================================================
# Events
#===============================================================================
class Game_Event
def cooledDown?(seconds)
return true if expired?(seconds) && tsOff?("A")
self.need_refresh = true
return false
end
def cooledDownDays?(days)
return true if expiredDays?(days) && tsOff?("A")
self.need_refresh = true
return false
end
end
module InterpreterFieldMixin
# Used in boulder events. Allows an event to be pushed. To be used in
# a script event command.
def pbPushThisEvent
event = get_character(0)
oldx = event.x
oldy = event.y
# Apply strict version of passable, which makes impassable
# tiles that are passable only from certain directions
return if !event.passableStrict?(event.x,event.y,$game_player.direction)
case $game_player.direction
when 2 then event.move_down
when 4 then event.move_left
when 6 then event.move_right
when 8 then event.move_up
end
$PokemonMap.addMovedEvent(@event_id) if $PokemonMap
if oldx!=event.x || oldy!=event.y
$game_player.lock
loop do
Graphics.update
Input.update
pbUpdateSceneMap
break if !event.moving?
end
$game_player.unlock
end
end
def pbPushThisBoulder
pbPushThisEvent if $PokemonMap.strengthUsed
return true
end
def pbSmashThisEvent
event = get_character(0)
pbSmashEvent(event) if event
@index += 1
return true
end
def pbTrainerIntro(symbol)
return true if $DEBUG && !GameData::TrainerType.exists?(symbol)
tr_type = GameData::TrainerType.get(symbol).id
pbGlobalLock
pbPlayTrainerIntroME(tr_type)
return true
end
def pbTrainerEnd
pbGlobalUnlock
e = get_character(0)
e.erase_route if e
end
def pbParams
(@parameters) ? @parameters : @params
end
def pbGetPokemon(id)
return $Trainer.party[pbGet(id)]
end
def pbSetEventTime(*arg)
$PokemonGlobal.eventvars = {} if !$PokemonGlobal.eventvars
time = pbGetTimeNow
time = time.to_i
pbSetSelfSwitch(@event_id,"A",true)
$PokemonGlobal.eventvars[[@map_id,@event_id]]=time
for otherevt in arg
pbSetSelfSwitch(otherevt,"A",true)
$PokemonGlobal.eventvars[[@map_id,otherevt]]=time
end
end
def getVariable(*arg)
if arg.length==0
return nil if !$PokemonGlobal.eventvars
return $PokemonGlobal.eventvars[[@map_id,@event_id]]
else
return $game_variables[arg[0]]
end
end
def setVariable(*arg)
if arg.length==1
$PokemonGlobal.eventvars = {} if !$PokemonGlobal.eventvars
$PokemonGlobal.eventvars[[@map_id,@event_id]]=arg[0]
else
$game_variables[arg[0]] = arg[1]
$game_map.need_refresh = true
end
end
def tsOff?(c)
get_character(0).tsOff?(c)
end
def tsOn?(c)
get_character(0).tsOn?(c)
end
alias isTempSwitchOn? tsOn?
alias isTempSwitchOff? tsOff?
def setTempSwitchOn(c)
get_character(0).setTempSwitchOn(c)
end
def setTempSwitchOff(c)
get_character(0).setTempSwitchOff(c)
end
# Must use this approach to share the methods because the methods already
# defined in a class override those defined in an included module
CustomEventCommands=<<_END_
def command_352
scene = PokemonSave_Scene.new
screen = PokemonSaveScreen.new(scene)
screen.pbSaveScreen
return true
end
def command_125
value = operate_value(pbParams[0], pbParams[1], pbParams[2])
$Trainer.money += value
return true
end
def command_132
($PokemonGlobal.nextBattleBGM = pbParams[0]) ? pbParams[0].clone : nil
return true
end
def command_133
($PokemonGlobal.nextBattleME = pbParams[0]) ? pbParams[0].clone : nil
return true
end
def command_353
pbBGMFade(1.0)
pbBGSFade(1.0)
pbFadeOutIn { pbStartOver(true) }
end
def command_314
pbHealAll if pbParams[0]==0
return true
end
_END_
end
class Interpreter
include InterpreterFieldMixin
eval(InterpreterFieldMixin::CustomEventCommands)
end
class Game_Interpreter
include InterpreterFieldMixin
eval(InterpreterFieldMixin::CustomEventCommands)
end
#===============================================================================
# Audio playing
#===============================================================================

View File

@@ -1,12 +1,6 @@
#===============================================================================
# Battle start animation
#===============================================================================
class Game_Temp
attr_accessor :background_bitmap
end
def pbSceneStandby
$scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map)
GC.start

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class PokemonPauseMenu_Scene
def pbStartScene
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@@ -78,8 +81,9 @@ class PokemonPauseMenu_Scene
def pbRefresh; end
end
#===============================================================================
#
#===============================================================================
class PokemonPauseMenu
def initialize(scene)
@scene = scene

View File

@@ -31,8 +31,9 @@ class Window_DexesList < Window_CommandPokemon
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokedexMenu_Scene
def pbUpdate
pbUpdateSpriteHash(@sprites)
@@ -81,8 +82,9 @@ class PokemonPokedexMenu_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokedexMenuScreen
def initialize(scene)
@scene = scene

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class Window_Pokedex < Window_DrawableCommand
def initialize(x,y,width,height,viewport)
@commands = []
@@ -69,8 +72,9 @@ class Window_Pokedex < Window_DrawableCommand
end
end
#===============================================================================
#
#===============================================================================
class PokedexSearchSelectionSprite < SpriteWrapper
attr_reader :index
attr_accessor :cmds
@@ -207,8 +211,6 @@ class PokedexSearchSelectionSprite < SpriteWrapper
end
end
#===============================================================================
# Pokédex main screen
#===============================================================================
@@ -236,8 +238,8 @@ class PokemonPokedex_Scene
@viewport.z = 99999
addBackgroundPlane(@sprites,"background","Pokedex/bg_list",@viewport)
=begin
# Suggestion for changing the background depending on region. You can change
# the line above with the following:
# Suggestion for changing the background depending on region. You can change
# the line above with the following:
if pbGetPokedexRegion==-1 # Using national Pokédex
addBackgroundPlane(@sprites,"background","Pokedex/bg_national",@viewport)
elsif pbGetPokedexRegion==0 # Using first regional Pokédex
@@ -1174,8 +1176,9 @@ class PokemonPokedex_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokedexScreen
def initialize(scene)
@scene = scene

View File

@@ -1,16 +1,6 @@
def pbFindEncounter(encounter,species)
return false if !encounter
for i in 0...encounter.length
next if !encounter[i]
for j in 0...encounter[i].length
return true if encounter[i][j][0]==species
end
end
return false
end
#===============================================================================
#
#===============================================================================
class PokemonPokedexInfo_Scene
def pbStartScene(dexlist,index,region)
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@@ -286,6 +276,17 @@ class PokemonPokedexInfo_Scene
pbDrawImagePositions(overlay, imagepos)
end
def pbFindEncounter(encounter,species)
return false if !encounter
for i in 0...encounter.length
next if !encounter[i]
for j in 0...encounter[i].length
return true if encounter[i][j][0]==species
end
end
return false
end
def drawPageArea
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_area"))
overlay = @sprites["overlay"].bitmap
@@ -539,8 +540,9 @@ class PokemonPokedexInfo_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokedexInfoScreen
def initialize(scene)
@scene = scene

View File

@@ -75,32 +75,36 @@ class PokemonPartyConfirmCancelSprite < SpriteWrapper
end
end
#===============================================================================
#
#===============================================================================
class PokemonPartyCancelSprite < PokemonPartyConfirmCancelSprite
def initialize(viewport=nil)
super(_INTL("CANCEL"),398,328,false,viewport)
end
end
#===============================================================================
#
#===============================================================================
class PokemonPartyConfirmSprite < PokemonPartyConfirmCancelSprite
def initialize(viewport=nil)
super(_INTL("CONFIRM"),398,308,true,viewport)
end
end
#===============================================================================
#
#===============================================================================
class PokemonPartyCancelSprite2 < PokemonPartyConfirmCancelSprite
def initialize(viewport=nil)
super(_INTL("CANCEL"),398,346,true,viewport)
end
end
#===============================================================================
#
#===============================================================================
class Window_CommandPokemonColor < Window_CommandPokemon
def initialize(commands,width=nil)
@colorKey = []
@@ -127,10 +131,8 @@ class Window_CommandPokemonColor < Window_CommandPokemon
end
end
#===============================================================================
# Pokémon party panels
# Blank party panel
#===============================================================================
class PokemonPartyBlankPanel < SpriteWrapper
attr_accessor :text
@@ -158,8 +160,9 @@ class PokemonPartyBlankPanel < SpriteWrapper
def refresh; end
end
#===============================================================================
# Pokémon party panel
#===============================================================================
class PokemonPartyPanel < SpriteWrapper
attr_reader :pokemon
attr_reader :active
@@ -423,8 +426,6 @@ class PokemonPartyPanel < SpriteWrapper
end
end
#===============================================================================
# Pokémon party visuals
#===============================================================================
@@ -820,8 +821,6 @@ class PokemonParty_Scene
end
end
#===============================================================================
# Pokémon party mechanics
#===============================================================================
@@ -941,7 +940,7 @@ class PokemonPartyScreen
def pbChooseMove(pokemon,helptext,index=0)
movenames = []
for i in pokemon.moves
break if i.id==0
next if !i || !i.id
if i.total_pp<=0
movenames.push(_INTL("{1} (PP: ---)",i.name))
else
@@ -1324,8 +1323,6 @@ class PokemonPartyScreen
end
end
#===============================================================================
# Open the party screen
#===============================================================================

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class MoveSelectionSprite < SpriteWrapper
attr_reader :preselected
attr_reader :index
@@ -52,8 +55,9 @@ class MoveSelectionSprite < SpriteWrapper
end
end
#===============================================================================
#
#===============================================================================
class RibbonSelectionSprite < MoveSelectionSprite
def initialize(viewport=nil)
super(viewport)
@@ -94,8 +98,9 @@ class RibbonSelectionSprite < MoveSelectionSprite
end
end
#===============================================================================
#
#===============================================================================
class PokemonSummary_Scene
def pbUpdate
pbUpdateSpriteHash(@sprites)
@@ -1305,8 +1310,9 @@ class PokemonSummary_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonSummaryScreen
def initialize(scene,inbattle=false)
@scene = scene
@@ -1347,8 +1353,6 @@ class PokemonSummaryScreen
end
end
#===============================================================================
#
#===============================================================================

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class Window_PokemonBag < Window_DrawableCommand
attr_reader :pocket
attr_accessor :sorting
@@ -117,8 +120,6 @@ class Window_PokemonBag < Window_DrawableCommand
end
end
#===============================================================================
# Bag visuals
#===============================================================================
@@ -319,7 +320,6 @@ class PokemonBag_Scene
# Set the selected item's description
@sprites["itemtext"].text =
(itemlist.item) ? GameData::Item.get(itemlist.item).description : _INTL("Close bag.")
end
def pbRefreshFilter
@@ -443,8 +443,6 @@ class PokemonBag_Scene
end
end
#===============================================================================
# Bag mechanics
#===============================================================================

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class PokegearButton < SpriteWrapper
attr_reader :index
attr_reader :name
@@ -49,8 +52,9 @@ class PokegearButton < SpriteWrapper
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokegear_Scene
def pbUpdate
for i in 0...@commands.length
@@ -111,8 +115,9 @@ class PokemonPokegear_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonPokegearScreen
def initialize(scene)
@scene = scene

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class MapBottomSprite < SpriteWrapper
attr_reader :mapname
attr_reader :maplocation
@@ -52,8 +55,9 @@ class MapBottomSprite < SpriteWrapper
end
end
#===============================================================================
#
#===============================================================================
class PokemonRegionMap_Scene
LEFT = 0
TOP = 0
@@ -339,8 +343,9 @@ class PokemonRegionMap_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonRegionMapScreen
def initialize(scene)
@scene = scene
@@ -360,8 +365,9 @@ class PokemonRegionMapScreen
end
end
#===============================================================================
#
#===============================================================================
def pbShowMap(region=-1,wallmap=true)
pbFadeOutIn {
scene = PokemonRegionMap_Scene.new(region,wallmap)

View File

@@ -17,8 +17,9 @@ class Window_PhoneList < Window_CommandPokemon
end
end
#===============================================================================
#
#===============================================================================
class PokemonPhoneScene
def start
commands = []

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class PokemonJukebox_Scene
def pbUpdate
pbUpdateSpriteHash(@sprites)
@@ -49,8 +52,9 @@ class PokemonJukebox_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonJukeboxScreen
def initialize(scene)
@scene = scene

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class PokemonTrainerCard_Scene
def pbUpdate
pbUpdateSpriteHash(@sprites)
@@ -95,8 +98,9 @@ class PokemonTrainerCard_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonTrainerCardScreen
def initialize(scene)
@scene = scene

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class PokemonLoadPanel < SpriteWrapper
attr_reader :selected
@@ -91,8 +94,9 @@ class PokemonLoadPanel < SpriteWrapper
end
end
#===============================================================================
#
#===============================================================================
class PokemonLoad_Scene
def pbStartScene(commands,showContinue,trainer,framecount,mapid)
@commands = commands
@@ -202,8 +206,9 @@ class PokemonLoad_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonLoadScreen
def initialize(scene)
@scene = scene

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
def pbSave(safesave=false)
$Trainer.metaID=$PokemonGlobal.playerID
begin
@@ -55,8 +58,9 @@ def pbEmergencySave
$scene=oldscene
end
#===============================================================================
#
#===============================================================================
class PokemonSave_Scene
def pbStartScreen
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@@ -93,8 +97,9 @@ class PokemonSave_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonSaveScreen
def initialize(scene)
@scene=scene
@@ -146,8 +151,9 @@ class PokemonSaveScreen
end
end
#===============================================================================
#
#===============================================================================
def pbSaveScreen
scene = PokemonSave_Scene.new
screen = PokemonSaveScreen.new(scene)

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class PokemonSystem
attr_accessor :textspeed
attr_accessor :battlescene
@@ -36,8 +39,6 @@ class PokemonSystem
def tilemap; return MAP_VIEW_MODE; end
end
#===============================================================================
# Stores game options
# Default options are at the top of script section SpriteWindow.
@@ -113,8 +114,9 @@ def pbSettingToTextSpeed(speed)
return MessageConfig::TextSpeed || 1
end
#===============================================================================
#
#===============================================================================
module MessageConfig
def self.pbDefaultSystemFrame
begin
@@ -153,8 +155,6 @@ module MessageConfig
end
end
#===============================================================================
#
#===============================================================================
@@ -168,8 +168,9 @@ module PropertyMixin
end
end
#===============================================================================
#
#===============================================================================
class EnumOption
include PropertyMixin
attr_reader :values
@@ -195,8 +196,9 @@ class EnumOption
end
end
#===============================================================================
#
#===============================================================================
class EnumOption2
include PropertyMixin
attr_reader :values
@@ -222,8 +224,9 @@ class EnumOption2
end
end
#===============================================================================
#
#===============================================================================
class NumberOption
include PropertyMixin
attr_reader :name
@@ -253,8 +256,9 @@ class NumberOption
end
end
#===============================================================================
#
#===============================================================================
class SliderOption
include PropertyMixin
attr_reader :name
@@ -285,8 +289,6 @@ class SliderOption
end
end
#===============================================================================
# Main options list
#===============================================================================
@@ -403,8 +405,6 @@ class Window_PokemonOption < Window_DrawableCommand
end
end
#===============================================================================
# Options main screen
#===============================================================================
@@ -587,8 +587,6 @@ class PokemonOption_Scene
end
end
#===============================================================================
#
#===============================================================================

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class ReadyMenuButton < SpriteWrapper
attr_reader :index # ID of button
attr_reader :selected
@@ -91,8 +94,9 @@ class ReadyMenuButton < SpriteWrapper
end
end
#===============================================================================
#
#===============================================================================
class PokemonReadyMenu_Scene
attr_reader :sprites
@@ -217,8 +221,9 @@ class PokemonReadyMenu_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonReadyMenu
def initialize(scene)
@scene = scene
@@ -290,8 +295,6 @@ class PokemonReadyMenu
end
end
#===============================================================================
# Using a registered item
#===============================================================================

View File

@@ -41,8 +41,6 @@ class PokemonBoxIcon < IconSprite
end
end
#===============================================================================
# Pokémon sprite
#===============================================================================
@@ -106,8 +104,9 @@ class MosaicPokemonSprite < PokemonSprite
end
end
#===============================================================================
#
#===============================================================================
class AutoMosaicPokemonSprite < MosaicPokemonSprite
def update
super
@@ -115,8 +114,6 @@ class AutoMosaicPokemonSprite < MosaicPokemonSprite
end
end
#===============================================================================
# Cursor
#===============================================================================
@@ -288,8 +285,6 @@ class PokemonBoxArrow < SpriteWrapper
end
end
#===============================================================================
# Box
#===============================================================================
@@ -444,8 +439,6 @@ class PokemonBoxSprite < SpriteWrapper
end
end
#===============================================================================
# Party pop-up panel
#===============================================================================
@@ -565,8 +558,6 @@ class PokemonBoxPartySprite < SpriteWrapper
end
end
#===============================================================================
# Pokémon storage visuals
#===============================================================================
@@ -1452,8 +1443,6 @@ class PokemonStorageScene
end
end
#===============================================================================
# Pokémon storage mechanics
#===============================================================================
@@ -1469,8 +1458,7 @@ class PokemonStorageScreen
def pbStartScreen(command)
@heldpkmn = nil
if command==0
### ORGANISE ###################################################################
if command==0 # Organise
@scene.pbStartBox(self,command)
loop do
selected = @scene.pbSelectBox(@storage.party)
@@ -1551,8 +1539,7 @@ class PokemonStorageScreen
end
end
@scene.pbCloseBox
elsif command==1
### WITHDRAW ###################################################################
elsif command==1 # Withdraw
@scene.pbStartBox(self,command)
loop do
selected = @scene.pbSelectBox(@storage.party)
@@ -1592,8 +1579,7 @@ class PokemonStorageScreen
end
end
@scene.pbCloseBox
elsif command==2
### DEPOSIT ####################################################################
elsif command==2 # Deposit
@scene.pbStartBox(self,command)
loop do
selected = @scene.pbSelectParty(@storage.party)

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class Window_PokemonItemStorage < Window_DrawableCommand
attr_reader :bag
attr_reader :pocket
@@ -47,8 +50,9 @@ class Window_PokemonItemStorage < Window_DrawableCommand
end
end
#===============================================================================
#
#===============================================================================
class ItemStorage_Scene
ITEMLISTBASECOLOR = Color.new(88,88,80)
ITEMLISTSHADOWCOLOR = Color.new(168,184,184)
@@ -169,24 +173,24 @@ class ItemStorage_Scene
end
end
#===============================================================================
#
#===============================================================================
class WithdrawItemScene < ItemStorage_Scene
def initialize
super(_INTL("Withdraw\nItem"))
end
end
#===============================================================================
#
#===============================================================================
class TossItemScene < ItemStorage_Scene
def initialize
super(_INTL("Toss\nItem"))
end
end
#===============================================================================
# Common UI functions used in both the Bag and item storage screens.
# Displays messages and allows the user to choose a number/command.

View File

@@ -1,3 +1,113 @@
#===============================================================================
#
#===============================================================================
class TrainerPC
def shouldShow?
return true
end
def name
return _INTL("{1}'s PC",$Trainer.name)
end
def access
pbMessage(_INTL("\\se[PC access]Accessed {1}'s PC.",$Trainer.name))
pbTrainerPCMenu
end
end
#===============================================================================
#
#===============================================================================
class StorageSystemPC
def shouldShow?
return true
end
def name
if $PokemonGlobal.seenStorageCreator
return _INTL("{1}'s PC",pbGetStorageCreator)
else
return _INTL("Someone's PC")
end
end
def access
pbMessage(_INTL("\\se[PC access]The Pokémon Storage System was opened."))
command = 0
loop do
command = pbShowCommandsWithHelp(nil,
[_INTL("Organize Boxes"),
_INTL("Withdraw Pokémon"),
_INTL("Deposit Pokémon"),
_INTL("See ya!")],
[_INTL("Organize the Pokémon in Boxes and in your party."),
_INTL("Move Pokémon stored in Boxes to your party."),
_INTL("Store Pokémon in your party in Boxes."),
_INTL("Return to the previous menu.")],-1,command
)
if command>=0 && command<3
if command==1 # Withdraw
if $PokemonStorage.party.length>=6
pbMessage(_INTL("Your party is full!"))
next
end
elsif command==2 # Deposit
count=0
for p in $PokemonStorage.party
count += 1 if p && !p.egg? && p.hp>0
end
if count<=1
pbMessage(_INTL("Can't deposit the last Pokémon!"))
next
end
end
pbFadeOutIn {
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene,$PokemonStorage)
screen.pbStartScreen(command)
}
else
break
end
end
end
end
#===============================================================================
#
#===============================================================================
module PokemonPCList
@@pclist = []
def self.registerPC(pc)
@@pclist.push(pc)
end
def self.getCommandList
commands = []
for pc in @@pclist
commands.push(pc.name) if pc.shouldShow?
end
commands.push(_INTL("Log Off"))
return commands
end
def self.callCommand(cmd)
return false if cmd<0 || cmd>=@@pclist.length
i = 0
for pc in @@pclist
next if !pc.shouldShow?
if i==cmd
pc.access
return true
end
i += 1
end
return false
end
end
#===============================================================================
# PC menus
#===============================================================================
@@ -118,90 +228,6 @@ def pbTrainerPCMenu
end
end
class TrainerPC
def shouldShow?
return true
end
def name
return _INTL("{1}'s PC",$Trainer.name)
end
def access
pbMessage(_INTL("\\se[PC access]Accessed {1}'s PC.",$Trainer.name))
pbTrainerPCMenu
end
end
def pbGetStorageCreator
creator = pbStorageCreator
creator = _INTL("Bill") if !creator || creator==""
return creator
end
class StorageSystemPC
def shouldShow?
return true
end
def name
if $PokemonGlobal.seenStorageCreator
return _INTL("{1}'s PC",pbGetStorageCreator)
else
return _INTL("Someone's PC")
end
end
def access
pbMessage(_INTL("\\se[PC access]The Pokémon Storage System was opened."))
command = 0
loop do
command = pbShowCommandsWithHelp(nil,
[_INTL("Organize Boxes"),
_INTL("Withdraw Pokémon"),
_INTL("Deposit Pokémon"),
_INTL("See ya!")],
[_INTL("Organize the Pokémon in Boxes and in your party."),
_INTL("Move Pokémon stored in Boxes to your party."),
_INTL("Store Pokémon in your party in Boxes."),
_INTL("Return to the previous menu.")],-1,command
)
if command>=0 && command<3
if command==1 # Withdraw
if $PokemonStorage.party.length>=6
pbMessage(_INTL("Your party is full!"))
next
end
elsif command==2 # Deposit
count=0
for p in $PokemonStorage.party
count += 1 if p && !p.egg? && p.hp>0
end
if count<=1
pbMessage(_INTL("Can't deposit the last Pokémon!"))
next
end
end
pbFadeOutIn {
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene,$PokemonStorage)
screen.pbStartScreen(command)
}
else
break
end
end
end
end
def pbTrainerPC
pbMessage(_INTL("\\se[PC open]{1} booted up the PC.",$Trainer.name))
pbTrainerPCMenu
@@ -220,40 +246,14 @@ def pbPokeCenterPC
pbSEPlay("PC close")
end
module PokemonPCList
@@pclist = []
def self.registerPC(pc)
@@pclist.push(pc)
end
def self.getCommandList
commands = []
for pc in @@pclist
commands.push(pc.name) if pc.shouldShow?
end
commands.push(_INTL("Log Off"))
return commands
end
def self.callCommand(cmd)
return false if cmd<0 || cmd>=@@pclist.length
i = 0
for pc in @@pclist
next if !pc.shouldShow?
if i==cmd
pc.access
return true
end
i += 1
end
return false
end
def pbGetStorageCreator
creator = pbStorageCreator
creator = _INTL("Bill") if !creator || creator==""
return creator
end
#===============================================================================
#
#===============================================================================
PokemonPCList.registerPC(StorageSystemPC.new)
PokemonPCList.registerPC(TrainerPC.new)

View File

@@ -162,8 +162,9 @@ class PokemonEggHatch_Scene
end
end
#===============================================================================
#
#===============================================================================
class PokemonEggHatchScreen
def initialize(scene)
@scene=scene
@@ -176,8 +177,9 @@ class PokemonEggHatchScreen
end
end
#===============================================================================
#
#===============================================================================
def pbHatchAnimation(pokemon)
pbMessage(_INTL("Huh?\1"))
pbFadeOutInWithMusic {

View File

@@ -226,8 +226,9 @@ class SpriteMetafile
end
end
#===============================================================================
#
#===============================================================================
class SpriteMetafilePlayer
def initialize(metafile,sprite=nil)
@metafile=metafile
@@ -283,8 +284,9 @@ class SpriteMetafilePlayer
end
end
#===============================================================================
#
#===============================================================================
def pbSaveSpriteState(sprite)
state=[]
return state if !sprite || sprite.disposed?
@@ -342,8 +344,6 @@ def pbRestoreSpriteStateAndBitmap(sprite,state)
return state
end
#===============================================================================
# Evolution screen
#===============================================================================

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class PokemonTrade_Scene
def pbUpdate
pbUpdateSpriteHash(@sprites)
@@ -187,8 +190,9 @@ class PokemonTrade_Scene
end
end
#===============================================================================
#
#===============================================================================
def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
myPokemon = $Trainer.party[pokemonIndex]
opponent = PokeBattle_Trainer.new(trainerName,trainerGender)
@@ -220,9 +224,6 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
$Trainer.party[pokemonIndex] = yourPokemon
end
#===============================================================================
# Evolution methods
#===============================================================================
def pbTradeCheckEvolution(pkmn, other_pkmn)
return pbCheckEvolutionEx(pkmn) { |pkmn, method, parameter, new_species|
success = PBEvolution.call("tradeCheck", method, pkmn, parameter, other_pkmn)

View File

@@ -1,30 +1,6 @@
# Unused
def pbHasRelearnableMove?(pokemon)
return pbGetRelearnableMoves(pokemon).length>0
end
def pbGetRelearnableMoves(pokemon)
return [] if !pokemon || pokemon.egg? || pokemon.shadowPokemon?
moves=[]
pokemon.getMoveList.each do |m|
next if m[0] > pokemon.level || pokemon.hasMove?(m[1])
moves.push(m[1]) if !moves.include?(m[1])
end
tmoves=[]
if pokemon.firstmoves
for i in pokemon.firstmoves
tmoves.push(i) if !pokemon.hasMove?(i) && !moves.include?(i)
end
end
moves=tmoves+moves
return moves|[] # remove duplicates
end
################################################################################
#===============================================================================
# Scene class for handling appearance of the screen
################################################################################
#===============================================================================
class MoveRelearner_Scene
VISIBLEMOVES = 4
@@ -168,27 +144,44 @@ class MoveRelearner_Scene
end
end
#===============================================================================
# Screen class for handling game logic
#===============================================================================
class MoveRelearnerScreen
def initialize(scene)
@scene = scene
end
def pbStartScreen(pokemon)
moves=pbGetRelearnableMoves(pokemon)
@scene.pbStartScene(pokemon,moves)
def pbGetRelearnableMoves(pkmn)
return [] if !pkmn || pkmn.egg? || pkmn.shadowPokemon?
moves = []
pkmn.getMoveList.each do |m|
next if m[0] > pkmn.level || pkmn.hasMove?(m[1])
moves.push(m[1]) if !moves.include?(m[1])
end
tmoves = []
if pkmn.firstmoves
for i in pkmn.firstmoves
tmoves.push(i) if !pkmn.hasMove?(i) && !moves.include?(i)
end
end
moves = tmoves + moves
return moves | [] # remove duplicates
end
def pbStartScreen(pkmn)
moves = pbGetRelearnableMoves(pkmn)
@scene.pbStartScene(pkmn, moves)
loop do
move=@scene.pbChooseMove
move = @scene.pbChooseMove
if move
if @scene.pbConfirm(_INTL("Teach {1}?",GameData::Move.get(move).name))
if pbLearnMove(pokemon,move)
if @scene.pbConfirm(_INTL("Teach {1}?", GameData::Move.get(move).name))
if pbLearnMove(pkmn, move)
@scene.pbEndScene
return true
end
end
elsif @scene.pbConfirm(_INTL("Give up trying to teach a new move to {1}?",pokemon.name))
elsif @scene.pbConfirm(_INTL("Give up trying to teach a new move to {1}?", pkmn.name))
@scene.pbEndScene
return false
end
@@ -196,14 +189,15 @@ class MoveRelearnerScreen
end
end
def pbRelearnMoveScreen(pokemon)
#===============================================================================
#
#===============================================================================
def pbRelearnMoveScreen(pkmn)
retval = true
pbFadeOutIn {
scene = MoveRelearner_Scene.new
screen = MoveRelearnerScreen.new(scene)
retval = screen.pbStartScreen(pokemon)
retval = screen.pbStartScreen(pkmn)
}
return retval
end

View File

@@ -1,3 +1,42 @@
#===============================================================================
#
#===============================================================================
class PokemonGlobalMetadata
attr_writer :purifyChamber
attr_accessor :seenPurifyChamber
def purifyChamber
@purifyChamber = PurifyChamber.new() if !@purifyChamber
return @purifyChamber
end
end
#===============================================================================
# General purpose utilities
#===============================================================================
def pbDrawGauge(bitmap,rect,color,value,maxValue)
return if !bitmap
bitmap.fill_rect(rect.x,rect.y,rect.width,rect.height,Color.new(0,0,0))
width=(maxValue<=0) ? 0 : (rect.width-4)*value/maxValue
if rect.width>=4 && rect.height>=4
bitmap.fill_rect(rect.x+2,rect.y+2,rect.width-4,rect.height-4,Color.new(248,248,248))
bitmap.fill_rect(rect.x+2,rect.y+2,width,rect.height-4,color)
end
end
def calcPoint(x,y,distance,angle) # angle in degrees
angle -=(angle/360.0).floor*360 # normalize
angle = (angle/360.0)*(2*Math::PI) # convert to radians
angle = -angle % (2*Math::PI) # normalize radians
point = [(Math.cos(angle) * distance), (Math.sin(angle) * distance)]
point[0] += x
point[1] += y
return point
end
#===============================================================================
#
#===============================================================================
class PurifyChamberSet
attr_reader :facing
attr_reader :shadow
@@ -27,11 +66,9 @@ class PurifyChamberSet
end
end
=begin
Main component is tempo
Boosted if center has advantage over facing Pokemon
Boosted based on number of best circles
=end
# Main component is tempo
# Boosted if center has advantage over facing Pokemon
# Boosted based on number of best circles
def flow
ret=0
return 0 if !@shadow
@@ -54,8 +91,8 @@ Boosted based on number of best circles
return (PurifyChamberSet.isSuperEffective(@list[i],@list[(i+1)%@list.length])) ? 2 : 1
end
# Tempo refers to the type advantages of each Pokemon in a certain set in a
# clockwise direction. Tempo also depends on the number of Pokemon in the set
# Tempo refers to the type advantages of each Pokemon in a certain set in a
# clockwise direction. Tempo also depends on the number of Pokemon in the set
def tempo
ret=0
for i in 0...@list.length
@@ -103,9 +140,10 @@ Boosted based on number of best circles
end
end
class PurifyChamber # German: der Kryptorbis
#===============================================================================
#
#===============================================================================
class PurifyChamber
NUMSETS=9
SETSIZE=4
attr_reader :currentSet # German: das Forum
@@ -231,68 +269,9 @@ class PurifyChamber # German: der Kryptorbis
end
end
class PokemonGlobalMetadata
attr_writer :purifyChamber
attr_accessor :seenPurifyChamber
def purifyChamber
@purifyChamber = PurifyChamber.new() if !@purifyChamber
return @purifyChamber
end
end
class PurifyChamberPC
def shouldShow?
return $PokemonGlobal.seenPurifyChamber
end
def name
return _INTL("Purify Chamber")
end
def access
pbMessage(_INTL("\\se[PC access]Accessed the Purify Chamber."))
pbPurifyChamber()
end
end
PokemonPCList.registerPC(PurifyChamberPC.new)
#####################
#===============================================================================
#
# General purpose utilities
#
def pbDrawGauge(bitmap,rect,color,value,maxValue)
return if !bitmap
bitmap.fill_rect(rect.x,rect.y,rect.width,rect.height,Color.new(0,0,0))
width=(maxValue<=0) ? 0 : (rect.width-4)*value/maxValue
if rect.width>=4 && rect.height>=4
bitmap.fill_rect(rect.x+2,rect.y+2,rect.width-4,rect.height-4,Color.new(248,248,248))
bitmap.fill_rect(rect.x+2,rect.y+2,width,rect.height-4,color)
end
end
def calcPoint(x,y,distance,angle) # angle in degrees
angle -=(angle/360.0).floor*360 # normalize
angle = (angle/360.0)*(2*Math::PI) # convert to radians
angle = -angle % (2*Math::PI) # normalize radians
point = [(Math.cos(angle) * distance), (Math.sin(angle) * distance)]
point[0] += x
point[1] += y
return point
end
#####################
#===============================================================================
module PurifyChamberHelper
def self.pbGetPokemon2(chamber,set,position)
if position==0
@@ -349,19 +328,20 @@ module PurifyChamberHelper
end
end
#===============================================================================
#
#===============================================================================
class PurifyChamberScreen
def initialize(scene)
@scene=scene
@chamber=$PokemonGlobal.purifyChamber
# for j in 0...PurifyChamber::NUMSETS
# @chamber.debugAddShadow(j,rand(100)+1)
# @chamber[j].shadow.heartgauge=0
# for i in 0...PurifyChamber::SETSIZE
# @chamber.debugAddNormal(j,rand(100)+1)
# end
# end
# for j in 0...PurifyChamber::NUMSETS
# @chamber.debugAddShadow(j,rand(100)+1)
# @chamber[j].shadow.heartgauge=0
# for i in 0...PurifyChamber::SETSIZE
# @chamber.debugAddNormal(j,rand(100)+1)
# end
# end
end
def pbPlace(pkmn,position)
@@ -637,10 +617,9 @@ class PurifyChamberScreen
end
end
################################################
#===============================================================================
#
#===============================================================================
class Window_PurifyChamberSets < Window_DrawableCommand
attr_reader :switching
@@ -682,8 +661,9 @@ class Window_PurifyChamberSets < Window_DrawableCommand
end
end
#===============================================================================
#
#===============================================================================
class DirectFlowDiagram
def initialize(viewport=nil)
@points=[]
@@ -756,8 +736,9 @@ class DirectFlowDiagram
end
end
#===============================================================================
#
#===============================================================================
class FlowDiagram
def initialize(viewport=nil)
@points=[]
@@ -844,8 +825,9 @@ class FlowDiagram
end
end
#===============================================================================
#
#===============================================================================
class PurifyChamberSetView < SpriteWrapper
attr_reader :set
attr_reader :cursor
@@ -1085,8 +1067,9 @@ class PurifyChamberSetView < SpriteWrapper
end
end
#===============================================================================
#
#===============================================================================
class PurifyChamberScene
def pbUpdate()
pbUpdateSpriteHash(@sprites)
@@ -1297,8 +1280,9 @@ class PurifyChamberScene
end
end
#===============================================================================
#
#===============================================================================
def pbPurifyChamber
$PokemonGlobal.seenPurifyChamber = true
pbFadeOutIn {
@@ -1307,3 +1291,26 @@ def pbPurifyChamber
screen.pbStartPurify
}
end
#===============================================================================
#
#===============================================================================
class PurifyChamberPC
def shouldShow?
return $PokemonGlobal.seenPurifyChamber
end
def name
return _INTL("Purify Chamber")
end
def access
pbMessage(_INTL("\\se[PC access]Accessed the Purify Chamber."))
pbPurifyChamber()
end
end
#===============================================================================
#
#===============================================================================
PokemonPCList.registerPC(PurifyChamberPC.new)

View File

@@ -81,8 +81,6 @@ class PokemonMartAdapter
end
end
#===============================================================================
# Abstraction layer for RPG Maker XP
# Won't be used if $PokemonBag exists
@@ -216,7 +214,6 @@ class RpgxpMartAdapter
end
end
#===============================================================================
# Buy and Sell adapters
#===============================================================================
@@ -238,8 +235,9 @@ class BuyAdapter
end
end
#===============================================================================
#
#===============================================================================
class SellAdapter
def initialize(adapter)
@adapter = adapter
@@ -262,8 +260,6 @@ class SellAdapter
end
end
#===============================================================================
# Pokémon Mart
#===============================================================================
@@ -305,8 +301,9 @@ class Window_PokemonMart < Window_DrawableCommand
end
end
#===============================================================================
#
#===============================================================================
class PokemonMart_Scene
def update
pbUpdateSpriteHash(@sprites)
@@ -657,10 +654,9 @@ class PokemonMart_Scene
end
end
#######################################################
#===============================================================================
#
#===============================================================================
class PokemonMartScreen
def initialize(scene,stock)
@scene=scene
@@ -786,8 +782,9 @@ class PokemonMartScreen
end
end
#===============================================================================
#
#===============================================================================
def pbPokemonMart(stock,speech=nil,cantsell=false)
for i in 0...stock.length
stock[i] = GameData::Item.get(stock[i]).id
@@ -822,64 +819,3 @@ def pbPokemonMart(stock,speech=nil,cantsell=false)
end
$game_temp.clear_mart_prices
end
class Game_Temp
attr_writer :mart_prices
def mart_prices
@mart_prices = [] if !@mart_prices
return @mart_prices
end
def clear_mart_prices
@mart_prices = []
end
end
class Interpreter
def getItem(p)
if p[0]==0; return $data_items[p[1]]
elsif p[0]==1; return $data_weapons[p[1]]
elsif p[0]==2; return $data_armors[p[1]]
end
return nil
end
def command_302
$game_temp.battle_abort = true
shop_goods = [getItem(@parameters)]
# Loop
loop do
# Advance index
@index += 1
# If next event command has shop on second line or after
if @list[@index].code == 605
# Add goods list to new item
shop_goods.push(getItem(@list[@index].parameters))
else
# End
pbPokemonMart(shop_goods.compact)
return true
end
end
end
def setPrice(item,buyprice=-1,sellprice=-1)
item = GameData::Item.get(item).id
$game_temp.mart_prices[item] = [-1,-1] if !$game_temp.mart_prices[item]
$game_temp.mart_prices[item][0] = buyprice if buyprice>0
if sellprice>=0 # 0=can't sell
$game_temp.mart_prices[item][1] = sellprice*2
else
$game_temp.mart_prices[item][1] = buyprice if buyprice>0
end
end
def setSellPrice(item,sellprice)
setPrice(item,-1,sellprice)
end
end

View File

@@ -9,8 +9,9 @@
MYSTERY_GIFT_URL = "http://images1.wikia.nocookie.net/pokemonessentials/images/e/e7/MysteryGift.txt"
# MYSTERY_GIFT_URL = "http://pastebin.com/raw/w6BqqUsm"
#===============================================================================
#
#===============================================================================
class PokeBattle_Trainer
attr_writer :mysterygiftaccess # Whether MG can be used from load screen
attr_writer :mysterygift # Variable that stores downloaded MG data
@@ -24,8 +25,6 @@ class PokeBattle_Trainer
end
end
#===============================================================================
# Creating a new Mystery Gift for the Master file, and editing an existing one.
#===============================================================================

View File

@@ -437,8 +437,9 @@ class HallOfFame_Scene
end
end
#===============================================================================
#
#===============================================================================
class HallOfFameScreen
def initialize(scene)
@scene = scene
@@ -457,8 +458,9 @@ class HallOfFameScreen
end
end
#===============================================================================
#
#===============================================================================
class HallOfFamePC
def shouldShow?
return $PokemonGlobal.hallOfFameLastNumber>0
@@ -474,12 +476,14 @@ class HallOfFamePC
end
end
#===============================================================================
#
#===============================================================================
PokemonPCList.registerPC(HallOfFamePC.new)
#===============================================================================
#
#===============================================================================
class PokemonGlobalMetadata
attr_writer :hallOfFame
# Number necessary if hallOfFame array reach in its size limit
@@ -495,8 +499,9 @@ class PokemonGlobalMetadata
end
end
#===============================================================================
#
#===============================================================================
def pbHallOfFameEntry
scene=HallOfFame_Scene.new
screen=HallOfFameScreen.new(scene)