mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Commented out support for ID numbers in Pokémon filenames, added class GameData::EggGroup
This commit is contained in:
31
Data/Scripts/011_Data/001_PBS data/002_Ability.rb
Normal file
31
Data/Scripts/011_Data/001_PBS data/002_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
|
||||
310
Data/Scripts/011_Data/001_PBS data/003_Item.rb
Normal file
310
Data/Scripts/011_Data/001_PBS data/003_Item.rb
Normal file
@@ -0,0 +1,310 @@
|
||||
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)
|
||||
ret = sprintf("Graphics/Items/%03d", item_data.id_number)
|
||||
return ret if pbResolveBitmap(ret)
|
||||
# Check for TM/HM type icons
|
||||
if item_data.is_machine?
|
||||
move_type = GameData::Move.get(item_data.move).type
|
||||
type_data = GameData::Type.get(move_type)
|
||||
ret = sprintf("Graphics/Items/machine_%s", type_data.id)
|
||||
return ret if pbResolveBitmap(ret)
|
||||
ret = sprintf("Graphics/Items/machine_%03d", type_data.id_number)
|
||||
return ret if pbResolveBitmap(ret)
|
||||
end
|
||||
return "Graphics/Items/000"
|
||||
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)
|
||||
ret = sprintf("Graphics/Pictures/Party/icon_%s_%03d", name_base, item_data.id_number)
|
||||
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 ret if pbResolveBitmap(ret)
|
||||
ret = sprintf("Graphics/Pictures/Mail/mail_%03d", item_data.id_number)
|
||||
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 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 && $PokemonGlobal.snagMachine); 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
|
||||
|
||||
def is_important?
|
||||
return true if is_key_item? || is_HM? || is_TM?
|
||||
return false
|
||||
end
|
||||
|
||||
def can_hold?; return !is_important?; end
|
||||
|
||||
def unlosable?(species, ability)
|
||||
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/011_Data/001_PBS data/004_Berry plant.rb
Normal file
36
Data/Scripts/011_Data/001_PBS data/004_Berry plant.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
|
||||
146
Data/Scripts/011_Data/001_PBS data/005_Metadata.rb
Normal file
146
Data/Scripts/011_Data/001_PBS data/005_Metadata.rb
Normal file
@@ -0,0 +1,146 @@
|
||||
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)
|
||||
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/011_Data/001_PBS data/006_Map metadata.rb
Normal file
129
Data/Scripts/011_Data/001_PBS data/006_Map metadata.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", :PBFieldWeather],
|
||||
"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", :PBEnvironment]
|
||||
}
|
||||
|
||||
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", EnumProperty2.new(PBEnvironment), _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
|
||||
85
Data/Scripts/011_Data/001_PBS data/007_Move.rb
Normal file
85
Data/Scripts/011_Data/001_PBS data/007_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
|
||||
151
Data/Scripts/011_Data/001_PBS data/008_Trainer type.rb
Normal file
151
Data/Scripts/011_Data/001_PBS data/008_Trainer type.rb
Normal file
@@ -0,0 +1,151 @@
|
||||
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.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/trchar")
|
||||
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)
|
||||
return self.check_file(tr_type, "Graphics/Trainers/")
|
||||
end
|
||||
|
||||
def self.player_front_sprite_filename(tr_type)
|
||||
outfit = ($Trainer) ? $Trainer.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/", nil, "_back")
|
||||
end
|
||||
|
||||
def self.player_back_sprite_filename(tr_type)
|
||||
outfit = ($Trainer) ? $Trainer.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
|
||||
58
Data/Scripts/011_Data/001_PBS data/009_Type.rb
Normal file
58
Data/Scripts/011_Data/001_PBS data/009_Type.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
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 PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if !other_type
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if @weaknesses.include?(other_type)
|
||||
return PBTypeEffectiveness::NOT_EFFECTIVE_ONE if @resistances.include?(other_type)
|
||||
return PBTypeEffectiveness::INEFFECTIVE if @immunities.include?(other_type)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
end
|
||||
end
|
||||
260
Data/Scripts/011_Data/001_PBS data/010_Species.rb
Normal file
260
Data/Scripts/011_Data/001_PBS data/010_Species.rb
Normal file
@@ -0,0 +1,260 @@
|
||||
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_rate
|
||||
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
|
||||
|
||||
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 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", :PBColors],
|
||||
"Shape" => [0, "u"],
|
||||
"Habitat" => [0, "e", :PBHabitats],
|
||||
"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, :PBEvolution, 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", :PBGrowthRates]
|
||||
ret["GenderRate"] = [0, "e", :PBGenderRates]
|
||||
ret["Incense"] = [0, "e", :Item]
|
||||
ret["Evolutions"] = [0, "*ses", nil, :PBEvolution, 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] || [1, 1, 1, 1, 1, 1]
|
||||
@evs = hash[:evs] || [0, 0, 0, 0, 0, 0]
|
||||
@base_exp = hash[:base_exp] || 100
|
||||
@growth_rate = hash[:growth_rate] || PBGrowthRates::Medium
|
||||
@gender_rate = hash[:gender_rate] || PBGenderRates::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] || PBColors::Red
|
||||
@shape = hash[:shape] || 1
|
||||
@habitat = hash[:habitat] || PBHabitats::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
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this species
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Species, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this form of this species
|
||||
def form_name
|
||||
return pbGetMessage(MessageTypes::FormNames, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated Pokédex category of this species
|
||||
def category
|
||||
return pbGetMessage(MessageTypes::Kinds, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated Pokédex entry of this species
|
||||
def pokedex_entry
|
||||
return pbGetMessage(MessageTypes::Entries, @id_number)
|
||||
end
|
||||
|
||||
def apply_metrics_to_sprite(sprite, index, shadow = false)
|
||||
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
|
||||
else # Foe Pokémon
|
||||
sprite.x += @front_sprite_x * 2
|
||||
sprite.y += @front_sprite_y * 2
|
||||
sprite.y -= @front_sprite_altitude * 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def shows_shadow?
|
||||
return true
|
||||
# return @front_sprite_altitude > 0
|
||||
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
|
||||
347
Data/Scripts/011_Data/001_PBS data/011_Species files.rb
Normal file
347
Data/Scripts/011_Data/001_PBS data/011_Species files.rb
Normal file
@@ -0,0 +1,347 @@
|
||||
module GameData
|
||||
class Species
|
||||
def self.check_graphic_file(path, species, form = 0, gender = 0, shiny = false, shadow = false, subfolder = "")
|
||||
try_subfolder = sprintf("%s/", subfolder)
|
||||
# species_data = self.get_species_form(species, form)
|
||||
# species_id = sprintf("%03d", (species_data) ? self.get(species_data.species).id_number : 0)
|
||||
try_species = species
|
||||
try_form = (form > 0) ? sprintf("_%d", 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 > 0
|
||||
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
|
||||
# for j in 0...2 # Try using the species' ID symbol and then its ID number
|
||||
# next if !try_species || (try_species == "000" && j == 1)
|
||||
# try_species_text = (j == 0) ? try_species : species_id
|
||||
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
|
||||
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?
|
||||
# species_id = self.get(species_data.species).id_number
|
||||
if form > 0
|
||||
ret = pbResolveBitmap(sprintf("%s%s_%d%s", path, species_data.species, form, suffix))
|
||||
return ret if ret
|
||||
# ret = pbResolveBitmap(sprintf("%s%03d_%d%s", path, species_id, form, suffix))
|
||||
# return ret if ret
|
||||
end
|
||||
ret = pbResolveBitmap(sprintf("%s%s%s", path, species_data.species, suffix))
|
||||
return ret
|
||||
# return ret if ret
|
||||
# return pbResolveBitmap(sprintf("%s%03d%s", path, species_id, 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.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)
|
||||
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, form, gender, shiny, shadow)
|
||||
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
|
||||
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, form = 0, gender = 0, shiny = false, shadow = false, egg = false)
|
||||
return self.egg_icon_filename(species, form) if egg
|
||||
return self.check_graphic_file("Graphics/Pokemon/", species, form, gender, shiny, shadow, "Icons")
|
||||
end
|
||||
|
||||
def self.icon_filename_from_pokemon(pkmn)
|
||||
return self.icon_filename(pkmn.species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?)
|
||||
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?
|
||||
# species_id = self.get(species_data.species).id_number
|
||||
if form > 0
|
||||
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s_%d", species_data.species, form))
|
||||
return ret if ret
|
||||
# ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d_%d", species_id, form))
|
||||
# return ret if ret
|
||||
end
|
||||
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%s", species_data.species))
|
||||
return ret
|
||||
# return ret if ret
|
||||
# return pbResolveBitmap(sprintf("Graphics/Pokemon/Footprints/%03d", species_id))
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
|
||||
def self.shadow_filename(species, form = 0)
|
||||
species_data = self.get_species_form(species, form)
|
||||
return nil if species_data.nil?
|
||||
# species_id = self.get(species_data.species).id_number
|
||||
# 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
|
||||
# ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d_%d", species_id, form))
|
||||
# return ret if ret
|
||||
end
|
||||
ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
|
||||
return ret if ret
|
||||
# ret = pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%03d", species_id))
|
||||
# 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?
|
||||
# species_id = self.get(species_data.species).id_number
|
||||
if form > 0
|
||||
ret = sprintf("Cries/%s_%d", species_data.species, form)
|
||||
return ret if pbResolveAudioSE(ret)
|
||||
# ret = sprintf("Cries/%03d_%d", species_id, form)
|
||||
# return ret if pbResolveAudioSE(ret)
|
||||
end
|
||||
ret = sprintf("Cries/%s", species_data.species)
|
||||
# return ret if pbResolveAudioSE(ret)
|
||||
# ret = sprintf("Cries/%03d", species_id)
|
||||
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)
|
||||
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?
|
||||
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_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
|
||||
|
||||
# @deprecated This alias is slated to be removed in v20.
|
||||
def pbPlayCrySpecies(species, form = 0, volume = 90, pitch = nil)
|
||||
Deprecation.warn_method('pbPlayCrySpecies', 'v20', 'GameData::Species.play_cry_from_species(species, form)')
|
||||
GameData::Species.play_cry_from_species(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', 'GameData::Species.play_cry_from_pokemon(pkmn)')
|
||||
GameData::Species.play_cry_from_pokemon(pkmn, 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
|
||||
175
Data/Scripts/011_Data/001_PBS data/012_Trainer.rb
Normal file
175
Data/Scripts/011_Data/001_PBS data/012_Trainer.rb
Normal file
@@ -0,0 +1,175 @@
|
||||
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
|
||||
|
||||
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_flag, "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, "u"],
|
||||
}
|
||||
|
||||
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 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|
|
||||
if pkmn[:iv]
|
||||
6.times { |i| pkmn[:iv][i] = pkmn[:iv][0] if !pkmn[:iv][i] }
|
||||
end
|
||||
if pkmn[:ev]
|
||||
6.times { |i| pkmn[:ev][i] = pkmn[:ev][0] if !pkmn[:ev][i] }
|
||||
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
|
||||
|
||||
# Creates a battle-ready version of a trainer's data.
|
||||
# @return [Array] all information about a trainer in a usable form
|
||||
def to_trainer
|
||||
# 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
|
||||
# Create each Pokémon owned by the trainer
|
||||
@pokemon.each do |pkmn_data|
|
||||
species = GameData::Species.get(pkmn_data[:species]).species
|
||||
pkmn = Pokemon.new(species, pkmn_data[: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
|
||||
pkmn.item = pkmn_data[:item]
|
||||
if pkmn_data[:moves] && pkmn_data[:moves].length > 0
|
||||
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
|
||||
else
|
||||
pkmn.resetMoves
|
||||
end
|
||||
pkmn.ability_index = pkmn_data[:ability_flag]
|
||||
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
|
||||
PBStats.eachStat do |s|
|
||||
if pkmn_data[:iv] && pkmn_data[:iv].length > 0
|
||||
pkmn.iv[s] = pkmn_data[:iv][s] || pkmn_data[:iv][0]
|
||||
else
|
||||
pkmn.iv[s] = [pkmn_data[:level] / 2, Pokemon::IV_STAT_LIMIT].min
|
||||
end
|
||||
if pkmn_data[:ev] && pkmn_data[:ev].length > 0
|
||||
pkmn.ev[s] = pkmn_data[:ev][s] || pkmn_data[:ev][0]
|
||||
else
|
||||
pkmn.ev[s] = [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 = pbBallTypeToItem(pkmn_data[:poke_ball]) if pkmn_data[:poke_ball]
|
||||
pkmn.calcStats
|
||||
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
|
||||
79
Data/Scripts/011_Data/001_PBS data/013_Encounter.rb
Normal file
79
Data/Scripts/011_Data/001_PBS data/013_Encounter.rb
Normal file
@@ -0,0 +1,79 @@
|
||||
# $PokemonGlobal.encounter_version
|
||||
|
||||
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 ClassMethods
|
||||
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
|
||||
31
Data/Scripts/011_Data/001_PBS data/014_Ribbon.rb
Normal file
31
Data/Scripts/011_Data/001_PBS data/014_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
|
||||
Reference in New Issue
Block a user