6 Commits

Author SHA1 Message Date
chardub
5b85e72cb2 6.7.2 patch 2025-10-02 10:35:46 -04:00
chardub
e5406179bf 6.7.1 patch fixes 2025-10-01 11:28:13 -04:00
chardub
1271d7e8f0 fixes naked sprite when fishing 2025-09-28 18:22:11 -04:00
chardub
e11e62272c possible missing files 2025-09-28 16:18:37 -04:00
chardub
51f98b9cc7 sprites credits 2025-09-28 16:14:12 -04:00
chardub
318ff90d8d update 6.7 2025-09-28 15:53:01 -04:00
724 changed files with 324438 additions and 198312 deletions

5
.gitignore vendored
View File

@@ -3,13 +3,8 @@ Graphics/Battlers/Shiny/*
Graphics/CustomBattlers/spritesheets/* Graphics/CustomBattlers/spritesheets/*
Graphics/CustomBattlers/* Graphics/CustomBattlers/*
Data/sprites/*
Data/VERSION Data/VERSION
infinitefusion.sh infinitefusion.sh
Data/sprites/CUSTOM_SPRITES
Data/sprites
Data/sprites/updated_spritesheets_cache
Data/sprites/sprites_rate_limit.log
.gitignore .gitignore
Game.rxproj Game.rxproj
.DS_Store .DS_Store

BIN
Audio/BGM/SSANNE.ogg Normal file

Binary file not shown.

BIN
Audio/BGM/bicycle.mp3 Normal file

Binary file not shown.

View File

@@ -107,9 +107,9 @@ casinoluck<s>ymirbot
################################### ###################################
### Custom Pok?dex entries ### ### Custom Pokedex entries ###
################################### ###################################
### Pok?dex entries quality control (Unown) ### Pokedex entries quality control (Unown)
luvischlo<s>char_latte3412<s>strawbearycandy luvischlo<s>char_latte3412<s>strawbearycandy
bobosmith01<s>griddle<s>.izik bobosmith01<s>griddle<s>.izik
knilk<s>lordjoostmeister<s>.realthree knilk<s>lordjoostmeister<s>.realthree
@@ -127,6 +127,10 @@ Maruno (http://pokemonessentials.wikia.com/wiki/Pok%C3%A9mon_Essentials_Wiki)
########################################################### ###########################################################
Playtesting was done by various members of the Discord channel. Playtesting was done by various members of the Discord channel.
Special thanks to all of you! Special thanks to all of you!
Elite 4 rematch teams
duskrd<s>anaconja
########################################################### ###########################################################
### Graphics # ### Graphics #
########################################################### ###########################################################
@@ -140,6 +144,14 @@ Nintendo
GameFreak GameFreak
########################
### Translations #
########################
French translation:
anthonygourmand
locpic_
blood.wolf58 (Willi)
####################################################################### #######################################################################
The following ressources were also used The following ressources were also used
with their respective authors' consent with their respective authors' consent

BIN
Data/.DS_Store vendored

Binary file not shown.

11
Data/.idea/Data.iml generated Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="ModuleRunConfigurationManager">
<shared />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
Data/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Data.iml" filepath="$PROJECT_DIR$/.idea/Data.iml" />
</modules>
</component>
</project>

7
Data/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/Scripts" vcs="Git" />
</component>
</project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -5,10 +5,12 @@
#==============================================================================# #==============================================================================#
module Settings module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format. # The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '6.6.2' GAME_VERSION_NUMBER = "6.7.2"
GAME_VERSION_NUMBER = "6.6.2"
LATEST_GAME_RELEASE = "6.6" LATEST_GAME_RELEASE = "6.6"
KANTO = GAME_ID == :IF_KANTO
HOENN = GAME_ID == :IF_HOENN
POKERADAR_LIGHT_ANIMATION_RED_ID = 17 POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18 POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
POKERADAR_HIDDEN_ABILITY_POKE_CHANCE = 32 POKERADAR_HIDDEN_ABILITY_POKE_CHANCE = 32
@@ -33,7 +35,7 @@ module Settings
BATTLERS_FOLDER = "Graphics/Battlers/Autogens/" BATTLERS_FOLDER = "Graphics/Battlers/Autogens/"
DOWNLOADED_SPRITES_FOLDER = "Graphics/temp/" DOWNLOADED_SPRITES_FOLDER = "Graphics/temp/"
DEFAULT_SPRITE_PATH = "Graphics/Battlers/Special/000.png" DEFAULT_SPRITE_PATH = "Graphics/Battlers/Special/000.png"
CREDITS_FILE_PATH = "Data/sprites/Sprite Credits.csv" CREDITS_FILE_PATH = "Data/sprites/Sprite_Credits.csv"
VERSION_FILE_PATH = "Data/VERSION" VERSION_FILE_PATH = "Data/VERSION"
CUSTOM_SPRITES_FILE_PATH = "Data/sprites/CUSTOM_SPRITES" CUSTOM_SPRITES_FILE_PATH = "Data/sprites/CUSTOM_SPRITES"
BASE_SPRITES_FILE_PATH = "Data/sprites/BASE_SPRITES" BASE_SPRITES_FILE_PATH = "Data/sprites/BASE_SPRITES"
@@ -66,9 +68,13 @@ module Settings
SPRITES_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/sprites/CUSTOM_SPRITES" SPRITES_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/sprites/CUSTOM_SPRITES"
BASE_SPRITES_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/sprites/BASE_SPRITES" BASE_SPRITES_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/sprites/BASE_SPRITES"
CREDITS_FILE_URL = "https://infinitefusion.net/Sprite Credits.csv" CREDITS_FILE_URL = "https://infinitefusion.net/customsprites/Sprite_Credits.csv"
CUSTOM_DEX_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/pif-downloadables/refs/heads/master/dex.json" CUSTOM_DEX_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/pif-downloadables/refs/heads/master/dex.json"
SECRETBASE_UPLOAD_URL = "http://secretbases-upload.pkmninfinitefusion.workers.dev"
SECRETBASE_DOWNLOAD_URL = "https://secretbase-download.pkmninfinitefusion.workers.dev"
STARTUP_MESSAGES = "" STARTUP_MESSAGES = ""
LEVEL_CAPS=[12,22,26,35,38,45,51,54,62,62,63,64,64,65,67,68] LEVEL_CAPS=[12,22,26,35,38,45,51,54,62,62,63,64,64,65,67,68]
@@ -175,12 +181,19 @@ module Settings
# always inherit egg moves from its father. # always inherit egg moves from its father.
BREEDING_CAN_INHERIT_EGG_MOVES_FROM_MOTHER = (MECHANICS_GENERATION >= 6) BREEDING_CAN_INHERIT_EGG_MOVES_FROM_MOTHER = (MECHANICS_GENERATION >= 6)
KANTO_STARTERS = [:BULBASAUR, :CHARMANDER, :SQUIRTLE] KANTO_STARTERS = [:BULBASAUR, :CHARMANDER, :SQUIRTLE]
JOHTO_STARTERS = [:CHIKORITA, :CYNDAQUIL, :TOTODILE] JOHTO_STARTERS = [:CHIKORITA, :CYNDAQUIL, :TOTODILE]
HOENN_STARTERS = [:TREECKO, :TORCHIC, :MUDKIP] HOENN_STARTERS = [:TREECKO, :TORCHIC, :MUDKIP]
SINNOH_STARTERS = [:TURTWIG, :CHIMCHAR, :PIPLUP] SINNOH_STARTERS = [:TURTWIG, :CHIMCHAR, :PIPLUP]
KALOS_STARTERS = [:CHESPIN, :FENNEKIN, :FROAKIE] KALOS_STARTERS = [:CHESPIN, :FENNEKIN, :FROAKIE]
DEFAULT_STARTERS = Settings::GAME_ID == :IF_KANTO ? KANTO_STARTERS : HOENN_STARTERS
GRASS_STARTERS = [:BULBASAUR,:CHIKORITA,:TREECKO,:TURTWIG,:CHESPIN]
FIRE_STARTERS = [:CHARMANDER,:CYNDAQUIL, :TORCHIC, :CHIMCHAR, :FENNEKIN]
WATER_STARTERS = [:SQUIRTLE, :TOTODILE, :MUDKIP, :PIPLUP, :FROAKIE]
#============================================================================= #=============================================================================
@@ -345,7 +358,7 @@ module Settings
# Dex list, no matter which region the player is currently in. # Dex list, no matter which region the player is currently in.
def self.pokedex_names def self.pokedex_names
return [ return [
# [_INTL("Kanto Pokédex"), 0] # ["Kanto Pokédex", 0]
] ]
end end
@@ -543,11 +556,15 @@ module Settings
# file in the Data folder. Edit only if you have 2 or more languages to choose # file in the Data folder. Edit only if you have 2 or more languages to choose
# from. # from.
LANGUAGES = [ LANGUAGES = [
# ["English", "english.dat"], ["English", "english.dat"],
# ["Deutsch", "deutsch.dat"] ["Français", "french.dat"]
] ]
#Experimental
REMOTE_BATTLES_CONTROL = false
REMOTE_NPC_DIALOG = false
REMOTE_BATTLE_CONTROL_SERVER_URL = "http://127.0.0.1:5000/choose_move"
REMOTE_NPC_DIALOG_SERVER_URL = "http://127.0.0.1:5000"
#Technical #Technical
SPRITE_CACHE_MAX_NB=100 SPRITE_CACHE_MAX_NB=100
NEWEST_SPRITEPACK_MONTH = 12 NEWEST_SPRITEPACK_MONTH = 12
@@ -576,7 +593,7 @@ module Settings
"speech hgss 18", "speech hgss 18",
"speech hgss 19", "speech hgss 19",
"speech hgss 20", "speech hgss 20",
"speech pl 18" "speech pl 18",
] ]
# Available menu frames. These are graphic files in "Graphics/Windowskins/". # Available menu frames. These are graphic files in "Graphics/Windowskins/".

View File

@@ -3,42 +3,42 @@
# HTTP utility functions # HTTP utility functions
# #
############################# #############################
#
def pbPostData(url, postdata, filename=nil, depth=0) def pbPostData(url, postdata, filename=nil, depth=0)
if url[/^http:\/\/([^\/]+)(.*)$/] return "" unless url =~ /^https?:\/\/([^\/]+)(.*)$/
host = $1 host = $1
path = $2 path = $2
path = "/" if path.length==0 path = "/" if path.empty?
userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
body = postdata.map { |key, value| userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
keyString = key.to_s
valueString = value.to_s # Serialize as JSON
keyString.gsub!(/[^a-zA-Z0-9_\.\-]/n) { |s| sprintf('%%%02x', s[0]) } body = serialize_json(postdata)
valueString.gsub!(/[^a-zA-Z0-9_\.\-]/n) { |s| sprintf('%%%02x', s[0]) }
next "#{keyString}=#{valueString}" ret = HTTPLite.post_body(
}.join('&') url,
ret = HTTPLite.post_body( body,
url, "application/json",
body, {
"application/x-www-form-urlencoded", "Host" => host,
{ "Proxy-Connection" => "Close",
"Host" => host, # might not be necessary "Content-Length" => body.bytesize.to_s,
"Proxy-Connection" => "Close", "Pragma" => "no-cache",
"Content-Length" => body.bytesize.to_s, "User-Agent" => userAgent
"Pragma" => "no-cache", }
"User-Agent" => userAgent ) rescue ""
}
) rescue "" return "" if !ret.is_a?(Hash)
return ret if !ret.is_a?(Hash) return "" if ret[:status] != 200
return "" if ret[:status] != 200 if filename
return ret[:body] if !filename File.open(filename, "wb") { |f| f.write(ret[:body]) }
File.open(filename, "wb"){|f|f.write(ret[:body])}
return "" return ""
end end
return "" ret[:body]
end end
def pbDownloadData(url, filename = nil, authorization = nil, depth = 0, &block) def pbDownloadData(url, filename = nil, authorization = nil, depth = 0, &block)
return nil if !downloadAllowed?() return nil if !downloadAllowed?()
echoln "downloading data from #{url}" echoln "downloading data from #{url}"
@@ -73,15 +73,21 @@ def pbDownloadToFile(url, file)
end end
end end
def pbPostToString(url, postdata) def pbPostToString(url, postdata, timeout = 30)
safe_postdata = postdata.transform_values(&:to_s)
begin begin
data = pbPostData(url, postdata) data = pbPostData(url, safe_postdata)
return data return data || ""
rescue rescue MKXPError => e
echoln("[Remote AI] Exception: #{e.message}")
return "" return ""
end end
end end
def pbPostToFile(url, postdata, file) def pbPostToFile(url, postdata, file)
begin begin
pbPostData(url, postdata,file) pbPostData(url, postdata,file)
@@ -89,7 +95,7 @@ def pbPostToFile(url, postdata, file)
end end
end end
def serialize_value(value) def serialize_value_legacy(value)
if value.is_a?(Hash) if value.is_a?(Hash)
serialize_json(value) serialize_json(value)
elsif value.is_a?(String) elsif value.is_a?(String)
@@ -102,17 +108,47 @@ end
def serialize_json(data) def serialize_json(data)
#echoln data if data.is_a?(Hash)
# Manually serialize the JSON data into a string parts = ["{"]
parts = ["{"] data.each_with_index do |(key, value), index|
data.each_with_index do |(key, value), index| parts << "\"#{key}\":#{serialize_value(value)}"
parts << "\"#{key}\":#{serialize_value(value)}" parts << "," unless index == data.size - 1
parts << "," unless index == data.size - 1 end
parts << "}"
return parts.join
else
return serialize_value(data)
end end
parts << "}"
return parts.join
end end
def serialize_value(value)
case value
when String
"\"#{escape_json_string(value)}\""
when Numeric
value.to_s
when TrueClass, FalseClass
value.to_s
when NilClass
"null"
when Array
"[" + value.map { |v| serialize_value(v) }.join(",") + "]"
when Hash
serialize_json(value)
else
raise "Unsupported type: #{value.class}"
end
end
def escape_json_string(str)
# Minimal escape handling
str.gsub(/["\\]/) { |m| "\\#{m}" }
.gsub("\n", "\\n")
.gsub("\t", "\\t")
.gsub("\r", "\\r")
end
def downloadAllowed?() def downloadAllowed?()
return $PokemonSystem.download_sprites==0 return $PokemonSystem.download_sprites==0
@@ -141,6 +177,42 @@ def clean_json_string(str)
end end
# json.rb - lightweight JSON parser for MKXP/RGSS XP
# Lightweight JSON for MKXP/RGSS XP
module JSON
module_function
# Convert Ruby object (hash/array/etc) into JSON string
def generate(obj)
case obj
when Hash
"{" + obj.map { |k, v| "\"#{k}\":#{generate(v)}" }.join(",") + "}"
when Array
"[" + obj.map { |v| generate(v) }.join(",") + "]"
when String, Symbol
"\"#{obj.to_s}\""
when TrueClass, FalseClass
obj.to_s
when NilClass
"null"
when Numeric
obj.to_s
else
raise "Unsupported type #{obj.class}"
end
end
# Simple parser (not full JSON) — optional
def parse(str)
return nil if str.nil? || str.strip.empty?
eval(str)
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -203,7 +203,7 @@ module SaveData
end end
echoln '' if conversions_to_run.length > 0 echoln '' if conversions_to_run.length > 0
save_data[:essentials_version] = Essentials::VERSION save_data[:essentials_version] = Essentials::VERSION
save_data[:game_version] = Settings::GAME_VERSION save_data[:game_version] = Settings::GAME_VERSION_NUMBER
return true return true
end end

View File

@@ -129,7 +129,7 @@ end
SaveData.register(:game_version) do SaveData.register(:game_version) do
load_in_bootup load_in_bootup
ensure_class :String ensure_class :String
save_value { Settings::GAME_VERSION } save_value { Settings::GAME_VERSION_NUMBER }
load_value { |value| $game_version = value } load_value { |value| $game_version = value }
new_game_value { Settings::GAME_VERSION } new_game_value { Settings::GAME_VERSION_NUMBER }
end end

View File

@@ -8,7 +8,7 @@ SaveData.register_conversion(:v19_define_versions) do
save_data[:essentials_version] = Essentials::VERSION save_data[:essentials_version] = Essentials::VERSION
end end
unless save_data.has_key?(:game_version) unless save_data.has_key?(:game_version)
save_data[:game_version] = Settings::GAME_VERSION save_data[:game_version] = Settings::GAME_VERSION_NUMBER
end end
end end
end end

View File

@@ -202,6 +202,7 @@ module Game
$PokemonMap.updateMap $PokemonMap.updateMap
$scene = Scene_Map.new $scene = Scene_Map.new
onLoadExistingGame() onLoadExistingGame()
end end
# Loads and validates the map. Called when loading a saved game. # Loads and validates the map. Called when loading a saved game.
@@ -234,9 +235,15 @@ module Game
end end
$PokemonEncounters = PokemonEncounters.new $PokemonEncounters = PokemonEncounters.new
$PokemonEncounters.setup($game_map.map_id) $PokemonEncounters.setup($game_map.map_id)
self.load_secret_bases if Settings::HOENN
pbUpdateVehicle pbUpdateVehicle
end end
def self.load_secret_bases
loader = SecretBaseLoader.new
loader.load_visitor_bases
end
# Saves the game. Returns whether the operation was successful. # Saves the game. Returns whether the operation was successful.
# @param save_file [String] the save file path # @param save_file [String] the save file path
# @param safe [Boolean] whether $PokemonGlobal.safesave should be set to true # @param safe [Boolean] whether $PokemonGlobal.safesave should be set to true

View File

@@ -218,6 +218,12 @@ class Scene_Map
end end
return if $game_temp.message_window_showing return if $game_temp.message_window_showing
if !pbMapInterpreterRunning? if !pbMapInterpreterRunning?
if $game_temp.moving_furniture
placeFurnitureMenu() if Input.trigger?(Input::USE)
rotate__held_furniture_left if Input.trigger?(Input::JUMPDOWN)
rotate_held_furniture_right if Input.trigger?(Input::JUMPUP)
end
if Input.trigger?(Input::USE) if Input.trigger?(Input::USE)
$PokemonTemp.hiddenMoveEventCalling = true $PokemonTemp.hiddenMoveEventCalling = true
elsif Input.trigger?(Input::BACK) elsif Input.trigger?(Input::BACK)
@@ -225,7 +231,7 @@ class Scene_Map
$game_temp.menu_calling = true $game_temp.menu_calling = true
$game_temp.menu_beep = true $game_temp.menu_beep = true
dayOfWeek = getDayOfTheWeek().to_s dayOfWeek = getDayOfTheWeek().to_s
$scene.spriteset.addUserSprite(LocationWindow.new($game_map.name+ "\n"+ pbGetTimeNow.strftime("%I:%M %p") + "\n" + dayOfWeek)) $scene.spriteset.addUserSprite(LocationWindow.new($game_map.name+ "\n"+ pbGetTimeNow.strftime(_INTL("%I:%M %p")) + "\n" + dayOfWeek))
end end
elsif Input.trigger?(Input::SPECIAL) elsif Input.trigger?(Input::SPECIAL)
unless $game_system.menu_disabled || $game_player.moving? unless $game_system.menu_disabled || $game_player.moving?

View File

@@ -25,11 +25,6 @@ class Game_Temp
attr_accessor :fadestate # for sprite hashes attr_accessor :fadestate # for sprite hashes
attr_accessor :background_bitmap attr_accessor :background_bitmap
attr_accessor :mart_prices attr_accessor :mart_prices
attr_accessor :unimportedSprites
attr_accessor :nb_imported_sprites
attr_accessor :loading_screen
attr_accessor :custom_sprites_list
attr_accessor :base_sprites_list
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# * Object Initialization # * Object Initialization
@@ -57,9 +52,6 @@ class Game_Temp
@message_window_showing = false @message_window_showing = false
@transition_processing = false @transition_processing = false
@mart_prices = {} @mart_prices = {}
@custom_sprites_list ={}
@base_sprites_list ={}
end end
def clear_mart_prices def clear_mart_prices

View File

@@ -12,8 +12,8 @@ class Game_Picture
attr_reader :number # picture number attr_reader :number # picture number
attr_accessor :name # file name attr_accessor :name # file name
attr_reader :origin # starting point attr_reader :origin # starting point
attr_reader :x # x-coordinate attr_accessor :x # x-coordinate
attr_reader :y # y-coordinate attr_accessor :y # y-coordinate
attr_accessor :zoom_x # x directional zoom rate attr_accessor :zoom_x # x directional zoom rate
attr_accessor :zoom_y # y directional zoom rate attr_accessor :zoom_y # y directional zoom rate
attr_accessor :opacity # opacity level attr_accessor :opacity # opacity level

View File

@@ -25,7 +25,10 @@ class Game_Character
attr_reader :move_speed attr_reader :move_speed
attr_accessor :walk_anime attr_accessor :walk_anime
attr_writer :bob_height attr_writer :bob_height
attr_accessor :under_everything attr_accessor :under_everything #under even grass
attr_accessor :under_player #always under the player, but over grass, etc.
attr_accessor :direction_fix
attr_accessor :always_on_top
def initialize(map = nil) def initialize(map = nil)
@map = map @map = map
@@ -77,6 +80,7 @@ class Game_Character
@locked = false @locked = false
@prelock_direction = 0 @prelock_direction = 0
@under_everything=false @under_everything=false
@under_player = false
@forced_z=nil @forced_z=nil
end end
@@ -339,6 +343,7 @@ class Game_Character
def screen_z(height = 0) def screen_z(height = 0)
return -1 if @under_everything return -1 if @under_everything
return 0 if @under_player
return 999 if @always_on_top return 999 if @always_on_top
return @forced_z if @forced_z return @forced_z if @forced_z
z = screen_y_ground z = screen_y_ground
@@ -354,6 +359,17 @@ class Game_Character
return z + ((height > Game_Map::TILE_HEIGHT) ? Game_Map::TILE_HEIGHT - 1 : 0) return z + ((height > Game_Map::TILE_HEIGHT) ? Game_Map::TILE_HEIGHT - 1 : 0)
end end
def opposite_direction
case @direction
when DIRECTION_LEFT; return DIRECTION_RIGHT
when DIRECTION_RIGHT; return DIRECTION_LEFT
when DIRECTION_UP; return DIRECTION_DOWN
when DIRECTION_DOWN; return DIRECTION_UP
else
return DIRECTION_ALL
end
end
#============================================================================= #=============================================================================
# Movement # Movement
#============================================================================= #=============================================================================
@@ -899,6 +915,27 @@ class Game_Character
@direction_fix = last_direction_fix @direction_fix = last_direction_fix
end end
def jump_forward
case $game_player.direction
when DIRECTION_DOWN
x_direction = 0
y_direction = 1
when DIRECTION_UP
x_direction = 0
y_direction = -1
when DIRECTION_LEFT
x_direction = -1
y_direction = 0
when DIRECTION_RIGHT
x_direction = 1
y_direction = 0
else
x_direction = 0
y_direction = 0
end
jump(x_direction, y_direction)
end
def jump(x_plus, y_plus) def jump(x_plus, y_plus)
if x_plus != 0 || y_plus != 0 if x_plus != 0 || y_plus != 0
if x_plus.abs > y_plus.abs if x_plus.abs > y_plus.abs

View File

@@ -1,10 +1,13 @@
class Game_Event < Game_Character class Game_Event < Game_Character
attr_reader :map_id attr_reader :map_id
attr_reader :trigger attr_accessor :trigger
attr_reader :list attr_reader :list
attr_reader :starting attr_reader :starting
attr_reader :tempSwitches # Temporary self-switches attr_reader :tempSwitches # Temporary self-switches
attr_reader :character_name
attr_accessor :need_refresh attr_accessor :need_refresh
attr_accessor :opacity
attr_accessor :through
def initialize(map_id, event, map=nil) def initialize(map_id, event, map=nil)
super(map) super(map)

View File

@@ -33,40 +33,34 @@ class Game_Player < Game_Character
return moving? && !@move_route_forcing && pbCanRun? return moving? && !@move_route_forcing && pbCanRun?
end end
#Override the player's graphics
# Path from Graphics/Characters/player/
def setPlayerGraphicsOverride(path)
@defaultCharacterName=path
end
def removeGraphicsOverride
@defaultCharacterName = ""
end
def hasGraphicsOverride?
return @defaultCharacterName!=""
end
def character_name def character_name
@defaultCharacterName = "" if !@defaultCharacterName @defaultCharacterName = "" if !@defaultCharacterName
return @defaultCharacterName if @defaultCharacterName!="" return @defaultCharacterName if hasGraphicsOverride?
if !@move_route_forcing && $Trainer.character_ID>=0 if !@move_route_forcing && $Trainer.character_ID>=0
meta = GameData::Metadata.get_player($Trainer.character_ID) meta = GameData::Metadata.get_player($Trainer.character_ID)
if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
charset = 1 # Display normal character sprite charset = 1 # Display normal character sprite
player_is_moving = moving? player_is_moving = moving?
if pbCanRun? && (player_is_moving || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!="" if pbCanRun? && (player_is_moving || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""
charset = 4 # Display running character sprite charset = 4 # Display running character sprite
end end
newCharName = pbGetPlayerCharset(meta,charset) newCharName = pbGetPlayerCharset(meta,charset)
if newCharName
# echoln caller
# echoln newCharName
# echoln "moving: " + moving?.to_s
# echoln "was moving: " + @wasmoving.to_s
#
# echoln "can run: " + pbCanRun?.to_s
# echoln "Input.dir4 " + Input.dir4.to_s
#
#
# echoln (moving? || @wasmoving)
# echoln charset
# echoln ""
end
@character_name = newCharName if newCharName @character_name = newCharName if newCharName
@wasmoving = player_is_moving @wasmoving = player_is_moving
end end

View File

@@ -127,7 +127,9 @@ class Sprite_Wearable < RPG::Sprite
end end
def update(action, filename,color) def update(action, filename,color)
@sprite.opacity = @player_sprite.opacity if @wearableBitmap @sprite.opacity = @player_sprite.opacity if @wearableBitmap
@sprite.opacity=0 if $game_player.hasGraphicsOverride?
if filename != @filename || color != @color if filename != @filename || color != @color
if pbResolveBitmap(filename) if pbResolveBitmap(filename)
#echoln pbResolveBitmap(filename) #echoln pbResolveBitmap(filename)

View File

@@ -60,6 +60,13 @@ class Sprite_Player < Sprite_Character
@charbitmap.bitmap.clone #nekkid sprite @charbitmap.bitmap.clone #nekkid sprite
baseBitmap = @charbitmap.bitmap.clone #nekkid sprite baseBitmap = @charbitmap.bitmap.clone #nekkid sprite
if $game_player.hasGraphicsOverride? && @character_name != "fish"
@hair.update(@character_name, "", 0) if @hair
@hat.update(@character_name, "", 0) if @hat
@hat2.update(@character_name, "", 0) if @hat2
return baseBitmap
end
outfitFilename = getOverworldOutfitFilename($Trainer.clothes, @character_name) # outfitFilename = getOverworldOutfitFilename($Trainer.clothes, @character_name) #
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename) outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
hairFilename = getOverworldHairFilename($Trainer.hair) hairFilename = getOverworldHairFilename($Trainer.hair)
@@ -77,6 +84,7 @@ class Sprite_Player < Sprite_Character
hat2_color_shift = 0 if !hat2_color_shift hat2_color_shift = 0 if !hat2_color_shift
clothes_color_shift = 0 if !clothes_color_shift clothes_color_shift = 0 if !clothes_color_shift
@hair.update(@character_name, hairFilename, hair_color_shift) if @hair @hair.update(@character_name, hairFilename, hair_color_shift) if @hair
@hat.update(@character_name, hatFilename, hat_color_shift) if @hat @hat.update(@character_name, hatFilename, hat_color_shift) if @hat
@hat2.update(@character_name, hat2Filename, hat2_color_shift) if @hat2 @hat2.update(@character_name, hat2Filename, hat2_color_shift) if @hat2

View File

@@ -78,6 +78,18 @@ class TilemapRenderer
}, },
5 => { #Rustboro
996 => "flowers_orange[10]",
991 => "flowers_pink[10]",
999 => "flowers_yellow[10]",
1007 => "flowers_blue[10]",
1015 => "flowers_purple[10]",
1023 => "flowers_red[10]",
1031 => "flowers_grey[10]",
1039 => "flowers_white[10]",
},
6 => { #Dewford Town 6 => { #Dewford Town
#water cliffs #water cliffs
@@ -92,7 +104,8 @@ class TilemapRenderer
}, },
7 => { #Sea Route 7 => { #Sea Route
#water rocks
1173 => "water_rock_medium[15]",
#water cliffs #water cliffs
1363 => "water_rock10", 1364 => "water_rock11", 1363 => "water_rock10", 1364 => "water_rock11",
1389 => "water_rock01", 1391 => "water_rock09", 1389 => "water_rock01", 1391 => "water_rock09",
@@ -154,6 +167,38 @@ class TilemapRenderer
881 => "tree_sway_single_6", 881 => "tree_sway_single_6",
866 => "tree_sway_group_1",
867 => "tree_sway_group_2",
874 => "tree_sway_group_3",
875 => "tree_sway_group_4",
},
5 => { #Rustboro
#trees
864 => "tree_sway_single_1",
865 => "tree_sway_single_2",
872 => "tree_sway_single_3",
873 => "tree_sway_single_4",
880 => "tree_sway_single_5",
881 => "tree_sway_single_6",
866 => "tree_sway_group_1",
867 => "tree_sway_group_2",
874 => "tree_sway_group_3",
875 => "tree_sway_group_4",
},
9 => { #Route Forest
#trees
864 => "tree_sway_single_1",
865 => "tree_sway_single_2",
872 => "tree_sway_single_3",
873 => "tree_sway_single_4",
880 => "tree_sway_single_5",
881 => "tree_sway_single_6",
866 => "tree_sway_group_1", 866 => "tree_sway_group_1",
867 => "tree_sway_group_2", 867 => "tree_sway_group_2",
874 => "tree_sway_group_3", 874 => "tree_sway_group_3",

View File

@@ -745,6 +745,7 @@ def addBackgroundPlane(sprites,planename,background,viewport=nil)
end end
end end
end end
return sprites[planename]
end end
# Adds a background to the sprite hash. # Adds a background to the sprite hash.

View File

@@ -129,22 +129,49 @@ class AnimatedBitmap
@bitmap.bitmap = new_bitmap @bitmap.bitmap = new_bitmap
end end
# def mirror
# for x in 0..@bitmap.bitmap.width / 2
# for y in 0..@bitmap.bitmap.height - 2
# temp = @bitmap.bitmap.get_pixel(x, y)
# newPix = @bitmap.bitmap.get_pixel((@bitmap.bitmap.width - x), y)
#
# @bitmap.bitmap.set_pixel(x, y, newPix)
# @bitmap.bitmap.set_pixel((@bitmap.bitmap.width - x), y, temp)
# end
# end
# end
def mirror def mirror
@bitmap.bitmap mirror_horizontally
end end
def mirror_horizontally
bmp = @bitmap.bitmap
half_width = bmp.width / 2
height = bmp.height
(0...half_width).each do |x|
(0...height).each do |y|
left_pixel = bmp.get_pixel(x, y)
right_pixel = bmp.get_pixel(bmp.width - 1 - x, y)
bmp.set_pixel(x, y, right_pixel)
bmp.set_pixel(bmp.width - 1 - x, y, left_pixel)
end
end
end
def mirror_vertically
bmp = @bitmap.bitmap
width = bmp.width
half_height = bmp.height / 2
(0...half_height).each do |y|
(0...width).each do |x|
top_pixel = bmp.get_pixel(x, y)
bottom_pixel = bmp.get_pixel(x, bmp.height - 1 - y)
bmp.set_pixel(x, y, bottom_pixel)
bmp.set_pixel(x, bmp.height - 1 - y, top_pixel)
end
end
end
# def mirror
# @bitmap.bitmap
# end
end end

View File

@@ -396,9 +396,9 @@ def pbGetGoldString
moneyString = _INTL("${1}", $Trainer.money.to_s_formatted) moneyString = _INTL("${1}", $Trainer.money.to_s_formatted)
rescue rescue
if $data_system.respond_to?("words") if $data_system.respond_to?("words")
moneyString = _INTL("{1} {2}", $game_party.gold, $data_system.words.gold) moneyString = "#{$game_party.gold} #{$data_system.words.gold}"
else else
moneyString = _INTL("{1} {2}", $game_party.gold, Vocab.gold) moneyString = "#{$game_party.gold} #{Vocab.gold}"
end end
end end
return moneyString return moneyString
@@ -474,6 +474,8 @@ def pbDisplayHeartScalesWindow(msgwindow)
return pointswindow return pointswindow
end end
def pbDisplayCoinsWindow(msgwindow, goldwindow) def pbDisplayCoinsWindow(msgwindow, goldwindow)
coinString = ($Trainer) ? $Trainer.coins.to_s_formatted : "0" coinString = ($Trainer) ? $Trainer.coins.to_s_formatted : "0"
coinwindow = Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>", coinString)) coinwindow = Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>", coinString))
@@ -506,6 +508,22 @@ def pbDisplayBattlePointsWindow(msgwindow)
return pointswindow return pointswindow
end end
def pbDisplayQuestPointsWindow(msgwindow)
pointsString = ($Trainer) ? $Trainer.quest_points.to_s_formatted : "0"
pointswindow = Window_AdvancedTextPokemon.new(_INTL("Quest Points:\n<ar>{1}</ar>", pointsString))
pointswindow.setSkin("Graphics/Windowskins/goldskin")
pointswindow.resizeToFit(pointswindow.text, Graphics.width)
pointswindow.width = 160 if pointswindow.width <= 160
if msgwindow.y == 0
pointswindow.y = Graphics.height - pointswindow.height
else
pointswindow.y = 0
end
pointswindow.viewport = msgwindow.viewport
pointswindow.z = msgwindow.z
return pointswindow
end
#=============================================================================== #===============================================================================
# #
#=============================================================================== #===============================================================================
@@ -594,6 +612,12 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
text.gsub!(/\\pog/i, "") text.gsub!(/\\pog/i, "")
text.gsub!(/\\b/i, "<c3=3050C8,D0D0C8>") text.gsub!(/\\b/i, "<c3=3050C8,D0D0C8>")
text.gsub!(/\\r/i, "<c3=E00808,D0D0C8>") text.gsub!(/\\r/i, "<c3=E00808,D0D0C8>")
text.gsub!(/\\mu\[(.*?)\]/i) do
$Trainer && isPlayerMale() ? $1 : ""
end
text.gsub!(/\\fu\[(.*?)\]/i) do
$Trainer && isPlayerFemale() ? $1 : ""
end
text.gsub!(/\\[Ww]\[([^\]]*)\]/) { text.gsub!(/\\[Ww]\[([^\]]*)\]/) {
w = $1.to_s w = $1.to_s
if w == "" if w == ""
@@ -632,7 +656,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
### Controls ### Controls
textchunks = [] textchunks = []
controls = [] controls = []
while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch)\[([^\]]*)\]|\\(g|cn|pt|ft|hs|wd|wm|op|cl|wu|\.|\||\!|\^))/i] while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch)\[([^\]]*)\]|\\(g|cn|pt|ft|qp|hs|wd|wm|op|cl|wu|\.|\||\!|\^))/i]
textchunks.push($~.pre_match) textchunks.push($~.pre_match)
if $~[1] if $~[1]
controls.push([$~[1].downcase, $~[2], -1]) controls.push([$~[1].downcase, $~[2], -1])
@@ -757,6 +781,9 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
when "hs" # Display heartscakes when "hs" # Display heartscakes
goldwindow.dispose if goldwindow goldwindow.dispose if goldwindow
goldwindow = pbDisplayHeartScalesWindow(msgwindow) goldwindow = pbDisplayHeartScalesWindow(msgwindow)
when "qp" # Display quest points
goldwindow.dispose if goldwindow
goldwindow = pbDisplayQuestPointsWindow(msgwindow)
when "cn" # Display coins window when "cn" # Display coins window
coinwindow.dispose if coinwindow coinwindow.dispose if coinwindow
coinwindow = pbDisplayCoinsWindow(msgwindow, goldwindow) coinwindow = pbDisplayCoinsWindow(msgwindow, goldwindow)

View File

@@ -101,7 +101,6 @@ end
# volume -- Volume of the file, up to 100 # volume -- Volume of the file, up to 100
# pitch -- Pitch of the file, normally 100 # pitch -- Pitch of the file, normally 100
def pbMEPlay(param,volume=nil,pitch=nil) def pbMEPlay(param,volume=nil,pitch=nil)
echoln param
return if !param return if !param
param=pbResolveAudioFile(param,volume,pitch) param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!="" if param.name && param.name!=""

View File

@@ -54,14 +54,12 @@ module GameData
end end
if !self::DATA.has_key?(other) if !self::DATA.has_key?(other)
#echoln _INTL("Unknown ID {1}.", other) if self == GameData::Item
return self::get(:PIKACHU) return nil
else
return self::get(:PIKACHU)
end
end end
#if other == :Species
# end
return self::DATA[other] return self::DATA[other]
end end

View File

@@ -27,10 +27,16 @@ module GameData
attr_reader :flowerYellow attr_reader :flowerYellow
attr_reader :flowerBlue attr_reader :flowerBlue
attr_reader :flower attr_reader :flower
attr_reader :trashcan attr_reader :trashcan
attr_reader :sharpedoObstacle attr_reader :sharpedoObstacle
attr_reader :underwater #only visible when diving attr_reader :underwater #only visible when diving
attr_reader :secretBase_tree
attr_reader :secretBase_cave
attr_reader :secretBase_bush
DATA = {} DATA = {}
extend ClassMethods extend ClassMethods
@@ -82,11 +88,20 @@ module GameData
@sharpedoObstacle = hash[:sharpedoObstacle] || false @sharpedoObstacle = hash[:sharpedoObstacle] || false
@underwater = hash[:underwater] || false @underwater = hash[:underwater] || false
@secretBase_tree = hash[:secretBase_tree] || false
@secretBase_cave = hash[:secretBase_cave] || false
@secretBase_bush = hash[:secretBase_bush] || false
end end
def can_surf_freely def can_surf_freely
return @can_surf && !@waterfall && !@waterfall_crest return @can_surf && !@waterfall && !@waterfall_crest
end end
def can_secret_base
return false if Settings::GAME_ID != :IF_HOENN
return @secretBase_tree || @secretBase_cave || @secretBase_bush
end
end end
end end
@@ -300,3 +315,22 @@ GameData::TerrainTag.register({
:battle_environment => :underwater, :battle_environment => :underwater,
:underwater => true, :underwater => true,
}) })
GameData::TerrainTag.register({
:id => :Secretbase_Tree,
:id_number => 29,
:secretBase_tree => true,
})
GameData::TerrainTag.register({
:id => :Secretbase_Cave,
:id_number => 30,
:secretBase_cave => true,
})
GameData::TerrainTag.register({
:id => :Secretbase_Bush,
:id_number => 31,
:secretBase_bush => true,
})

View File

@@ -63,7 +63,7 @@ module GameData
# return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000") # return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000")
# end # end
def self.egg_sprite_filename(species, form) def self.egg_sprite_filename(species, form)
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.use_custom_eggs return "Graphics/Battlers/Eggs/000" if $PokemonSystem.hide_custom_eggs
dexNum = getDexNumberForSpecies(species) dexNum = getDexNumberForSpecies(species)
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%d", dexNum) rescue nil bitmapFileName = sprintf("Graphics/Battlers/Eggs/%d", dexNum) rescue nil
if !pbResolveBitmap(bitmapFileName) if !pbResolveBitmap(bitmapFileName)

View File

@@ -197,7 +197,8 @@ module GameData
gym_type = GameData::Type.get(type_id) gym_type = GameData::Type.get(type_id)
while true while true
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range)) new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
if new_species.hasType?(gym_type) if new_species.hasType?(gym_type) || $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] || $game_switches[SWITCH_LEGENDARY_MODE]
# Note: gym Type validation is handled in-house for legendary mode
return new_species return new_species
end end
end end
@@ -218,6 +219,9 @@ module GameData
end end
end end
new_species = generateRandomGymSpecies(species) new_species = generateRandomGymSpecies(species)
if !new_species
return species
end
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS] if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS]
add_generated_species_to_gym_array(new_species, trainerId) add_generated_species_to_gym_array(new_species, trainerId)
end end
@@ -392,7 +396,7 @@ module GameData
secondary_ability_index = pkmn.ability_index == 0 ? 1 : 0 secondary_ability_index = pkmn.ability_index == 0 ? 1 : 0
pkmn.ability2_index = secondary_ability_index pkmn.ability2_index = secondary_ability_index
pkmn.ability2 = pkmn.getAbilityList[secondary_ability_index][0] pkmn.ability2 = pkmn.getAbilityList[secondary_ability_index][0]
#print _INTL("Primary: {1}, Secondary: {2}",pkmn.ability.id, pkmn.ability2.id) #print "Primary: {1}, Secondary: {2}",pkmn.ability.id, pkmn.ability2.id
end end
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1) pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)

View File

@@ -1,369 +1,5 @@
module GameData module GameData
class TrainerModern class TrainerModern < Trainer
attr_reader :id
attr_reader :id_number
attr_reader :trainer_type
attr_reader :real_name
attr_reader :version
attr_reader :items
attr_reader :real_lose_text
attr_reader :pokemon
DATA = {}
DATA_FILENAME = "trainers_remix.dat" DATA_FILENAME = "trainers_remix.dat"
SCHEMA = {
"Items" => [:items, "*e", :Item],
"LoseText" => [:lose_text, "s"],
"Pokemon" => [:pokemon, "ev", :Species], # Species, level
"Form" => [:form, "u"],
"Name" => [:name, "s"],
"Moves" => [:moves, "*e", :Move],
"Ability" => [:ability, "s"],
"AbilityIndex" => [:ability_index, "u"],
"Item" => [:item, "e", :Item],
"Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }],
"Nature" => [:nature, "e", :Nature],
"IV" => [:iv, "uUUUUU"],
"EV" => [:ev, "uUUUUU"],
"Happiness" => [:happiness, "u"],
"Shiny" => [:shininess, "b"],
"Shadow" => [:shadowness, "b"],
"Ball" => [:poke_ball, "s"],
}
extend ClassMethods
include InstanceMethods
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
# @return [Boolean] whether the given other is defined as a self
def self.exists?(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String]
validate tr_name => [String]
key = [tr_type.to_sym, tr_name, tr_version]
return !self::DATA[key].nil?
end
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
# @return [self]
def self.get(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String]
validate tr_name => [String]
key = [tr_type.to_sym, tr_name, tr_version]
raise "Unknown trainer #{tr_type} #{tr_name} #{tr_version}." unless self::DATA.has_key?(key)
return self::DATA[key]
end
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
# @return [self, nil]
def self.try_get(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String]
validate tr_name => [String]
key = [tr_type.to_sym, tr_name, tr_version]
return (self::DATA.has_key?(key)) ? self::DATA[key] : nil
end
def self.list_all()
return self::DATA
end
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number]
@trainer_type = hash[:trainer_type]
@real_name = hash[:name] || "Unnamed"
@version = hash[:version] || 0
@items = hash[:items] || []
@real_lose_text = hash[:lose_text] || "..."
@pokemon = hash[:pokemon] || []
@pokemon.each do |pkmn|
GameData::Stat.each_main do |s|
pkmn[:iv][s.id] ||= 0 if pkmn[:iv]
pkmn[:ev][s.id] ||= 0 if pkmn[:ev]
end
end
end
# @return [String] the translated name of this trainer
def name
return pbGetMessageFromHash(MessageTypes::TrainerNames, @real_name)
end
# @return [String] the translated in-battle lose message of this trainer
def lose_text
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @real_lose_text)
end
def replace_species_with_placeholder(species)
case species
when Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES
return pbGet(Settings::RIVAL_STARTER_PLACEHOLDER_VARIABLE)
when Settings::VAR_1_PLACEHOLDER_SPECIES
return pbGet(1)
when Settings::VAR_2_PLACEHOLDER_SPECIES
return pbGet(2)
when Settings::VAR_3_PLACEHOLDER_SPECIES
return pbGet(3)
end
end
def generateRandomChampionSpecies(old_species)
customsList = getCustomSpeciesList()
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
#every pokemon should be fully evolved
evolved_species_id = getEvolution(new_species)
evolved_species_id = getEvolution(evolved_species_id)
evolved_species_id = getEvolution(evolved_species_id)
evolved_species_id = getEvolution(evolved_species_id)
return getSpecies(evolved_species_id)
end
def generateRandomGymSpecies(old_species)
gym_index = pbGet(VAR_CURRENT_GYM_TYPE)
return old_species if gym_index == -1
return generateRandomChampionSpecies(old_species) if gym_index == 999
type_id = pbGet(VAR_GYM_TYPES_ARRAY)[gym_index]
return old_species if type_id == -1
customsList = getCustomSpeciesList()
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
gym_type = GameData::Type.get(type_id)
while true
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
if new_species.hasType?(gym_type)
return new_species
end
end
end
def replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
if $PokemonGlobal.randomGymTrainersHash == nil
$PokemonGlobal.randomGymTrainersHash = {}
end
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS] && $PokemonGlobal.randomGymTrainersHash != nil
if $PokemonGlobal.randomGymTrainersHash[trainerId] != nil && $PokemonGlobal.randomGymTrainersHash[trainerId].length >= $PokemonGlobal.randomTrainersHash[trainerId].length
return getSpecies($PokemonGlobal.randomGymTrainersHash[trainerId][pokemonIndex])
end
end
new_species = generateRandomGymSpecies(species)
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS]
add_generated_species_to_gym_array(new_species, trainerId)
end
return new_species
end
def add_generated_species_to_gym_array(new_species, trainerId)
if (new_species.is_a?(Symbol))
id = new_species
else
id = new_species.id_number
end
expected_team_length = 1
expected_team_length = $PokemonGlobal.randomTrainersHash[trainerId].length if $PokemonGlobal.randomTrainersHash[trainerId]
new_team = []
if $PokemonGlobal.randomGymTrainersHash[trainerId]
new_team = $PokemonGlobal.randomGymTrainersHash[trainerId]
end
if new_team.length < expected_team_length
new_team << id
end
$PokemonGlobal.randomGymTrainersHash[trainerId] = new_team
end
def replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
if $PokemonGlobal.randomTrainersHash[trainerId] == nil
Kernel.pbMessage(_INTL("The trainers need to be re-shuffled."))
Kernel.pbShuffleTrainers()
end
new_species_dex = $PokemonGlobal.randomTrainersHash[trainerId][pokemonIndex]
return getSpecies(new_species_dex)
end
def isGymBattle
return ($game_switches[SWITCH_RANDOM_TRAINERS] && ($game_variables[VAR_CURRENT_GYM_TYPE] != -1) || ($game_switches[SWITCH_FIRST_RIVAL_BATTLE] && $game_switches[SWITCH_RANDOM_STARTERS]))
end
def replace_species_to_randomized(species, trainerId, pokemonIndex)
return species if $game_switches[SWITCH_FIRST_RIVAL_BATTLE]
return species if $game_switches[SWITCH_DONT_RANDOMIZE]
if isGymBattle() && $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY]
return replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
end
return replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
end
def replaceSingleSpeciesModeIfApplicable(species)
if $game_switches[SWITCH_SINGLE_POKEMON_MODE]
if $game_switches[SWITCH_SINGLE_POKEMON_MODE_HEAD]
return replaceFusionsHeadWithSpecies(species)
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_BODY]
return replaceFusionsBodyWithSpecies(species)
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_RANDOM]
if (rand(2) == 0)
return replaceFusionsHeadWithSpecies(species)
else
return replaceFusionsBodyWithSpecies(species)
end
end
end
return species
end
def replaceFusionsHeadWithSpecies(species)
speciesId = getDexNumberForSpecies(species)
if speciesId > NB_POKEMON
bodyPoke = getBodyID(speciesId)
headPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
newSpecies = bodyPoke * NB_POKEMON + headPoke
return getPokemon(newSpecies)
end
return species
end
def replaceFusionsBodyWithSpecies(species)
speciesId = getDexNumberForSpecies(species)
if speciesId > NB_POKEMON
bodyPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
headPoke = getHeadID(species)
newSpecies = bodyPoke * NB_POKEMON + headPoke
return getPokemon(newSpecies)
end
return species
end
def to_trainer
placeholder_species = [Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES,
Settings::VAR_1_PLACEHOLDER_SPECIES,
Settings::VAR_2_PLACEHOLDER_SPECIES,
Settings::VAR_3_PLACEHOLDER_SPECIES]
# Determine trainer's name
tr_name = self.name
Settings::RIVAL_NAMES.each do |rival|
next if rival[0] != @trainer_type || !$game_variables[rival[1]].is_a?(String)
tr_name = $game_variables[rival[1]]
break
end
# Create trainer object
trainer = NPCTrainer.new(tr_name, @trainer_type)
trainer.id = $Trainer.make_foreign_ID
trainer.items = @items.clone
trainer.lose_text = self.lose_text
isRematch = $game_switches[SWITCH_IS_REMATCH]
isPlayingRandomized = $game_switches[SWITCH_RANDOM_TRAINERS] && !$game_switches[SWITCH_FIRST_RIVAL_BATTLE]
rematchId = getRematchId(trainer.name, trainer.trainer_type)
# Create each Pokémon owned by the trainer
index = 0
@pokemon.each do |pkmn_data|
#replace placeholder species infinite fusion edit
species = GameData::Species.get(pkmn_data[:species]).species
original_species = species
if placeholder_species.include?(species)
species = replace_species_with_placeholder(species)
else
species = replace_species_to_randomized(species, self.id, index) if isPlayingRandomized
end
species = replaceSingleSpeciesModeIfApplicable(species)
if $game_switches[SWITCH_REVERSED_MODE]
species = reverseFusionSpecies(species)
end
level = pkmn_data[:level]
if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
level = (level * Settings::HARD_MODE_LEVEL_MODIFIER).ceil
if level > Settings::MAXIMUM_LEVEL
level = Settings::MAXIMUM_LEVEL
end
end
if $game_switches[Settings::OVERRIDE_BATTLE_LEVEL_SWITCH]
override_level = $game_variables[Settings::OVERRIDE_BATTLE_LEVEL_VALUE_VAR]
if override_level.is_a?(Integer)
level = override_level
end
end
####
#trainer rematch infinite fusion edit
if isRematch
nbRematch = getNumberRematch(rematchId)
level = getRematchLevel(level, nbRematch)
species = evolveRematchPokemon(nbRematch, species)
end
pkmn = Pokemon.new(species, level, trainer, false)
trainer.party.push(pkmn)
# Set Pokémon's properties if defined
if pkmn_data[:form]
pkmn.forced_form = pkmn_data[:form] if MultipleForms.hasFunction?(species, "getForm")
pkmn.form_simple = pkmn_data[:form]
end
if $game_switches[SWITCH_RANDOM_HELD_ITEMS]
pkmn.item = pbGetRandomHeldItem().id
else
pkmn.item = pkmn_data[:item]
end
if pkmn_data[:moves] && pkmn_data[:moves].length > 0 && original_species == species
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
else
pkmn.reset_moves
end
pkmn.ability_index = pkmn_data[:ability_index]
pkmn.ability = pkmn_data[:ability]
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
if pkmn_data[:nature]
pkmn.nature = pkmn_data[:nature]
else
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainer_type).id_number
pkmn.nature = nature % (GameData::Nature::DATA.length / 2)
end
GameData::Stat.each_main do |s|
if pkmn_data[:iv]
pkmn.iv[s.id] = pkmn_data[:iv][s.id]
else
pkmn.iv[s.id] = [pkmn_data[:level] / 2, Pokemon::IV_STAT_LIMIT].min
end
if pkmn_data[:ev]
pkmn.ev[s.id] = pkmn_data[:ev][s.id]
else
pkmn.ev[s.id] = [pkmn_data[:level] * 3 / 2, Pokemon::EV_LIMIT / 6].min
end
end
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
if pkmn_data[:shadowness]
pkmn.makeShadow
pkmn.update_shadow_moves(true)
pkmn.shiny = false
end
pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
pkmn.calc_stats
index += 1
end
return trainer
end
end end
end end
#===============================================================================
# Deprecated methods
#===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetTrainerData(tr_type, tr_name, tr_version = 0)
Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)')
return GameData::Trainer.get(tr_type, tr_name, tr_version)
end

Some files were not shown because too many files have changed in this diff Show More