mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-02-04 04:11:03 +00:00
Merge branch 'dev' into ai
This commit is contained in:
@@ -87,6 +87,13 @@ module Console
|
|||||||
echoln ""
|
echoln ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Same as echoln_li but text is in green
|
||||||
|
def echoln_li_done(msg)
|
||||||
|
self.echo_li(markup_style(msg, text: :green), 0, :green)
|
||||||
|
echoln ""
|
||||||
|
echoln ""
|
||||||
|
end
|
||||||
|
|
||||||
# paragraph with markup
|
# paragraph with markup
|
||||||
def echo_p(msg)
|
def echo_p(msg)
|
||||||
echoln markup(msg)
|
echoln markup(msg)
|
||||||
@@ -170,7 +177,7 @@ module Console
|
|||||||
options_pool = options.select { |key, val| font_options.key?(key) && val }
|
options_pool = options.select { |key, val| font_options.key?(key) && val }
|
||||||
markup_pool = options_pool.keys.map { |opt| font_options[opt] }.join(";").squeeze
|
markup_pool = options_pool.keys.map { |opt| font_options[opt] }.join(";").squeeze
|
||||||
# return formatted string
|
# return formatted string
|
||||||
"\e[#{code_bg};#{markup_pool};#{code_text}m#{string}\e[0m".squeeze(";")
|
return "\e[#{code_bg};#{markup_pool};#{code_text}m#{string}\e[0m".squeeze(";")
|
||||||
end
|
end
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ module PluginManager
|
|||||||
def self.error(msg)
|
def self.error(msg)
|
||||||
Graphics.update
|
Graphics.update
|
||||||
t = Thread.new do
|
t = Thread.new do
|
||||||
Console.echo_error "Plugin Error:\r\n#{msg}"
|
Console.echo_error("Plugin Error:\r\n#{msg}")
|
||||||
print("Plugin Error:\r\n#{msg}")
|
print("Plugin Error:\r\n#{msg}")
|
||||||
Thread.exit
|
Thread.exit
|
||||||
end
|
end
|
||||||
@@ -594,7 +594,7 @@ module PluginManager
|
|||||||
# Check if plugins need compiling
|
# Check if plugins need compiling
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def self.compilePlugins(order, plugins)
|
def self.compilePlugins(order, plugins)
|
||||||
Console.echo_li "Compiling plugin scripts..."
|
Console.echo_li("Compiling plugin scripts...")
|
||||||
scripts = []
|
scripts = []
|
||||||
# go through the entire order one by one
|
# go through the entire order one by one
|
||||||
order.each do |o|
|
order.each do |o|
|
||||||
@@ -617,20 +617,19 @@ module PluginManager
|
|||||||
# collect garbage
|
# collect garbage
|
||||||
GC.start
|
GC.start
|
||||||
Console.echo_done(true)
|
Console.echo_done(true)
|
||||||
echoln "" if scripts.length == 0
|
|
||||||
end
|
end
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Check if plugins need compiling
|
# Check if plugins need compiling
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
def self.runPlugins
|
def self.runPlugins
|
||||||
Console.echo_h1 "Checking plugins"
|
Console.echo_h1("Checking plugins")
|
||||||
# get the order of plugins to interpret
|
# get the order of plugins to interpret
|
||||||
order, plugins = self.getPluginOrder
|
order, plugins = self.getPluginOrder
|
||||||
# compile if necessary
|
# compile if necessary
|
||||||
if self.needCompiling?(order, plugins)
|
if self.needCompiling?(order, plugins)
|
||||||
self.compilePlugins(order, plugins)
|
self.compilePlugins(order, plugins)
|
||||||
else
|
else
|
||||||
Console.echoln_li "Plugins were not compiled."
|
Console.echoln_li("Plugins were not compiled")
|
||||||
end
|
end
|
||||||
# load plugins
|
# load plugins
|
||||||
scripts = load_data("Data/PluginScripts.rxdata")
|
scripts = load_data("Data/PluginScripts.rxdata")
|
||||||
@@ -639,7 +638,7 @@ module PluginManager
|
|||||||
# get the required data
|
# get the required data
|
||||||
name, meta, script = plugin
|
name, meta, script = plugin
|
||||||
if !meta[:essentials] || !meta[:essentials].include?(Essentials::VERSION)
|
if !meta[:essentials] || !meta[:essentials].include?(Essentials::VERSION)
|
||||||
Console.echo_warn "Plugin '#{name}' may not be compatible with Essentials v#{Essentials::VERSION}. Trying to load anyway."
|
Console.echo_warn("Plugin '#{name}' may not be compatible with Essentials v#{Essentials::VERSION}. Trying to load anyway.")
|
||||||
end
|
end
|
||||||
# register plugin
|
# register plugin
|
||||||
self.register(meta)
|
self.register(meta)
|
||||||
@@ -655,7 +654,7 @@ module PluginManager
|
|||||||
# try to run the code
|
# try to run the code
|
||||||
begin
|
begin
|
||||||
eval(code, TOPLEVEL_BINDING, fname)
|
eval(code, TOPLEVEL_BINDING, fname)
|
||||||
Console.echoln_li "Loaded plugin: ==#{name}== (ver. #{meta[:version]})" if !echoed_plugins.include?(name)
|
Console.echoln_li("Loaded plugin: ==#{name}== (ver. #{meta[:version]})") if !echoed_plugins.include?(name)
|
||||||
echoed_plugins.push(name)
|
echoed_plugins.push(name)
|
||||||
rescue Exception # format error message to display
|
rescue Exception # format error message to display
|
||||||
self.pluginErrorMsg(name, sname)
|
self.pluginErrorMsg(name, sname)
|
||||||
@@ -664,10 +663,9 @@ module PluginManager
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if scripts.length > 0
|
if scripts.length > 0
|
||||||
echoln ""
|
Console.echoln_li_done("Successfully loaded #{scripts.length} plugin(s)")
|
||||||
Console.echo_h2("Successfully loaded #{scripts.length} plugin(s)", text: :green)
|
|
||||||
else
|
else
|
||||||
Console.echo_h2("No plugins found", text: :green)
|
Console.echoln_li_done("No plugins found")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -195,14 +195,13 @@ module SaveData
|
|||||||
conversions_to_run = self.get_conversions(save_data)
|
conversions_to_run = self.get_conversions(save_data)
|
||||||
return false if conversions_to_run.none?
|
return false if conversions_to_run.none?
|
||||||
File.open(SaveData::FILE_PATH + ".bak", "wb") { |f| Marshal.dump(save_data, f) }
|
File.open(SaveData::FILE_PATH + ".bak", "wb") { |f| Marshal.dump(save_data, f) }
|
||||||
Console.echo_h1 "Running #{conversions_to_run.length} save file conversions"
|
Console.echo_h1(_INTL("Converting save file"))
|
||||||
conversions_to_run.each do |conversion|
|
conversions_to_run.each do |conversion|
|
||||||
Console.echo_li "#{conversion.title}..."
|
Console.echo_li("#{conversion.title}...")
|
||||||
conversion.run(save_data)
|
conversion.run(save_data)
|
||||||
Console.echo_done(true)
|
Console.echo_done(true)
|
||||||
end
|
end
|
||||||
echoln "" if conversions_to_run.length > 0
|
Console.echoln_li_done(_INTL("Successfully applied #{conversions_to_run.length} save file conversion(s)"))
|
||||||
Console.echo_h2("All save file conversions applied successfully", text: :green)
|
|
||||||
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
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ module Game
|
|||||||
end
|
end
|
||||||
$game_temp.common_event_id = 0 if $game_temp
|
$game_temp.common_event_id = 0 if $game_temp
|
||||||
$game_temp.begun_new_game = true
|
$game_temp.begun_new_game = true
|
||||||
|
pbMapInterpreter&.clear
|
||||||
|
pbMapInterpreter&.setup(nil, 0, 0)
|
||||||
$scene = Scene_Map.new
|
$scene = Scene_Map.new
|
||||||
SaveData.load_new_game_values
|
SaveData.load_new_game_values
|
||||||
$stats.play_sessions += 1
|
$stats.play_sessions += 1
|
||||||
|
|||||||
@@ -59,10 +59,9 @@ class Scene_Map
|
|||||||
return if !playingBGM && !playingBGS
|
return if !playingBGM && !playingBGS
|
||||||
map = load_data(sprintf("Data/Map%03d.rxdata", mapid))
|
map = load_data(sprintf("Data/Map%03d.rxdata", mapid))
|
||||||
if playingBGM && map.autoplay_bgm
|
if playingBGM && map.autoplay_bgm
|
||||||
if (PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + map.bgm.name + "_n") &&
|
test_filename = map.bgm.name
|
||||||
playingBGM.name != map.bgm.name + "_n") || playingBGM.name != map.bgm.name
|
test_filename += "_n" if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + test_filename + "_n")
|
||||||
pbBGMFade(0.8)
|
pbBGMFade(0.8) if playingBGM.name != test_filename
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if playingBGS && map.autoplay_bgs && playingBGS.name != map.bgs.name
|
if playingBGS && map.autoplay_bgs && playingBGS.name != map.bgs.name
|
||||||
pbBGMFade(0.8)
|
pbBGMFade(0.8)
|
||||||
|
|||||||
@@ -163,13 +163,13 @@ end
|
|||||||
class HandlerHashSymbol
|
class HandlerHashSymbol
|
||||||
def initialize
|
def initialize
|
||||||
@hash = {}
|
@hash = {}
|
||||||
@add_ifs = []
|
@add_ifs = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](sym)
|
def [](sym)
|
||||||
sym = sym.id if !sym.is_a?(Symbol) && sym.respond_to?("id")
|
sym = sym.id if !sym.is_a?(Symbol) && sym.respond_to?("id")
|
||||||
return @hash[sym] if sym && @hash[sym]
|
return @hash[sym] if sym && @hash[sym]
|
||||||
@add_ifs.each do |add_if|
|
@add_ifs.each_value do |add_if|
|
||||||
return add_if[1] if add_if[0].call(sym)
|
return add_if[1] if add_if[0].call(sym)
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
@@ -182,11 +182,11 @@ class HandlerHashSymbol
|
|||||||
@hash[sym] = handler || handlerBlock if sym
|
@hash[sym] = handler || handlerBlock if sym
|
||||||
end
|
end
|
||||||
|
|
||||||
def addIf(conditionProc, handler = nil, &handlerBlock)
|
def addIf(sym, conditionProc, handler = nil, &handlerBlock)
|
||||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
if ![Proc, Hash].include?(handler.class) && !block_given?
|
||||||
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
raise ArgumentError, "addIf call for #{sym} in #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
||||||
end
|
end
|
||||||
@add_ifs.push([conditionProc, handler || handlerBlock])
|
@add_ifs[sym] = [conditionProc, handler || handlerBlock]
|
||||||
end
|
end
|
||||||
|
|
||||||
def copy(src, *dests)
|
def copy(src, *dests)
|
||||||
@@ -271,13 +271,6 @@ class HandlerHashEnum
|
|||||||
@hash[symbol] = handler || handlerBlock if symbol
|
@hash[symbol] = handler || handlerBlock if symbol
|
||||||
end
|
end
|
||||||
|
|
||||||
def addIf(conditionProc, handler = nil, &handlerBlock)
|
|
||||||
if ![Proc, Hash].include?(handler.class) && !block_given?
|
|
||||||
raise ArgumentError, "addIf call for #{self.class.name} has no valid handler (#{handler.inspect} was given)"
|
|
||||||
end
|
|
||||||
@addIfs.push([conditionProc, handler || handlerBlock])
|
|
||||||
end
|
|
||||||
|
|
||||||
def copy(src, *dests)
|
def copy(src, *dests)
|
||||||
handler = self[src]
|
handler = self[src]
|
||||||
return if !handler
|
return if !handler
|
||||||
|
|||||||
@@ -529,11 +529,17 @@ class Game_Player < Game_Character
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Center player on-screen
|
# Track the player on-screen as they move
|
||||||
def update_screen_position(last_real_x, last_real_y)
|
def update_screen_position(last_real_x, last_real_y)
|
||||||
return if self.map.scrolling? || !(@moved_last_frame || @moved_this_frame)
|
return if self.map.scrolling? || !(@moved_last_frame || @moved_this_frame)
|
||||||
self.map.display_x = @real_x - SCREEN_CENTER_X
|
if (@real_x < last_real_x && @real_x - $game_map.display_x < SCREEN_CENTER_X) ||
|
||||||
self.map.display_y = @real_y - SCREEN_CENTER_Y
|
(@real_x > last_real_x && @real_x - $game_map.display_x > SCREEN_CENTER_X)
|
||||||
|
self.map.display_x += @real_x - last_real_x
|
||||||
|
end
|
||||||
|
if (@real_y < last_real_y && @real_y - $game_map.display_y < SCREEN_CENTER_Y) ||
|
||||||
|
(@real_y > last_real_y && @real_y - $game_map.display_y > SCREEN_CENTER_Y)
|
||||||
|
self.map.display_y += @real_y - last_real_y
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_event_triggering
|
def update_event_triggering
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ class TilemapRenderer
|
|||||||
tile.z = 0
|
tile.z = 0
|
||||||
else
|
else
|
||||||
priority = tile.priority
|
priority = tile.priority
|
||||||
tile.z = (priority == 0) ? 0 : (y * SOURCE_TILE_HEIGHT) + (priority * SOURCE_TILE_HEIGHT) + SOURCE_TILE_HEIGHT
|
tile.z = (priority == 0) ? 0 : (y * SOURCE_TILE_HEIGHT) + (priority * SOURCE_TILE_HEIGHT) + SOURCE_TILE_HEIGHT + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -942,14 +942,10 @@ def drawSingleFormattedChar(bitmap, ch)
|
|||||||
graphic.dispose
|
graphic.dispose
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
bitmap.font.bold = ch[6] if bitmap.font.bold != ch[6]
|
|
||||||
bitmap.font.italic = ch[7] if bitmap.font.italic != ch[7]
|
|
||||||
bitmap.font.name = ch[12] if bitmap.font.name != ch[12]
|
|
||||||
bitmap.font.size = ch[13] if bitmap.font.size != ch[13]
|
bitmap.font.size = ch[13] if bitmap.font.size != ch[13]
|
||||||
if ch[9] # shadow
|
if ch[9] # shadow
|
||||||
if ch[10] # underline
|
if ch[10] # underline
|
||||||
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2,
|
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2, ch[3], 4, ch[9])
|
||||||
ch[3], 4, ch[9])
|
|
||||||
end
|
end
|
||||||
if ch[11] # strikeout
|
if ch[11] # strikeout
|
||||||
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3], 4, ch[9])
|
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3], 4, ch[9])
|
||||||
@@ -958,6 +954,9 @@ def drawSingleFormattedChar(bitmap, ch)
|
|||||||
if ch[0] == "\n" || ch[0] == "\r" || ch[0] == " " || isWaitChar(ch[0])
|
if ch[0] == "\n" || ch[0] == "\r" || ch[0] == " " || isWaitChar(ch[0])
|
||||||
bitmap.font.color = ch[8] if bitmap.font.color != ch[8]
|
bitmap.font.color = ch[8] if bitmap.font.color != ch[8]
|
||||||
else
|
else
|
||||||
|
bitmap.font.bold = ch[6] if bitmap.font.bold != ch[6]
|
||||||
|
bitmap.font.italic = ch[7] if bitmap.font.italic != ch[7]
|
||||||
|
bitmap.font.name = ch[12] if bitmap.font.name != ch[12]
|
||||||
offset = 0
|
offset = 0
|
||||||
if ch[9] # shadow
|
if ch[9] # shadow
|
||||||
bitmap.font.color = ch[9]
|
bitmap.font.color = ch[9]
|
||||||
@@ -991,8 +990,7 @@ def drawSingleFormattedChar(bitmap, ch)
|
|||||||
bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0])
|
bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0])
|
||||||
end
|
end
|
||||||
if ch[10] # underline
|
if ch[10] # underline
|
||||||
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2,
|
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2, ch[3] - 2, 2, ch[8])
|
||||||
ch[3] - 2, 2, ch[8])
|
|
||||||
end
|
end
|
||||||
if ch[11] # strikeout
|
if ch[11] # strikeout
|
||||||
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3] - 2, 2, ch[8])
|
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3] - 2, 2, ch[8])
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ module GameData
|
|||||||
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
|
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
|
||||||
if pkmn_data[:shadowness]
|
if pkmn_data[:shadowness]
|
||||||
pkmn.makeShadow
|
pkmn.makeShadow
|
||||||
pkmn.update_shadow_moves(true)
|
|
||||||
pkmn.shiny = false
|
pkmn.shiny = false
|
||||||
end
|
end
|
||||||
pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
|
pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class Battle::Battler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbRecoverHPFromDrain(amt, target, msg = nil)
|
def pbRecoverHPFromDrain(amt, target, msg = nil)
|
||||||
if target.hasActiveAbility?(:LIQUIDOOZE)
|
if target.hasActiveAbility?(:LIQUIDOOZE, true)
|
||||||
@battle.pbShowAbilitySplash(target)
|
@battle.pbShowAbilitySplash(target)
|
||||||
pbReduceHP(amt)
|
pbReduceHP(amt)
|
||||||
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", pbThis))
|
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", pbThis))
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ class Battle::Battler
|
|||||||
# Start using the move
|
# Start using the move
|
||||||
pbBeginTurn(choice)
|
pbBeginTurn(choice)
|
||||||
# Force the use of certain moves if they're already being used
|
# Force the use of certain moves if they're already being used
|
||||||
|
if !@battle.futureSight
|
||||||
if usingMultiTurnAttack?
|
if usingMultiTurnAttack?
|
||||||
choice[2] = Battle::Move.from_pokemon_move(@battle, Pokemon::Move.new(@currentMove))
|
choice[2] = Battle::Move.from_pokemon_move(@battle, Pokemon::Move.new(@currentMove))
|
||||||
specialUsage = true
|
specialUsage = true
|
||||||
@@ -173,6 +174,7 @@ class Battle::Battler
|
|||||||
choice[3] = -1 # No target chosen
|
choice[3] = -1 # No target chosen
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
# Labels the move being used as "move"
|
# Labels the move being used as "move"
|
||||||
move = choice[2]
|
move = choice[2]
|
||||||
return if !move # if move was not chosen somehow
|
return if !move # if move was not chosen somehow
|
||||||
@@ -361,6 +363,8 @@ class Battle::Battler
|
|||||||
targets = pbFindTargets(choice, move, user)
|
targets = pbFindTargets(choice, move, user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# For two-turn moves when they charge and attack in the same turn
|
||||||
|
move.pbQuickChargingMove(user, targets)
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
magicCoater = -1
|
magicCoater = -1
|
||||||
magicBouncer = -1
|
magicBouncer = -1
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ class Battle::Move
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
#
|
#
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Whether the move is currently in the "charging" turn of a two turn attack.
|
# Whether the move is currently in the "charging" turn of a two-turn move.
|
||||||
# Is false if Power Herb or another effect lets a two turn move charge and
|
# Is false if Power Herb or another effect lets a two-turn move charge and
|
||||||
# attack in the same turn.
|
# attack in the same turn.
|
||||||
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID during the
|
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID during the
|
||||||
# charging turn, and is nil during the attack turn.
|
# charging turn, and is nil during the attack turn.
|
||||||
@@ -52,6 +52,9 @@ class Battle::Move
|
|||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# For two-turn moves when they charge and attack in the same turn.
|
||||||
|
def pbQuickChargingMove(user, targets); end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Effect methods per hit
|
# Effect methods per hit
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
@@ -271,6 +274,7 @@ class Battle::Move
|
|||||||
# Messages upon being hit
|
# Messages upon being hit
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbEffectivenessMessage(user, target, numTargets = 1)
|
def pbEffectivenessMessage(user, target, numTargets = 1)
|
||||||
|
return if self.is_a?(Battle::Move::FixedDamageMove)
|
||||||
return if target.damageState.disguise || target.damageState.iceFace
|
return if target.damageState.disguise || target.damageState.iceFace
|
||||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||||
if numTargets > 1
|
if numTargets > 1
|
||||||
|
|||||||
@@ -323,14 +323,11 @@ class Battle::Move::TwoTurnMove < Battle::Move
|
|||||||
return super
|
return super
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbAccuracyCheck(user, target)
|
# Does the charging part of this move, for when this move only takes one round
|
||||||
return true if !@damagingTurn
|
# to use.
|
||||||
return super
|
def pbQuickChargingMove(user, targets)
|
||||||
end
|
return if !@chargingTurn || !@damagingTurn # Move only takes one turn to use
|
||||||
|
pbChargingTurnMessage(user, targets)
|
||||||
def pbInitialEffect(user, targets, hitNum)
|
|
||||||
pbChargingTurnMessage(user, targets) if @chargingTurn
|
|
||||||
if @chargingTurn && @damagingTurn # Move only takes one turn to use
|
|
||||||
pbShowAnimation(@id, user, targets, 1) # Charging anim
|
pbShowAnimation(@id, user, targets, 1) # Charging anim
|
||||||
targets.each { |b| pbChargingTurnEffect(user, b) }
|
targets.each { |b| pbChargingTurnEffect(user, b) }
|
||||||
if @powerHerb
|
if @powerHerb
|
||||||
@@ -349,7 +346,18 @@ class Battle::Move::TwoTurnMove < Battle::Move
|
|||||||
user.pbConsumeItem
|
user.pbConsumeItem
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
pbAttackingTurnMessage(user, targets) if @damagingTurn
|
|
||||||
|
def pbAccuracyCheck(user, target)
|
||||||
|
return true if !@damagingTurn
|
||||||
|
return super
|
||||||
|
end
|
||||||
|
|
||||||
|
def pbInitialEffect(user, targets, hitNum)
|
||||||
|
if @damagingTurn
|
||||||
|
pbAttackingTurnMessage(user, targets)
|
||||||
|
elsif @chargingTurn
|
||||||
|
pbChargingTurnMessage(user, targets)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChargingTurnMessage(user, targets)
|
def pbChargingTurnMessage(user, targets)
|
||||||
@@ -359,14 +367,6 @@ class Battle::Move::TwoTurnMove < Battle::Move
|
|||||||
def pbAttackingTurnMessage(user, targets)
|
def pbAttackingTurnMessage(user, targets)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbChargingTurnEffect(user, target)
|
|
||||||
# Skull Bash/Sky Drop are the only two-turn moves with an effect here, and
|
|
||||||
# the latter just records the target is being Sky Dropped
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbAttackingTurnEffect(user, target)
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbEffectAgainstTarget(user, target)
|
def pbEffectAgainstTarget(user, target)
|
||||||
if @damagingTurn
|
if @damagingTurn
|
||||||
pbAttackingTurnEffect(user, target)
|
pbAttackingTurnEffect(user, target)
|
||||||
@@ -375,6 +375,14 @@ class Battle::Move::TwoTurnMove < Battle::Move
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pbChargingTurnEffect(user, target)
|
||||||
|
# Skull Bash/Sky Drop are the only two-turn moves with an effect here, and
|
||||||
|
# the latter just records the target is being Sky Dropped
|
||||||
|
end
|
||||||
|
|
||||||
|
def pbAttackingTurnEffect(user, target)
|
||||||
|
end
|
||||||
|
|
||||||
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
|
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
|
||||||
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim
|
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim
|
||||||
super
|
super
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class Battle::Move::HealUserByTargetAttackLowerTargetAttack1 < Battle::Move
|
|||||||
target.pbLowerStatStage(:ATTACK, 1, user)
|
target.pbLowerStatStage(:ATTACK, 1, user)
|
||||||
end
|
end
|
||||||
# Heal user
|
# Heal user
|
||||||
if target.hasActiveAbility?(:LIQUIDOOZE)
|
if target.hasActiveAbility?(:LIQUIDOOZE, true)
|
||||||
@battle.pbShowAbilitySplash(target)
|
@battle.pbShowAbilitySplash(target)
|
||||||
user.pbReduceHP(healAmt)
|
user.pbReduceHP(healAmt)
|
||||||
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", user.pbThis))
|
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", user.pbThis))
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
|||||||
def refreshMoveData(move)
|
def refreshMoveData(move)
|
||||||
# Write PP and type of the selected move
|
# Write PP and type of the selected move
|
||||||
if !USE_GRAPHICS
|
if !USE_GRAPHICS
|
||||||
|
return if !move
|
||||||
moveType = GameData::Type.get(move.display_type(@battler)).name
|
moveType = GameData::Type.get(move.display_type(@battler)).name
|
||||||
if move.total_pp <= 0
|
if move.total_pp <= 0
|
||||||
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}", moveType)
|
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}", moveType)
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ class WildBattle
|
|||||||
# roaming Pokémon, Safari battles, Bug Contest battles)
|
# roaming Pokémon, Safari battles, Bug Contest battles)
|
||||||
if foe_party.length == 1 && can_override
|
if foe_party.length == 1 && can_override
|
||||||
handled = [nil]
|
handled = [nil]
|
||||||
EventHandlers.trigger(:on_calling_wild_battle, foe_party[0].species, foe_party[0].level, handled)
|
EventHandlers.trigger(:on_calling_wild_battle, foe_party[0], handled)
|
||||||
return handled[0] if !handled[0].nil?
|
return handled[0] if !handled[0].nil?
|
||||||
end
|
end
|
||||||
# Perform the battle
|
# Perform the battle
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ class PokemonGlobalMetadata
|
|||||||
attr_writer :roamPokemonCaught
|
attr_writer :roamPokemonCaught
|
||||||
|
|
||||||
def roamPokemonCaught
|
def roamPokemonCaught
|
||||||
return @roamPokemonCaught || []
|
@roamPokemonCaught = [] if !@roamPokemonCaught
|
||||||
|
return @roamPokemonCaught
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -185,23 +186,27 @@ EventHandlers.add(:on_wild_species_chosen, :roaming_pokemon,
|
|||||||
)
|
)
|
||||||
|
|
||||||
EventHandlers.add(:on_calling_wild_battle, :roaming_pokemon,
|
EventHandlers.add(:on_calling_wild_battle, :roaming_pokemon,
|
||||||
proc { |species, level, handled|
|
proc { |pkmn, handled|
|
||||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
# been overridden (the boolean is its outcome), so don't do anything that
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
# would override it again
|
# would override it again
|
||||||
next if !handled[0].nil?
|
next if !handled[0].nil?
|
||||||
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
next if !$PokemonGlobal.roamEncounter || $game_temp.roamer_index_for_encounter.nil?
|
||||||
handled[0] = pbRoamingPokemonBattle(species, level)
|
handled[0] = pbRoamingPokemonBattle(pkmn)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def pbRoamingPokemonBattle(species, level)
|
def pbRoamingPokemonBattle(pkmn, level = 1)
|
||||||
# Get the roaming Pokémon to encounter; generate it based on the species and
|
# Get the roaming Pokémon to encounter; generate it based on the species and
|
||||||
# level if it doesn't already exist
|
# level if it doesn't already exist
|
||||||
idxRoamer = $game_temp.roamer_index_for_encounter
|
idxRoamer = $game_temp.roamer_index_for_encounter
|
||||||
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
if !$PokemonGlobal.roamPokemon[idxRoamer] ||
|
||||||
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
!$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon)
|
||||||
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species, level, true)
|
if pkmn.is_a?(Pokemon)
|
||||||
|
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(pkmn.species_data.id, pkmn.level, true)
|
||||||
|
else
|
||||||
|
$PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(pkmn, level, true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
# Set some battle rules
|
# Set some battle rules
|
||||||
setBattleRule("single")
|
setBattleRule("single")
|
||||||
@@ -217,7 +222,7 @@ def pbRoamingPokemonBattle(species, level)
|
|||||||
$PokemonGlobal.roamedAlready = true
|
$PokemonGlobal.roamedAlready = true
|
||||||
$game_temp.roamer_index_for_encounter = nil
|
$game_temp.roamer_index_for_encounter = nil
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||||
# Return false if the player lost or drew the battle, and true if any other result
|
# Return false if the player lost or drew the battle, and true if any other result
|
||||||
return (decision != 2 && decision != 5)
|
return (decision != 2 && decision != 5)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -150,9 +150,8 @@ class DayCare
|
|||||||
egg.nature = new_natures.sample
|
egg.nature = new_natures.sample
|
||||||
end
|
end
|
||||||
|
|
||||||
# If a Pokémon is bred with a Ditto, that Pokémon can pass down its Hidden
|
# The female parent (or the non-Ditto parent) can pass down its Hidden
|
||||||
# Ability (60% chance). If neither Pokémon are Ditto, then the mother can
|
# Ability (60% chance) or its regular ability (80% chance).
|
||||||
# pass down its ability (60% chance if Hidden, 80% chance if not).
|
|
||||||
# NOTE: This is how ability inheritance works in Gen 6+. Gen 5 is more
|
# NOTE: This is how ability inheritance works in Gen 6+. Gen 5 is more
|
||||||
# restrictive, and even works differently between BW and B2W2, and I
|
# restrictive, and even works differently between BW and B2W2, and I
|
||||||
# don't think that is worth adding in. Gen 4 and lower don't have
|
# don't think that is worth adding in. Gen 4 and lower don't have
|
||||||
@@ -164,26 +163,25 @@ class DayCare
|
|||||||
parent = (mother[1]) ? father[0] : mother[0] # The female or non-Ditto parent
|
parent = (mother[1]) ? father[0] : mother[0] # The female or non-Ditto parent
|
||||||
if parent.hasHiddenAbility?
|
if parent.hasHiddenAbility?
|
||||||
egg.ability_index = parent.ability_index if rand(100) < 60
|
egg.ability_index = parent.ability_index if rand(100) < 60
|
||||||
elsif !mother[1] && !father[1] # If neither parent is a Ditto
|
elsif rand(100) < 80
|
||||||
if rand(100) < 80
|
egg.ability_index = parent.ability_index
|
||||||
egg.ability_index = mother[0].ability_index
|
|
||||||
else
|
else
|
||||||
egg.ability_index = (mother[0].ability_index + 1) % 2
|
egg.ability_index = (parent.ability_index + 1) % 2
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def inherit_IVs(egg, mother, father)
|
def inherit_IVs(egg, mother, father)
|
||||||
# Get all stats
|
# Get all stats
|
||||||
stats = []
|
stats = []
|
||||||
GameData::Stat.each_main { |s| stats.push(s) }
|
GameData::Stat.each_main { |s| stats.push(s.id) }
|
||||||
# Get the number of stats to inherit
|
# Get the number of stats to inherit (includes ones inherited via Power items)
|
||||||
inherit_count = 3
|
inherit_count = 3
|
||||||
if Settings::MECHANICS_GENERATION >= 6
|
if Settings::MECHANICS_GENERATION >= 6
|
||||||
inherit_count = 5 if mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT)
|
inherit_count = 5 if mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT)
|
||||||
end
|
end
|
||||||
# Inherit IV because of Power items (if both parents have a Power item,
|
# Inherit IV because of Power items (if both parents have the same Power
|
||||||
# then only a random one of them is inherited)
|
# item, then the parent that passes that Power item's stat down is chosen
|
||||||
|
# randomly)
|
||||||
power_items = [
|
power_items = [
|
||||||
[:POWERWEIGHT, :HP],
|
[:POWERWEIGHT, :HP],
|
||||||
[:POWERBRACER, :ATTACK],
|
[:POWERBRACER, :ATTACK],
|
||||||
@@ -192,18 +190,20 @@ class DayCare
|
|||||||
[:POWERBAND, :SPECIAL_DEFENSE],
|
[:POWERBAND, :SPECIAL_DEFENSE],
|
||||||
[:POWERANKLET, :SPEED]
|
[:POWERANKLET, :SPEED]
|
||||||
]
|
]
|
||||||
power_stats = []
|
power_stats = {}
|
||||||
[mother, father].each do |parent|
|
[mother, father].each do |parent|
|
||||||
power_items.each do |item|
|
power_items.each do |item|
|
||||||
next if !parent.hasItem?(item[0])
|
next if !parent.hasItem?(item[0])
|
||||||
power_stats.push(item[1], parent.iv[item[1]])
|
power_stats[item[1]] ||= []
|
||||||
|
power_stats[item[1]].push(parent.iv[item[1]])
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if power_stats.length > 0
|
power_stats.each_pair do |stat, new_stats|
|
||||||
power_stat = power_stats.sample
|
next if !new_stats || new_stats.length == 0
|
||||||
egg.iv[power_stat[0]] = power_stat[1]
|
new_stat = new_stats.sample
|
||||||
stats.delete(power_stat[0]) # Don't try to inherit this stat's IV again
|
egg.iv[stat] = new_stat
|
||||||
|
stats.delete(stat) # Don't try to inherit this stat's IV again
|
||||||
inherit_count -= 1
|
inherit_count -= 1
|
||||||
end
|
end
|
||||||
# Inherit the rest of the IVs
|
# Inherit the rest of the IVs
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ ItemHandlers::UseFromBag.add(:TOWNMAP, proc { |item|
|
|||||||
next ($game_temp.fly_destination) ? 2 : 0
|
next ($game_temp.fly_destination) ? 2 : 0
|
||||||
})
|
})
|
||||||
|
|
||||||
ItemHandlers::UseFromBag.addIf(proc { |item| GameData::Item.get(item).is_machine? },
|
ItemHandlers::UseFromBag.addIf(:move_machines,
|
||||||
|
proc { |item| GameData::Item.get(item).is_machine? },
|
||||||
proc { |item|
|
proc { |item|
|
||||||
if $player.pokemon_count == 0
|
if $player.pokemon_count == 0
|
||||||
pbMessage(_INTL("There is no Pokémon."))
|
pbMessage(_INTL("There is no Pokémon."))
|
||||||
@@ -361,7 +362,8 @@ ItemHandlers::UseInField.add(:EXPALLOFF, proc { |item|
|
|||||||
|
|
||||||
# Applies to all items defined as an evolution stone.
|
# Applies to all items defined as an evolution stone.
|
||||||
# No need to add more code for new ones.
|
# No need to add more code for new ones.
|
||||||
ItemHandlers::UseOnPokemon.addIf(proc { |item| GameData::Item.get(item).is_evolution_stone? },
|
ItemHandlers::UseOnPokemon.addIf(:evolution_stones,
|
||||||
|
proc { |item| GameData::Item.get(item).is_evolution_stone? },
|
||||||
proc { |item, qty, pkmn, scene|
|
proc { |item, qty, pkmn, scene|
|
||||||
if pkmn.shadowPokemon?
|
if pkmn.shadowPokemon?
|
||||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ ItemHandlers::CanUseInBattle.add(:POKEDOLL, proc { |item, pokemon, battler, move
|
|||||||
|
|
||||||
ItemHandlers::CanUseInBattle.copy(:POKEDOLL, :FLUFFYTAIL, :POKETOY)
|
ItemHandlers::CanUseInBattle.copy(:POKEDOLL, :FLUFFYTAIL, :POKETOY)
|
||||||
|
|
||||||
ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? }, # Poké Balls
|
ItemHandlers::CanUseInBattle.addIf(:poke_balls,
|
||||||
|
proc { |item| GameData::Item.get(item).is_poke_ball? },
|
||||||
proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
|
proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
|
||||||
if battle.pbPlayer.party_full? && $PokemonStorage.full?
|
if battle.pbPlayer.party_full? && $PokemonStorage.full?
|
||||||
scene.pbDisplay(_INTL("There is no room left in the PC!")) if showMessages
|
scene.pbDisplay(_INTL("There is no room left in the PC!")) if showMessages
|
||||||
@@ -314,7 +315,8 @@ ItemHandlers::UseInBattle.add(:POKEFLUTE, proc { |item, battler, battle|
|
|||||||
battle.pbDisplay(_INTL("All Pokémon were roused by the tune!"))
|
battle.pbDisplay(_INTL("All Pokémon were roused by the tune!"))
|
||||||
})
|
})
|
||||||
|
|
||||||
ItemHandlers::UseInBattle.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? }, # Poké Balls
|
ItemHandlers::UseInBattle.addIf(:poke_balls,
|
||||||
|
proc { |item| GameData::Item.get(item).is_poke_ball? },
|
||||||
proc { |item, battler, battle|
|
proc { |item, battler, battle|
|
||||||
battle.pbThrowPokeBall(battler.index, item)
|
battle.pbThrowPokeBall(battler.index, item)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ end
|
|||||||
def pbUsePokeRadar
|
def pbUsePokeRadar
|
||||||
return false if !pbCanUsePokeRadar?
|
return false if !pbCanUsePokeRadar?
|
||||||
$stats.poke_radar_count += 1
|
$stats.poke_radar_count += 1
|
||||||
$game_temp.poke_radar_data = [0, 0, 0, [], false] if !$game_temp.poke_radar_data
|
$game_temp.poke_radar_data = [nil, 0, 0, [], false] if !$game_temp.poke_radar_data
|
||||||
$game_temp.poke_radar_data[4] = false
|
$game_temp.poke_radar_data[4] = false
|
||||||
$PokemonGlobal.pokeradarBattery = 50
|
$PokemonGlobal.pokeradarBattery = 50
|
||||||
pbPokeRadarHighlightGrass
|
pbPokeRadarHighlightGrass
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ module MultipleForms
|
|||||||
@@formSpecies.add(sym, hash)
|
@@formSpecies.add(sym, hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.registerIf(cond, hash)
|
def self.registerIf(sym, cond, hash)
|
||||||
@@formSpecies.addIf(cond, hash)
|
@@formSpecies.addIf(sym, cond, hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.hasFunction?(pkmn, func)
|
def self.hasFunction?(pkmn, func)
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class Pokemon
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_shadow_moves(relearn_all_moves = false)
|
def update_shadow_moves
|
||||||
return if !@shadow_moves || @shadow_moves.empty?
|
return if !@shadow_moves || @shadow_moves.empty?
|
||||||
# Not a Shadow Pokémon (any more); relearn all its original moves
|
# Not a Shadow Pokémon (any more); relearn all its original moves
|
||||||
if !shadowPokemon?
|
if !shadowPokemon?
|
||||||
@@ -159,7 +159,7 @@ class Pokemon
|
|||||||
@shadow_moves.each_with_index { |m, i| new_moves.push(m) if m && i < MAX_MOVES }
|
@shadow_moves.each_with_index { |m, i| new_moves.push(m) if m && i < MAX_MOVES }
|
||||||
num_shadow_moves = new_moves.length
|
num_shadow_moves = new_moves.length
|
||||||
# Add some original moves (skipping ones in the same slot as a Shadow Move)
|
# Add some original moves (skipping ones in the same slot as a Shadow Move)
|
||||||
num_original_moves = (relearn_all_moves) ? 3 : [3, 3, 2, 1, 1, 0][self.heartStage]
|
num_original_moves = [3, 3, 2, 1, 1, 0][self.heartStage]
|
||||||
if num_original_moves > 0
|
if num_original_moves > 0
|
||||||
relearned_count = 0
|
relearned_count = 0
|
||||||
@shadow_moves.each_with_index do |m, i|
|
@shadow_moves.each_with_index do |m, i|
|
||||||
@@ -174,17 +174,16 @@ class Pokemon
|
|||||||
end
|
end
|
||||||
|
|
||||||
def replace_moves(new_moves)
|
def replace_moves(new_moves)
|
||||||
|
# Forget any known moves that aren't in new_moves
|
||||||
|
@moves.each_with_index do |m, i|
|
||||||
|
@moves[i] = nil if !new_moves.include?(m.id)
|
||||||
|
end
|
||||||
|
@moves.compact!
|
||||||
|
# Learn any moves in new_moves that aren't known
|
||||||
new_moves.each do |move|
|
new_moves.each do |move|
|
||||||
next if !move || !GameData::Move.exists?(move) || hasMove?(move)
|
next if !move || !GameData::Move.exists?(move) || hasMove?(move)
|
||||||
if numMoves < Pokemon::MAX_MOVES # Has an empty slot; just learn move
|
break if numMoves >= Pokemon::MAX_MOVES
|
||||||
learn_move(move)
|
learn_move(move)
|
||||||
next
|
|
||||||
end
|
|
||||||
@moves.each do |m|
|
|
||||||
next if new_moves.include?(m.id)
|
|
||||||
m.id = GameData::Move.get(move).id
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -105,19 +105,19 @@ EventHandlers.add(:on_player_step_taken_can_transfer, :safari_game_counter,
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
EventHandlers.add(:on_calling_wild_battle, :safari_battle,
|
EventHandlers.add(:on_calling_wild_battle, :safari_battle,
|
||||||
proc { |species, level, handled|
|
proc { |pkmn, handled|
|
||||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
# been overridden (the boolean is its outcome), so don't do anything that
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
# would override it again
|
# would override it again
|
||||||
next if !handled[0].nil?
|
next if !handled[0].nil?
|
||||||
next if !pbInSafari?
|
next if !pbInSafari?
|
||||||
handled[0] = pbSafariBattle(species, level)
|
handled[0] = pbSafariBattle(pkmn)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def pbSafariBattle(species, level)
|
def pbSafariBattle(pkmn, level = 1)
|
||||||
# Generate a wild Pokémon based on the species and level
|
# Generate a wild Pokémon based on the species and level
|
||||||
pkmn = pbGenerateWildPokemon(species, level)
|
pkmn = pbGenerateWildPokemon(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||||
foeParty = [pkmn]
|
foeParty = [pkmn]
|
||||||
# Calculate who the trainer is
|
# Calculate who the trainer is
|
||||||
playerTrainer = $player
|
playerTrainer = $player
|
||||||
@@ -156,7 +156,7 @@ def pbSafariBattle(species, level)
|
|||||||
end
|
end
|
||||||
pbSet(1, decision)
|
pbSet(1, decision)
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||||
# Return the outcome of the battle
|
# Return the outcome of the battle
|
||||||
return decision
|
return decision
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -355,22 +355,22 @@ EventHandlers.add(:on_leave_map, :end_bug_contest,
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
EventHandlers.add(:on_calling_wild_battle, :bug_contest_battle,
|
EventHandlers.add(:on_calling_wild_battle, :bug_contest_battle,
|
||||||
proc { |species, level, handled|
|
proc { |pkmn, handled|
|
||||||
# handled is an array: [nil]. If [true] or [false], the battle has already
|
# handled is an array: [nil]. If [true] or [false], the battle has already
|
||||||
# been overridden (the boolean is its outcome), so don't do anything that
|
# been overridden (the boolean is its outcome), so don't do anything that
|
||||||
# would override it again
|
# would override it again
|
||||||
next if !handled[0].nil?
|
next if !handled[0].nil?
|
||||||
next if !pbInBugContest?
|
next if !pbInBugContest?
|
||||||
handled[0] = pbBugContestBattle(species, level)
|
handled[0] = pbBugContestBattle(pkmn)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def pbBugContestBattle(species, level)
|
def pbBugContestBattle(pkmn, level = 1)
|
||||||
# Record information about party Pokémon to be used at the end of battle (e.g.
|
# Record information about party Pokémon to be used at the end of battle (e.g.
|
||||||
# comparing levels for an evolution check)
|
# comparing levels for an evolution check)
|
||||||
EventHandlers.trigger(:on_start_battle)
|
EventHandlers.trigger(:on_start_battle)
|
||||||
# Generate a wild Pokémon based on the species and level
|
# Generate a wild Pokémon based on the species and level
|
||||||
pkmn = pbGenerateWildPokemon(species, level)
|
pkmn = pbGenerateWildPokemon(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||||
foeParty = [pkmn]
|
foeParty = [pkmn]
|
||||||
# Calculate who the trainers and their party are
|
# Calculate who the trainers and their party are
|
||||||
playerTrainer = [$player]
|
playerTrainer = [$player]
|
||||||
@@ -405,7 +405,7 @@ def pbBugContestBattle(species, level)
|
|||||||
# Save the result of the battle in Game Variable 1
|
# Save the result of the battle in Game Variable 1
|
||||||
BattleCreationHelperMethods.set_outcome(decision, 1)
|
BattleCreationHelperMethods.set_outcome(decision, 1)
|
||||||
# Used by the Poké Radar to update/break the chain
|
# Used by the Poké Radar to update/break the chain
|
||||||
EventHandlers.trigger(:on_wild_battle_end, species, level, decision)
|
EventHandlers.trigger(:on_wild_battle_end, pkmn.species_data.id, pkmn.level, decision)
|
||||||
# Return false if the player lost or drew the battle, and true if any other result
|
# Return false if the player lost or drew the battle, and true if any other result
|
||||||
return (decision != 2 && decision != 5)
|
return (decision != 2 && decision != 5)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -466,6 +466,11 @@ def pbDebugRoamers
|
|||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
pbUpdateSpriteHash(sprites)
|
pbUpdateSpriteHash(sprites)
|
||||||
|
if cmdwindow.index < cmdwindow.roamerCount
|
||||||
|
pkmn = Settings::ROAMING_SPECIES[cmdwindow.index]
|
||||||
|
else
|
||||||
|
pkmn = nil
|
||||||
|
end
|
||||||
if Input.trigger?(Input::ACTION) && cmdwindow.index < cmdwindow.roamerCount &&
|
if Input.trigger?(Input::ACTION) && cmdwindow.index < cmdwindow.roamerCount &&
|
||||||
(pkmn[2] <= 0 || $game_switches[pkmn[2]]) &&
|
(pkmn[2] <= 0 || $game_switches[pkmn[2]]) &&
|
||||||
$PokemonGlobal.roamPokemon[cmdwindow.index] != true
|
$PokemonGlobal.roamPokemon[cmdwindow.index] != true
|
||||||
@@ -494,7 +499,6 @@ def pbDebugRoamers
|
|||||||
if cmdwindow.index < cmdwindow.roamerCount
|
if cmdwindow.index < cmdwindow.roamerCount
|
||||||
pbPlayDecisionSE
|
pbPlayDecisionSE
|
||||||
# Toggle through roaming, not roaming, defeated
|
# Toggle through roaming, not roaming, defeated
|
||||||
pkmn = Settings::ROAMING_SPECIES[cmdwindow.index]
|
|
||||||
if pkmn[2] > 0 && !$game_switches[pkmn[2]]
|
if pkmn[2] > 0 && !$game_switches[pkmn[2]]
|
||||||
# not roaming -> roaming
|
# not roaming -> roaming
|
||||||
$game_switches[pkmn[2]] = true
|
$game_switches[pkmn[2]] = true
|
||||||
@@ -507,7 +511,7 @@ def pbDebugRoamers
|
|||||||
# defeated -> caught
|
# defeated -> caught
|
||||||
$PokemonGlobal.roamPokemonCaught[cmdwindow.index] = true
|
$PokemonGlobal.roamPokemonCaught[cmdwindow.index] = true
|
||||||
elsif pkmn[2] > 0
|
elsif pkmn[2] > 0
|
||||||
# caught -> not roaming (or roaming if Switch ID is 0
|
# caught -> not roaming (or roaming if Switch ID is 0)
|
||||||
$game_switches[pkmn[2]] = false if pkmn[2] > 0
|
$game_switches[pkmn[2]] = false if pkmn[2] > 0
|
||||||
$PokemonGlobal.roamPokemon[cmdwindow.index] = nil
|
$PokemonGlobal.roamPokemon[cmdwindow.index] = nil
|
||||||
$PokemonGlobal.roamPokemonCaught[cmdwindow.index] = false
|
$PokemonGlobal.roamPokemonCaught[cmdwindow.index] = false
|
||||||
@@ -701,7 +705,7 @@ def pbDebugFixInvalidTiles
|
|||||||
t = Time.now.to_i
|
t = Time.now.to_i
|
||||||
Graphics.update
|
Graphics.update
|
||||||
total_maps = mapData.mapinfos.keys.length
|
total_maps = mapData.mapinfos.keys.length
|
||||||
Console.echo_h1 _INTL("Checking {1} maps for invalid tiles", total_maps)
|
Console.echo_h1(_INTL("Checking {1} maps for invalid tiles", total_maps))
|
||||||
mapData.mapinfos.keys.sort.each do |id|
|
mapData.mapinfos.keys.sort.each do |id|
|
||||||
if Time.now.to_i - t >= 5
|
if Time.now.to_i - t >= 5
|
||||||
Graphics.update
|
Graphics.update
|
||||||
@@ -734,7 +738,7 @@ def pbDebugFixInvalidTiles
|
|||||||
end
|
end
|
||||||
next if map_errors == 0
|
next if map_errors == 0
|
||||||
# Map was changed; save it
|
# Map was changed; save it
|
||||||
Console.echoln_li _INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name)
|
Console.echoln_li(_INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name))
|
||||||
total_errors += map_errors
|
total_errors += map_errors
|
||||||
num_error_maps += 1
|
num_error_maps += 1
|
||||||
mapData.saveMap(id)
|
mapData.saveMap(id)
|
||||||
@@ -745,7 +749,7 @@ def pbDebugFixInvalidTiles
|
|||||||
else
|
else
|
||||||
echoln ""
|
echoln ""
|
||||||
Console.echo_h2(_INTL("Done. {1} errors found and fixed.", total_errors), text: :green)
|
Console.echo_h2(_INTL("Done. {1} errors found and fixed.", total_errors), text: :green)
|
||||||
Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")
|
Console.echo_warn(_INTL("RMXP data was altered. Close RMXP now to ensure changes are applied."))
|
||||||
echoln ""
|
echoln ""
|
||||||
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", total_errors, num_error_maps))
|
pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", total_errors, num_error_maps))
|
||||||
pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly."))
|
pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly."))
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ module FilenameUpdater
|
|||||||
def rename_berry_plant_charsets
|
def rename_berry_plant_charsets
|
||||||
src_dir = "Graphics/Characters/"
|
src_dir = "Graphics/Characters/"
|
||||||
return false if !FileTest.directory?(src_dir)
|
return false if !FileTest.directory?(src_dir)
|
||||||
Console.echo_li _INTL("Renaming berry tree charsets...")
|
Console.echo_li(_INTL("Renaming berry tree charsets..."))
|
||||||
ret = false
|
ret = false
|
||||||
# generates a list of all graphic files
|
# generates a list of all graphic files
|
||||||
files = readDirectoryFiles(src_dir, ["berrytree*.png"])
|
files = readDirectoryFiles(src_dir, ["berrytree*.png"])
|
||||||
@@ -38,7 +38,7 @@ module FilenameUpdater
|
|||||||
mapData = Compiler::MapData.new
|
mapData = Compiler::MapData.new
|
||||||
t = Time.now.to_i
|
t = Time.now.to_i
|
||||||
Graphics.update
|
Graphics.update
|
||||||
Console.echo_li _INTL("Checking {1} maps for used berry tree charsets...", mapData.mapinfos.keys.length)
|
Console.echo_li(_INTL("Checking {1} maps for used berry tree charsets...", mapData.mapinfos.keys.length))
|
||||||
idx = 0
|
idx = 0
|
||||||
mapData.mapinfos.keys.sort.each do |id|
|
mapData.mapinfos.keys.sort.each do |id|
|
||||||
echo "." if idx % 20 == 0
|
echo "." if idx % 20 == 0
|
||||||
@@ -71,19 +71,19 @@ module FilenameUpdater
|
|||||||
end
|
end
|
||||||
|
|
||||||
def rename_files
|
def rename_files
|
||||||
Console.echo_h1 "Updating file names and locations"
|
Console.echo_h1(_INTL("Updating file names and locations"))
|
||||||
change_record = []
|
change_record = []
|
||||||
# Add underscore to berry plant charsets
|
# Add underscore to berry plant charsets
|
||||||
if rename_berry_plant_charsets
|
if rename_berry_plant_charsets
|
||||||
Console.echo_warn _INTL("Berry plant charset files were renamed.")
|
Console.echo_warn(_INTL("Berry plant charset files were renamed."))
|
||||||
end
|
end
|
||||||
change_record += update_berry_tree_event_charsets
|
change_record += update_berry_tree_event_charsets
|
||||||
# Warn if any map data has been changed
|
# Warn if any map data has been changed
|
||||||
if !change_record.empty?
|
if !change_record.empty?
|
||||||
change_record.each { |msg| Console.echo_warn msg }
|
change_record.each { |msg| Console.echo_warn(msg) }
|
||||||
Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")
|
Console.echo_warn(_INTL("RMXP data was altered. Close RMXP now to ensure changes are applied."))
|
||||||
end
|
end
|
||||||
echoln ""
|
echoln ""
|
||||||
Console.echo_h2("Finished updating file names and locations", text: :green)
|
Console.echo_h2(_INTL("Finished updating file names and locations"), text: :green)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -740,12 +740,12 @@ module Compiler
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
def compile_pbs_file_message_start(filename)
|
def compile_pbs_file_message_start(filename)
|
||||||
# The `` around the file's name turns it cyan
|
# The `` around the file's name turns it cyan
|
||||||
Console.echo_li _INTL("Compiling PBS file `{1}`...", filename.split("/").last)
|
Console.echo_li(_INTL("Compiling PBS file `{1}`...", filename.split("/").last))
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_pbs_file_message_start(filename)
|
def write_pbs_file_message_start(filename)
|
||||||
# The `` around the file's name turns it cyan
|
# The `` around the file's name turns it cyan
|
||||||
Console.echo_li _INTL("Writing PBS file `{1}`...", filename.split("/").last)
|
Console.echo_li(_INTL("Writing PBS file `{1}`...", filename.split("/").last))
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_pbs_file_message_end
|
def process_pbs_file_message_end
|
||||||
@@ -780,25 +780,25 @@ module Compiler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile_all(mustCompile)
|
def compile_all(mustCompile)
|
||||||
|
Console.echo_h1(_INTL("Checking game data"))
|
||||||
if !mustCompile
|
if !mustCompile
|
||||||
Console.echo_h1(_INTL("Game did not compile data"))
|
Console.echoln_li(_INTL("Game data was not compiled"))
|
||||||
|
echoln ""
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
FileLineData.clear
|
FileLineData.clear
|
||||||
Console.echo_h1 _INTL("Compiling all data")
|
|
||||||
compile_pbs_files
|
compile_pbs_files
|
||||||
compile_animations
|
compile_animations
|
||||||
compile_trainer_events(mustCompile)
|
compile_trainer_events(mustCompile)
|
||||||
Console.echo_li _INTL("Saving messages...")
|
Console.echo_li(_INTL("Saving messages..."))
|
||||||
pbSetTextMessages
|
pbSetTextMessages
|
||||||
MessageTypes.saveMessages
|
MessageTypes.saveMessages
|
||||||
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
|
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
|
||||||
Console.echo_done(true)
|
Console.echo_done(true)
|
||||||
Console.echo_li _INTL("Reloading cache...")
|
Console.echo_li(_INTL("Reloading cache..."))
|
||||||
System.reload_cache
|
System.reload_cache
|
||||||
Console.echo_done(true)
|
Console.echo_done(true)
|
||||||
echoln ""
|
Console.echoln_li_done(_INTL("Successfully compiled all game data"))
|
||||||
Console.echo_h2("Successfully compiled all data", text: :green)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def main
|
def main
|
||||||
|
|||||||
@@ -1956,7 +1956,7 @@ module Compiler
|
|||||||
# Compile battle animations
|
# Compile battle animations
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def compile_animations
|
def compile_animations
|
||||||
Console.echo_li _INTL("Compiling animations...")
|
Console.echo_li(_INTL("Compiling animations..."))
|
||||||
begin
|
begin
|
||||||
pbanims = load_data("Data/PkmnAnimations.rxdata")
|
pbanims = load_data("Data/PkmnAnimations.rxdata")
|
||||||
rescue
|
rescue
|
||||||
|
|||||||
@@ -962,7 +962,7 @@ module Compiler
|
|||||||
# Save all data to PBS files
|
# Save all data to PBS files
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
def write_all
|
def write_all
|
||||||
Console.echo_h1 _INTL("Writing all PBS files")
|
Console.echo_h1(_INTL("Writing all PBS files"))
|
||||||
write_town_map
|
write_town_map
|
||||||
write_connections
|
write_connections
|
||||||
write_types
|
write_types
|
||||||
@@ -986,6 +986,6 @@ module Compiler
|
|||||||
write_dungeon_parameters
|
write_dungeon_parameters
|
||||||
write_phone
|
write_phone
|
||||||
echoln ""
|
echoln ""
|
||||||
Console.echo_h2("Successfully rewrote all PBS files", text: :green)
|
Console.echo_h2(_INTL("Successfully rewrote all PBS files"), text: :green)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1681,7 +1681,7 @@ module Compiler
|
|||||||
Graphics.update
|
Graphics.update
|
||||||
trainerChecker = TrainerChecker.new
|
trainerChecker = TrainerChecker.new
|
||||||
change_record = []
|
change_record = []
|
||||||
Console.echo_li _INTL("Processing {1} maps...", mapData.mapinfos.keys.length)
|
Console.echo_li(_INTL("Processing {1} maps...", mapData.mapinfos.keys.length))
|
||||||
idx = 0
|
idx = 0
|
||||||
mapData.mapinfos.keys.sort.each do |id|
|
mapData.mapinfos.keys.sort.each do |id|
|
||||||
echo "." if idx % 20 == 0
|
echo "." if idx % 20 == 0
|
||||||
@@ -1725,11 +1725,11 @@ module Compiler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
Console.echo_done(true)
|
Console.echo_done(true)
|
||||||
change_record.each { |msg| Console.echo_warn msg }
|
change_record.each { |msg| Console.echo_warn(msg) }
|
||||||
changed = false
|
changed = false
|
||||||
Graphics.update
|
Graphics.update
|
||||||
commonEvents = load_data("Data/CommonEvents.rxdata")
|
commonEvents = load_data("Data/CommonEvents.rxdata")
|
||||||
Console.echo_li _INTL("Processing common events...")
|
Console.echo_li(_INTL("Processing common events..."))
|
||||||
commonEvents.length.times do |key|
|
commonEvents.length.times do |key|
|
||||||
newevent = fix_event_use(commonEvents[key], 0, mapData)
|
newevent = fix_event_use(commonEvents[key], 0, mapData)
|
||||||
if newevent
|
if newevent
|
||||||
@@ -1740,7 +1740,7 @@ module Compiler
|
|||||||
save_data(commonEvents, "Data/CommonEvents.rxdata") if changed
|
save_data(commonEvents, "Data/CommonEvents.rxdata") if changed
|
||||||
Console.echo_done(true)
|
Console.echo_done(true)
|
||||||
if change_record.length > 0 || changed
|
if change_record.length > 0 || changed
|
||||||
Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")
|
Console.echo_warn(_INTL("RMXP data was altered. Close RMXP now to ensure changes are applied."))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ ShowArea = true
|
|||||||
MapPosition = 0,13,12
|
MapPosition = 0,13,12
|
||||||
BattleBack = field
|
BattleBack = field
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
[003] # \PN's house
|
[003] # Player's house
|
||||||
Name = \PN's house
|
Name = \PN's house
|
||||||
HealingSpot = 2,8,8
|
HealingSpot = 2,8,8
|
||||||
MapPosition = 0,13,12
|
MapPosition = 0,13,12
|
||||||
|
|||||||
Reference in New Issue
Block a user