mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
6.6 update
This commit is contained in:
107
Data/Scripts/010_Data/002_PBS data/001_MiscPBSData.rb
Normal file
107
Data/Scripts/010_Data/002_PBS data/001_MiscPBSData.rb
Normal file
@@ -0,0 +1,107 @@
|
||||
#===============================================================================
|
||||
# Data caches.
|
||||
#===============================================================================
|
||||
class PokemonTemp
|
||||
attr_accessor :townMapData
|
||||
attr_accessor :phoneData
|
||||
attr_accessor :speciesShadowMovesets
|
||||
attr_accessor :regionalDexes
|
||||
attr_accessor :battleAnims
|
||||
attr_accessor :moveToAnim
|
||||
attr_accessor :mapInfos
|
||||
end
|
||||
|
||||
def pbClearData
|
||||
if $PokemonTemp
|
||||
$PokemonTemp.townMapData = nil
|
||||
$PokemonTemp.phoneData = nil
|
||||
$PokemonTemp.speciesShadowMovesets = nil
|
||||
$PokemonTemp.regionalDexes = nil
|
||||
$PokemonTemp.battleAnims = nil
|
||||
$PokemonTemp.moveToAnim = nil
|
||||
$PokemonTemp.mapInfos = nil
|
||||
end
|
||||
MapFactoryHelper.clear
|
||||
$PokemonEncounters.setup($game_map.map_id) if $game_map && $PokemonEncounters
|
||||
if pbRgssExists?("Data/Tilesets.rxdata")
|
||||
$data_tilesets = load_data("Data/Tilesets.rxdata")
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Town Map data.
|
||||
#===============================================================================
|
||||
def pbLoadTownMapData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.townMapData
|
||||
$PokemonTemp.townMapData = load_data("Data/town_map.dat")
|
||||
end
|
||||
return $PokemonTemp.townMapData
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get phone call data.
|
||||
#===============================================================================
|
||||
def pbLoadPhoneData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.phoneData
|
||||
if pbRgssExists?("Data/phone.dat")
|
||||
$PokemonTemp.phoneData = load_data("Data/phone.dat")
|
||||
end
|
||||
end
|
||||
return $PokemonTemp.phoneData
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Shadow Pokémon moveset data.
|
||||
#===============================================================================
|
||||
def pbLoadShadowMovesets
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesShadowMovesets
|
||||
$PokemonTemp.speciesShadowMovesets = load_data("Data/shadow_movesets.dat") || []
|
||||
end
|
||||
return $PokemonTemp.speciesShadowMovesets
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Regional Dexes data.
|
||||
#===============================================================================
|
||||
def pbLoadRegionalDexes
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.regionalDexes
|
||||
$PokemonTemp.regionalDexes = load_data("Data/regional_dexes.dat")
|
||||
end
|
||||
return $PokemonTemp.regionalDexes
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Methods relating to battle animations data.
|
||||
#===============================================================================
|
||||
def pbLoadBattleAnimations
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.battleAnims
|
||||
if pbRgssExists?("Data/PkmnAnimations.rxdata")
|
||||
$PokemonTemp.battleAnims = load_data("Data/PkmnAnimations.rxdata")
|
||||
end
|
||||
end
|
||||
return $PokemonTemp.battleAnims
|
||||
end
|
||||
|
||||
def pbLoadMoveToAnim
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.moveToAnim
|
||||
$PokemonTemp.moveToAnim = load_data("Data/move2anim.dat") || []
|
||||
end
|
||||
return $PokemonTemp.moveToAnim
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method relating to map infos data.
|
||||
#===============================================================================
|
||||
def pbLoadMapInfos
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.mapInfos
|
||||
$PokemonTemp.mapInfos = load_data("Data/MapInfos.rxdata")
|
||||
end
|
||||
return $PokemonTemp.mapInfos
|
||||
end
|
||||
31
Data/Scripts/010_Data/002_PBS data/002_PhoneDatabase.rb
Normal file
31
Data/Scripts/010_Data/002_PBS data/002_PhoneDatabase.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
#===============================================================================
|
||||
# Phone data
|
||||
#===============================================================================
|
||||
class PhoneDatabase
|
||||
attr_accessor :generics
|
||||
attr_accessor :greetings
|
||||
attr_accessor :greetingsMorning
|
||||
attr_accessor :greetingsEvening
|
||||
attr_accessor :bodies1
|
||||
attr_accessor :bodies2
|
||||
attr_accessor :battleRequests
|
||||
attr_accessor :trainers
|
||||
|
||||
def initialize
|
||||
@generics = []
|
||||
@greetings = []
|
||||
@greetingsMorning = []
|
||||
@greetingsEvening = []
|
||||
@bodies1 = []
|
||||
@bodies2 = []
|
||||
@battleRequests = []
|
||||
@trainers = []
|
||||
end
|
||||
end
|
||||
|
||||
module PhoneMsgType
|
||||
Generic = 0
|
||||
Greeting = 1
|
||||
Body = 2
|
||||
BattleRequest = 3
|
||||
end
|
||||
132
Data/Scripts/010_Data/002_PBS data/003_Type.rb
Normal file
132
Data/Scripts/010_Data/002_PBS data/003_Type.rb
Normal file
@@ -0,0 +1,132 @@
|
||||
module GameData
|
||||
class Type
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :special_type
|
||||
attr_reader :pseudo_type
|
||||
attr_reader :weaknesses
|
||||
attr_reader :resistances
|
||||
attr_reader :immunities
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "types.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Name" => [1, "s"],
|
||||
"InternalName" => [2, "s"],
|
||||
"IsPseudoType" => [3, "b"],
|
||||
"IsSpecialType" => [4, "b"],
|
||||
"Weaknesses" => [5, "*s"],
|
||||
"Resistances" => [6, "*s"],
|
||||
"Immunities" => [7, "*s"]
|
||||
}
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@pseudo_type = hash[:pseudo_type] || false
|
||||
@special_type = hash[:special_type] || false
|
||||
@weaknesses = hash[:weaknesses] || []
|
||||
@weaknesses = [@weaknesses] if !@weaknesses.is_a?(Array)
|
||||
@resistances = hash[:resistances] || []
|
||||
@resistances = [@resistances] if !@resistances.is_a?(Array)
|
||||
@immunities = hash[:immunities] || []
|
||||
@immunities = [@immunities] if !@immunities.is_a?(Array)
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this item
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Types, @id_number)
|
||||
end
|
||||
|
||||
def physical?; return !@special_type; end
|
||||
def special?; return @special_type; end
|
||||
|
||||
def effectiveness(other_type)
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE if !other_type
|
||||
return Effectiveness::SUPER_EFFECTIVE_ONE if @weaknesses.include?(other_type)
|
||||
return Effectiveness::NOT_VERY_EFFECTIVE_ONE if @resistances.include?(other_type)
|
||||
return Effectiveness::INEFFECTIVE if @immunities.include?(other_type)
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
module Effectiveness
|
||||
INEFFECTIVE = 0
|
||||
NOT_VERY_EFFECTIVE_ONE = 1
|
||||
NORMAL_EFFECTIVE_ONE = 2
|
||||
SUPER_EFFECTIVE_ONE = 4
|
||||
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE ** 3
|
||||
|
||||
module_function
|
||||
|
||||
def ineffective?(value)
|
||||
return value == INEFFECTIVE
|
||||
end
|
||||
|
||||
def not_very_effective?(value)
|
||||
return value > INEFFECTIVE && value < NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def resistant?(value)
|
||||
return value < NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def normal?(value)
|
||||
return value == NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def super_effective?(value)
|
||||
return value > NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def ineffective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
return ineffective?(value)
|
||||
end
|
||||
|
||||
def not_very_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
return not_very_effective?(value)
|
||||
end
|
||||
|
||||
def resistant_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
return resistant?(value)
|
||||
end
|
||||
|
||||
def normal_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
return normal?(value)
|
||||
end
|
||||
|
||||
def super_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
return super_effective?(value)
|
||||
end
|
||||
|
||||
def calculate_one(attack_type, defend_type)
|
||||
return GameData::Type.get(defend_type).effectiveness(attack_type)
|
||||
end
|
||||
|
||||
def calculate(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
mod1 = calculate_one(attack_type, defend_type1)
|
||||
mod2 = NORMAL_EFFECTIVE_ONE
|
||||
mod3 = NORMAL_EFFECTIVE_ONE
|
||||
if defend_type2 && defend_type1 != defend_type2
|
||||
mod2 = calculate_one(attack_type, defend_type2)
|
||||
end
|
||||
if defend_type3 && defend_type1 != defend_type3 && defend_type2 != defend_type3
|
||||
mod3 = calculate_one(attack_type, defend_type3)
|
||||
end
|
||||
return mod1 * mod2 * mod3
|
||||
end
|
||||
end
|
||||
31
Data/Scripts/010_Data/002_PBS data/004_Ability.rb
Normal file
31
Data/Scripts/010_Data/002_PBS data/004_Ability.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
module GameData
|
||||
class Ability
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :real_description
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "abilities.dat"
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@real_description = hash[:description] || "???"
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this ability
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Abilities, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this ability
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::AbilityDescs, @id_number)
|
||||
end
|
||||
end
|
||||
end
|
||||
85
Data/Scripts/010_Data/002_PBS data/005_Move.rb
Normal file
85
Data/Scripts/010_Data/002_PBS data/005_Move.rb
Normal file
@@ -0,0 +1,85 @@
|
||||
module GameData
|
||||
class Move
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :function_code
|
||||
attr_reader :base_damage
|
||||
attr_reader :type
|
||||
attr_reader :category
|
||||
attr_reader :accuracy
|
||||
attr_reader :total_pp
|
||||
attr_reader :effect_chance
|
||||
attr_reader :target
|
||||
attr_reader :priority
|
||||
attr_reader :flags
|
||||
attr_reader :real_description
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "moves.dat"
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@function_code = hash[:function_code]
|
||||
@base_damage = hash[:base_damage]
|
||||
@type = hash[:type]
|
||||
@category = hash[:category]
|
||||
@accuracy = hash[:accuracy]
|
||||
@total_pp = hash[:total_pp]
|
||||
@effect_chance = hash[:effect_chance]
|
||||
@target = hash[:target]
|
||||
@priority = hash[:priority]
|
||||
@flags = hash[:flags]
|
||||
@real_description = hash[:description] || "???"
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this move
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Moves, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this move
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::MoveDescriptions, @id_number)
|
||||
end
|
||||
|
||||
def physical?
|
||||
return false if @base_damage == 0
|
||||
return @category == 0 if Settings::MOVE_CATEGORY_PER_MOVE
|
||||
return GameData::Type.get(@type).physical?
|
||||
end
|
||||
|
||||
def special?
|
||||
return false if @base_damage == 0
|
||||
return @category == 1 if Settings::MOVE_CATEGORY_PER_MOVE
|
||||
return GameData::Type.get(@type).special?
|
||||
end
|
||||
|
||||
def hidden_move?
|
||||
GameData::Item.each do |i|
|
||||
return true if i.is_HM? && i.move == @id
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetMoveData(move_id, move_data_type = -1)
|
||||
Deprecation.warn_method('pbGetMoveData', 'v20', 'GameData::Move.get(move_id)')
|
||||
return GameData::Move.get(move_id)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsHiddenMove?(move)
|
||||
Deprecation.warn_method('pbIsHiddenMove?', 'v20', 'GameData::Move.get(move).hidden_move?')
|
||||
return GameData::Move.get(move).hidden_move?
|
||||
end
|
||||
324
Data/Scripts/010_Data/002_PBS data/006_Item.rb
Normal file
324
Data/Scripts/010_Data/002_PBS data/006_Item.rb
Normal file
@@ -0,0 +1,324 @@
|
||||
module GameData
|
||||
class Item
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :real_name_plural
|
||||
attr_reader :pocket
|
||||
attr_reader :price
|
||||
attr_reader :real_description
|
||||
attr_reader :field_use
|
||||
attr_reader :battle_use
|
||||
attr_reader :type
|
||||
attr_reader :move
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "items.dat"
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def self.icon_filename(item)
|
||||
return "Graphics/Items/back" if item.nil?
|
||||
item_data = self.try_get(item)
|
||||
return "Graphics/Items/000" if item_data.nil?
|
||||
# Check for files
|
||||
ret = sprintf("Graphics/Items/%s", item_data.id)
|
||||
return ret if pbResolveBitmap(ret)
|
||||
# Check for TM/HM type icons
|
||||
if item_data.is_machine?
|
||||
prefix = "machine"
|
||||
if item_data.is_HM?
|
||||
prefix = "machine_hm"
|
||||
elsif item_data.is_TR?
|
||||
prefix = "machine_tr"
|
||||
end
|
||||
move_type = GameData::Move.get(item_data.move).type
|
||||
type_data = GameData::Type.get(move_type)
|
||||
ret = sprintf("Graphics/Items/%s_%s", prefix, type_data.id)
|
||||
return ret if pbResolveBitmap(ret)
|
||||
if !item_data.is_TM?
|
||||
ret = sprintf("Graphics/Items/machine_%s", type_data.id)
|
||||
return ret if pbResolveBitmap(ret)
|
||||
end
|
||||
end
|
||||
return "Graphics/Items/000"
|
||||
end
|
||||
|
||||
def self.list_all()
|
||||
return self::DATA
|
||||
end
|
||||
|
||||
def self.held_icon_filename(item)
|
||||
item_data = self.try_get(item)
|
||||
return nil if !item_data
|
||||
name_base = (item_data.is_mail?) ? "mail" : "item"
|
||||
# Check for files
|
||||
ret = sprintf("Graphics/Pictures/Party/icon_%s_%s", name_base, item_data.id)
|
||||
return ret if pbResolveBitmap(ret)
|
||||
return sprintf("Graphics/Pictures/Party/icon_%s", name_base)
|
||||
end
|
||||
|
||||
def self.mail_filename(item)
|
||||
item_data = self.try_get(item)
|
||||
return nil if !item_data
|
||||
# Check for files
|
||||
ret = sprintf("Graphics/Pictures/Mail/mail_%s", item_data.id)
|
||||
return pbResolveBitmap(ret) ? ret : nil
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@real_name_plural = hash[:name_plural] || "Unnamed"
|
||||
@pocket = hash[:pocket] || 1
|
||||
@price = hash[:price] || 0
|
||||
@real_description = hash[:description] || "???"
|
||||
@field_use = hash[:field_use] || 0
|
||||
@battle_use = hash[:battle_use] || 0
|
||||
@type = hash[:type] || 0
|
||||
@move = hash[:move]
|
||||
end
|
||||
|
||||
|
||||
|
||||
# @return [String] the translated name of this item
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Items, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated plural version of the name of this item
|
||||
def name_plural
|
||||
return pbGetMessage(MessageTypes::ItemPlurals, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this item
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::ItemDescriptions, @id_number)
|
||||
end
|
||||
|
||||
def has_battle_use?
|
||||
return @battle_use != 0
|
||||
end
|
||||
def is_TM?; return @field_use == 3; end
|
||||
def is_HM?; return @field_use == 4; end
|
||||
def is_TR?; return @field_use == 6; end
|
||||
def is_machine?; return is_TM? || is_HM? || is_TR?; end
|
||||
def is_mail?; return @type == 1 || @type == 2; end
|
||||
def is_icon_mail?; return @type == 2; end
|
||||
def is_poke_ball?; return @type == 3 || @type == 4; end
|
||||
def is_snag_ball?; return @type == 3 || (@type == 4 && $Trainer.has_snag_machine); end
|
||||
def is_berry?; return @type == 5; end
|
||||
def is_key_item?; return @type == 6; end
|
||||
def is_evolution_stone?; return @type == 7; end
|
||||
def is_fossil?; return @type == 8; end
|
||||
def is_apricorn?; return @type == 9; end
|
||||
def is_gem?; return @type == 10; end
|
||||
def is_mulch?; return @type == 11; end
|
||||
def is_mega_stone?; return @type == 12; end # Does NOT include Red Orb/Blue Orb
|
||||
|
||||
UNTOSSABLE_ITEMS =[:PINKANBERRY,:DYNAMITE, :TM00]
|
||||
def is_important?
|
||||
return true if is_key_item? || is_HM? || is_TM?
|
||||
return true if UNTOSSABLE_ITEMS.include?(@id)
|
||||
return false
|
||||
end
|
||||
|
||||
def can_hold?; return !is_important?; end
|
||||
|
||||
def unlosable?(species, ability)
|
||||
return true if $game_switches[SWITCH_RANDOM_HELD_ITEMS]
|
||||
return false if species == :ARCEUS && ability != :MULTITYPE
|
||||
return false if species == :SILVALLY && ability != :RKSSYSTEM
|
||||
combos = {
|
||||
:ARCEUS => [:FISTPLATE, :FIGHTINIUMZ,
|
||||
:SKYPLATE, :FLYINIUMZ,
|
||||
:TOXICPLATE, :POISONIUMZ,
|
||||
:EARTHPLATE, :GROUNDIUMZ,
|
||||
:STONEPLATE, :ROCKIUMZ,
|
||||
:INSECTPLATE, :BUGINIUMZ,
|
||||
:SPOOKYPLATE, :GHOSTIUMZ,
|
||||
:IRONPLATE, :STEELIUMZ,
|
||||
:FLAMEPLATE, :FIRIUMZ,
|
||||
:SPLASHPLATE, :WATERIUMZ,
|
||||
:MEADOWPLATE, :GRASSIUMZ,
|
||||
:ZAPPLATE, :ELECTRIUMZ,
|
||||
:MINDPLATE, :PSYCHIUMZ,
|
||||
:ICICLEPLATE, :ICIUMZ,
|
||||
:DRACOPLATE, :DRAGONIUMZ,
|
||||
:DREADPLATE, :DARKINIUMZ,
|
||||
:PIXIEPLATE, :FAIRIUMZ],
|
||||
:SILVALLY => [:FIGHTINGMEMORY,
|
||||
:FLYINGMEMORY,
|
||||
:POISONMEMORY,
|
||||
:GROUNDMEMORY,
|
||||
:ROCKMEMORY,
|
||||
:BUGMEMORY,
|
||||
:GHOSTMEMORY,
|
||||
:STEELMEMORY,
|
||||
:FIREMEMORY,
|
||||
:WATERMEMORY,
|
||||
:GRASSMEMORY,
|
||||
:ELECTRICMEMORY,
|
||||
:PSYCHICMEMORY,
|
||||
:ICEMEMORY,
|
||||
:DRAGONMEMORY,
|
||||
:DARKMEMORY,
|
||||
:FAIRYMEMORY],
|
||||
:GIRATINA => [:GRISEOUSORB],
|
||||
:GENESECT => [:BURNDRIVE, :CHILLDRIVE, :DOUSEDRIVE, :SHOCKDRIVE],
|
||||
:KYOGRE => [:BLUEORB],
|
||||
:GROUDON => [:REDORB]
|
||||
}
|
||||
return combos[species] && combos[species].include?(@id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetPocket(item)
|
||||
Deprecation.warn_method('pbGetPocket', 'v20', 'GameData::Item.get(item).pocket')
|
||||
return GameData::Item.get(item).pocket
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetPrice(item)
|
||||
Deprecation.warn_method('pbGetPrice', 'v20', 'GameData::Item.get(item).price')
|
||||
return GameData::Item.get(item).price
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetMachine(item)
|
||||
Deprecation.warn_method('pbGetMachine', 'v20', 'GameData::Item.get(item).move')
|
||||
return GameData::Item.get(item).move
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsTechnicalMachine?(item)
|
||||
Deprecation.warn_method('pbIsTechnicalMachine?', 'v20', 'GameData::Item.get(item).is_TM?')
|
||||
return GameData::Item.get(item).is_TM?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsHiddenMachine?(item)
|
||||
Deprecation.warn_method('pbIsHiddenMachine?', 'v20', 'GameData::Item.get(item).is_HM?')
|
||||
return GameData::Item.get(item).is_HM?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsMachine?(item)
|
||||
Deprecation.warn_method('pbIsMachine?', 'v20', 'GameData::Item.get(item).is_machine?')
|
||||
return GameData::Item.get(item).is_machine?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsMail?(item)
|
||||
Deprecation.warn_method('pbIsMail?', 'v20', 'GameData::Item.get(item).is_mail?')
|
||||
return GameData::Item.get(item).is_mail?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsMailWithPokemonIcons?(item)
|
||||
Deprecation.warn_method('pbIsMailWithPokemonIcons?', 'v20', 'GameData::Item.get(item).is_icon_mail?')
|
||||
return GameData::Item.get(item).is_icon_mail?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsPokeBall?(item)
|
||||
Deprecation.warn_method('pbIsPokeBall?', 'v20', 'GameData::Item.get(item).is_poke_ball?')
|
||||
return GameData::Item.get(item).is_poke_ball?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsSnagBall?(item)
|
||||
Deprecation.warn_method('pbIsSnagBall?', 'v20', 'GameData::Item.get(item).is_snag_ball?')
|
||||
return GameData::Item.get(item).is_snag_ball?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsBerry?(item)
|
||||
Deprecation.warn_method('pbIsBerry?', 'v20', 'GameData::Item.get(item).is_berry?')
|
||||
return GameData::Item.get(item).is_berry?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsKeyItem?(item)
|
||||
Deprecation.warn_method('pbIsKeyItem?', 'v20', 'GameData::Item.get(item).is_key_item?')
|
||||
return GameData::Item.get(item).is_key_item?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsEvolutionStone?(item)
|
||||
Deprecation.warn_method('pbIsEvolutionStone?', 'v20', 'GameData::Item.get(item).is_evolution_stone?')
|
||||
return GameData::Item.get(item).is_evolution_stone?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsFossil?(item)
|
||||
Deprecation.warn_method('pbIsFossil?', 'v20', 'GameData::Item.get(item).is_fossil?')
|
||||
return GameData::Item.get(item).is_fossil?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsApricorn?(item)
|
||||
Deprecation.warn_method('pbIsApricorn?', 'v20', 'GameData::Item.get(item).is_apricorn?')
|
||||
return GameData::Item.get(item).is_apricorn?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsGem?(item)
|
||||
Deprecation.warn_method('pbIsGem?', 'v20', 'GameData::Item.get(item).is_gem?')
|
||||
return GameData::Item.get(item).is_gem?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsMulch?(item)
|
||||
Deprecation.warn_method('pbIsMulch?', 'v20', 'GameData::Item.get(item).is_mulch?')
|
||||
return GameData::Item.get(item).is_mulch?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsMegaStone?(item)
|
||||
Deprecation.warn_method('pbIsMegaStone?', 'v20', 'GameData::Item.get(item).is_mega_stone?')
|
||||
return GameData::Item.get(item).is_mega_stone?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsImportantItem?(item)
|
||||
Deprecation.warn_method('pbIsImportantItem?', 'v20', 'GameData::Item.get(item).is_important?')
|
||||
return GameData::Item.get(item).is_important?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbCanHoldItem?(item)
|
||||
Deprecation.warn_method('pbCanHoldItem?', 'v20', 'GameData::Item.get(item).can_hold?')
|
||||
return GameData::Item.get(item).can_hold?
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbIsUnlosableItem?(check_item, species, ability)
|
||||
Deprecation.warn_method('pbIsUnlosableItem?', 'v20', 'GameData::Item.get(item).unlosable?')
|
||||
return GameData::Item.get(check_item).unlosable?(species, ability)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbItemIconFile(item)
|
||||
Deprecation.warn_method('pbItemIconFile', 'v20', 'GameData::Item.icon_filename(item)')
|
||||
return GameData::Item.icon_filename(item)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbHeldItemIconFile(item)
|
||||
Deprecation.warn_method('pbHeldItemIconFile', 'v20', 'GameData::Item.held_icon_filename(item)')
|
||||
return GameData::Item.held_icon_filename(item)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbMailBackFile(item)
|
||||
Deprecation.warn_method('pbMailBackFile', 'v20', 'GameData::Item.mail_filename(item)')
|
||||
return GameData::Item.mail_filename(item)
|
||||
end
|
||||
36
Data/Scripts/010_Data/002_PBS data/007_BerryPlant.rb
Normal file
36
Data/Scripts/010_Data/002_PBS data/007_BerryPlant.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
module GameData
|
||||
class BerryPlant
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :hours_per_stage
|
||||
attr_reader :drying_per_hour
|
||||
attr_reader :minimum_yield
|
||||
attr_reader :maximum_yield
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "berry_plants.dat"
|
||||
|
||||
NUMBER_OF_REPLANTS = 9
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@hours_per_stage = hash[:hours_per_stage] || 3
|
||||
@drying_per_hour = hash[:drying_per_hour] || 15
|
||||
@minimum_yield = hash[:minimum_yield] || 2
|
||||
@maximum_yield = hash[:maximum_yield] || 5
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetBerryPlantData(item)
|
||||
Deprecation.warn_method('pbGetBerryPlantData', 'v20', 'GameData::BerryPlant.get(item)')
|
||||
return GameData::BerryPlant.get(item)
|
||||
end
|
||||
444
Data/Scripts/010_Data/002_PBS data/008_Species.rb
Normal file
444
Data/Scripts/010_Data/002_PBS data/008_Species.rb
Normal file
@@ -0,0 +1,444 @@
|
||||
module GameData
|
||||
class Species
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :species
|
||||
attr_reader :form
|
||||
attr_reader :real_name
|
||||
attr_reader :real_form_name
|
||||
attr_reader :real_category
|
||||
attr_reader :real_pokedex_entry
|
||||
attr_reader :pokedex_form
|
||||
attr_reader :type1
|
||||
attr_reader :type2
|
||||
attr_reader :base_stats
|
||||
attr_reader :evs
|
||||
attr_reader :base_exp
|
||||
attr_reader :growth_rate
|
||||
attr_reader :gender_ratio
|
||||
attr_reader :catch_rate
|
||||
attr_reader :happiness
|
||||
attr_reader :moves
|
||||
attr_reader :tutor_moves
|
||||
attr_reader :egg_moves
|
||||
attr_reader :abilities
|
||||
attr_reader :hidden_abilities
|
||||
attr_reader :wild_item_common
|
||||
attr_reader :wild_item_uncommon
|
||||
attr_reader :wild_item_rare
|
||||
attr_reader :egg_groups
|
||||
attr_reader :hatch_steps
|
||||
attr_reader :incense
|
||||
attr_reader :evolutions
|
||||
attr_reader :height
|
||||
attr_reader :weight
|
||||
attr_reader :color
|
||||
attr_reader :shape
|
||||
attr_reader :habitat
|
||||
attr_reader :generation
|
||||
attr_reader :mega_stone
|
||||
attr_reader :mega_move
|
||||
attr_reader :unmega_form
|
||||
attr_reader :mega_message
|
||||
attr_accessor :back_sprite_x
|
||||
attr_accessor :back_sprite_y
|
||||
attr_accessor :front_sprite_x
|
||||
attr_accessor :front_sprite_y
|
||||
attr_accessor :front_sprite_altitude
|
||||
attr_accessor :shadow_x
|
||||
attr_accessor :shadow_size
|
||||
attr_accessor :alwaysUseGeneratedSprite
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "species.dat"
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
# @param species [Symbol, self, String, Integer]
|
||||
# @param form [Integer]
|
||||
# @return [self, nil]
|
||||
def self.get_species_form(species, form)
|
||||
return GameData::Species.get(species) rescue nil
|
||||
# return nil if !species || !form
|
||||
# validate species => [Symbol, self, String, Integer]
|
||||
# validate form => Integer
|
||||
# # if other.is_a?(Integer)
|
||||
# # p "Please switch to symbols, thanks."
|
||||
# # end
|
||||
# species = species.species if species.is_a?(self)
|
||||
# species = DATA[species].species if species.is_a?(Integer)
|
||||
# species = species.to_sym if species.is_a?(String)
|
||||
# trial = sprintf("%s_%d", species, form).to_sym
|
||||
# species_form = (DATA[trial].nil?) ? species : trial
|
||||
# return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
|
||||
end
|
||||
|
||||
def self.schema(compiling_forms = false)
|
||||
ret = {
|
||||
"FormName" => [0, "q"],
|
||||
"Kind" => [0, "s"],
|
||||
"Pokedex" => [0, "q"],
|
||||
"Type1" => [0, "e", :Type],
|
||||
"Type2" => [0, "e", :Type],
|
||||
"BaseStats" => [0, "vvvvvv"],
|
||||
"EffortPoints" => [0, "uuuuuu"],
|
||||
"BaseEXP" => [0, "v"],
|
||||
"Rareness" => [0, "u"],
|
||||
"Happiness" => [0, "u"],
|
||||
"Moves" => [0, "*ue", nil, :Move],
|
||||
"TutorMoves" => [0, "*e", :Move],
|
||||
"EggMoves" => [0, "*e", :Move],
|
||||
"Abilities" => [0, "*e", :Ability],
|
||||
"HiddenAbility" => [0, "*e", :Ability],
|
||||
"WildItemCommon" => [0, "e", :Item],
|
||||
"WildItemUncommon" => [0, "e", :Item],
|
||||
"WildItemRare" => [0, "e", :Item],
|
||||
"Compatibility" => [0, "*e", :EggGroup],
|
||||
"StepsToHatch" => [0, "v"],
|
||||
"Height" => [0, "f"],
|
||||
"Weight" => [0, "f"],
|
||||
"Color" => [0, "e", :BodyColor],
|
||||
"Shape" => [0, "y", :BodyShape],
|
||||
"Habitat" => [0, "e", :Habitat],
|
||||
"Generation" => [0, "i"],
|
||||
"BattlerPlayerX" => [0, "i"],
|
||||
"BattlerPlayerY" => [0, "i"],
|
||||
"BattlerEnemyX" => [0, "i"],
|
||||
"BattlerEnemyY" => [0, "i"],
|
||||
"BattlerAltitude" => [0, "i"],
|
||||
"BattlerShadowX" => [0, "i"],
|
||||
"BattlerShadowSize" => [0, "u"]
|
||||
}
|
||||
if compiling_forms
|
||||
ret["PokedexForm"] = [0, "u"]
|
||||
ret["Evolutions"] = [0, "*ees", :Species, :Evolution, nil]
|
||||
ret["MegaStone"] = [0, "e", :Item]
|
||||
ret["MegaMove"] = [0, "e", :Move]
|
||||
ret["UnmegaForm"] = [0, "u"]
|
||||
ret["MegaMessage"] = [0, "u"]
|
||||
else
|
||||
ret["InternalName"] = [0, "n"]
|
||||
ret["Name"] = [0, "s"]
|
||||
ret["GrowthRate"] = [0, "e", :GrowthRate]
|
||||
ret["GenderRate"] = [0, "e", :GenderRatio]
|
||||
ret["Incense"] = [0, "e", :Item]
|
||||
ret["Evolutions"] = [0, "*ses", nil, :Evolution, nil]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@species = hash[:species] || @id
|
||||
@form = hash[:form] || 0
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@real_form_name = hash[:form_name]
|
||||
@real_category = hash[:category] || "???"
|
||||
@real_pokedex_entry = hash[:pokedex_entry] || "???"
|
||||
@pokedex_form = hash[:pokedex_form] || @form
|
||||
@type1 = hash[:type1] || :NORMAL
|
||||
@type2 = hash[:type2] || @type1
|
||||
@base_stats = hash[:base_stats] || {}
|
||||
@evs = hash[:evs] || {}
|
||||
GameData::Stat.each_main do |s|
|
||||
@base_stats[s.id] = 1 if !@base_stats[s.id] || @base_stats[s.id] <= 0
|
||||
@evs[s.id] = 0 if !@evs[s.id] || @evs[s.id] < 0
|
||||
end
|
||||
@base_exp = hash[:base_exp] || 100
|
||||
@growth_rate = hash[:growth_rate] || :Medium
|
||||
@gender_ratio = hash[:gender_ratio] || :Female50Percent
|
||||
@catch_rate = hash[:catch_rate] || 255
|
||||
@happiness = hash[:happiness] || 70
|
||||
@moves = hash[:moves] || []
|
||||
@tutor_moves = hash[:tutor_moves] || []
|
||||
@egg_moves = hash[:egg_moves] || []
|
||||
@abilities = hash[:abilities] || []
|
||||
@hidden_abilities = hash[:hidden_abilities] || []
|
||||
@wild_item_common = hash[:wild_item_common]
|
||||
@wild_item_uncommon = hash[:wild_item_uncommon]
|
||||
@wild_item_rare = hash[:wild_item_rare]
|
||||
@egg_groups = hash[:egg_groups] || [:Undiscovered]
|
||||
@hatch_steps = hash[:hatch_steps] || 1
|
||||
@incense = hash[:incense]
|
||||
@evolutions = hash[:evolutions] || []
|
||||
@height = hash[:height] || 1
|
||||
@weight = hash[:weight] || 1
|
||||
@color = hash[:color] || :Red
|
||||
@shape = hash[:shape] || :Head
|
||||
@habitat = hash[:habitat] || :None
|
||||
@generation = hash[:generation] || 0
|
||||
@mega_stone = hash[:mega_stone]
|
||||
@mega_move = hash[:mega_move]
|
||||
@unmega_form = hash[:unmega_form] || 0
|
||||
@mega_message = hash[:mega_message] || 0
|
||||
@back_sprite_x = hash[:back_sprite_x] || 0
|
||||
@back_sprite_y = hash[:back_sprite_y] || 0
|
||||
@front_sprite_x = hash[:front_sprite_x] || 0
|
||||
@front_sprite_y = hash[:front_sprite_y] || 0
|
||||
@front_sprite_altitude = hash[:front_sprite_altitude] || 0
|
||||
@shadow_x = hash[:shadow_x] || 0
|
||||
@shadow_size = hash[:shadow_size] || 2
|
||||
@alwaysUseGeneratedSprite=false
|
||||
end
|
||||
|
||||
def set_always_use_generated_sprite(useGeneratedSprite)
|
||||
@alwaysUseGeneratedSprite=useGeneratedSprite
|
||||
end
|
||||
|
||||
def always_use_generated
|
||||
return @alwaysUseGeneratedSprite
|
||||
end
|
||||
# @return [String] the translated name of this species
|
||||
def name
|
||||
return @real_name
|
||||
#return pbGetMessage(MessageTypes::Species, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this form of this species
|
||||
def form_name
|
||||
return @real_form_name
|
||||
#return pbGetMessage(MessageTypes::FormNames, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated Pokédex category of this species
|
||||
def category
|
||||
return @real_category
|
||||
#return pbGetMessage(MessageTypes::Kinds, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated Pokédex entry of this species
|
||||
def pokedex_entry
|
||||
return @real_pokedex_entry
|
||||
#return pbGetMessage(MessageTypes::Entries, @id_number)
|
||||
end
|
||||
|
||||
def is_fusion
|
||||
return @id_number > Settings::NB_POKEMON
|
||||
end
|
||||
|
||||
def is_triple_fusion
|
||||
return @id_number >= Settings::ZAPMOLCUNO_NB
|
||||
end
|
||||
def get_body_species
|
||||
return @species
|
||||
end
|
||||
|
||||
def get_head_species
|
||||
return @species
|
||||
end
|
||||
|
||||
def hasType?(type)
|
||||
type = GameData::Type.get(type).id
|
||||
return self.types.include?(type)
|
||||
end
|
||||
|
||||
def types
|
||||
types = [@type1]
|
||||
types << @type2 if @type2 && @type2 != @type1
|
||||
return types
|
||||
end
|
||||
|
||||
def apply_metrics_to_sprite(sprite, index, shadow = false)
|
||||
front_sprite_y = self.is_fusion ? GameData::Species.get(getBodyID(@id_number)).front_sprite_y: @front_sprite_y
|
||||
|
||||
if shadow
|
||||
if (index & 1) == 1 # Foe Pokémon
|
||||
sprite.x += @shadow_x * 2
|
||||
end
|
||||
else
|
||||
if (index & 1) == 0 # Player's Pokémon
|
||||
sprite.x += @back_sprite_x * 2
|
||||
sprite.y += (@back_sprite_y * 2) + Settings::BACKSPRITE_POSITION_OFFSET
|
||||
else
|
||||
# Foe Pokémon
|
||||
sprite.x += @front_sprite_x * 2
|
||||
sprite.y += (front_sprite_y * 2) + Settings::FRONTSPRITE_POSITION_OFFSET
|
||||
sprite.y -= @front_sprite_altitude * 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def shows_shadow?
|
||||
return true
|
||||
# return @front_sprite_altitude > 0
|
||||
end
|
||||
|
||||
def get_evolutions(exclude_invalid = false)
|
||||
ret = []
|
||||
@evolutions.each do |evo|
|
||||
next if evo[3] # Is the prevolution
|
||||
next if evo[1] == :None && exclude_invalid
|
||||
ret.push([evo[0], evo[1], evo[2]]) # [Species, method, parameter]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def get_family_evolutions(exclude_invalid = true)
|
||||
evos = self.get_evolutions(exclude_invalid)
|
||||
evos = evos.sort { |a, b| GameData::Species.get(a[0]).id_number <=> GameData::Species.get(b[0]).id_number }
|
||||
ret = []
|
||||
evos.each do |evo|
|
||||
ret.push([@species].concat(evo)) # [Prevo species, evo species, method, parameter]
|
||||
evo_array = GameData::Species.get(evo[0]).get_family_evolutions(exclude_invalid)
|
||||
ret.concat(evo_array) if evo_array && evo_array.length > 0
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def get_previous_species
|
||||
return @species if @evolutions.length == 0
|
||||
@evolutions.each { |evo| return evo[0] if evo[3] } # Is the prevolution
|
||||
return @species
|
||||
end
|
||||
|
||||
def get_baby_species(check_items = false, item1 = nil, item2 = nil)
|
||||
ret = @species
|
||||
return ret if @evolutions.length == 0
|
||||
@evolutions.each do |evo|
|
||||
next if !evo[3] # Not the prevolution
|
||||
if check_items
|
||||
incense = GameData::Species.get(evo[0]).incense
|
||||
ret = evo[0] if !incense || item1 == incense || item2 == incense
|
||||
else
|
||||
ret = evo[0] # Species of prevolution
|
||||
end
|
||||
break
|
||||
end
|
||||
ret = GameData::Species.get(ret).get_baby_species(check_items, item1, item2) if ret != @species
|
||||
return ret
|
||||
end
|
||||
|
||||
def get_related_species
|
||||
sp = self.get_baby_species
|
||||
evos = GameData::Species.get(sp).get_family_evolutions(false)
|
||||
return [sp] if evos.length == 0
|
||||
return [sp].concat(evos.map { |e| e[1] }).uniq
|
||||
end
|
||||
|
||||
def family_evolutions_have_method?(check_method, check_param = nil)
|
||||
sp = self.get_baby_species
|
||||
evos = GameData::Species.get(sp).get_family_evolutions
|
||||
return false if evos.length == 0
|
||||
evos.each do |evo|
|
||||
if check_method.is_a?(Array)
|
||||
next if !check_method.include?(evo[2])
|
||||
else
|
||||
next if evo[2] != check_method
|
||||
end
|
||||
return true if check_param.nil? || evo[3] == check_param
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# Used by the Moon Ball when checking if a Pokémon's evolution family
|
||||
# includes an evolution that uses the Moon Stone.
|
||||
def family_item_evolutions_use_item?(check_item = nil)
|
||||
sp = self.get_baby_species
|
||||
evos = GameData::Species.get(sp).get_family_evolutions
|
||||
return false if !evos || evos.length == 0
|
||||
evos.each do |evo|
|
||||
next if GameData::Evolution.get(evo[2]).use_item_proc.nil?
|
||||
return true if check_item.nil? || evo[3] == check_item
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def minimum_level
|
||||
return 1 if @evolutions.length == 0
|
||||
@evolutions.each do |evo|
|
||||
next if !evo[3] # Not the prevolution
|
||||
evo_method_data = GameData::Evolution.get(evo[1])
|
||||
next if evo_method_data.level_up_proc.nil?
|
||||
min_level = evo_method_data.minimum_level
|
||||
return (min_level == 0) ? evo[2] : min_level + 1
|
||||
end
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetSpeciesData(species, form = 0, species_data_type = -1)
|
||||
Deprecation.warn_method('pbGetSpeciesData', 'v20', 'GameData::Species.get_species_form(species, form).something')
|
||||
return GameData::Species.get_species_form(species, form)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetSpeciesEggMoves(species, form = 0)
|
||||
Deprecation.warn_method('pbGetSpeciesEggMoves', 'v20', 'GameData::Species.get_species_form(species, form).egg_moves')
|
||||
return GameData::Species.get_species_form(species, form).egg_moves
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetSpeciesMoveset(species, form = 0)
|
||||
Deprecation.warn_method('pbGetSpeciesMoveset', 'v20', 'GameData::Species.get_species_form(species, form).moves')
|
||||
return GameData::Species.get_species_form(species, form).moves
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetEvolutionData(species)
|
||||
Deprecation.warn_method('pbGetEvolutionData', 'v20', 'GameData::Species.get(species).evolutions')
|
||||
return GameData::Species.get(species).evolutions
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbApplyBattlerMetricsToSprite(sprite, index, species_data, shadow = false, metrics = nil)
|
||||
Deprecation.warn_method('pbApplyBattlerMetricsToSprite', 'v20', 'GameData::Species.get(species).apply_metrics_to_sprite')
|
||||
GameData::Species.get(species).apply_metrics_to_sprite(sprite, index, shadow)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def showShadow?(species)
|
||||
Deprecation.warn_method('showShadow?', 'v20', 'GameData::Species.get(species).shows_shadow?')
|
||||
return GameData::Species.get(species).shows_shadow?
|
||||
end
|
||||
|
||||
# @deprecated Use {GameData#Species#get_evolutions} instead. This alias is slated to be removed in v20.
|
||||
def pbGetEvolvedFormData(species, exclude_invalid = false)
|
||||
Deprecation.warn_method('pbGetEvolvedFormData', 'v20', 'GameData::Species.get(species).get_evolutions')
|
||||
return GameData::Species.get(species).get_evolutions(exclude_invalid)
|
||||
end
|
||||
|
||||
# @deprecated Use {GameData#Species#get_family_evolutions} instead. This alias is slated to be removed in v20.
|
||||
def pbGetEvolutionFamilyData(species)
|
||||
# Unused
|
||||
Deprecation.warn_method('pbGetEvolutionFamilyData', 'v20', 'GameData::Species.get(species).get_family_evolutions')
|
||||
return GameData::Species.get(species).get_family_evolutions
|
||||
end
|
||||
|
||||
# @deprecated Use {GameData#Species#get_previous_species} instead. This alias is slated to be removed in v20.
|
||||
def pbGetPreviousForm(species)
|
||||
# Unused
|
||||
Deprecation.warn_method('pbGetPreviousForm', 'v20', 'GameData::Species.get(species).get_previous_species')
|
||||
return GameData::Species.get(species).get_previous_species
|
||||
end
|
||||
|
||||
# @deprecated Use {GameData#Species#get_baby_species} instead. This alias is slated to be removed in v20.
|
||||
def pbGetBabySpecies(species, check_items = false, item1 = nil, item2 = nil)
|
||||
Deprecation.warn_method('pbGetBabySpecies', 'v20', 'GameData::Species.get(species).get_baby_species')
|
||||
return GameData::Species.get(species).get_baby_species(check_items, item1, item2)
|
||||
end
|
||||
|
||||
# @deprecated Use {GameData#Species#family_evolutions_have_method?} instead. This alias is slated to be removed in v20.
|
||||
def pbCheckEvolutionFamilyForMethod(species, method, param = nil)
|
||||
# Unused
|
||||
Deprecation.warn_method('pbCheckEvolutionFamilyForMethod', 'v20', 'GameData::Species.get(species).family_evolutions_have_method?(method)')
|
||||
return GameData::Species.get(species).family_evolutions_have_method?(method, param)
|
||||
end
|
||||
|
||||
# @deprecated Use {GameData#Species#family_item_evolutions_use_item?} instead. This alias is slated to be removed in v20.
|
||||
def pbCheckEvolutionFamilyForItemMethodItem(species, param = nil)
|
||||
Deprecation.warn_method('pbCheckEvolutionFamilyForItemMethodItem', 'v20', 'GameData::Species.get(species).family_item_evolutions_use_item?(item)')
|
||||
return GameData::Species.get(species).family_item_evolutions_use_item?(param)
|
||||
end
|
||||
|
||||
# @deprecated Use {GameData#Species#minimum_level} instead. This alias is slated to be removed in v20.
|
||||
def pbGetMinimumLevel(species)
|
||||
Deprecation.warn_method('pbGetMinimumLevel', 'v20', 'GameData::Species.get(species).minimum_level')
|
||||
return GameData::Species.get(species).minimum_level
|
||||
end
|
||||
388
Data/Scripts/010_Data/002_PBS data/009_Species_Files.rb
Normal file
388
Data/Scripts/010_Data/002_PBS data/009_Species_Files.rb
Normal file
@@ -0,0 +1,388 @@
|
||||
module GameData
|
||||
class Species
|
||||
def self.check_graphic_file(path, species, form = "", gender = 0, shiny = false, shadow = false, subfolder = "")
|
||||
try_subfolder = sprintf("%s/", subfolder)
|
||||
try_species = species
|
||||
|
||||
try_form = form ? sprintf("_%s", form) : ""
|
||||
try_gender = (gender == 1) ? "_female" : ""
|
||||
try_shadow = (shadow) ? "_shadow" : ""
|
||||
factors = []
|
||||
factors.push([4, sprintf("%s shiny/", subfolder), try_subfolder]) if shiny
|
||||
factors.push([3, try_shadow, ""]) if shadow
|
||||
factors.push([2, try_gender, ""]) if gender == 1
|
||||
factors.push([1, try_form, ""]) if form
|
||||
factors.push([0, try_species, "000"])
|
||||
# Go through each combination of parameters in turn to find an existing sprite
|
||||
for i in 0...2 ** factors.length
|
||||
# Set try_ parameters for this combination
|
||||
factors.each_with_index do |factor, index|
|
||||
value = ((i / (2 ** index)) % 2 == 0) ? factor[1] : factor[2]
|
||||
case factor[0]
|
||||
when 0 then
|
||||
try_species = value
|
||||
when 1 then
|
||||
try_form = value
|
||||
when 2 then
|
||||
try_gender = value
|
||||
when 3 then
|
||||
try_shadow = value
|
||||
when 4 then
|
||||
try_subfolder = value # Shininess
|
||||
end
|
||||
end
|
||||
# Look for a graphic matching this combination's parameters
|
||||
try_species_text = try_species
|
||||
ret = pbResolveBitmap(sprintf("%s%s%s%s%s%s", path, try_subfolder,
|
||||
try_species_text, try_form, try_gender, try_shadow))
|
||||
return ret if ret
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def self.check_egg_graphic_file(path, species, form, suffix = "")
|
||||
species_data = self.get_species_form(species, form)
|
||||
return nil if species_data.nil?
|
||||
if form > 0
|
||||
ret = pbResolveBitmap(sprintf("%s%s_%d%s", path, species_data.species, form, suffix))
|
||||
return ret if ret
|
||||
end
|
||||
return pbResolveBitmap(sprintf("%s%s%s", path, species_data.species, suffix))
|
||||
end
|
||||
|
||||
def self.front_sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false)
|
||||
return self.check_graphic_file("Graphics/Pokemon/", species, form, gender, shiny, shadow, "Front")
|
||||
end
|
||||
|
||||
def self.back_sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false)
|
||||
return self.check_graphic_file("Graphics/Pokemon/", species, form, gender, shiny, shadow, "Back")
|
||||
end
|
||||
|
||||
# def self.egg_sprite_filename(species, form)
|
||||
# ret = self.check_egg_graphic_file("Graphics/Pokemon/Eggs/", species, form)
|
||||
# return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000")
|
||||
# end
|
||||
def self.egg_sprite_filename(species, form)
|
||||
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.use_custom_eggs
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%03d", dexNum) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
if isTripleFusion?(dexNum)
|
||||
bitmapFileName = "Graphics/Battlers/Eggs/egg_base"
|
||||
else
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%03d", dexNum)
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/000")
|
||||
end
|
||||
end
|
||||
end
|
||||
return bitmapFileName
|
||||
end
|
||||
|
||||
def self.sprite_filename(species, form = 0, gender = 0, shiny = false, shadow = false, back = false, egg = false)
|
||||
return self.egg_sprite_filename(species, form) if egg
|
||||
return self.back_sprite_filename(species, form, gender, shiny, shadow) if back
|
||||
return self.front_sprite_filename(species, form, gender, shiny, shadow)
|
||||
end
|
||||
|
||||
def self.front_sprite_bitmap(species, form = 0, gender = 0, shiny = false, shadow = false)
|
||||
#filename = self.front_sprite_filename(species, form, gender, shiny, shadow)
|
||||
filename = self.front_sprite_filename(GameData::Species.get(species).id_number)
|
||||
return (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
end
|
||||
|
||||
def self.back_sprite_bitmap(species, form = 0, gender = 0, shiny = false, shadow = false)
|
||||
filename = self.back_sprite_filename(species, form, gender, shiny, shadow)
|
||||
return (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
end
|
||||
|
||||
def self.egg_sprite_bitmap(species, form = 0)
|
||||
filename = self.egg_sprite_filename(species, form)
|
||||
return (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
end
|
||||
|
||||
def self.sprite_bitmap(species, form = 0, gender = 0, shiny = false, shadow = false, back = false, egg = false)
|
||||
return self.egg_sprite_bitmap(species, form) if egg
|
||||
return self.back_sprite_bitmap(species, form, gender, shiny, shadow) if back
|
||||
return self.front_sprite_bitmap(species, shiny,)
|
||||
end
|
||||
|
||||
def self.sprite_bitmap_from_pokemon(pkmn, back = false, species = nil)
|
||||
species = pkmn.species if !species
|
||||
species = GameData::Species.get(species).species # Just to be sure it's a symbol
|
||||
return self.egg_sprite_bitmap(species, pkmn.form) if pkmn.egg?
|
||||
if back
|
||||
ret = self.back_sprite_bitmap(species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?)
|
||||
else
|
||||
ret = self.front_sprite_bitmap(species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?)
|
||||
end
|
||||
alter_bitmap_function = MultipleForms.getFunction(species, "alterBitmap")
|
||||
if ret && alter_bitmap_function
|
||||
new_ret = ret.copy
|
||||
ret.dispose
|
||||
new_ret.each { |bitmap| alter_bitmap_function.call(pkmn, bitmap) }
|
||||
ret = new_ret
|
||||
end
|
||||
print "hat"
|
||||
add_hat_to_bitmap(ret,pkmn.hat,pkmn.hat_x,pkmn.hat_y) if pkmn.hat
|
||||
return ret
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
|
||||
def self.egg_icon_filename(species, form)
|
||||
ret = self.check_egg_graphic_file("Graphics/Pokemon/Eggs/", species, form, "_icon")
|
||||
return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000_icon")
|
||||
end
|
||||
|
||||
def self.icon_filename(species, spriteform= nil, gender=nil, shiny = false, shadow = false, egg = false)
|
||||
return self.egg_icon_filename(species, 0) if egg
|
||||
return self.check_graphic_file("Graphics/Pokemon/", species, spriteform, gender, shiny, shadow, "Icons")
|
||||
end
|
||||
|
||||
def self.icon_filename_from_pokemon(pkmn)
|
||||
return pbResolveBitmap(sprintf("Graphics/Icons/iconEgg")) if pkmn.egg?
|
||||
if pkmn.isFusion?
|
||||
return pbResolveBitmap(sprintf("Graphics/Icons/iconDNA"))
|
||||
end
|
||||
return self.icon_filename(pkmn.species, pkmn.spriteform_head, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?)
|
||||
end
|
||||
|
||||
def self.icon_filename_from_species(species)
|
||||
return self.icon_filename(species, 0, 0, false, false, false)
|
||||
end
|
||||
|
||||
def self.egg_icon_bitmap(species, form)
|
||||
filename = self.egg_icon_filename(species, form)
|
||||
return (filename) ? AnimatedBitmap.new(filename).deanimate : nil
|
||||
end
|
||||
|
||||
def self.icon_bitmap(species, form = 0, gender = 0, shiny = false, shadow = false)
|
||||
filename = self.icon_filename(species, form, gender, shiny, shadow)
|
||||
return (filename) ? AnimatedBitmap.new(filename).deanimate : nil
|
||||
end
|
||||
|
||||
def self.icon_bitmap_from_pokemon(pkmn)
|
||||
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)
|
||||
return nil if species_data.nil?
|
||||
if form > 0
|
||||
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s_%d", species_data.species, form))
|
||||
return ret if ret
|
||||
end
|
||||
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)
|
||||
return nil if species_data.nil?
|
||||
# Look for species-specific shadow graphic
|
||||
if form > 0
|
||||
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, form))
|
||||
return ret if ret
|
||||
end
|
||||
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
|
||||
return ret if ret
|
||||
# Use general shadow graphic
|
||||
return pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%d", species_data.shadow_size))
|
||||
end
|
||||
|
||||
def self.shadow_bitmap(species, form = 0)
|
||||
filename = self.shadow_filename(species, form)
|
||||
return (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
end
|
||||
|
||||
def self.shadow_bitmap_from_pokemon(pkmn)
|
||||
filename = self.shadow_filename(pkmn.species, pkmn.form)
|
||||
return (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
|
||||
def self.check_cry_file(species, form)
|
||||
species_data = self.get_species_form(species, form)
|
||||
return nil if species_data.nil?
|
||||
if species_data.is_fusion
|
||||
species_data = GameData::Species.get(getHeadID(species_data))
|
||||
end
|
||||
ret = sprintf("Cries/%s", species_data.species)
|
||||
return (pbResolveAudioSE(ret)) ? ret : nil
|
||||
end
|
||||
|
||||
def self.cry_filename(species, form = 0)
|
||||
return self.check_cry_file(species, form)
|
||||
end
|
||||
|
||||
def self.cry_filename_from_pokemon(pkmn)
|
||||
return self.check_cry_file(pkmn.species, pkmn.form)
|
||||
end
|
||||
|
||||
def self.play_cry_from_species(species, form = 0, volume = 90, pitch = 100)
|
||||
dex_num = getDexNumberForSpecies(species)
|
||||
return if !dex_num
|
||||
return play_triple_fusion_cry(species, volume, pitch) if dex_num > Settings::ZAPMOLCUNO_NB
|
||||
if dex_num > NB_POKEMON
|
||||
body_number = getBodyID(dex_num)
|
||||
head_number = getHeadID(dex_num,body_number)
|
||||
return play_fusion_cry(GameData::Species.get(head_number).species,GameData::Species.get(body_number).species, volume, pitch)
|
||||
end
|
||||
filename = self.cry_filename(species, form)
|
||||
return if !filename
|
||||
pbSEPlay(RPG::AudioFile.new(filename, volume, pitch)) rescue nil
|
||||
end
|
||||
|
||||
def self.play_cry_from_pokemon(pkmn, volume = 90, pitch = nil)
|
||||
return if !pkmn || pkmn.egg?
|
||||
|
||||
species_data = pkmn.species_data
|
||||
return play_triple_fusion_cry(pkmn.species, volume, pitch) if species_data.is_triple_fusion
|
||||
if pkmn.species_data.is_fusion
|
||||
return play_fusion_cry(species_data.get_head_species,species_data.get_body_species, volume, pitch)
|
||||
end
|
||||
filename = self.cry_filename_from_pokemon(pkmn)
|
||||
return if !filename
|
||||
pitch ||= 75 + (pkmn.hp * 25 / pkmn.totalhp)
|
||||
pbSEPlay(RPG::AudioFile.new(filename, volume, pitch)) rescue nil
|
||||
end
|
||||
|
||||
def self.play_triple_fusion_cry(species_id, volume, pitch)
|
||||
fusion_components = get_triple_fusion_components(species_id)
|
||||
|
||||
echoln fusion_components
|
||||
echoln species_id
|
||||
for id in fusion_components
|
||||
cry_filename = self.check_cry_file(id,nil)
|
||||
pbSEPlay(cry_filename,volume-10) rescue nil
|
||||
end
|
||||
end
|
||||
def self.play_fusion_cry(head_id,body_id, volume = 90, pitch = 100)
|
||||
head_cry_filename = self.check_cry_file(head_id,nil)
|
||||
body_cry_filename = self.check_cry_file(body_id,nil)
|
||||
|
||||
pbSEPlay(body_cry_filename,volume-10) rescue nil
|
||||
pbSEPlay(head_cry_filename,volume) rescue nil
|
||||
end
|
||||
def self.play_cry(pkmn, volume = 90, pitch = nil)
|
||||
if pkmn.is_a?(Pokemon)
|
||||
self.play_cry_from_pokemon(pkmn, volume, pitch)
|
||||
else
|
||||
self.play_cry_from_species(pkmn, nil, volume, pitch)
|
||||
end
|
||||
end
|
||||
|
||||
def self.cry_length(species, form = 0, pitch = 100)
|
||||
return 0 if !species || pitch <= 0
|
||||
pitch = pitch.to_f / 100
|
||||
ret = 0.0
|
||||
if species.is_a?(Pokemon)
|
||||
if !species.egg?
|
||||
filename = pbResolveAudioSE(GameData::Species.cry_filename_from_pokemon(species))
|
||||
ret = getPlayTime(filename) if filename
|
||||
end
|
||||
else
|
||||
filename = pbResolveAudioSE(GameData::Species.cry_filename(species, form))
|
||||
ret = getPlayTime(filename) if filename
|
||||
end
|
||||
ret /= pitch # Sound played at a lower pitch lasts longer
|
||||
return (ret * Graphics.frame_rate).ceil + 4 # 4 provides a buffer between sounds
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadSpeciesBitmap(species, gender = 0, form = 0, shiny = false, shadow = false, back = false, egg = false)
|
||||
Deprecation.warn_method('pbLoadSpeciesBitmap', 'v20', 'GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg)')
|
||||
return GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadPokemonBitmap(pkmn, back = false)
|
||||
Deprecation.warn_method('pbLoadPokemonBitmap', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn)')
|
||||
return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadPokemonBitmapSpecies(pkmn, species, back = false)
|
||||
Deprecation.warn_method('pbLoadPokemonBitmapSpecies', 'v20', 'GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species)')
|
||||
return GameData::Species.sprite_bitmap_from_pokemon(pkmn, back, species)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPokemonIconFile(pkmn)
|
||||
Deprecation.warn_method('pbPokemonIconFile', 'v20', 'GameData::Species.icon_filename_from_pokemon(pkmn)')
|
||||
return GameData::Species.icon_filename_from_pokemon(pkmn)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadPokemonIcon(pkmn)
|
||||
Deprecation.warn_method('pbLoadPokemonIcon', 'v20', 'GameData::Species.icon_bitmap_from_pokemon(pkmn)')
|
||||
return GameData::Species.icon_bitmap_from_pokemon(pkmn)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPokemonFootprintFile(species, form = 0)
|
||||
Deprecation.warn_method('pbPokemonFootprintFile', 'v20', 'GameData::Species.footprint_filename(species, form)')
|
||||
return GameData::Species.footprint_filename(species, form)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbCheckPokemonShadowBitmapFiles(species, form = 0)
|
||||
Deprecation.warn_method('pbCheckPokemonShadowBitmapFiles', 'v20', 'GameData::Species.shadow_filename(species, form)')
|
||||
return GameData::Species.shadow_filename(species, form)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadPokemonShadowBitmap(pkmn)
|
||||
Deprecation.warn_method('pbLoadPokemonShadowBitmap', 'v20', 'GameData::Species.shadow_bitmap_from_pokemon(pkmn)')
|
||||
return GameData::Species.shadow_bitmap_from_pokemon(pkmn)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbCryFile(species, form = 0)
|
||||
if species.is_a?(Pokemon)
|
||||
Deprecation.warn_method('pbCryFile', 'v20', 'GameData::Species.cry_filename_from_pokemon(pkmn)')
|
||||
return GameData::Species.cry_filename_from_pokemon(species)
|
||||
end
|
||||
Deprecation.warn_method('pbCryFile', 'v20', 'GameData::Species.cry_filename(species, form)')
|
||||
return GameData::Species.cry_filename(species, form)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPlayCry(pkmn, volume = 90, pitch = nil)
|
||||
Deprecation.warn_method('pbPlayCry', 'v20', 'GameData::Species.play_cry(pkmn)')
|
||||
GameData::Species.play_cry(pkmn, volume, pitch)
|
||||
end
|
||||
|
||||
|
||||
def play_cry(species, volume = 90, pitch = 100)
|
||||
echoln species
|
||||
GameData::Species.play_cry_from_species(species,0,volume, pitch)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPlayCrySpecies(species, form = 0, volume = 90, pitch = nil)
|
||||
Deprecation.warn_method('pbPlayCrySpecies', 'v20', 'Pokemon.play_cry(species, form)')
|
||||
Pokemon.play_cry(species, form, volume, pitch)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPlayCryPokemon(pkmn, volume = 90, pitch = nil)
|
||||
Deprecation.warn_method('pbPlayCryPokemon', 'v20', 'pkmn.play_cry')
|
||||
pkmn.play_cry(volume, pitch)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbCryFrameLength(species, form = 0, pitch = 100)
|
||||
Deprecation.warn_method('pbCryFrameLength', 'v20', 'GameData::Species.cry_length(species, form)')
|
||||
return GameData::Species.cry_length(species, form, pitch)
|
||||
end
|
||||
31
Data/Scripts/010_Data/002_PBS data/010_Ribbon.rb
Normal file
31
Data/Scripts/010_Data/002_PBS data/010_Ribbon.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
module GameData
|
||||
class Ribbon
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :real_description
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "ribbons.dat"
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@real_description = hash[:description] || "???"
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this ribbon
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::RibbonNames, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this ribbon
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::RibbonDescriptions, @id_number)
|
||||
end
|
||||
end
|
||||
end
|
||||
78
Data/Scripts/010_Data/002_PBS data/011_Encounter.rb
Normal file
78
Data/Scripts/010_Data/002_PBS data/011_Encounter.rb
Normal file
@@ -0,0 +1,78 @@
|
||||
module GameData
|
||||
class Encounter
|
||||
attr_accessor :id
|
||||
attr_accessor :map
|
||||
attr_accessor :version
|
||||
|
||||
attr_reader :step_chances
|
||||
attr_reader :types
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "encounters.dat"
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
# @param map_id [Integer]
|
||||
# @param map_version [Integer, nil]
|
||||
# @return [Boolean] whether there is encounter data for the given map ID/version
|
||||
def self.exists?(map_id, map_version = 0)
|
||||
validate map_id => [Integer]
|
||||
validate map_version => [Integer]
|
||||
key = sprintf("%s_%d", map_id, map_version).to_sym
|
||||
return !self::DATA[key].nil?
|
||||
end
|
||||
|
||||
# @param map_id [Integer]
|
||||
# @param map_version [Integer, nil]
|
||||
# @return [self, nil]
|
||||
def self.get(map_id, map_version = 0)
|
||||
validate map_id => Integer
|
||||
validate map_version => Integer
|
||||
trial_key = sprintf("%s_%d", map_id, map_version).to_sym
|
||||
key = (self::DATA.has_key?(trial_key)) ? trial_key : sprintf("%s_0", map_id).to_sym
|
||||
return self::DATA[key]
|
||||
end
|
||||
|
||||
# Yields all encounter data in order of their map and version numbers.
|
||||
def self.each
|
||||
keys = self::DATA.keys.sort do |a, b|
|
||||
if self::DATA[a].map == self::DATA[b].map
|
||||
self::DATA[a].version <=> self::DATA[b].version
|
||||
else
|
||||
self::DATA[a].map <=> self::DATA[b].map
|
||||
end
|
||||
end
|
||||
keys.each { |key| yield self::DATA[key] }
|
||||
end
|
||||
|
||||
# Yields all encounter data for the given version. Also yields encounter
|
||||
# data for version 0 of a map if that map doesn't have encounter data for
|
||||
# the given version.
|
||||
def self.each_of_version(version = 0)
|
||||
self.each do |data|
|
||||
yield data if data.version == version
|
||||
if version > 0
|
||||
yield data if data.version == 0 && !self::DATA.has_key?([data.map, version])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@map = hash[:map]
|
||||
@version = hash[:version] || 0
|
||||
@step_chances = hash[:step_chances]
|
||||
@types = hash[:types] || {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadEncountersData
|
||||
Deprecation.warn_method('pbLoadEncountersData', 'v20', 'GameData::Encounter.get(map_id, version)')
|
||||
return nil
|
||||
end
|
||||
77
Data/Scripts/010_Data/002_PBS data/011_EncounterModern.rb
Normal file
77
Data/Scripts/010_Data/002_PBS data/011_EncounterModern.rb
Normal file
@@ -0,0 +1,77 @@
|
||||
module GameData
|
||||
class EncounterModern
|
||||
attr_accessor :id
|
||||
attr_accessor :map
|
||||
attr_accessor :version
|
||||
attr_reader :step_chances
|
||||
attr_reader :types
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "encounters_remix.dat"
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
# @param map_id [Integer]
|
||||
# @param map_version [Integer, nil]
|
||||
# @return [Boolean] whether there is encounter data for the given map ID/version
|
||||
def self.exists?(map_id, map_version = 0)
|
||||
validate map_id => [Integer]
|
||||
validate map_version => [Integer]
|
||||
key = sprintf("%s_%d", map_id, map_version).to_sym
|
||||
return !self::DATA[key].nil?
|
||||
end
|
||||
|
||||
# @param map_id [Integer]
|
||||
# @param map_version [Integer, nil]
|
||||
# @return [self, nil]
|
||||
def self.get(map_id, map_version = 0)
|
||||
validate map_id => Integer
|
||||
validate map_version => Integer
|
||||
trial_key = sprintf("%s_%d", map_id, map_version).to_sym
|
||||
key = (self::DATA.has_key?(trial_key)) ? trial_key : sprintf("%s_0", map_id).to_sym
|
||||
return self::DATA[key]
|
||||
end
|
||||
|
||||
# Yields all encounter data in order of their map and version numbers.
|
||||
def self.each
|
||||
keys = self::DATA.keys.sort do |a, b|
|
||||
if self::DATA[a].map == self::DATA[b].map
|
||||
self::DATA[a].version <=> self::DATA[b].version
|
||||
else
|
||||
self::DATA[a].map <=> self::DATA[b].map
|
||||
end
|
||||
end
|
||||
keys.each { |key| yield self::DATA[key] }
|
||||
end
|
||||
|
||||
# Yields all encounter data for the given version. Also yields encounter
|
||||
# data for version 0 of a map if that map doesn't have encounter data for
|
||||
# the given version.
|
||||
def self.each_of_version(version = 0)
|
||||
self.each do |data|
|
||||
yield data if data.version == version
|
||||
if version > 0
|
||||
yield data if data.version == 0 && !self::DATA.has_key?([data.map, version])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@map = hash[:map]
|
||||
@version = hash[:version] || 0
|
||||
@step_chances = hash[:step_chances]
|
||||
@types = hash[:types] || {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadEncountersData
|
||||
Deprecation.warn_method('pbLoadEncountersData', 'v20', 'GameData::Encounter.get(map_id, version)')
|
||||
return nil
|
||||
end
|
||||
77
Data/Scripts/010_Data/002_PBS data/011_Encounter_random.rb
Normal file
77
Data/Scripts/010_Data/002_PBS data/011_Encounter_random.rb
Normal file
@@ -0,0 +1,77 @@
|
||||
module GameData
|
||||
class EncounterRandom
|
||||
attr_accessor :id
|
||||
attr_accessor :map
|
||||
attr_accessor :version
|
||||
attr_reader :step_chances
|
||||
attr_reader :types
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "encounters_randomized.dat"
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
# @param map_id [Integer]
|
||||
# @param map_version [Integer, nil]
|
||||
# @return [Boolean] whether there is encounter data for the given map ID/version
|
||||
def self.exists?(map_id, map_version = 0)
|
||||
validate map_id => [Integer]
|
||||
validate map_version => [Integer]
|
||||
key = sprintf("%s_%d", map_id, map_version).to_sym
|
||||
return !self::DATA[key].nil?
|
||||
end
|
||||
|
||||
# @param map_id [Integer]
|
||||
# @param map_version [Integer, nil]
|
||||
# @return [self, nil]
|
||||
def self.get(map_id, map_version = 0)
|
||||
validate map_id => Integer
|
||||
validate map_version => Integer
|
||||
trial_key = sprintf("%s_%d", map_id, map_version).to_sym
|
||||
key = (self::DATA.has_key?(trial_key)) ? trial_key : sprintf("%s_0", map_id).to_sym
|
||||
return self::DATA[key]
|
||||
end
|
||||
|
||||
# Yields all encounter data in order of their map and version numbers.
|
||||
def self.each
|
||||
keys = self::DATA.keys.sort do |a, b|
|
||||
if self::DATA[a].map == self::DATA[b].map
|
||||
self::DATA[a].version <=> self::DATA[b].version
|
||||
else
|
||||
self::DATA[a].map <=> self::DATA[b].map
|
||||
end
|
||||
end
|
||||
keys.each { |key| yield self::DATA[key] }
|
||||
end
|
||||
|
||||
# Yields all encounter data for the given version. Also yields encounter
|
||||
# data for version 0 of a map if that map doesn't have encounter data for
|
||||
# the given version.
|
||||
def self.each_of_version(version = 0)
|
||||
self.each do |data|
|
||||
yield data if data.version == version
|
||||
if version > 0
|
||||
yield data if data.version == 0 && !self::DATA.has_key?([data.map, version])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@map = hash[:map]
|
||||
@version = hash[:version] || 0
|
||||
@step_chances = hash[:step_chances]
|
||||
@types = hash[:types] || {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadEncountersData
|
||||
Deprecation.warn_method('pbLoadEncountersData', 'v20', 'GameData::Encounter.get(map_id, version)')
|
||||
return nil
|
||||
end
|
||||
157
Data/Scripts/010_Data/002_PBS data/012_TrainerType.rb
Normal file
157
Data/Scripts/010_Data/002_PBS data/012_TrainerType.rb
Normal file
@@ -0,0 +1,157 @@
|
||||
module GameData
|
||||
class TrainerType
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :base_money
|
||||
attr_reader :battle_BGM
|
||||
attr_reader :victory_ME
|
||||
attr_reader :intro_ME
|
||||
attr_reader :gender
|
||||
attr_reader :skill_level
|
||||
attr_reader :skill_code
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "trainer_types.dat"
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def self.check_file(tr_type, path, optional_suffix = "", suffix = "")
|
||||
tr_type_data = self.try_get(tr_type)
|
||||
return nil if tr_type_data.nil?
|
||||
# Check for files
|
||||
if optional_suffix && !optional_suffix.empty?
|
||||
ret = path + tr_type_data.id.to_s + optional_suffix + suffix
|
||||
return ret if pbResolveBitmap(ret)
|
||||
ret = path + sprintf("%03d", tr_type_data.id_number) + optional_suffix + suffix
|
||||
return ret if pbResolveBitmap(ret)
|
||||
end
|
||||
ret = path + tr_type_data.id.to_s + suffix
|
||||
return ret if pbResolveBitmap(ret)
|
||||
ret = path + sprintf("%03d", tr_type_data.id_number) + suffix
|
||||
return (pbResolveBitmap(ret)) ? ret : nil
|
||||
end
|
||||
|
||||
def self.charset_filename(tr_type)
|
||||
return self.check_file(tr_type, "Graphics/Characters/trainer_")
|
||||
end
|
||||
|
||||
def self.charset_filename_brief(tr_type)
|
||||
ret = self.charset_filename(tr_type)
|
||||
ret.slice!("Graphics/Characters/") if ret
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.front_sprite_filename(tr_type)
|
||||
tr_type_data = self.try_get(tr_type)
|
||||
path = "Graphics/Trainers/"
|
||||
file = sprintf("trainer%03d", tr_type_data.id_number)
|
||||
ret = path + file
|
||||
return ret if pbResolveBitmap(ret)
|
||||
end
|
||||
|
||||
def self.player_front_sprite_filename(tr_type)
|
||||
#outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||
outfit=0
|
||||
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit))
|
||||
end
|
||||
|
||||
def self.back_sprite_filename(tr_type)
|
||||
return self.check_file(tr_type, "Graphics/Trainers/", "", "_back")
|
||||
end
|
||||
|
||||
def self.player_back_sprite_filename(tr_type)
|
||||
#outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||
outfit=0
|
||||
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit), "_back")
|
||||
end
|
||||
|
||||
def self.map_icon_filename(tr_type)
|
||||
return self.check_file(tr_type, "Graphics/Pictures/mapPlayer")
|
||||
end
|
||||
|
||||
def self.player_map_icon_filename(tr_type)
|
||||
outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||
return self.check_file(tr_type, "Graphics/Pictures/mapPlayer", sprintf("_%d", outfit))
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@base_money = hash[:base_money] || 30
|
||||
@battle_BGM = hash[:battle_BGM]
|
||||
@victory_ME = hash[:victory_ME]
|
||||
@intro_ME = hash[:intro_ME]
|
||||
@gender = hash[:gender] || 2
|
||||
@skill_level = hash[:skill_level] || @base_money
|
||||
@skill_code = hash[:skill_code]
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this trainer type
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::TrainerTypes, @id_number)
|
||||
end
|
||||
|
||||
def male?; return @gender == 0; end
|
||||
def female?; return @gender == 1; end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetTrainerTypeData(tr_type)
|
||||
Deprecation.warn_method('pbGetTrainerTypeData', 'v20', 'GameData::TrainerType.get(trainer_type)')
|
||||
return GameData::TrainerType.get(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbTrainerCharFile(tr_type) # Used by the phone
|
||||
Deprecation.warn_method('pbTrainerCharFile', 'v20', 'GameData::TrainerType.charset_filename(trainer_type)')
|
||||
return GameData::TrainerType.charset_filename(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbTrainerCharNameFile(tr_type) # Used by Battle Frontier and compiler
|
||||
Deprecation.warn_method('pbTrainerCharNameFile', 'v20', 'GameData::TrainerType.charset_filename_brief(trainer_type)')
|
||||
return GameData::TrainerType.charset_filename_brief(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbTrainerSpriteFile(tr_type)
|
||||
Deprecation.warn_method('pbTrainerSpriteFile', 'v20', 'GameData::TrainerType.front_sprite_filename(trainer_type)')
|
||||
return GameData::TrainerType.front_sprite_filename(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbTrainerSpriteBackFile(tr_type)
|
||||
Deprecation.warn_method('pbTrainerSpriteBackFile', 'v20', 'GameData::TrainerType.back_sprite_filename(trainer_type)')
|
||||
return GameData::TrainerType.back_sprite_filename(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPlayerSpriteFile(tr_type)
|
||||
Deprecation.warn_method('pbPlayerSpriteFile', 'v20', 'GameData::TrainerType.player_front_sprite_filename(trainer_type)')
|
||||
return GameData::TrainerType.player_front_sprite_filename(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPlayerSpriteBackFile(tr_type)
|
||||
Deprecation.warn_method('pbPlayerSpriteBackFile', 'v20', 'GameData::TrainerType.player_back_sprite_filename(trainer_type)')
|
||||
return GameData::TrainerType.player_back_sprite_filename(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbTrainerHeadFile(tr_type)
|
||||
Deprecation.warn_method('pbTrainerHeadFile', 'v20', 'GameData::TrainerType.map_icon_filename(trainer_type)')
|
||||
return GameData::TrainerType.map_icon_filename(tr_type)
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPlayerHeadFile(tr_type)
|
||||
Deprecation.warn_method('pbPlayerHeadFile', 'v20', 'GameData::TrainerType.player_map_icon_filename(trainer_type)')
|
||||
return GameData::TrainerType.player_map_icon_filename(tr_type)
|
||||
end
|
||||
442
Data/Scripts/010_Data/002_PBS data/013_Trainer.rb
Normal file
442
Data/Scripts/010_Data/002_PBS data/013_Trainer.rb
Normal file
@@ -0,0 +1,442 @@
|
||||
module GameData
|
||||
class Trainer
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :trainer_type
|
||||
attr_reader :real_name
|
||||
attr_reader :version
|
||||
attr_reader :items
|
||||
attr_reader :real_lose_text
|
||||
attr_reader :pokemon
|
||||
|
||||
|
||||
attr_accessor :loseText_rematch
|
||||
attr_accessor :preRematchText
|
||||
attr_accessor :preRematchText_caught
|
||||
attr_accessor :preRematchText_evolved
|
||||
attr_accessor :preRematchText_fused
|
||||
attr_accessor :preRematchText_unfused
|
||||
attr_accessor :preRematchText_reversed
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "trainers.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Items" => [:items, "*e", :Item],
|
||||
"LoseText" => [:lose_text, "s"],
|
||||
"Pokemon" => [:pokemon, "ev", :Species], # Species, level
|
||||
"Form" => [:form, "u"],
|
||||
"Name" => [:name, "s"],
|
||||
"Moves" => [:moves, "*e", :Move],
|
||||
"Ability" => [:ability, "s"],
|
||||
"AbilityIndex" => [:ability_index, "u"],
|
||||
"Item" => [:item, "e", :Item],
|
||||
"Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
|
||||
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }],
|
||||
"Nature" => [:nature, "e", :Nature],
|
||||
"IV" => [:iv, "uUUUUU"],
|
||||
"EV" => [:ev, "uUUUUU"],
|
||||
"Happiness" => [:happiness, "u"],
|
||||
"Shiny" => [:shininess, "b"],
|
||||
"Shadow" => [:shadowness, "b"],
|
||||
"Ball" => [:poke_ball, "s"],
|
||||
|
||||
"LoseTextRematch" => [:loseText_rematch, "s"],
|
||||
"PreRematchText" => [:preRematchText, "s"],
|
||||
"PreRematchText_caught" => [:preRematchText_caught, "s"],
|
||||
"PreRematchText_evolved" => [:preRematchText_evolved, "s"],
|
||||
"PreRematchText_fused" => [:preRematchText_fused, "s"],
|
||||
"PreRematchText_unfused" => [:preRematchText_unfused, "s"],
|
||||
"PreRematchText_reversed" => [:preRematchText_reversed, "s"],
|
||||
|
||||
|
||||
}
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
# @param tr_name [String]
|
||||
# @param tr_version [Integer, nil]
|
||||
# @return [Boolean] whether the given other is defined as a self
|
||||
def self.exists?(tr_type, tr_name, tr_version = 0)
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
return !self::DATA[key].nil?
|
||||
end
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
# @param tr_name [String]
|
||||
# @param tr_version [Integer, nil]
|
||||
# @return [self]
|
||||
def self.get(tr_type, tr_name, tr_version = 0)
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
raise "Unknown trainer #{tr_type} #{tr_name} #{tr_version}." unless self::DATA.has_key?(key)
|
||||
return self::DATA[key]
|
||||
end
|
||||
|
||||
def list_all
|
||||
return self::DATA
|
||||
end
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
# @param tr_name [String]
|
||||
# @param tr_version [Integer, nil]
|
||||
# @return [self, nil]
|
||||
def self.try_get(tr_type, tr_name, tr_version = 0)
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
return (self::DATA.has_key?(key)) ? self::DATA[key] : nil
|
||||
end
|
||||
|
||||
def self.list_all()
|
||||
return self::DATA
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number]
|
||||
@trainer_type = hash[:trainer_type]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@version = hash[:version] || 0
|
||||
@items = hash[:items] || []
|
||||
@real_lose_text = hash[:lose_text] || "..."
|
||||
@pokemon = hash[:pokemon] || []
|
||||
@pokemon.each do |pkmn|
|
||||
GameData::Stat.each_main do |s|
|
||||
pkmn[:iv][s.id] ||= 0 if pkmn[:iv]
|
||||
pkmn[:ev][s.id] ||= 0 if pkmn[:ev]
|
||||
end
|
||||
end
|
||||
|
||||
@loseText_rematch = hash[:loseText_rematch] || @real_lose_text
|
||||
@preRematchText = hash[:preRematchText] || "Are you up for a rematch? Or maybe you want to trade..."
|
||||
@preRematchText_caught = hash[:preRematchText_caught] || @preRematchText
|
||||
@preRematchText_evolved = hash[:preRematchText_evolved] || @preRematchText
|
||||
@preRematchText_fused = hash[:preRematchText_fused] || @preRematchText
|
||||
@preRematchText_unfused = hash[:preRematchText_unfused] || @preRematchText
|
||||
@preRematchText_reversed = hash[:preRematchText_reversed] || @preRematchText
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this trainer
|
||||
def name
|
||||
return pbGetMessageFromHash(MessageTypes::TrainerNames, @real_name)
|
||||
end
|
||||
|
||||
# @return [String] the translated in-battle lose message of this trainer
|
||||
def lose_text
|
||||
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @real_lose_text)
|
||||
end
|
||||
|
||||
def rematch_lose_text
|
||||
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @loseText_rematch)
|
||||
end
|
||||
|
||||
def preRematch_text_default
|
||||
return pbGetMessageFromHash(MessageTypes::BeginSpeech, @preRematchText)
|
||||
end
|
||||
|
||||
def preRematch_text_caught
|
||||
return pbGetMessageFromHash(MessageTypes::BeginSpeech, @preRematchText_caught)
|
||||
end
|
||||
|
||||
def preRematch_text_evolved
|
||||
return pbGetMessageFromHash(MessageTypes::BeginSpeech, @preRematchText_evolved)
|
||||
end
|
||||
|
||||
def preRematch_text_fused
|
||||
return pbGetMessageFromHash(MessageTypes::BeginSpeech, @preRematchText_fused)
|
||||
end
|
||||
|
||||
def preRematch_text_unfused
|
||||
return pbGetMessageFromHash(MessageTypes::BeginSpeech, @preRematchText_unfused)
|
||||
end
|
||||
|
||||
def preRematch_text_reversed
|
||||
return pbGetMessageFromHash(MessageTypes::BeginSpeech, @preRematchText_reversed)
|
||||
end
|
||||
|
||||
def replace_species_with_placeholder(species)
|
||||
case species
|
||||
when Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES
|
||||
return pbGet(Settings::RIVAL_STARTER_PLACEHOLDER_VARIABLE)
|
||||
when Settings::VAR_1_PLACEHOLDER_SPECIES
|
||||
return pbGet(1)
|
||||
when Settings::VAR_2_PLACEHOLDER_SPECIES
|
||||
return pbGet(2)
|
||||
when Settings::VAR_3_PLACEHOLDER_SPECIES
|
||||
return pbGet(3)
|
||||
end
|
||||
end
|
||||
|
||||
def generateRandomChampionSpecies(old_species)
|
||||
customsList = getCustomSpeciesList()
|
||||
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
|
||||
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
|
||||
#every pokemon should be fully evolved
|
||||
evolved_species_id = getEvolution(new_species)
|
||||
evolved_species_id = getEvolution(evolved_species_id)
|
||||
evolved_species_id = getEvolution(evolved_species_id)
|
||||
evolved_species_id = getEvolution(evolved_species_id)
|
||||
return getSpecies(evolved_species_id)
|
||||
end
|
||||
|
||||
def generateRandomGymSpecies(old_species)
|
||||
gym_index = pbGet(VAR_CURRENT_GYM_TYPE)
|
||||
return old_species if gym_index == -1
|
||||
return generateRandomChampionSpecies(old_species) if gym_index == 999
|
||||
type_id = pbGet(VAR_GYM_TYPES_ARRAY)[gym_index]
|
||||
return old_species if type_id == -1
|
||||
|
||||
customsList = getCustomSpeciesList()
|
||||
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
|
||||
gym_type = GameData::Type.get(type_id)
|
||||
while true
|
||||
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
|
||||
if new_species.hasType?(gym_type)
|
||||
return new_species
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
|
||||
return if !pokemonIndex
|
||||
return if !trainerId
|
||||
return if !species
|
||||
if $PokemonGlobal.randomGymTrainersHash == nil
|
||||
$PokemonGlobal.randomGymTrainersHash = {}
|
||||
end
|
||||
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS] && $PokemonGlobal.randomGymTrainersHash != nil
|
||||
if $PokemonGlobal.randomGymTrainersHash[trainerId] && $PokemonGlobal.randomGymTrainersHash[trainerId].length >= $PokemonGlobal.randomTrainersHash[trainerId].length
|
||||
newSpecies = getSpecies($PokemonGlobal.randomGymTrainersHash[trainerId][pokemonIndex])
|
||||
return newSpecies if newSpecies
|
||||
return species
|
||||
end
|
||||
end
|
||||
new_species = generateRandomGymSpecies(species)
|
||||
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS]
|
||||
add_generated_species_to_gym_array(new_species, trainerId)
|
||||
end
|
||||
return new_species
|
||||
end
|
||||
|
||||
def add_generated_species_to_gym_array(new_species, trainerId)
|
||||
if (new_species.is_a?(Symbol))
|
||||
id = new_species
|
||||
else
|
||||
id = new_species.id_number
|
||||
end
|
||||
|
||||
expected_team_length = 1
|
||||
expected_team_length = $PokemonGlobal.randomTrainersHash[trainerId].length if $PokemonGlobal.randomTrainersHash[trainerId]
|
||||
new_team = []
|
||||
if $PokemonGlobal.randomGymTrainersHash[trainerId]
|
||||
new_team = $PokemonGlobal.randomGymTrainersHash[trainerId]
|
||||
end
|
||||
if new_team.length < expected_team_length
|
||||
new_team << id
|
||||
end
|
||||
$PokemonGlobal.randomGymTrainersHash[trainerId] = new_team
|
||||
end
|
||||
|
||||
def replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
|
||||
if $PokemonGlobal.randomTrainersHash[trainerId] == nil
|
||||
Kernel.pbMessage(_INTL("The trainers need to be re-shuffled."))
|
||||
Kernel.pbShuffleTrainers()
|
||||
end
|
||||
new_species_dex = $PokemonGlobal.randomTrainersHash[trainerId][pokemonIndex]
|
||||
return getSpecies(new_species_dex)
|
||||
end
|
||||
|
||||
def isGymBattle
|
||||
return ($game_switches[SWITCH_RANDOM_TRAINERS] && ($game_variables[VAR_CURRENT_GYM_TYPE] != -1) || ($game_switches[SWITCH_FIRST_RIVAL_BATTLE] && $game_switches[SWITCH_RANDOM_STARTERS]))
|
||||
end
|
||||
|
||||
def replace_species_to_randomized(species, trainerId, pokemonIndex)
|
||||
return species if $game_switches[SWITCH_DONT_RANDOMIZE]
|
||||
return species if $game_switches[SWITCH_FIRST_RIVAL_BATTLE]
|
||||
return species if getDexNumberForSpecies(species) >= Settings::ZAPMOLCUNO_NB
|
||||
if isGymBattle() && $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY]
|
||||
return replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
|
||||
end
|
||||
return replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
|
||||
|
||||
end
|
||||
|
||||
def replaceSingleSpeciesModeIfApplicable(species)
|
||||
return species if getDexNumberForSpecies(species) >= Settings::ZAPMOLCUNO_NB
|
||||
if $game_switches[SWITCH_SINGLE_POKEMON_MODE]
|
||||
if $game_switches[SWITCH_SINGLE_POKEMON_MODE_HEAD]
|
||||
return replaceFusionsHeadWithSpecies(species)
|
||||
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_BODY]
|
||||
return replaceFusionsBodyWithSpecies(species)
|
||||
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_RANDOM]
|
||||
if (rand(2) == 0)
|
||||
return replaceFusionsHeadWithSpecies(species)
|
||||
else
|
||||
return replaceFusionsBodyWithSpecies(species)
|
||||
end
|
||||
end
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
def replaceFusionsHeadWithSpecies(species)
|
||||
speciesId = getDexNumberForSpecies(species)
|
||||
if speciesId > NB_POKEMON
|
||||
bodyPoke = getBodyID(speciesId)
|
||||
headPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
|
||||
newSpecies = bodyPoke * NB_POKEMON + headPoke
|
||||
return getPokemon(newSpecies)
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
def replaceFusionsBodyWithSpecies(species)
|
||||
speciesId = getDexNumberForSpecies(species)
|
||||
if speciesId > NB_POKEMON
|
||||
bodyPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
|
||||
headPoke = getHeadID(species)
|
||||
newSpecies = bodyPoke * NB_POKEMON + headPoke
|
||||
return getPokemon(newSpecies)
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
def to_trainer
|
||||
placeholder_species = [Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES,
|
||||
Settings::VAR_1_PLACEHOLDER_SPECIES,
|
||||
Settings::VAR_2_PLACEHOLDER_SPECIES,
|
||||
Settings::VAR_3_PLACEHOLDER_SPECIES]
|
||||
# Determine trainer's name
|
||||
tr_name = self.name
|
||||
Settings::RIVAL_NAMES.each do |rival|
|
||||
next if rival[0] != @trainer_type || !$game_variables[rival[1]].is_a?(String)
|
||||
tr_name = $game_variables[rival[1]]
|
||||
break
|
||||
end
|
||||
# Create trainer object
|
||||
trainer = NPCTrainer.new(tr_name, @trainer_type)
|
||||
trainer.id = $Trainer.make_foreign_ID
|
||||
trainer.items = @items.clone
|
||||
trainer.lose_text = self.lose_text
|
||||
|
||||
isRematch = $game_switches[SWITCH_IS_REMATCH]
|
||||
isPlayingRandomized = $game_switches[SWITCH_RANDOM_TRAINERS] && !$game_switches[SWITCH_FIRST_RIVAL_BATTLE]
|
||||
rematchId = getRematchId(trainer.name, trainer.trainer_type)
|
||||
|
||||
# Create each Pokémon owned by the trainer
|
||||
index = 0
|
||||
@pokemon.each do |pkmn_data|
|
||||
#replace placeholder species infinite fusion edit
|
||||
species = GameData::Species.get(pkmn_data[:species]).species
|
||||
original_species = species
|
||||
if placeholder_species.include?(species)
|
||||
species = replace_species_with_placeholder(species)
|
||||
else
|
||||
species = replace_species_to_randomized(species, self.id, index) if isPlayingRandomized
|
||||
end
|
||||
species = replaceSingleSpeciesModeIfApplicable(species)
|
||||
if $game_switches[SWITCH_REVERSED_MODE]
|
||||
species = reverseFusionSpecies(species)
|
||||
end
|
||||
level = pkmn_data[:level]
|
||||
if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
level = (level * Settings::HARD_MODE_LEVEL_MODIFIER).ceil
|
||||
if level > Settings::MAXIMUM_LEVEL
|
||||
level = Settings::MAXIMUM_LEVEL
|
||||
end
|
||||
end
|
||||
|
||||
if $game_switches[Settings::OVERRIDE_BATTLE_LEVEL_SWITCH]
|
||||
override_level = $game_variables[Settings::OVERRIDE_BATTLE_LEVEL_VALUE_VAR]
|
||||
if override_level.is_a?(Integer)
|
||||
level = override_level
|
||||
end
|
||||
end
|
||||
####
|
||||
|
||||
#trainer rematch infinite fusion edit
|
||||
if isRematch
|
||||
nbRematch = getNumberRematch(rematchId)
|
||||
level = getRematchLevel(level, nbRematch)
|
||||
species = getSpecies(evolveRematchPokemon(nbRematch, species)).id
|
||||
end
|
||||
pkmn = Pokemon.new(species, level, trainer, false)
|
||||
|
||||
trainer.party.push(pkmn)
|
||||
# Set Pokémon's properties if defined
|
||||
if pkmn_data[:form]
|
||||
pkmn.forced_form = pkmn_data[:form] if MultipleForms.hasFunction?(species, "getForm")
|
||||
pkmn.form_simple = pkmn_data[:form]
|
||||
end
|
||||
|
||||
if $game_switches[SWITCH_RANDOM_HELD_ITEMS]
|
||||
pkmn.item = pbGetRandomHeldItem().id
|
||||
else
|
||||
pkmn.item = pkmn_data[:item]
|
||||
end
|
||||
if pkmn_data[:moves] && pkmn_data[:moves].length > 0 && original_species == species
|
||||
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
|
||||
else
|
||||
pkmn.reset_moves
|
||||
end
|
||||
pkmn.ability_index = pkmn_data[:ability_index]
|
||||
pkmn.ability = pkmn_data[:ability]
|
||||
|
||||
if $game_switches[SWITCH_DOUBLE_ABILITIES] && pkmn.isFusion?
|
||||
secondary_ability_index = pkmn.ability_index == 0 ? 1 : 0
|
||||
pkmn.ability2_index = secondary_ability_index
|
||||
pkmn.ability2 = pkmn.getAbilityList[secondary_ability_index][0]
|
||||
#print _INTL("Primary: {1}, Secondary: {2}",pkmn.ability.id, pkmn.ability2.id)
|
||||
end
|
||||
|
||||
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
|
||||
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
|
||||
if pkmn_data[:nature]
|
||||
pkmn.nature = pkmn_data[:nature]
|
||||
else
|
||||
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainer_type).id_number
|
||||
pkmn.nature = nature % (GameData::Nature::DATA.length / 2)
|
||||
end
|
||||
GameData::Stat.each_main do |s|
|
||||
if pkmn_data[:iv]
|
||||
pkmn.iv[s.id] = pkmn_data[:iv][s.id]
|
||||
else
|
||||
pkmn.iv[s.id] = [pkmn_data[:level] / 2, Pokemon::IV_STAT_LIMIT].min
|
||||
end
|
||||
if pkmn_data[:ev]
|
||||
pkmn.ev[s.id] = pkmn_data[:ev][s.id]
|
||||
else
|
||||
pkmn.ev[s.id] = [pkmn_data[:level] * 3 / 2, Pokemon::EV_LIMIT / 6].min
|
||||
end
|
||||
end
|
||||
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]
|
||||
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
|
||||
if pkmn_data[:shadowness]
|
||||
pkmn.makeShadow
|
||||
pkmn.update_shadow_moves(true)
|
||||
pkmn.shiny = false
|
||||
end
|
||||
pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
|
||||
pkmn.calc_stats
|
||||
|
||||
index += 1
|
||||
end
|
||||
return trainer
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetTrainerData(tr_type, tr_name, tr_version = 0)
|
||||
Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)')
|
||||
return GameData::Trainer.get(tr_type, tr_name, tr_version)
|
||||
end
|
||||
14
Data/Scripts/010_Data/002_PBS data/013_TrainerExpert.rb
Normal file
14
Data/Scripts/010_Data/002_PBS data/013_TrainerExpert.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module GameData
|
||||
class TrainerExpert < Trainer
|
||||
DATA_FILENAME = "trainers_expert.dat"
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetTrainerData(tr_type, tr_name, tr_version = 0)
|
||||
Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)')
|
||||
return GameData::Trainer.get(tr_type, tr_name, tr_version)
|
||||
end
|
||||
369
Data/Scripts/010_Data/002_PBS data/013_TrainerModern.rb
Normal file
369
Data/Scripts/010_Data/002_PBS data/013_TrainerModern.rb
Normal file
@@ -0,0 +1,369 @@
|
||||
module GameData
|
||||
class TrainerModern
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :trainer_type
|
||||
attr_reader :real_name
|
||||
attr_reader :version
|
||||
attr_reader :items
|
||||
attr_reader :real_lose_text
|
||||
attr_reader :pokemon
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "trainers_remix.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Items" => [:items, "*e", :Item],
|
||||
"LoseText" => [:lose_text, "s"],
|
||||
"Pokemon" => [:pokemon, "ev", :Species], # Species, level
|
||||
"Form" => [:form, "u"],
|
||||
"Name" => [:name, "s"],
|
||||
"Moves" => [:moves, "*e", :Move],
|
||||
"Ability" => [:ability, "s"],
|
||||
"AbilityIndex" => [:ability_index, "u"],
|
||||
"Item" => [:item, "e", :Item],
|
||||
"Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
|
||||
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }],
|
||||
"Nature" => [:nature, "e", :Nature],
|
||||
"IV" => [:iv, "uUUUUU"],
|
||||
"EV" => [:ev, "uUUUUU"],
|
||||
"Happiness" => [:happiness, "u"],
|
||||
"Shiny" => [:shininess, "b"],
|
||||
"Shadow" => [:shadowness, "b"],
|
||||
"Ball" => [:poke_ball, "s"],
|
||||
}
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
# @param tr_name [String]
|
||||
# @param tr_version [Integer, nil]
|
||||
# @return [Boolean] whether the given other is defined as a self
|
||||
def self.exists?(tr_type, tr_name, tr_version = 0)
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
return !self::DATA[key].nil?
|
||||
end
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
# @param tr_name [String]
|
||||
# @param tr_version [Integer, nil]
|
||||
# @return [self]
|
||||
def self.get(tr_type, tr_name, tr_version = 0)
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
raise "Unknown trainer #{tr_type} #{tr_name} #{tr_version}." unless self::DATA.has_key?(key)
|
||||
return self::DATA[key]
|
||||
end
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
# @param tr_name [String]
|
||||
# @param tr_version [Integer, nil]
|
||||
# @return [self, nil]
|
||||
def self.try_get(tr_type, tr_name, tr_version = 0)
|
||||
validate tr_type => [Symbol, String]
|
||||
validate tr_name => [String]
|
||||
key = [tr_type.to_sym, tr_name, tr_version]
|
||||
return (self::DATA.has_key?(key)) ? self::DATA[key] : nil
|
||||
end
|
||||
|
||||
def self.list_all()
|
||||
return self::DATA
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number]
|
||||
@trainer_type = hash[:trainer_type]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@version = hash[:version] || 0
|
||||
@items = hash[:items] || []
|
||||
@real_lose_text = hash[:lose_text] || "..."
|
||||
@pokemon = hash[:pokemon] || []
|
||||
@pokemon.each do |pkmn|
|
||||
GameData::Stat.each_main do |s|
|
||||
pkmn[:iv][s.id] ||= 0 if pkmn[:iv]
|
||||
pkmn[:ev][s.id] ||= 0 if pkmn[:ev]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this trainer
|
||||
def name
|
||||
return pbGetMessageFromHash(MessageTypes::TrainerNames, @real_name)
|
||||
end
|
||||
|
||||
# @return [String] the translated in-battle lose message of this trainer
|
||||
def lose_text
|
||||
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @real_lose_text)
|
||||
end
|
||||
|
||||
def replace_species_with_placeholder(species)
|
||||
case species
|
||||
when Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES
|
||||
return pbGet(Settings::RIVAL_STARTER_PLACEHOLDER_VARIABLE)
|
||||
when Settings::VAR_1_PLACEHOLDER_SPECIES
|
||||
return pbGet(1)
|
||||
when Settings::VAR_2_PLACEHOLDER_SPECIES
|
||||
return pbGet(2)
|
||||
when Settings::VAR_3_PLACEHOLDER_SPECIES
|
||||
return pbGet(3)
|
||||
end
|
||||
end
|
||||
|
||||
def generateRandomChampionSpecies(old_species)
|
||||
customsList = getCustomSpeciesList()
|
||||
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
|
||||
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
|
||||
#every pokemon should be fully evolved
|
||||
evolved_species_id = getEvolution(new_species)
|
||||
evolved_species_id = getEvolution(evolved_species_id)
|
||||
evolved_species_id = getEvolution(evolved_species_id)
|
||||
evolved_species_id = getEvolution(evolved_species_id)
|
||||
return getSpecies(evolved_species_id)
|
||||
end
|
||||
|
||||
def generateRandomGymSpecies(old_species)
|
||||
gym_index = pbGet(VAR_CURRENT_GYM_TYPE)
|
||||
return old_species if gym_index == -1
|
||||
return generateRandomChampionSpecies(old_species) if gym_index == 999
|
||||
type_id = pbGet(VAR_GYM_TYPES_ARRAY)[gym_index]
|
||||
return old_species if type_id == -1
|
||||
|
||||
customsList = getCustomSpeciesList()
|
||||
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
|
||||
gym_type = GameData::Type.get(type_id)
|
||||
while true
|
||||
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
|
||||
if new_species.hasType?(gym_type)
|
||||
return new_species
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
|
||||
if $PokemonGlobal.randomGymTrainersHash == nil
|
||||
$PokemonGlobal.randomGymTrainersHash = {}
|
||||
end
|
||||
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS] && $PokemonGlobal.randomGymTrainersHash != nil
|
||||
if $PokemonGlobal.randomGymTrainersHash[trainerId] != nil && $PokemonGlobal.randomGymTrainersHash[trainerId].length >= $PokemonGlobal.randomTrainersHash[trainerId].length
|
||||
return getSpecies($PokemonGlobal.randomGymTrainersHash[trainerId][pokemonIndex])
|
||||
end
|
||||
end
|
||||
new_species = generateRandomGymSpecies(species)
|
||||
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS]
|
||||
add_generated_species_to_gym_array(new_species, trainerId)
|
||||
end
|
||||
return new_species
|
||||
end
|
||||
|
||||
def add_generated_species_to_gym_array(new_species, trainerId)
|
||||
if (new_species.is_a?(Symbol))
|
||||
id = new_species
|
||||
else
|
||||
id = new_species.id_number
|
||||
end
|
||||
|
||||
expected_team_length = 1
|
||||
expected_team_length = $PokemonGlobal.randomTrainersHash[trainerId].length if $PokemonGlobal.randomTrainersHash[trainerId]
|
||||
new_team = []
|
||||
if $PokemonGlobal.randomGymTrainersHash[trainerId]
|
||||
new_team = $PokemonGlobal.randomGymTrainersHash[trainerId]
|
||||
end
|
||||
if new_team.length < expected_team_length
|
||||
new_team << id
|
||||
end
|
||||
$PokemonGlobal.randomGymTrainersHash[trainerId] = new_team
|
||||
end
|
||||
|
||||
def replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
|
||||
if $PokemonGlobal.randomTrainersHash[trainerId] == nil
|
||||
Kernel.pbMessage(_INTL("The trainers need to be re-shuffled."))
|
||||
Kernel.pbShuffleTrainers()
|
||||
end
|
||||
new_species_dex = $PokemonGlobal.randomTrainersHash[trainerId][pokemonIndex]
|
||||
return getSpecies(new_species_dex)
|
||||
end
|
||||
|
||||
def isGymBattle
|
||||
return ($game_switches[SWITCH_RANDOM_TRAINERS] && ($game_variables[VAR_CURRENT_GYM_TYPE] != -1) || ($game_switches[SWITCH_FIRST_RIVAL_BATTLE] && $game_switches[SWITCH_RANDOM_STARTERS]))
|
||||
end
|
||||
|
||||
def replace_species_to_randomized(species, trainerId, pokemonIndex)
|
||||
return species if $game_switches[SWITCH_FIRST_RIVAL_BATTLE]
|
||||
return species if $game_switches[SWITCH_DONT_RANDOMIZE]
|
||||
if isGymBattle() && $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY]
|
||||
return replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
|
||||
end
|
||||
return replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
|
||||
|
||||
end
|
||||
|
||||
def replaceSingleSpeciesModeIfApplicable(species)
|
||||
if $game_switches[SWITCH_SINGLE_POKEMON_MODE]
|
||||
if $game_switches[SWITCH_SINGLE_POKEMON_MODE_HEAD]
|
||||
return replaceFusionsHeadWithSpecies(species)
|
||||
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_BODY]
|
||||
return replaceFusionsBodyWithSpecies(species)
|
||||
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_RANDOM]
|
||||
if (rand(2) == 0)
|
||||
return replaceFusionsHeadWithSpecies(species)
|
||||
else
|
||||
return replaceFusionsBodyWithSpecies(species)
|
||||
end
|
||||
end
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
def replaceFusionsHeadWithSpecies(species)
|
||||
speciesId = getDexNumberForSpecies(species)
|
||||
if speciesId > NB_POKEMON
|
||||
bodyPoke = getBodyID(speciesId)
|
||||
headPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
|
||||
newSpecies = bodyPoke * NB_POKEMON + headPoke
|
||||
return getPokemon(newSpecies)
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
def replaceFusionsBodyWithSpecies(species)
|
||||
speciesId = getDexNumberForSpecies(species)
|
||||
if speciesId > NB_POKEMON
|
||||
bodyPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
|
||||
headPoke = getHeadID(species)
|
||||
newSpecies = bodyPoke * NB_POKEMON + headPoke
|
||||
return getPokemon(newSpecies)
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
def to_trainer
|
||||
placeholder_species = [Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES,
|
||||
Settings::VAR_1_PLACEHOLDER_SPECIES,
|
||||
Settings::VAR_2_PLACEHOLDER_SPECIES,
|
||||
Settings::VAR_3_PLACEHOLDER_SPECIES]
|
||||
# Determine trainer's name
|
||||
tr_name = self.name
|
||||
Settings::RIVAL_NAMES.each do |rival|
|
||||
next if rival[0] != @trainer_type || !$game_variables[rival[1]].is_a?(String)
|
||||
tr_name = $game_variables[rival[1]]
|
||||
break
|
||||
end
|
||||
# Create trainer object
|
||||
trainer = NPCTrainer.new(tr_name, @trainer_type)
|
||||
trainer.id = $Trainer.make_foreign_ID
|
||||
trainer.items = @items.clone
|
||||
trainer.lose_text = self.lose_text
|
||||
|
||||
isRematch = $game_switches[SWITCH_IS_REMATCH]
|
||||
isPlayingRandomized = $game_switches[SWITCH_RANDOM_TRAINERS] && !$game_switches[SWITCH_FIRST_RIVAL_BATTLE]
|
||||
rematchId = getRematchId(trainer.name, trainer.trainer_type)
|
||||
|
||||
# Create each Pokémon owned by the trainer
|
||||
index = 0
|
||||
@pokemon.each do |pkmn_data|
|
||||
#replace placeholder species infinite fusion edit
|
||||
species = GameData::Species.get(pkmn_data[:species]).species
|
||||
original_species = species
|
||||
if placeholder_species.include?(species)
|
||||
species = replace_species_with_placeholder(species)
|
||||
else
|
||||
species = replace_species_to_randomized(species, self.id, index) if isPlayingRandomized
|
||||
end
|
||||
species = replaceSingleSpeciesModeIfApplicable(species)
|
||||
if $game_switches[SWITCH_REVERSED_MODE]
|
||||
species = reverseFusionSpecies(species)
|
||||
end
|
||||
level = pkmn_data[:level]
|
||||
if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
level = (level * Settings::HARD_MODE_LEVEL_MODIFIER).ceil
|
||||
if level > Settings::MAXIMUM_LEVEL
|
||||
level = Settings::MAXIMUM_LEVEL
|
||||
end
|
||||
end
|
||||
|
||||
if $game_switches[Settings::OVERRIDE_BATTLE_LEVEL_SWITCH]
|
||||
override_level = $game_variables[Settings::OVERRIDE_BATTLE_LEVEL_VALUE_VAR]
|
||||
if override_level.is_a?(Integer)
|
||||
level = override_level
|
||||
end
|
||||
end
|
||||
####
|
||||
|
||||
#trainer rematch infinite fusion edit
|
||||
if isRematch
|
||||
nbRematch = getNumberRematch(rematchId)
|
||||
level = getRematchLevel(level, nbRematch)
|
||||
species = evolveRematchPokemon(nbRematch, species)
|
||||
end
|
||||
|
||||
pkmn = Pokemon.new(species, level, trainer, false)
|
||||
|
||||
trainer.party.push(pkmn)
|
||||
# Set Pokémon's properties if defined
|
||||
if pkmn_data[:form]
|
||||
pkmn.forced_form = pkmn_data[:form] if MultipleForms.hasFunction?(species, "getForm")
|
||||
pkmn.form_simple = pkmn_data[:form]
|
||||
end
|
||||
|
||||
if $game_switches[SWITCH_RANDOM_HELD_ITEMS]
|
||||
pkmn.item = pbGetRandomHeldItem().id
|
||||
else
|
||||
pkmn.item = pkmn_data[:item]
|
||||
end
|
||||
if pkmn_data[:moves] && pkmn_data[:moves].length > 0 && original_species == species
|
||||
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
|
||||
else
|
||||
pkmn.reset_moves
|
||||
end
|
||||
pkmn.ability_index = pkmn_data[:ability_index]
|
||||
pkmn.ability = pkmn_data[:ability]
|
||||
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
|
||||
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
|
||||
if pkmn_data[:nature]
|
||||
pkmn.nature = pkmn_data[:nature]
|
||||
else
|
||||
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainer_type).id_number
|
||||
pkmn.nature = nature % (GameData::Nature::DATA.length / 2)
|
||||
end
|
||||
GameData::Stat.each_main do |s|
|
||||
if pkmn_data[:iv]
|
||||
pkmn.iv[s.id] = pkmn_data[:iv][s.id]
|
||||
else
|
||||
pkmn.iv[s.id] = [pkmn_data[:level] / 2, Pokemon::IV_STAT_LIMIT].min
|
||||
end
|
||||
if pkmn_data[:ev]
|
||||
pkmn.ev[s.id] = pkmn_data[:ev][s.id]
|
||||
else
|
||||
pkmn.ev[s.id] = [pkmn_data[:level] * 3 / 2, Pokemon::EV_LIMIT / 6].min
|
||||
end
|
||||
end
|
||||
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]
|
||||
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
|
||||
if pkmn_data[:shadowness]
|
||||
pkmn.makeShadow
|
||||
pkmn.update_shadow_moves(true)
|
||||
pkmn.shiny = false
|
||||
end
|
||||
pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
|
||||
pkmn.calc_stats
|
||||
|
||||
index += 1
|
||||
end
|
||||
return trainer
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetTrainerData(tr_type, tr_name, tr_version = 0)
|
||||
Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)')
|
||||
return GameData::Trainer.get(tr_type, tr_name, tr_version)
|
||||
end
|
||||
147
Data/Scripts/010_Data/002_PBS data/014_Metadata.rb
Normal file
147
Data/Scripts/010_Data/002_PBS data/014_Metadata.rb
Normal file
@@ -0,0 +1,147 @@
|
||||
module GameData
|
||||
class Metadata
|
||||
attr_reader :id
|
||||
attr_reader :home
|
||||
attr_reader :wild_battle_BGM
|
||||
attr_reader :trainer_battle_BGM
|
||||
attr_reader :wild_victory_ME
|
||||
attr_reader :trainer_victory_ME
|
||||
attr_reader :wild_capture_ME
|
||||
attr_reader :surf_BGM
|
||||
attr_reader :bicycle_BGM
|
||||
attr_reader :player_A
|
||||
attr_reader :player_B
|
||||
attr_reader :player_C
|
||||
attr_reader :player_D
|
||||
attr_reader :player_E
|
||||
attr_reader :player_F
|
||||
attr_reader :player_G
|
||||
attr_reader :player_H
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "metadata.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Home" => [1, "vuuu"],
|
||||
"WildBattleBGM" => [2, "s"],
|
||||
"TrainerBattleBGM" => [3, "s"],
|
||||
"WildVictoryME" => [4, "s"],
|
||||
"TrainerVictoryME" => [5, "s"],
|
||||
"WildCaptureME" => [6, "s"],
|
||||
"SurfBGM" => [7, "s"],
|
||||
"BicycleBGM" => [8, "s"],
|
||||
"PlayerA" => [9, "esssssss", :TrainerType],
|
||||
"PlayerB" => [10, "esssssss", :TrainerType],
|
||||
"PlayerC" => [11, "esssssss", :TrainerType],
|
||||
"PlayerD" => [12, "esssssss", :TrainerType],
|
||||
"PlayerE" => [13, "esssssss", :TrainerType],
|
||||
"PlayerF" => [14, "esssssss", :TrainerType],
|
||||
"PlayerG" => [15, "esssssss", :TrainerType],
|
||||
"PlayerH" => [16, "esssssss", :TrainerType]
|
||||
}
|
||||
|
||||
extend ClassMethodsIDNumbers
|
||||
include InstanceMethods
|
||||
|
||||
def self.editor_properties
|
||||
return [
|
||||
["Home", MapCoordsFacingProperty, _INTL("Map ID and X and Y coordinates of where the player goes if no Pokémon Center was entered after a loss.")],
|
||||
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles.")],
|
||||
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for Trainer battles.")],
|
||||
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle.")],
|
||||
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle.")],
|
||||
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a Pokémon.")],
|
||||
["SurfBGM", BGMProperty, _INTL("BGM played while surfing.")],
|
||||
["BicycleBGM", BGMProperty, _INTL("BGM played while on a bicycle.")],
|
||||
["PlayerA", PlayerProperty, _INTL("Specifies player A.")],
|
||||
["PlayerB", PlayerProperty, _INTL("Specifies player B.")],
|
||||
["PlayerC", PlayerProperty, _INTL("Specifies player C.")],
|
||||
["PlayerD", PlayerProperty, _INTL("Specifies player D.")],
|
||||
["PlayerE", PlayerProperty, _INTL("Specifies player E.")],
|
||||
["PlayerF", PlayerProperty, _INTL("Specifies player F.")],
|
||||
["PlayerG", PlayerProperty, _INTL("Specifies player G.")],
|
||||
["PlayerH", PlayerProperty, _INTL("Specifies player H.")]
|
||||
]
|
||||
end
|
||||
|
||||
def self.get
|
||||
return DATA[0]
|
||||
end
|
||||
|
||||
def self.get_player(id)
|
||||
return self.get.player_A
|
||||
case id
|
||||
when 0 then return self.get.player_A
|
||||
when 1 then return self.get.player_B
|
||||
when 2 then return self.get.player_C
|
||||
when 3 then return self.get.player_D
|
||||
when 4 then return self.get.player_E
|
||||
when 5 then return self.get.player_F
|
||||
when 6 then return self.get.player_G
|
||||
when 7 then return self.get.player_H
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@home = hash[:home]
|
||||
@wild_battle_BGM = hash[:wild_battle_BGM]
|
||||
@trainer_battle_BGM = hash[:trainer_battle_BGM]
|
||||
@wild_victory_ME = hash[:wild_victory_ME]
|
||||
@trainer_victory_ME = hash[:trainer_victory_ME]
|
||||
@wild_capture_ME = hash[:wild_capture_ME]
|
||||
@surf_BGM = hash[:surf_BGM]
|
||||
@bicycle_BGM = hash[:bicycle_BGM]
|
||||
@player_A = hash[:player_A]
|
||||
@player_B = hash[:player_B]
|
||||
@player_C = hash[:player_C]
|
||||
@player_D = hash[:player_D]
|
||||
@player_E = hash[:player_E]
|
||||
@player_F = hash[:player_F]
|
||||
@player_G = hash[:player_G]
|
||||
@player_H = hash[:player_H]
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "Home" then return @home
|
||||
when "WildBattleBGM" then return @wild_battle_BGM
|
||||
when "TrainerBattleBGM" then return @trainer_battle_BGM
|
||||
when "WildVictoryME" then return @wild_victory_ME
|
||||
when "TrainerVictoryME" then return @trainer_victory_ME
|
||||
when "WildCaptureME" then return @wild_capture_ME
|
||||
when "SurfBGM" then return @surf_BGM
|
||||
when "BicycleBGM" then return @bicycle_BGM
|
||||
when "PlayerA" then return @player_A
|
||||
when "PlayerB" then return @player_B
|
||||
when "PlayerC" then return @player_C
|
||||
when "PlayerD" then return @player_D
|
||||
when "PlayerE" then return @player_E
|
||||
when "PlayerF" then return @player_F
|
||||
when "PlayerG" then return @player_G
|
||||
when "PlayerH" then return @player_H
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbLoadMetadata
|
||||
Deprecation.warn_method('pbLoadMetadata', 'v20', 'GameData::Metadata.get or GameData::MapMetadata.get(map_id)')
|
||||
return nil
|
||||
end
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbGetMetadata(map_id, metadata_type)
|
||||
if map_id == 0 # Global metadata
|
||||
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::Metadata.get.something')
|
||||
else # Map metadata
|
||||
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::MapMetadata.get(map_id).something')
|
||||
end
|
||||
return nil
|
||||
end
|
||||
129
Data/Scripts/010_Data/002_PBS data/015_MapMetadata.rb
Normal file
129
Data/Scripts/010_Data/002_PBS data/015_MapMetadata.rb
Normal file
@@ -0,0 +1,129 @@
|
||||
module GameData
|
||||
class MapMetadata
|
||||
attr_reader :id
|
||||
attr_reader :outdoor_map
|
||||
attr_reader :announce_location
|
||||
attr_reader :can_bicycle
|
||||
attr_reader :always_bicycle
|
||||
attr_reader :teleport_destination
|
||||
attr_reader :weather
|
||||
attr_reader :town_map_position
|
||||
attr_reader :dive_map_id
|
||||
attr_reader :dark_map
|
||||
attr_reader :safari_map
|
||||
attr_reader :snap_edges
|
||||
attr_reader :random_dungeon
|
||||
attr_reader :battle_background
|
||||
attr_reader :wild_battle_BGM
|
||||
attr_reader :trainer_battle_BGM
|
||||
attr_reader :wild_victory_ME
|
||||
attr_reader :trainer_victory_ME
|
||||
attr_reader :wild_capture_ME
|
||||
attr_reader :town_map_size
|
||||
attr_reader :battle_environment
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "map_metadata.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Outdoor" => [1, "b"],
|
||||
"ShowArea" => [2, "b"],
|
||||
"Bicycle" => [3, "b"],
|
||||
"BicycleAlways" => [4, "b"],
|
||||
"HealingSpot" => [5, "vuu"],
|
||||
"Weather" => [6, "eu", :Weather],
|
||||
"MapPosition" => [7, "uuu"],
|
||||
"DiveMap" => [8, "v"],
|
||||
"DarkMap" => [9, "b"],
|
||||
"SafariMap" => [10, "b"],
|
||||
"SnapEdges" => [11, "b"],
|
||||
"Dungeon" => [12, "b"],
|
||||
"BattleBack" => [13, "s"],
|
||||
"WildBattleBGM" => [14, "s"],
|
||||
"TrainerBattleBGM" => [15, "s"],
|
||||
"WildVictoryME" => [16, "s"],
|
||||
"TrainerVictoryME" => [17, "s"],
|
||||
"WildCaptureME" => [18, "s"],
|
||||
"MapSize" => [19, "us"],
|
||||
"Environment" => [20, "e", :Environment]
|
||||
}
|
||||
|
||||
extend ClassMethodsIDNumbers
|
||||
include InstanceMethods
|
||||
|
||||
def self.editor_properties
|
||||
return [
|
||||
["Outdoor", BooleanProperty, _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")],
|
||||
["ShowArea", BooleanProperty, _INTL("If true, the game will display the map's name upon entry.")],
|
||||
["Bicycle", BooleanProperty, _INTL("If true, the bicycle can be used on this map.")],
|
||||
["BicycleAlways", BooleanProperty, _INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
|
||||
["HealingSpot", MapCoordsProperty, _INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")],
|
||||
["Weather", WeatherEffectProperty, _INTL("Weather conditions in effect for this map.")],
|
||||
["MapPosition", RegionMapCoordsProperty, _INTL("Identifies the point on the regional map for this map.")],
|
||||
["DiveMap", MapProperty, _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
|
||||
["DarkMap", BooleanProperty, _INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
|
||||
["SafariMap", BooleanProperty, _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
|
||||
["SnapEdges", BooleanProperty, _INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
|
||||
["Dungeon", BooleanProperty, _INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
|
||||
["BattleBack", StringProperty, _INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")],
|
||||
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles on this map.")],
|
||||
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for trainer battles on this map.")],
|
||||
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle on this map.")],
|
||||
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle on this map.")],
|
||||
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a wild Pokémon on this map.")],
|
||||
["MapSize", MapSizeProperty, _INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
|
||||
["Environment", GameDataProperty.new(:Environment), _INTL("The default battle environment for battles on this map.")]
|
||||
]
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@outdoor_map = hash[:outdoor_map]
|
||||
@announce_location = hash[:announce_location]
|
||||
@can_bicycle = hash[:can_bicycle]
|
||||
@always_bicycle = hash[:always_bicycle]
|
||||
@teleport_destination = hash[:teleport_destination]
|
||||
@weather = hash[:weather]
|
||||
@town_map_position = hash[:town_map_position]
|
||||
@dive_map_id = hash[:dive_map_id]
|
||||
@dark_map = hash[:dark_map]
|
||||
@safari_map = hash[:safari_map]
|
||||
@snap_edges = hash[:snap_edges]
|
||||
@random_dungeon = hash[:random_dungeon]
|
||||
@battle_background = hash[:battle_background]
|
||||
@wild_battle_BGM = hash[:wild_battle_BGM]
|
||||
@trainer_battle_BGM = hash[:trainer_battle_BGM]
|
||||
@wild_victory_ME = hash[:wild_victory_ME]
|
||||
@trainer_victory_ME = hash[:trainer_victory_ME]
|
||||
@wild_capture_ME = hash[:wild_capture_ME]
|
||||
@town_map_size = hash[:town_map_size]
|
||||
@battle_environment = hash[:battle_environment]
|
||||
end
|
||||
|
||||
def property_from_string(str)
|
||||
case str
|
||||
when "Outdoor" then return @outdoor_map
|
||||
when "ShowArea" then return @announce_location
|
||||
when "Bicycle" then return @can_bicycle
|
||||
when "BicycleAlways" then return @always_bicycle
|
||||
when "HealingSpot" then return @teleport_destination
|
||||
when "Weather" then return @weather
|
||||
when "MapPosition" then return @town_map_position
|
||||
when "DiveMap" then return @dive_map_id
|
||||
when "DarkMap" then return @dark_map
|
||||
when "SafariMap" then return @safari_map
|
||||
when "SnapEdges" then return @snap_edges
|
||||
when "Dungeon" then return @random_dungeon
|
||||
when "BattleBack" then return @battle_background
|
||||
when "WildBattleBGM" then return @wild_battle_BGM
|
||||
when "TrainerBattleBGM" then return @trainer_battle_BGM
|
||||
when "WildVictoryME" then return @wild_victory_ME
|
||||
when "TrainerVictoryME" then return @trainer_victory_ME
|
||||
when "WildCaptureME" then return @wild_capture_ME
|
||||
when "MapSize" then return @town_map_size
|
||||
when "Environment" then return @battle_environment
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user