Lots of rubocop

This commit is contained in:
Maruno17
2023-01-28 15:21:12 +00:00
parent 2d056052ce
commit 13aab8d911
159 changed files with 1679 additions and 1931 deletions
+31
View File
@@ -63,6 +63,24 @@ Naming/ClassAndModuleCamelCase:
Naming/FileName:
Enabled: false
# Disabled for sanity's sake. While this is a cop we want to obey, fixing all
# this is a gargantuan task that may never be completed, and we don't need
# rubocop telling us about the 4000+ instances of camelCase method names.
Naming/MethodName:
Enabled: false
# Disabled for sanity's sake. While this is a cop we want to obey, fixing all
# this is a gargantuan task that may never be completed, and we don't need
# rubocop telling us about the 1500+ instances of camelCase parameter names.
Naming/MethodParameterName:
Enabled: false
# Disabled for sanity's sake. While this is a cop we want to obey, fixing all
# this is a gargantuan task that may never be completed, and we don't need
# rubocop telling us about the 10000+ instances of camelCase variable names.
Naming/VariableName:
Enabled: false
#===============================================================================
# Security
#===============================================================================
@@ -85,13 +103,21 @@ Style/AccessorGrouping:
# The assign_to_condition style looks awful, indenting loads of lines and
# increasing the separation between variable and value being assigned to it.
# Having said that, using "assign_inside_condition" flags every instance of
# conditional assignment using a one-line ternary operator, so this cop has been
# disabled because such assignment is fine.
Style/ConditionalAssignment:
Enabled: false
EnforcedStyle: assign_inside_condition
# Check with yard instead.
Style/Documentation:
Enabled: false
# This is just shorthand that looks bad due to the lack of an "end" to a "def".
Style/EndlessMethod:
EnforcedStyle: disallow
# It's a choice between format and sprintf. We already make use of sprintf and
# the translatable _ISPRINTF, so...
Style/FormatString:
@@ -110,6 +136,11 @@ Style/GlobalVars:
Style/HashSyntax:
EnforcedStyle: no_mixed_keys
# Sometimes you want to clearly separate sets of code, one per "paradigm".
Style/IfInsideElse:
Enabled: false
AllowIfModifier: true
# The alernative is ->(x) { x } which is less English than "lambda". This style
# makes lambda definitions require the word "lambda".
Style/Lambda:
@@ -45,7 +45,7 @@ class Dir
# get path tree
dirs = path.split("/")
full = ""
for dir in dirs
dirs.each do |dir|
full += dir + "/"
# creates directories
self.mkdir(full) if !self.safe?(full)
@@ -56,7 +56,7 @@ class Dir
def self.all_dirs(dir)
# sets variables for starting
dirs = []
for file in self.get(dir, "*", true)
self.get(dir, "*", true).each do |file|
# engages in recursion to read the entire folder tree
dirs += self.all_dirs(file) if self.safe?(file)
end
@@ -86,7 +86,6 @@ class File
# Checks for existing .rxdata file
def self.safeData?(file)
ret = false
ret = (load_data(file) ? true : false) rescue false
return ret
end
@@ -121,10 +120,10 @@ def safeGlob(dir, wildcard)
ret = []
afterChdir = false
begin
Dir.chdir(dir) {
Dir.chdir(dir) do
afterChdir = true
Dir.glob(wildcard) { |f| ret.push(dir + "/" + f) }
}
end
rescue Errno::ENOENT
raise if afterChdir
end
@@ -152,13 +151,13 @@ def pbResolveBitmap(x)
# filename = pbTryString(path) if !filename
# filename = pbTryString(path + ".gif") if !filename
# }
RTP.eachPathFor(noext) { |path|
RTP.eachPathFor(noext) do |path|
filename = pbTryString(path + ".png") if !filename
filename = pbTryString(path + ".gif") if !filename
# filename = pbTryString(path + ".jpg") if !filename
# filename = pbTryString(path + ".jpeg") if !filename
# filename = pbTryString(path + ".bmp") if !filename
}
end
return filename
end
@@ -211,12 +210,12 @@ module RTP
def self.exists?(filename, extensions = [])
return false if nil_or_empty?(filename)
eachPathFor(filename) { |path|
eachPathFor(filename) do |path|
return true if safeExists?(path)
extensions.each do |ext|
return true if safeExists?(path + ext)
end
}
end
return false
end
@@ -230,13 +229,13 @@ module RTP
def self.getPath(filename, extensions = [])
return filename if nil_or_empty?(filename)
eachPathFor(filename) { |path|
eachPathFor(filename) do |path|
return path if safeExists?(path)
extensions.each do |ext|
file = path + ext
return file if safeExists?(file)
end
}
end
return filename
end
@@ -248,13 +247,13 @@ module RTP
yield filename
else
# relative path
RTP.eachPath { |path|
RTP.eachPath do |path|
if path == "./"
yield filename
else
yield path + filename
end
}
end
end
end
@@ -308,7 +307,7 @@ end
# NOTE: pbGetFileChar checks anything added in MKXP's RTP setting, and matching
# mount points added through System.mount.
def pbRgssExists?(filename)
return pbGetFileChar(filename) != nil if safeExists?("./Game.rgssad")
return !pbGetFileChar(filename).nil? if safeExists?("./Game.rgssad")
filename = canonicalize(filename)
return safeExists?(filename)
end
@@ -109,22 +109,21 @@ module FileOutputMixin
end
class File < IO
=begin
unless defined?(debugopen)
class << self
alias debugopen open
end
end
# unless defined?(debugopen)
# class << self
# alias debugopen open
# end
# end
# def open(f, m = "r")
# debugopen("debug.txt", "ab") { |file| file.write([f, m, Time.now.to_f].inspect + "\r\n") }
# if block_given?
# debugopen(f, m) { |file| yield file }
# else
# return debugopen(f, m)
# end
# end
def open(f, m = "r")
debugopen("debug.txt", "ab") { |file| file.write([f, m, Time.now.to_f].inspect + "\r\n") }
if block_given?
debugopen(f, m) { |file| yield file }
else
return debugopen(f, m)
end
end
=end
include FileInputMixin
include FileOutputMixin
end
@@ -9,13 +9,13 @@ def pbPostData(url, postdata, filename = nil, depth = 0)
# path = $2
# path = "/" if path.length == 0
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|
body = postdata.map do |key, value|
keyString = key.to_s
valueString = value.to_s
keyString.gsub!(/[^a-zA-Z0-9_\.\-]/n) { |s| sprintf("%%%02x", s[0]) }
valueString.gsub!(/[^a-zA-Z0-9_\.\-]/n) { |s| sprintf("%%%02x", s[0]) }
next "#{keyString}=#{valueString}"
}.join("&")
end.join("&")
ret = HTTPLite.post_body(
url,
body,
@@ -169,23 +169,25 @@ class Color
# New constructor, accepts RGB values as well as a hex number or string value.
def initialize(*args)
pbPrintException("Wrong number of arguments! At least 1 is needed!") if args.length < 1
if args.length == 1
if args.first.is_a?(Fixnum)
case args.length
when 1
case args.first
when Integer
hex = args.first.to_s(16)
elsif args.first.is_a?(String)
when String
try_rgb_format = args.first.split(",")
return init_original(*try_rgb_format.map(&:to_i)) if try_rgb_format.length.between?(3, 4)
init_original(*try_rgb_format.map(&:to_i)) if try_rgb_format.length.between?(3, 4)
hex = args.first.delete("#")
end
pbPrintException("Wrong type of argument given!") if !hex
r = hex[0...2].to_i(16)
g = hex[2...4].to_i(16)
b = hex[4...6].to_i(16)
elsif args.length == 3
when 3
r, g, b = *args
end
return init_original(r, g, b) if r && g && b
return init_original(*args)
init_original(r, g, b) if r && g && b
init_original(*args)
end
def self.new_from_rgb(param)
@@ -242,7 +244,9 @@ class Color
# @return [String] this color in the format "RRGGBBAA" (or "RRGGBB" if this color's alpha is 255)
def to_rgb32(always_include_alpha = false)
return sprintf("%02X%02X%02X", self.red.to_i, self.green.to_i, self.blue.to_i) if self.alpha.to_i == 255 && !always_include_alpha
if self.alpha.to_i == 255 && !always_include_alpha
return sprintf("%02X%02X%02X", self.red.to_i, self.green.to_i, self.blue.to_i)
end
return sprintf("%02X%02X%02X%02X", self.red.to_i, self.green.to_i, self.blue.to_i, self.alpha.to_i)
end
+73 -75
View File
@@ -45,7 +45,7 @@ module Translator
end
end
end
MessageTypes.addMessagesAsHash(MessageTypes::ScriptTexts, texts)
MessageTypes.addMessagesAsHash(MessageTypes::SCRIPT_TEXTS, texts)
# Find all text in common events and add them to messages
commonevents = load_data("Data/CommonEvents.rxdata")
items = []
@@ -87,7 +87,7 @@ module Translator
elsif list.code == 209 # Set Move Route
route = list.parameters[1]
route.list.size.times do |k|
if route.list[k].code == PBMoveRoute::Script
if route.list[k].code == PBMoveRoute::SCRIPT
find_translatable_text_from_event_script(items, route.list[k].parameters[0])
end
end
@@ -157,7 +157,7 @@ module Translator
elsif list.code == 209 # Set Move Route
route = list.parameters[1]
route.list.size.times do |k|
if route.list[k].code == PBMoveRoute::Script
if route.list[k].code == PBMoveRoute::SCRIPT
find_translatable_text_from_event_script(items, route.list[k].parameters[0])
end
end
@@ -190,7 +190,7 @@ module Translator
def find_translatable_text_from_RGSS_script(items, script)
script.force_encoding(Encoding::UTF_8)
script.scan(/(?:_INTL|_ISPRINTF)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/) { |s|
script.scan(/(?:_INTL|_ISPRINTF)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/) do |s|
string = s[0]
string.gsub!(/\\r/, "\r")
string.gsub!(/\\n/, "\n")
@@ -198,17 +198,17 @@ module Translator
string.gsub!(/\\\"/, "\"")
string.gsub!(/\\\\/, "\\")
items.push(string)
}
end
end
def find_translatable_text_from_event_script(items, script)
script.force_encoding(Encoding::UTF_8)
script.scan(/(?:_I)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/) { |s|
script.scan(/(?:_I)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/) do |s|
string = s[0]
string.gsub!(/\\\"/, "\"")
string.gsub!(/\\\\/, "\\")
items.push(string)
}
end
end
def normalize_value(value)
@@ -239,7 +239,7 @@ module Translator
return value
end
#=============================================================================
#-----------------------------------------------------------------------------
def extract_text(language_name = "default", core_text = false, separate_map_files = false)
dir_name = sprintf("Text_%s_%s", language_name, (core_text) ? "core" : "game")
@@ -296,18 +296,18 @@ module Translator
max_section_id.times do |i|
section_name = getConstantName(MessageTypes, i, false)
next if !section_name
if i == MessageTypes::EventTexts
if i == MessageTypes::EVENT_TEXTS
if separate_map_files
map_infos = pbLoadMapInfos
default_messages[i].each_with_index do |map_msgs, map_id|
next if !map_msgs || map_msgs.length == 0
filename = sprintf("Map%03d", map_id)
filename += " " + map_infos[map_id].name if map_infos[map_id]
File.open(dir_name + "/" + filename + ".txt", "wb") { |f|
File.open(dir_name + "/" + filename + ".txt", "wb") do |f|
write_header.call(f, true)
translated_msgs = language_messages[i][map_id] if language_messages && language_messages[i]
write_section_texts_to_file(f, sprintf("Map%03d", map_id), translated_msgs, map_msgs)
}
end
end
else
next if !default_messages[i] || default_messages[i].length == 0
@@ -317,7 +317,7 @@ module Translator
break if !map_msgs
end
next if no_difference
File.open(dir_name + "/" + section_name + ".txt", "wb") { |f|
File.open(dir_name + "/" + section_name + ".txt", "wb") do |f|
write_header.call(f, false)
default_messages[i].each_with_index do |map_msgs, map_id|
next if !map_msgs || map_msgs.length == 0
@@ -325,15 +325,15 @@ module Translator
translated_msgs = (language_messages && language_messages[i]) ? language_messages[i][map_id] : nil
write_section_texts_to_file(f, sprintf("Map%03d", map_id), translated_msgs, map_msgs)
end
}
end
end
else # MessageTypes sections
next if !default_messages[i] || default_messages[i].length == 0
File.open(dir_name + "/" + section_name + ".txt", "wb") { |f|
File.open(dir_name + "/" + section_name + ".txt", "wb") do |f|
write_header.call(f, true)
translated_msgs = (language_messages) ? language_messages[i] : nil
write_section_texts_to_file(f, section_name, translated_msgs, default_messages[i])
}
end
end
end
msg_window.textspeed = MessageConfig.pbSettingToTextSpeed($PokemonSystem.textspeed)
@@ -371,7 +371,7 @@ module Translator
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def compile_text(dir_name, dat_filename)
msg_window = pbCreateMessageWindow
@@ -452,16 +452,16 @@ module Translator
break if i >= contents.length
end
# Add ordered list/hash (text_hash) to array of all text (all_text)
all_text[MessageTypes::EventTexts] = [] if is_map && !all_text[MessageTypes::EventTexts]
target_section = (is_map) ? all_text[MessageTypes::EventTexts][section_id] : all_text[section_id]
all_text[MessageTypes::EVENT_TEXTS] = [] if is_map && !all_text[MessageTypes::EVENT_TEXTS]
target_section = (is_map) ? all_text[MessageTypes::EVENT_TEXTS][section_id] : all_text[section_id]
if target_section
if text_hash.is_a?(Hash)
text_hash.keys.each { |key| target_section[key] = text_hash[key] if text_hash[key] }
text_hash.each_key { |key| target_section[key] = text_hash[key] if text_hash[key] }
else # text_hash is an array
text_hash.each_with_index { |line, i| target_section[i] = line if line }
text_hash.each_with_index { |line, j| target_section[j] = line if line }
end
elsif is_map
all_text[MessageTypes::EventTexts][section_id] = text_hash
all_text[MessageTypes::EVENT_TEXTS][section_id] = text_hash
else
all_text[section_id] = text_hash
end
@@ -570,16 +570,16 @@ class Translation
def setMapMessagesAsHash(map_id, array)
load_default_messages
@default_game_messages[MessageTypes::EventTexts] ||= []
@default_game_messages[MessageTypes::EventTexts][map_id] = priv_add_to_hash(MessageTypes::EventTexts,
@default_game_messages[MessageTypes::EVENT_TEXTS] ||= []
@default_game_messages[MessageTypes::EVENT_TEXTS][map_id] = priv_add_to_hash(MessageTypes::EVENT_TEXTS,
array, nil, map_id)
end
def addMapMessagesAsHash(map_id, array)
load_default_messages
@default_game_messages[MessageTypes::EventTexts] ||= []
@default_game_messages[MessageTypes::EventTexts][map_id] = priv_add_to_hash(MessageTypes::EventTexts,
array, @default_game_messages[MessageTypes::EventTexts][map_id], map_id)
@default_game_messages[MessageTypes::EVENT_TEXTS] ||= []
@default_game_messages[MessageTypes::EVENT_TEXTS][map_id] = priv_add_to_hash(MessageTypes::EVENT_TEXTS,
array, @default_game_messages[MessageTypes::EVENT_TEXTS][map_id], map_id)
end
def get(type, id)
@@ -610,23 +610,25 @@ class Translation
delayed_load_message_files
key = Translation.stringToKey(text)
return text if nil_or_empty?(key)
if @game_messages && @game_messages[MessageTypes::EventTexts]
if @game_messages[MessageTypes::EventTexts][map_id] && @game_messages[MessageTypes::EventTexts][map_id][key]
return @game_messages[MessageTypes::EventTexts][map_id][key]
elsif @game_messages[MessageTypes::EventTexts][0] && @game_messages[MessageTypes::EventTexts][0][key]
return @game_messages[MessageTypes::EventTexts][0][key]
if @game_messages && @game_messages[MessageTypes::EVENT_TEXTS]
if @game_messages[MessageTypes::EVENT_TEXTS][map_id] && @game_messages[MessageTypes::EVENT_TEXTS][map_id][key]
return @game_messages[MessageTypes::EVENT_TEXTS][map_id][key]
elsif @game_messages[MessageTypes::EVENT_TEXTS][0] && @game_messages[MessageTypes::EVENT_TEXTS][0][key]
return @game_messages[MessageTypes::EVENT_TEXTS][0][key]
end
end
if @core_messages && @core_messages[MessageTypes::EventTexts]
if @core_messages[MessageTypes::EventTexts][map_id] && @core_messages[MessageTypes::EventTexts][map_id][key]
return @core_messages[MessageTypes::EventTexts][map_id][key]
elsif @core_messages[MessageTypes::EventTexts][0] && @core_messages[MessageTypes::EventTexts][0][key]
return @core_messages[MessageTypes::EventTexts][0][key]
if @core_messages && @core_messages[MessageTypes::EVENT_TEXTS]
if @core_messages[MessageTypes::EVENT_TEXTS][map_id] && @core_messages[MessageTypes::EVENT_TEXTS][map_id][key]
return @core_messages[MessageTypes::EVENT_TEXTS][map_id][key]
elsif @core_messages[MessageTypes::EVENT_TEXTS][0] && @core_messages[MessageTypes::EVENT_TEXTS][0][key]
return @core_messages[MessageTypes::EVENT_TEXTS][0][key]
end
end
return text
end
#-----------------------------------------------------------------------------
private
def delayed_load_message_files
@@ -645,7 +647,7 @@ class Translation
end
def priv_add_to_hash(type, array, ret, map_id = 0)
if type == MessageTypes::EventTexts
if type == MessageTypes::EVENT_TEXTS
@default_core_messages[type] ||= []
@default_core_messages[type][map_id] ||= {}
default_keys = @default_core_messages[type][map_id].keys
@@ -670,36 +672,36 @@ module MessageTypes
# NOTE: These constants aren't numbered in any particular order, but these
# numbers are retained for backwards compatibility with older extracted
# text files.
EventTexts = 0 # Used for text in both common events and map events
Species = 1
SpeciesCategories = 2
PokedexEntries = 3
SpeciesForms = 4
Moves = 5
MoveDescriptions = 6
Items = 7
ItemPlurals = 8
ItemDescriptions = 9
Abilities = 10
AbilityDescriptions = 11
Types = 12
TrainerTypes = 13
TrainerNames = 14
FrontierIntroSpeeches = 15
FrontierEndSpeechesWin = 16
FrontierEndSpeechesLose = 17
Regions = 18
RegionLocations = 19
RegionDescriptions = 20
MapNames = 21
PhoneMessages = 22
TrainerLoseTexts = 23
ScriptTexts = 24
RibbonNames = 25
RibbonDescriptions = 26
StorageCreator = 27
ItemPortions = 28
ItemPortionPlurals = 29
EVENT_TEXTS = 0 # Used for text in both common events and map events
SPECIES_NAMES = 1
SPECIES_CATEGORIES = 2
POKEDEX_ENTRIES = 3
SPECIES_FORM_NAMES = 4
MOVE_NAMES = 5
MOVE_DESCRIPTIONS = 6
ITEM_NAMES = 7
ITEM_NAME_PLURALS = 8
ITEM_DESCRIPTIONS = 9
ABILITY_NAMES = 10
ABILITY_DESCRIPTIONS = 11
TYPE_NAMES = 12
TRAINER_TYPE_NAMES = 13
TRAINER_NAMES = 14
FRONTIER_INTRO_SPEECHES = 15
FRONTIER_END_SPEECHES_WIN = 16
FRONTIER_END_SPEECHES_LOSE = 17
REGION_NAMES = 18
REGION_LOCATION_NAMES = 19
REGION_LOCATION_DESCRIPTIONS = 20
MAP_NAMES = 21
PHONE_MESSAGES = 22
TRAINER_SPEECHES_LOSE = 23
SCRIPT_TEXTS = 24
RIBBON_NAMES = 25
RIBBON_DESCRIPTIONS = 26
STORAGE_CREATOR_NAME = 27
ITEM_PORTION_NAMES = 28
ITEM_PORTION_NAME_PLURALS = 29
@@messages = Translation.new
def self.load_default_messages
@@ -766,7 +768,7 @@ end
# parameters by replacing {1}, {2}, etc. with those placeholders.
def _INTL(*arg)
begin
string = MessageTypes.getFromHash(MessageTypes::ScriptTexts, arg[0])
string = MessageTypes.getFromHash(MessageTypes::SCRIPT_TEXTS, arg[0])
rescue
string = arg[0]
end
@@ -782,15 +784,13 @@ end
# This version acts more like sprintf, supports e.g. {1:d} or {2:s}
def _ISPRINTF(*arg)
begin
string = MessageTypes.getFromHash(MessageTypes::ScriptTexts, arg[0])
string = MessageTypes.getFromHash(MessageTypes::SCRIPT_TEXTS, arg[0])
rescue
string = arg[0]
end
string = string.clone
(1...arg.length).each do |i|
string.gsub!(/\{#{i}\:([^\}]+?)\}/) { |m|
next sprintf("%" + $1, arg[i])
}
string.gsub!(/\{#{i}\:([^\}]+?)\}/) { |m| next sprintf("%" + $1, arg[i]) }
end
return string
end
@@ -812,9 +812,7 @@ def _MAPISPRINTF(mapid, *arg)
string = MessageTypes.getFromMapHash(mapid, arg[0])
string = string.clone
(1...arg.length).each do |i|
string.gsub!(/\{#{i}\:([^\}]+?)\}/) { |m|
next sprintf("%" + $1, arg[i])
}
string.gsub!(/\{#{i}\:([^\}]+?)\}/) { |m| next sprintf("%" + $1, arg[i]) }
end
return string
end
+1 -3
View File
@@ -16,9 +16,7 @@ module Input
def self.update
update_KGC_ScreenCapture
if trigger?(Input::F8)
pbScreenCapture
end
pbScreenCapture if trigger?(Input::F8)
end
end
@@ -136,9 +136,7 @@ module PluginManager
end
name = value
when :version # Plugin version
if nil_or_empty?(value)
self.error("Plugin version must be a string.")
end
self.error("Plugin version must be a string.") if nil_or_empty?(value)
version = value
when :essentials
essentials = value
@@ -412,7 +410,7 @@ module PluginManager
filename = "#{dir}/#{file}"
meta = {}
# read file
Compiler.pbCompilerEachPreppedLine(filename) { |line, line_no|
Compiler.pbCompilerEachPreppedLine(filename) do |line, line_no|
# split line up into property name and values
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
raise _INTL("Bad line syntax (expected syntax like XXX=YYY)\r\n{1}", FileLineData.linereport)
@@ -456,7 +454,7 @@ module PluginManager
else
meta[property.downcase.to_sym] = data[0]
end
}
end
# generate a list of all script files to be loaded, in the order they are to
# be loaded (files listed in the meta file are loaded first)
meta[:scripts] = [] if !meta[:scripts]
+6 -18
View File
@@ -56,9 +56,7 @@ class SpriteAnimation
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
@@_animations.push(animation) unless @@_animations.include?(animation)
end
update_animation
end
@@ -97,13 +95,9 @@ class SpriteAnimation
sprite = @_animation_sprites[0]
if sprite
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
@_animation_sprites.each do |sprite|
sprite.dispose
sprite.bitmap.dispose if @@_reference_count[sprite.bitmap] == 0
end
@_animation_sprites.each { |s| s.dispose }
@_animation_sprites = nil
@_animation = nil
end
@@ -113,13 +107,9 @@ class SpriteAnimation
sprite = @_loop_animation_sprites[0]
if sprite
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
@_loop_animation_sprites.each do |sprite|
sprite.dispose
sprite.bitmap.dispose if @@_reference_count[sprite.bitmap] == 0
end
@_loop_animation_sprites.each { |s| s.dispose }
@_loop_animation_sprites = nil
@_loop_animation = nil
end
@@ -469,9 +459,7 @@ module RPG
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - ((12 - @_damage_duration) * 32)
if @_damage_duration == 0
dispose_damage
end
dispose_damage if @_damage_duration == 0
end
@animations.each do |a|
a.update
@@ -99,6 +99,8 @@ module SaveData
return @old_format_get_proc.call(old_format)
end
#---------------------------------------------------------------------------
private
# Raises an {InvalidValueError} if the given value is invalid.
@@ -71,6 +71,8 @@ module SaveData
@value_procs[key].call(object) if @value_procs[key].is_a?(Proc)
end
#---------------------------------------------------------------------------
private
# @!group Configuration
@@ -4,11 +4,7 @@ SaveData.register(:player) do
ensure_class :Player
save_value { $player }
load_value { |value| $player = $Trainer = value }
new_game_value {
# Get the first defined trainer type as a placeholder
trainer_type = GameData::TrainerType.keys.first
Player.new("Unnamed", trainer_type)
}
new_game_value { Player.new("Unnamed", GameData::TrainerType.keys.first) }
from_old_format { |old_format| old_format[0] }
end
@@ -75,9 +75,7 @@ module Game
$game_map = $map_factory.map
magic_number_matches = ($game_system.magic_number == $data_system.magic_number)
if !magic_number_matches || $PokemonGlobal.safesave
if pbMapInterpreterRunning?
pbMapInterpreter.setup(nil, 0)
end
pbMapInterpreter.setup(nil, 0) if pbMapInterpreterRunning?
begin
$map_factory.setup($game_map.map_id)
rescue Errno::ENOENT
@@ -197,9 +197,7 @@ class Scene_Map
$game_temp.menu_beep = true
end
elsif Input.trigger?(Input::SPECIAL)
unless $game_player.moving?
$game_temp.ready_menu_calling = true
end
$game_temp.ready_menu_calling = true if !$game_player.moving?
elsif Input.press?(Input::F9)
$game_temp.debug_calling = true if $DEBUG
end
@@ -143,13 +143,13 @@ class Interpreter
message = pbGetExceptionMessage(e)
backtrace_text = ""
if e.is_a?(SyntaxError)
script.each_line { |line|
script.each_line do |line|
line.gsub!(/\s+$/, "")
if line[/^\s*\(/]
message += "\r\n***Line '#{line}' shouldn't begin with '('. Try putting the '('\r\n"
message += "at the end of the previous line instead, or using 'extendtext.exe'."
end
}
end
else
backtrace_text += "\r\n"
backtrace_text += "Backtrace:"
@@ -1081,14 +1081,14 @@ class Interpreter
end
if $game_actors && $data_actors && $data_actors[@parameters[0]]
$game_temp.battle_abort = true
pbFadeOutIn {
pbFadeOutIn do
sscene = PokemonEntryScene.new
sscreen = PokemonEntry.new(sscene)
$game_actors[@parameters[0]].name = sscreen.pbStartScreen(
_INTL("Enter {1}'s name.", $game_actors[@parameters[0]].name),
1, @parameters[1], $game_actors[@parameters[0]].name
)
}
end
end
return true
end
@@ -40,9 +40,7 @@ class Game_Screen
def start_tone_change(tone, duration)
@tone_target = tone.clone
@tone_duration = duration
if @tone_duration == 0
@tone = @tone_target.clone
end
@tone = @tone_target.clone if @tone_duration == 0
end
def start_flash(color, duration)
@@ -103,9 +103,7 @@ class Game_Picture
def start_tone_change(tone, duration)
@tone_target = tone.clone
@tone_duration = duration
if @tone_duration == 0
@tone = @tone_target.clone
end
@tone = @tone_target.clone if @tone_duration == 0
end
# Erase Picture
@@ -371,17 +371,13 @@ class Game_Map
def start_fog_tone_change(tone, duration)
@fog_tone_target = tone.clone
@fog_tone_duration = duration
if @fog_tone_duration == 0
@fog_tone = @fog_tone_target.clone
end
@fog_tone = @fog_tone_target.clone if @fog_tone_duration == 0
end
def start_fog_opacity_change(opacity, duration)
@fog_opacity_target = opacity.to_f
@fog_opacity_duration = duration
if @fog_opacity_duration == 0
@fog_opacity = @fog_opacity_target
end
@fog_opacity = @fog_opacity_target if @fog_opacity_duration == 0
end
def set_tile(x, y, layer, id = 0)
@@ -5,69 +5,68 @@
# Version 1.02
# 2005-12-18
#===============================================================================
=begin
This script supplements the built-in "Scroll Map" event command with the
aim of simplifying cutscenes (and map scrolling in general). Whereas the
normal event command requires a direction and number of tiles to scroll,
Map Autoscroll scrolls the map to center on the tile whose x and y
coordinates are given.
FEATURES
- automatic map scrolling to given x,y coordinate (or player)
- destination is fixed, so it's possible to scroll to same place even if
origin is variable (e.g. moving NPC)
- variable speed (just like "Scroll Map" event command)
- diagonal scrolling supported
SETUP
Instead of a "Scroll Map" event command, use the "Call Script" command
and enter on the following on the first line:
autoscroll(x,y)
(replacing "x" and "y" with the x and y coordinates of the tile to scroll to)
To specify a scroll speed other than the default (4), use:
autoscroll(x,y,speed)
(now also replacing "speed" with the scroll speed from 1-6)
Diagonal scrolling happens automatically when the destination is diagonal
relative to the starting point (i.e., not directly up, down, left or right).
To scroll to the player, instead use the following:
autoscroll_player(speed)
Note: because of how the interpreter and the "Call Script" event command
are setup, the call to autoscroll(...) can only be on the first line of
the "Call Script" event command (and not flowing down to subsequent lines).
For example, the following call may not work as expected:
autoscroll($game_variables[1],
$game_variables[2])
(since the long argument names require dropping down to a second line)
A work-around is to setup new variables with shorter names in a preceding
(separate) "Call Script" event command:
@x = $game_variables[1]
@y = $game_variables[2]
and then use those as arguments:
autoscroll(@x,@y)
The renaming must be in a separate "Call Script" because otherwise
the call to autoscroll(...) isn't on the first line.
Originally requested by militantmilo80:
http://www.rmxp.net/forums/index.php?showtopic=29519
=end
#
# This script supplements the built-in "Scroll Map" event command with the
# aim of simplifying cutscenes (and map scrolling in general). Whereas the
# normal event command requires a direction and number of tiles to scroll,
# Map Autoscroll scrolls the map to center on the tile whose x and y
# coordinates are given.
#
# FEATURES
# - automatic map scrolling to given x,y coordinate (or player)
# - destination is fixed, so it's possible to scroll to same place even if
# origin is variable (e.g. moving NPC)
# - variable speed (just like "Scroll Map" event command)
# - diagonal scrolling supported
#
# SETUP
# Instead of a "Scroll Map" event command, use the "Call Script" command
# and enter on the following on the first line:
#
# autoscroll(x,y)
#
# (replacing "x" and "y" with the x and y coordinates of the tile to scroll to)
#
# To specify a scroll speed other than the default (4), use:
#
# autoscroll(x,y,speed)
#
# (now also replacing "speed" with the scroll speed from 1-6)
#
# Diagonal scrolling happens automatically when the destination is diagonal
# relative to the starting point (i.e., not directly up, down, left or right).
#
# To scroll to the player, instead use the following:
#
# autoscroll_player(speed)
#
# Note: because of how the interpreter and the "Call Script" event command
# are setup, the call to autoscroll(...) can only be on the first line of
# the "Call Script" event command (and not flowing down to subsequent lines).
#
# For example, the following call may not work as expected:
#
# autoscroll($game_variables[1],
# $game_variables[2])
#
# (since the long argument names require dropping down to a second line)
# A work-around is to setup new variables with shorter names in a preceding
# (separate) "Call Script" event command:
#
# @x = $game_variables[1]
# @y = $game_variables[2]
#
# and then use those as arguments:
#
# autoscroll(@x,@y)
#
# The renaming must be in a separate "Call Script" because otherwise
# the call to autoscroll(...) isn't on the first line.
#
# Originally requested by militantmilo80:
# http://www.rmxp.net/forums/index.php?showtopic=29519
#
#===============================================================================
#===============================================================================
#
@@ -433,9 +433,9 @@ module MapFactoryHelper
end
def self.mapsConnected?(id1, id2)
MapFactoryHelper.eachConnectionForMap(id1) { |conn|
MapFactoryHelper.eachConnectionForMap(id1) do |conn|
return true if conn[0] == id2 || conn[3] == id2
}
end
return false
end
@@ -237,9 +237,7 @@ class Game_Event < Game_Character
@trigger = @page.trigger
@list = @page.list
@interpreter = nil
if @trigger == 4 # Parallel Process
@interpreter = Interpreter.new
end
@interpreter = Interpreter.new if @trigger == 4 # Parallel Process
check_event_trigger_auto
end
@@ -262,18 +260,14 @@ class Game_Event < Game_Character
@moveto_happened = false
last_moving = moving?
super
if !moving? && last_moving
$game_player.pbCheckEventTriggerFromDistance([2])
end
$game_player.pbCheckEventTriggerFromDistance([2]) if !moving? && last_moving
if @need_refresh
@need_refresh = false
refresh
end
check_event_trigger_auto
if @interpreter
unless @interpreter.running?
@interpreter.setup(@list, @event.id, @map_id)
end
@interpreter.setup(@list, @event.id, @map_id) if !@interpreter.running?
@interpreter.update
end
end
@@ -40,9 +40,7 @@ class Game_CommonEvent
def refresh
# Create an interpreter for parallel process if necessary
if self.trigger == 2 && switchIsOn?(self.switch_id)
if @interpreter.nil?
@interpreter = Interpreter.new
end
@interpreter = Interpreter.new if @interpreter.nil?
else
@interpreter = nil
end
@@ -27,7 +27,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def move_through(direction)
old_through = @through
@@ -105,7 +105,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def turn_towards_leader(leader)
pbTurnTowardEvent(self, leader)
@@ -146,7 +146,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def update_move
was_jumping = jumping?
@@ -157,7 +157,7 @@ class Game_Follower < Game_Event
end
end
#=============================================================================
#-----------------------------------------------------------------------------
private
@@ -84,7 +84,7 @@ class Game_FollowerFactory
@last_update = -1
end
#=============================================================================
#-----------------------------------------------------------------------------
def add_follower(event, name = nil, common_event_id = nil)
return if !event
@@ -150,7 +150,7 @@ class Game_FollowerFactory
$PokemonGlobal.followers.each_with_index { |follower, i| yield @events[i], follower }
end
#=============================================================================
#-----------------------------------------------------------------------------
def turn_followers
leader = $game_player
@@ -208,11 +208,11 @@ class Game_FollowerFactory
vector = $map_factory.getRelativePos(event.map.map_id, event.x, event.y,
leader[0], leader[1], leader[2])
if vector[0] != 0
move_route.prepend((vector[0] > 0) ? PBMoveRoute::Right : PBMoveRoute::Left)
move_route.prepend((vector[0] > 0) ? PBMoveRoute::RIGHT : PBMoveRoute::LEFT)
elsif vector[1] != 0
move_route.prepend((vector[1] > 0) ? PBMoveRoute::Down : PBMoveRoute::Up)
move_route.prepend((vector[1] > 0) ? PBMoveRoute::DOWN : PBMoveRoute::UP)
end
pbMoveRoute(event, move_route + [PBMoveRoute::Opacity, 0])
pbMoveRoute(event, move_route + [PBMoveRoute::OPACITY, 0])
end
end
@@ -237,7 +237,7 @@ class Game_FollowerFactory
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def update
followers = $PokemonGlobal.followers
@@ -286,7 +286,7 @@ class Game_FollowerFactory
end
end
#=============================================================================
#-----------------------------------------------------------------------------
private
@@ -48,15 +48,15 @@ class Sprite_Reflection
# Just-in-time creation of sprite
@sprite = Sprite.new(@viewport) if !@sprite
if @sprite
x = @rsprite.x - @rsprite.ox * TilemapRenderer::ZOOM_X
y = @rsprite.y - @rsprite.oy * TilemapRenderer::ZOOM_Y
x = @rsprite.x - (@rsprite.ox * TilemapRenderer::ZOOM_X)
y = @rsprite.y - (@rsprite.oy * TilemapRenderer::ZOOM_Y)
y -= Game_Map::TILE_HEIGHT * TilemapRenderer::ZOOM_Y if @rsprite.character.character_name[/offset/i]
@height = $PokemonGlobal.bridge if !@fixedheight
y += @height * TilemapRenderer::ZOOM_Y * Game_Map::TILE_HEIGHT / 2
width = @rsprite.src_rect.width
height = @rsprite.src_rect.height
@sprite.x = x + (width / 2) * TilemapRenderer::ZOOM_X
@sprite.y = y + (height + (height / 2)) * TilemapRenderer::ZOOM_Y
@sprite.x = x + ((width / 2) * TilemapRenderer::ZOOM_X)
@sprite.y = y + ((height + (height / 2)) * TilemapRenderer::ZOOM_Y)
@sprite.ox = width / 2
@sprite.oy = (height / 2) - 2 # Hard-coded 2 pixel shift up
@sprite.oy -= @rsprite.character.bob_height * 2
@@ -184,9 +184,7 @@ class TilemapRenderer
end
def current_frame(filename)
if !@current_frames[filename]
set_current_frame(filename)
end
set_current_frame(filename) if !@current_frames[filename]
return @current_frames[filename]
end
@@ -56,6 +56,8 @@ class TilemapRenderer
return ret
end
#---------------------------------------------------------------------------
private
def blitWrappedPixels(destX, destY, dest, src, srcrect)
@@ -11,7 +11,7 @@ module RPG
def self.debug
t = Time.now
filename = t.strftime("%H %M %S.%L.txt")
File.open("cache_" + filename, "wb") { |f|
File.open("cache_" + filename, "wb") do |f|
@cache.each do |key, value|
if !value
f.write("#{key} (nil)\r\n")
@@ -21,7 +21,7 @@ module RPG
f.write("#{key} (#{value.refcount}, #{value.width}x#{value.height})\r\n")
end
end
}
end
end
def self.setKey(key, obj)
@@ -208,9 +208,7 @@ def pbPositionNearMsgWindow(cmdwindow, msgwindow, side)
return if !cmdwindow
if msgwindow
height = [cmdwindow.height, Graphics.height - msgwindow.height].min
if cmdwindow.height != height
cmdwindow.height = height
end
cmdwindow.height = height if cmdwindow.height != height
cmdwindow.y = msgwindow.y - cmdwindow.height
if cmdwindow.y < 0
cmdwindow.y = msgwindow.y + msgwindow.height
@@ -257,9 +255,7 @@ def pbUpdateMsgWindowPos(msgwindow, event, eventChanged = false)
msgwindow.resizeToFit2(msgwindow.text, Graphics.width * 2 / 3, msgwindow.height)
end
msgwindow.y = event.screen_y - 48 - msgwindow.height
if msgwindow.y < 0
msgwindow.y = event.screen_y + 24
end
msgwindow.y = event.screen_y + 24 if msgwindow.y < 0
msgwindow.x = event.screen_x - (msgwindow.width / 2)
msgwindow.x = 0 if msgwindow.x < 0
if msgwindow.x > Graphics.width - msgwindow.width
@@ -623,24 +619,24 @@ def pbFadeOutInWithMusic(zViewport = 99999)
$game_system.bgm_pause(1.0)
$game_system.bgs_pause(1.0)
pos = $game_system.bgm_position
pbFadeOutIn(zViewport) {
pbFadeOutIn(zViewport) do
yield
$game_system.bgm_position = pos
$game_system.bgm_resume(playingBGM)
$game_system.bgs_resume(playingBGS)
}
end
end
def pbFadeOutAndHide(sprites)
visiblesprites = {}
numFrames = (Graphics.frame_rate * 0.4).floor
alphaDiff = (255.0 / numFrames).ceil
pbDeactivateWindows(sprites) {
pbDeactivateWindows(sprites) do
(0..numFrames).each do |j|
pbSetSpritesToColor(sprites, Color.new(0, 0, 0, j * alphaDiff))
(block_given?) ? yield : pbUpdateSpriteHash(sprites)
end
}
end
sprites.each do |i|
next if !i[1]
next if pbDisposed?(i[1])
@@ -660,12 +656,12 @@ def pbFadeInAndShow(sprites, visiblesprites = nil)
end
numFrames = (Graphics.frame_rate * 0.4).floor
alphaDiff = (255.0 / numFrames).ceil
pbDeactivateWindows(sprites) {
pbDeactivateWindows(sprites) do
(0..numFrames).each do |j|
pbSetSpritesToColor(sprites, Color.new(0, 0, 0, ((numFrames - j) * alphaDiff)))
(block_given?) ? yield : pbUpdateSpriteHash(sprites)
end
}
end
end
# Restores which windows are active for the given sprite hash.
@@ -731,9 +727,7 @@ def addBackgroundPlane(sprites, planename, background, viewport = nil)
else
sprites[planename].setBitmap(bitmapName)
sprites.each_value do |spr|
if spr.is_a?(Window)
spr.windowskin = nil
end
spr.windowskin = nil if spr.is_a?(Window)
end
end
end
@@ -753,9 +747,7 @@ def addBackgroundOrColoredPlane(sprites, planename, background, color, viewport
sprites[planename] = AnimatedPlane.new(viewport)
sprites[planename].setBitmap(bitmapName)
sprites.each_value do |spr|
if spr.is_a?(Window)
spr.windowskin = nil
end
spr.windowskin = nil if spr.is_a?(Window)
end
end
end
@@ -767,6 +759,7 @@ module Graphics
if !self.respond_to?("width")
def self.width; return 640; end
end
if !self.respond_to?("height")
def self.height; return 480; end
end
@@ -778,9 +771,7 @@ end
if !defined?(_INTL)
def _INTL(*args)
string = args[0].clone
(1...args.length).each do |i|
string.gsub!(/\{#{i}\}/, args[i].to_s)
end
(1...args.length).each { |i| string.gsub!(/\{#{i}\}/, args[i].to_s) }
return string
end
end
@@ -789,9 +780,7 @@ if !defined?(_ISPRINTF)
def _ISPRINTF(*args)
string = args[0].clone
(1...args.length).each do |i|
string.gsub!(/\{#{i}\:([^\}]+?)\}/) { |m|
next sprintf("%" + $1, args[i])
}
string.gsub!(/\{#{i}\:([^\}]+?)\}/) { |m| next sprintf("%" + $1, args[i]) }
end
return string
end
@@ -800,9 +789,7 @@ end
if !defined?(_MAPINTL)
def _MAPINTL(*args)
string = args[1].clone
(2...args.length).each do |i|
string.gsub!(/\{#{i}\}/, args[i + 1].to_s)
end
(2...args.length).each { |i| string.gsub!(/\{#{i}\}/, args[i + 1].to_s) }
return string
end
end
@@ -42,6 +42,8 @@ class WindowCursorRect < Rect
@window.width = @window.width
end
#-----------------------------------------------------------------------------
private
def needs_update?(x, y, width, height)
@@ -323,6 +325,8 @@ class Window
end
end
#-----------------------------------------------------------------------------
private
def ensureBitmap(bitmap, dwidth, dheight)
@@ -34,15 +34,14 @@ class SpriteWindow < Window
@_windowskin
end
# Flags used to preserve compatibility
# with RGSS/RGSS2's version of Window
# Flags used to preserve compatibility with RGSS/RGSS2's version of Window
module CompatBits
CorrectZ = 1
ExpandBack = 2
ShowScrollArrows = 4
StretchSides = 8
ShowPause = 16
ShowCursor = 32
CORRECT_Z = 1
EXPAND_BACK = 2
SHOW_SCROLL_ARROWS = 4
STRETCH_SIDES = 8
SHOW_PAUSE = 16
SHOW_CURSOR = 32
end
attr_reader :compat
@@ -78,7 +77,7 @@ class SpriteWindow < Window
@contents = @blankcontents
@_windowskin = nil
@rpgvx = false
@compat = CompatBits::ExpandBack | CompatBits::StretchSides
@compat = CompatBits::EXPAND_BACK | CompatBits::STRETCH_SIDES
@x = 0
@y = 0
@width = 0
@@ -435,7 +434,7 @@ class SpriteWindow < Window
privRefresh
end
#===============================================================================
#-----------------------------------------------------------------------------
private
@@ -515,9 +514,9 @@ class SpriteWindow < Window
@sprites["back"].visible = @visible
@sprites["contents"].visible = @visible && @openness == 255
@sprites["pause"].visible = supported && @visible && @pause &&
(@combat & CompatBits::ShowPause)
(@combat & CompatBits::SHOW_PAUSE)
@sprites["cursor"].visible = supported && @visible && @openness == 255 &&
(@combat & CompatBits::ShowCursor)
(@combat & CompatBits::SHOW_CURSOR)
@sprites["scroll0"].visible = false
@sprites["scroll1"].visible = false
@sprites["scroll2"].visible = false
@@ -540,7 +539,7 @@ class SpriteWindow < Window
@spritekeys.each do |i|
@sprites[i].z = @z
end
if (@compat & CompatBits::CorrectZ) > 0 && @skinformat == 0 && !@rpgvx
if (@compat & CompatBits::CORRECT_Z) > 0 && @skinformat == 0 && !@rpgvx
# Compatibility Mode: Cursor, pause, and contents have higher Z
@sprites["cursor"].z = @z + 1
@sprites["contents"].z = @z + 2
@@ -630,7 +629,7 @@ class SpriteWindow < Window
end
@sprites["contents"].x = @x + trimStartX
@sprites["contents"].y = @y + trimStartY
if (@compat & CompatBits::ShowScrollArrows) > 0 && @skinformat == 0 &&
if (@compat & CompatBits::SHOW_SCROLL_ARROWS) > 0 && @skinformat == 0 &&
@_windowskin && !@_windowskin.disposed? &&
@contents && !@contents.disposed?
@sprites["scroll0"].visible = @visible && hascontents && @oy > 0
@@ -667,7 +666,7 @@ class SpriteWindow < Window
@sprites["scroll3"].y = @y + @height - 16
@sprites["cursor"].x = @x + startX + @cursor_rect.x
@sprites["cursor"].y = @y + startY + @cursor_rect.y
if (@compat & CompatBits::ExpandBack) > 0 && @skinformat == 0
if (@compat & CompatBits::EXPAND_BACK) > 0 && @skinformat == 0
# Compatibility mode: Expand background
@sprites["back"].x = @x + 2
@sprites["back"].y = @y + 2
@@ -742,7 +741,7 @@ class SpriteWindow < Window
@sprites["side#{i}"].src_rect.set(0, 0, dwidth, dheight)
@sidebitmaps[i].clear
if sideRects[i].width > 0 && sideRects[i].height > 0
if (@compat & CompatBits::StretchSides) > 0 && @skinformat == 0
if (@compat & CompatBits::STRETCH_SIDES) > 0 && @skinformat == 0
# Compatibility mode: Stretch sides
@sidebitmaps[i].stretch_blt(@sprites["side#{i}"].src_rect,
@_windowskin, sideRects[i])
@@ -752,7 +751,7 @@ class SpriteWindow < Window
end
end
end
if (@compat & CompatBits::ExpandBack) > 0 && @skinformat == 0
if (@compat & CompatBits::EXPAND_BACK) > 0 && @skinformat == 0
# Compatibility mode: Expand background
backwidth = @width - 4
backheight = @height - 4
@@ -816,7 +815,7 @@ end
#
#===============================================================================
class SpriteWindow_Base < SpriteWindow
TEXTPADDING = 4 # In pixels
TEXT_PADDING = 4 # In pixels
def initialize(x, y, width, height)
super()
@@ -51,7 +51,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
dims = [0, 0]
cwidth = maxwidth < 0 ? Graphics.width : maxwidth
getLineBrokenChunks(self.contents, text,
cwidth - self.borderX - SpriteWindow_Base::TEXTPADDING, dims, true)
cwidth - self.borderX - SpriteWindow_Base::TEXT_PADDING, dims, true)
return dims
end
@@ -62,7 +62,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
def resizeToFit(text, maxwidth = -1) # maxwidth is maximum acceptable window width
dims = resizeToFitInternal(text, maxwidth)
self.width = dims[0] + self.borderX + SpriteWindow_Base::TEXTPADDING
self.width = dims[0] + self.borderX + SpriteWindow_Base::TEXT_PADDING
self.height = dims[1] + self.borderY
refresh
end
@@ -211,7 +211,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
dims = resizeToFitInternal(text, maxwidth)
oldstarting = @starting
@starting = true
self.width = dims[0] + self.borderX + SpriteWindow_Base::TEXTPADDING
self.width = dims[0] + self.borderX + SpriteWindow_Base::TEXT_PADDING
self.height = dims[1] + self.borderY
@starting = oldstarting
redrawText
@@ -221,7 +221,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
dims = resizeToFitInternal(text, maxwidth)
oldstarting = @starting
@starting = true
self.width = [dims[0] + self.borderX + SpriteWindow_Base::TEXTPADDING, maxwidth].min
self.width = [dims[0] + self.borderX + SpriteWindow_Base::TEXT_PADDING, maxwidth].min
self.height = [dims[1] + self.borderY, maxheight].min
@starting = oldstarting
redrawText
@@ -306,7 +306,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
if @letterbyletter
@fmtchars = []
fmt = getFormattedText(self.contents, 0, 0,
self.width - self.borderX - SpriteWindow_Base::TEXTPADDING, -1,
self.width - self.borderX - SpriteWindow_Base::TEXT_PADDING, -1,
shadowctag(@baseColor, @shadowColor) + value, 32, true)
@oldfont = self.contents.font.clone
fmt.each do |ch|
@@ -333,7 +333,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
fmt.clear
else
@fmtchars = getFormattedText(self.contents, 0, 0,
self.width - self.borderX - SpriteWindow_Base::TEXTPADDING, -1,
self.width - self.borderX - SpriteWindow_Base::TEXT_PADDING, -1,
shadowctag(@baseColor, @shadowColor) + value, 32, true)
@oldfont = self.contents.font.clone
@fmtchars.each do |ch|
@@ -586,6 +586,8 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
@frameskipChanged = false
end
#-----------------------------------------------------------------------------
private
def curcharSkip(skip)
@@ -704,6 +706,8 @@ class Window_InputNumberPokemon < SpriteWindow_Base
@frame = (@frame + 1) % 30
end
#-----------------------------------------------------------------------------
private
def textHelper(x, y, text, i)
@@ -895,6 +899,8 @@ class SpriteWindow_Selectable < SpriteWindow_Base
end
end
#-----------------------------------------------------------------------------
private
def priv_page_row_max
@@ -1074,7 +1080,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
width = [width, tmpbitmap.text_size(i).width].max
end
# one 16 to allow cursor
width += 16 + 16 + SpriteWindow_Base::TEXTPADDING
width += 16 + 16 + SpriteWindow_Base::TEXT_PADDING
tmpbitmap.dispose
end
# Store suggested width and height of window
@@ -1229,7 +1235,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
def textWidth(bitmap, text)
dims = [nil, 0]
chars = getFormattedText(bitmap, 0, 0,
Graphics.width - self.borderX - SpriteWindow_Base::TEXTPADDING - 16,
Graphics.width - self.borderX - SpriteWindow_Base::TEXT_PADDING - 16,
-1, text, self.rowHeight, true, true)
chars.each do |ch|
dims[0] = dims[0] ? [dims[0], ch[1]].min : ch[1]
@@ -218,9 +218,9 @@ end
#
#===============================================================================
def pbGetTileBitmap(filename, tile_id, hue, width = 1, height = 1)
return RPG::Cache.tileEx(filename, tile_id, hue, width, height) { |f|
return RPG::Cache.tileEx(filename, tile_id, hue, width, height) do |f|
AnimatedBitmap.new("Graphics/Tilesets/" + filename).deanimate
}
end
end
def pbGetTileset(name, hue = 0)
@@ -64,6 +64,8 @@ class AnimatedPlane < Plane
end
end
#-----------------------------------------------------------------------------
private
def clear_bitmap
@@ -97,9 +97,7 @@ end
def getFormattedTextForDims(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight,
newlineBreaks = true, explicitBreaksOnly = false)
text2 = text.gsub(/<(\/?)(c|c2|c3|o|u|s)(\s*\=\s*([^>]*))?>/i, "")
if newlineBreaks
text2.gsub!(/<(\/?)(br)(\s*\=\s*([^>]*))?>/i, "\n")
end
text2.gsub!(/<(\/?)(br)(\s*\=\s*([^>]*))?>/i, "\n") if newlineBreaks
return getFormattedText(bitmap, xDst, yDst, widthDst, heightDst,
text2, lineheight, newlineBreaks,
explicitBreaksOnly, true)
@@ -249,70 +247,79 @@ end
#===============================================================================
# Formats a string of text and returns an array containing a list of formatted
# characters.
#
# Parameters:
# bitmap: Source bitmap. Will be used to determine the default font of
# the text.
# xDst: X coordinate of the text's top left corner.
# yDst: Y coordinate of the text's top left corner.
# widthDst: Width of the text. Used to determine line breaks.
# heightDst: Height of the text. If -1, there is no height restriction.
# If 1 or greater, any characters exceeding the height are
# removed from the returned list.
# newLineBreaks: If true, newline characters will be treated as line breaks.
# The default is true.
#
# Return Values:
# A list of formatted characters. Returns an empty array if _bitmap_ is nil
# or disposed, or if _widthDst_ is 0 or less or _heightDst_ is 0.
#
# Formatting Specification:
# This function uses the following syntax when formatting the text.
#
# <b> ... </b> - Formats the text in bold.
# <i> ... </i> - Formats the text in italics.
# <u> ... </u> - Underlines the text.
# <s> ... </s> - Draws a strikeout line over the text.
# <al> ... </al> - Left-aligns the text. Causes line breaks before and
# after the text.
# <r> - Right-aligns the text until the next line break.
# <ar> ... </ar> - Right-aligns the text. Causes line breaks before and
# after the text.
# <ac> ... </ac> - Centers the text. Causes line breaks before and after
# the text.
# <br> - Causes a line break.
# <c=X> ... </c> - Color specification. A total of four formats are
# supported: RRGGBBAA, RRGGBB, 16-bit RGB, and
# Window_Base color numbers.
# <c2=X> ... </c2> - Color specification where the first half is the base
# color and the second half is the shadow color. 16-bit
# RGB is supported.
#
# Added 2009-10-20
#
# <c3=B,S> ... </c3> - Color specification where B is the base color and S is
# the shadow color. B and/or S can be omitted. A total of
# four formats are supported: RRGGBBAA, RRGGBB, 16-bit
# RGB, and Window_Base color numbers.
#
# Added 2009-9-12
#
# <o=X> - Displays the text in the given opacity (0-255)
#
# Added 2009-10-19
#
# <outln> - Displays the text in outline format.
#
# Added 2010-05-12
#
# <outln2> - Displays the text in outline format (outlines more
# exaggerated.
# <fn=X> ... </fn> - Formats the text in the specified font, or Arial if the
# font doesn't exist.
# <fs=X> ... </fs> - Changes the font size to X.
# <icon=X> - Displays the icon X (in Graphics/Icons/).
#
# In addition, the syntax supports the following:
# &apos; - Converted to "'".
# &lt; - Converted to "<".
# &gt; - Converted to ">".
# &amp; - Converted to "&".
# &quot; - Converted to double quotation mark.
#
# To draw the characters, pass the returned array to the
# _drawFormattedChars_ function.
#===============================================================================
=begin
Parameters:
bitmap: Source bitmap. Will be used to determine the default font of
the text.
xDst: X coordinate of the text's top left corner.
yDst: Y coordinate of the text's top left corner.
widthDst: Width of the text. Used to determine line breaks.
heightDst: Height of the text. If -1, there is no height restriction. If
1 or greater, any characters exceeding the height are removed
from the returned list.
newLineBreaks: If true, newline characters will be treated as line breaks. The
default is true.
Return Values:
A list of formatted characters. Returns an empty array if _bitmap_ is nil
or disposed, or if _widthDst_ is 0 or less or _heightDst_ is 0.
Formatting Specification:
This function uses the following syntax when formatting the text.
<b> ... </b> - Formats the text in bold.
<i> ... </i> - Formats the text in italics.
<u> ... </u> - Underlines the text.
<s> ... </s> - Draws a strikeout line over the text.
<al> ... </al> - Left-aligns the text. Causes line breaks before and after
the text.
<r> - Right-aligns the text until the next line break.
<ar> ... </ar> - Right-aligns the text. Causes line breaks before and after
the text.
<ac> ... </ac> - Centers the text. Causes line breaks before and after the
text.
<br> - Causes a line break.
<c=X> ... </c> - Color specification. A total of four formats are supported:
RRGGBBAA, RRGGBB, 16-bit RGB, and Window_Base color numbers.
<c2=X> ... </c2> - Color specification where the first half is the base color
and the second half is the shadow color. 16-bit RGB is
supported.
Added 2009-10-20
<c3=B,S> ... </c3> - Color specification where B is the base color and S is the
shadow color. B and/or S can be omitted. A total of four
formats are supported:
RRGGBBAA, RRGGBB, 16-bit RGB, and Window_Base color numbers.
Added 2009-9-12
<o=X> - Displays the text in the given opacity (0-255)
Added 2009-10-19
<outln> - Displays the text in outline format.
Added 2010-05-12
<outln2> - Displays the text in outline format (outlines more
exaggerated.
<fn=X> ... </fn> - Formats the text in the specified font, or Arial if the
font doesn't exist.
<fs=X> ... </fs> - Changes the font size to X.
<icon=X> - Displays the icon X (in Graphics/Icons/).
In addition, the syntax supports the following:
&apos; - Converted to "'".
&lt; - Converted to "<".
&gt; - Converted to ">".
&amp; - Converted to "&".
&quot; - Converted to double quotation mark.
To draw the characters, pass the returned array to the
_drawFormattedChars_ function.
=end
def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = 32,
newlineBreaks = true, explicitBreaksOnly = false,
collapseAlignments = false)
@@ -515,9 +522,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
break
end
when "br" # Line break
if !endtag
nextline += 1
end
nextline += 1 if !endtag
when "r" # Right align this line
if !endtag
x = 0
@@ -639,49 +644,47 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
end
# This code looks at whether the text occupies exactly two lines when
# displayed. If it does, it balances the length of each line.
=begin
# Count total number of lines
numlines = (x==0 && y>0) ? y : y+1
if numlines==2 && realtext && !realtext[/\n/] && realtext.length>=50
# Set half to middle of text (known to contain no formatting)
half = realtext.length/2
leftSearch = 0
rightSearch = 0
# Search left for a space
i = half
while i>=0
break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
leftSearch += 1
i -= 1
end
# Search right for a space
i = half
while i<realtext.length
break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
rightSearch += 1
i += 1
end
# Move half left or right whichever is closer
trialHalf = half+((rightSearch<leftSearch) ? rightSearch : -leftSearch)
if trialHalf!=0 && trialHalf!=realtext.length
# Insert newline and re-call this function (force newlineBreaksOnly)
newText = realtext.clone
if isWaitChar(newText[trialHalf,1])
# insert after wait character
newText.insert(trialHalf+1,"\n")
else
# remove spaces after newline
newText.insert(trialHalf,"\n")
newText.gsub!(/\n\s+/,"\n")
end
bitmap.font = oldfont
dummybitmap.dispose if dummybitmap
return getFormattedText(dummybitmap ? nil : bitmap,xDst,yDst,
widthDst,heightDst,realtextStart+newText,
lineheight,true,explicitBreaksOnly)
end
end
=end
# # Count total number of lines
# numlines = (x==0 && y>0) ? y : y+1
# if numlines==2 && realtext && !realtext[/\n/] && realtext.length>=50
# # Set half to middle of text (known to contain no formatting)
# half = realtext.length/2
# leftSearch = 0
# rightSearch = 0
# # Search left for a space
# i = half
# while i>=0
# break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
# leftSearch += 1
# i -= 1
# end
# # Search right for a space
# i = half
# while i<realtext.length
# break if realtext[i,1][/\s/]||isWaitChar(realtext[i,1]) # found a space
# rightSearch += 1
# i += 1
# end
# # Move half left or right whichever is closer
# trialHalf = half+((rightSearch<leftSearch) ? rightSearch : -leftSearch)
# if trialHalf!=0 && trialHalf!=realtext.length
# # Insert newline and re-call this function (force newlineBreaksOnly)
# newText = realtext.clone
# if isWaitChar(newText[trialHalf,1])
# # insert after wait character
# newText.insert(trialHalf+1,"\n")
# else
# # remove spaces after newline
# newText.insert(trialHalf,"\n")
# newText.gsub!(/\n\s+/,"\n")
# end
# bitmap.font = oldfont
# dummybitmap.dispose if dummybitmap
# return getFormattedText(dummybitmap ? nil : bitmap,xDst,yDst,
# widthDst,heightDst,realtextStart+newText,
# lineheight,true,explicitBreaksOnly)
# end
# end
if havenl
# Eliminate spaces before newlines and pause character
firstspace = -1
@@ -696,9 +699,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
end
firstspace = -1
elsif characters[i][0][/[ \r\t]/]
if firstspace < 0
firstspace = i
end
firstspace = i if firstspace < 0
else
firstspace = -1
end
@@ -739,9 +740,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
totalLineWidths = []
widthblocks.each do |block|
y = block[4]
if !totalLineWidths[y]
totalLineWidths[y] = 0
end
totalLineWidths[y] = 0 if !totalLineWidths[y]
if totalLineWidths[y] != 0
# padding in case more than one line has different alignments
totalLineWidths[y] += 16
@@ -874,9 +873,7 @@ def getLineBrokenChunks(bitmap, value, width, dims, plain = false)
x += textwidth
dims[0] = x if dims && dims[0] < x
end
if textcols[i]
color = textcols[i]
end
color = textcols[i] if textcols[i]
end
end
dims[1] = y + 32 if dims
@@ -145,6 +145,8 @@ class ChooseNumberParams
end
end
#-----------------------------------------------------------------------------
private
def clamp(v, mn, mx)
@@ -422,16 +424,13 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
msgback = nil
linecount = (Graphics.height > 400) ? 3 : 2
### Text replacement
text.gsub!(/\\sign\[([^\]]*)\]/i) { # \sign[something] gets turned into
text.gsub!(/\\sign\[([^\]]*)\]/i) do # \sign[something] gets turned into
next "\\op\\cl\\ts[]\\w[" + $1 + "]" # \op\cl\ts[]\w[something]
}
end
text.gsub!(/\\\\/, "\5")
text.gsub!(/\\1/, "\1")
if $game_actors
text.gsub!(/\\n\[([1-8])\]/i) {
m = $1.to_i
next $game_actors[m].name
}
text.gsub!(/\\n\[([1-8])\]/i) { next $game_actors[$1.to_i].name }
end
text.gsub!(/\\pn/i, $player.name) if $player
text.gsub!(/\\pm/i, _INTL("${1}", $player.money.to_s_formatted)) if $player
@@ -445,7 +444,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
text.gsub!(/\\pog/i, "")
text.gsub!(/\\b/i, "<c3=3050C8,D0D0C8>")
text.gsub!(/\\r/i, "<c3=E00808,D0D0C8>")
text.gsub!(/\\[Ww]\[([^\]]*)\]/) {
text.gsub!(/\\[Ww]\[([^\]]*)\]/) do
w = $1.to_s
if w == ""
msgwindow.windowskin = nil
@@ -453,12 +452,11 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
msgwindow.setSkin("Graphics/Windowskins/#{w}", false)
end
next ""
}
end
isDarkSkin = isDarkWindowskin(msgwindow.windowskin)
text.gsub!(/\\c\[([0-9]+)\]/i) {
m = $1.to_i
next getSkinColor(msgwindow.windowskin, m, isDarkSkin)
}
text.gsub!(/\\c\[([0-9]+)\]/i) do
next getSkinColor(msgwindow.windowskin, $1.to_i, isDarkSkin)
end
loop do
last_text = text.clone
text.gsub!(/\\v\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
@@ -466,10 +464,10 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
end
loop do
last_text = text.clone
text.gsub!(/\\l\[([0-9]+)\]/i) {
text.gsub!(/\\l\[([0-9]+)\]/i) do
linecount = [1, $1.to_i].max
next ""
}
end
break if text == last_text
end
colortag = ""
@@ -664,9 +662,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
$game_variables[cmdvariable] = pbShowCommands(msgwindow, commands, cmdIfCancel)
$game_map.need_refresh = true if $game_map
end
if commandProc
ret = commandProc.call(msgwindow)
end
ret = commandProc.call(msgwindow) if commandProc
msgback&.dispose
goldwindow&.dispose
coinwindow&.dispose
@@ -698,8 +694,8 @@ def pbMessage(message, commands = nil, cmdIfCancel = 0, skin = nil, defaultCmd =
msgwindow = pbCreateMessageWindow(nil, skin)
if commands
ret = pbMessageDisplay(msgwindow, message, true,
proc { |msgwindow|
next Kernel.pbShowCommands(msgwindow, commands, cmdIfCancel, defaultCmd, &block)
proc { |msgwndw|
next Kernel.pbShowCommands(msgwndw, commands, cmdIfCancel, defaultCmd, &block)
}, &block)
else
pbMessageDisplay(msgwindow, message, &block)
@@ -720,8 +716,8 @@ end
def pbMessageChooseNumber(message, params, &block)
msgwindow = pbCreateMessageWindow(nil, params.messageSkin)
ret = pbMessageDisplay(msgwindow, message, true,
proc { |msgwindow|
next pbChooseNumber(msgwindow, params, &block)
proc { |msgwndw|
next pbChooseNumber(msgwndw, params, &block)
}, &block)
pbDisposeMessageWindow(msgwindow)
return ret
@@ -783,9 +779,7 @@ def pbShowCommandsWithHelp(msgwindow, commands, help, cmdIfCancel = 0, defaultCm
Input.update
oldindex = cmdwindow.index
cmdwindow.update
if oldindex != cmdwindow.index
msgwin.text = help[cmdwindow.index]
end
msgwin.text = help[cmdwindow.index] if oldindex != cmdwindow.index
msgwin.update
yield if block_given?
if Input.trigger?(Input::BACK)
@@ -822,9 +816,7 @@ def pbMessageWaitForInput(msgwindow, frames, showPause = false)
Input.update
msgwindow&.update
pbUpdateSceneMap
if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
break
end
break if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
yield if block_given?
end
msgwindow.stopPause if msgwindow && showPause
@@ -863,8 +855,8 @@ end
def pbMessageFreeText(message, currenttext, passwordbox, maxlength, width = 240, &block)
msgwindow = pbCreateMessageWindow
retval = pbMessageDisplay(msgwindow, message, true,
proc { |msgwindow|
next pbFreeText(msgwindow, currenttext, passwordbox, maxlength, width, &block)
proc { |msgwndw|
next pbFreeText(msgwndw, currenttext, passwordbox, maxlength, width, &block)
}, &block)
pbDisposeMessageWindow(msgwindow)
return retval
@@ -41,9 +41,7 @@ class CharacterEntryHelper
return false if @maxlength >= 0 && chars.length >= @maxlength
chars.insert(@cursor, ch)
@text = ""
chars.each do |ch|
@text += ch if ch
end
chars.each { |char| @text += char if char }
@cursor += 1
return true
end
@@ -66,14 +64,14 @@ class CharacterEntryHelper
return true
end
#-----------------------------------------------------------------------------
private
def ensure
return if @maxlength < 0
chars = self.text.scan(/./m)
if chars.length > @maxlength && @maxlength >= 0
chars = chars[0, @maxlength]
end
chars = chars[0, @maxlength] if chars.length > @maxlength && @maxlength >= 0
@text = ""
chars.each do |ch|
@text += ch if ch
+10 -10
View File
@@ -18,8 +18,8 @@ end
# Methods that determine the duration of an audio file.
#===============================================================================
def getOggPage(file)
fgetdw = proc { |file|
(file.eof? ? 0 : (file.read(4).unpack("V")[0] || 0))
fgetdw = proc { |f|
(f.eof? ? 0 : (f.read(4).unpack("V")[0] || 0))
}
dw = fgetdw.call(file)
return nil if dw != 0x5367674F
@@ -35,8 +35,8 @@ end
# internal function
def oggfiletime(file)
fgetdw = proc { |file|
(file.eof? ? 0 : (file.read(4).unpack("V")[0] || 0))
fgetdw = proc { |f|
(f.eof? ? 0 : (f.read(4).unpack("V")[0] || 0))
}
pages = []
page = nil
@@ -51,8 +51,8 @@ def oggfiletime(file)
i = -1
pcmlengths = []
rates = []
pages.each do |page|
header = page[0]
pages.each do |pg|
header = pg[0]
serial = header[10, 4].unpack("V")
frame = header[2, 8].unpack("C*")
frameno = frame[7]
@@ -65,7 +65,7 @@ def oggfiletime(file)
frameno = (frameno << 8) | frame[0]
if serial != curserial
curserial = serial
file.pos = page[1]
file.pos = pg[1]
packtype = (file.read(1)[0].ord rescue 0)
string = file.read(6)
return -1 if string != "vorbis"
@@ -78,7 +78,7 @@ def oggfiletime(file)
pcmlengths[i] = frameno
end
ret = 0.0
pcmlengths.each_with_index { |length, i| ret += length.to_f / rates[i] }
pcmlengths.each_with_index { |length, j| ret += length.to_f / rates[j] }
return ret * 256.0
end
@@ -105,7 +105,7 @@ def getPlayTime2(filename)
fgetw = proc { |file|
(file.eof? ? 0 : (file.read(2).unpack("v")[0] || 0))
}
File.open(filename, "rb") { |file|
File.open(filename, "rb") do |file|
file.pos = 0
fdw = fgetdw.call(file)
case fdw
@@ -165,6 +165,6 @@ def getPlayTime2(filename)
break
end
end
}
end
return time
end
+25 -23
View File
@@ -306,6 +306,8 @@ module Transitions
end
end
#---------------------------------------------------------------------------
private
def rand_sign
@@ -1382,29 +1384,29 @@ module Transitions
# Foe sprite appears
proportion = (@timer - @foe_appear_start) / (@foe_appear_end - @foe_appear_start)
start_x = Graphics.width + (@foe_bitmap.width / 2)
@foe_sprite.x = start_x + (FOE_SPRITE_X_LIMIT - start_x) * proportion
@foe_sprite.x = start_x + ((FOE_SPRITE_X_LIMIT - start_x) * proportion)
elsif @timer >= @vs_appear_final
@vs_1_sprite.visible = false
elsif @timer >= @vs_appear_start_2
# Temp VS sprites enlarge and shrink again
if @vs_2_sprite.visible
@vs_2_sprite.zoom_x = 1.6 - 0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time
@vs_2_sprite.zoom_x = 1.6 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
if @vs_2_sprite.zoom_x <= 1.2
@vs_2_sprite.visible = false
@vs_main_sprite.visible = true
end
end
@vs_1_sprite.zoom_x = 2.0 - 0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
elsif @timer >= @vs_appear_start
# Temp VS sprites appear and start shrinking
@vs_2_sprite.visible = true
@vs_2_sprite.zoom_x = 2.0 - 0.8 * (@timer - @vs_appear_start) / @vs_shrink_time
@vs_2_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start) / @vs_shrink_time)
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
if @vs_1_sprite.visible || @vs_2_sprite.zoom_x <= 1.6 # Halfway between 2.0 and 1.2
@vs_1_sprite.visible = true
@vs_1_sprite.zoom_x = 2.0 - 0.8 * (@timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time)
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
end
elsif @timer >= @bar_appear_end
@@ -1413,7 +1415,7 @@ module Transitions
start_x = Graphics.width * (1 - (@timer / @bar_appear_end))
color = Color.new(0, 0, 0, 0) # Transparent
(@sprites[0].height / 2).times do |i|
x = start_x - BAR_MASK[i % BAR_MASK.length] * 4
x = start_x - (BAR_MASK[i % BAR_MASK.length] * 4)
@bar_mask_sprite.bitmap.fill_rect(x, BAR_Y + (i * 2), @bar_mask_sprite.width - x, 2, color)
end
end
@@ -1572,14 +1574,14 @@ module Transitions
# Bars/trainer sprites slide in
proportion = (@timer - @bar_appear_start) / (@bar_appear_end - @bar_appear_start)
sqrt_proportion = Math.sqrt(proportion)
@player_bar_sprite.x = @player_bar_start_x + (@player_bar_x + BAR_OVERSHOOT - @player_bar_start_x) * sqrt_proportion
@player_bar_sprite.x = @player_bar_start_x + ((@player_bar_x + BAR_OVERSHOOT - @player_bar_start_x) * sqrt_proportion)
@player_sprite.x = @player_bar_sprite.x + TRAINER_X_OFFSET
@foe_bar_sprite.x = @foe_bar_start_x + (@foe_bar_x - BAR_OVERSHOOT - @foe_bar_start_x) * sqrt_proportion
@foe_bar_sprite.x = @foe_bar_start_x + ((@foe_bar_x - BAR_OVERSHOOT - @foe_bar_start_x) * sqrt_proportion)
@foe_sprite.x = @foe_bar_sprite.x + (@bar_bitmap.width / 2) - TRAINER_X_OFFSET
@text_sprite.x = @foe_bar_sprite.x
end
# Animate bars
if @timer >= @flash_start + 0.33 * @flash_duration
if @timer >= @flash_start + (0.33 * @flash_duration)
bar_phase = (@timer * 30).to_i % @num_bar_frames
@player_bar_sprite.src_rect.y = bar_phase * BAR_HEIGHT
@foe_bar_sprite.src_rect.y = bar_phase * BAR_HEIGHT
@@ -1594,23 +1596,23 @@ module Transitions
elsif @timer >= @vs_appear_start_2
# Temp VS sprites enlarge and shrink again
if @vs_2_sprite.visible
@vs_2_sprite.zoom_x = 1.6 - 0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time
@vs_2_sprite.zoom_x = 1.6 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
if @vs_2_sprite.zoom_x <= 1.2
@vs_2_sprite.visible = false
@vs_main_sprite.visible = true
end
end
@vs_1_sprite.zoom_x = 2.0 - 0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start_2) / @vs_shrink_time)
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
elsif @timer >= @vs_appear_start
# Temp VS sprites appear and start shrinking
@vs_2_sprite.visible = true
@vs_2_sprite.zoom_x = 2.0 - 0.8 * (@timer - @vs_appear_start) / @vs_shrink_time
@vs_2_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start) / @vs_shrink_time)
@vs_2_sprite.zoom_y = @vs_2_sprite.zoom_x
if @vs_1_sprite.visible || @vs_2_sprite.zoom_x <= 1.6 # Halfway between 2.0 and 1.2
@vs_1_sprite.visible = true
@vs_1_sprite.zoom_x = 2.0 - 0.8 * (@timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time
@vs_1_sprite.zoom_x = 2.0 - (0.8 * (@timer - @vs_appear_start - (@vs_shrink_time / 2)) / @vs_shrink_time)
@vs_1_sprite.zoom_y = @vs_1_sprite.zoom_x
end
end
@@ -1652,12 +1654,12 @@ module Transitions
@flash_viewport.color.alpha = 255 * proportion
# Move bars and trainer sprites off-screen
dist = BAR_Y_INDENT + BAR_HEIGHT
@player_bar_sprite.x = @player_bar_x - dist * proportion
@player_bar_sprite.y = @player_bar_y - dist * proportion
@player_bar_sprite.x = @player_bar_x - (dist * proportion)
@player_bar_sprite.y = @player_bar_y - (dist * proportion)
@player_sprite.x = @player_bar_sprite.x + TRAINER_X_OFFSET
@player_sprite.y = @player_bar_sprite.y + BAR_HEIGHT - TRAINER_Y_OFFSET
@foe_bar_sprite.x = @foe_bar_x + dist * proportion
@foe_bar_sprite.y = @foe_bar_y + dist * proportion
@foe_bar_sprite.x = @foe_bar_x + (dist * proportion)
@foe_bar_sprite.y = @foe_bar_y + (dist * proportion)
@foe_sprite.x = @foe_bar_sprite.x + (@bar_bitmap.width / 2) - TRAINER_X_OFFSET
@foe_sprite.y = @foe_bar_sprite.y + @foe_bitmap.height - TRAINER_Y_OFFSET
end
@@ -1731,8 +1733,8 @@ module Transitions
next if proportion < start_time
single_proportion = (proportion - start_time) / @rocket_appear_time
sqrt_single_proportion = Math.sqrt(single_proportion)
sprite.x = (ROCKET_X[i] + (0.5 - ROCKET_X[i]) * sqrt_single_proportion) * Graphics.width
sprite.y = (ROCKET_Y[i] + (0.5 - ROCKET_Y[i]) * sqrt_single_proportion) * Graphics.height
sprite.x = (ROCKET_X[i] + ((0.5 - ROCKET_X[i]) * sqrt_single_proportion)) * Graphics.width
sprite.y = (ROCKET_Y[i] + ((0.5 - ROCKET_Y[i]) * sqrt_single_proportion)) * Graphics.height
sprite.zoom_x = 2.5 * (1 - single_proportion)
sprite.zoom_y = sprite.zoom_x
sprite.angle = sprite.zoom_x * ROCKET_ANGLE[i] * 360
@@ -1867,8 +1869,8 @@ module Transitions
# Slide foe sprite/name off-screen
proportion = (@timer - @foe_disappear_start) / (@foe_disappear_end - @foe_disappear_start)
start_x = Graphics.width / 2
@foe_sprite.x = start_x - (@foe_bitmap.width + start_x) * proportion * proportion
@text_sprite.x = @foe_sprite.x - Graphics.width / 2
@foe_sprite.x = start_x - ((@foe_bitmap.width + start_x) * proportion * proportion)
@text_sprite.x = @foe_sprite.x - (Graphics.width / 2)
elsif @timer >= @flash_end
@flash_viewport.color.alpha = 0 # Ensure flash has ended
elsif @timer >= @bg_2_appear_end
@@ -1884,8 +1886,8 @@ module Transitions
@bg_2_sprite.opacity = 255 * proportion
# Foe sprite/name appear
start_x = Graphics.width + (@foe_bitmap.width / 2)
@foe_sprite.x = start_x + ((Graphics.width / 2) - start_x) * Math.sqrt(proportion)
@text_sprite.x = @foe_sprite.x - Graphics.width / 2
@foe_sprite.x = start_x + (((Graphics.width / 2) - start_x) * Math.sqrt(proportion))
@text_sprite.x = @foe_sprite.x - (Graphics.width / 2)
@text_sprite.visible = true
elsif @timer >= @bg_1_appear_end
@bg_1_sprite.oy = Graphics.height / 2
+8 -20
View File
@@ -79,12 +79,8 @@ class EventScene
def dispose
return if disposed?
@picturesprites.each do |sprite|
sprite.dispose
end
@usersprites.each do |sprite|
sprite.dispose
end
@picturesprites.each { |sprite| sprite.dispose }
@usersprites.each { |sprite| sprite.dispose }
@onCTrigger.clear
@onBTrigger.clear
@onUpdate.clear
@@ -142,9 +138,7 @@ class EventScene
def pictureWait(extraframes = 0)
loop do
hasRunning = false
@pictures.each do |pic|
hasRunning = true if pic.running?
end
@pictures.each { |pic| hasRunning = true if pic.running? }
break if !hasRunning
update
end
@@ -155,12 +149,8 @@ class EventScene
return if disposed?
Graphics.update
Input.update
@pictures.each do |picture|
picture.update
end
@picturesprites.each do |sprite|
sprite.update
end
@pictures.each { |picture| picture.update }
@picturesprites.each { |sprite| sprite.update }
@usersprites.each do |sprite|
next if !sprite || sprite.disposed? || !sprite.is_a?(Sprite)
sprite.update
@@ -184,12 +174,10 @@ end
#
#===============================================================================
def pbEventScreen(cls)
pbFadeOutIn {
pbFadeOutIn do
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
viewport.z = 99999
PBDebug.logonerr {
cls.new(viewport).main
}
PBDebug.logonerr { cls.new(viewport).main }
viewport.dispose
}
end
end
+5 -6
View File
@@ -266,13 +266,12 @@ module GameData
self.constants.each do |c|
next if !self.const_get(c).is_a?(Class)
ret[c] = self.const_get(c)::PBS_BASE_FILENAME if self.const_get(c).const_defined?(:PBS_BASE_FILENAME)
if ret[c].is_a?(Array)
ret[c].length.times do |i|
next if i == 0
ret[(c.to_s + i.to_s).to_sym] = ret[c][i] # :Species1 => "pokemon_forms"
end
ret[c] = ret[c][0] # :Species => "pokemon"
next if !ret[c].is_a?(Array)
ret[c].length.times do |i|
next if i == 0
ret[(c.to_s + i.to_s).to_sym] = ret[c][i] # :Species1 => "pokemon_forms"
end
ret[c] = ret[c][0] # :Species => "pokemon"
end
return ret
end
@@ -33,7 +33,7 @@ module GameData
# @return [String] the translated name of this region
def name
return pbGetMessageFromHash(MessageTypes::Regions, @real_name)
return pbGetMessageFromHash(MessageTypes::REGION_NAMES, @real_name)
end
def has_flag?(flag)
@@ -48,7 +48,7 @@ module GameData
# @return [String] the translated name of this item
def name
return pbGetMessageFromHash(MessageTypes::Types, @real_name)
return pbGetMessageFromHash(MessageTypes::TYPE_NAMES, @real_name)
end
def physical?; return !@special_type; end
@@ -30,12 +30,12 @@ module GameData
# @return [String] the translated name of this ability
def name
return pbGetMessageFromHash(MessageTypes::Abilities, @real_name)
return pbGetMessageFromHash(MessageTypes::ABILITY_NAMES, @real_name)
end
# @return [String] the translated description of this ability
def description
return pbGetMessageFromHash(MessageTypes::AbilityDescriptions, @real_description)
return pbGetMessageFromHash(MessageTypes::ABILITY_DESCRIPTIONS, @real_description)
end
def has_flag?(flag)
@@ -60,12 +60,12 @@ module GameData
# @return [String] the translated name of this move
def name
return pbGetMessageFromHash(MessageTypes::Moves, @real_name)
return pbGetMessageFromHash(MessageTypes::MOVE_NAMES, @real_name)
end
# @return [String] the translated description of this move
def description
return pbGetMessageFromHash(MessageTypes::MoveDescriptions, @real_description)
return pbGetMessageFromHash(MessageTypes::MOVE_DESCRIPTIONS, @real_description)
end
def has_flag?(flag)
@@ -133,29 +133,29 @@ module GameData
# @return [String] the translated name of this item
def name
return pbGetMessageFromHash(MessageTypes::Items, @real_name)
return pbGetMessageFromHash(MessageTypes::ITEM_NAMES, @real_name)
end
# @return [String] the translated plural version of the name of this item
def name_plural
return pbGetMessageFromHash(MessageTypes::ItemPlurals, @real_name_plural)
return pbGetMessageFromHash(MessageTypes::ITEM_NAME_PLURALS, @real_name_plural)
end
# @return [String] the translated portion name of this item
def portion_name
return pbGetMessageFromHash(MessageTypes::ItemPortions, @real_portion_name) if @real_portion_name
return pbGetMessageFromHash(MessageTypes::ITEM_PORTION_NAMES, @real_portion_name) if @real_portion_name
return name
end
# @return [String] the translated plural version of the portion name of this item
def portion_name_plural
return pbGetMessageFromHash(MessageTypes::ItemPortionPlurals, @real_portion_name_plural) if @real_portion_name_plural
return pbGetMessageFromHash(MessageTypes::ITEM_PORTION_NAME_PLURALS, @real_portion_name_plural) if @real_portion_name_plural
return name_plural
end
# @return [String] the translated description of this item
def description
return pbGetMessageFromHash(MessageTypes::ItemDescriptions, @real_description)
return pbGetMessageFromHash(MessageTypes::ITEM_DESCRIPTIONS, @real_description)
end
def has_flag?(flag)
@@ -220,22 +220,22 @@ module GameData
# @return [String] the translated name of this species
def name
return pbGetMessageFromHash(MessageTypes::Species, @real_name)
return pbGetMessageFromHash(MessageTypes::SPECIES_NAMES, @real_name)
end
# @return [String] the translated name of this form of this species
def form_name
return pbGetMessageFromHash(MessageTypes::SpeciesForms, @real_form_name)
return pbGetMessageFromHash(MessageTypes::SPECIES_FORM_NAMES, @real_form_name)
end
# @return [String] the translated Pokédex category of this species
def category
return pbGetMessageFromHash(MessageTypes::SpeciesCategories, @real_category)
return pbGetMessageFromHash(MessageTypes::SPECIES_CATEGORIES, @real_category)
end
# @return [String] the translated Pokédex entry of this species
def pokedex_entry
return pbGetMessageFromHash(MessageTypes::PokedexEntries, @real_pokedex_entry)
return pbGetMessageFromHash(MessageTypes::POKEDEX_ENTRIES, @real_pokedex_entry)
end
def default_form
@@ -70,9 +70,7 @@ module GameData
def apply_metrics_to_sprite(sprite, index, shadow = false)
if shadow
if (index & 1) == 1 # Foe Pokémon
sprite.x += @shadow_x * 2
end
sprite.x += @shadow_x * 2 if (index & 1) == 1 # Foe Pokémon
elsif (index & 1) == 0 # Player's Pokémon
sprite.x += @back_sprite[0] * 2
sprite.y += @back_sprite[1] * 2
@@ -33,12 +33,12 @@ module GameData
# @return [String] the translated name of this ribbon
def name
return pbGetMessageFromHash(MessageTypes::RibbonNames, @real_name)
return pbGetMessageFromHash(MessageTypes::RIBBON_NAMES, @real_name)
end
# @return [String] the translated description of this ribbon
def description
return pbGetMessageFromHash(MessageTypes::RibbonDescriptions, @real_description)
return pbGetMessageFromHash(MessageTypes::RIBBON_DESCRIPTIONS, @real_description)
end
def has_flag?(flag)
@@ -113,7 +113,7 @@ module GameData
# @return [String] the translated name of this trainer type
def name
return pbGetMessageFromHash(MessageTypes::TrainerTypes, @real_name)
return pbGetMessageFromHash(MessageTypes::TRAINER_TYPE_NAMES, @real_name)
end
def male?; return @gender == 0; end
@@ -102,12 +102,12 @@ module GameData
# @return [String] the translated name of this trainer
def name
return pbGetMessageFromHash(MessageTypes::TrainerNames, @real_name)
return pbGetMessageFromHash(MessageTypes::TRAINER_NAMES, @real_name)
end
# @return [String] the translated in-battle lose message of this trainer
def lose_text
return pbGetMessageFromHash(MessageTypes::TrainerLoseTexts, @real_lose_text)
return pbGetMessageFromHash(MessageTypes::TRAINER_SPEECHES_LOSE, @real_lose_text)
end
# Creates a battle-ready version of a trainer's data.
@@ -74,7 +74,7 @@ module GameData
# @return [String] the translated name of the Pokémon Storage creator
def storage_creator
ret = pbGetMessageFromHash(MessageTypes::StorageCreator, @real_storage_creator)
ret = pbGetMessageFromHash(MessageTypes::STORAGE_CREATOR_NAME, @real_storage_creator)
return nil_or_empty?(ret) ? _INTL("Bill") : ret
end
end
@@ -115,7 +115,7 @@ module GameData
# @return [String] the translated name of this map
def name
ret = pbGetMessageFromHash(MessageTypes::MapNames, @real_name)
ret = pbGetMessageFromHash(MessageTypes::MAP_NAMES, @real_name)
ret = pbGetBasicMapNameFromId(@id) if nil_or_empty?(ret)
ret.gsub!(/\\PN/, $player.name) if $player
return ret
@@ -211,9 +211,7 @@ class Battle
oldSpAtk = pkmn.spatk
oldSpDef = pkmn.spdef
oldSpeed = pkmn.speed
if battler&.pokemon
battler.pokemon.changeHappiness("levelup")
end
battler.pokemon.changeHappiness("levelup") if battler&.pokemon
pkmn.calc_stats
battler&.pbUpdate(false)
@scene.pbRefreshOne(battler.index) if battler
@@ -227,7 +227,7 @@ class Battle
end
# Reorder the priority array
if needRearranging
@priority.sort! { |a, b|
@priority.sort! do |a, b|
if a[5] != b[5]
# Sort by priority (highest value first)
b[5] <=> a[5]
@@ -241,7 +241,7 @@ class Battle
# Sort by speed (highest first), and use tie-breaker if necessary
(a[1] == b[1]) ? b[6] <=> a[6] : b[1] <=> a[1]
end
}
end
# Write the priority order to the debug log
logMsg = (fullCalc) ? "[Round order] " : "[Round order recalculated] "
comma = false
@@ -111,7 +111,7 @@ class Battle
# all instances where the party screen is opened.
def pbPartyScreen(idxBattler, checkLaxOnly = false, canCancel = false, shouldRegister = false)
ret = -1
@scene.pbPartyScreen(idxBattler, canCancel) { |idxParty, partyScene|
@scene.pbPartyScreen(idxBattler, canCancel) do |idxParty, partyScene|
if checkLaxOnly
next false if !pbCanSwitchLax?(idxBattler, idxParty, partyScene)
elsif !pbCanSwitch?(idxBattler, idxParty, partyScene)
@@ -122,7 +122,7 @@ class Battle
end
ret = idxParty
next true
}
end
return ret
end
@@ -64,7 +64,7 @@ class Battle
return true if pbAutoFightMenu(idxBattler)
# Regular move selection
ret = false
@scene.pbFightMenu(idxBattler, pbCanMegaEvolve?(idxBattler)) { |cmd|
@scene.pbFightMenu(idxBattler, pbCanMegaEvolve?(idxBattler)) do |cmd|
case cmd
when -1 # Cancel
when -2 # Toggle Mega Evolution
@@ -83,7 +83,7 @@ class Battle
ret = true
end
next true
}
end
return ret
end
@@ -103,7 +103,7 @@ class Battle
return false
end
ret = false
@scene.pbItemMenu(idxBattler, firstAction) { |item, useType, idxPkmn, idxMove, itemScene|
@scene.pbItemMenu(idxBattler, firstAction) do |item, useType, idxPkmn, idxMove, itemScene|
next false if !item
battler = pkmn = nil
case useType
@@ -133,7 +133,7 @@ class Battle
next false if !pbRegisterItem(idxBattler, item, idxPkmn, idxMove)
ret = true
next true
}
end
return ret
end
@@ -57,9 +57,9 @@ class Battle
pbPursuit(b.index)
return if @decision > 0
# Switch Pokémon
allBattlers.each do |b|
b.droppedBelowHalfHP = false
b.statsDropped = false
allBattlers.each do |b2|
b2.droppedBelowHalfHP = false
b2.statsDropped = false
end
pbRecallAndReplace(b.index, idxNewPkmn)
pbOnBattlerEnteringBattle(b.index, true)
@@ -141,9 +141,9 @@ class Battle
next if battler.opposes?(side)
next if !battler.takesIndirectDamage? || battler.pbHasType?(:FIRE)
@scene.pbDamageAnimation(battler)
battler.pbTakeEffectDamage(battler.totalhp / 8, false) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8, false) do |hp_lost|
pbDisplay(_INTL("{1} is hurt by the sea of fire!", battler.pbThis))
}
end
end
end
end
@@ -190,11 +190,11 @@ class Battle
recipient = @battlers[battler.effects[PBEffects::LeechSeed]]
next if !recipient || recipient.fainted?
pbCommonAnimation("LeechSeed", recipient, battler)
battler.pbTakeEffectDamage(battler.totalhp / 8) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8) do |hp_lost|
recipient.pbRecoverHPFromDrain(hp_lost, battler,
_INTL("{1}'s health is sapped by Leech Seed!", battler.pbThis))
recipient.pbAbilitiesOnDamageTaken
}
end
recipient.pbFaint if recipient.fainted?
end
end
@@ -257,16 +257,16 @@ class Battle
priority.each do |battler|
battler.effects[PBEffects::Nightmare] = false if !battler.asleep?
next if !battler.effects[PBEffects::Nightmare] || !battler.takesIndirectDamage?
battler.pbTakeEffectDamage(battler.totalhp / 4) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 4) do |hp_lost|
pbDisplay(_INTL("{1} is locked in a nightmare!", battler.pbThis))
}
end
end
# Curse
priority.each do |battler|
next if !battler.effects[PBEffects::Curse] || !battler.takesIndirectDamage?
battler.pbTakeEffectDamage(battler.totalhp / 4) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 4) do |hp_lost|
pbDisplay(_INTL("{1} is afflicted by the curse!", battler.pbThis))
}
end
end
end
@@ -299,9 +299,9 @@ class Battle
hpLoss = (Settings::MECHANICS_GENERATION >= 6) ? battler.totalhp / 6 : battler.totalhp / 8
end
@scene.pbDamageAnimation(battler)
battler.pbTakeEffectDamage(hpLoss, false) { |hp_lost|
battler.pbTakeEffectDamage(hpLoss, false) do |hp_lost|
pbDisplay(_INTL("{1} is hurt by {2}!", battler.pbThis, move_name))
}
end
end
#=============================================================================
@@ -317,9 +317,9 @@ class Battle
def pbEOREndBattlerEffects(priority)
# Taunt
pbEORCountDownBattlerEffect(priority, PBEffects::Taunt) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Taunt) do |battler|
pbDisplay(_INTL("{1}'s taunt wore off!", battler.pbThis))
}
end
# Encore
priority.each do |battler|
next if battler.fainted? || battler.effects[PBEffects::Encore] == 0
@@ -337,34 +337,34 @@ class Battle
end
end
# Disable/Cursed Body
pbEORCountDownBattlerEffect(priority, PBEffects::Disable) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Disable) do |battler|
battler.effects[PBEffects::DisableMove] = nil
pbDisplay(_INTL("{1} is no longer disabled!", battler.pbThis))
}
end
# Magnet Rise
pbEORCountDownBattlerEffect(priority, PBEffects::MagnetRise) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::MagnetRise) do |battler|
pbDisplay(_INTL("{1}'s electromagnetism wore off!", battler.pbThis))
}
end
# Telekinesis
pbEORCountDownBattlerEffect(priority, PBEffects::Telekinesis) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Telekinesis) do |battler|
pbDisplay(_INTL("{1} was freed from the telekinesis!", battler.pbThis))
}
end
# Heal Block
pbEORCountDownBattlerEffect(priority, PBEffects::HealBlock) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::HealBlock) do |battler|
pbDisplay(_INTL("{1}'s Heal Block wore off!", battler.pbThis))
}
end
# Embargo
pbEORCountDownBattlerEffect(priority, PBEffects::Embargo) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Embargo) do |battler|
pbDisplay(_INTL("{1} can use items again!", battler.pbThis))
battler.pbItemTerrainStatBoostCheck
}
end
# Yawn
pbEORCountDownBattlerEffect(priority, PBEffects::Yawn) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Yawn) do |battler|
if battler.pbCanSleepYawn?
PBDebug.log("[Lingering effect] #{battler.pbThis} fell asleep because of Yawn")
battler.pbSleep
end
}
end
# Perish Song
perishSongUsers = []
priority.each do |battler|
@@ -72,10 +72,10 @@ class Battle::Battler
# in and not at any later times, even if a traceable ability turns
# up later. Essentials ignores this, and allows Trace to trigger
# whenever it can even in Gen 5 battle mechanics.
choices = @battle.allOtherSideBattlers(@index).select { |b|
choices = @battle.allOtherSideBattlers(@index).select do |b|
next !b.ungainableAbility? &&
![:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id)
}
end
if choices.length > 0
choice = choices[@battle.pbRandom(choices.length)]
@battle.pbShowAbilitySplash(self)
@@ -48,9 +48,7 @@ class Battle::Battler
end
# Use the move
PBDebug.log("[Move usage] #{pbThis} started using #{choice[2].name}")
PBDebug.logonerr {
pbUseMove(choice, choice[2] == @battle.struggle)
}
PBDebug.logonerr { pbUseMove(choice, choice[2] == @battle.struggle) }
@battle.pbJudge
# Update priority order
@battle.pbCalculatePriority if Settings::RECALCULATE_TURN_ORDER_AFTER_SPEED_CHANGES
@@ -315,9 +313,9 @@ class Battle::Battler
@battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
user.lastMoveFailed = true
if ![:Rain, :HeavyRain].include?(user.effectiveWeather) && user.takesIndirectDamage?
user.pbTakeEffectDamage((user.totalhp / 4.0).round, false) { |hp_lost|
user.pbTakeEffectDamage((user.totalhp / 4.0).round, false) do |hp_lost|
@battle.pbDisplay(_INTL("{1} is hurt by its {2}!", battler.pbThis, battler.itemName))
}
end
@battle.pbGainExp # In case user is KO'd by this
end
pbCancelMoves
@@ -531,9 +529,9 @@ class Battle::Battler
@battle.pbDisplay(_INTL("{1} used the move instructed by {2}!", b.pbThis, user.pbThis(true)))
b.effects[PBEffects::Instructed] = true
if b.pbCanChooseMove?(@moves[idxMove], false)
PBDebug.logonerr {
PBDebug.logonerr do
b.pbUseMoveSimple(b.lastMoveUsed, b.lastRegularMoveTarget, idxMove, false)
}
end
b.lastRoundMoved = oldLastRoundMoved
@battle.pbJudge
return if @battle.decision > 0
@@ -567,9 +565,7 @@ class Battle::Battler
end
nextUser.effects[PBEffects::Dancer] = true
if nextUser.pbCanChooseMove?(move, false)
PBDebug.logonerr {
nextUser.pbUseMoveSimple(move.id, preTarget)
}
PBDebug.logonerr { nextUser.pbUseMoveSimple(move.id, preTarget) }
nextUser.lastRoundMoved = oldLastRoundMoved
nextUser.effects[PBEffects::Outrage] = oldOutrage
nextUser.currentMove = oldCurrentMove
@@ -716,9 +712,7 @@ class Battle::Battler
next if b.damageState.calcDamage == 0
chance = move.pbAdditionalEffectChance(user, b)
next if chance <= 0
if @battle.pbRandom(100) < chance
move.pbAdditionalEffect(user, b)
end
move.pbAdditionalEffect(user, b) if @battle.pbRandom(100) < chance
end
end
# Make the target flinch (because of an item/ability)
@@ -104,11 +104,11 @@ class Battle::Move
def pbFailsAgainstTarget?(user, target, show_message); return false; end
def pbMoveFailedLastInRound?(user, showMessage = true)
unmoved = @battle.allBattlers.any? { |b|
unmoved = @battle.allBattlers.any? do |b|
next b.index != user.index &&
[:UseMove, :Shift].include?(@battle.choices[b.index][0]) &&
!b.movedThisRound?
}
end
if !unmoved
@battle.pbDisplay(_INTL("But it failed!")) if showMessage
return true
@@ -226,16 +226,12 @@ class Battle::Move
def pbModifyDamage(damageMult, user, target); return damageMult; end
def pbGetAttackStats(user, target)
if specialMove?
return user.spatk, user.stages[:SPECIAL_ATTACK] + 6
end
return user.spatk, user.stages[:SPECIAL_ATTACK] + 6 if specialMove?
return user.attack, user.stages[:ATTACK] + 6
end
def pbGetDefenseStats(user, target)
if specialMove?
return target.spdef, target.stages[:SPECIAL_DEFENSE] + 6
end
return target.spdef, target.stages[:SPECIAL_DEFENSE] + 6 if specialMove?
return target.defense, target.stages[:DEFENSE] + 6
end
@@ -396,9 +392,7 @@ class Battle::Move
end
end
# Multi-targeting attacks
if numTargets > 1
multipliers[:final_damage_multiplier] *= 0.75
end
multipliers[:final_damage_multiplier] *= 0.75 if numTargets > 1
# Weather
case user.effectiveWeather
when :Sun, :HarshSun
@@ -356,8 +356,7 @@ class Battle::Move::TwoTurnMove < Battle::Move
@battle.pbDisplay(_INTL("{1} began charging up!", user.pbThis))
end
def pbAttackingTurnMessage(user, targets)
end
def pbAttackingTurnMessage(user, targets); end
def pbEffectAgainstTarget(user, target)
if @damagingTurn
@@ -372,8 +371,7 @@ class Battle::Move::TwoTurnMove < Battle::Move
# the latter just records the target is being Sky Dropped
end
def pbAttackingTurnEffect(user, target)
end
def pbAttackingTurnEffect(user, target); end
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim
@@ -100,9 +100,7 @@ class Battle::Move::OHKO < Battle::Move::FixedDamageMove
def pbHitEffectivenessMessages(user, target, numTargets = 1)
super
if target.fainted?
@battle.pbDisplay(_INTL("It's a one-hit KO!"))
end
@battle.pbDisplay(_INTL("It's a one-hit KO!")) if target.fainted?
end
end
@@ -1211,9 +1209,7 @@ end
#===============================================================================
class Battle::Move::UseTargetAttackInsteadOfUserAttack < Battle::Move
def pbGetAttackStats(user, target)
if specialMove?
return target.spatk, target.stages[:SPECIAL_ATTACK] + 6
end
return target.spatk, target.stages[:SPECIAL_ATTACK] + 6 if specialMove?
return target.attack, target.stages[:ATTACK] + 6
end
end
@@ -363,8 +363,7 @@ class Battle::Scene
pbShowWindow(MESSAGE_BOX)
end
def pbBeginEndOfRoundPhase
end
def pbBeginEndOfRoundPhase; end
def pbEndBattle(_result)
@abortable = false
@@ -98,15 +98,11 @@ class Battle::Scene
if Input.trigger?(Input::LEFT)
cw.index -= 1 if (cw.index & 1) == 1
elsif Input.trigger?(Input::RIGHT)
if battler.moves[cw.index + 1]&.id && (cw.index & 1) == 0
cw.index += 1
end
cw.index += 1 if battler.moves[cw.index + 1]&.id && (cw.index & 1) == 0
elsif Input.trigger?(Input::UP)
cw.index -= 2 if (cw.index & 2) == 2
elsif Input.trigger?(Input::DOWN)
if battler.moves[cw.index + 2]&.id && (cw.index & 2) == 0
cw.index += 2
end
cw.index += 2 if battler.moves[cw.index + 2]&.id && (cw.index & 2) == 0
end
pbPlayCursorSE if cw.index != oldIndex
# Actions
@@ -449,11 +445,11 @@ class Battle::Scene
# not allow HM moves to be forgotten.
def pbForgetMove(pkmn, moveToLearn)
ret = -1
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
ret = screen.pbStartForgetScreen([pkmn], 0, moveToLearn)
}
end
return ret
end
@@ -468,10 +464,10 @@ class Battle::Scene
# Shows the Pokédex entry screen for a newly caught Pokémon
#=============================================================================
def pbShowPokedex(species)
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbDexEntry(species)
}
end
end
end
@@ -137,9 +137,7 @@ class Battle::Scene
a[2] = true if a[1].animDone?
end
pbUpdate
if !inPartyAnimation? && sendOutAnims.none? { |a| !a[2] }
break
end
break if !inPartyAnimation? && sendOutAnims.none? { |a| !a[2] }
end
fadeAnim.dispose
sendOutAnims.each do |a|
@@ -498,13 +496,13 @@ class Battle::Scene
target = (targets.is_a?(Array)) ? targets[0] : targets
animations = pbLoadBattleAnimations
return if !animations
pbSaveShadows {
pbSaveShadows do
if animID[1] # On opposing side and using OppMove animation
pbAnimationCore(animations[anim], target, user, true)
else # On player's side, and/or using Move animation
pbAnimationCore(animations[anim], user, target)
end
}
end
end
# Plays a common animation.
@@ -401,8 +401,8 @@ module Battle::Scene::Animation::BallAnimationMixin
angle = rand(360)
radian = (angle + 90) * Math::PI / 180
start_zoom = rand(50...100)
ray = addNewSprite(ballX + ray_min_radius * Math.cos(radian),
ballY - ray_min_radius * Math.sin(radian),
ray = addNewSprite(ballX + (ray_min_radius * Math.cos(radian)),
ballY - (ray_min_radius * Math.sin(radian)),
"Graphics/Battle animations/ballBurst_ray", PictureOrigin::BOTTOM)
ray.setZ(0, 100)
ray.setZoomXY(0, 200, start_zoom)
@@ -411,7 +411,7 @@ module Battle::Scene::Animation::BallAnimationMixin
ray.setVisible(0, false)
ray.setAngle(0, angle)
# Animate ray
start = delay + i / 2
start = delay + (i / 2)
ray.setVisible(start, true)
ray.moveZoomXY(start, ray_lifetime, 200, start_zoom * 6)
ray.moveOpacity(start, 2, 255) # Quickly fade in
@@ -437,7 +437,7 @@ module Battle::Scene::Animation::BallAnimationMixin
particle.setVisible(0, false)
end
# Animate particles
start = delay + i / 4
start = delay + (i / 4)
max_radius = rand(256...384)
angle = rand(360)
radian = angle * Math::PI / 180
@@ -596,7 +596,7 @@ module Battle::Scene::Animation::BallAnimationMixin
else
glare1.moveZoom(delay, particle_duration, 600)
end
glare1.moveOpacity(delay + particle_duration / 2, particle_duration / 2, 0)
glare1.moveOpacity(delay + (particle_duration / 2), particle_duration / 2, 0)
[glare1, glare2, glare3].each_with_index do |particle, num|
particle.moveTone(delay, particle_duration, variances[8 - (3 * num)])
end
@@ -604,13 +604,13 @@ module Battle::Scene::Animation::BallAnimationMixin
glare2.moveZoom(delay, particle_duration, 350)
glare3.moveZoom(delay, particle_duration, 500)
[glare2, glare3].each_with_index do |particle, num|
particle.moveOpacity(delay + particle_duration / 2, particle_duration / 2, 0)
particle.moveOpacity(delay + (particle_duration / 2), particle_duration / 2, 0)
end
else
glare2.moveZoom(delay, particle_duration, (poke_ball == :MASTERBALL) ? 400 : 250)
glare2.moveOpacity(delay + particle_duration / 2, particle_duration / 3, 0)
glare2.moveOpacity(delay + (particle_duration / 2), particle_duration / 3, 0)
glare3.moveZoom(delay, particle_duration, (poke_ball == :MASTERBALL) ? 800 : 500)
glare3.moveOpacity(delay + particle_duration / 2, particle_duration / 3, 0)
glare3.moveOpacity(delay + (particle_duration / 2), particle_duration / 3, 0)
end
[glare1, glare2, glare3].each { |p| p.setVisible(delay + particle_duration, false) }
# Burst particles
@@ -647,12 +647,12 @@ module Battle::Scene::Animation::BallAnimationMixin
prop = 2 - prop if index > particle_duration / 2
radius *= prop
particle1.moveXY(delay + j, 1,
ballX + p1_x_offset * index * 2 / particle_duration,
ballY - p1_y_offset * index * 2 / particle_duration)
ballX + (p1_x_offset * index * 2 / particle_duration),
ballY - (p1_y_offset * index * 2 / particle_duration))
[particle2, particle3].each do |particle|
particle.moveXY(delay + j, 1,
ballX + radius * Math.cos(radian),
ballY - radius * Math.sin(radian))
ballX + (radius * Math.cos(radian)),
ballY - (radius * Math.sin(radian)))
end
end
particle1.moveZoom(delay, particle_duration, 0)
@@ -674,14 +674,14 @@ module Battle::Scene::Animation::BallAnimationMixin
end
# Zoom out
if ["particle", "dazzle", "ring3", "ring4", "diamond"].include?(variances[12 - (3 * num)])
particle.moveZoom(delay + particle_duration * 2 / 3, particle_duration / 3, 10)
particle.moveZoom(delay + (particle_duration * 2 / 3), particle_duration / 3, 10)
else
particle.moveZoom(delay + particle_duration * 2 / 3, particle_duration / 3, 25)
particle.moveZoom(delay + (particle_duration * 2 / 3), particle_duration / 3, 25)
end
# Rotate (for Premier Ball)
particle.moveAngle(delay, particle_duration, -180) if poke_ball == :PREMIERBALL
# Change tone, fade out
particle.moveTone(delay + particle_duration / 3, (particle_duration.to_f / 3).ceil, variances[14 - (3 * num)])
particle.moveTone(delay + (particle_duration / 3), (particle_duration.to_f / 3).ceil, variances[14 - (3 * num)])
particle.moveOpacity(delay + particle_duration - 3, 3, 128) # Fade out at end
end
[particle1, particle2, particle3].each { |p| p.setVisible(delay + particle_duration, false) }
@@ -702,7 +702,7 @@ module Battle::Scene::Animation::BallAnimationMixin
web.moveZoom(delay + start + (i * 4), 2, 150)
web.moveZoom(delay + start + (i * 4) + 2, 2, 120)
end
now = start + (web_duration / 4) * 4
now = start + ((web_duration / 4) * 4)
web.moveZoom(delay + now, particle_duration + ring_duration - now, 150)
web.moveOpacity(delay + particle_duration, ring_duration, 0)
web.setVisible(delay + particle_duration + ring_duration, false)
@@ -747,10 +747,10 @@ module Battle::Scene::Animation::BallAnimationMixin
index = j + 1
x = 72 * index / star_duration
proportion = index.to_f / star_duration
a = (2 * y_pos[2]) - 4 * y_pos[1]
a = (2 * y_pos[2]) - (4 * y_pos[1])
b = y_pos[2] - a
y = ((a * proportion) + b) * proportion
star.moveXY(delay + j, 1, ballX + [-1, 0, 1][i] * x, ballY - y)
star.moveXY(delay + j, 1, ballX + ([-1, 0, 1][i] * x), ballY - y)
end
star.moveAngle(delay, star_duration, start_angle + [144, 0, 45][i]) if i.even?
star.moveOpacity(delay, 4, 255) # Fade in
@@ -789,17 +789,17 @@ module Battle::Scene::Animation::BallAnimationMixin
prop = j.to_f / (color_duration / 3)
radius *= 0.75 + (prop / 4)
elsif j >= burst_duration / 2
prop = (j.to_f - burst_duration / 2) / (burst_duration / 2)
prop = (j.to_f - (burst_duration / 2)) / (burst_duration / 2)
radius *= 1 - prop
end
if j == 0
particle.setXY(delay + j, ballX + radius * Math.cos(radian), ballY - radius * Math.sin(radian))
particle.setXY(delay + j, ballX + (radius * Math.cos(radian)), ballY - (radius * Math.sin(radian)))
else
particle.moveXY(delay + j, 1, ballX + radius * Math.cos(radian), ballY - radius * Math.sin(radian))
particle.moveXY(delay + j, 1, ballX + (radius * Math.cos(radian)), ballY - (radius * Math.sin(radian)))
end
end
particle.moveZoom(delay, burst_duration, 0)
particle.moveTone(delay + color_duration / 2, color_duration / 2, Tone.new(0, 0, -192)) # Yellow
particle.moveTone(delay + (color_duration / 2), color_duration / 2, Tone.new(0, 0, -192)) # Yellow
particle.moveTone(delay + color_duration, shrink_duration, Tone.new(0, -128, -248)) # Dark orange
particle.moveOpacity(delay + color_duration, shrink_duration, 0) # Fade out at end
particle.setVisible(delay + burst_duration, false)
@@ -323,10 +323,10 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
partyBar.setVisible(delay + 12, false)
partyBar.setOpacity(delay + 12, 255)
end
Battle::Scene::NUM_BALLS.times do |i|
next if !@sprites["partyBall_0_#{i}"] || !@sprites["partyBall_0_#{i}"].visible
partyBall = addSprite(@sprites["partyBall_0_#{i}"])
partyBall.moveDelta(delay + (2 * i), 16, -Graphics.width, 0) if @fullAnim
Battle::Scene::NUM_BALLS.times do |j|
next if !@sprites["partyBall_0_#{j}"] || !@sprites["partyBall_0_#{j}"].visible
partyBall = addSprite(@sprites["partyBall_0_#{j}"])
partyBall.moveDelta(delay + (2 * j), 16, -Graphics.width, 0) if @fullAnim
partyBall.moveOpacity(delay, 12, 0)
partyBall.setVisible(delay + 12, false)
partyBall.setOpacity(delay + 12, 255)
@@ -366,10 +366,10 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
partyBar.setVisible(delay + 12, false)
partyBar.setOpacity(delay + 12, 255)
end
Battle::Scene::NUM_BALLS.times do |i|
next if !@sprites["partyBall_1_#{i}"] || !@sprites["partyBall_1_#{i}"].visible
partyBall = addSprite(@sprites["partyBall_1_#{i}"])
partyBall.moveDelta(delay + (2 * i), 16, Graphics.width, 0) if @fullAnim
Battle::Scene::NUM_BALLS.times do |j|
next if !@sprites["partyBall_1_#{j}"] || !@sprites["partyBall_1_#{j}"].visible
partyBall = addSprite(@sprites["partyBall_1_#{j}"])
partyBall.moveDelta(delay + (2 * j), 16, Graphics.width, 0) if @fullAnim
partyBall.moveOpacity(delay, 12, 0)
partyBall.setVisible(delay + 12, false)
partyBall.setOpacity(delay + 12, 255)
@@ -26,10 +26,10 @@ module Battle::CatchAndStoreMixin
when 0 # Add to your party
pbDisplay(_INTL("Choose a Pokémon in your party to send to your Boxes."))
party_index = -1
@scene.pbPartyScreen(0, (@sendToBoxes != 2), 1) { |idxParty, _partyScene|
@scene.pbPartyScreen(0, (@sendToBoxes != 2), 1) do |idxParty, _partyScene|
party_index = idxParty
next true
}
end
next if party_index < 0 # Cancelled
party_size = pbPlayer.party.length
# Send chosen Pokémon to storage
@@ -56,11 +56,11 @@ module Battle::CatchAndStoreMixin
when 1 # Send to a Box
break
when 2 # See X's summary
pbFadeOutIn {
pbFadeOutIn do
summary_scene = PokemonSummary_Scene.new
summary_screen = PokemonSummaryScreen.new(summary_scene, true)
summary_screen.pbStartScreen([pkmn], 0)
}
end
when 3 # Check party
@scene.pbPartyScreen(0, true, 2)
end
@@ -1240,9 +1240,7 @@ Battle::AbilityEffects::DamageCalcFromUser.add(:DRAGONSMAW,
Battle::AbilityEffects::DamageCalcFromUser.add(:FLAREBOOST,
proc { |ability, user, target, move, mults, baseDmg, type|
if user.burned? && move.specialMove?
mults[:base_damage_multiplier] *= 1.5
end
mults[:base_damage_multiplier] *= 1.5 if user.burned? && move.specialMove?
}
)
@@ -1384,9 +1382,7 @@ Battle::AbilityEffects::DamageCalcFromUser.add(:SOLARPOWER,
Battle::AbilityEffects::DamageCalcFromUser.add(:SNIPER,
proc { |ability, user, target, move, mults, baseDmg, type|
if target.damageState.critical
mults[:final_damage_multiplier] *= 1.5
end
mults[:final_damage_multiplier] *= 1.5 if target.damageState.critical
}
)
@@ -1546,9 +1542,7 @@ Battle::AbilityEffects::DamageCalcFromTarget.add(:FURCOAT,
Battle::AbilityEffects::DamageCalcFromTarget.add(:GRASSPELT,
proc { |ability, user, target, move, mults, baseDmg, type|
if user.battle.field.terrain == :Grassy
mults[:defense_multiplier] *= 1.5
end
mults[:defense_multiplier] *= 1.5 if user.battle.field.terrain == :Grassy
}
)
@@ -1610,9 +1604,7 @@ Battle::AbilityEffects::DamageCalcFromTargetNonIgnorable.add(:PRISMARMOR,
Battle::AbilityEffects::DamageCalcFromTargetNonIgnorable.add(:SHADOWSHIELD,
proc { |ability, user, target, move, mults, baseDmg, type|
if target.hp == target.totalhp
mults[:final_damage_multiplier] /= 2
end
mults[:final_damage_multiplier] /= 2 if target.hp == target.totalhp
}
)
@@ -2425,7 +2417,7 @@ Battle::AbilityEffects::EndOfRoundEffect.add(:BADDREAMS,
next if !b.near?(battler) || !b.asleep?
battle.pbShowAbilitySplash(battler)
next if !b.takesIndirectDamage?(Battle::Scene::USE_ABILITY_SPLASH)
b.pbTakeEffectDamage(b.totalhp / 8) { |hp_lost|
b.pbTakeEffectDamage(b.totalhp / 8) do |hp_lost|
if Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1} is tormented!", b.pbThis))
else
@@ -2433,7 +2425,7 @@ Battle::AbilityEffects::EndOfRoundEffect.add(:BADDREAMS,
b.pbThis, battler.pbThis(true), battler.abilityName))
end
battle.pbHideAbilitySplash(battler)
}
end
end
}
)
@@ -889,9 +889,7 @@ Battle::ItemEffects::DamageCalcFromUser.add(:LIFEORB,
Battle::ItemEffects::DamageCalcFromUser.add(:LIGHTBALL,
proc { |item, user, target, move, mults, baseDmg, type|
if user.isSpecies?(:PIKACHU)
mults[:attack_multiplier] *= 2
end
mults[:attack_multiplier] *= 2 if user.isSpecies?(:PIKACHU)
}
)
@@ -1844,9 +1842,9 @@ Battle::ItemEffects::EndOfRoundHealing.add(:BLACKSLUDGE,
battler.pbThis, battler.itemName))
elsif battler.takesIndirectDamage?
battle.pbCommonAnimation("UseItem", battler)
battler.pbTakeEffectDamage(battler.totalhp / 8) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8) do |hp_lost|
battle.pbDisplay(_INTL("{1} is hurt by its {2}!", battler.pbThis, battler.itemName))
}
end
end
}
)
@@ -1876,9 +1874,9 @@ Battle::ItemEffects::EndOfRoundEffect.add(:STICKYBARB,
proc { |item, battler, battle|
next if !battler.takesIndirectDamage?
battle.scene.pbDamageAnimation(battler)
battler.pbTakeEffectDamage(battler.totalhp / 8, false) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8, false) do |hp_lost|
battle.pbDisplay(_INTL("{1} is hurt by its {2}!", battler.pbThis, battler.itemName))
}
end
}
)
@@ -271,10 +271,10 @@ class Battle::Scene
msgwindow = pbCreateMessageWindow
dimmingvp = Viewport.new(0, 0, Graphics.width, Graphics.height - msgwindow.height)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!\\wtnp[20]")) {
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!\\wtnp[20]")) do
pbBattleArenaUpdate
dimmingvp.update
}
end
dimmingvp.z = 99999
infowindow = SpriteWindow_Base.new(80, 0, 320, 224)
infowindow.contents = Bitmap.new(infowindow.width - infowindow.borderX,
@@ -299,25 +299,25 @@ class Battle::Scene
end
updateJudgment(infowindow, 1, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!\\wtnp[40]")) {
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!\\wtnp[40]")) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
updateJudgment(infowindow, 2, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!\\wtnp[40]")) {
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!\\wtnp[40]")) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
updateJudgment(infowindow, 3, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!\\wtnp[40]")) {
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!\\wtnp[40]")) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
total1 = 0
total2 = 0
3.times do |i|
@@ -326,27 +326,27 @@ class Battle::Scene
end
if total1 == total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!\\wtnp[40]", total1, total2)) {
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!\\wtnp[40]", total1, total2)) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
elsif total1 > total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}'s {4}!\\wtnp[40]",
total1, total2, @battle.pbGetOwnerName(battler1.index), battler1.name)) {
total1, total2, @battle.pbGetOwnerName(battler1.index), battler1.name)) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
else
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}!\\wtnp[40]",
total1, total2, battler2.name)) {
total1, total2, battler2.name)) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
end
infowindow.visible = false
msgwindow.visible = false
+56 -56
View File
@@ -448,52 +448,52 @@ end
# Event movement
#===============================================================================
module PBMoveRoute
Down = 1
Left = 2
Right = 3
Up = 4
LowerLeft = 5
LowerRight = 6
UpperLeft = 7
UpperRight = 8
Random = 9
TowardPlayer = 10
AwayFromPlayer = 11
Forward = 12
Backward = 13
Jump = 14 # xoffset, yoffset
Wait = 15 # frames
TurnDown = 16
TurnLeft = 17
TurnRight = 18
TurnUp = 19
TurnRight90 = 20
TurnLeft90 = 21
Turn180 = 22
TurnRightOrLeft90 = 23
TurnRandom = 24
TurnTowardPlayer = 25
TurnAwayFromPlayer = 26
SwitchOn = 27 # 1 param
SwitchOff = 28 # 1 param
ChangeSpeed = 29 # 1 param
ChangeFreq = 30 # 1 param
WalkAnimeOn = 31
WalkAnimeOff = 32
StepAnimeOn = 33
StepAnimeOff = 34
DirectionFixOn = 35
DirectionFixOff = 36
ThroughOn = 37
ThroughOff = 38
AlwaysOnTopOn = 39
AlwaysOnTopOff = 40
Graphic = 41 # Name, hue, direction, pattern
Opacity = 42 # 1 param
Blending = 43 # 1 param
PlaySE = 44 # 1 param
Script = 45 # 1 param
ScriptAsync = 101 # 1 param
DOWN = 1
LEFT = 2
RRIGHT = 3
UP = 4
LOWER_LEFT = 5
LOWER_RIGHT = 6
UPPER_LEFT = 7
UPPER_RIGHT = 8
RANDOM = 9
TOWARD_PLAYER = 10
AWAY_FROM_PLAYER = 11
FORWARD = 12
BACKWARD = 13
JUMP = 14 # xoffset, yoffset
WAIT = 15 # frames
TURN_DOWN = 16
TURN_LEFT = 17
TURN_RIGHT = 18
TURN_UP = 19
TURN_RIGHT90 = 20
TURN_LEFT90 = 21
TURN180 = 22
TURN_RIGHT_OR_LEFT90 = 23
TURN_RANDOM = 24
TURN_TOWARD_PLAYER = 25
TURN_AWAY_FROM_PLAYER = 26
SWITCH_ON = 27 # 1 param
SWITCH_OFF = 28 # 1 param
CHANGE_SPEED = 29 # 1 param
CHANGE_FREQUENCY = 30 # 1 param
WALK_ANIME_ON = 31
WALK_ANIME_OFF = 32
STEP_ANIME_ON = 33
STEP_ANIME_OFF = 34
DIRECTION_FIX_ON = 35
DIRECTION_FIX_OFF = 36
THROUGH_ON = 37
THROUGH_OFF = 38
ALWAYS_ON_TOP_ON = 39
ALWAYS_ON_TOP_OFF = 40
GRAPHIC = 41 # Name, hue, direction, pattern
OPACITY = 42 # 1 param
BLENDING = 43 # 1 param
PLAY_SE = 44 # 1 param
SCRIPT = 45 # 1 param
SCRIPT_ASYNC = 101 # 1 param
end
def pbMoveRoute(event, commands, waitComplete = false)
@@ -501,23 +501,23 @@ def pbMoveRoute(event, commands, waitComplete = false)
route.repeat = false
route.skippable = true
route.list.clear
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::THROUGH_ON))
i = 0
while i < commands.length
case commands[i]
when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script
when PBMoveRoute::WAIT, PBMoveRoute::SWITCH_ON, PBMoveRoute::SWITCH_OFF,
PBMoveRoute::CHANGE_SPEED, PBMoveRoute::CHANGE_FREQUENCY, PBMoveRoute::OPACITY,
PBMoveRoute::BLENDING, PBMoveRoute::PLAY_SE, PBMoveRoute::SCRIPT
route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1]]))
i += 1
when PBMoveRoute::ScriptAsync
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script, [commands[i + 1]]))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait, [0]))
when PBMoveRoute::SCRIPT_ASYNC
route.list.push(RPG::MoveCommand.new(PBMoveRoute::SCRIPT, [commands[i + 1]]))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::WAIT, [0]))
i += 1
when PBMoveRoute::Jump
when PBMoveRoute::JUMP
route.list.push(RPG::MoveCommand.new(commands[i], [commands[i + 1], commands[i + 2]]))
i += 2
when PBMoveRoute::Graphic
when PBMoveRoute::GRAPHIC
route.list.push(RPG::MoveCommand.new(commands[i],
[commands[i + 1], commands[i + 2],
commands[i + 3], commands[i + 4]]))
@@ -527,7 +527,7 @@ def pbMoveRoute(event, commands, waitComplete = false)
end
i += 1
end
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOff))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::THROUGH_OFF))
route.list.push(RPG::MoveCommand.new(0))
event&.force_move_route(route)
return route
@@ -390,12 +390,10 @@ class WildBattle
$game_temp.clear_battle_rules
# Perform the battle itself
outcome = 0
pbBattleAnimation(pbGetWildBattleBGM(foe_party), (foe_party.length == 1) ? 0 : 2, foe_party) {
pbSceneStandby {
outcome = battle.pbStartBattle
}
pbBattleAnimation(pbGetWildBattleBGM(foe_party), (foe_party.length == 1) ? 0 : 2, foe_party) do
pbSceneStandby { outcome = battle.pbStartBattle }
BattleCreationHelperMethods.after_battle(outcome, can_lose)
}
end
Input.update
# Save the result of the battle in a Game Variable (1 by default)
BattleCreationHelperMethods.set_outcome(outcome, outcome_variable)
@@ -512,12 +510,10 @@ class TrainerBattle
$game_temp.clear_battle_rules
# Perform the battle itself
outcome = 0
pbBattleAnimation(pbGetTrainerBattleBGM(foe_trainers), (battle.singleBattle?) ? 1 : 3, foe_trainers) {
pbSceneStandby {
outcome = battle.pbStartBattle
}
pbBattleAnimation(pbGetTrainerBattleBGM(foe_trainers), (battle.singleBattle?) ? 1 : 3, foe_trainers) do
pbSceneStandby { outcome = battle.pbStartBattle }
BattleCreationHelperMethods.after_battle(outcome, can_lose)
}
end
Input.update
# Save the result of the battle in a Game Variable (1 by default)
BattleCreationHelperMethods.set_outcome(outcome, outcome_variable, true)
@@ -219,9 +219,7 @@ HiddenMoveHandlers::UseMove.add(:CUT, proc { |move, pokemon|
end
$stats.cut_count += 1
facingEvent = $game_player.pbFacingEvent
if facingEvent
pbSmashEvent(facingEvent)
end
pbSmashEvent(facingEvent) if facingEvent
next true
})
@@ -232,13 +230,10 @@ def pbSmashEvent(event)
elsif event.name[/smashrock/i]
pbSEPlay("Rock Smash", 80)
end
pbMoveRoute(event, [PBMoveRoute::Wait, 2,
PBMoveRoute::TurnLeft,
PBMoveRoute::Wait, 2,
PBMoveRoute::TurnRight,
PBMoveRoute::Wait, 2,
PBMoveRoute::TurnUp,
PBMoveRoute::Wait, 2])
pbMoveRoute(event, [PBMoveRoute::WAIT, 2,
PBMoveRoute::TURN_LEFT, PBMoveRoute::WAIT, 2,
PBMoveRoute::TURN_RIGHT, PBMoveRoute::WAIT, 2,
PBMoveRoute::TURN_UP, PBMoveRoute::WAIT, 2])
pbWait(Graphics.frame_rate * 4 / 10)
event.erase
$PokemonMap&.addErasedEvent(event.id)
@@ -273,7 +268,7 @@ HiddenMoveHandlers::UseMove.add(:DIG, proc { |move, pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
end
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = escape[0]
$game_temp.player_new_x = escape[1]
$game_temp.player_new_y = escape[2]
@@ -282,7 +277,7 @@ HiddenMoveHandlers::UseMove.add(:DIG, proc { |move, pokemon|
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
end
pbEraseEscapePoint
next true
end
@@ -306,7 +301,7 @@ def pbDive
speciesname = (movefinder) ? movefinder.name : $player.name
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
pbHiddenMoveAnimation(movefinder)
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = map_metadata.dive_map_id
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = $game_player.y
@@ -318,7 +313,7 @@ def pbDive
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
return true
end
return false
@@ -344,7 +339,7 @@ def pbSurfacing
speciesname = (movefinder) ? movefinder.name : $player.name
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
pbHiddenMoveAnimation(movefinder)
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = surface_map_id
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = $game_player.y
@@ -356,7 +351,7 @@ def pbSurfacing
surfbgm = GameData::Metadata.get.surf_BGM
(surfbgm) ? pbBGMPlay(surfbgm) : $game_map.autoplayAsCue
$game_map.refresh
}
end
return true
end
return false
@@ -365,7 +360,7 @@ end
# @deprecated This method is slated to be removed in v21.
def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
Deprecation.warn_method("pbTransferUnderwater", "v21", '"Transfer Player" event command')
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = mapid
$game_temp.player_new_x = x
$game_temp.player_new_y = y
@@ -373,7 +368,7 @@ def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
end
EventHandlers.add(:on_player_interact, :diving,
@@ -438,7 +433,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE, proc { |move, pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
end
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = dive_map_id
$game_temp.player_new_x = $game_player.x
$game_temp.player_new_y = $game_player.y
@@ -449,7 +444,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE, proc { |move, pokemon|
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
next true
})
@@ -518,7 +513,7 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
pbMessage(_INTL("{1} used {2}!", name, GameData::Move.get(move).name))
end
$stats.fly_count += 1
pbFadeOutIn {
pbFadeOutIn do
pbSEPlay("Fly")
$game_temp.player_new_map_id = $game_temp.fly_destination[0]
$game_temp.player_new_x = $game_temp.fly_destination[1]
@@ -531,7 +526,7 @@ def pbFlyToNewLocation(pkmn = nil, move = :FLY)
$game_map.refresh
yield if block_given?
pbWait(Graphics.frame_rate / 4)
}
end
pbEraseEscapePoint
return true
end
@@ -763,7 +758,7 @@ end
# @deprecated This method is slated to be removed in v21.
def pbTransferSurfing(mapid, xcoord, ycoord, direction = $game_player.direction)
Deprecation.warn_method("pbTransferSurfing", "v21", '"Transfer Player" event command')
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = mapid
$game_temp.player_new_x = xcoord
$game_temp.player_new_y = ycoord
@@ -771,7 +766,7 @@ def pbTransferSurfing(mapid, xcoord, ycoord, direction = $game_player.direction)
$scene.transfer_player(false)
$game_map.autoplay
$game_map.refresh
}
end
end
EventHandlers.add(:on_player_interact, :start_surfing,
@@ -923,7 +918,7 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT, proc { |move, pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
end
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = healing[0]
$game_temp.player_new_x = healing[1]
$game_temp.player_new_y = healing[2]
@@ -932,7 +927,7 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT, proc { |move, pokemon|
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
end
pbEraseEscapePoint
next true
})
@@ -50,33 +50,27 @@ def pbFishing(hasEncounter, rodType = 1)
message = ""
time.times { message += ". " }
if pbWaitMessage(msgWindow, time)
pbFishingEnd {
pbMessageDisplay(msgWindow, _INTL("Not even a nibble..."))
}
pbFishingEnd { pbMessageDisplay(msgWindow, _INTL("Not even a nibble...")) }
break
end
if hasEncounter && rand(100) < biteChance
$scene.spriteset.addUserAnimation(Settings::EXCLAMATION_ANIMATION_ID, $game_player.x, $game_player.y, true, 3)
frames = Graphics.frame_rate - rand(Graphics.frame_rate / 2) # 0.5-1 second
if !pbWaitForInput(msgWindow, message + _INTL("\r\nOh! A bite!"), frames)
pbFishingEnd {
pbMessageDisplay(msgWindow, _INTL("The Pokémon got away..."))
}
pbFishingEnd { pbMessageDisplay(msgWindow, _INTL("The Pokémon got away...")) }
break
end
if Settings::FISHING_AUTO_HOOK || rand(100) < hookChance
pbFishingEnd {
pbFishingEnd do
pbMessageDisplay(msgWindow, _INTL("Landed a Pokémon!")) if !Settings::FISHING_AUTO_HOOK
}
end
ret = true
break
end
# biteChance += 15
# hookChance += 15
else
pbFishingEnd {
pbMessageDisplay(msgWindow, _INTL("Not even a nibble..."))
}
pbFishingEnd { pbMessageDisplay(msgWindow, _INTL("Not even a nibble...")) }
break
end
end
@@ -381,11 +381,11 @@ def pbBerryPlant
[_INTL("Fertilize"), _INTL("Plant Berry"), _INTL("Exit")], -1)
when 0 # Fertilize
mulch = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
mulch = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_mulch? })
}
end
return if !mulch
mulch_data = GameData::Item.get(mulch)
if mulch_data.is_mulch?
@@ -408,11 +408,11 @@ def pbBerryPlant
ask_to_plant = false
end
if !ask_to_plant || pbConfirmMessage(_INTL("Want to plant a Berry?"))
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
berry = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_berry? })
}
end
if berry
$stats.berries_planted += 1
berry_plant.plant(berry)
@@ -404,7 +404,7 @@ class DayCare
end
end
#=============================================================================
#-----------------------------------------------------------------------------
def self.count
return $PokemonGlobal.day_care.count
@@ -494,7 +494,7 @@ class DayCare
day_care.reset_egg_counters
end
#=============================================================================
#-----------------------------------------------------------------------------
private
@@ -512,8 +512,8 @@ module RandomDungeon
start = nil
maxWidth = @usable_width - (@buffer_x * 2)
maxHeight = @usable_height - (@buffer_y * 2)
for y in 0...maxHeight
for x in 0...maxWidth
maxHeight.times do |y|
maxWidth.times do |x|
next if !tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
start = [x, y]
break
@@ -535,10 +535,10 @@ module RandomDungeon
checking = to_check.shift
x1, x2, y, dy = checking
x = x1
if !visited[y * maxWidth + x] && tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
if !visited[(y * maxWidth) + x] && tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
loop do
break if visited[y * maxWidth + x - 1] || !tile_is_ground?(@map_data[x - 1 + @buffer_x, y + @buffer_y, 0])
visited[y * maxWidth + x - 1] = true
break if visited[(y * maxWidth) + x - 1] || !tile_is_ground?(@map_data[x - 1 + @buffer_x, y + @buffer_y, 0])
visited[(y * maxWidth) + x - 1] = true
x -= 1
end
end
@@ -546,8 +546,8 @@ module RandomDungeon
loop do
break if x1 > x2
loop do
break if visited[y * maxWidth + x1] || !tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
visited[y * maxWidth + x1] = true
break if visited[(y * maxWidth) + x1] || !tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
visited[(y * maxWidth) + x1] = true
to_check.push([x, x1, y + dy, dy])
to_check.push([x2 + 1, x1, y - dy, -dy]) if x1 > x2
x1 += 1
@@ -555,16 +555,16 @@ module RandomDungeon
x1 += 1
loop do
break if x1 >= x2
break if !visited[y * maxWidth + x1] && tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
break if !visited[(y * maxWidth) + x1] && tile_is_ground?(@map_data[x1 + @buffer_x, y + @buffer_y, 0])
x1 += 1
end
x = x1
end
end
# Check for unflooded floor tiles
for y in 0...maxHeight
for x in 0...maxWidth
next if visited[y * maxWidth + x] || !tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
maxHeight.times do |y|
maxWidth.times do |x|
next if visited[(y * maxWidth) + x] || !tile_is_ground?(@map_data[x + @buffer_x, y + @buffer_y, 0])
@need_redraw = true
break
end
@@ -824,9 +824,9 @@ module RandomDungeon
def get_wall_tile_for_coord(x, y, layer = 0)
if layer == 0
is_neighbour = lambda { |x, y| return tile_is_ground?(@map_data.value(x, y)) }
is_neighbour = lambda { |x2, y2| return tile_is_ground?(@map_data.value(x2, y2)) }
else
is_neighbour = lambda { |x, y| return tile_is_wall?(@map_data[x, y, 1]) }
is_neighbour = lambda { |x2, y2| return tile_is_wall?(@map_data[x2, y2, 1]) }
end
neighbours = 0
neighbours |= 0x01 if is_neighbour.call(x, y - 1) # N
@@ -863,8 +863,8 @@ module RandomDungeon
(maxWidth / @parameters.cell_width).times do |i|
next if rand(100) >= @parameters.floor_patch_chance
# Random placing of floor patch tiles
mid_x = i * @parameters.cell_width + rand(@parameters.cell_width)
mid_y = j * @parameters.cell_height + rand(@parameters.cell_height)
mid_x = (i * @parameters.cell_width) + rand(@parameters.cell_width)
mid_y = (j * @parameters.cell_height) + rand(@parameters.cell_height)
((mid_y - @parameters.floor_patch_radius)..(mid_y + @parameters.floor_patch_radius)).each do |y|
((mid_x - @parameters.floor_patch_radius)..(mid_x + @parameters.floor_patch_radius)).each do |x|
if @tileset.floor_patch_under_walls
@@ -989,7 +989,7 @@ module RandomDungeon
when :void_decoration_large, :floor_decoration_large
4.times do |c|
tile = @tileset.get_random_tile_of_type(tile_type, self, i, j, layer)
tile += (c % 2) + 8 * (c / 2) if tile >= 384 # Regular tile
tile += (c % 2) + (8 * (c / 2)) if tile >= 384 # Regular tile
map.data[i + (c % 2), j + (c / 2), layer] = tile
end
else
+14 -14
View File
@@ -190,13 +190,13 @@ def pbChangeLevel(pkmn, new_level, scene)
# Check for evolution
new_species = pkmn.check_evolution_on_level_up
if new_species
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
}
end
end
end
end
@@ -299,13 +299,13 @@ def pbChangeExp(pkmn, new_exp, scene)
# Check for evolution
new_species = pkmn.check_evolution_on_level_up
if new_species
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
}
end
end
end
end
@@ -624,11 +624,11 @@ end
def pbForgetMove(pkmn, moveToLearn)
ret = -1
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
ret = screen.pbStartForgetScreen([pkmn], 0, moveToLearn)
}
end
return ret
end
@@ -653,7 +653,7 @@ def pbUseItem(bag, item, bagscene = nil)
annot.push((elig) ? _INTL("ABLE") : _INTL("NOT ABLE"))
end
end
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
screen.pbStartScene(_INTL("Use on which Pokémon?"), false, annot)
@@ -685,7 +685,7 @@ def pbUseItem(bag, item, bagscene = nil)
end
screen.pbEndScene
bagscene&.pbRefresh
}
end
return (ret) ? 1 : 0
elsif useType == 2 || itm.is_machine? # Item is usable from Bag or teaches a move
intret = ItemHandlers.triggerUseFromBag(item)
@@ -853,33 +853,33 @@ end
#===============================================================================
def pbChooseItem(var = 0, *args)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen
}
end
$game_variables[var] = ret || :NONE if var > 0
return ret
end
def pbChooseApricorn(var = 0)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_apricorn? })
}
end
$game_variables[var] = ret || :NONE if var > 0
return ret
end
def pbChooseFossil(var = 0)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).is_fossil? })
}
end
$game_variables[var] = ret || :NONE if var > 0
return ret
end
+47 -49
View File
@@ -54,13 +54,13 @@ ItemHandlers::UseFromBag.add(:ITEMFINDER, proc { |item|
ItemHandlers::UseFromBag.copy(:ITEMFINDER, :DOWSINGMCHN, :DOWSINGMACHINE)
ItemHandlers::UseFromBag.add(:TOWNMAP, proc { |item|
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonRegionMap_Scene.new(-1, false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
$game_temp.fly_destination = ret if ret
next 99999 if ret # Ugly hack to make Bag scene not reappear if flying
}
end
next ($game_temp.fly_destination) ? 2 : 0
})
@@ -148,11 +148,11 @@ EventHandlers.add(:on_player_step_taken, :repel_counter,
end
next if !pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
ret = screen.pbChooseItemScreen(proc { |item| repels.include?(item) })
}
end
pbUseItem($bag, ret) if ret
}
)
@@ -190,7 +190,7 @@ ItemHandlers::UseInField.add(:ESCAPEROPE, proc { |item|
next false
end
pbUseItemMessage(item)
pbFadeOutIn {
pbFadeOutIn do
$game_temp.player_new_map_id = escape[0]
$game_temp.player_new_x = escape[1]
$game_temp.player_new_y = escape[2]
@@ -199,7 +199,7 @@ ItemHandlers::UseInField.add(:ESCAPEROPE, proc { |item|
$scene.transfer_player
$game_map.autoplay
$game_map.refresh
}
end
pbEraseEscapePoint
next true
})
@@ -220,7 +220,7 @@ ItemHandlers::UseInField.add(:SACREDASH, proc { |item|
next false
end
revived = 0
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
screen.pbStartScene(_INTL("Using item..."), false)
@@ -231,11 +231,9 @@ ItemHandlers::UseInField.add(:SACREDASH, proc { |item|
screen.pbRefreshSingle(i)
screen.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name))
end
if revived == 0
screen.pbDisplay(_INTL("It won't have any effect."))
end
screen.pbDisplay(_INTL("It won't have any effect.")) if revived == 0
screen.pbEndScene
}
end
next (revived > 0)
})
@@ -371,7 +369,7 @@ ItemHandlers::UseOnPokemon.addIf(:evolution_stones,
end
newspecies = pkmn.check_evolution_on_use_item(item)
if newspecies
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, newspecies)
evo.pbEvolution(false)
@@ -380,7 +378,7 @@ ItemHandlers::UseOnPokemon.addIf(:evolution_stones,
scene.pbRefreshAnnotations(proc { |p| !p.check_evolution_on_use_item(item).nil? })
scene.pbRefresh
end
}
end
next true
end
scene.pbDisplay(_INTL("It won't have any effect."))
@@ -896,13 +894,13 @@ ItemHandlers::UseOnPokemon.add(:RARECANDY, proc { |item, qty, pkmn, scene|
next false
end
# Check for evolution
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pkmn, new_species)
evo.pbEvolution
evo.pbEndScreen
scene.pbRefresh if scene.is_a?(PokemonPartyScreen)
}
end
next true
end
# Level up
@@ -1093,10 +1091,10 @@ ItemHandlers::UseOnPokemon.add(:GRACIDEA, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(1) {
pkmn.setForm(1) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
next true
})
@@ -1108,10 +1106,10 @@ ItemHandlers::UseOnPokemon.add(:REDNECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(0) {
pkmn.setForm(0) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1123,10 +1121,10 @@ ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(1) {
pkmn.setForm(1) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1138,10 +1136,10 @@ ItemHandlers::UseOnPokemon.add(:PINKNECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(2) {
pkmn.setForm(2) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1153,10 +1151,10 @@ ItemHandlers::UseOnPokemon.add(:PURPLENECTAR, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
next false
end
pkmn.setForm(3) {
pkmn.setForm(3) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
end
next true
})
@@ -1171,10 +1169,10 @@ ItemHandlers::UseOnPokemon.add(:REVEALGLASS, proc { |item, qty, pkmn, scene|
next false
end
newForm = (pkmn.form == 0) ? 1 : 0
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
next true
})
@@ -1187,10 +1185,10 @@ ItemHandlers::UseOnPokemon.add(:PRISONBOTTLE, proc { |item, qty, pkmn, scene|
next false
end
newForm = (pkmn.form == 0) ? 1 : 0
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
next true
})
@@ -1217,10 +1215,10 @@ ItemHandlers::UseOnPokemon.add(:ROTOMCATALOG, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("It won't have any effect."))
next false
elsif new_form > 0 && new_form < choices.length - 1
pkmn.setForm(new_form) {
pkmn.setForm(new_form) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
}
end
next true
end
next false
@@ -1238,10 +1236,10 @@ ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE, proc { |item, qty, pkmn, scene|
[_INTL("Change form"), _INTL("Change Ability"), _INTL("Cancel")])
when 0 # Change form
newForm = (pkmn.form == 0) ? 1 : 0
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
scene.pbRefresh
scene.pbDisplay(_INTL("{1} transformed!", pkmn.name))
}
end
next true
when 1 # Change ability
new_abil = (pkmn.ability_index + 1) % 2
@@ -1282,12 +1280,12 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS, proc { |item, qty, pkmn, scene|
newForm = 0
newForm = 1 if other_pkmn.isSpecies?(:RESHIRAM)
newForm = 2 if other_pkmn.isSpecies?(:ZEKROM)
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:DNASPLICERS, :DNASPLICERSUSED)
next true
})
@@ -1304,12 +1302,12 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERSUSED, proc { |item, qty, pkmn, scene|
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:DNASPLICERSUSED, :DNASPLICERS)
next true
})
@@ -1339,12 +1337,12 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
next false
end
pkmn.setForm(1) {
pkmn.setForm(1) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NSOLARIZER, :NSOLARIZERUSED)
next true
})
@@ -1361,12 +1359,12 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZERUSED, proc { |item, qty, pkmn, scene|
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NSOLARIZERUSED, :NSOLARIZER)
next true
})
@@ -1396,12 +1394,12 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER, proc { |item, qty, pkmn, scene|
scene.pbDisplay(_INTL("It cannot be fused with that Pokémon."))
next false
end
pkmn.setForm(2) {
pkmn.setForm(2) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NLUNARIZER, :NLUNARIZERUSED)
next true
})
@@ -1418,12 +1416,12 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZERUSED, proc { |item, qty, pkmn, scene|
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:NLUNARIZERUSED, :NLUNARIZER)
next true
})
@@ -1457,12 +1455,12 @@ ItemHandlers::UseOnPokemon.add(:REINSOFUNITY, proc { |item, qty, pkmn, scene|
newForm = 0
newForm = 1 if other_pkmn.isSpecies?(:GLASTRIER)
newForm = 2 if other_pkmn.isSpecies?(:SPECTRIER)
pkmn.setForm(newForm) {
pkmn.setForm(newForm) do
pkmn.fused = other_pkmn
$player.remove_pokemon_at_index(chosen)
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:REINSOFUNITY, :REINSOFUNITYUSED)
next true
})
@@ -1479,12 +1477,12 @@ ItemHandlers::UseOnPokemon.add(:REINSOFUNITYUSED, proc { |item, qty, pkmn, scene
next false
end
# Unfusing
pkmn.setForm(0) {
pkmn.setForm(0) do
$player.party[$player.party.length] = pkmn.fused
pkmn.fused = nil
scene.pbHardRefresh
scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name))
}
end
$bag.replace_item(:REINSOFUNITYUSED, :REINSOFUNITY)
next true
})
+11 -18
View File
@@ -88,12 +88,10 @@ class Phone
if contact
contact.visible = true
@contacts.delete(contact)
@contacts.push(contact)
else
contact = Contact.new(true, args[0].map_id, args[0].id,
trainer_type, name, args[3], args[4], args[5])
contact.increment_version
@contacts.push(contact)
end
elsif args[1].is_a?(Numeric)
# Trainer
@@ -104,12 +102,10 @@ class Phone
if contact
contact.visible = true
@contacts.delete(contact)
@contacts.push(contact)
else
contact = Contact.new(true, args[0], args[1],
trainer_type, name, args[4], args[5], args[6])
contact.increment_version
@contacts.push(contact)
end
else
# Non-trainer
@@ -118,12 +114,11 @@ class Phone
if contact
contact.visible = true
@contacts.delete(contact)
@contacts.push(contact)
else
contact = Contact.new(false, *args)
@contacts.push(contact)
end
end
@contacts.push(contact)
sort_contacts
return true
end
@@ -264,9 +259,9 @@ class Phone
# Map ID, name, common event ID
def initialize(trainer, *args)
@trainer = trainer
@map_id = args[0]
if @trainer
# Trainer
@map_id = args[0]
@event_id = args[1]
@trainer_type = args[2]
@name = args[3]
@@ -279,7 +274,6 @@ class Phone
@common_event_id = args[6] || 0
else
# Non-trainer
@map_id = args[0]
@name = args[1]
@common_event_id = args[2] || 0
end
@@ -320,7 +314,7 @@ class Phone
def display_name
if trainer?
return sprintf("%s %s", GameData::TrainerType.get(@trainer_type).name,
pbGetMessageFromHash(MessageTypes::TrainerNames, @name))
pbGetMessageFromHash(MessageTypes::TRAINER_NAMES, @name))
end
return _INTL(@name)
end
@@ -482,11 +476,11 @@ class Phone
messages = GameData::PhoneMessage.try_get(contact.trainer_type, contact.name, contact.start_version) if !messages
messages = GameData::PhoneMessage::DATA["default"] if !messages
# Create lambda for choosing a random message and translating it
get_random_message = lambda do |messages|
return "" if !messages
msg = messages.sample
get_random_message = lambda do |msgs|
return "" if !msgs
msg = msgs.sample
return "" if !msg
return pbGetMessageFromHash(MessageTypes::PhoneMessages, msg)
return pbGetMessageFromHash(MessageTypes::PHONE_MESSAGES, msg)
end
# Choose random greeting depending on time of day
ret = get_random_message.call(messages.intro)
@@ -505,10 +499,11 @@ class Phone
# Choose main message set
if Phone.rematches_enabled && contact.rematch_flag > 0
# Trainer is ready for a rematch, so tell/remind the player
if contact.rematch_flag == 1 # Tell the player
case contact.rematch_flag
when 1 # Tell the player
ret += get_random_message.call(messages.battle_request)
contact.rematch_flag = 2 # Ready for rematch and told player
elsif contact.rematch_flag == 2 # Remind the player
when 2 # Remind the player
if messages.battle_remind
ret += get_random_message.call(messages.battle_remind)
else
@@ -555,9 +550,7 @@ class Phone
species = get_species_from_table.call(enc_tables[:Land])
if !species
species = get_species_from_table.call(enc_tables[:Cave])
if !species
species = get_species_from_table.call(enc_tables[:Water])
end
species = get_species_from_table.call(enc_tables[:Water]) if !species
end
return "" if !species
return GameData::Species.get(species).name
@@ -264,9 +264,7 @@ MultipleForms.register(:ROTOM, {
MultipleForms.register(:GIRATINA, {
"getForm" => proc { |pkmn|
next 1 if pkmn.hasItem?(:GRISEOUSORB)
if $game_map && $game_map.metadata&.has_flag?("DistortionWorld")
next 1
end
next 1 if $game_map&.metadata&.has_flag?("DistortionWorld")
next 0
}
})
@@ -1,17 +1,15 @@
=begin
All types except Shadow have Shadow as a weakness.
Shadow has Shadow as a resistance.
On a side note, the Shadow moves in Colosseum will not be affected by Weaknesses
or Resistances, while in XD the Shadow-type is Super-Effective against all other
types.
2/5 - display nature
XD - Shadow Rush -- 55, 100 - Deals damage.
Colosseum - Shadow Rush -- 90, 100
If this attack is successful, user loses half of HP lost by opponent due to this
attack (recoil). If user is in Hyper Mode, this attack has a good chance for a
critical hit.
=end
# All types except Shadow have Shadow as a weakness.
# Shadow has Shadow as a resistance.
# On a side note, the Shadow moves in Colosseum will not be affected by
# Weaknesses or Resistances, while in XD the Shadow-type is Super-Effective
# against all other types.
# 2/5 - display nature
#
# XD - Shadow Rush -- 55, 100 - Deals damage.
# Colosseum - Shadow Rush -- 90, 100
# If this attack is successful, user loses half of HP lost by opponent due to
# this attack (recoil). If user is in Hyper Mode, this attack has a good chance
# for a critical hit.
#===============================================================================
# Purify a Shadow Pokémon.
@@ -63,8 +61,7 @@ end
# Relic Stone scene.
#===============================================================================
class RelicStoneScene
def pbPurify
end
def pbPurify; end
def pbUpdate
pbUpdateSpriteHash(@sprites)
@@ -136,11 +133,11 @@ end
#===============================================================================
def pbRelicStoneScreen(pkmn)
retval = true
pbFadeOutIn {
pbFadeOutIn do
scene = RelicStoneScene.new
screen = RelicStoneScreen.new(scene)
retval = screen.pbStartScreen(pkmn)
}
end
return retval
end
@@ -187,9 +184,7 @@ class Battle::Battler
alias __shadow__pbInitPokemon pbInitPokemon unless method_defined?(:__shadow__pbInitPokemon)
def pbInitPokemon(*arg)
if self.pokemonIndex > 0 && inHyperMode?
self.pokemon.hyper_mode = false
end
self.pokemon.hyper_mode = false if self.pokemonIndex > 0 && inHyperMode?
__shadow__pbInitPokemon(*arg)
# Called into battle
if shadowPokemon?
@@ -284,9 +284,7 @@ class RegionalStorage
if @rgnmap < 0
raise _INTL("The current map has no region set. Please set the MapPosition metadata setting for this map.")
end
if !@storages[@rgnmap]
@storages[@rgnmap] = PokemonStorage.new
end
@storages[@rgnmap] = PokemonStorage.new if !@storages[@rgnmap]
return @storages[@rgnmap]
end
+12 -12
View File
@@ -974,49 +974,49 @@ class Pokemon
# Checks whether this Pokemon can evolve because of levelling up.
# @return [Symbol, nil] the ID of the species to evolve into
def check_evolution_on_level_up
return check_evolution_internal { |pkmn, new_species, method, parameter|
return check_evolution_internal do |pkmn, new_species, method, parameter|
success = GameData::Evolution.get(method).call_level_up(pkmn, parameter)
next (success) ? new_species : nil
}
end
end
# Checks whether this Pokemon can evolve because of using an item on it.
# @param item_used [Symbol, GameData::Item, nil] the item being used
# @return [Symbol, nil] the ID of the species to evolve into
def check_evolution_on_use_item(item_used)
return check_evolution_internal { |pkmn, new_species, method, parameter|
return check_evolution_internal do |pkmn, new_species, method, parameter|
success = GameData::Evolution.get(method).call_use_item(pkmn, parameter, item_used)
next (success) ? new_species : nil
}
end
end
# Checks whether this Pokemon can evolve because of being traded.
# @param other_pkmn [Pokemon] the other Pokémon involved in the trade
# @return [Symbol, nil] the ID of the species to evolve into
def check_evolution_on_trade(other_pkmn)
return check_evolution_internal { |pkmn, new_species, method, parameter|
return check_evolution_internal do |pkmn, new_species, method, parameter|
success = GameData::Evolution.get(method).call_on_trade(pkmn, parameter, other_pkmn)
next (success) ? new_species : nil
}
end
end
# Checks whether this Pokemon can evolve after a battle.
# @return [Symbol, nil] the ID of the species to evolve into
def check_evolution_after_battle(party_index)
return check_evolution_internal { |pkmn, new_species, method, parameter|
return check_evolution_internal do |pkmn, new_species, method, parameter|
success = GameData::Evolution.get(method).call_after_battle(pkmn, party_index, parameter)
next (success) ? new_species : nil
}
end
end
# Checks whether this Pokemon can evolve by a triggered event.
# @param value [Integer] a value that may be used by the evolution method
# @return [Symbol, nil] the ID of the species to evolve into
def check_evolution_by_event(value = 0)
return check_evolution_internal { |pkmn, new_species, method, parameter|
return check_evolution_internal do |pkmn, new_species, method, parameter|
success = GameData::Evolution.get(method).call_event(pkmn, parameter, value)
next (success) ? new_species : nil
}
end
end
# Called after this Pokémon evolves, to remove its held item (if the evolution
@@ -1047,12 +1047,12 @@ class Pokemon
def trigger_event_evolution(number)
new_species = check_evolution_by_event(number)
if new_species
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonEvolutionScene.new
evo.pbStartScreen(self, new_species)
evo.pbEvolution
evo.pbEndScreen
}
end
return true
end
return false
@@ -62,7 +62,7 @@ end
def pbConvertTrainerData
tr_type_names = []
GameData::TrainerType.each { |t| tr_type_names.push(t.real_name) }
MessageTypes.setMessagesAsHash(MessageTypes::TrainerTypes, tr_type_names)
MessageTypes.setMessagesAsHash(MessageTypes::TRAINER_TYPE_NAMES, tr_type_names)
Compiler.write_trainer_types
Compiler.write_trainers
end
@@ -139,7 +139,7 @@ class Player < Trainer
@last_seen_forms[species] = [gender, form, shiny]
end
#===========================================================================
#---------------------------------------------------------------------------
# Sets the given species as owned in the Pokédex.
# @param species [Symbol, GameData::Species] species to set as owned
@@ -185,7 +185,7 @@ class Player < Trainer
return self.count_species(@owned, dex)
end
#===========================================================================
#---------------------------------------------------------------------------
# @param species [Pokemon, Symbol, GameData::Species] Pokemon to register as seen
# @param gender [Integer] gender to register (0=male, 1=female, 2=genderless)
@@ -227,7 +227,7 @@ class Player < Trainer
@last_seen_forms[pkmn.species] = [pkmn.gender, form, pkmn.shiny?]
end
#===========================================================================
#---------------------------------------------------------------------------
# @param species [Symbol, GameData::Species] species to check
# @return [Integer] the number of Pokémon of the given species that have
@@ -272,7 +272,7 @@ class Player < Trainer
@defeated_counts[species_id] += 1
end
#===========================================================================
#---------------------------------------------------------------------------
# Unlocks the given Dex, -1 being the National Dex.
# @param dex [Integer] Dex ID (-1 is the National Dex)
@@ -321,9 +321,7 @@ class Player < Trainer
return
end
if dexes_count == 1 # Only National Dex is defined
if self.unlocked?(0) && self.seen_any?
@accessible_dexes.push(-1)
end
@accessible_dexes.push(-1) if self.unlocked?(0) && self.seen_any?
else # Regional Dexes + National Dex
dexes_count.times do |i|
dex_list_to_check = (i == dexes_count - 1) ? -1 : i
@@ -334,7 +332,7 @@ class Player < Trainer
end
end
#===========================================================================
#---------------------------------------------------------------------------
private
@@ -109,11 +109,11 @@ class PokemonEggHatch_Scene
if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && $player.has_pokedex
pbMessage(_INTL("{1}'s data was added to the Pokédex.", @pokemon.name)) { update }
$player.pokedex.register_last_seen(@pokemon)
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbDexEntry(@pokemon.species)
}
end
end
# Nickname the Pokémon
if $PokemonSystem.givenicknames == 0 &&
@@ -195,11 +195,11 @@ end
#===============================================================================
def pbHatchAnimation(pokemon)
pbMessage(_INTL("Huh?\1"))
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
scene = PokemonEggHatch_Scene.new
screen = PokemonEggHatchScreen.new(scene)
screen.pbStartScreen(pokemon)
}
end
return true
end
@@ -226,11 +226,11 @@ def pbHatch(pokemon)
if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && $player.has_pokedex
pbMessage(_INTL("{1}'s data was added to the Pokédex.", speciesname))
$player.pokedex.register_last_seen(pokemon)
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbDexEntry(pokemon.species)
}
end
end
# Nickname the Pokémon
if $PokemonSystem.givenicknames == 0 &&
@@ -617,13 +617,13 @@ class PokemonEvolutionScene
pbMessageDisplay(@sprites["msgwindow"],
_INTL("{1}'s data was added to the Pokédex.", newspeciesname)) { pbUpdate }
$player.pokedex.register_last_seen(@pokemon)
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbDexEntry(@pokemon.species)
@sprites["msgwindow"].text = "" if moves_to_learn.length > 0
pbEndScreen(false) if moves_to_learn.length == 0
}
end
end
# Learn moves upon evolution for evolved species
moves_to_learn.each do |move|
@@ -195,12 +195,12 @@ class PokemonTrade_Scene
pbMessageDisplay(@sprites["msgwindow"],
_INTL("{1}'s data was added to the Pokédex.", speciesname2)) { pbUpdate }
$player.pokedex.register_last_seen(@pokemon2)
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbDexEntry(@pokemon2.species)
pbEndScreen(false)
}
end
end
end
end
@@ -227,11 +227,11 @@ def pbStartTrade(pokemonIndex, newpoke, nickname, trainerName, trainerGender = 0
yourPokemon.obtain_method = 2 # traded
yourPokemon.reset_moves if resetmoves
yourPokemon.record_first_moves
pbFadeOutInWithMusic {
pbFadeOutInWithMusic do
evo = PokemonTrade_Scene.new
evo.pbStartScreen(myPokemon, yourPokemon, $player.name, trainerName)
evo.pbTrade
evo.pbEndScreen
}
end
$player.party[pokemonIndex] = yourPokemon
end
+20 -20
View File
@@ -137,27 +137,27 @@ MenuHandlers.add(:pause_menu, :pokedex, {
"effect" => proc { |menu|
pbPlayDecisionSE
if Settings::USE_CURRENT_REGION_DEX
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene)
screen.pbStartScreen
menu.pbRefresh
}
end
elsif $player.pokedex.accessible_dexes.length == 1
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0]
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene)
screen.pbStartScreen
menu.pbRefresh
}
end
else
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexMenu_Scene.new
screen = PokemonPokedexMenuScreen.new(scene)
screen.pbStartScreen
menu.pbRefresh
}
end
end
next false
}
@@ -170,12 +170,12 @@ MenuHandlers.add(:pause_menu, :party, {
"effect" => proc { |menu|
pbPlayDecisionSE
hidden_move = nil
pbFadeOutIn {
pbFadeOutIn do
sscene = PokemonParty_Scene.new
sscreen = PokemonPartyScreen.new(sscene, $player.party)
hidden_move = sscreen.pbPokemonScreen
(hidden_move) ? menu.pbEndScene : menu.pbRefresh
}
end
next false if !hidden_move
$game_temp.in_menu = false
pbUseHiddenMove(hidden_move[0], hidden_move[1])
@@ -190,12 +190,12 @@ MenuHandlers.add(:pause_menu, :bag, {
"effect" => proc { |menu|
pbPlayDecisionSE
item = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
item = screen.pbStartScreen
(item) ? menu.pbEndScene : menu.pbRefresh
}
end
next false if !item
$game_temp.in_menu = false
pbUseKeyItemInField(item)
@@ -209,12 +209,12 @@ MenuHandlers.add(:pause_menu, :pokegear, {
"condition" => proc { next $player.has_pokegear },
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokegear_Scene.new
screen = PokemonPokegearScreen.new(scene)
screen.pbStartScreen
($game_temp.fly_destination) ? menu.pbEndScene : menu.pbRefresh
}
end
next pbFlyToNewLocation
}
})
@@ -225,13 +225,13 @@ MenuHandlers.add(:pause_menu, :town_map, {
"condition" => proc { next !$player.has_pokegear && $bag.has?(:TOWNMAP) },
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonRegionMap_Scene.new(-1, false)
screen = PokemonRegionMapScreen.new(scene)
ret = screen.pbStartScreen
$game_temp.fly_destination = ret if ret
($game_temp.fly_destination) ? menu.pbEndScene : menu.pbRefresh
}
end
next pbFlyToNewLocation
}
})
@@ -241,12 +241,12 @@ MenuHandlers.add(:pause_menu, :trainer_card, {
"order" => 50,
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonTrainerCard_Scene.new
screen = PokemonTrainerCardScreen.new(scene)
screen.pbStartScreen
menu.pbRefresh
}
end
next false
}
})
@@ -276,13 +276,13 @@ MenuHandlers.add(:pause_menu, :options, {
"order" => 70,
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonOption_Scene.new
screen = PokemonOptionScreen.new(scene)
screen.pbStartScreen
pbUpdateSceneMap
menu.pbRefresh
}
end
next false
}
})
@@ -293,10 +293,10 @@ MenuHandlers.add(:pause_menu, :debug, {
"condition" => proc { next $DEBUG },
"effect" => proc { |menu|
pbPlayDecisionSE
pbFadeOutIn {
pbFadeOutIn do
pbDebugMenu
menu.pbRefresh
}
end
next false
}
})
+2 -2
View File
@@ -114,11 +114,11 @@ class PokemonPokedexMenuScreen
cmd = @scene.pbScene
break if cmd < 0 || cmd >= commands2.length # Cancel/Exit
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[cmd]
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene)
screen.pbStartScreen
}
end
end
@scene.pbEndScene
end
+26 -33
View File
@@ -272,15 +272,13 @@ class PokemonPokedex_Scene
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
addBackgroundPlane(@sprites, "background", "Pokedex/bg_list", @viewport)
=begin
# Suggestion for changing the background depending on region. You can change
# the line above with the following:
if pbGetPokedexRegion==-1 # Using national Pokédex
addBackgroundPlane(@sprites,"background","Pokedex/bg_national",@viewport)
elsif pbGetPokedexRegion==0 # Using first regional Pokédex
addBackgroundPlane(@sprites,"background","Pokedex/bg_regional",@viewport)
end
=end
# Suggestion for changing the background depending on region. You can
# comment out the line above and uncomment the following lines:
# if pbGetPokedexRegion == -1 # Using national Pokédex
# addBackgroundPlane(@sprites, "background", "Pokedex/bg_national", @viewport)
# elsif pbGetPokedexRegion == 0 # Using first regional Pokédex
# addBackgroundPlane(@sprites, "background", "Pokedex/bg_regional", @viewport)
# end
addBackgroundPlane(@sprites, "searchbg", "Pokedex/bg_search", @viewport)
@sprites["searchbg"].visible = false
@sprites["pokedex"] = Window_Pokedex.new(206, 30, 276, 364, @viewport)
@@ -766,9 +764,8 @@ class PokemonPokedex_Scene
end
def setIconBitmap(species)
gender, form, shiny = $player.pokedex.last_form_seen(species)
shiny = false
@sprites["icon"].setSpeciesBitmap(species, gender, form, shiny)
gender, form, _shiny = $player.pokedex.last_form_seen(species)
@sprites["icon"].setSpeciesBitmap(species, gender, form, false)
end
def pbSearchDexList(params)
@@ -777,17 +774,17 @@ class PokemonPokedex_Scene
# Filter by name
if params[1] >= 0
scanNameCommand = @nameCommands[params[1]].scan(/./)
dexlist = dexlist.find_all { |item|
dexlist = dexlist.find_all do |item|
next false if !$player.seen?(item[:species])
firstChar = item[:name][0, 1]
next scanNameCommand.any? { |v| v == firstChar }
}
end
end
# Filter by type
if params[2] >= 0 || params[3] >= 0
stype1 = (params[2] >= 0) ? @typeCommands[params[2]].id : nil
stype2 = (params[3] >= 0) ? @typeCommands[params[3]].id : nil
dexlist = dexlist.find_all { |item|
dexlist = dexlist.find_all do |item|
next false if !$player.owned?(item[:species])
types = item[:types]
if stype1 && stype2
@@ -802,43 +799,41 @@ class PokemonPokedex_Scene
else
next false
end
}
end
end
# Filter by height range
if params[4] >= 0 || params[5] >= 0
minh = (params[4] < 0) ? 0 : (params[4] >= @heightCommands.length) ? 999 : @heightCommands[params[4]]
maxh = (params[5] < 0) ? 999 : (params[5] >= @heightCommands.length) ? 0 : @heightCommands[params[5]]
dexlist = dexlist.find_all { |item|
dexlist = dexlist.find_all do |item|
next false if !$player.owned?(item[:species])
height = item[:height]
next height >= minh && height <= maxh
}
end
end
# Filter by weight range
if params[6] >= 0 || params[7] >= 0
minw = (params[6] < 0) ? 0 : (params[6] >= @weightCommands.length) ? 9999 : @weightCommands[params[6]]
maxw = (params[7] < 0) ? 9999 : (params[7] >= @weightCommands.length) ? 0 : @weightCommands[params[7]]
dexlist = dexlist.find_all { |item|
dexlist = dexlist.find_all do |item|
next false if !$player.owned?(item[:species])
weight = item[:weight]
next weight >= minw && weight <= maxw
}
end
end
# Filter by color
if params[8] >= 0
scolor = @colorCommands[params[8]].id
dexlist = dexlist.find_all { |item|
next false if !$player.seen?(item[:species])
next item[:color] == scolor
}
dexlist = dexlist.find_all do |item|
next $player.seen?(item[:species]) && item[:color] == scolor
end
end
# Filter by shape
if params[9] >= 0
sshape = @shapeCommands[params[9]].id
dexlist = dexlist.find_all { |item|
next false if !$player.seen?(item[:species])
next item[:shape] == sshape
}
dexlist = dexlist.find_all do |item|
next $player.seen?(item[:species]) && item[:shape] == sshape
end
end
# Remove all unseen species from the results
dexlist = dexlist.find_all { |item| next $player.seen?(item[:species]) }
@@ -924,9 +919,7 @@ class PokemonPokedex_Scene
oldindex = index
minmax = 1
oldminmax = minmax
if [3, 4].include?(mode)
index = oldindex = selindex[minmax]
end
index = oldindex = selindex[minmax] if [3, 4].include?(mode)
@sprites["searchcursor"].mode = mode
@sprites["searchcursor"].cmds = cmds.length
@sprites["searchcursor"].minmax = minmax
@@ -1260,7 +1253,7 @@ class PokemonPokedex_Scene
end
def pbPokedex
pbActivateWindow(@sprites, "pokedex") {
pbActivateWindow(@sprites, "pokedex") do
loop do
Graphics.update
Input.update
@@ -1290,7 +1283,7 @@ class PokemonPokedex_Scene
end
end
end
}
end
end
end
+5 -9
View File
@@ -161,9 +161,9 @@ class PokemonPokedexInfo_Scene
real_gender = 2 if sp.gender_ratio == :Genderless
ret.push([sp.form_name, real_gender, sp.form])
else # Both male and female
2.times do |real_gender|
next if !$player.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
ret.push([sp.form_name, real_gender, sp.form])
2.times do |real_gndr|
next if !$player.pokedex.seen_form?(@species, real_gndr, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
ret.push([sp.form_name, real_gndr, sp.form])
break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
end
end
@@ -210,9 +210,7 @@ class PokemonPokedexInfo_Scene
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
imagepos = []
if @brief
imagepos.push([_INTL("Graphics/UI/Pokedex/overlay_info"), 0, 0])
end
imagepos.push([_INTL("Graphics/UI/Pokedex/overlay_info"), 0, 0]) if @brief
species_data = GameData::Species.get_species_form(@species, @form)
# Write various bits of text
indexText = "???"
@@ -536,9 +534,7 @@ class PokemonPokedexInfo_Scene
dorefresh = true
end
end
if dorefresh
drawPage(@page)
end
drawPage(@page) if dorefresh
end
return @index
end
+26 -26
View File
@@ -559,7 +559,7 @@ class PokemonParty_Scene
@sprites["messagebox"].text = text
@sprites["messagebox"].visible = true
@sprites["helpwindow"].visible = false
using(cmdwindow = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) {
using(cmdwindow = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
cmdwindow.visible = false
pbBottomRight(cmdwindow)
cmdwindow.y -= @sprites["messagebox"].height
@@ -580,7 +580,7 @@ class PokemonParty_Scene
end
end
end
}
end
@sprites["messagebox"].visible = false
@sprites["helpwindow"].visible = true
return ret
@@ -590,7 +590,7 @@ class PokemonParty_Scene
ret = -1
helpwindow = @sprites["helpwindow"]
helpwindow.visible = true
using(cmdwindow = Window_CommandPokemonColor.new(commands)) {
using(cmdwindow = Window_CommandPokemonColor.new(commands)) do
cmdwindow.z = @viewport.z + 1
cmdwindow.index = index
pbBottomRight(cmdwindow)
@@ -612,7 +612,7 @@ class PokemonParty_Scene
break
end
end
}
end
return ret
end
@@ -705,18 +705,18 @@ class PokemonParty_Scene
def pbChooseItem(bag)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, bag)
ret = screen.pbChooseItemScreen(proc { |item| GameData::Item.get(item).can_hold? })
yield if block_given?
}
end
return ret
end
def pbUseItem(bag, pokemon)
ret = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, bag)
ret = screen.pbChooseItemScreen(proc { |item|
@@ -730,7 +730,7 @@ class PokemonParty_Scene
next true
})
yield if block_given?
}
end
return ret
end
@@ -764,12 +764,12 @@ class PokemonParty_Scene
cancelsprite = Settings::MAX_PARTY_SIZE + ((@multiselect) ? 1 : 0)
if Input.trigger?(Input::SPECIAL) && @can_access_storage && canswitch != 2
pbPlayDecisionSE
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
screen.pbStartScreen(0)
pbHardRefresh
}
end
elsif Input.trigger?(Input::ACTION) && canswitch == 1 && @activecmd != cancelsprite
pbPlayDecisionSE
return [1, @activecmd]
@@ -1121,9 +1121,9 @@ class PokemonPartyScreen
statuses[pkmnid] = 1
pbRefreshSingle(pkmnid)
elsif cmdSummary >= 0 && command == cmdSummary
@scene.pbSummary(pkmnid) {
@scene.pbSummary(pkmnid) do
@scene.pbSetHelpText((@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
}
end
end
end
@scene.pbEndScene
@@ -1314,9 +1314,9 @@ MenuHandlers.add(:party_menu, :summary, {
"name" => _INTL("Summary"),
"order" => 10,
"effect" => proc { |screen, party, party_idx|
screen.scene.pbSummary(party_idx) {
screen.scene.pbSummary(party_idx) do
screen.scene.pbSetHelpText((party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
}
end
}
})
@@ -1351,10 +1351,10 @@ MenuHandlers.add(:party_menu, :mail, {
[_INTL("Read"), _INTL("Take"), _INTL("Cancel")])
case command
when 0 # Read
pbFadeOutIn {
pbFadeOutIn do
pbDisplayMail(pkmn.mail, pkmn)
screen.scene.pbSetHelpText((party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
}
end
when 1 # Take
if pbTakeItemFromPokemon(pkmn, screen)
screen.pbRefreshSingle(party_idx)
@@ -1388,9 +1388,9 @@ MenuHandlers.add(:party_menu_item, :use, {
"order" => 10,
"effect" => proc { |screen, party, party_idx|
pkmn = party[party_idx]
item = screen.scene.pbUseItem($bag, pkmn) {
item = screen.scene.pbUseItem($bag, pkmn) do
screen.scene.pbSetHelpText((party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
}
end
next if !item
pbUseItemOnPokemon(item, pkmn, screen)
screen.pbRefreshSingle(party_idx)
@@ -1402,9 +1402,9 @@ MenuHandlers.add(:party_menu_item, :give, {
"order" => 20,
"effect" => proc { |screen, party, party_idx|
pkmn = party[party_idx]
item = screen.scene.pbChooseItem($bag) {
item = screen.scene.pbChooseItem($bag) do
screen.scene.pbSetHelpText((party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
}
end
next if !item || !pbGiveItemToPokemon(item, pkmn, screen, party_idx)
screen.pbRefreshSingle(party_idx)
}
@@ -1480,11 +1480,11 @@ MenuHandlers.add(:party_menu_item, :move, {
# Open the party screen
#===============================================================================
def pbPokemonScreen
pbFadeOutIn {
pbFadeOutIn do
sscene = PokemonParty_Scene.new
sscreen = PokemonPartyScreen.new(sscene, $player.party)
sscreen.pbPokemonScreen
}
end
end
#===============================================================================
@@ -1495,7 +1495,7 @@ end
# variable _nameVarNumber_; result is -1 if no Pokémon was chosen
def pbChoosePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
chosen = 0
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
if ableProc
@@ -1505,7 +1505,7 @@ def pbChoosePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligib
chosen = screen.pbChoosePokemon
screen.pbEndScene
end
}
end
pbSet(variableNumber, chosen)
if chosen >= 0
pbSet(nameVarNumber, $player.party[chosen].name)
@@ -1525,7 +1525,7 @@ end
# Same as pbChoosePokemon, but prevents choosing an egg or a Shadow Pokémon.
def pbChooseTradablePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
chosen = 0
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
if ableProc
@@ -1535,7 +1535,7 @@ def pbChooseTradablePokemon(variableNumber, nameVarNumber, ableProc = nil, allow
chosen = screen.pbChoosePokemon
screen.pbEndScene
end
}
end
pbSet(variableNumber, chosen)
if chosen >= 0
pbSet(nameVarNumber, $player.party[chosen].name)
+12 -18
View File
@@ -233,7 +233,7 @@ class PokemonSummary_Scene
ret = -1
@sprites["messagebox"].text = text
@sprites["messagebox"].visible = true
using(cmdwindow = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) {
using(cmdwindow = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
cmdwindow.z = @viewport.z + 1
cmdwindow.visible = false
pbBottomRight(cmdwindow)
@@ -254,14 +254,14 @@ class PokemonSummary_Scene
end
end
end
}
end
@sprites["messagebox"].visible = false
return ret
end
def pbShowCommands(commands, index = 0)
ret = -1
using(cmdwindow = Window_CommandPokemon.new(commands)) {
using(cmdwindow = Window_CommandPokemon.new(commands)) do
cmdwindow.z = @viewport.z + 1
cmdwindow.index = index
pbBottomRight(cmdwindow)
@@ -280,7 +280,7 @@ class PokemonSummary_Scene
break
end
end
}
end
return ret
end
@@ -328,9 +328,7 @@ class PokemonSummary_Scene
imagepos.push([sprintf("Graphics/UI/Summary/icon_pokerus"), 176, 100])
end
# Show shininess star
if @pokemon.shiny?
imagepos.push([sprintf("Graphics/UI/shiny"), 2, 134])
end
imagepos.push([sprintf("Graphics/UI/shiny"), 2, 134]) if @pokemon.shiny?
# Draw all images
pbDrawImagePositions(overlay, imagepos)
# Write various bits of text
@@ -1193,23 +1191,21 @@ class PokemonSummary_Scene
command = pbShowCommands(commands)
if cmdGiveItem >= 0 && command == cmdGiveItem
item = nil
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, $bag)
item = screen.pbChooseItemScreen(proc { |itm| GameData::Item.get(itm).can_hold? })
}
if item
dorefresh = pbGiveItemToPokemon(item, @pokemon, self, @partyindex)
end
dorefresh = pbGiveItemToPokemon(item, @pokemon, self, @partyindex) if item
elsif cmdTakeItem >= 0 && command == cmdTakeItem
dorefresh = pbTakeItemFromPokemon(@pokemon, self)
elsif cmdPokedex >= 0 && command == cmdPokedex
$player.pokedex.register_last_seen(@pokemon)
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbStartSceneSingle(@pokemon.species)
}
end
dorefresh = true
elsif cmdMark >= 0 && command == cmdMark
dorefresh = pbMarking(@pokemon)
@@ -1318,9 +1314,7 @@ class PokemonSummary_Scene
dorefresh = true
end
end
if dorefresh
drawPage(@page)
end
drawPage(@page) if dorefresh
end
return @partyindex
end
@@ -1375,11 +1369,11 @@ end
def pbChooseMove(pokemon, variableNumber, nameVarNumber)
return if !pokemon
ret = -1
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
ret = screen.pbStartForgetScreen([pokemon], 0, nil)
}
end
$game_variables[variableNumber] = ret
if ret >= 0
$game_variables[nameVarNumber] = pokemon.moves[ret].name

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