mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
More or less standardised separator comments in the code
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module PBDebug
|
||||
@@log = []
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#===============================================================================
|
||||
# To use the console, use the executable explicitly built with the console
|
||||
# enabled on Windows. On Linux and macOS, just launch the executable directly
|
||||
# from a terminal.
|
||||
#===============================================================================
|
||||
module Console
|
||||
def self.setup_console
|
||||
return unless $DEBUG
|
||||
@@ -33,6 +35,9 @@ module Console
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module Kernel
|
||||
def echo(string)
|
||||
return unless $DEBUG
|
||||
@@ -48,14 +53,15 @@ end
|
||||
Console.setup_console
|
||||
|
||||
#===============================================================================
|
||||
# Console message formatting
|
||||
# Console message formatting
|
||||
#===============================================================================
|
||||
module Console
|
||||
module_function
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# echo string into console (example shorthand for common options)
|
||||
# echo string into console (example shorthand for common options)
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# heading 1
|
||||
def echo_h1(msg)
|
||||
echoln markup_style("*** #{msg} ***", text: :brown)
|
||||
@@ -130,6 +136,7 @@ module Console
|
||||
#-----------------------------------------------------------------------------
|
||||
# Markup options
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def string_colors
|
||||
{
|
||||
default: "38", black: "30", red: "31", green: "32", brown: "33",
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
class Reset < Exception
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class EventScriptError < Exception
|
||||
attr_accessor :event_message
|
||||
|
||||
@@ -13,6 +16,9 @@ class EventScriptError < Exception
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbGetExceptionMessage(e, _script = "")
|
||||
return e.event_message.dup if e.is_a?(EventScriptError) # Message with map/event ID generated elsewhere
|
||||
emessage = e.message.dup
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#===============================================================================
|
||||
# The Kernel module is extended to include the validate method.
|
||||
#===============================================================================
|
||||
module Kernel
|
||||
private
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#===============================================================================
|
||||
# The Deprecation module is used to warn game & plugin creators of deprecated
|
||||
# methods.
|
||||
#===============================================================================
|
||||
module Deprecation
|
||||
module_function
|
||||
|
||||
@@ -19,7 +21,10 @@ module Deprecation
|
||||
end
|
||||
end
|
||||
|
||||
# The Module class is extended to allow easy deprecation of instance and class methods.
|
||||
#===============================================================================
|
||||
# The Module class is extended to allow easy deprecation of instance and class
|
||||
# methods.
|
||||
#===============================================================================
|
||||
class Module
|
||||
private
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#===============================================================================
|
||||
# Using mkxp-z v2.4.2/c9378cf - built 2023-07-07
|
||||
# https://github.com/mkxp-z/mkxp-z/actions/runs/5482601942
|
||||
#===============================================================================
|
||||
$VERBOSE = nil
|
||||
Font.default_shadow = false if Font.respond_to?(:default_shadow)
|
||||
Encoding.default_internal = Encoding::UTF_8
|
||||
@@ -9,6 +11,23 @@ def pbSetWindowText(string)
|
||||
System.set_window_title(string || System.game_title)
|
||||
end
|
||||
|
||||
def pbSetResizeFactor(factor)
|
||||
if !$ResizeInitialized
|
||||
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
|
||||
$ResizeInitialized = true
|
||||
end
|
||||
if factor < 0 || factor == 4
|
||||
Graphics.fullscreen = true if !Graphics.fullscreen
|
||||
else
|
||||
Graphics.fullscreen = false if Graphics.fullscreen
|
||||
Graphics.scale = (factor + 1) * 0.5
|
||||
Graphics.center
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Bitmap
|
||||
attr_accessor :text_offset_y
|
||||
|
||||
@@ -27,20 +46,9 @@ class Bitmap
|
||||
end
|
||||
end
|
||||
|
||||
def pbSetResizeFactor(factor)
|
||||
if !$ResizeInitialized
|
||||
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
|
||||
$ResizeInitialized = true
|
||||
end
|
||||
if factor < 0 || factor == 4
|
||||
Graphics.fullscreen = true if !Graphics.fullscreen
|
||||
else
|
||||
Graphics.fullscreen = false if Graphics.fullscreen
|
||||
Graphics.scale = (factor + 1) * 0.5
|
||||
Graphics.center
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
if System::VERSION != Essentials::MKXPZ_VERSION
|
||||
printf(sprintf("\e[1;33mWARNING: mkxp-z version %s detected, but this version of Pokémon Essentials was designed for mkxp-z version %s.\e[0m\r\n",
|
||||
System::VERSION, Essentials::MKXPZ_VERSION))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#===============================================================================
|
||||
# Reads files of certain format from a directory
|
||||
# Reads files of certain format from a directory
|
||||
#===============================================================================
|
||||
class Dir
|
||||
# Reads all files in a directory
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module FileInputMixin
|
||||
def fgetb
|
||||
ret = 0
|
||||
@@ -85,6 +88,9 @@ module FileInputMixin
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module FileOutputMixin
|
||||
def fputb(b)
|
||||
b &= 0xFF
|
||||
@@ -108,6 +114,9 @@ module FileOutputMixin
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class File < IO
|
||||
# unless defined?(debugopen)
|
||||
# class << self
|
||||
@@ -128,6 +137,9 @@ class File < IO
|
||||
include FileOutputMixin
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class StringInput
|
||||
include FileInputMixin
|
||||
|
||||
@@ -144,6 +156,9 @@ class StringInput
|
||||
def binmode; end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class StringOutput
|
||||
include FileOutputMixin
|
||||
end
|
||||
|
||||
@@ -211,6 +211,8 @@ module Translator
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def normalize_value(value)
|
||||
if value[/[\r\n\t\x01]|^[\[\]]/]
|
||||
ret = value.dup
|
||||
@@ -709,51 +711,53 @@ module MessageTypes
|
||||
POKEMON_NICKNAMES = 30
|
||||
@@messages = Translation.new
|
||||
|
||||
def self.load_default_messages
|
||||
module_function
|
||||
|
||||
def load_default_messages
|
||||
@@messages.load_default_messages
|
||||
end
|
||||
|
||||
def self.load_message_files(filename)
|
||||
def load_message_files(filename)
|
||||
@@messages.load_message_files(filename)
|
||||
end
|
||||
|
||||
def self.save_default_messages
|
||||
def save_default_messages
|
||||
@@messages.save_default_messages
|
||||
end
|
||||
|
||||
def self.setMessages(type, array)
|
||||
def setMessages(type, array)
|
||||
@@messages.setMessages(type, array)
|
||||
end
|
||||
|
||||
def self.addMessages(type, array)
|
||||
def addMessages(type, array)
|
||||
@@messages.addMessages(type, array)
|
||||
end
|
||||
|
||||
def self.setMessagesAsHash(type, array)
|
||||
def setMessagesAsHash(type, array)
|
||||
@@messages.setMessagesAsHash(type, array)
|
||||
end
|
||||
|
||||
def self.addMessagesAsHash(type, array)
|
||||
def addMessagesAsHash(type, array)
|
||||
@@messages.addMessagesAsHash(type, array)
|
||||
end
|
||||
|
||||
def self.setMapMessagesAsHash(type, array)
|
||||
def setMapMessagesAsHash(type, array)
|
||||
@@messages.setMapMessagesAsHash(type, array)
|
||||
end
|
||||
|
||||
def self.addMapMessagesAsHash(type, array)
|
||||
def addMapMessagesAsHash(type, array)
|
||||
@@messages.addMapMessagesAsHash(type, array)
|
||||
end
|
||||
|
||||
def self.get(type, id)
|
||||
def get(type, id)
|
||||
return @@messages.get(type, id)
|
||||
end
|
||||
|
||||
def self.getFromHash(type, key)
|
||||
def getFromHash(type, key)
|
||||
return @@messages.getFromHash(type, key)
|
||||
end
|
||||
|
||||
def self.getFromMapHash(type, key)
|
||||
def getFromMapHash(type, key)
|
||||
return @@messages.getFromMapHash(type, key)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module Input
|
||||
USE = C
|
||||
BACK = B
|
||||
@@ -20,11 +23,12 @@ module Input
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module Mouse
|
||||
module_function
|
||||
|
||||
# Returns the position of the mouse relative to the game window.
|
||||
def getMousePos(catch_anywhere = false)
|
||||
def self.getMousePos(catch_anywhere = false)
|
||||
return nil unless Input.mouse_in_window || catch_anywhere
|
||||
return Input.mouse_x, Input.mouse_y
|
||||
end
|
||||
|
||||
@@ -102,7 +102,6 @@
|
||||
#------------------------------------------------------------------------------#
|
||||
# Please give credit when using this. #
|
||||
#==============================================================================#
|
||||
|
||||
module PluginManager
|
||||
# Holds all registered plugin data.
|
||||
@@Plugins = {}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#===============================================================================
|
||||
# The SaveData module is used to manipulate save data. It contains the {Value}s
|
||||
# that make up the save data and {Conversion}s for resolving incompatibilities
|
||||
# between Essentials and game versions.
|
||||
# @see SaveData.register
|
||||
# @see SaveData.register_conversion
|
||||
#===============================================================================
|
||||
module SaveData
|
||||
# Contains the file path of the save file.
|
||||
FILE_PATH = if File.directory?(System.data_directory)
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module SaveData
|
||||
# Contains Value objects for each save element.
|
||||
# Populated during runtime by SaveData.register calls.
|
||||
# @type [Array<Value>]
|
||||
@values = []
|
||||
|
||||
#=============================================================================
|
||||
# An error raised if an invalid save value is being saved or loaded.
|
||||
#=============================================================================
|
||||
class InvalidValueError < RuntimeError; end
|
||||
|
||||
#=============================================================================
|
||||
# Represents a single value in save data.
|
||||
# New values are added using {SaveData.register}.
|
||||
#=============================================================================
|
||||
class Value
|
||||
# @return [Symbol] the value id
|
||||
attr_reader :id
|
||||
@@ -160,7 +166,8 @@ module SaveData
|
||||
# @!endgroup
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Registers a {Value} to be saved into save data.
|
||||
# Takes a block which defines the value's saving ({Value#save_value})
|
||||
# and loading ({Value#load_value}) procedures.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module SaveData
|
||||
# Contains Conversion objects for each defined conversion:
|
||||
# {
|
||||
@@ -21,6 +24,7 @@ module SaveData
|
||||
#=============================================================================
|
||||
# Represents a conversion made to save data.
|
||||
# New conversions are added using {SaveData.register_conversion}.
|
||||
#=============================================================================
|
||||
class Conversion
|
||||
# @return [Symbol] conversion ID
|
||||
attr_reader :id
|
||||
@@ -134,7 +138,8 @@ module SaveData
|
||||
# @!endgroup
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Registers a {Conversion} to occur for save data that meets the given criteria.
|
||||
# Two types of criteria can be defined: {Conversion#essentials_version} and
|
||||
# {Conversion#game_version}. The conversion is automatically run on save data
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#===============================================================================
|
||||
# Contains the save values defined in Essentials by default.
|
||||
#===============================================================================
|
||||
|
||||
SaveData.register(:player) do
|
||||
ensure_class :Player
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
# The Game module contains methods for saving and loading the game.
|
||||
#===============================================================================
|
||||
module Game
|
||||
module_function
|
||||
|
||||
# Initializes various global variables and loads the game data.
|
||||
def self.initialize
|
||||
def initialize
|
||||
$game_temp = Game_Temp.new
|
||||
$game_system = Game_System.new
|
||||
$data_animations = load_data("Data/Animations.rxdata")
|
||||
@@ -18,7 +22,7 @@ module Game
|
||||
|
||||
# Loads bootup data from save file (if it exists) or creates bootup data (if
|
||||
# it doesn't).
|
||||
def self.set_up_system
|
||||
def set_up_system
|
||||
save_data = (SaveData.exists?) ? SaveData.read_from_file(SaveData::FILE_PATH) : {}
|
||||
if save_data.empty?
|
||||
SaveData.initialize_bootup_values
|
||||
@@ -36,7 +40,7 @@ module Game
|
||||
|
||||
# Called when starting a new game. Initializes global variables
|
||||
# and transfers the player into the map scene.
|
||||
def self.start_new
|
||||
def start_new
|
||||
if $game_map&.events
|
||||
$game_map.events.each_value { |event| event.clear_starting }
|
||||
end
|
||||
@@ -60,12 +64,12 @@ module Game
|
||||
# Loads the game from the given save data and starts the map scene.
|
||||
# @param save_data [Hash] hash containing the save data
|
||||
# @raise [SaveData::InvalidValueError] if an invalid value is being loaded
|
||||
def self.load(save_data)
|
||||
def load(save_data)
|
||||
validate save_data => Hash
|
||||
SaveData.load_all_values(save_data)
|
||||
$game_temp.last_uptime_refreshed_play_time = System.uptime
|
||||
$stats.play_sessions += 1
|
||||
self.load_map
|
||||
load_map
|
||||
pbAutoplayOnSave
|
||||
$game_map.update
|
||||
$PokemonMap.updateMap
|
||||
@@ -73,7 +77,7 @@ module Game
|
||||
end
|
||||
|
||||
# Loads and validates the map. Called when loading a saved game.
|
||||
def self.load_map
|
||||
def load_map
|
||||
$game_map = $map_factory.map
|
||||
magic_number_matches = ($game_system.magic_number == $data_system.magic_number)
|
||||
if !magic_number_matches || $PokemonGlobal.safesave
|
||||
@@ -108,7 +112,7 @@ module Game
|
||||
# @param safe [Boolean] whether $PokemonGlobal.safesave should be set to true
|
||||
# @return [Boolean] whether the operation was successful
|
||||
# @raise [SaveData::InvalidValueError] if an invalid value is being saved
|
||||
def self.save(save_file = SaveData::FILE_PATH, safe: false)
|
||||
def save(save_file = SaveData::FILE_PATH, safe: false)
|
||||
validate save_file => String, safe => [TrueClass, FalseClass]
|
||||
$PokemonGlobal.safesave = safe
|
||||
$game_system.save_count += 1
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#===============================================================================
|
||||
# ** Modified Scene_Map class for Pokémon.
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# Modified Scene_Map class for Pokémon.
|
||||
#===============================================================================
|
||||
class Scene_Map
|
||||
attr_reader :spritesetGlobal
|
||||
|
||||
@@ -42,24 +42,26 @@
|
||||
module EventHandlers
|
||||
@@events = {}
|
||||
|
||||
module_function
|
||||
|
||||
# Add a named callback for the given event.
|
||||
def self.add(event, key, proc)
|
||||
def add(event, key, proc)
|
||||
@@events[event] = NamedEvent.new if !@@events.has_key?(event)
|
||||
@@events[event].add(key, proc)
|
||||
end
|
||||
|
||||
# Remove a named callback from the given event.
|
||||
def self.remove(event, key)
|
||||
def remove(event, key)
|
||||
@@events[event]&.remove(key)
|
||||
end
|
||||
|
||||
# Clear all callbacks for the given event.
|
||||
def self.clear(key)
|
||||
def clear(key)
|
||||
@@events[key]&.clear
|
||||
end
|
||||
|
||||
# Trigger all callbacks from an Event if it has been defined.
|
||||
def self.trigger(event, *args)
|
||||
def trigger(event, *args)
|
||||
return @@events[event]&.trigger(*args)
|
||||
end
|
||||
end
|
||||
@@ -80,25 +82,27 @@ end
|
||||
module MenuHandlers
|
||||
@@handlers = {}
|
||||
|
||||
def self.add(menu, option, hash)
|
||||
module_function
|
||||
|
||||
def add(menu, option, hash)
|
||||
@@handlers[menu] = HandlerHash.new if !@@handlers.has_key?(menu)
|
||||
@@handlers[menu].add(option, hash)
|
||||
end
|
||||
|
||||
def self.remove(menu, option)
|
||||
def remove(menu, option)
|
||||
@@handlers[menu]&.remove(option)
|
||||
end
|
||||
|
||||
def self.clear(menu)
|
||||
def clear(menu)
|
||||
@@handlers[menu]&.clear
|
||||
end
|
||||
|
||||
def self.each(menu)
|
||||
def each(menu)
|
||||
return if !@@handlers.has_key?(menu)
|
||||
@@handlers[menu].each { |option, hash| yield option, hash }
|
||||
end
|
||||
|
||||
def self.each_available(menu, *args)
|
||||
def each_available(menu, *args)
|
||||
return if !@@handlers.has_key?(menu)
|
||||
options = @@handlers[menu]
|
||||
keys = options.keys
|
||||
@@ -115,7 +119,7 @@ module MenuHandlers
|
||||
end
|
||||
end
|
||||
|
||||
def self.call(menu, option, function, *args)
|
||||
def call(menu, option, function, *args)
|
||||
option_hash = @@handlers[menu][option]
|
||||
return nil if !option_hash || !option_hash[function]
|
||||
return option_hash[function].call(*args)
|
||||
|
||||
@@ -47,9 +47,6 @@ class Game_Temp
|
||||
attr_accessor :darkness_sprite # DarknessSprite or nil
|
||||
attr_accessor :mart_prices
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#-----------------------------------------------------------------------------
|
||||
def initialize
|
||||
# Flags requesting something to happen
|
||||
@menu_calling = false
|
||||
|
||||
@@ -39,6 +39,30 @@ class Game_System
|
||||
@bgs_position = 0
|
||||
end
|
||||
|
||||
def battle_bgm
|
||||
return (@battle_bgm) ? @battle_bgm : $data_system.battle_bgm
|
||||
end
|
||||
|
||||
attr_writer :battle_bgm
|
||||
|
||||
def battle_end_me
|
||||
return (@battle_end_me) ? @battle_end_me : $data_system.battle_end_me
|
||||
end
|
||||
|
||||
attr_writer :battle_end_me
|
||||
|
||||
def windowskin_name
|
||||
return $data_system.windowskin_name if @windowskin_name.nil?
|
||||
return @windowskin_name
|
||||
end
|
||||
|
||||
attr_writer :windowskin_name
|
||||
|
||||
def timer
|
||||
return 0 if !@timer_start || !$stats
|
||||
return @timer_duration - $stats.play_time + @timer_start
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def bgm_play(bgm, track = nil)
|
||||
@@ -250,32 +274,6 @@ class Game_System
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def battle_bgm
|
||||
return (@battle_bgm) ? @battle_bgm : $data_system.battle_bgm
|
||||
end
|
||||
|
||||
attr_writer :battle_bgm
|
||||
|
||||
def battle_end_me
|
||||
return (@battle_end_me) ? @battle_end_me : $data_system.battle_end_me
|
||||
end
|
||||
|
||||
attr_writer :battle_end_me
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def windowskin_name
|
||||
return $data_system.windowskin_name if @windowskin_name.nil?
|
||||
return @windowskin_name
|
||||
end
|
||||
|
||||
attr_writer :windowskin_name
|
||||
|
||||
def timer
|
||||
return 0 if !@timer_start || !$stats
|
||||
return @timer_duration - $stats.play_time + @timer_start
|
||||
end
|
||||
|
||||
def update
|
||||
if Input.trigger?(Input::SPECIAL) && pbCurrentEventCommentInput(1, "Cut Scene")
|
||||
event = @map_interpreter.get_self
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#===============================================================================
|
||||
# Map Factory (allows multiple maps to be loaded at once and connected)
|
||||
# Map Factory (allows multiple maps to be loaded at once and connected).
|
||||
#===============================================================================
|
||||
class PokemonMapFactory
|
||||
attr_reader :maps
|
||||
@@ -384,12 +384,14 @@ module MapFactoryHelper
|
||||
@@MapConnections = nil
|
||||
@@MapDims = nil
|
||||
|
||||
def self.clear
|
||||
module_function
|
||||
|
||||
def clear
|
||||
@@MapConnections = nil
|
||||
@@MapDims = nil
|
||||
end
|
||||
|
||||
def self.getMapConnections
|
||||
def getMapConnections
|
||||
if !@@MapConnections
|
||||
@@MapConnections = []
|
||||
conns = load_data("Data/map_connections.dat")
|
||||
@@ -427,26 +429,26 @@ module MapFactoryHelper
|
||||
return @@MapConnections
|
||||
end
|
||||
|
||||
def self.hasConnections?(id)
|
||||
def hasConnections?(id)
|
||||
conns = MapFactoryHelper.getMapConnections
|
||||
return conns[id] ? true : false
|
||||
end
|
||||
|
||||
def self.mapsConnected?(id1, id2)
|
||||
def mapsConnected?(id1, id2)
|
||||
MapFactoryHelper.eachConnectionForMap(id1) do |conn|
|
||||
return true if conn[0] == id2 || conn[3] == id2
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def self.eachConnectionForMap(id)
|
||||
def eachConnectionForMap(id)
|
||||
conns = MapFactoryHelper.getMapConnections
|
||||
return if !conns[id]
|
||||
conns[id].each { |conn| yield conn }
|
||||
end
|
||||
|
||||
# Gets the height and width of the map with id
|
||||
def self.getMapDims(id)
|
||||
# Gets the height and width of the map with id.
|
||||
def getMapDims(id)
|
||||
# Create cache if doesn't exist
|
||||
@@MapDims = [] if !@@MapDims
|
||||
# Add map to cache if can't be found
|
||||
@@ -464,7 +466,7 @@ module MapFactoryHelper
|
||||
|
||||
# Returns the X or Y coordinate of an edge on the map with id.
|
||||
# Considers the special strings "N","W","E","S"
|
||||
def self.getMapEdge(id, edge)
|
||||
def getMapEdge(id, edge)
|
||||
return 0 if ["N", "W"].include?(edge)
|
||||
dims = getMapDims(id) # Get dimensions
|
||||
return dims[0] if edge == "E"
|
||||
@@ -472,7 +474,7 @@ module MapFactoryHelper
|
||||
return dims[0] # real dimension (use width)
|
||||
end
|
||||
|
||||
def self.mapInRange?(map)
|
||||
def mapInRange?(map)
|
||||
range = 6 # Number of tiles
|
||||
dispx = map.display_x
|
||||
dispy = map.display_y
|
||||
@@ -483,7 +485,7 @@ module MapFactoryHelper
|
||||
return true
|
||||
end
|
||||
|
||||
def self.mapInRangeById?(id, dispx, dispy)
|
||||
def mapInRangeById?(id, dispx, dispy)
|
||||
range = 6 # Number of tiles
|
||||
dims = MapFactoryHelper.getMapDims(id)
|
||||
return false if dispx >= (dims[0] + range) * Game_Map::REAL_RES_X
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Game_Character
|
||||
attr_reader :id
|
||||
attr_reader :original_x
|
||||
@@ -194,9 +197,10 @@ class Game_Character
|
||||
@direction = @prelock_direction if !@direction_fix && @prelock_direction != 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Information from map data
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def map
|
||||
return (@map) ? @map : $game_map
|
||||
end
|
||||
@@ -242,9 +246,10 @@ class Game_Character
|
||||
return 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Passability
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def passable?(x, y, dir, strict = false)
|
||||
new_x = x + (dir == 6 ? 1 : dir == 4 ? -1 : 0)
|
||||
new_y = y + (dir == 2 ? 1 : dir == 8 ? -1 : 0)
|
||||
@@ -313,9 +318,10 @@ class Game_Character
|
||||
return can_move_from_coordinate?(@x, @y, dir, strict)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Screen position of the character
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def screen_x
|
||||
ret = ((@real_x.to_f - self.map.display_x) / Game_Map::X_SUBPIXELS).round
|
||||
ret += @width * Game_Map::TILE_WIDTH / 2
|
||||
@@ -353,9 +359,10 @@ class Game_Character
|
||||
return z + ((height > Game_Map::TILE_HEIGHT) ? Game_Map::TILE_HEIGHT - 1 : 0)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Movement
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def moving?
|
||||
return !@move_timer.nil?
|
||||
end
|
||||
@@ -410,9 +417,10 @@ class Game_Character
|
||||
triggerLeaveTile
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Movement commands
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def move_type_random
|
||||
case rand(6)
|
||||
when 0..3 then move_random
|
||||
@@ -906,9 +914,10 @@ class Game_Character
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Updating
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def update
|
||||
return if $game_temp.in_menu
|
||||
time_now = System.uptime
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Game_Event < Game_Character
|
||||
attr_reader :map_id
|
||||
attr_reader :trigger
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Sprite_Picture
|
||||
def initialize(viewport, picture)
|
||||
@viewport = viewport
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Sprite_Timer
|
||||
def initialize(viewport = nil)
|
||||
@viewport = viewport
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Sprite_Reflection
|
||||
attr_reader :visible
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Sprite_SurfBase
|
||||
attr_reader :visible
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Spriteset_Global
|
||||
attr_reader :playersprite
|
||||
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module ScreenPosHelper
|
||||
def self.pbScreenZoomX(ch)
|
||||
@heightcache = {}
|
||||
|
||||
module_function
|
||||
|
||||
def pbScreenZoomX(ch)
|
||||
return Game_Map::TILE_WIDTH / 32.0
|
||||
end
|
||||
|
||||
def self.pbScreenZoomY(ch)
|
||||
def pbScreenZoomY(ch)
|
||||
return Game_Map::TILE_HEIGHT / 32.0
|
||||
end
|
||||
|
||||
def self.pbScreenX(ch)
|
||||
def pbScreenX(ch)
|
||||
return ch.screen_x
|
||||
end
|
||||
|
||||
def self.pbScreenY(ch)
|
||||
def pbScreenY(ch)
|
||||
return ch.screen_y
|
||||
end
|
||||
|
||||
@heightcache = {}
|
||||
|
||||
def self.bmHeight(bm)
|
||||
def bmHeight(bm)
|
||||
h = @heightcache[bm]
|
||||
if !h
|
||||
bmap = AnimatedBitmap.new("Graphics/Characters/" + bm, 0)
|
||||
@@ -28,7 +33,7 @@ module ScreenPosHelper
|
||||
return h
|
||||
end
|
||||
|
||||
def self.pbScreenZ(ch, height = nil)
|
||||
def pbScreenZ(ch, height = nil)
|
||||
if height.nil?
|
||||
height = 0
|
||||
if ch.tile_id > 0
|
||||
|
||||
@@ -259,9 +259,8 @@ class TilemapRenderer
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def initialize(viewport)
|
||||
@tilesets = TilesetBitmaps.new
|
||||
@autotiles = AutotileBitmaps.new
|
||||
@@ -319,7 +318,7 @@ class TilemapRenderer
|
||||
return @disposed
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def add_tileset(filename)
|
||||
@tilesets.add(filename)
|
||||
@@ -351,7 +350,7 @@ class TilemapRenderer
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def refresh
|
||||
@need_refresh = true
|
||||
@@ -436,7 +435,7 @@ class TilemapRenderer
|
||||
tile.need_refresh = false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def check_if_screen_moved
|
||||
ret = false
|
||||
@@ -522,7 +521,7 @@ class TilemapRenderer
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def update
|
||||
# Update tone
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class TilemapRenderer
|
||||
module AutotileExpander
|
||||
MAX_TEXTURE_SIZE = (Bitmap.max_size / 1024) * 1024
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class TileDrawingHelper
|
||||
attr_accessor :tileset
|
||||
attr_accessor :autotiles
|
||||
@@ -81,6 +84,8 @@ class TileDrawingHelper
|
||||
return self.new(bmtileset, bmautotiles)
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def initialize(tileset, autotiles)
|
||||
if tileset.mega?
|
||||
@tileset = TilemapRenderer::TilesetWrapper.wrapTileset(tileset)
|
||||
|
||||
@@ -32,7 +32,9 @@ module MessageConfig
|
||||
@@smallFont = nil
|
||||
@@narrowFont = nil
|
||||
|
||||
def self.pbDefaultSystemFrame
|
||||
module_function
|
||||
|
||||
def pbDefaultSystemFrame
|
||||
if $PokemonSystem
|
||||
return pbResolveBitmap("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[$PokemonSystem.frame]) || ""
|
||||
else
|
||||
@@ -40,7 +42,7 @@ module MessageConfig
|
||||
end
|
||||
end
|
||||
|
||||
def self.pbDefaultSpeechFrame
|
||||
def pbDefaultSpeechFrame
|
||||
if $PokemonSystem
|
||||
return pbResolveBitmap("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[$PokemonSystem.textskin]) || ""
|
||||
else
|
||||
@@ -48,7 +50,7 @@ module MessageConfig
|
||||
end
|
||||
end
|
||||
|
||||
def self.pbDefaultWindowskin
|
||||
def pbDefaultWindowskin
|
||||
skin = ($data_system) ? $data_system.windowskin_name : nil
|
||||
if skin && skin != ""
|
||||
skin = pbResolveBitmap("Graphics/Windowskins/" + skin) || ""
|
||||
@@ -58,7 +60,7 @@ module MessageConfig
|
||||
return skin || ""
|
||||
end
|
||||
|
||||
def self.pbGetSystemFrame
|
||||
def pbGetSystemFrame
|
||||
if !@@systemFrame
|
||||
skin = MessageConfig.pbDefaultSystemFrame
|
||||
skin = MessageConfig.pbDefaultWindowskin if nil_or_empty?(skin)
|
||||
@@ -67,7 +69,7 @@ module MessageConfig
|
||||
return @@systemFrame
|
||||
end
|
||||
|
||||
def self.pbGetSpeechFrame
|
||||
def pbGetSpeechFrame
|
||||
if !@@defaultTextSkin
|
||||
skin = MessageConfig.pbDefaultSpeechFrame
|
||||
skin = MessageConfig.pbDefaultWindowskin if nil_or_empty?(skin)
|
||||
@@ -76,32 +78,32 @@ module MessageConfig
|
||||
return @@defaultTextSkin
|
||||
end
|
||||
|
||||
def self.pbSetSystemFrame(value)
|
||||
def pbSetSystemFrame(value)
|
||||
@@systemFrame = pbResolveBitmap(value) || ""
|
||||
end
|
||||
|
||||
def self.pbSetSpeechFrame(value)
|
||||
def pbSetSpeechFrame(value)
|
||||
@@defaultTextSkin = pbResolveBitmap(value) || ""
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def self.pbDefaultTextSpeed
|
||||
def pbDefaultTextSpeed
|
||||
return ($PokemonSystem) ? pbSettingToTextSpeed($PokemonSystem.textspeed) : pbSettingToTextSpeed(nil)
|
||||
end
|
||||
|
||||
def self.pbGetTextSpeed
|
||||
def pbGetTextSpeed
|
||||
@@textSpeed = pbDefaultTextSpeed if !@@textSpeed
|
||||
return @@textSpeed
|
||||
end
|
||||
|
||||
def self.pbSetTextSpeed(value)
|
||||
def pbSetTextSpeed(value)
|
||||
@@textSpeed = value
|
||||
end
|
||||
|
||||
# Text speed is the delay in seconds between two adjacent characters being
|
||||
# shown.
|
||||
def self.pbSettingToTextSpeed(speed)
|
||||
def pbSettingToTextSpeed(speed)
|
||||
case speed
|
||||
when 0 then return 4 / 80.0 # Slow
|
||||
when 1 then return 2 / 80.0 # Medium
|
||||
@@ -113,49 +115,49 @@ module MessageConfig
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def self.pbDefaultSystemFontName
|
||||
def pbDefaultSystemFontName
|
||||
return MessageConfig.pbTryFonts(FONT_NAME)
|
||||
end
|
||||
|
||||
def self.pbDefaultSmallFontName
|
||||
def pbDefaultSmallFontName
|
||||
return MessageConfig.pbTryFonts(SMALL_FONT_NAME)
|
||||
end
|
||||
|
||||
def self.pbDefaultNarrowFontName
|
||||
def pbDefaultNarrowFontName
|
||||
return MessageConfig.pbTryFonts(NARROW_FONT_NAME)
|
||||
end
|
||||
|
||||
def self.pbGetSystemFontName
|
||||
def pbGetSystemFontName
|
||||
@@systemFont = pbDefaultSystemFontName if !@@systemFont
|
||||
return @@systemFont
|
||||
end
|
||||
|
||||
def self.pbGetSmallFontName
|
||||
def pbGetSmallFontName
|
||||
@@smallFont = pbDefaultSmallFontName if !@@smallFont
|
||||
return @@smallFont
|
||||
end
|
||||
|
||||
def self.pbGetNarrowFontName
|
||||
def pbGetNarrowFontName
|
||||
@@narrowFont = pbDefaultNarrowFontName if !@@narrowFont
|
||||
return @@narrowFont
|
||||
end
|
||||
|
||||
def self.pbSetSystemFontName(value)
|
||||
def pbSetSystemFontName(value)
|
||||
@@systemFont = MessageConfig.pbTryFonts(value)
|
||||
@@systemFont = MessageConfig.pbDefaultSystemFontName if @@systemFont == ""
|
||||
end
|
||||
|
||||
def self.pbSetSmallFontName(value)
|
||||
def pbSetSmallFontName(value)
|
||||
@@smallFont = MessageConfig.pbTryFonts(value)
|
||||
@@smallFont = MessageConfig.pbDefaultSmallFontName if @@smallFont == ""
|
||||
end
|
||||
|
||||
def self.pbSetNarrowFontName(value)
|
||||
def pbSetNarrowFontName(value)
|
||||
@@narrowFont = MessageConfig.pbTryFonts(value)
|
||||
@@narrowFont = MessageConfig.pbDefaultNarrowFontName if @@narrowFont == ""
|
||||
end
|
||||
|
||||
def self.pbTryFonts(*args)
|
||||
def pbTryFonts(*args)
|
||||
args.each do |a|
|
||||
next if !a
|
||||
case a
|
||||
@@ -173,7 +175,7 @@ module MessageConfig
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Position a window
|
||||
# Position a window.
|
||||
#===============================================================================
|
||||
def pbBottomRight(window)
|
||||
window.x = Graphics.width - window.width
|
||||
@@ -277,7 +279,7 @@ def pbUpdateMsgWindowPos(msgwindow, event, eventChanged = false)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Determine the colour of a background
|
||||
# Determine the colour of a background.
|
||||
#===============================================================================
|
||||
def isDarkBackground(background, rect = nil)
|
||||
return true if !background || background.disposed?
|
||||
@@ -328,7 +330,7 @@ def isDarkWindowskin(windowskin)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Determine which text colours to use based on the darkness of the background
|
||||
# Determine which text colours to use based on the darkness of the background.
|
||||
#===============================================================================
|
||||
def get_text_colors_for_windowskin(windowskin, color, isDarkSkin)
|
||||
# VX windowskin
|
||||
@@ -394,7 +396,7 @@ def getDefaultTextColors(windowskin)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Makes sure a bitmap exists
|
||||
# Makes sure a bitmap exists.
|
||||
#===============================================================================
|
||||
def pbDoEnsureBitmap(bitmap, dwidth, dheight)
|
||||
if !bitmap || bitmap.disposed? || bitmap.width < dwidth || bitmap.height < dheight
|
||||
@@ -408,7 +410,7 @@ def pbDoEnsureBitmap(bitmap, dwidth, dheight)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Set a bitmap's font
|
||||
# Set a bitmap's font.
|
||||
#===============================================================================
|
||||
# Sets a bitmap's font to the system font.
|
||||
def pbSetSystemFont(bitmap)
|
||||
@@ -432,7 +434,7 @@ def pbSetNarrowFont(bitmap)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Blend colours, set the colour of all bitmaps in a sprite hash
|
||||
# Blend colours, set the colour of all bitmaps in a sprite hash.
|
||||
#===============================================================================
|
||||
def pbAlphaBlend(dstColor, srcColor)
|
||||
r = (255 * (srcColor.red - dstColor.red) / 255) + dstColor.red
|
||||
@@ -478,7 +480,7 @@ def pbSetSpritesToColor(sprites, color)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Update and dispose sprite hashes
|
||||
# Update and dispose sprite hashes.
|
||||
#===============================================================================
|
||||
def using(window)
|
||||
begin
|
||||
@@ -538,7 +540,7 @@ def pbDisposed?(x)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fades and window activations for sprite hashes
|
||||
# Fades and window activations for sprite hashes.
|
||||
#===============================================================================
|
||||
def pbPushFade
|
||||
$game_temp.fadestate = [$game_temp.fadestate + 1, 0].max if $game_temp
|
||||
@@ -728,7 +730,7 @@ def pbActivateWindow(sprites, key)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Create background planes for a sprite hash
|
||||
# Create background planes for a sprite hash.
|
||||
#===============================================================================
|
||||
# Adds a background to the sprite hash.
|
||||
# _planename_ is the hash key of the background.
|
||||
|
||||
@@ -34,7 +34,7 @@ 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
|
||||
CORRECT_Z = 1
|
||||
EXPAND_BACK = 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#===============================================================================
|
||||
# Text colors
|
||||
# Text colors.
|
||||
#===============================================================================
|
||||
# Unused
|
||||
def ctag(color)
|
||||
@@ -70,7 +70,7 @@ def getContrastColor(color)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Format text
|
||||
# Format text.
|
||||
#===============================================================================
|
||||
FORMATREGEXP = /<(\/?)(c|c2|c3|o|fn|br|fs|i|b|r|pg|pog|u|s|icon|img|ac|ar|al|outln|outln2)(\s*\=\s*([^>]*))?>/i
|
||||
|
||||
@@ -790,7 +790,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Draw text and images on a bitmap
|
||||
# Draw text and images on a bitmap.
|
||||
#===============================================================================
|
||||
def getLineBrokenText(bitmap, value, width, dims)
|
||||
x = 0
|
||||
@@ -1134,7 +1134,7 @@ def pbDrawTextPositions(bitmap, textpos)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Draw images on a bitmap
|
||||
# Draw images on a bitmap.
|
||||
#===============================================================================
|
||||
def pbCopyBitmap(dstbm, srcbm, x, y, opacity = 255)
|
||||
rc = Rect.new(0, 0, srcbm.width, srcbm.height)
|
||||
|
||||
@@ -305,7 +305,7 @@ def pbCsvPosInt!(str)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Money and coins windows
|
||||
# Money and coins windows.
|
||||
#===============================================================================
|
||||
def pbGetGoldString
|
||||
return _INTL("${1}", $player.money.to_s_formatted)
|
||||
@@ -400,7 +400,7 @@ def pbDisposeMessageWindow(msgwindow)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Main message-displaying function
|
||||
# Main message-displaying function.
|
||||
#===============================================================================
|
||||
def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = nil)
|
||||
return if !msgwindow
|
||||
@@ -685,7 +685,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Message-displaying functions
|
||||
# Message-displaying functions.
|
||||
#===============================================================================
|
||||
def pbMessage(message, commands = nil, cmdIfCancel = 0, skin = nil, defaultCmd = 0, &block)
|
||||
ret = 0
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbStringToAudioFile(str)
|
||||
if str[/^(.*)\:\s*(\d+)\s*\:\s*(\d+)\s*$/] # Of the format "XXX: ###: ###"
|
||||
file = $1
|
||||
@@ -39,7 +42,8 @@ def pbResolveAudioFile(str, volume = nil, pitch = nil)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
#
|
||||
#===============================================================================
|
||||
# Plays a BGM file.
|
||||
# param -- Either a string showing the filename
|
||||
# (relative to Audio/BGM/) or an RPG::AudioFile object.
|
||||
@@ -89,7 +93,8 @@ def pbBGMStop(timeInSeconds = 0.0)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
#
|
||||
#===============================================================================
|
||||
# Plays an ME file.
|
||||
# param -- Either a string showing the filename
|
||||
# (relative to Audio/ME/) or an RPG::AudioFile object.
|
||||
@@ -139,7 +144,8 @@ def pbMEStop(timeInSeconds = 0.0)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
#
|
||||
#===============================================================================
|
||||
# Plays a BGS file.
|
||||
# param -- Either a string showing the filename
|
||||
# (relative to Audio/BGS/) or an RPG::AudioFile object.
|
||||
@@ -189,7 +195,8 @@ def pbBGSStop(timeInSeconds = 0.0)
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
#
|
||||
#===============================================================================
|
||||
# Plays an SE file.
|
||||
# param -- Either a string showing the filename
|
||||
# (relative to Audio/SE/) or an RPG::AudioFile object.
|
||||
@@ -232,8 +239,6 @@ def pbSEStop(_timeInSeconds = 0.0)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
# Plays a sound effect that plays when the player moves the cursor.
|
||||
def pbPlayCursorSE
|
||||
if !nil_or_empty?($data_system&.cursor_se&.name)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
#=============================================================================
|
||||
# A mixin module for data classes which provides common class methods (called
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class GrowthRate
|
||||
attr_reader :id
|
||||
@@ -24,6 +27,8 @@ module GameData
|
||||
return Settings::MAXIMUM_LEVEL
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -72,6 +77,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::GrowthRate.register({
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#===============================================================================
|
||||
# If a Pokémon's gender ratio is none of :AlwaysMale, :AlwaysFemale or
|
||||
# :Genderless, then it will choose a random number between 0 and 255 inclusive,
|
||||
# and compare it to the @female_chance. If the random number is lower than this
|
||||
# chance, it will be female; otherwise, it will be male.
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class GenderRatio
|
||||
attr_reader :id
|
||||
@@ -16,6 +18,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -35,6 +39,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::GenderRatio.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class EggGroup
|
||||
attr_reader :id
|
||||
@@ -11,6 +14,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -23,6 +28,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::EggGroup.register({
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#===============================================================================
|
||||
# NOTE: The order these shapes are registered are the order they are listed in
|
||||
# the Pokédex search screen.
|
||||
# "Graphics/UI/Pokedex/icon_shapes.png" contains icons for these
|
||||
# shapes.
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class BodyShape
|
||||
attr_reader :id
|
||||
@@ -16,6 +18,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -29,6 +33,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::BodyShape.register({
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#===============================================================================
|
||||
# NOTE: The order these colors are registered are the order they are listed in
|
||||
# the Pokédex search screen.
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class BodyColor
|
||||
attr_reader :id
|
||||
@@ -13,6 +15,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -25,6 +29,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::BodyColor.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Habitat
|
||||
attr_reader :id
|
||||
@@ -11,6 +14,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -23,6 +28,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Habitat.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Evolution
|
||||
attr_reader :id
|
||||
@@ -20,6 +23,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:id].to_s || "Unnamed"
|
||||
@@ -71,12 +76,18 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Evolution.register({
|
||||
:id => :None
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Evolution.register({
|
||||
:id => :Level,
|
||||
:parameter => Integer,
|
||||
@@ -545,6 +556,7 @@ GameData::Evolution.register({
|
||||
#===============================================================================
|
||||
# Evolution methods that trigger when levelling up in battle.
|
||||
#===============================================================================
|
||||
|
||||
GameData::Evolution.register({
|
||||
:id => :LevelBattle,
|
||||
:parameter => Integer,
|
||||
@@ -556,6 +568,7 @@ GameData::Evolution.register({
|
||||
#===============================================================================
|
||||
# Evolution methods that trigger when using an item on the Pokémon.
|
||||
#===============================================================================
|
||||
|
||||
GameData::Evolution.register({
|
||||
:id => :Item,
|
||||
:parameter => :Item,
|
||||
@@ -607,6 +620,7 @@ GameData::Evolution.register({
|
||||
#===============================================================================
|
||||
# Evolution methods that trigger when the Pokémon is obtained in a trade.
|
||||
#===============================================================================
|
||||
|
||||
GameData::Evolution.register({
|
||||
:id => :Trade,
|
||||
:on_trade_proc => proc { |pkmn, parameter, other_pkmn|
|
||||
@@ -666,6 +680,7 @@ GameData::Evolution.register({
|
||||
#===============================================================================
|
||||
# Evolution methods that are triggered after any battle.
|
||||
#===============================================================================
|
||||
|
||||
GameData::Evolution.register({
|
||||
:id => :AfterBattleCounter,
|
||||
:parameter => Integer,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#===============================================================================
|
||||
# The pbs_order value determines the order in which the stats are written in
|
||||
# several PBS files, where base stats/IVs/EVs/EV yields are defined. Only stats
|
||||
# which are yielded by the "each_main" method can have stat numbers defined in
|
||||
# those places. The values of pbs_order defined below should start with 0 and
|
||||
# increase without skipping any numbers.
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Stat
|
||||
attr_reader :id
|
||||
@@ -34,6 +36,8 @@ module GameData
|
||||
self.each { |s| yield s if [:main_battle, :battle].include?(s.type) }
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -54,6 +58,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Stat.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Nature
|
||||
attr_reader :id
|
||||
@@ -12,6 +15,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -25,6 +30,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Nature.register({
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#===============================================================================
|
||||
# NOTE: "Graphics/UI/statuses.png" also contains icons for being fainted and for
|
||||
# having Pokérus, in that order, at the bottom of the graphic.
|
||||
# "Graphics/UI/Battle/icon_statuses.png" also contains an icon for bad
|
||||
# poisoning (toxic), at the bottom of the graphic.
|
||||
# Both graphics automatically handle varying numbers of defined statuses,
|
||||
# as long as their extra icons remain at the bottom of them.
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Status
|
||||
attr_reader :id
|
||||
@@ -21,6 +23,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -35,6 +39,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Status.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class TerrainTag
|
||||
attr_reader :id
|
||||
@@ -40,6 +43,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number]
|
||||
@@ -72,6 +77,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::TerrainTag.register({
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#===============================================================================
|
||||
# Category has the following effects:
|
||||
# - Determines the in-battle weather.
|
||||
# - Some abilities reduce the encounter rate in certain categories of weather.
|
||||
@@ -8,6 +9,7 @@
|
||||
# Delta values are per second.
|
||||
# For the tone_proc, strength goes from 0 to RPG::Weather::MAX_SPRITES (60) and
|
||||
# will typically be the maximum.
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Weather
|
||||
attr_reader :id
|
||||
@@ -30,6 +32,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number]
|
||||
@@ -60,6 +64,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Weather.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class EncounterType
|
||||
attr_reader :id
|
||||
@@ -13,6 +16,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:id].to_s || "Unnamed"
|
||||
@@ -24,6 +29,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::EncounterType.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Environment
|
||||
attr_reader :id
|
||||
@@ -12,6 +15,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -25,6 +30,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::Environment.register({
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class BattleWeather
|
||||
attr_reader :id
|
||||
@@ -12,6 +15,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -25,6 +30,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::BattleWeather.register({
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#===============================================================================
|
||||
# These are in-battle terrain effects caused by moves like Electric Terrain.
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class BattleTerrain
|
||||
attr_reader :id
|
||||
@@ -13,6 +15,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -26,6 +30,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
GameData::BattleTerrain.register({
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#===============================================================================
|
||||
# NOTE: If adding a new target, you will need to add code in several places to
|
||||
# make them work properly:
|
||||
# - def pbFindTargets
|
||||
@@ -5,6 +6,7 @@
|
||||
# - def pbCreateTargetTexts
|
||||
# - def pbFirstTarget
|
||||
# - def pbTargetsMultiple?
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Target
|
||||
attr_reader :id
|
||||
@@ -23,6 +25,8 @@ module GameData
|
||||
def self.load; end
|
||||
def self.save; end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@@ -48,6 +52,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
# Bide, Counter, Metal Burst, Mirror Coat (calculate a target)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class TownMap
|
||||
attr_reader :id
|
||||
@@ -10,7 +13,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "town_map.dat"
|
||||
PBS_BASE_FILENAME = "town_map"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "u"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -22,6 +24,8 @@ module GameData
|
||||
extend ClassMethodsIDNumbers
|
||||
include InstanceMethods
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "???"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Type
|
||||
attr_reader :id
|
||||
@@ -14,7 +17,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "types.dat"
|
||||
PBS_BASE_FILENAME = "types"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -26,12 +28,13 @@ module GameData
|
||||
"Immunities" => [:immunities, "*m"],
|
||||
"Flags" => [:flags, "*s"]
|
||||
}
|
||||
|
||||
ICON_SIZE = [64, 28]
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "Unnamed"
|
||||
@@ -71,7 +74,8 @@ module GameData
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
#
|
||||
#===============================================================================
|
||||
module Effectiveness
|
||||
INEFFECTIVE = 0
|
||||
NOT_VERY_EFFECTIVE = 1
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Ability
|
||||
attr_reader :id
|
||||
@@ -9,10 +12,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "abilities.dat"
|
||||
PBS_BASE_FILENAME = "abilities"
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -20,6 +19,11 @@ module GameData
|
||||
"Flags" => [:flags, "*s"]
|
||||
}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "Unnamed"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Move
|
||||
attr_reader :id
|
||||
@@ -18,7 +21,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "moves.dat"
|
||||
PBS_BASE_FILENAME = "moves"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -34,12 +36,13 @@ module GameData
|
||||
"EffectChance" => [:effect_chance, "u"],
|
||||
"Description" => [:real_description, "q"]
|
||||
}
|
||||
|
||||
CATEGORY_ICON_SIZE = [64, 28]
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "Unnamed"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Item
|
||||
attr_reader :id
|
||||
@@ -21,7 +24,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "items.dat"
|
||||
PBS_BASE_FILENAME = "items"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -116,6 +118,8 @@ module GameData
|
||||
return pbResolveBitmap(ret) ? ret : nil
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "Unnamed"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class BerryPlant
|
||||
attr_reader :id
|
||||
@@ -9,14 +12,12 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "berry_plants.dat"
|
||||
PBS_BASE_FILENAME = "berry_plants"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"HoursPerStage" => [:hours_per_stage, "v"],
|
||||
"DryingPerHour" => [:drying_per_hour, "u"],
|
||||
"Yield" => [:yield, "uv"]
|
||||
}
|
||||
|
||||
NUMBER_OF_REPLANTS = 9
|
||||
NUMBER_OF_GROWTH_STAGES = 4
|
||||
NUMBER_OF_FULLY_GROWN_STAGES = 4
|
||||
@@ -25,6 +26,8 @@ module GameData
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@hours_per_stage = hash[:hours_per_stage] || 3
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Species
|
||||
attr_reader :id
|
||||
@@ -176,6 +179,8 @@ module GameData
|
||||
return ret
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@species = hash[:species] || @id
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Species
|
||||
def self.check_graphic_file(path, species, form = 0, gender = 0, shiny = false, shadow = false, subfolder = "")
|
||||
@@ -108,7 +111,7 @@ module GameData
|
||||
return ret
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def self.egg_icon_filename(species, form)
|
||||
ret = self.check_egg_graphic_file("Graphics/Pokemon/Eggs/", species, form, "_icon")
|
||||
@@ -139,7 +142,7 @@ module GameData
|
||||
return self.icon_bitmap(pkmn.species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?)
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def self.footprint_filename(species, form = 0)
|
||||
species_data = self.get_species_form(species, form)
|
||||
@@ -151,7 +154,7 @@ module GameData
|
||||
return pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s", species_data.species))
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def self.shadow_filename(species, form = 0)
|
||||
species_data = self.get_species_form(species, form)
|
||||
@@ -178,7 +181,7 @@ module GameData
|
||||
return (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def self.check_cry_file(species, form, suffix = "")
|
||||
species_data = self.get_species_form(species, form)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class SpeciesMetrics
|
||||
attr_reader :id
|
||||
@@ -13,7 +16,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "species_metrics.dat"
|
||||
PBS_BASE_FILENAME = "pokemon_metrics"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "eV", :Species],
|
||||
"BackSprite" => [:back_sprite, "ii"],
|
||||
@@ -56,6 +58,8 @@ module GameData
|
||||
return DATA[species]
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@species = hash[:species] || @id
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class ShadowPokemon
|
||||
attr_reader :id
|
||||
@@ -12,7 +15,6 @@ module GameData
|
||||
DATA_FILENAME = "shadow_pokemon.dat"
|
||||
PBS_BASE_FILENAME = "shadow_pokemon"
|
||||
OPTIONAL = true
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "eV", :Species],
|
||||
"GaugeSize" => [:gauge_size, "v"],
|
||||
@@ -43,6 +45,8 @@ module GameData
|
||||
return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@species = hash[:species] || @id
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Ribbon
|
||||
attr_reader :id
|
||||
@@ -10,7 +13,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "ribbons.dat"
|
||||
PBS_BASE_FILENAME = "ribbons"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -22,6 +24,8 @@ module GameData
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "Unnamed"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Encounter
|
||||
attr_accessor :id
|
||||
@@ -59,6 +62,8 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@map = hash[:map]
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class TrainerType
|
||||
attr_reader :id
|
||||
@@ -15,7 +18,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "trainer_types.dat"
|
||||
PBS_BASE_FILENAME = "trainer_types"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "m"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -101,6 +103,8 @@ module GameData
|
||||
return self.check_file(tr_type, "Graphics/UI/Town Map/player_", sprintf("_%d", outfit))
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name] || "Unnamed"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Trainer
|
||||
attr_reader :id
|
||||
@@ -12,7 +15,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "trainers.dat"
|
||||
PBS_BASE_FILENAME = "trainers"
|
||||
|
||||
# "Pokemon" is specially mentioned in def compile_trainers and def
|
||||
# write_trainers, and acts as a subheading for a particular Pokémon.
|
||||
SCHEMA = {
|
||||
@@ -83,6 +85,8 @@ module GameData
|
||||
return (self::DATA.has_key?(key)) ? self::DATA[key] : nil
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@trainer_type = hash[:trainer_type]
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class Metadata
|
||||
attr_reader :id
|
||||
@@ -17,7 +20,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "metadata.dat"
|
||||
PBS_BASE_FILENAME = "metadata"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "u"],
|
||||
"StartMoney" => [:start_money, "u"],
|
||||
@@ -56,6 +58,8 @@ module GameData
|
||||
return DATA[0]
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id] || 0
|
||||
@start_money = hash[:start_money] || 3000
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class PlayerMetadata
|
||||
attr_reader :id
|
||||
@@ -8,7 +11,6 @@ module GameData
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "player_metadata.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "u"],
|
||||
"TrainerType" => [:trainer_type, "e", :TrainerType],
|
||||
@@ -48,6 +50,8 @@ module GameData
|
||||
return self::DATA[1]
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@trainer_type = hash[:trainer_type]
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class MapMetadata
|
||||
attr_reader :id
|
||||
@@ -29,7 +32,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "map_metadata.dat"
|
||||
PBS_BASE_FILENAME = "map_metadata"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "u"],
|
||||
"Name" => [:real_name, "s"],
|
||||
@@ -89,6 +91,8 @@ module GameData
|
||||
]
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@real_name = hash[:real_name]
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class DungeonTileset
|
||||
attr_reader :id
|
||||
@@ -15,7 +18,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "dungeon_tilesets.dat"
|
||||
PBS_BASE_FILENAME = "dungeon_tilesets"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "u"],
|
||||
"Autotile" => [:autotile, "^um"],
|
||||
@@ -41,6 +43,8 @@ module GameData
|
||||
return (self::DATA.has_key?(other)) ? self::DATA[other] : self.get(self::DATA.keys.first)
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@snap_to_large_grid = hash[:snap_to_large_grid] || false
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class DungeonParameters
|
||||
attr_reader :id, :area, :version
|
||||
@@ -29,7 +32,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "dungeon_parameters.dat"
|
||||
PBS_BASE_FILENAME = "dungeon_parameters"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "mV"],
|
||||
"DungeonSize" => [:dungeon_size, "vv"],
|
||||
@@ -65,6 +67,8 @@ module GameData
|
||||
return (DATA.has_key?(area_version)) ? DATA[area_version] : self.new({})
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@area = hash[:area]
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module GameData
|
||||
class PhoneMessage
|
||||
attr_reader :id
|
||||
@@ -11,7 +14,6 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "phone.dat"
|
||||
PBS_BASE_FILENAME = "phone"
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "q"],
|
||||
"Intro" => [:intro, "^q"],
|
||||
@@ -69,6 +71,8 @@ module GameData
|
||||
return (self::DATA.has_key?(key)) ? self::DATA[key] : nil
|
||||
end
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@trainer_type = hash[:trainer_type]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#===============================================================================
|
||||
# Results of battle (see module Outcome):
|
||||
# 0 - Undecided or aborted
|
||||
# 1 - Player won
|
||||
@@ -36,7 +37,7 @@
|
||||
# class Game_Temp
|
||||
# def add_battle_rule
|
||||
# (There is no guarantee that this list is complete.)
|
||||
|
||||
#===============================================================================
|
||||
class Battle
|
||||
module Outcome
|
||||
UNDECIDED = 0
|
||||
@@ -115,9 +116,8 @@ class Battle
|
||||
|
||||
def pbRandom(x); return rand(x); end
|
||||
|
||||
#=============================================================================
|
||||
# Creating the battle class
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def initialize(scene, p1, p2, player, opponent)
|
||||
if p1.length == 0
|
||||
raise ArgumentError.new(_INTL("Party 1 has no Pokémon."))
|
||||
@@ -200,9 +200,10 @@ class Battle
|
||||
return Outcome.decided?(@decision)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Information about the type and size of the battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Information about the type and size of the battle.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def wildBattle?; return @opponent.nil?; end
|
||||
def trainerBattle?; return !@opponent.nil?; end
|
||||
|
||||
@@ -236,9 +237,10 @@ class Battle
|
||||
return (pbSideSize(0) > pbSideSize(1)) ? (pbSideSize(0) - 1) * 2 : (pbSideSize(1) * 2) - 1
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Trainers and owner-related methods
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Trainers and owner-related methods.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbPlayer; return @player[0]; end
|
||||
|
||||
# Given a battler index, returns the index within @player/@opponent of the
|
||||
@@ -324,9 +326,10 @@ class Battle
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Get party information (counts all teams on the same side)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Get party information (counts all teams on the same side).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbParty(idxBattler)
|
||||
return (opposes?(idxBattler)) ? @party2 : @party1
|
||||
end
|
||||
@@ -407,10 +410,11 @@ class Battle
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Get team information (a team is only the Pokémon owned by a particular
|
||||
# trainer)
|
||||
#=============================================================================
|
||||
# trainer).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
partyStarts = pbPartyStarts(idxBattler)
|
||||
idxTrainer = pbGetOwnerIndexFromBattlerIndex(idxBattler)
|
||||
@@ -464,9 +468,10 @@ class Battle
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Iterate through battlers
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Iterate through battlers.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Unused
|
||||
def eachBattler
|
||||
@battlers.each { |b| yield b if b && !b.fainted? }
|
||||
@@ -577,9 +582,10 @@ class Battle
|
||||
return [idxBattler]
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Comparing the positions of two battlers
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Comparing the positions of two battlers.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def opposes?(idxBattler1, idxBattler2 = 0)
|
||||
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
|
||||
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
|
||||
@@ -612,9 +618,10 @@ class Battle
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Altering a party or rearranging battlers
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Altering a party or rearranging battlers.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbRemoveFromParty(idxBattler, idxParty)
|
||||
party = pbParty(idxBattler)
|
||||
# Erase the Pokémon from the party
|
||||
@@ -670,9 +677,10 @@ class Battle
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns the battler representing the Pokémon at index idxParty in its party,
|
||||
# on the same side as a battler with battler index of idxBattlerOther.
|
||||
def pbFindBattler(idxParty, idxBattlerOther = 0)
|
||||
@@ -724,9 +732,10 @@ class Battle
|
||||
return @nextPickupUse
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Weather
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Weather.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def defaultWeather=(value)
|
||||
@field.defaultWeather = value
|
||||
@field.weather = value
|
||||
@@ -811,9 +820,10 @@ class Battle
|
||||
# NOTE: The ability splash is hidden again in def pbStartWeather.
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Terrain
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Terrain.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def defaultTerrain=(value)
|
||||
@field.defaultTerrain = value
|
||||
@field.terrain = value
|
||||
@@ -847,9 +857,10 @@ class Battle
|
||||
allBattlers.each { |b| b.pbItemTerrainStatBoostCheck }
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Messages and animations
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Messages and animations.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbDisplay(msg, &block)
|
||||
@scene.pbDisplayMessage(msg, &block)
|
||||
end
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
class BattleAbortedException < Exception; end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbAbort
|
||||
raise BattleAbortedException.new("Battle aborted")
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Makes sure all Pokémon exist that need to. Alter the type of battle if
|
||||
# necessary. Will never try to create battler positions, only delete them
|
||||
# (except for wild Pokémon whose number of positions are fixed). Reduces the
|
||||
# size of each side by 1 and tries again. If the side sizes are uneven, only
|
||||
# the larger side's size will be reduced by 1 each time, until both sides are
|
||||
# an equal size (then both sides will be reduced equally).
|
||||
#=============================================================================
|
||||
def pbEnsureParticipants
|
||||
# Prevent battles larger than 2v2 if both sides have multiple trainers
|
||||
# NOTE: This is necessary to ensure that battlers can never become unable to
|
||||
@@ -103,9 +106,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set up all battlers
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCreateBattler(idxBattler, pkmn, idxParty)
|
||||
if !@battlers[idxBattler].nil?
|
||||
raise _INTL("Battler index {1} already exists", idxBattler)
|
||||
@@ -164,9 +168,10 @@ class Battle
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Send out all battlers at the start of battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Send out all battlers at the start of battle.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbStartBattleSendOut(sendOuts)
|
||||
# "Want to battle" messages
|
||||
if wildBattle?
|
||||
@@ -241,9 +246,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Start a battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Start a battle.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbStartBattle
|
||||
PBDebug.log("")
|
||||
PBDebug.log("================================================================")
|
||||
@@ -317,9 +323,10 @@ class Battle
|
||||
pbBattleLoop
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Main battle loop
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Main battle loop.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbBattleLoop
|
||||
@turnCount = 0
|
||||
loop do # Now begin the battle loop
|
||||
@@ -347,9 +354,10 @@ class Battle
|
||||
pbEndOfBattle
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End of battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End of battle.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbGainMoney
|
||||
return if !@internalBattle || !@moneyGain
|
||||
# Money rewarded from opposing trainers
|
||||
@@ -511,9 +519,10 @@ class Battle
|
||||
return @decision
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Judging
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Judging.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbJudgeCheckpoint(user, move = nil); end
|
||||
|
||||
def pbDecisionOnTime
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# Gaining Experience
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Gaining Experience.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbGainExp
|
||||
# Play wild victory music if it's the end of the battle (has to be here)
|
||||
@scene.pbWildBattleSuccess if wildBattle? && pbAllFainted?(1) && !pbAllFainted?(0)
|
||||
@@ -223,9 +227,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Learning a move
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Learning a move.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbLearnMove(idxParty, newMove)
|
||||
pkmn = pbParty(0)[idxParty]
|
||||
return if !pkmn
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# Choosing a move/target
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Choosing a move/target.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanChooseMove?(idxBattler, idxMove, showMessages, sleepTalk = false)
|
||||
battler = @battlers[idxBattler]
|
||||
move = battler.moves[idxMove]
|
||||
@@ -130,9 +134,9 @@ class Battle
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Turn order calculation (priority)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Turn order calculation (priority).
|
||||
#-----------------------------------------------------------------------------
|
||||
def pbCalculatePriority(fullCalc = false, indexArray = nil)
|
||||
needRearranging = false
|
||||
if fullCalc
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# Choosing Pokémon to switch
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Choosing Pokémon to switch.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Checks whether the replacement Pokémon (at party index idxParty) can enter
|
||||
# battle.
|
||||
# NOTE: Messages are only shown while in the party screen when choosing a
|
||||
@@ -104,10 +108,11 @@ class Battle
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Open the party screen and potentially pick a replacement Pokémon (or AI
|
||||
# chooses replacement)
|
||||
#=============================================================================
|
||||
# chooses replacement).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Open party screen and potentially choose a Pokémon to switch with. Used in
|
||||
# all instances where the party screen is opened.
|
||||
def pbPartyScreen(idxBattler, checkLaxOnly = false, canCancel = false, shouldRegister = false)
|
||||
@@ -134,9 +139,10 @@ class Battle
|
||||
return @battleAI.pbDefaultChooseNewEnemy(idxBattler)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Switching Pokémon
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Switching Pokémon.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# General switching method that checks if any Pokémon need to be sent out and,
|
||||
# if so, does. Called at the end of each round.
|
||||
def pbEORSwitch(favorDraws = false)
|
||||
@@ -296,9 +302,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Effects upon a Pokémon entering battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Effects upon a Pokémon entering battle.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Called at the start of battle only.
|
||||
def pbOnAllBattlersEnteringBattle
|
||||
pbCalculatePriority(true)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# Choosing to use an item
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Choosing to use an item.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanUseItemOnPokemon?(item, pkmn, battler, scene, showMessages = true)
|
||||
if !pkmn || pkmn.egg?
|
||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||
@@ -43,9 +47,10 @@ class Battle
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Using an item
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Using an item.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbConsumeItemInBag(item, idxBattler)
|
||||
return if !item
|
||||
return if !GameData::Item.get(item).consumed_after_use?
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Running from battle
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanRun?(idxBattler)
|
||||
return false if trainerBattle?
|
||||
battler = @battlers[idxBattler]
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# Shifting a battler to another position in a battle larger than double
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Shifting a battler to another position in a battle larger than double.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanShift?(idxBattler)
|
||||
return false if pbSideSize(0) <= 2 && pbSideSize(1) <= 2 # Double battle or smaller
|
||||
idxOther = -1
|
||||
@@ -25,9 +29,10 @@ class Battle
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Calling at a battler
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Calling at a battler.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbRegisterCall(idxBattler)
|
||||
@choices[idxBattler][0] = :Call
|
||||
@choices[idxBattler][1] = 0
|
||||
@@ -61,9 +66,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Choosing to Mega Evolve a battler
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Choosing to Mega Evolve a battler.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbHasMegaRing?(idxBattler)
|
||||
if pbOwnedByPlayer?(idxBattler)
|
||||
@mega_rings.each { |item| return true if $bag.has?(item) }
|
||||
@@ -129,9 +135,10 @@ class Battle
|
||||
return @megaEvolution[side][owner] == idxBattler
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Mega Evolving a battler
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Mega Evolving a battler.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbMegaEvolve(idxBattler)
|
||||
battler = @battlers[idxBattler]
|
||||
return if !battler || !battler.pokemon
|
||||
@@ -174,9 +181,10 @@ class Battle
|
||||
pbCalculatePriority(false, [idxBattler]) if Settings::RECALCULATE_TURN_ORDER_AFTER_MEGA_EVOLUTION
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Primal Reverting a battler
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Primal Reverting a battler.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbPrimalReversion(idxBattler)
|
||||
battler = @battlers[idxBattler]
|
||||
return if !battler || !battler.pokemon || battler.fainted?
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# Clear commands
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Clear commands.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbClearChoice(idxBattler)
|
||||
@choices[idxBattler] = [] if !@choices[idxBattler]
|
||||
@choices[idxBattler][0] = :None
|
||||
@@ -22,16 +26,18 @@ class Battle
|
||||
pbClearChoice(idxBattler)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Use main command menu (Fight/Pokémon/Bag/Run)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Use main command menu (Fight/Pokémon/Bag/Run).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCommandMenu(idxBattler, firstAction)
|
||||
return @scene.pbCommandMenu(idxBattler, firstAction)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Check whether actions can be taken
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check whether actions can be taken.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanShowCommands?(idxBattler)
|
||||
battler = @battlers[idxBattler]
|
||||
return false if !battler || battler.fainted?
|
||||
@@ -53,9 +59,10 @@ class Battle
|
||||
return usable
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Use sub-menus to choose an action, and register it if is allowed
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Use sub-menus to choose an action, and register it if is allowed.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns true if a choice was made, false if cancelled.
|
||||
def pbFightMenu(idxBattler)
|
||||
# Auto-use Encored move or no moves choosable, so auto-use Struggle
|
||||
@@ -168,9 +175,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Command phase
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Command phase.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCommandPhase
|
||||
@command_phase = true
|
||||
@scene.pbBeginCommandPhase
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# Attack phase actions
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Attack phase actions.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Quick Claw, Custap Berry's "X let it move first!" message.
|
||||
def pbAttackPhasePriorityChangeMessages
|
||||
pbPriority.each do |b|
|
||||
@@ -170,9 +174,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Attack phase
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Attack phase.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbAttackPhase
|
||||
@scene.pbBeginAttackPhase
|
||||
# Reset certain effects
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle
|
||||
#=============================================================================
|
||||
# End Of Round end weather check and weather effects
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round end weather check and weather effects.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEOREndWeather(priority)
|
||||
# NOTE: Primordial weather doesn't need to be checked here, because if it
|
||||
# could wear off here, it will have worn off already.
|
||||
@@ -74,9 +78,10 @@ class Battle
|
||||
battler.pbFaint if battler.fainted?
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round use delayed moves (Future Sight, Doom Desire)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round use delayed moves (Future Sight, Doom Desire).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORUseFutureSight(position, position_index)
|
||||
return if !position || position.effects[PBEffects::FutureSightCounter] == 0
|
||||
position.effects[PBEffects::FutureSightCounter] -= 1
|
||||
@@ -116,9 +121,10 @@ class Battle
|
||||
position.effects[PBEffects::FutureSightUserPartyIndex] = -1
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round healing from Wish
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round healing from Wish.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORWishHealing
|
||||
@positions.each_with_index do |pos, idxPos|
|
||||
next if !pos || pos.effects[PBEffects::Wish] == 0
|
||||
@@ -131,9 +137,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round Sea of Fire damage (Fire Pledge + Grass Pledge combination)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round Sea of Fire damage (Fire Pledge + Grass Pledge combination).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORSeaOfFireDamage(priority)
|
||||
2.times do |side|
|
||||
next if sides[side].effects[PBEffects::SeaOfFire] == 0
|
||||
@@ -152,9 +159,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round healing from Grassy Terrain
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round healing from Grassy Terrain.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORTerrainHealing(battler)
|
||||
return if battler.fainted?
|
||||
# Grassy Terrain (healing)
|
||||
@@ -165,9 +173,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round various healing effects
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round various healing effects.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORHealingEffects(priority)
|
||||
# Aqua Ring
|
||||
priority.each do |battler|
|
||||
@@ -205,9 +214,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round deal damage from status problems
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round deal damage from status problems.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORStatusProblemDamage(priority)
|
||||
# Damage from poisoning
|
||||
priority.each do |battler|
|
||||
@@ -255,9 +265,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round deal damage from effects (except by trapping)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round deal damage from effects (except by trapping).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEOREffectDamage(priority)
|
||||
# Damage from sleep (Nightmare)
|
||||
priority.each do |battler|
|
||||
@@ -278,9 +289,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round deal damage to trapped battlers
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round deal damage to trapped battlers.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
TRAPPING_MOVE_COMMON_ANIMATIONS = {
|
||||
:BIND => "Bind",
|
||||
:CLAMP => "Clamp",
|
||||
@@ -312,9 +324,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round end effects that apply to a battler
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round end effects that apply to a battler.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORCountDownBattlerEffect(priority, effect)
|
||||
priority.each do |battler|
|
||||
next if battler.fainted? || battler.effects[effect] == 0
|
||||
@@ -394,9 +407,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round end effects that apply to one side of the field
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round end effects that apply to one side of the field.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORCountDownSideEffect(side, effect, msg)
|
||||
return if @sides[side].effects[effect] <= 0
|
||||
@sides[side].effects[effect] -= 1
|
||||
@@ -436,9 +450,10 @@ class Battle
|
||||
_INTL("{1}'s Aurora Veil wore off!", @battlers[side].pbTeam))
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round end effects that apply to the whole field
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round end effects that apply to the whole field.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORCountDownFieldEffect(effect, msg)
|
||||
return if @field.effects[effect] <= 0
|
||||
@field.effects[effect] -= 1
|
||||
@@ -470,9 +485,10 @@ class Battle
|
||||
_INTL("Magic Room wore off, and held items' effects returned to normal!"))
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round end terrain check
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round end terrain check.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEOREndTerrain
|
||||
# Count down terrain duration
|
||||
@field.terrainDuration -= 1 if @field.terrainDuration > 0
|
||||
@@ -509,9 +525,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round end self-inflicted effects on battler
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round end self-inflicted effects on battler.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEOREndBattlerSelfEffects(battler)
|
||||
return if battler.fainted?
|
||||
# Hyper Mode (Shadow Pokémon)
|
||||
@@ -541,9 +558,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# End Of Round shift distant battlers to middle positions
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# End Of Round shift distant battlers to middle positions.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEORShiftDistantBattlers
|
||||
# Move battlers around if none are near to each other
|
||||
# NOTE: This code assumes each side has a maximum of 3 battlers on it, and
|
||||
@@ -596,9 +614,10 @@ class Battle
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Main End Of Round phase method
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Main End Of Round phase method.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEndOfRoundPhase
|
||||
PBDebug.log("")
|
||||
PBDebug.log("[End of round #{@turnCount + 1}]")
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
# Fundamental to this object
|
||||
attr_reader :battle
|
||||
@@ -52,9 +55,10 @@ class Battle::Battler
|
||||
ACC_EVA_STAGE_DIVISORS = [9, 8, 7, 6, 5, 4, 3, 3, 3, 3, 3, 3, 3]
|
||||
STAT_STAGE_MAXIMUM = 6 # Is also the minimum (-6)
|
||||
|
||||
#=============================================================================
|
||||
# Complex accessors
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Complex accessors.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
attr_reader :level
|
||||
|
||||
def level=(value)
|
||||
@@ -130,18 +134,20 @@ class Battle::Battler
|
||||
@battle.scene.pbRefreshOne(@index)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Properties from Pokémon
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Properties from Pokémon.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def happiness; return @pokemon ? @pokemon.happiness : 0; end
|
||||
def affection_level; return @pokemon ? @pokemon.affection_level : 2; end
|
||||
def gender; return @pokemon ? @pokemon.gender : 0; end
|
||||
def nature; return @pokemon ? @pokemon.nature : nil; end
|
||||
def pokerusStage; return @pokemon ? @pokemon.pokerusStage : 0; end
|
||||
|
||||
#=============================================================================
|
||||
# Mega Evolution, Primal Reversion, Shadow Pokémon
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Mega Evolution, Primal Reversion, Shadow Pokémon.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def hasMega?
|
||||
return false if @effects[PBEffects::Transform]
|
||||
return @pokemon&.hasMegaForm?
|
||||
@@ -160,9 +166,10 @@ class Battle::Battler
|
||||
|
||||
def inHyperMode?; return false; end
|
||||
|
||||
#=============================================================================
|
||||
# Display-only properties
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Display-only properties.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def name
|
||||
return @effects[PBEffects::Illusion].name if @effects[PBEffects::Illusion]
|
||||
return @name
|
||||
@@ -242,9 +249,10 @@ class Battle::Battler
|
||||
return lowerCase ? _INTL("the opposing team") : _INTL("The opposing team")
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Calculated properties
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Calculated properties.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbSpeed
|
||||
return 1 if fainted?
|
||||
stage = @stages[:SPEED] + STAT_STAGE_MAXIMUM
|
||||
@@ -287,9 +295,10 @@ class Battle::Battler
|
||||
return [ret, 1].max
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Queries about what the battler has
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Queries about what the battler has.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def plainStats
|
||||
ret = {}
|
||||
ret[:ATTACK] = self.attack
|
||||
@@ -698,9 +707,10 @@ class Battle::Battler
|
||||
@battle.belch[@index & 1][@pokemonIndex] = true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Methods relating to this battler's position on the battlefield
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Methods relating to this battler's position on the battlefield.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns whether the given position belongs to the opposing Pokémon's side.
|
||||
def opposes?(i = 0)
|
||||
i = i.index if i.respond_to?("index")
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Creating a battler
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Creating a battler.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def initialize(btl, idxBattler)
|
||||
@battle = btl
|
||||
@index = idxBattler
|
||||
@@ -282,9 +286,10 @@ class Battle::Battler
|
||||
@effects[PBEffects::Yawn] = 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Refreshing a battler's properties
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Refreshing a battler's properties.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbUpdate(fullChange = false)
|
||||
return if !@pokemon
|
||||
@pokemon.calc_stats
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Change HP
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Change HP.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbReduceHP(amt, anim = true, registerDamage = true, anyAnim = true)
|
||||
amt = amt.round
|
||||
amt = @hp if amt > @hp
|
||||
@@ -93,9 +97,10 @@ class Battle::Battler
|
||||
@battle.pbEndPrimordialWeather
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Move PP
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Move PP.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbSetPP(move, pp)
|
||||
move.pp = pp
|
||||
# No need to care about @effects[PBEffects::Mimic], since Mimic can't copy
|
||||
@@ -118,9 +123,10 @@ class Battle::Battler
|
||||
pbSetPP(move, move.pp - 1) if move.pp > 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Change type
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Change type.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbChangeTypes(newType)
|
||||
if newType.is_a?(Battle::Battler)
|
||||
newTypes = newType.pbTypes
|
||||
@@ -147,9 +153,10 @@ class Battle::Battler
|
||||
@effects[PBEffects::Roost] = false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Forms
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Forms.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbChangeForm(newForm, msg)
|
||||
return if fainted? || @effects[PBEffects::Transform] || @form == newForm
|
||||
oldForm = @form
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Generalised checks for whether a status problem can be inflicted
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generalised checks for whether a status problem can be inflicted.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# NOTE: Not all "does it have this status?" checks use this method. If the
|
||||
# check is leading up to curing self of that status condition, then it
|
||||
# will look at the value of @status directly instead - if it is that
|
||||
@@ -212,9 +216,10 @@ class Battle::Battler
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Generalised infliction of status problem
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generalised infliction of status problem.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbInflictStatus(newStatus, newStatusCount = 0, msg = nil, user = nil)
|
||||
# Inflict the new status
|
||||
self.status = newStatus
|
||||
@@ -269,9 +274,10 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Sleep
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Sleep.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def asleep?
|
||||
return pbHasStatus?(:SLEEP)
|
||||
end
|
||||
@@ -323,9 +329,10 @@ class Battle::Battler
|
||||
return duration
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Poison
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Poison.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def poisoned?
|
||||
return pbHasStatus?(:POISON)
|
||||
end
|
||||
@@ -342,9 +349,10 @@ class Battle::Battler
|
||||
pbInflictStatus(:POISON, (toxic) ? 1 : 0, msg, user)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Burn
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Burn.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def burned?
|
||||
return pbHasStatus?(:BURN)
|
||||
end
|
||||
@@ -361,9 +369,10 @@ class Battle::Battler
|
||||
pbInflictStatus(:BURN, 0, msg, user)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Paralyze
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Paralyze.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def paralyzed?
|
||||
return pbHasStatus?(:PARALYSIS)
|
||||
end
|
||||
@@ -380,9 +389,10 @@ class Battle::Battler
|
||||
pbInflictStatus(:PARALYSIS, 0, msg, user)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Freeze
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Freeze.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def frozen?
|
||||
return pbHasStatus?(:FROZEN)
|
||||
end
|
||||
@@ -395,9 +405,10 @@ class Battle::Battler
|
||||
pbInflictStatus(:FROZEN, 0, msg, user)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Generalised status displays
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generalised status displays.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbContinueStatus
|
||||
if self.status == :POISON && @statusCount > 0
|
||||
@battle.pbCommonAnimation("Toxic", self)
|
||||
@@ -436,9 +447,10 @@ class Battle::Battler
|
||||
PBDebug.log("[Status change] #{pbThis}'s status was cured") if !showMessages
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Confusion
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Confusion.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanConfuse?(user = nil, showMessages = true, move = nil, selfInflicted = false)
|
||||
return false if fainted?
|
||||
if @effects[PBEffects::Confusion] > 0
|
||||
@@ -499,9 +511,10 @@ class Battle::Battler
|
||||
@effects[PBEffects::Confusion] = 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Attraction
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Attraction.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanAttract?(user, showMessages = true)
|
||||
return false if fainted?
|
||||
return false if !user || user.fainted?
|
||||
@@ -562,9 +575,10 @@ class Battle::Battler
|
||||
@effects[PBEffects::Attract] = -1
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Flinching
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Flinching.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbFlinch(_user = nil)
|
||||
return if hasActiveAbility?(:INNERFOCUS) && !beingMoldBroken?
|
||||
@effects[PBEffects::Flinch] = true
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Increase stat stages
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Increase stat stages.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def statStageAtMax?(stat)
|
||||
return @stages[stat] >= STAT_STAGE_MAXIMUM
|
||||
end
|
||||
@@ -113,9 +117,10 @@ class Battle::Battler
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Decrease stat stages
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Decrease stat stages.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def statStageAtMin?(stat)
|
||||
return @stages[stat] <= -STAT_STAGE_MAXIMUM
|
||||
end
|
||||
@@ -364,9 +369,10 @@ class Battle::Battler
|
||||
return pbLowerStatStageByCause(:ATTACK, 1, user, user.abilityName)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Reset stat stages
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Reset stat stages.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def hasAlteredStatStages?
|
||||
GameData::Stat.each_battle { |s| return true if @stages[s.id] != 0 }
|
||||
return false
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Ability trigger checks
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Ability trigger checks.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbAbilitiesOnSwitchOut
|
||||
if abilityActive?
|
||||
Battle::AbilityEffects.triggerOnSwitchOut(self.ability, self, false)
|
||||
@@ -98,9 +102,10 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Ability curing
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Ability curing.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Cures status conditions, confusion and infatuation.
|
||||
def pbAbilityStatusCureCheck
|
||||
if abilityActive?
|
||||
@@ -108,9 +113,10 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Ability effects
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Ability effects.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# For abilities that grant immunity to moves of a particular type, and raises
|
||||
# one of the ability's bearer's stats instead.
|
||||
def pbMoveImmunityStatRaisingAbility(user, move, moveType, immuneType, stat, increment, show_message)
|
||||
@@ -165,9 +171,10 @@ class Battle::Battler
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Ability change
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Ability change.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbOnLosingAbility(oldAbil, suppressed = false)
|
||||
if oldAbil == :NEUTRALIZINGGAS && (suppressed || !@effects[PBEffects::GastroAcid])
|
||||
pbAbilitiesOnNeutralizingGasEnding
|
||||
@@ -206,9 +213,10 @@ class Battle::Battler
|
||||
@battle.pbEndPrimordialWeather
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Held item consuming/removing
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Held item consuming/removing.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def canConsumeBerry?
|
||||
return false if @battle.pbCheckOpposingAbility([:UNNERVE, :ASONECHILLINGNEIGH, :ASONEGRIMNEIGH], @index)
|
||||
return true
|
||||
@@ -285,9 +293,10 @@ class Battle::Battler
|
||||
pbSymbiosis if !own_item && !fling # Bug Bite/Pluck users trigger Symbiosis
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Held item trigger checks
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Held item trigger checks.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# NOTE: A Pokémon using Bug Bite/Pluck, and a Pokémon having an item thrown at
|
||||
# it via Fling, will gain the effect of the item even if the Pokémon is
|
||||
# affected by item-negating effects.
|
||||
@@ -393,9 +402,10 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Item effects
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Item effects.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbConfusionBerry(item_to_use, forced, confuse_stat, confuse_msg)
|
||||
return false if !forced && !canHeal?
|
||||
return false if !forced && !canConsumePinchBerry?(Settings::MECHANICS_GENERATION >= 7)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Turn processing
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Turn processing.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbProcessTurn(choice, tryFlee = true)
|
||||
return false if fainted?
|
||||
# Wild roaming Pokémon always flee if possible
|
||||
@@ -55,9 +59,10 @@ class Battle::Battler
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbBeginTurn(_choice)
|
||||
# Cancel some lingering effects which only apply until the user next moves
|
||||
@effects[PBEffects::DestinyBondPrevious] = @effects[PBEffects::DestinyBond]
|
||||
@@ -131,10 +136,11 @@ class Battle::Battler
|
||||
pbItemHPHealCheck
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Simple "use move" method, used when a move calls another move and for Future
|
||||
# Sight's attack
|
||||
#=============================================================================
|
||||
# Sight's attack.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbUseMoveSimple(moveID, target = -1, idxMove = -1, specialUsage = true)
|
||||
choice = []
|
||||
choice[0] = :UseMove # "Use move"
|
||||
@@ -150,9 +156,10 @@ class Battle::Battler
|
||||
pbUseMove(choice, specialUsage)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Master "use move" method
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Master "use move" method.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbUseMove(choice, specialUsage = false)
|
||||
# NOTE: This is intentionally determined before a multi-turn attack can
|
||||
# set specialUsage to true.
|
||||
@@ -582,9 +589,10 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Attack a single target
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Attack a single target.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbProcessMoveHit(move, user, targets, hitNum, skipAccuracyCheck)
|
||||
return false if user.fainted?
|
||||
# For two-turn attacks being used in a single turn
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Get move's user
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Get move's user.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbFindUser(_choice, _move)
|
||||
return self
|
||||
end
|
||||
@@ -30,9 +34,10 @@ class Battle::Battler
|
||||
return user
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Get move's default target(s)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Get move's default target(s).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbFindTargets(choice, move, user)
|
||||
preTarget = choice[3] # A target that was already chosen
|
||||
targets = []
|
||||
@@ -90,9 +95,10 @@ class Battle::Battler
|
||||
return targets
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Redirect attack to another target
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Redirect attack to another target.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbChangeTargets(move, user, targets)
|
||||
target_data = move.pbTarget(user)
|
||||
return targets if @battle.switching # For Pursuit interrupting a switch
|
||||
@@ -167,9 +173,10 @@ class Battle::Battler
|
||||
return targets
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Register target
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Register target.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbAddTarget(targets, user, target, move, nearOnly = true, allowUser = false)
|
||||
return false if !target || (target.fainted? && !move.targetsPosition?)
|
||||
return false if !allowUser && target == user
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Decide whether the trainer is allowed to tell the Pokémon to use the given
|
||||
# move. Called when choosing a command for the round.
|
||||
# Also called when processing the Pokémon's action, because these effects also
|
||||
# prevent Pokémon action. Relevant because these effects can become active
|
||||
# earlier in the same round (after choosing the command but before using the
|
||||
# move) or an unusable move may be called by another move such as Metronome.
|
||||
#=============================================================================
|
||||
def pbCanChooseMove?(move, commandPhase, showMessages = true, specialUsage = false)
|
||||
# Disable
|
||||
if @effects[PBEffects::DisableMove] == move.id && !specialUsage
|
||||
@@ -99,9 +100,9 @@ class Battle::Battler
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Obedience check
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Obedience check.
|
||||
# Return true if Pokémon continues attacking (although it may have chosen to
|
||||
# use a different move in disobedience), or false if attack stops.
|
||||
def pbObedienceCheck?(choice)
|
||||
@@ -175,11 +176,11 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Check whether the user (self) is able to take action at all.
|
||||
# If this returns true, and if PP isn't a problem, the move will be considered
|
||||
# to have been used (even if it then fails for whatever reason).
|
||||
#=============================================================================
|
||||
def pbTryUseMove(choice, move, specialUsage, skipAccuracyCheck)
|
||||
# Check whether it's possible for self to use the given move
|
||||
# NOTE: Encore has already changed the move being used, no need to have a
|
||||
@@ -296,10 +297,10 @@ class Battle::Battler
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Initial success check against the target. Done once before the first hit.
|
||||
# Includes move-specific failure conditions, protections and type immunities.
|
||||
#=============================================================================
|
||||
def pbSuccessCheckAgainstTarget(move, user, target, targets)
|
||||
show_message = move.pbShowFailMessages?(targets)
|
||||
typeMod = move.pbCalcTypeMod(move.calcType, user, target)
|
||||
@@ -595,10 +596,10 @@ class Battle::Battler
|
||||
return true
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Per-hit success check against the target.
|
||||
# Includes semi-invulnerable move use and accuracy calculation.
|
||||
#=============================================================================
|
||||
def pbSuccessCheckPerHit(move, user, target, skipAccuracyCheck)
|
||||
# Two-turn attacks can't fail here in the charging turn
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]
|
||||
@@ -617,9 +618,9 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Message shown when a move fails the per-hit success check above.
|
||||
#=============================================================================
|
||||
def pbMissMessage(move, user, target)
|
||||
if target.damageState.affection_missed
|
||||
@battle.pbDisplay(_INTL("{1} avoided the move in time with your shout!", target.pbThis))
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Battler
|
||||
#=============================================================================
|
||||
# Effect per hit
|
||||
#=============================================================================
|
||||
# Effect per hit.
|
||||
def pbEffectsOnMakingHit(move, user, target)
|
||||
if target.damageState.calcDamage > 0 && !target.damageState.substitute
|
||||
# Target's ability
|
||||
@@ -82,9 +83,7 @@ class Battle::Battler
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Effects after all hits (i.e. at end of move usage)
|
||||
#=============================================================================
|
||||
# Effects after all hits (i.e. at end of move usage).
|
||||
def pbEffectsAfterMove(user, targets, move, numHits)
|
||||
# Defrost
|
||||
if move.damagingMove?
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Move
|
||||
attr_reader :battle
|
||||
attr_reader :realMove
|
||||
@@ -28,9 +31,10 @@ class Battle::Move
|
||||
return @power
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Creating a move
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Creating a move.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def initialize(battle, move)
|
||||
@battle = battle
|
||||
@realMove = move
|
||||
@@ -68,9 +72,10 @@ class Battle::Move
|
||||
return Battle::Move::Unimplemented.new(battle, move)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# About the move
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# About the move.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbTarget(_user); return GameData::Target.get(@target); end
|
||||
|
||||
def total_pp
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Move
|
||||
#=============================================================================
|
||||
# Effect methods per move usage
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Effect methods per move usage.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCanChooseMove?(user, commandPhase, showMessages); return true; end # For Belch
|
||||
def pbDisplayChargeMessage(user); end # For Focus Punch/shell Trap/Beak Blast
|
||||
def pbOnStartUse(user, targets); end
|
||||
@@ -24,9 +28,10 @@ class Battle::Move
|
||||
def pbShowFailMessages?(targets); return true; end
|
||||
def pbMissMessage(user, target); return false; end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Whether the move is currently in the "charging" turn of a two-turn move.
|
||||
# Is false if Power Herb or another effect lets a two-turn move charge and
|
||||
# attack in the same turn.
|
||||
@@ -56,9 +61,10 @@ class Battle::Move
|
||||
# For two-turn moves when they charge and attack in the same turn.
|
||||
def pbQuickChargingMove(user, targets); end
|
||||
|
||||
#=============================================================================
|
||||
# Effect methods per hit
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Effect methods per hit.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbOverrideSuccessCheckPerHit(user, target); return false; end
|
||||
def pbCrashDamage(user); end
|
||||
def pbInitialEffect(user, targets, hitNum); end
|
||||
@@ -83,9 +89,10 @@ class Battle::Move
|
||||
def pbSwitchOutTargetEffect(user, targets, numHits, switched_battlers); end
|
||||
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers); end
|
||||
|
||||
#=============================================================================
|
||||
# Check if target is immune to the move because of its ability
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check if target is immune to the move because of its ability.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbImmunityByAbility(user, target, show_message)
|
||||
ret = false
|
||||
if target.abilityActive? && !target.beingMoldBroken?
|
||||
@@ -95,9 +102,10 @@ class Battle::Move
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Move failure checks
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Move failure checks.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Check whether the move fails completely due to move-specific requirements.
|
||||
def pbMoveFailed?(user, targets); return false; end
|
||||
# Checks whether the move will be ineffective against the target.
|
||||
@@ -156,9 +164,10 @@ class Battle::Move
|
||||
return false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Weaken the damage dealt (doesn't actually change a battler's HP)
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Weaken the damage dealt (doesn't actually change a battler's HP).
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCheckDamageAbsorption(user, target)
|
||||
# Substitute will take the damage
|
||||
if target.effects[PBEffects::Substitute] > 0 && !ignoresSubstitute?(user) &&
|
||||
@@ -225,9 +234,10 @@ class Battle::Move
|
||||
target.damageState.totalHPLost += damage
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Change the target's HP by the amount calculated above
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Change the target's HP by the amount calculated above.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbInflictHPDamage(target)
|
||||
if target.damageState.substitute
|
||||
target.effects[PBEffects::Substitute] -= target.damageState.hpLost
|
||||
@@ -236,9 +246,10 @@ class Battle::Move
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Animate the damage dealt, including lowering the HP
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Animate the damage dealt, including lowering the HP.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Animate being damaged and losing HP (by a move)
|
||||
def pbAnimateHitAndHPLost(user, targets)
|
||||
# Animate allies first, then foes
|
||||
@@ -269,9 +280,10 @@ class Battle::Move
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Messages upon being hit
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Messages upon being hit.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbEffectivenessMessage(user, target, numTargets = 1)
|
||||
return if self.is_a?(Battle::Move::FixedDamageMove)
|
||||
return if target.damageState.disguise || target.damageState.iceFace
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class Battle::Move
|
||||
#=============================================================================
|
||||
# Move's type calculation
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Move's type calculation.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbBaseType(user)
|
||||
ret = @type
|
||||
if ret && user.abilityActive?
|
||||
@@ -26,9 +30,10 @@ class Battle::Move
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Type effectiveness calculation
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Type effectiveness calculation.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbCalcTypeModSingle(moveType, defType, user, target)
|
||||
ret = Effectiveness.calculate(moveType, defType)
|
||||
if Effectiveness.ineffective_type?(moveType, defType)
|
||||
@@ -78,9 +83,10 @@ class Battle::Move
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Accuracy check
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Accuracy check.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbBaseAccuracy(user, target); return @accuracy; end
|
||||
|
||||
# Accuracy calculations for one-hit KO moves are handled elsewhere.
|
||||
@@ -166,9 +172,10 @@ class Battle::Move
|
||||
modifiers[:evasion_stage] = 0 if user.hasActiveAbility?(:MINDSEYE)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Critical hit check
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Critical hit check.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Return values:
|
||||
# -1: Never a critical hit.
|
||||
# 0: Calculate normally.
|
||||
@@ -220,9 +227,10 @@ class Battle::Move
|
||||
return false
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Damage calculation
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Damage calculation.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbBaseDamage(baseDmg, user, target); return baseDmg; end
|
||||
def pbBaseDamageMultiplier(damageMult, user, target); return damageMult; end
|
||||
def pbModifyDamage(damageMult, user, target); return damageMult; end
|
||||
@@ -505,9 +513,10 @@ class Battle::Move
|
||||
multipliers[:final_damage_multiplier] = pbModifyDamage(multipliers[:final_damage_multiplier], user, target)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Additional effect chance
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Additional effect chance.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbAdditionalEffectChance(user, target, effectChance = 0)
|
||||
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !target.beingMoldBroken?
|
||||
ret = (effectChance > 0) ? effectChance : @addlEffect
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#===============================================================================
|
||||
# Battle scene (the visuals of the battle)
|
||||
#===============================================================================
|
||||
class Battle::Scene
|
||||
attr_accessor :abortable # For non-interactive battles, can quit immediately
|
||||
attr_reader :viewport
|
||||
@@ -73,9 +75,10 @@ class Battle::Scene
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Updating and refreshing
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Updating and refreshing.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbUpdate(cw = nil)
|
||||
pbGraphicsUpdate
|
||||
pbInputUpdate
|
||||
@@ -139,17 +142,19 @@ class Battle::Scene
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Party lineup
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Party lineup.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# Returns whether the party line-ups are currently coming on-screen
|
||||
def inPartyAnimation?
|
||||
return @animations.length > 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Window displays
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Window displays.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbShowWindow(windowType)
|
||||
# NOTE: If you are not using fancy graphics for the command/fight menus, you
|
||||
# will need to make "messageBox" also visible if the windowtype if
|
||||
@@ -307,9 +312,10 @@ class Battle::Scene
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Sprites
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Sprites.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbAddSprite(id, x, y, filename, viewport)
|
||||
sprite = @sprites[id] || IconSprite.new(x, y, viewport)
|
||||
if filename
|
||||
@@ -348,9 +354,10 @@ class Battle::Scene
|
||||
pbRefresh
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Phases
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
# Phases.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbBeginCommandPhase
|
||||
@sprites["messageWindow"].text = ""
|
||||
end
|
||||
@@ -371,9 +378,10 @@ class Battle::Scene
|
||||
pbDisposeSprites
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pbSelectBattler(idxBattler, selectMode = 1)
|
||||
numWindows = @battle.sideSizes.max * 2
|
||||
numWindows.times do |i|
|
||||
@@ -401,9 +409,10 @@ class Battle::Scene
|
||||
@lastMove[idxBattler] = 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
#=============================================================================
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# This method is called when the player wins a wild Pokémon battle.
|
||||
# This method can change the battle's music for example.
|
||||
def pbWildBattleSuccess
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user