mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Merge branch 'dev' into ai
This commit is contained in:
49
.rubocop.yml
49
.rubocop.yml
@@ -21,6 +21,10 @@ Layout/HashAlignment:
|
||||
EnforcedHashRocketStyle: table
|
||||
EnforcedColonStyle: table
|
||||
|
||||
# This interferes with the presentation of some code, notably registered procs.
|
||||
Layout/MultilineMethodCallBraceLayout:
|
||||
Enabled: false
|
||||
|
||||
# This means hashes and arrays are written the same way, rather than hashes
|
||||
# needing to be written like { foo => bar } while arrays are like [foo, bar].
|
||||
Layout/SpaceInsideHashLiteralBraces:
|
||||
@@ -59,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
|
||||
#===============================================================================
|
||||
@@ -81,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:
|
||||
@@ -106,6 +136,16 @@ 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:
|
||||
EnforcedStyle: lambda
|
||||
|
||||
# unless just adds mental gymnastics trying to figure out what it actually
|
||||
# means. I much prefer if !something.
|
||||
Style/NegatedIf:
|
||||
@@ -139,6 +179,11 @@ Style/SingleLineBlockParams:
|
||||
Style/SingleLineMethods:
|
||||
Enabled: false
|
||||
|
||||
# This requires writing array[n..] instead of array[n..-1], and I think endless
|
||||
# ranges look bad.
|
||||
Style/SlicingWithRange:
|
||||
Enabled: false
|
||||
|
||||
# Single quotes being faster is hardly measurable and only affects parse time.
|
||||
# Enforcing double quotes reduces the times where you need to change them
|
||||
# when introducing an interpolation or an apostrophe. Use single quotes only if
|
||||
@@ -154,6 +199,10 @@ Style/SymbolArray:
|
||||
Style/WordArray:
|
||||
EnforcedStyle: brackets
|
||||
|
||||
# Allows procs to be written like { |obj| obj.something } which is clearer.
|
||||
Style/SymbolProc:
|
||||
AllowMethodsWithArguments: true
|
||||
|
||||
# Parentheses around the condition in a ternary operator helps to differentiate
|
||||
# it from the true/false results.
|
||||
Style/TernaryParentheses:
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
# Reads files of certain format from a directory
|
||||
#===============================================================================
|
||||
class Dir
|
||||
#-----------------------------------------------------------------------------
|
||||
# Reads all files in a directory
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.get(dir, filters = "*", full = true)
|
||||
files = []
|
||||
filters = [filters] if !filters.is_a?(Array)
|
||||
@@ -15,9 +13,8 @@ class Dir
|
||||
end
|
||||
return files.sort
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Generates entire file/folder tree from a certain directory
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.all(dir, filters = "*", full = true)
|
||||
# sets variables for starting
|
||||
files = []
|
||||
@@ -33,81 +30,67 @@ class Dir
|
||||
# returns all found files
|
||||
return files + subfolders
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Checks for existing directory, gets around accents
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.safe?(dir)
|
||||
return false if !FileTest.directory?(dir)
|
||||
ret = false
|
||||
self.chdir(dir) { ret = true } rescue nil
|
||||
return ret
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Creates all the required directories for filename path
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.create(path)
|
||||
path.gsub!("\\", "/") # Windows compatibility
|
||||
# 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)
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Generates entire folder tree from a certain directory
|
||||
#-----------------------------------------------------------------------------
|
||||
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
|
||||
# returns all found directories
|
||||
return dirs.length > 0 ? (dirs + [dir]) : [dir]
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Deletes all the files in a directory and all the sub directories (allows for non-empty dirs)
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.delete_all(dir)
|
||||
# delete all files in dir
|
||||
self.all(dir).each { |f| File.delete(f) }
|
||||
# delete all dirs in dir
|
||||
self.all_dirs(dir).each { |f| Dir.delete(f) }
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# extensions for file class
|
||||
# Extensions for file class
|
||||
#===============================================================================
|
||||
class File
|
||||
#-----------------------------------------------------------------------------
|
||||
# Checks for existing file, gets around accents
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.safe?(file)
|
||||
ret = false
|
||||
self.open(file, "rb") { ret = true } rescue nil
|
||||
return ret
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Checks for existing .rxdata file
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.safeData?(file)
|
||||
ret = false
|
||||
ret = (load_data(file) ? true : false) rescue false
|
||||
return ret
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Checking for files and directories
|
||||
#===============================================================================
|
||||
@@ -137,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
|
||||
@@ -168,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
|
||||
|
||||
@@ -219,19 +202,20 @@ def canonicalize(c)
|
||||
return retstr
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module RTP
|
||||
@rtpPaths = nil
|
||||
|
||||
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
|
||||
|
||||
@@ -245,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
|
||||
|
||||
@@ -263,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
|
||||
|
||||
@@ -299,8 +283,9 @@ module RTP
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module FileTest
|
||||
IMAGE_EXTENSIONS = [".png", ".gif"] # ".jpg", ".jpeg", ".bmp",
|
||||
AUDIO_EXTENSIONS = [".mid", ".midi", ".ogg", ".wav", ".wma"] # ".mp3"
|
||||
@@ -314,27 +299,23 @@ module FileTest
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
# Used to determine whether a data file exists (rather than a graphics or
|
||||
# audio file). Doesn't check RTP, but does check encrypted archives.
|
||||
|
||||
# NOTE: pbGetFileChar checks anything added in MKXP's RTP setting,
|
||||
# and matching mount points added through System.mount
|
||||
# NOTE: pbGetFileChar checks anything added in MKXP's RTP setting, and matching
|
||||
# mount points added through System.mount.
|
||||
def pbRgssExists?(filename)
|
||||
if safeExists?("./Game.rgssad")
|
||||
return pbGetFileChar(filename) != nil
|
||||
else
|
||||
return !pbGetFileChar(filename).nil? if safeExists?("./Game.rgssad")
|
||||
filename = canonicalize(filename)
|
||||
return safeExists?(filename)
|
||||
end
|
||||
end
|
||||
|
||||
# Opens an IO, even if the file is in an encrypted archive.
|
||||
# Doesn't check RTP for the file.
|
||||
|
||||
# NOTE: load_data checks anything added in MKXP's RTP setting,
|
||||
# and matching mount points added through System.mount
|
||||
# NOTE: load_data checks anything added in MKXP's RTP setting, and matching
|
||||
# mount points added through System.mount.
|
||||
def pbRgssOpen(file, mode = nil)
|
||||
# File.open("debug.txt","ab") { |fw| fw.write([file,mode,Time.now.to_f].inspect+"\r\n") }
|
||||
if !safeExists?("./Game.rgssad")
|
||||
@@ -385,9 +366,8 @@ end
|
||||
|
||||
# Gets the contents of a file. Doesn't check RTP, but does check
|
||||
# encrypted archives.
|
||||
|
||||
# NOTE: load_data will check anything added in MKXP's RTP setting,
|
||||
# and matching mount points added through System.mount
|
||||
# NOTE: load_data will check anything added in MKXP's RTP setting, and matching
|
||||
# mount points added through System.mount.
|
||||
def pbGetFileString(file)
|
||||
file = canonicalize(file)
|
||||
if !safeExists?("./Game.rgssad")
|
||||
@@ -407,14 +387,14 @@ def pbGetFileString(file)
|
||||
return str
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class StringInput
|
||||
include Enumerable
|
||||
|
||||
attr_reader :lineno, :string
|
||||
|
||||
class << self
|
||||
def new(str)
|
||||
if block_given?
|
||||
@@ -438,8 +418,6 @@ class StringInput
|
||||
@lineno = 0
|
||||
end
|
||||
|
||||
attr_reader :lineno, :string
|
||||
|
||||
def inspect
|
||||
return "#<#{self.class}:#{@closed ? 'closed' : 'open'},src=#{@string[0, 30].inspect}>"
|
||||
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
|
||||
|
||||
|
||||
@@ -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")
|
||||
@@ -267,7 +267,10 @@ module Translator
|
||||
# existing destination folder
|
||||
if Dir.safe?(dir_name)
|
||||
has_files = false
|
||||
Dir.all(dir_name).each { |f| has_files = true; break }
|
||||
Dir.all(dir_name).each do |f|
|
||||
has_files = true
|
||||
break
|
||||
end
|
||||
if has_files && !pbConfirmMessageSerious(_INTL("Replace all text files in folder '{1}'?", dir_name))
|
||||
pbDisposeMessageWindow(msg_window)
|
||||
return
|
||||
@@ -293,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
|
||||
@@ -314,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
|
||||
@@ -322,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)
|
||||
@@ -368,7 +371,7 @@ module Translator
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def compile_text(dir_name, dat_filename)
|
||||
msg_window = pbCreateMessageWindow
|
||||
@@ -449,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
|
||||
@@ -567,15 +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, array, nil, map_id)
|
||||
@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)
|
||||
@@ -606,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
|
||||
@@ -641,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
|
||||
@@ -666,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
|
||||
@@ -762,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
|
||||
@@ -778,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
|
||||
@@ -808,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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -106,9 +106,8 @@
|
||||
module PluginManager
|
||||
# Holds all registered plugin data.
|
||||
@@Plugins = {}
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Registers a plugin and tests its dependencies and incompatibilities.
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.register(options)
|
||||
name = nil
|
||||
version = nil
|
||||
@@ -137,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
|
||||
@@ -289,9 +286,8 @@ module PluginManager
|
||||
:credits => credits
|
||||
}
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Throws a pure error message without stack trace or any other useless info.
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.error(msg)
|
||||
Graphics.update
|
||||
t = Thread.new do
|
||||
@@ -304,11 +300,10 @@ module PluginManager
|
||||
end
|
||||
Kernel.exit! true
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns true if the specified plugin is installed.
|
||||
# If the version is specified, this version is taken into account.
|
||||
# If mustequal is true, the version must be a match with the specified version.
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.installed?(plugin_name, plugin_version = nil, mustequal = false)
|
||||
plugin = @@Plugins[plugin_name]
|
||||
return false if plugin.nil?
|
||||
@@ -317,41 +312,36 @@ module PluginManager
|
||||
return true if !mustequal && comparison >= 0
|
||||
return true if mustequal && comparison == 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns the string names of all installed plugins.
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.plugins
|
||||
return @@Plugins.keys
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns the installed version of the specified plugin.
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.version(plugin_name)
|
||||
return if !installed?(plugin_name)
|
||||
return @@Plugins[plugin_name][:version]
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns the link of the specified plugin.
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.link(plugin_name)
|
||||
return if !installed?(plugin_name)
|
||||
return @@Plugins[plugin_name][:link]
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns the credits of the specified plugin.
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.credits(plugin_name)
|
||||
return if !installed?(plugin_name)
|
||||
return @@Plugins[plugin_name][:credits]
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Compares two versions given in string form. v1 should be the plugin version
|
||||
# you actually have, and v2 should be the minimum/desired plugin version.
|
||||
# Return values:
|
||||
# 1 if v1 is higher than v2
|
||||
# 0 if v1 is equal to v2
|
||||
# -1 if v1 is lower than v2
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.compare_versions(v1, v2)
|
||||
d1 = v1.chars
|
||||
d1.insert(0, "0") if d1[0] == "." # Turn ".123" into "0.123"
|
||||
@@ -376,9 +366,8 @@ module PluginManager
|
||||
end
|
||||
return 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# formats the error message
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Formats the error message
|
||||
def self.pluginErrorMsg(name, script)
|
||||
e = $!
|
||||
# begin message formatting
|
||||
@@ -415,14 +404,13 @@ module PluginManager
|
||||
end
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Used to read the metadata file
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.readMeta(dir, file)
|
||||
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)
|
||||
@@ -466,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]
|
||||
@@ -480,9 +468,8 @@ module PluginManager
|
||||
# return meta hash
|
||||
return meta
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Get a list of all the plugin directories to inspect
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.listAll
|
||||
return [] if !$DEBUG || safeExists?("Game.rgssad") || !Dir.safe?("Plugins")
|
||||
# get a list of all directories in the `Plugins/` folder
|
||||
@@ -491,9 +478,8 @@ module PluginManager
|
||||
# return all plugins
|
||||
return dirs
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Catch any potential loop with dependencies and raise an error
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.validateDependencies(name, meta, og = nil)
|
||||
# exit if no registered dependency
|
||||
return nil if !meta[name] || !meta[name][:dependencies]
|
||||
@@ -511,9 +497,8 @@ module PluginManager
|
||||
end
|
||||
return name
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Sort load order based on dependencies (this ends up in reverse order)
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.sortLoadOrder(order, plugins)
|
||||
# go through the load order
|
||||
order.each do |o|
|
||||
@@ -540,9 +525,8 @@ module PluginManager
|
||||
end
|
||||
return order
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Get the order in which to load plugins
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.getPluginOrder
|
||||
plugins = {}
|
||||
order = []
|
||||
@@ -568,9 +552,8 @@ module PluginManager
|
||||
# sort the load order
|
||||
return self.sortLoadOrder(order, plugins).reverse, plugins
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Check if plugins need compiling
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.needCompiling?(order, plugins)
|
||||
# fixed actions
|
||||
return false if !$DEBUG || safeExists?("Game.rgssad")
|
||||
@@ -590,9 +573,8 @@ module PluginManager
|
||||
end
|
||||
return false
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Check if plugins need compiling
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.compilePlugins(order, plugins)
|
||||
Console.echo_li("Compiling plugin scripts...")
|
||||
scripts = []
|
||||
@@ -618,9 +600,8 @@ module PluginManager
|
||||
GC.start
|
||||
Console.echo_done(true)
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Check if plugins need compiling
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.runPlugins
|
||||
Console.echo_h1("Checking plugins")
|
||||
# get the order of plugins to interpret
|
||||
@@ -668,9 +649,8 @@ module PluginManager
|
||||
Console.echoln_li_done("No plugins found")
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Get plugin dir from name based on meta entries
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.findDirectory(name)
|
||||
# go through the plugins folder
|
||||
Dir.get("Plugins").each do |dir|
|
||||
@@ -683,5 +663,4 @@ module PluginManager
|
||||
# return nil if no plugin dir found
|
||||
return nil
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
end
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class SpriteAnimation
|
||||
@@_animations = []
|
||||
@@_reference_count = {}
|
||||
@@ -53,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
|
||||
@@ -94,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
|
||||
@@ -110,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
|
||||
@@ -262,8 +255,9 @@ class SpriteAnimation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module RPG
|
||||
class Sprite < ::Sprite
|
||||
def initialize(viewport = nil)
|
||||
@@ -465,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
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
# Game_System class and the Game_Event class.
|
||||
#===============================================================================
|
||||
class Interpreter
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
# Object Initialization
|
||||
# depth : nest depth
|
||||
# main : main flag
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize(depth = 0, main = false)
|
||||
@depth = depth
|
||||
@main = main
|
||||
@@ -39,11 +37,10 @@ class Interpreter
|
||||
@renamed_choices = []
|
||||
end_follower_overrides
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Event Setup
|
||||
|
||||
# Event Setup
|
||||
# list : list of event commands
|
||||
# event_id : event ID
|
||||
#-----------------------------------------------------------------------------
|
||||
def setup(list, event_id, map_id = nil)
|
||||
clear
|
||||
@map_id = map_id || $game_map.map_id
|
||||
@@ -82,9 +79,7 @@ class Interpreter
|
||||
def running?
|
||||
return !@list.nil?
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Frame Update
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def update
|
||||
@loop_count = 0
|
||||
loop do
|
||||
@@ -135,9 +130,7 @@ class Interpreter
|
||||
@index += 1
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Execute script
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def execute_script(script)
|
||||
begin
|
||||
result = eval(script)
|
||||
@@ -150,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:"
|
||||
@@ -182,10 +175,7 @@ class Interpreter
|
||||
raise EventScriptError.new(err)
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get Character
|
||||
# parameter : parameter
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def get_character(parameter = 0)
|
||||
case parameter
|
||||
when -1 # player
|
||||
@@ -210,21 +200,18 @@ class Interpreter
|
||||
def get_event(parameter)
|
||||
return get_character(parameter)
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Freezes all events on the map (for use at the beginning of common events)
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Freezes all events on the map (for use at the beginning of common events)
|
||||
def pbGlobalLock
|
||||
$game_map.events.each_value { |event| event.minilock }
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Unfreezes all events on the map (for use at the end of common events)
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Unfreezes all events on the map (for use at the end of common events)
|
||||
def pbGlobalUnlock
|
||||
$game_map.events.each_value { |event| event.unlock }
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Gets the next index in the interpreter, ignoring certain commands between messages
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Gets the next index in the interpreter, ignoring certain commands between messages
|
||||
def pbNextIndex(index)
|
||||
return -1 if !@list || @list.length == 0
|
||||
i = index + 1
|
||||
@@ -292,9 +279,6 @@ class Interpreter
|
||||
@follower_animation_id = nil
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Various methods to be used in a script event command.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Helper function that shows a picture in a script.
|
||||
def pbShowPicture(number, name, origin, x, y, zoomX = 100, zoomY = 100, opacity = 255, blendType = 0)
|
||||
number += ($game_temp.in_battle ? 50 : 0)
|
||||
|
||||
@@ -121,6 +121,7 @@ class Interpreter
|
||||
def command_dummy
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * End Event
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -132,6 +133,7 @@ class Interpreter
|
||||
$game_map.events[@event_id].unlock
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Command Skip
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -142,6 +144,7 @@ class Interpreter
|
||||
@index += 1
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Command If
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -152,6 +155,7 @@ class Interpreter
|
||||
end
|
||||
return command_skip
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Show Text
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -203,6 +207,7 @@ class Interpreter
|
||||
@message_waiting = false
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Show Choices
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -289,6 +294,7 @@ class Interpreter
|
||||
return if !condition || nil_or_empty?(new_name)
|
||||
@renamed_choices[number - 1] = new_name
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * When [**]
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -300,6 +306,7 @@ class Interpreter
|
||||
end
|
||||
return command_skip
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * When Cancel
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -311,6 +318,7 @@ class Interpreter
|
||||
end
|
||||
return command_skip
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Input Number
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -325,6 +333,7 @@ class Interpreter
|
||||
@message_waiting = false
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Text Options
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -334,6 +343,7 @@ class Interpreter
|
||||
$game_system.message_frame = @parameters[1]
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Button Input Processing
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -371,6 +381,7 @@ class Interpreter
|
||||
@index += 1
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Wait
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -378,6 +389,7 @@ class Interpreter
|
||||
@wait_count = @parameters[0] * Graphics.frame_rate / 20
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Conditional Branch
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -433,6 +445,7 @@ class Interpreter
|
||||
end
|
||||
return command_skip
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Else
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -443,12 +456,14 @@ class Interpreter
|
||||
end
|
||||
return command_skip
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Loop
|
||||
#-----------------------------------------------------------------------------
|
||||
def command_112
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Repeat Above
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -459,6 +474,7 @@ class Interpreter
|
||||
return true if @list[@index].indent == indent
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Break Loop
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -475,6 +491,7 @@ class Interpreter
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Exit Event Processing
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -482,6 +499,7 @@ class Interpreter
|
||||
command_end
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Erase Event
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -493,6 +511,7 @@ class Interpreter
|
||||
@index += 1
|
||||
return false
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Call Common Event
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -504,12 +523,14 @@ class Interpreter
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Label
|
||||
#-----------------------------------------------------------------------------
|
||||
def command_118
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Jump to Label
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -528,6 +549,7 @@ class Interpreter
|
||||
temp_index += 1
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Control Switches
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -542,6 +564,7 @@ class Interpreter
|
||||
$game_map.need_refresh = true if should_refresh
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Control Variables
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -606,6 +629,7 @@ class Interpreter
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Control Self Switch
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -620,6 +644,7 @@ class Interpreter
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Control Timer
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -628,6 +653,7 @@ class Interpreter
|
||||
$game_system.timer = @parameters[1] * Graphics.frame_rate if @parameters[0] == 0
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Gold
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -642,6 +668,7 @@ class Interpreter
|
||||
def command_127; command_dummy; end # Change Weapons
|
||||
def command_128; command_dummy; end # Change Armor
|
||||
def command_129; command_dummy; end # Change Party Member
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Windowskin
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -654,6 +681,7 @@ class Interpreter
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Battle BGM
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -661,10 +689,12 @@ class Interpreter
|
||||
($PokemonGlobal.nextBattleBGM = @parameters[0]) ? @parameters[0].clone : nil
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Battle End ME
|
||||
#-----------------------------------------------------------------------------
|
||||
def command_133; command_dummy; end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Save Access
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -672,6 +702,7 @@ class Interpreter
|
||||
$game_system.save_disabled = (@parameters[0] == 0)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Menu Access
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -679,6 +710,7 @@ class Interpreter
|
||||
$game_system.menu_disabled = (@parameters[0] == 0)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Encounter
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -687,6 +719,7 @@ class Interpreter
|
||||
$game_player.make_encounter_count
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Transfer Player
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -716,6 +749,7 @@ class Interpreter
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Event Location
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -747,6 +781,7 @@ class Interpreter
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Scroll Map
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -756,6 +791,7 @@ class Interpreter
|
||||
$game_map.start_scroll(@parameters[0], @parameters[1], @parameters[2])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Map Settings
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -778,6 +814,7 @@ class Interpreter
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Fog Color Tone
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -785,6 +822,7 @@ class Interpreter
|
||||
$game_map.start_fog_tone_change(@parameters[0], @parameters[1] * Graphics.frame_rate / 20)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Fog Opacity
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -792,6 +830,7 @@ class Interpreter
|
||||
$game_map.start_fog_opacity_change(@parameters[0], @parameters[1] * Graphics.frame_rate / 20)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Show Animation
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -806,6 +845,7 @@ class Interpreter
|
||||
character.animation_id = @parameters[1]
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Transparent Flag
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -813,6 +853,7 @@ class Interpreter
|
||||
$game_player.transparent = (@parameters[0] == 0)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Move Route
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -827,6 +868,7 @@ class Interpreter
|
||||
character.force_move_route(@parameters[1])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Wait for Move's Completion
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -834,6 +876,7 @@ class Interpreter
|
||||
@move_route_waiting = true if !$game_temp.in_battle
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Prepare for Transition
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -842,6 +885,7 @@ class Interpreter
|
||||
Graphics.freeze
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Execute Transition
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -852,6 +896,7 @@ class Interpreter
|
||||
@index += 1
|
||||
return false
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Screen Color Tone
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -859,6 +904,7 @@ class Interpreter
|
||||
$game_screen.start_tone_change(@parameters[0], @parameters[1] * Graphics.frame_rate / 20)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Screen Flash
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -866,6 +912,7 @@ class Interpreter
|
||||
$game_screen.start_flash(@parameters[0], @parameters[1] * Graphics.frame_rate / 20)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Screen Shake
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -873,6 +920,7 @@ class Interpreter
|
||||
$game_screen.start_shake(@parameters[0], @parameters[1], @parameters[2] * Graphics.frame_rate / 20)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Show Picture
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -889,6 +937,7 @@ class Interpreter
|
||||
x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Move Picture
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -905,6 +954,7 @@ class Interpreter
|
||||
@parameters[2], x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Rotate Picture
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -913,6 +963,7 @@ class Interpreter
|
||||
$game_screen.pictures[number].rotate(@parameters[1])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Picture Color Tone
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -922,6 +973,7 @@ class Interpreter
|
||||
@parameters[2] * Graphics.frame_rate / 20)
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Erase Picture
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -930,6 +982,7 @@ class Interpreter
|
||||
$game_screen.pictures[number].erase
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Weather Effects
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -937,6 +990,7 @@ class Interpreter
|
||||
$game_screen.weather(@parameters[0], @parameters[1], @parameters[2])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Play BGM
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -944,6 +998,7 @@ class Interpreter
|
||||
pbBGMPlay(@parameters[0])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Fade Out BGM
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -951,6 +1006,7 @@ class Interpreter
|
||||
pbBGMFade(@parameters[0])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Play BGS
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -958,6 +1014,7 @@ class Interpreter
|
||||
pbBGSPlay(@parameters[0])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Fade Out BGS
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -965,6 +1022,7 @@ class Interpreter
|
||||
pbBGSFade(@parameters[0])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Memorize BGM/BGS
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -973,6 +1031,7 @@ class Interpreter
|
||||
$game_system.bgs_memorize
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Restore BGM/BGS
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -981,6 +1040,7 @@ class Interpreter
|
||||
$game_system.bgs_restore
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Play ME
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -988,6 +1048,7 @@ class Interpreter
|
||||
pbMEPlay(@parameters[0])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Play SE
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -995,6 +1056,7 @@ class Interpreter
|
||||
pbSEPlay(@parameters[0])
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Stop SE
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1008,6 +1070,7 @@ class Interpreter
|
||||
def command_602; command_if(1); end # If Escape
|
||||
def command_603; command_if(2); end # If Lose
|
||||
def command_302; command_dummy; end # Shop Processing
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Name Input Processing
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1018,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
|
||||
@@ -1033,6 +1096,7 @@ class Interpreter
|
||||
def command_311; command_dummy; end # Change HP
|
||||
def command_312; command_dummy; end # Change SP
|
||||
def command_313; command_dummy; end # Change State
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Recover All
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1065,6 +1129,7 @@ class Interpreter
|
||||
def command_338; command_dummy; end # Deal Damage
|
||||
def command_339; command_dummy; end # Force Action
|
||||
def command_340; command_dummy; end # Abort Battle
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Call Menu Screen
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1073,6 +1138,7 @@ class Interpreter
|
||||
@index += 1
|
||||
return false
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Call Save Screen
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1082,6 +1148,7 @@ class Interpreter
|
||||
screen.pbSaveScreen
|
||||
return true
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Game Over
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1090,6 +1157,7 @@ class Interpreter
|
||||
pbBGSFade(1.0)
|
||||
pbFadeOutIn { pbStartOver(true) }
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Return to Title Screen
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1097,6 +1165,7 @@ class Interpreter
|
||||
$game_temp.title_screen_calling = true
|
||||
return false
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Script
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
# flashing, etc. Refer to "$game_screen" for the instance of this class.
|
||||
#===============================================================================
|
||||
class Game_Screen
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Public Instance Variables
|
||||
#-----------------------------------------------------------------------------
|
||||
attr_reader :brightness # brightness
|
||||
attr_reader :tone # color tone
|
||||
attr_reader :flash_color # flash color
|
||||
@@ -17,9 +14,6 @@ class Game_Screen
|
||||
attr_reader :weather_max # max number of weather sprites
|
||||
attr_accessor :weather_duration # ticks in which the weather should fade in
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize
|
||||
@brightness = 255
|
||||
@fadeout_duration = 0
|
||||
@@ -42,52 +36,30 @@ class Game_Screen
|
||||
@weather_max = 0.0
|
||||
@weather_duration = 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Start Changing Color Tone
|
||||
# tone : color tone
|
||||
# duration : time
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def start_tone_change(tone, duration)
|
||||
@tone_target = tone.clone
|
||||
@tone_duration = duration
|
||||
if @tone_duration == 0
|
||||
@tone = @tone_target.clone
|
||||
@tone = @tone_target.clone if @tone_duration == 0
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Start Flashing
|
||||
# color : color
|
||||
# duration : time
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def start_flash(color, duration)
|
||||
@flash_color = color.clone
|
||||
@flash_duration = duration
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Start Shaking
|
||||
# power : strength
|
||||
# speed : speed
|
||||
# duration : time
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def start_shake(power, speed, duration)
|
||||
@shake_power = power
|
||||
@shake_speed = speed
|
||||
@shake_duration = duration
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Weather
|
||||
# type : type
|
||||
# power : strength
|
||||
# duration : time
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def weather(type, power, duration)
|
||||
@weather_type = GameData::Weather.get(type).id
|
||||
@weather_max = (power + 1) * RPG::Weather::MAX_SPRITES / 10
|
||||
@weather_duration = duration # In 1/20ths of a seconds
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Frame Update
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def update
|
||||
if @fadeout_duration && @fadeout_duration >= 1
|
||||
d = @fadeout_duration
|
||||
|
||||
@@ -5,25 +5,20 @@
|
||||
# Refer to "$game_switches" for the instance of this class.
|
||||
#===============================================================================
|
||||
class Game_Switches
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize
|
||||
@data = []
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get Switch
|
||||
|
||||
# Get Switch
|
||||
# switch_id : switch ID
|
||||
#-----------------------------------------------------------------------------
|
||||
def [](switch_id)
|
||||
return @data[switch_id] if switch_id <= 5000 && @data[switch_id]
|
||||
return false
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Switch
|
||||
|
||||
# Set Switch
|
||||
# switch_id : switch ID
|
||||
# value : ON (true) / OFF (false)
|
||||
#-----------------------------------------------------------------------------
|
||||
def []=(switch_id, value)
|
||||
@data[switch_id] = value if switch_id <= 5000
|
||||
end
|
||||
|
||||
@@ -5,25 +5,20 @@
|
||||
# Refer to "$game_variables" for the instance of this class.
|
||||
#===============================================================================
|
||||
class Game_Variables
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize
|
||||
@data = []
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get Variable
|
||||
|
||||
# Get Variable
|
||||
# variable_id : variable ID
|
||||
#-----------------------------------------------------------------------------
|
||||
def [](variable_id)
|
||||
return @data[variable_id] if variable_id <= 5000 && !@data[variable_id].nil?
|
||||
return 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Variable
|
||||
|
||||
# Set Variable
|
||||
# variable_id : variable ID
|
||||
# value : the variable's value
|
||||
#-----------------------------------------------------------------------------
|
||||
def []=(variable_id, value)
|
||||
@data[variable_id] = value if variable_id <= 5000
|
||||
end
|
||||
|
||||
@@ -5,24 +5,19 @@
|
||||
# "Hash." Refer to "$game_self_switches" for the instance of this class.
|
||||
#===============================================================================
|
||||
class Game_SelfSwitches
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize
|
||||
@data = {}
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get Self Switch
|
||||
|
||||
# Get Self Switch
|
||||
# key : key
|
||||
#-----------------------------------------------------------------------------
|
||||
def [](key)
|
||||
return @data[key] == true
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Self Switch
|
||||
|
||||
# Set Self Switch
|
||||
# key : key
|
||||
# value : ON (true) / OFF (false)
|
||||
#-----------------------------------------------------------------------------
|
||||
def []=(key, value)
|
||||
@data[key] = value
|
||||
end
|
||||
|
||||
@@ -4,11 +4,7 @@
|
||||
# This class handles the picture. It's used within the Game_Screen class
|
||||
# ($game_screen).
|
||||
#===============================================================================
|
||||
|
||||
class Game_Picture
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Public Instance Variables
|
||||
#-----------------------------------------------------------------------------
|
||||
attr_reader :number # picture number
|
||||
attr_reader :name # file name
|
||||
attr_reader :origin # starting point
|
||||
@@ -21,10 +17,6 @@ class Game_Picture
|
||||
attr_reader :tone # color tone
|
||||
attr_reader :angle # rotation angle
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
# number : picture number
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize(number)
|
||||
@number = number
|
||||
@name = ""
|
||||
@@ -47,8 +39,8 @@ class Game_Picture
|
||||
@angle = 0
|
||||
@rotate_speed = 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Show Picture
|
||||
|
||||
# Show Picture
|
||||
# name : file name
|
||||
# origin : starting point
|
||||
# x : x-coordinate
|
||||
@@ -57,7 +49,6 @@ class Game_Picture
|
||||
# zoom_y : y directional zoom rate
|
||||
# opacity : opacity level
|
||||
# blend_type : blend method
|
||||
#-----------------------------------------------------------------------------
|
||||
def show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
|
||||
@name = name
|
||||
@origin = origin
|
||||
@@ -79,8 +70,8 @@ class Game_Picture
|
||||
@angle = 0
|
||||
@rotate_speed = 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Move Picture
|
||||
|
||||
# Move Picture
|
||||
# duration : time
|
||||
# origin : starting point
|
||||
# x : x-coordinate
|
||||
@@ -89,7 +80,6 @@ class Game_Picture
|
||||
# zoom_y : y directional zoom rate
|
||||
# opacity : opacity level
|
||||
# blend_type : blend method
|
||||
#-----------------------------------------------------------------------------
|
||||
def move(duration, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
|
||||
@duration = duration
|
||||
@origin = origin
|
||||
@@ -100,34 +90,28 @@ class Game_Picture
|
||||
@target_opacity = opacity.to_f
|
||||
@blend_type = blend_type || 0
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Change Rotation Speed
|
||||
|
||||
# Change Rotation Speed
|
||||
# speed : rotation speed
|
||||
#-----------------------------------------------------------------------------
|
||||
def rotate(speed)
|
||||
@rotate_speed = speed
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Start Change of Color Tone
|
||||
|
||||
# Start Change of Color Tone
|
||||
# tone : color tone
|
||||
# duration : time
|
||||
#-----------------------------------------------------------------------------
|
||||
def start_tone_change(tone, duration)
|
||||
@tone_target = tone.clone
|
||||
@tone_duration = duration
|
||||
if @tone_duration == 0
|
||||
@tone = @tone_target.clone
|
||||
@tone = @tone_target.clone if @tone_duration == 0
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Erase Picture
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Erase Picture
|
||||
def erase
|
||||
@name = ""
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Frame Update
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Frame Update
|
||||
def update
|
||||
if @duration >= 1
|
||||
d = @duration
|
||||
|
||||
@@ -106,28 +106,24 @@ class Game_Map
|
||||
return GameData::MapMetadata.try_get(@map_id)
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Returns the name of this map's BGM. If it's night time, returns the night
|
||||
# version of the BGM (if it exists).
|
||||
#-----------------------------------------------------------------------------
|
||||
def bgm_name
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + @map.bgm.name + "_n")
|
||||
return @map.bgm.name + "_n"
|
||||
end
|
||||
return @map.bgm.name
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Autoplays background music
|
||||
|
||||
# Autoplays background music
|
||||
# Plays music called "[normal BGM]_n" if it's night time and it exists
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoplayAsCue
|
||||
pbCueBGM(bgm_name, 1.0, @map.bgm.volume, @map.bgm.pitch) if @map.autoplay_bgm
|
||||
pbBGSPlay(@map.bgs) if @map.autoplay_bgs
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Plays background music
|
||||
|
||||
# Plays background music
|
||||
# Plays music called "[normal BGM]_n" if it's night time and it exists
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoplay
|
||||
pbBGMPlay(bgm_name, @map.bgm.volume, @map.bgm.pitch) if @map.autoplay_bgm
|
||||
pbBGSPlay(@map.bgs) if @map.autoplay_bgs
|
||||
@@ -249,7 +245,7 @@ class Game_Map
|
||||
end
|
||||
|
||||
# Returns whether the position x,y is fully passable (there is no blocking
|
||||
# event there, and the tile is fully passable in all directions)
|
||||
# event there, and the tile is fully passable in all directions).
|
||||
def passableStrict?(x, y, d, self_event = nil)
|
||||
return false if !valid?(x, y)
|
||||
events.each_value do |event|
|
||||
@@ -375,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,78 +5,78 @@
|
||||
# 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
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Interpreter
|
||||
SCROLL_SPEED_DEFAULT = 4
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Map Autoscroll to Coordinates
|
||||
# Map Autoscroll to Coordinates
|
||||
# x : x coordinate to scroll to and center on
|
||||
# y : y coordinate to scroll to and center on
|
||||
# speed : (optional) scroll speed (from 1-6, default being 4)
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoscroll(x, y, speed = SCROLL_SPEED_DEFAULT)
|
||||
if $game_map.scrolling?
|
||||
return false
|
||||
@@ -130,17 +130,16 @@ class Interpreter
|
||||
return !@diag
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Map Autoscroll (to Player)
|
||||
# Map Autoscroll (to Player)
|
||||
# speed : (optional) scroll speed (from 1-6, default being 4)
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoscroll_player(speed = SCROLL_SPEED_DEFAULT)
|
||||
autoscroll($game_player.x, $game_player.y, speed)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Game_Map
|
||||
def scroll_downright(distance)
|
||||
@display_x = [@display_x + distance,
|
||||
|
||||
@@ -355,7 +355,7 @@ class PokemonMapFactory
|
||||
|
||||
def updateMaps(scene)
|
||||
updateMapsInternal
|
||||
$map_factory.setSceneStarted(scene) if @mapChanged
|
||||
setSceneStarted(scene) if @mapChanged
|
||||
end
|
||||
|
||||
def updateMapsInternal
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -763,26 +763,33 @@ class Game_Character
|
||||
@jump_speed_real = nil # Reset jump speed
|
||||
@jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile
|
||||
end
|
||||
@stop_count = 0
|
||||
triggerLeaveTile
|
||||
increase_steps
|
||||
end
|
||||
|
||||
def jumpForward
|
||||
def jumpForward(distance = 1)
|
||||
return false if distance == 0
|
||||
old_x = @x
|
||||
old_y = @y
|
||||
case self.direction
|
||||
when 2 then jump(0, 1) # down
|
||||
when 4 then jump(-1, 0) # left
|
||||
when 6 then jump(1, 0) # right
|
||||
when 8 then jump(0, -1) # up
|
||||
when 2 then jump(0, distance) # down
|
||||
when 4 then jump(-distance, 0) # left
|
||||
when 6 then jump(distance, 0) # right
|
||||
when 8 then jump(0, -distance) # up
|
||||
end
|
||||
return @x != old_x || @y != old_y
|
||||
end
|
||||
|
||||
def jumpBackward
|
||||
def jumpBackward(distance = 1)
|
||||
return false if distance == 0
|
||||
old_x = @x
|
||||
old_y = @y
|
||||
case self.direction
|
||||
when 2 then jump(0, -1) # down
|
||||
when 4 then jump(1, 0) # left
|
||||
when 6 then jump(-1, 0) # right
|
||||
when 8 then jump(0, 1) # up
|
||||
when 2 then jump(0, -distance) # down
|
||||
when 4 then jump(distance, 0) # left
|
||||
when 6 then jump(-distance, 0) # right
|
||||
when 8 then jump(0, distance) # up
|
||||
end
|
||||
return @x != old_x || @y != old_y
|
||||
end
|
||||
|
||||
def turn_generic(dir)
|
||||
@@ -926,12 +933,16 @@ class Game_Character
|
||||
@real_y = dest_y if @real_y < dest_y + 0.1
|
||||
end
|
||||
# Refresh how far is left to travel in a jump
|
||||
if jumping?
|
||||
was_jumping = jumping?
|
||||
if was_jumping
|
||||
@jump_count -= 1 if @jump_count > 0 # For stationary jumps only
|
||||
@jump_distance_left = [(dest_x - @real_x).abs, (dest_y - @real_y).abs].max
|
||||
end
|
||||
# End of a step, so perform events that happen at this time
|
||||
if !jumping? && !moving?
|
||||
if was_jumping && !(self.is_a?(Game_Player) && $PokemonGlobal.surfing && !$game_temp.ending_surf)
|
||||
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID, @x, @y, true, 1)
|
||||
end
|
||||
EventHandlers.trigger(:on_step_taken, self)
|
||||
calculate_bush_depth
|
||||
@stopped_this_frame = true
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -116,26 +116,39 @@ class Game_Player < Game_Character
|
||||
@bump_se = Graphics.frame_rate / 4
|
||||
end
|
||||
|
||||
def add_move_distance_to_stats(distance = 1)
|
||||
if $PokemonGlobal&.diving || $PokemonGlobal&.surfing
|
||||
$stats.distance_surfed += distance
|
||||
elsif $PokemonGlobal&.bicycle
|
||||
$stats.distance_cycled += distance
|
||||
else
|
||||
$stats.distance_walked += distance
|
||||
end
|
||||
$stats.distance_slid_on_ice += distance if $PokemonGlobal.ice_sliding
|
||||
end
|
||||
|
||||
def move_generic(dir, turn_enabled = true)
|
||||
turn_generic(dir, true) if turn_enabled
|
||||
if !$game_temp.encounter_triggered
|
||||
if can_move_in_direction?(dir)
|
||||
x_offset = (dir == 4) ? -1 : (dir == 6) ? 1 : 0
|
||||
y_offset = (dir == 8) ? -1 : (dir == 2) ? 1 : 0
|
||||
return if pbLedge(x_offset, y_offset)
|
||||
# Jump over ledges
|
||||
if pbFacingTerrainTag.ledge
|
||||
if jumpForward(2)
|
||||
pbSEPlay("Player jump")
|
||||
increase_steps
|
||||
end
|
||||
return
|
||||
end
|
||||
# Jumping out of surfing back onto land
|
||||
return if pbEndSurf(x_offset, y_offset)
|
||||
# General movement
|
||||
turn_generic(dir, true)
|
||||
if !$game_temp.encounter_triggered
|
||||
@x += x_offset
|
||||
@y += y_offset
|
||||
if $PokemonGlobal&.diving || $PokemonGlobal&.surfing
|
||||
$stats.distance_surfed += 1
|
||||
elsif $PokemonGlobal&.bicycle
|
||||
$stats.distance_cycled += 1
|
||||
else
|
||||
$stats.distance_walked += 1
|
||||
end
|
||||
$stats.distance_slid_on_ice += 1 if $PokemonGlobal.ice_sliding
|
||||
add_move_distance_to_stats(x_offset.abs + y_offset.abs)
|
||||
increase_steps
|
||||
end
|
||||
elsif !check_event_trigger_touch(dir)
|
||||
@@ -155,36 +168,10 @@ class Game_Player < Game_Character
|
||||
end
|
||||
|
||||
def jump(x_plus, y_plus)
|
||||
if x_plus != 0 || y_plus != 0
|
||||
if x_plus.abs > y_plus.abs
|
||||
(x_plus < 0) ? turn_left : turn_right
|
||||
else
|
||||
(y_plus < 0) ? turn_up : turn_down
|
||||
end
|
||||
each_occupied_tile { |i, j| return if !passable?(i + x_plus, j + y_plus, 0) }
|
||||
end
|
||||
@x = @x + x_plus
|
||||
@y = @y + y_plus
|
||||
real_distance = Math.sqrt((x_plus * x_plus) + (y_plus * y_plus))
|
||||
distance = [1, real_distance].max
|
||||
@jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping
|
||||
@jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max
|
||||
@jump_distance_left = 1 # Just needs to be non-zero
|
||||
if real_distance > 0 # Jumping to somewhere else
|
||||
if $PokemonGlobal&.diving || $PokemonGlobal&.surfing
|
||||
$stats.distance_surfed += x_plus.abs + y_plus.abs
|
||||
elsif $PokemonGlobal&.bicycle
|
||||
$stats.distance_cycled += x_plus.abs + y_plus.abs
|
||||
else
|
||||
$stats.distance_walked += x_plus.abs + y_plus.abs
|
||||
end
|
||||
@jump_count = 0
|
||||
else # Jumping on the spot
|
||||
@jump_speed_real = nil # Reset jump speed
|
||||
@jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile
|
||||
end
|
||||
@stop_count = 0
|
||||
triggerLeaveTile
|
||||
old_x = @x
|
||||
old_y = @y
|
||||
super
|
||||
add_move_distance_to_stats(x_plus.abs + y_plus.abs) if @x != old_x || @y != old_y
|
||||
end
|
||||
|
||||
def pbTriggeredTrainerEvents(triggers, checkIfRunning = true, trainer_only = false)
|
||||
@@ -267,13 +254,11 @@ class Game_Player < Game_Character
|
||||
return $game_map.terrain_tag(facing[1], facing[2])
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Passable Determinants
|
||||
# Passable Determinants
|
||||
# x : x-coordinate
|
||||
# y : y-coordinate
|
||||
# d : direction (0,2,4,6,8)
|
||||
# d : direction (0, 2, 4, 6, 8)
|
||||
# * 0 = Determines if all directions are impassable (for jumping)
|
||||
#-----------------------------------------------------------------------------
|
||||
def passable?(x, y, d, strict = false)
|
||||
# Get new coordinates
|
||||
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
|
||||
@@ -289,28 +274,22 @@ class Game_Player < Game_Character
|
||||
return super
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Set Map Display Position to Center of Screen
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set Map Display Position to Center of Screen
|
||||
def center(x, y)
|
||||
self.map.display_x = (x * Game_Map::REAL_RES_X) - SCREEN_CENTER_X
|
||||
self.map.display_y = (y * Game_Map::REAL_RES_Y) - SCREEN_CENTER_Y
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Move to Designated Position
|
||||
# Move to Designated Position
|
||||
# x : x-coordinate
|
||||
# y : y-coordinate
|
||||
#-----------------------------------------------------------------------------
|
||||
def moveto(x, y)
|
||||
super
|
||||
center(x, y)
|
||||
make_encounter_count
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Make Encounter Count
|
||||
#-----------------------------------------------------------------------------
|
||||
# Make Encounter Count
|
||||
def make_encounter_count
|
||||
# Image of two dice rolling
|
||||
if $game_map.map_id != 0
|
||||
@@ -319,18 +298,13 @@ class Game_Player < Game_Character
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Refresh
|
||||
#-----------------------------------------------------------------------------
|
||||
def refresh
|
||||
@opacity = 255
|
||||
@blend_type = 0
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Trigger event(s) at the same coordinates as self with the appropriate
|
||||
# Trigger event(s) at the same coordinates as self with the appropriate
|
||||
# trigger(s) that can be triggered
|
||||
#-----------------------------------------------------------------------------
|
||||
def check_event_trigger_here(triggers)
|
||||
result = false
|
||||
# If event is running
|
||||
@@ -348,9 +322,7 @@ class Game_Player < Game_Character
|
||||
return result
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Front Event Starting Determinant
|
||||
#-----------------------------------------------------------------------------
|
||||
# Front Event Starting Determinant
|
||||
def check_event_trigger_there(triggers)
|
||||
result = false
|
||||
# If event is running
|
||||
@@ -389,9 +361,7 @@ class Game_Player < Game_Character
|
||||
return result
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Touch Event Starting Determinant
|
||||
#-----------------------------------------------------------------------------
|
||||
# Touch Event Starting Determinant
|
||||
def check_event_trigger_touch(dir)
|
||||
result = false
|
||||
return result if $game_system.map_interpreter.running?
|
||||
@@ -417,9 +387,6 @@ class Game_Player < Game_Character
|
||||
return result
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Frame Update
|
||||
#-----------------------------------------------------------------------------
|
||||
def update
|
||||
last_real_x = @real_x
|
||||
last_real_y = @real_y
|
||||
@@ -434,12 +401,6 @@ class Game_Player < Game_Character
|
||||
$game_temp.followers.update
|
||||
# Count down the time between allowed bump sounds
|
||||
@bump_se -= 1 if @bump_se && @bump_se > 0
|
||||
# Finish up dismounting from surfing
|
||||
if $game_temp.ending_surf && !moving?
|
||||
pbCancelVehicles
|
||||
$game_temp.surf_base_coords = nil
|
||||
$game_temp.ending_surf = false
|
||||
end
|
||||
update_event_triggering
|
||||
end
|
||||
|
||||
@@ -531,21 +492,21 @@ class Game_Player < Game_Character
|
||||
end
|
||||
end
|
||||
|
||||
# Track the player on-screen as they move
|
||||
# Track the player on-screen as they move.
|
||||
def update_screen_position(last_real_x, last_real_y)
|
||||
return if self.map.scrolling? || !(@moved_last_frame || @moved_this_frame)
|
||||
if (@real_x < last_real_x && @real_x - $game_map.display_x < SCREEN_CENTER_X) ||
|
||||
(@real_x > last_real_x && @real_x - $game_map.display_x > SCREEN_CENTER_X)
|
||||
if (@real_x < last_real_x && @real_x < $game_map.display_x + SCREEN_CENTER_X) ||
|
||||
(@real_x > last_real_x && @real_x > $game_map.display_x + SCREEN_CENTER_X)
|
||||
self.map.display_x += @real_x - last_real_x
|
||||
end
|
||||
if (@real_y < last_real_y && @real_y - $game_map.display_y < SCREEN_CENTER_Y) ||
|
||||
(@real_y > last_real_y && @real_y - $game_map.display_y > SCREEN_CENTER_Y)
|
||||
if (@real_y < last_real_y && @real_y < $game_map.display_y + SCREEN_CENTER_Y) ||
|
||||
(@real_y > last_real_y && @real_y > $game_map.display_y + SCREEN_CENTER_Y)
|
||||
self.map.display_y += @real_y - last_real_y
|
||||
end
|
||||
end
|
||||
|
||||
def update_event_triggering
|
||||
return if moving? || $PokemonGlobal.ice_sliding
|
||||
return if moving? || jumping? || $PokemonGlobal.ice_sliding
|
||||
# Try triggering events upon walking into them/in front of them
|
||||
if @moved_this_frame
|
||||
$game_temp.followers.turn_followers
|
||||
@@ -564,8 +525,6 @@ class Game_Player < Game_Character
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -5,42 +5,28 @@
|
||||
# event. This class is used within the Game_Map class ($game_map).
|
||||
#===============================================================================
|
||||
class Game_CommonEvent
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
# common_event_id : common event ID
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize(common_event_id)
|
||||
@common_event_id = common_event_id
|
||||
@interpreter = nil
|
||||
refresh
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get Name
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def name
|
||||
return $data_common_events[@common_event_id].name
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get Trigger
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def trigger
|
||||
return $data_common_events[@common_event_id].trigger
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get Condition Switch ID
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def switch_id
|
||||
return $data_common_events[@common_event_id].switch_id
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Get List of Event Commands
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def list
|
||||
return $data_common_events[@common_event_id].list
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Checks if switch is on
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def switchIsOn?(id)
|
||||
switchName = $data_system.switches[id]
|
||||
return false if !switchName
|
||||
@@ -50,22 +36,16 @@ class Game_CommonEvent
|
||||
return $game_switches[id]
|
||||
end
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Refresh
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Frame Update
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def update
|
||||
return if !@interpreter
|
||||
# Set up event if interpreter is not running
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -388,7 +388,6 @@ module Followers
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class BushBitmap
|
||||
def initialize(bitmap, isTile, depth)
|
||||
@bitmaps = []
|
||||
@@ -53,8 +56,9 @@ class BushBitmap
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Sprite_Character < RPG::Sprite
|
||||
attr_accessor :character
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# Unused
|
||||
#===============================================================================
|
||||
# Unused.
|
||||
#===============================================================================
|
||||
class ClippableSprite < Sprite_Character
|
||||
def initialize(viewport, event, tilemap)
|
||||
@tilemap = tilemap
|
||||
@@ -29,8 +31,9 @@ class ClippableSprite < Sprite_Character
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Spriteset_Map
|
||||
attr_reader :map
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
=begin
|
||||
A sprite whose sole purpose is to display an animation. This sprite
|
||||
can be displayed anywhere on the map and is disposed
|
||||
automatically when its animation is finished.
|
||||
Used for grass rustling and so forth.
|
||||
=end
|
||||
#===============================================================================
|
||||
# A sprite whose sole purpose is to display an animation. This sprite can be
|
||||
# displayed anywhere on the map and is disposed automatically when its animation
|
||||
# is finished. Used for grass rustling and so forth.
|
||||
#===============================================================================
|
||||
class AnimationSprite < RPG::Sprite
|
||||
def initialize(animID, map, tileX, tileY, viewport = nil, tinting = false, height = 3)
|
||||
super(viewport)
|
||||
@@ -38,8 +37,9 @@ class AnimationSprite < RPG::Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Spriteset_Map
|
||||
alias _animationSprite_initialize initialize unless private_method_defined?(:_animationSprite_initialize)
|
||||
alias _animationSprite_update update unless method_defined?(:_animationSprite_update)
|
||||
|
||||
@@ -117,11 +117,9 @@ class Sprite_Shadow < RPG::Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
# ? CLASS Sprite_Character edit
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
class Sprite_Character < RPG::Sprite
|
||||
alias shadow_initialize initialize unless private_method_defined?(:shadow_initialize)
|
||||
|
||||
@@ -161,20 +159,16 @@ class Sprite_Character < RPG::Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
# ? CLASS Game_Event edit
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
class Game_Event
|
||||
attr_accessor :id
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
# ? CLASS Spriteset_Map edit
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
class Spriteset_Map
|
||||
attr_accessor :shadows
|
||||
|
||||
@@ -202,9 +196,7 @@ class Spriteset_Map
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
# ? XPML Definition, by Rataime, using ideas from Near Fantastica
|
||||
#
|
||||
# Returns nil if the markup wasn't present at all,
|
||||
@@ -222,7 +214,7 @@ end
|
||||
# p XPML_read("second", event_id) -> [1, "two"]
|
||||
# p XPML_read("third", event_id) -> [3]
|
||||
# p XPML_read("forth", event_id) -> nil
|
||||
#===================================================
|
||||
#===============================================================================
|
||||
def XPML_read(map, markup, event, max_param_number = 0)
|
||||
parameter_list = nil
|
||||
return nil if !event || event.list.nil?
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#===============================================================================
|
||||
# Particle Engine, Peter O., 2007-11-03
|
||||
# Based on version 2 by Near Fantastica, 04.01.06
|
||||
# In turn based on the Particle Engine designed by PinkMan
|
||||
#===============================================================================
|
||||
class Particle_Engine
|
||||
def initialize(viewport = nil, map = nil)
|
||||
@map = (map) ? map : $game_map
|
||||
@@ -98,8 +100,9 @@ class Particle_Engine
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class ParticleEffect
|
||||
attr_accessor :x, :y, :z
|
||||
|
||||
@@ -113,8 +116,9 @@ class ParticleEffect
|
||||
def dispose; end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class ParticleSprite
|
||||
attr_accessor :x, :y, :z, :ox, :oy, :opacity, :blend_type
|
||||
attr_reader :bitmap
|
||||
@@ -171,8 +175,9 @@ class ParticleSprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class ParticleEffect_Event < ParticleEffect
|
||||
attr_accessor :event
|
||||
|
||||
@@ -357,8 +362,9 @@ class ParticleEffect_Event < ParticleEffect
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Fire < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -368,8 +374,9 @@ class Particle_Engine::Fire < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Smoke < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -379,8 +386,9 @@ class Particle_Engine::Smoke < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Teleport < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -394,8 +402,9 @@ class Particle_Engine::Teleport < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Spirit < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -405,8 +414,9 @@ class Particle_Engine::Spirit < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Explosion < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -416,8 +426,9 @@ class Particle_Engine::Explosion < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Aura < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -427,8 +438,9 @@ class Particle_Engine::Aura < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Soot < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -438,8 +450,9 @@ class Particle_Engine::Soot < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::SootSmoke < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -452,8 +465,9 @@ class Particle_Engine::SootSmoke < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Rocket < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -463,8 +477,9 @@ class Particle_Engine::Rocket < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::FixedTeleport < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -478,9 +493,9 @@ class Particle_Engine::FixedTeleport < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# By Peter O.
|
||||
#===============================================================================
|
||||
class Particle_Engine::StarTeleport < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -494,8 +509,9 @@ class Particle_Engine::StarTeleport < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Smokescreen < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -531,8 +547,9 @@ class Particle_Engine::Smokescreen < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Flare < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -542,8 +559,9 @@ class Particle_Engine::Flare < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Particle_Engine::Splash < ParticleEffect_Event
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
@@ -561,8 +579,9 @@ class Particle_Engine::Splash < ParticleEffect_Event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Game_Event < Game_Character
|
||||
attr_accessor :pe_refresh
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PictureOrigin
|
||||
TOP_LEFT = 0
|
||||
CENTER = 1
|
||||
@@ -12,8 +15,9 @@ class PictureOrigin
|
||||
RIGHT = 8
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Processes
|
||||
XY = 0
|
||||
DELTA_XY = 1
|
||||
@@ -35,8 +39,9 @@ class Processes
|
||||
CROP_BOTTOM = 17
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def getCubicPoint2(src, t)
|
||||
x0 = src[0]
|
||||
y0 = src[1]
|
||||
@@ -72,8 +77,6 @@ def getCubicPoint2(src, t)
|
||||
return [cx, cy]
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# PictureEx
|
||||
#===============================================================================
|
||||
@@ -456,8 +459,6 @@ class PictureEx
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Interpolator
|
||||
ZOOM_X = 1
|
||||
ZOOM_Y = 2
|
||||
@@ -83,8 +86,9 @@ class Interpolator
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class RectInterpolator
|
||||
def initialize(oldrect, newrect, frames)
|
||||
restart(oldrect, newrect, frames)
|
||||
@@ -130,8 +134,9 @@ class RectInterpolator
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PointInterpolator
|
||||
attr_reader :x
|
||||
attr_reader :y
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Hangup < Exception; end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module RPG
|
||||
module Cache
|
||||
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")
|
||||
@@ -17,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)
|
||||
@@ -106,8 +110,9 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class BitmapWrapper < Bitmap
|
||||
attr_reader :refcount
|
||||
attr_accessor :never_dispose
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module MessageConfig
|
||||
LIGHT_TEXT_MAIN_COLOR = Color.new(248, 248, 248)
|
||||
LIGHT_TEXT_SHADOW_COLOR = Color.new(72, 80, 88)
|
||||
@@ -163,8 +166,6 @@ module MessageConfig
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Position a window
|
||||
#===============================================================================
|
||||
@@ -207,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
|
||||
@@ -256,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
|
||||
@@ -622,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])
|
||||
@@ -659,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.
|
||||
@@ -730,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
|
||||
@@ -752,35 +747,31 @@ 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
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Ensure required method definitions
|
||||
# Ensure required method definitions.
|
||||
#===============================================================================
|
||||
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
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Ensure required method definitions.
|
||||
#===============================================================================
|
||||
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
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class WindowCursorRect < Rect
|
||||
def initialize(window)
|
||||
super(0, 0, 0, 0)
|
||||
@@ -39,6 +42,8 @@ class WindowCursorRect < Rect
|
||||
@window.width = @window.width
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
private
|
||||
|
||||
def needs_update?(x, y, width, height)
|
||||
@@ -46,7 +51,9 @@ class WindowCursorRect < Rect
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Window
|
||||
attr_reader :tone
|
||||
attr_reader :color
|
||||
@@ -318,6 +325,8 @@ class Window
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
private
|
||||
|
||||
def ensureBitmap(bitmap, dwidth, dheight)
|
||||
|
||||
@@ -34,18 +34,19 @@ 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
|
||||
attr_reader :skinformat
|
||||
attr_reader :skinrect
|
||||
|
||||
def compat=(value)
|
||||
@compat = value
|
||||
@@ -76,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
|
||||
@@ -324,10 +325,6 @@ class SpriteWindow < Window
|
||||
end
|
||||
end
|
||||
|
||||
#############
|
||||
attr_reader :skinformat
|
||||
attr_reader :skinrect
|
||||
|
||||
def loadSkinFile(_file)
|
||||
if (self.windowskin.width == 80 || self.windowskin.width == 96) &&
|
||||
self.windowskin.height == 48
|
||||
@@ -437,7 +434,8 @@ class SpriteWindow < Window
|
||||
privRefresh
|
||||
end
|
||||
|
||||
#############
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
private
|
||||
|
||||
def ensureBitmap(bitmap, dwidth, dheight)
|
||||
@@ -516,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
|
||||
@@ -541,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
|
||||
@@ -631,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
|
||||
@@ -668,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
|
||||
@@ -743,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])
|
||||
@@ -753,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
|
||||
@@ -813,13 +811,11 @@ class SpriteWindow < Window
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class SpriteWindow_Base < SpriteWindow
|
||||
TEXTPADDING = 4 # In pixels
|
||||
TEXT_PADDING = 4 # In pixels
|
||||
|
||||
def initialize(x, y, width, height)
|
||||
super()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
# Represents a window with no formatting capabilities. Its text color can be set,
|
||||
# though, and line breaks are supported, but the text is generally unformatted.
|
||||
#===============================================================================
|
||||
class Window_UnformattedTextPokemon < SpriteWindow_Base
|
||||
attr_reader :text
|
||||
attr_reader :baseColor
|
||||
@@ -52,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
|
||||
|
||||
@@ -63,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
|
||||
@@ -106,8 +105,6 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -214,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
|
||||
@@ -224,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
|
||||
@@ -309,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|
|
||||
@@ -336,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|
|
||||
@@ -589,6 +586,8 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
@frameskipChanged = false
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
private
|
||||
|
||||
def curcharSkip(skip)
|
||||
@@ -602,8 +601,6 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -709,6 +706,8 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
@frame = (@frame + 1) % 30
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
private
|
||||
|
||||
def textHelper(x, y, text, i)
|
||||
@@ -723,8 +722,6 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -902,6 +899,8 @@ class SpriteWindow_Selectable < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
private
|
||||
|
||||
def priv_page_row_max
|
||||
@@ -951,8 +950,6 @@ class SpriteWindow_Selectable < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -1016,8 +1013,6 @@ module UpDownArrowMixin
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -1030,8 +1025,6 @@ class SpriteWindow_SelectableEx < SpriteWindow_Selectable
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -1087,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
|
||||
@@ -1137,8 +1130,6 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -1229,15 +1220,12 @@ class Window_CommandPokemon < Window_DrawableCommand
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Window_CommandPokemonEx < Window_CommandPokemon
|
||||
end
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -1247,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]
|
||||
@@ -1350,8 +1338,6 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -51,8 +51,6 @@ class IconWindow < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Displays an icon bitmap in a window. Supports animated images.
|
||||
# Accepts bitmaps and paths to bitmap files in its constructor.
|
||||
|
||||
@@ -88,8 +88,6 @@ class SpriteWrapper
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Sprite class that maintains a bitmap of its own.
|
||||
# This bitmap can't be changed to a different one.
|
||||
@@ -111,8 +109,6 @@ class BitmapSprite < Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -237,8 +233,6 @@ class AnimatedSprite < Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Displays an icon bitmap in a sprite. Supports animated images.
|
||||
#===============================================================================
|
||||
@@ -310,8 +304,6 @@ class IconSprite < Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Sprite class that stores multiple bitmaps, and displays only one at once.
|
||||
#===============================================================================
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -54,8 +54,6 @@ def getContrastColor(color)
|
||||
return color.get_contrast_color
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Format text
|
||||
#===============================================================================
|
||||
@@ -99,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)
|
||||
@@ -248,76 +244,82 @@ def getLastColors(colorstack, opacitystack, defaultcolors)
|
||||
return colors
|
||||
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:
|
||||
# ' - Converted to "'".
|
||||
# < - Converted to "<".
|
||||
# > - Converted to ">".
|
||||
# & - Converted to "&".
|
||||
# " - 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:
|
||||
' - Converted to "'".
|
||||
< - Converted to "<".
|
||||
> - Converted to ">".
|
||||
& - Converted to "&".
|
||||
" - 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)
|
||||
@@ -520,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
|
||||
@@ -644,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
|
||||
@@ -701,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
|
||||
@@ -744,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
|
||||
@@ -774,8 +768,6 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
return characters
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Draw text and images on a bitmap
|
||||
#===============================================================================
|
||||
@@ -881,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
|
||||
@@ -1109,8 +1099,6 @@ def pbDrawTextPositions(bitmap, textpos)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Draw images on a bitmap
|
||||
#===============================================================================
|
||||
|
||||
@@ -49,8 +49,6 @@ def pbCurrentEventCommentInput(elements, trigger)
|
||||
return pbEventCommentInput(event, elements, trigger)
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -147,6 +145,8 @@ class ChooseNumberParams
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
private
|
||||
|
||||
def clamp(v, mn, mx)
|
||||
@@ -164,8 +164,9 @@ class ChooseNumberParams
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbChooseNumber(msgwindow, params)
|
||||
return 0 if !params
|
||||
ret = 0
|
||||
@@ -208,8 +209,6 @@ def pbChooseNumber(msgwindow, params)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -244,8 +243,6 @@ class FaceWindowVX < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -311,8 +308,6 @@ def pbCsvPosInt!(str)
|
||||
return ret.to_i
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Money and coins windows
|
||||
#===============================================================================
|
||||
@@ -368,8 +363,6 @@ def pbDisplayBattlePointsWindow(msgwindow)
|
||||
return pointswindow
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -410,8 +403,6 @@ def pbDisposeMessageWindow(msgwindow)
|
||||
msgwindow.dispose
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Main message-displaying function
|
||||
#===============================================================================
|
||||
@@ -433,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
|
||||
@@ -456,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
|
||||
@@ -464,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] }
|
||||
@@ -477,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 = ""
|
||||
@@ -675,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
|
||||
@@ -701,8 +686,6 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Message-displaying functions
|
||||
#===============================================================================
|
||||
@@ -711,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)
|
||||
@@ -733,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
|
||||
@@ -796,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)
|
||||
@@ -835,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
|
||||
@@ -876,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
|
||||
@@ -81,8 +79,6 @@ class CharacterEntryHelper
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -217,8 +213,6 @@ class Window_TextEntry < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -253,8 +247,6 @@ class Window_TextEntry_Keyboard < Window_TextEntry
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PictureSprite < Sprite
|
||||
def initialize(viewport, picture)
|
||||
super(viewport)
|
||||
@@ -50,8 +53,6 @@ class PictureSprite < Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbTextBitmap(text, maxwidth = Graphics.width)
|
||||
tmp = Bitmap.new(maxwidth, Graphics.height)
|
||||
pbSetSystemFont(tmp)
|
||||
@@ -59,10 +60,8 @@ def pbTextBitmap(text, maxwidth = Graphics.width)
|
||||
return tmp
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# EventScene
|
||||
#
|
||||
#===============================================================================
|
||||
class EventScene
|
||||
attr_accessor :onCTrigger, :onBTrigger, :onUpdate
|
||||
@@ -80,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
|
||||
@@ -143,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
|
||||
@@ -156,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
|
||||
@@ -181,18 +170,14 @@ class EventScene
|
||||
end
|
||||
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
|
||||
|
||||
@@ -266,14 +266,13 @@ 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)
|
||||
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
|
||||
end
|
||||
return ret
|
||||
end
|
||||
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)
|
||||
|
||||
@@ -31,10 +31,10 @@ module GameData
|
||||
"Price" => [:price, "u"],
|
||||
"SellPrice" => [:sell_price, "u"],
|
||||
"BPPrice" => [:bp_price, "u"],
|
||||
"FieldUse" => [:field_use, "e", { "OnPokemon" => 1, "Direct" => 2,
|
||||
"TM" => 3, "HM" => 4, "TR" => 5 }],
|
||||
"BattleUse" => [:battle_use, "e", { "OnPokemon" => 1, "OnMove" => 2,
|
||||
"OnBattler" => 3, "OnFoe" => 4, "Direct" => 5 }],
|
||||
"FieldUse" => [:field_use, "e", {"OnPokemon" => 1, "Direct" => 2,
|
||||
"TM" => 3, "HM" => 4, "TR" => 5}],
|
||||
"BattleUse" => [:battle_use, "e", {"OnPokemon" => 1, "OnMove" => 2,
|
||||
"OnBattler" => 3, "OnFoe" => 4, "Direct" => 5}],
|
||||
"Flags" => [:flags, "*s"],
|
||||
"Consumable" => [:consumable, "b"],
|
||||
"Move" => [:move, "e", :Move],
|
||||
@@ -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
|
||||
|
||||
@@ -38,7 +38,7 @@ module GameData
|
||||
if form > 0
|
||||
trial = sprintf("%s_%d", species, form).to_sym
|
||||
if !DATA.has_key?(trial)
|
||||
self.register({ :id => species }) if !DATA[species]
|
||||
self.register({:id => species}) if !DATA[species]
|
||||
self.register({
|
||||
:id => trial,
|
||||
:species => species,
|
||||
@@ -52,7 +52,7 @@ module GameData
|
||||
end
|
||||
return DATA[trial]
|
||||
end
|
||||
self.register({ :id => species }) if !DATA[species]
|
||||
self.register({:id => species}) if !DATA[species]
|
||||
return DATA[species]
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,7 +13,7 @@ module GameData
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "e", :Species],
|
||||
"GaugeSize" => [:gauge_size, "v"],
|
||||
"Moves" => [:moves, "*m"], # Not enumerated when compiled
|
||||
"Moves" => [:moves, "*e", :Move],
|
||||
"Flags" => [:flags, "*s"]
|
||||
}
|
||||
HEART_GAUGE_SIZE = 4000 # Default gauge size
|
||||
@@ -21,6 +21,11 @@ module GameData
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
alias __orig__load load unless private_method_defined?(:__orig__load)
|
||||
def self.load
|
||||
__orig__load if safeExists?("Data/#{self::DATA_FILENAME}")
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@gauge_size = hash[:gauge_size] || HEART_GAUGE_SIZE
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -18,10 +18,10 @@ module GameData
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
"Gender" => [:gender, "e", { "Male" => 0, "male" => 0, "M" => 0, "m" => 0, "0" => 0,
|
||||
"Gender" => [:gender, "e", {"Male" => 0, "male" => 0, "M" => 0, "m" => 0, "0" => 0,
|
||||
"Female" => 1, "female" => 1, "F" => 1, "f" => 1, "1" => 1,
|
||||
"Unknown" => 2, "unknown" => 2, "Other" => 2, "other" => 2,
|
||||
"Mixed" => 2, "mixed" => 2, "X" => 2, "x" => 2, "2" => 2 }],
|
||||
"Mixed" => 2, "mixed" => 2, "X" => 2, "x" => 2, "2" => 2}],
|
||||
"BaseMoney" => [:base_money, "u"],
|
||||
"SkillLevel" => [:skill_level, "u"],
|
||||
"Flags" => [:flags, "*s"],
|
||||
@@ -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
|
||||
|
||||
@@ -30,8 +30,8 @@ module GameData
|
||||
"Ability" => [:ability, "e", :Ability],
|
||||
"AbilityIndex" => [:ability_index, "u"],
|
||||
"Item" => [:item, "e", :Item],
|
||||
"Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
|
||||
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }],
|
||||
"Gender" => [:gender, "e", {"M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
|
||||
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1}],
|
||||
"Nature" => [:nature, "e", :Nature],
|
||||
"IV" => [:iv, "uUUUUU"],
|
||||
"EV" => [:ev, "uUUUUU"],
|
||||
@@ -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
|
||||
|
||||
@@ -42,7 +42,7 @@ module GameData
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String, NilClass]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
key = key[0] if key[1] == nil
|
||||
key = key[0] if key[1].nil?
|
||||
return !self::DATA[key].nil?
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
if fullCalc && $INTERNAL
|
||||
logMsg = "[Round order] "
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -143,9 +143,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
|
||||
@@ -192,11 +192,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
|
||||
@@ -259,16 +259,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
|
||||
|
||||
@@ -301,9 +301,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
|
||||
|
||||
#=============================================================================
|
||||
@@ -319,9 +319,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
|
||||
@@ -339,34 +339,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("[Use move] #{pbThis} (#{@index}) used #{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
|
||||
|
||||
@@ -400,9 +396,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
|
||||
|
||||
@@ -366,8 +366,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
|
||||
@@ -382,8 +381,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
|
||||
|
||||
@@ -328,7 +328,7 @@ class Battle::Move::UserConsumeBerryRaiseDefense2 < Battle::Move::StatUpMove
|
||||
@battle.pbDisplay(_INTL("{1} ate its {2}!", user.pbThis, user.itemName))
|
||||
item = user.item
|
||||
user.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
|
||||
user.pbHeldItemTriggerCheck(item, false)
|
||||
user.pbHeldItemTriggerCheck(item.id, false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -370,7 +370,7 @@ class Battle::Move::AllBattlersConsumeBerry < Battle::Move
|
||||
@battle.pbCommonAnimation("EatBerry", target)
|
||||
item = target.item
|
||||
target.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
|
||||
target.pbHeldItemTriggerCheck(item, false)
|
||||
target.pbHeldItemTriggerCheck(item.id, false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -385,9 +385,11 @@ class Battle::Move::UserConsumeTargetBerry < Battle::Move
|
||||
return if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
|
||||
item = target.item
|
||||
itemName = target.itemName
|
||||
user.setBelched
|
||||
target.pbRemoveItem
|
||||
@battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!", user.pbThis, itemName))
|
||||
user.pbHeldItemTriggerCheck(item, false)
|
||||
user.pbHeldItemTriggerCheck(item.id, false)
|
||||
user.pbSymbiosis
|
||||
end
|
||||
end
|
||||
|
||||
@@ -445,8 +447,13 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move
|
||||
when :KINGSROCK, :RAZORFANG
|
||||
target.pbFlinch(user)
|
||||
else
|
||||
target.pbHeldItemTriggerCheck(user.item, true)
|
||||
target.pbHeldItemTriggerCheck(user.item_id, true)
|
||||
end
|
||||
# NOTE: The official games only let the target use Belch if the berry flung
|
||||
# at it has some kind of effect (i.e. it isn't an effectless berry). I
|
||||
# think this isn't in the spirit of "consuming a berry", so I've said
|
||||
# that Belch is usable after having any kind of berry flung at you.
|
||||
target.setBelched if user.item.is_berry?
|
||||
end
|
||||
|
||||
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -91,8 +91,6 @@ class Battle::Scene::MenuBase
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Command menu (Fight/Pokémon/Bag/Run)
|
||||
#===============================================================================
|
||||
@@ -194,8 +192,6 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Fight menu (choose a move)
|
||||
#===============================================================================
|
||||
@@ -440,8 +436,6 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Target menu (choose a move's target)
|
||||
# NOTE: Unlike the command and fight menus, this one doesn't have a textbox-only
|
||||
|
||||
@@ -402,8 +402,6 @@ class Battle::Scene::PokemonDataBox < Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Splash bar to announce a triggered ability
|
||||
#===============================================================================
|
||||
@@ -496,8 +494,6 @@ class Battle::Scene::AbilitySplashBar < Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Pokémon sprite (used in battle)
|
||||
#===============================================================================
|
||||
@@ -624,8 +620,6 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shadow sprite for Pokémon (used in battle)
|
||||
#===============================================================================
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -57,8 +57,6 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows wild Pokémon fading back to their normal color, and triggers their intro
|
||||
# animations
|
||||
@@ -80,8 +78,6 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Makes a side's party bar and balls appear
|
||||
#===============================================================================
|
||||
@@ -181,8 +177,6 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Makes a Pokémon's data box appear
|
||||
#===============================================================================
|
||||
@@ -202,8 +196,6 @@ class Battle::Scene::Animation::DataBoxAppear < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Makes a Pokémon's data box disappear
|
||||
#===============================================================================
|
||||
@@ -222,8 +214,6 @@ class Battle::Scene::Animation::DataBoxDisappear < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Makes a Pokémon's ability bar appear
|
||||
#===============================================================================
|
||||
@@ -242,8 +232,6 @@ class Battle::Scene::Animation::AbilitySplashAppear < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Makes a Pokémon's ability bar disappear
|
||||
#===============================================================================
|
||||
@@ -262,8 +250,6 @@ class Battle::Scene::Animation::AbilitySplashDisappear < Battle::Scene::Animatio
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Make an enemy trainer slide on-screen from the right. Makes the previous
|
||||
# trainer slide off to the right first if it is on-screen.
|
||||
@@ -296,8 +282,6 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows the player (and partner) and the player party lineup sliding off screen.
|
||||
# Shows the player's/partner's throwing animation (if they have one).
|
||||
@@ -339,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)
|
||||
@@ -350,8 +334,6 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows the enemy trainer(s) and the enemy party lineup sliding off screen.
|
||||
# Doesn't show the ball thrown or the Pokémon.
|
||||
@@ -384,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)
|
||||
@@ -395,8 +377,6 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows a Pokémon being sent out on the player's side (including by a partner).
|
||||
# Includes the Poké Ball being thrown.
|
||||
@@ -473,8 +453,6 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows a Pokémon being sent out on the opposing side.
|
||||
# Includes the Poké Ball being "thrown" (although here the Poké Ball just
|
||||
@@ -544,8 +522,6 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows a Pokémon being recalled into its Poké Ball
|
||||
#===============================================================================
|
||||
@@ -594,8 +570,6 @@ class Battle::Scene::Animation::BattlerRecall < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows a Pokémon flashing after taking damage
|
||||
#===============================================================================
|
||||
@@ -632,8 +606,6 @@ class Battle::Scene::Animation::BattlerDamage < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows a Pokémon fainting
|
||||
#===============================================================================
|
||||
@@ -682,8 +654,6 @@ class Battle::Scene::Animation::BattlerFaint < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows the player's Poké Ball being thrown to capture a Pokémon
|
||||
#===============================================================================
|
||||
@@ -836,8 +806,6 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows the player throwing a Poké Ball and it being deflected
|
||||
#===============================================================================
|
||||
|
||||
@@ -71,8 +71,7 @@ class Battle::DebugSceneNoVisuals
|
||||
def pbChangePokemon(idxBattler, pkmn); end
|
||||
def pbFaintBattler(battler); end
|
||||
def pbEXPBar(battler, startExp, endExp, tempExp1, tempExp2); end
|
||||
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,
|
||||
oldSpAtk, oldSpDef, oldSpeed); end
|
||||
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense, oldSpAtk, oldSpDef, oldSpeed); end
|
||||
def pbForgetMove(pkmn, moveToLearn); return 0; end # Always forget first move
|
||||
|
||||
def pbCommandMenu(idxBattler, firstAction)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -51,8 +51,9 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
unless @__clauses__aliased
|
||||
alias __clauses__pbCanSleep? pbCanSleep?
|
||||
@@ -100,9 +101,10 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::RaiseUserEvasion1 # Double Team
|
||||
#===============================================================================
|
||||
# Double Team
|
||||
#===============================================================================
|
||||
class Battle::Move::RaiseUserEvasion1
|
||||
unless method_defined?(:__clauses__pbMoveFailed?)
|
||||
alias __clauses__pbMoveFailed? pbMoveFailed?
|
||||
end
|
||||
@@ -116,9 +118,10 @@ class Battle::Move::RaiseUserEvasion1 # Double Team
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::RaiseUserEvasion2MinimizeUser # Minimize
|
||||
#===============================================================================
|
||||
# Minimize
|
||||
#===============================================================================
|
||||
class Battle::Move::RaiseUserEvasion2MinimizeUser
|
||||
unless method_defined?(:__clauses__pbMoveFailed?)
|
||||
alias __clauses__pbMoveFailed? pbMoveFailed?
|
||||
end
|
||||
@@ -132,9 +135,10 @@ class Battle::Move::RaiseUserEvasion2MinimizeUser # Minimize
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::UserTargetSwapAbilities # Skill Swap
|
||||
#===============================================================================
|
||||
# Skill Swap
|
||||
#===============================================================================
|
||||
class Battle::Move::UserTargetSwapAbilities
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
end
|
||||
@@ -148,9 +152,10 @@ class Battle::Move::UserTargetSwapAbilities # Skill Swap
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::FixedDamage20 # Sonic Boom
|
||||
#===============================================================================
|
||||
# Sonic Boom
|
||||
#===============================================================================
|
||||
class Battle::Move::FixedDamage20
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
end
|
||||
@@ -164,9 +169,10 @@ class Battle::Move::FixedDamage20 # Sonic Boom
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::FixedDamage40 # Dragon Rage
|
||||
#===============================================================================
|
||||
# Dragon Rage
|
||||
#===============================================================================
|
||||
class Battle::Move::FixedDamage40
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
end
|
||||
@@ -180,8 +186,9 @@ class Battle::Move::FixedDamage40 # Dragon Rage
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Move::OHKO
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
@@ -196,8 +203,9 @@ class Battle::Move::OHKO
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Move::OHKOIce
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
@@ -212,8 +220,9 @@ class Battle::Move::OHKOIce
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Move::OHKOHitsUndergroundTarget
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
@@ -228,9 +237,10 @@ class Battle::Move::OHKOHitsUndergroundTarget
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::UserFaintsExplosive # Self-Destruct
|
||||
#===============================================================================
|
||||
# Self-Destruct
|
||||
#===============================================================================
|
||||
class Battle::Move::UserFaintsExplosive
|
||||
unless method_defined?(:__clauses__pbMoveFailed?)
|
||||
alias __clauses__pbMoveFailed? pbMoveFailed?
|
||||
end
|
||||
@@ -259,9 +269,10 @@ class Battle::Move::UserFaintsExplosive # Self-Destruct
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::StartPerishCountsForAllBattlers # Perish Song
|
||||
#===============================================================================
|
||||
# Perish Song
|
||||
#===============================================================================
|
||||
class Battle::Move::StartPerishCountsForAllBattlers
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
end
|
||||
@@ -276,9 +287,10 @@ class Battle::Move::StartPerishCountsForAllBattlers # Perish Song
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Battle::Move::AttackerFaintsIfUserFaints # Destiny Bond
|
||||
#===============================================================================
|
||||
# Destiny Bond
|
||||
#===============================================================================
|
||||
class Battle::Move::AttackerFaintsIfUserFaints
|
||||
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
|
||||
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
|
||||
end
|
||||
|
||||
@@ -29,8 +29,6 @@ class AnimFrame
|
||||
FOCUS = 26
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -166,8 +164,6 @@ def pbConvertRPGAnimation(animation)
|
||||
return pbAnim
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -230,8 +226,6 @@ class RPG::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -310,7 +304,7 @@ class PBAnimTiming
|
||||
text = sprintf("[%d] Set FG: \"%s\"", @frame + 1, name)
|
||||
text += sprintf(" (color=%s,%s,%s,%s)",
|
||||
@colorRed || "-",
|
||||
@colorGreen | "-",
|
||||
@colorGreen || "-",
|
||||
@colorBlue || "-",
|
||||
@colorAlpha || "-")
|
||||
text += sprintf(" (opacity=%d)", @opacity)
|
||||
@@ -333,8 +327,6 @@ class PBAnimTiming
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -397,8 +389,6 @@ class PBAnimations < Array
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -598,8 +588,6 @@ class PBAnimation < Array
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -678,8 +666,6 @@ def pbSpriteSetAnimFrame(sprite, frame, user = nil, target = nil, inEditor = fal
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Animation player
|
||||
#===============================================================================
|
||||
|
||||
@@ -888,10 +888,7 @@ Battle::AbilityEffects::MoveBlocking.add(:DAZZLING,
|
||||
next false if battle.choices[user.index][4] <= 0
|
||||
next false if !bearer.opposes?(user)
|
||||
ret = false
|
||||
targets.each do |b|
|
||||
next if !b.opposes?(user)
|
||||
ret = true
|
||||
end
|
||||
targets.each { |b| ret = true if b.opposes?(user) }
|
||||
next ret
|
||||
}
|
||||
)
|
||||
@@ -1243,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?
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1387,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
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1549,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
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1613,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
|
||||
}
|
||||
)
|
||||
|
||||
@@ -2428,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
|
||||
@@ -2436,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
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -54,8 +54,6 @@ class Battle::FakeBattler
|
||||
def pbReset; end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Data box for safari battles
|
||||
#===============================================================================
|
||||
@@ -93,8 +91,6 @@ class Battle::Scene::SafariDataBox < Sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows the player throwing bait at a wild Pokémon in a Safari battle.
|
||||
#===============================================================================
|
||||
@@ -159,8 +155,6 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shows the player throwing a rock at a wild Pokémon in a Safari battle.
|
||||
#===============================================================================
|
||||
@@ -222,8 +216,6 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Safari Zone battle scene (the visuals of the battle)
|
||||
#===============================================================================
|
||||
@@ -280,8 +272,6 @@ class Battle::Scene
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Safari Zone battle class
|
||||
#===============================================================================
|
||||
@@ -308,9 +298,9 @@ class SafariBattle
|
||||
|
||||
def pbRandom(x); return rand(x); end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Initialize the battle class
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize(scene, player, party2)
|
||||
@scene = scene
|
||||
@peer = Battle::Peer.new
|
||||
@@ -335,9 +325,9 @@ class SafariBattle
|
||||
def defaultWeather=(value); @weather = value; end
|
||||
def defaultTerrain=(value); end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Information about the type and size of the battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
def wildBattle?; return true; end
|
||||
def trainerBattle?; return false; end
|
||||
|
||||
@@ -347,9 +337,9 @@ class SafariBattle
|
||||
return @sideSizes[index % 2]
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Trainers and owner-related
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
def pbPlayer; return @player[0]; end
|
||||
def opponent; return nil; end
|
||||
|
||||
@@ -374,18 +364,18 @@ class SafariBattle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Get party info (counts all teams on the same side)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
def pbParty(idxBattler)
|
||||
return (opposes?(idxBattler)) ? @party2 : nil
|
||||
end
|
||||
|
||||
def pbAllFainted?(idxBattler = 0); return false; end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Battler-related
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
def opposes?(idxBattler1, idxBattler2 = 0)
|
||||
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
|
||||
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
|
||||
@@ -395,9 +385,9 @@ class SafariBattle
|
||||
def pbRemoveFromParty(idxBattler, idxParty); end
|
||||
def pbGainExp; end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Messages and animations
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
def pbDisplay(msg, &block)
|
||||
@scene.pbDisplayMessage(msg, &block)
|
||||
end
|
||||
@@ -414,17 +404,15 @@ class SafariBattle
|
||||
return @scene.pbDisplayConfirmMessage(msg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
class BattleAbortedException < Exception; end
|
||||
|
||||
def pbAbort
|
||||
raise BattleAbortedException.new("Battle aborted")
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Safari battle-specific methods
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
def pbEscapeRate(catch_rate)
|
||||
return 125 if catch_rate <= 45 # Escape factor 9 (45%)
|
||||
return 100 if catch_rate <= 60 # Escape factor 7 (35%)
|
||||
|
||||
@@ -26,8 +26,6 @@ class Battle::Scene
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Bug Catching Contest battle class
|
||||
#===============================================================================
|
||||
|
||||
@@ -164,8 +164,6 @@ class BattlePalaceBattle < Battle
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -35,8 +35,6 @@ class Battle::SuccessState
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -203,8 +201,6 @@ class BattleArenaBattle < Battle
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -221,8 +217,6 @@ class Battle::AI
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
@@ -277,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,
|
||||
@@ -305,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|
|
||||
@@ -332,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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user