mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Rearranged some script files
This commit is contained in:
472
Data/Scripts/011_Data/001_MiscData.rb
Normal file
472
Data/Scripts/011_Data/001_MiscData.rb
Normal file
@@ -0,0 +1,472 @@
|
||||
#===============================================================================
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Global and map metadata
|
||||
#===============================================================================
|
||||
MetadataHome = 1
|
||||
MetadataWildBattleBGM = 2
|
||||
MetadataTrainerBattleBGM = 3
|
||||
MetadataWildVictoryME = 4
|
||||
MetadataTrainerVictoryME = 5
|
||||
MetadataWildCaptureME = 6
|
||||
MetadataSurfBGM = 7
|
||||
MetadataBicycleBGM = 8
|
||||
MetadataPlayerA = 9
|
||||
MetadataPlayerB = 10
|
||||
MetadataPlayerC = 11
|
||||
MetadataPlayerD = 12
|
||||
MetadataPlayerE = 13
|
||||
MetadataPlayerF = 14
|
||||
MetadataPlayerG = 15
|
||||
MetadataPlayerH = 16
|
||||
|
||||
MetadataOutdoor = 1
|
||||
MetadataShowArea = 2
|
||||
MetadataBicycle = 3
|
||||
MetadataBicycleAlways = 4
|
||||
MetadataHealingSpot = 5
|
||||
MetadataWeather = 6
|
||||
MetadataMapPosition = 7
|
||||
MetadataDiveMap = 8
|
||||
MetadataDarkMap = 9
|
||||
MetadataSafariMap = 10
|
||||
MetadataSnapEdges = 11
|
||||
MetadataDungeon = 12
|
||||
MetadataBattleBack = 13
|
||||
MetadataMapWildBattleBGM = 14
|
||||
MetadataMapTrainerBattleBGM = 15
|
||||
MetadataMapWildVictoryME = 16
|
||||
MetadataMapTrainerVictoryME = 17
|
||||
MetadataMapWildCaptureME = 18
|
||||
MetadataMapSize = 19
|
||||
MetadataEnvironment = 20
|
||||
|
||||
|
||||
|
||||
module PokemonMetadata
|
||||
GlobalTypes = {
|
||||
"Home" => [MetadataHome, "uuuu"],
|
||||
"WildBattleBGM" => [MetadataWildBattleBGM, "s"],
|
||||
"TrainerBattleBGM" => [MetadataTrainerBattleBGM, "s"],
|
||||
"WildVictoryME" => [MetadataWildVictoryME, "s"],
|
||||
"TrainerVictoryME" => [MetadataTrainerVictoryME, "s"],
|
||||
"WildCaptureME" => [MetadataWildCaptureME, "s"],
|
||||
"SurfBGM" => [MetadataSurfBGM, "s"],
|
||||
"BicycleBGM" => [MetadataBicycleBGM, "s"],
|
||||
"PlayerA" => [MetadataPlayerA, "esssssss",:PBTrainers],
|
||||
"PlayerB" => [MetadataPlayerB, "esssssss",:PBTrainers],
|
||||
"PlayerC" => [MetadataPlayerC, "esssssss",:PBTrainers],
|
||||
"PlayerD" => [MetadataPlayerD, "esssssss",:PBTrainers],
|
||||
"PlayerE" => [MetadataPlayerE, "esssssss",:PBTrainers],
|
||||
"PlayerF" => [MetadataPlayerF, "esssssss",:PBTrainers],
|
||||
"PlayerG" => [MetadataPlayerG, "esssssss",:PBTrainers],
|
||||
"PlayerH" => [MetadataPlayerH, "esssssss",:PBTrainers]
|
||||
}
|
||||
NonGlobalTypes = {
|
||||
"Outdoor" => [MetadataOutdoor, "b"],
|
||||
"ShowArea" => [MetadataShowArea, "b"],
|
||||
"Bicycle" => [MetadataBicycle, "b"],
|
||||
"BicycleAlways" => [MetadataBicycleAlways, "b"],
|
||||
"HealingSpot" => [MetadataHealingSpot, "uuu"],
|
||||
"Weather" => [MetadataWeather, "eu",:PBFieldWeather],
|
||||
"MapPosition" => [MetadataMapPosition, "uuu"],
|
||||
"DiveMap" => [MetadataDiveMap, "u"],
|
||||
"DarkMap" => [MetadataDarkMap, "b"],
|
||||
"SafariMap" => [MetadataSafariMap, "b"],
|
||||
"SnapEdges" => [MetadataSnapEdges, "b"],
|
||||
"Dungeon" => [MetadataDungeon, "b"],
|
||||
"BattleBack" => [MetadataBattleBack, "s"],
|
||||
"WildBattleBGM" => [MetadataMapWildBattleBGM, "s"],
|
||||
"TrainerBattleBGM" => [MetadataMapTrainerBattleBGM, "s"],
|
||||
"WildVictoryME" => [MetadataMapWildVictoryME, "s"],
|
||||
"TrainerVictoryME" => [MetadataMapTrainerVictoryME, "s"],
|
||||
"WildCaptureME" => [MetadataMapWildCaptureME, "s"],
|
||||
"MapSize" => [MetadataMapSize, "us"],
|
||||
"Environment" => [MetadataEnvironment, "e",:PBEnvironment]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Pokémon data
|
||||
#===============================================================================
|
||||
SpeciesType1 = 0
|
||||
SpeciesType2 = 1
|
||||
SpeciesBaseStats = 2
|
||||
SpeciesGenderRate = 3
|
||||
SpeciesGrowthRate = 4
|
||||
SpeciesBaseExp = 5
|
||||
SpeciesEffortPoints = 6
|
||||
SpeciesRareness = 7
|
||||
SpeciesHappiness = 8
|
||||
SpeciesAbilities = 9
|
||||
SpeciesHiddenAbility = 10
|
||||
SpeciesCompatibility = 11
|
||||
SpeciesStepsToHatch = 12
|
||||
SpeciesHeight = 13
|
||||
SpeciesWeight = 14
|
||||
SpeciesColor = 15
|
||||
SpeciesShape = 16
|
||||
SpeciesHabitat = 17
|
||||
SpeciesWildItemCommon = 18
|
||||
SpeciesWildItemUncommon = 19
|
||||
SpeciesWildItemRare = 20
|
||||
SpeciesIncense = 21
|
||||
SpeciesPokedexForm = 22 # For alternate forms
|
||||
SpeciesMegaStone = 23 # For alternate forms
|
||||
SpeciesMegaMove = 24 # For alternate forms
|
||||
SpeciesUnmegaForm = 25 # For alternate forms
|
||||
SpeciesMegaMessage = 26 # For alternate forms
|
||||
|
||||
MetricBattlerPlayerX = 0
|
||||
MetricBattlerPlayerY = 1
|
||||
MetricBattlerEnemyX = 2
|
||||
MetricBattlerEnemyY = 3
|
||||
MetricBattlerAltitude = 4
|
||||
MetricBattlerShadowX = 5
|
||||
MetricBattlerShadowSize = 6
|
||||
|
||||
|
||||
|
||||
module PokemonSpeciesData
|
||||
def self.requiredValues(compilingForms=false)
|
||||
ret = {
|
||||
"Type1" => [SpeciesType1, "e",:PBTypes],
|
||||
"BaseStats" => [SpeciesBaseStats, "vvvvvv"],
|
||||
"BaseEXP" => [SpeciesBaseExp, "v"],
|
||||
"EffortPoints" => [SpeciesEffortPoints, "uuuuuu"],
|
||||
"Rareness" => [SpeciesRareness, "u"],
|
||||
"Happiness" => [SpeciesHappiness, "u"],
|
||||
"Compatibility" => [SpeciesCompatibility, "eE",:PBEggGroups,:PBEggGroups],
|
||||
"StepsToHatch" => [SpeciesStepsToHatch, "v"],
|
||||
"Height" => [SpeciesHeight, "f"],
|
||||
"Weight" => [SpeciesWeight, "f"],
|
||||
"Color" => [SpeciesColor, "e",:PBColors],
|
||||
"Shape" => [SpeciesShape, "u"],
|
||||
"Moves" => [0, "*ue",nil,:PBMoves],
|
||||
"Kind" => [0, "s"],
|
||||
"Pokedex" => [0, "q"]
|
||||
}
|
||||
if !compilingForms
|
||||
ret["GenderRate"] = [SpeciesGenderRate, "e",:PBGenderRates]
|
||||
ret["GrowthRate"] = [SpeciesGrowthRate, "e",:PBGrowthRates]
|
||||
ret["Name"] = [0, "s"]
|
||||
ret["InternalName"] = [0, "n"]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.optionalValues(compilingForms=false)
|
||||
ret = {
|
||||
"Type2" => [SpeciesType2, "e",:PBTypes],
|
||||
"Abilities" => [SpeciesAbilities, "eE",:PBAbilities,:PBAbilities],
|
||||
"HiddenAbility" => [SpeciesHiddenAbility, "eEEE",:PBAbilities,:PBAbilities,
|
||||
:PBAbilities,:PBAbilities],
|
||||
"Habitat" => [SpeciesHabitat, "e",:PBHabitats],
|
||||
"WildItemCommon" => [SpeciesWildItemCommon, "e",:PBItems],
|
||||
"WildItemUncommon" => [SpeciesWildItemUncommon, "e",:PBItems],
|
||||
"WildItemRare" => [SpeciesWildItemRare, "e",:PBItems],
|
||||
"BattlerPlayerX" => [MetricBattlerPlayerX, "i"],
|
||||
"BattlerPlayerY" => [MetricBattlerPlayerY, "i"],
|
||||
"BattlerEnemyX" => [MetricBattlerEnemyX, "i"],
|
||||
"BattlerEnemyY" => [MetricBattlerEnemyY, "i"],
|
||||
"BattlerAltitude" => [MetricBattlerAltitude, "i"],
|
||||
"BattlerShadowX" => [MetricBattlerShadowX, "i"],
|
||||
"BattlerShadowSize" => [MetricBattlerShadowSize, "u"],
|
||||
"EggMoves" => [0, "*e",:PBMoves],
|
||||
"FormName" => [0, "q"],
|
||||
"Evolutions" => [0, "*ses",nil,:PBEvolution,nil]
|
||||
}
|
||||
if compilingForms
|
||||
ret["PokedexForm"] = [SpeciesPokedexForm, "u"]
|
||||
ret["MegaStone"] = [SpeciesMegaStone, "e",:PBItems]
|
||||
ret["MegaMove"] = [SpeciesMegaMove, "e",:PBMoves]
|
||||
ret["UnmegaForm"] = [SpeciesUnmegaForm, "u"]
|
||||
ret["MegaMessage"] = [SpeciesMegaMessage, "u"]
|
||||
else
|
||||
ret["Incense"] = [SpeciesIncense, "e",:PBItems]
|
||||
ret["RegionalNumbers"] = [0, "*u"]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Manipulation methods for metadata, phone data and Pokémon species data
|
||||
#===============================================================================
|
||||
class PokemonTemp
|
||||
attr_accessor :metadata
|
||||
attr_accessor :townMapData
|
||||
attr_accessor :encountersData
|
||||
attr_accessor :phoneData
|
||||
attr_accessor :regionalDexes
|
||||
attr_accessor :speciesData
|
||||
attr_accessor :speciesEggMoves
|
||||
attr_accessor :speciesMetrics
|
||||
attr_accessor :speciesMovesets
|
||||
attr_accessor :speciesTMData
|
||||
attr_accessor :speciesShadowMovesets
|
||||
attr_accessor :pokemonFormToSpecies
|
||||
attr_accessor :trainerTypesData
|
||||
attr_accessor :trainersData
|
||||
attr_accessor :moveToAnim
|
||||
attr_accessor :battleAnims
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbLoadMetadata
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.metadata
|
||||
$PokemonTemp.metadata = load_data("Data/metadata.dat") || []
|
||||
end
|
||||
return $PokemonTemp.metadata
|
||||
end
|
||||
|
||||
def pbGetMetadata(mapid,metadataType)
|
||||
meta = pbLoadMetadata
|
||||
return meta[mapid][metadataType] if meta[mapid]
|
||||
return nil
|
||||
end
|
||||
|
||||
def pbLoadTownMapData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.townMapData
|
||||
$PokemonTemp.townMapData = load_data("Data/town_map.dat")
|
||||
end
|
||||
return $PokemonTemp.townMapData
|
||||
end
|
||||
|
||||
def pbLoadEncountersData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.encountersData
|
||||
if pbRgssExists?("Data/encounters.dat")
|
||||
$PokemonTemp.encountersData = load_data("Data/encounters.dat")
|
||||
end
|
||||
end
|
||||
return $PokemonTemp.encountersData
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
def pbLoadRegionalDexes
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.regionalDexes
|
||||
$PokemonTemp.regionalDexes = load_data("Data/regional_dexes.dat")
|
||||
end
|
||||
return $PokemonTemp.regionalDexes
|
||||
end
|
||||
|
||||
def pbLoadSpeciesData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesData
|
||||
$PokemonTemp.speciesData = load_data("Data/species.dat") || []
|
||||
end
|
||||
return $PokemonTemp.speciesData
|
||||
end
|
||||
|
||||
def pbGetSpeciesData(species,form=0,speciesDataType=-1)
|
||||
species = getID(PBSpecies,species)
|
||||
s = pbGetFSpeciesFromForm(species,form)
|
||||
speciesData = pbLoadSpeciesData
|
||||
if speciesDataType<0
|
||||
return speciesData[s] || []
|
||||
end
|
||||
return speciesData[s][speciesDataType] if speciesData[s] && speciesData[s][speciesDataType]
|
||||
case speciesDataType
|
||||
when SpeciesType2; return nil
|
||||
when SpeciesBaseStats; return [1,1,1,1,1,1]
|
||||
when SpeciesEffortPoints; return [0,0,0,0,0,0]
|
||||
when SpeciesStepsToHatch, SpeciesHeight, SpeciesWeight; return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def pbLoadEggMovesData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesEggMoves
|
||||
$PokemonTemp.speciesEggMoves = load_data("Data/species_eggmoves.dat") || []
|
||||
end
|
||||
return $PokemonTemp.speciesEggMoves
|
||||
end
|
||||
|
||||
def pbGetSpeciesEggMoves(species,form=0)
|
||||
species = getID(PBSpecies,species)
|
||||
s = pbGetFSpeciesFromForm(species,form)
|
||||
eggMovesData = pbLoadEggMovesData
|
||||
return eggMovesData[s] if eggMovesData[s]
|
||||
return []
|
||||
end
|
||||
|
||||
def pbLoadSpeciesMetrics
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesMetrics
|
||||
$PokemonTemp.speciesMetrics = load_data("Data/species_metrics.dat") || []
|
||||
end
|
||||
return $PokemonTemp.speciesMetrics
|
||||
end
|
||||
|
||||
def pbLoadMovesetsData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesMovesets
|
||||
$PokemonTemp.speciesMovesets = load_data("Data/species_movesets.dat") || []
|
||||
end
|
||||
return $PokemonTemp.speciesMovesets
|
||||
end
|
||||
|
||||
def pbGetSpeciesMoveset(species,form=0)
|
||||
species = getID(PBSpecies,species)
|
||||
s = pbGetFSpeciesFromForm(species,form)
|
||||
movesetsData = pbLoadMovesetsData
|
||||
return movesetsData[s] if movesetsData[s]
|
||||
return []
|
||||
end
|
||||
|
||||
def pbLoadSpeciesTMData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesTMData
|
||||
$PokemonTemp.speciesTMData = load_data("Data/tm.dat") || []
|
||||
end
|
||||
return $PokemonTemp.speciesTMData
|
||||
end
|
||||
|
||||
def pbLoadShadowMovesets
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.speciesShadowMovesets
|
||||
$PokemonTemp.speciesShadowMovesets = load_data("Data/shadow_movesets.dat") || []
|
||||
end
|
||||
return $PokemonTemp.speciesShadowMovesets
|
||||
end
|
||||
|
||||
def pbLoadFormToSpecies
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.pokemonFormToSpecies
|
||||
$PokemonTemp.pokemonFormToSpecies = load_data("Data/form2species.dat")
|
||||
end
|
||||
return $PokemonTemp.pokemonFormToSpecies
|
||||
end
|
||||
|
||||
def pbLoadTrainerTypesData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.trainerTypesData
|
||||
$PokemonTemp.trainerTypesData = load_data("Data/trainer_types.dat") || []
|
||||
end
|
||||
return $PokemonTemp.trainerTypesData
|
||||
end
|
||||
|
||||
def pbGetTrainerTypeData(type)
|
||||
data = pbLoadTrainerTypesData
|
||||
return data[type] if data
|
||||
return nil
|
||||
end
|
||||
|
||||
def pbLoadTrainersData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.trainersData
|
||||
$PokemonTemp.trainersData = load_data("Data/trainers.dat") || []
|
||||
end
|
||||
return $PokemonTemp.trainersData
|
||||
end
|
||||
|
||||
def pbGetTrainerData(trainerID,trainerName,partyID=0)
|
||||
trainersData = pbLoadTrainersData
|
||||
ret = nil
|
||||
for t in trainersData
|
||||
next if t[0]!=trainerID || t[1]!=trainerName || t[4]!=partyID
|
||||
ret = t
|
||||
break
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbLoadMoveToAnim
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.moveToAnim
|
||||
$PokemonTemp.moveToAnim = load_data("Data/move2anim.dat") || []
|
||||
end
|
||||
return $PokemonTemp.moveToAnim
|
||||
end
|
||||
|
||||
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 pbClearData
|
||||
if $PokemonTemp
|
||||
$PokemonTemp.metadata = nil
|
||||
$PokemonTemp.townMapData = nil
|
||||
$PokemonTemp.encountersData = nil
|
||||
$PokemonTemp.phoneData = nil
|
||||
$PokemonTemp.regionalDexes = nil
|
||||
$PokemonTemp.speciesData = nil
|
||||
$PokemonTemp.speciesEggMoves = nil
|
||||
$PokemonTemp.speciesMetrics = nil
|
||||
$PokemonTemp.speciesMovesets = nil
|
||||
$PokemonTemp.speciesTMData = nil
|
||||
$PokemonTemp.speciesShadowMovesets = nil
|
||||
$PokemonTemp.pokemonFormToSpecies = nil
|
||||
$PokemonTemp.trainerTypesData = nil
|
||||
$PokemonTemp.trainersData = nil
|
||||
$PokemonTemp.moveToAnim = nil
|
||||
$PokemonTemp.battleAnims = 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
|
||||
if pbRgssExists?("Data/Tilesets.rvdata")
|
||||
$data_tilesets = load_data("Data/Tilesets.rvdata")
|
||||
end
|
||||
end
|
||||
104
Data/Scripts/011_Data/002_PBMove.rb
Normal file
104
Data/Scripts/011_Data/002_PBMove.rb
Normal file
@@ -0,0 +1,104 @@
|
||||
MOVE_ID = 0
|
||||
MOVE_INTERNAL_NAME = 1
|
||||
MOVE_NAME = 2
|
||||
MOVE_FUNCTION_CODE = 3
|
||||
MOVE_BASE_DAMAGE = 4
|
||||
MOVE_TYPE = 5
|
||||
MOVE_CATEGORY = 6
|
||||
MOVE_ACCURACY = 7
|
||||
MOVE_TOTAL_PP = 8
|
||||
MOVE_EFFECT_CHANCE = 9
|
||||
MOVE_TARGET = 10
|
||||
MOVE_PRIORITY = 11
|
||||
MOVE_FLAGS = 12
|
||||
MOVE_DESCRIPTION = 13
|
||||
|
||||
|
||||
|
||||
class PokemonTemp
|
||||
attr_accessor :movesData
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbLoadMovesData
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.movesData
|
||||
if pbRgssExists?("Data/moves.dat")
|
||||
$PokemonTemp.movesData = load_data("Data/moves.dat")
|
||||
else
|
||||
$PokemonTemp.movesData = []
|
||||
end
|
||||
end
|
||||
return $PokemonTemp.movesData
|
||||
end
|
||||
|
||||
def pbGetMoveData(moveID,moveDataType=-1)
|
||||
meta = pbLoadMovesData
|
||||
if moveDataType<0
|
||||
return meta[moveID] || []
|
||||
end
|
||||
return meta[moveID][moveDataType] if meta[moveID]
|
||||
return nil
|
||||
end
|
||||
|
||||
alias __moveData__pbClearData pbClearData
|
||||
def pbClearData
|
||||
$PokemonTemp.movesData = nil if $PokemonTemp
|
||||
__moveData__pbClearData
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PBMoveData
|
||||
attr_reader :function,:basedamage,:type,:accuracy,:category
|
||||
attr_reader :totalpp,:addlEffect,:target,:priority,:flags
|
||||
|
||||
def initialize(moveid)
|
||||
moveData = pbGetMoveData(moveID)
|
||||
@function = moveData[MOVE_FUNCTION_CODE]
|
||||
@basedamage = moveData[MOVE_BASE_DAMAGE]
|
||||
@type = moveData[MOVE_TYPE]
|
||||
@category = moveData[MOVE_CATEGORY]
|
||||
@accuracy = moveData[MOVE_ACCURACY]
|
||||
@totalpp = moveData[MOVE_TOTAL_PP]
|
||||
@addlEffect = moveData[MOVE_EFFECT_CHANCE]
|
||||
@target = moveData[MOVE_TARGET]
|
||||
@priority = moveData[MOVE_PRIORITY]
|
||||
@flags = moveData[MOVE_FLAGS]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PBMove
|
||||
attr_reader(:id) # This move's ID
|
||||
attr_accessor(:pp) # The amount of PP remaining for this move
|
||||
attr_accessor(:ppup) # The number of PP Ups used for this move
|
||||
|
||||
# Initializes this object to the specified move ID.
|
||||
def initialize(moveID)
|
||||
@id = moveID
|
||||
@pp = pbGetMoveData(moveID,MOVE_TOTAL_PP) || 0
|
||||
@ppup = 0
|
||||
end
|
||||
|
||||
# Changes this move's ID, and caps the PP amount if it is now greater than the
|
||||
# new move's total PP.
|
||||
def id=(value)
|
||||
oldID = @id
|
||||
@id = value
|
||||
@pp = [@pp,self.totalpp].min if oldID>0
|
||||
end
|
||||
|
||||
# Gets this move's type.
|
||||
def type
|
||||
return pbGetMoveData(@id,MOVE_TYPE) || 0
|
||||
end
|
||||
|
||||
# Gets the maximum PP for this move.
|
||||
def totalpp
|
||||
maxPP = pbGetMoveData(@id,MOVE_TOTAL_PP) || 0
|
||||
return maxPP+maxPP*@ppup/5
|
||||
end
|
||||
end
|
||||
28
Data/Scripts/011_Data/003_PBStatuses.rb
Normal file
28
Data/Scripts/011_Data/003_PBStatuses.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
#70925035
|
||||
begin
|
||||
module PBStatuses
|
||||
NONE = 0
|
||||
SLEEP = 1
|
||||
POISON = 2
|
||||
BURN = 3
|
||||
PARALYSIS = 4
|
||||
FROZEN = 5
|
||||
|
||||
def self.getName(id)
|
||||
id = getID(PBStatuses,id)
|
||||
names = [
|
||||
_INTL("healthy"),
|
||||
_INTL("asleep"),
|
||||
_INTL("poisoned"),
|
||||
_INTL("burned"),
|
||||
_INTL("paralyzed"),
|
||||
_INTL("frozen")
|
||||
]
|
||||
return names[id]
|
||||
end end
|
||||
|
||||
rescue Exception
|
||||
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
|
||||
raise $!
|
||||
end
|
||||
end
|
||||
90
Data/Scripts/011_Data/004_PBTypes_Extra.rb
Normal file
90
Data/Scripts/011_Data/004_PBTypes_Extra.rb
Normal file
@@ -0,0 +1,90 @@
|
||||
module PBTypeEffectiveness
|
||||
INEFFECTIVE = 0
|
||||
NOT_EFFECTIVE_ONE = 1
|
||||
NORMAL_EFFECTIVE_ONE = 2
|
||||
SUPER_EFFECTIVE_ONE = 4
|
||||
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE ** 3
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PBTypes
|
||||
@@TypeData = nil
|
||||
|
||||
def PBTypes.loadTypeData
|
||||
if !@@TypeData
|
||||
@@TypeData = load_data("Data/types.dat")
|
||||
@@TypeData[0].freeze
|
||||
@@TypeData[1].freeze
|
||||
@@TypeData[2].freeze
|
||||
@@TypeData.freeze
|
||||
end
|
||||
return @@TypeData
|
||||
end
|
||||
|
||||
def PBTypes.regularTypesCount
|
||||
ret = 0
|
||||
for i in 0..PBTypes.maxValue
|
||||
next if PBTypes.isPseudoType?(i) || isConst?(i,PBTypes,:SHADOW)
|
||||
ret += 1
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def PBTypes.isPseudoType?(type)
|
||||
return PBTypes.loadTypeData[0].include?(type)
|
||||
end
|
||||
|
||||
def PBTypes.isSpecialType?(type)
|
||||
return PBTypes.loadTypeData[1].include?(type)
|
||||
end
|
||||
|
||||
def PBTypes.getEffectiveness(attackType,targetType)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if !targetType || targetType<0
|
||||
return PBTypes.loadTypeData[2][attackType*(PBTypes.maxValue+1)+targetType]
|
||||
end
|
||||
|
||||
def PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2=nil,targetType3=nil)
|
||||
mod1 = PBTypes.getEffectiveness(attackType,targetType1)
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod3 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
if targetType2!=nil && targetType2>=0 && targetType1!=targetType2
|
||||
mod2 = PBTypes.getEffectiveness(attackType,targetType2)
|
||||
end
|
||||
if targetType3!=nil && targetType3>=0 &&
|
||||
targetType1!=targetType3 && targetType2!=targetType3
|
||||
mod3 = PBTypes.getEffectiveness(attackType,targetType3)
|
||||
end
|
||||
return mod1*mod2*mod3
|
||||
end
|
||||
|
||||
def PBTypes.ineffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType==PBTypeEffectiveness::INEFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e==PBTypeEffectiveness::INEFFECTIVE
|
||||
end
|
||||
|
||||
def PBTypes.notVeryEffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType>PBTypeEffectiveness::INEFFECTIVE && attackType<PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e>PBTypeEffectiveness::INEFFECTIVE && e<PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def PBTypes.resistant?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType<PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e<PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def PBTypes.normalEffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType==PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e==PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def PBTypes.superEffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType>PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e>PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
end
|
||||
end
|
||||
87
Data/Scripts/011_Data/005_PBNatures.rb
Normal file
87
Data/Scripts/011_Data/005_PBNatures.rb
Normal file
@@ -0,0 +1,87 @@
|
||||
module PBNatures
|
||||
HARDY = 0
|
||||
LONELY = 1
|
||||
BRAVE = 2
|
||||
ADAMANT = 3
|
||||
NAUGHTY = 4
|
||||
BOLD = 5
|
||||
DOCILE = 6
|
||||
RELAXED = 7
|
||||
IMPISH = 8
|
||||
LAX = 9
|
||||
TIMID = 10
|
||||
HASTY = 11
|
||||
SERIOUS = 12
|
||||
JOLLY = 13
|
||||
NAIVE = 14
|
||||
MODEST = 15
|
||||
MILD = 16
|
||||
QUIET = 17
|
||||
BASHFUL = 18
|
||||
RASH = 19
|
||||
CALM = 20
|
||||
GENTLE = 21
|
||||
SASSY = 22
|
||||
CAREFUL = 23
|
||||
QUIRKY = 24
|
||||
|
||||
def self.maxValue; 24; end
|
||||
def self.getCount; 25; end
|
||||
|
||||
def self.getName(id)
|
||||
id = getID(PBNatures,id)
|
||||
names = [
|
||||
_INTL("Hardy"),
|
||||
_INTL("Lonely"),
|
||||
_INTL("Brave"),
|
||||
_INTL("Adamant"),
|
||||
_INTL("Naughty"),
|
||||
_INTL("Bold"),
|
||||
_INTL("Docile"),
|
||||
_INTL("Relaxed"),
|
||||
_INTL("Impish"),
|
||||
_INTL("Lax"),
|
||||
_INTL("Timid"),
|
||||
_INTL("Hasty"),
|
||||
_INTL("Serious"),
|
||||
_INTL("Jolly"),
|
||||
_INTL("Naive"),
|
||||
_INTL("Modest"),
|
||||
_INTL("Mild"),
|
||||
_INTL("Quiet"),
|
||||
_INTL("Bashful"),
|
||||
_INTL("Rash"),
|
||||
_INTL("Calm"),
|
||||
_INTL("Gentle"),
|
||||
_INTL("Sassy"),
|
||||
_INTL("Careful"),
|
||||
_INTL("Quirky")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
|
||||
def self.getStatRaised(id)
|
||||
m = (id%25)/5 # 25 here is (number of stats)**2, not PBNatures.getCount
|
||||
return [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
|
||||
PBStats::SPATK,PBStats::SPDEF][m]
|
||||
end
|
||||
|
||||
def self.getStatLowered(id)
|
||||
m = id%5 # Don't need to %25 here because 25 is a multiple of 5
|
||||
return [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
|
||||
PBStats::SPATK,PBStats::SPDEF][m]
|
||||
end
|
||||
|
||||
def self.getStatChanges(id)
|
||||
id = getID(PBNatures,id)
|
||||
up = PBNatures.getStatRaised(id)
|
||||
dn = PBNatures.getStatLowered(id)
|
||||
ret = []
|
||||
PBStats.eachStat do |s|
|
||||
ret[s] = 100
|
||||
ret[s] += 10 if s==up
|
||||
ret[s] -= 10 if s==dn
|
||||
end
|
||||
return ret
|
||||
end
|
||||
end
|
||||
24
Data/Scripts/011_Data/006_PBGenderRates.rb
Normal file
24
Data/Scripts/011_Data/006_PBGenderRates.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
module PBGenderRates
|
||||
Genderless = 0
|
||||
AlwaysMale = 1
|
||||
FemaleOneEighth = 2
|
||||
Female25Percent = 3
|
||||
Female50Percent = 4
|
||||
Female75Percent = 5
|
||||
FemaleSevenEighths = 6
|
||||
AlwaysFemale = 7
|
||||
|
||||
def self.genderByte(gender)
|
||||
case gender
|
||||
when AlwaysMale; return 0
|
||||
when FemaleOneEighth; return 32
|
||||
when Female25Percent; return 64
|
||||
when Female50Percent; return 128
|
||||
when Female75Percent; return 192
|
||||
when FemaleSevenEighths; return 224
|
||||
when AlwaysFemale; return 254
|
||||
when Genderless; return 255
|
||||
end
|
||||
return 255 # Default value (genderless)
|
||||
end
|
||||
end
|
||||
197
Data/Scripts/011_Data/007_PBExperience.rb
Normal file
197
Data/Scripts/011_Data/007_PBExperience.rb
Normal file
@@ -0,0 +1,197 @@
|
||||
module PBGrowthRates
|
||||
Medium = MediumFast = 0
|
||||
Erratic = 1
|
||||
Fluctuating = 2
|
||||
Parabolic = MediumSlow = 3
|
||||
Fast = 4
|
||||
Slow = 5
|
||||
|
||||
def self.maxValue; return 5; end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module PBExperience
|
||||
@PBExpTable = []
|
||||
@PBExpTable[PBGrowthRates::Medium] = [
|
||||
-1, 0, 8, 27, 64, 125, 216, 343, 512, 729,
|
||||
1000, 1331, 1728, 2197, 2744, 3375, 4096, 4913, 5832, 6859,
|
||||
8000, 9261, 10648, 12167, 13824, 15625, 17576, 19683, 21952, 24389,
|
||||
27000, 29791, 32768, 35937, 39304, 42875, 46656, 50653, 54872, 59319,
|
||||
64000, 68921, 74088, 79507, 85184, 91125, 97336, 103823, 110592, 117649,
|
||||
125000, 132651, 140608, 148877, 157464, 166375, 175616, 185193, 195112, 205379,
|
||||
216000, 226981, 238328, 250047, 262144, 274625, 287496, 300763, 314432, 328509,
|
||||
343000, 357911, 373248, 389017, 405224, 421875, 438976, 456533, 474552, 493039,
|
||||
512000, 531441, 551368, 571787, 592704, 614125, 636056, 658503, 681472, 704969,
|
||||
729000, 753571, 778688, 804357, 830584, 857375, 884736, 912673, 941192, 970299,
|
||||
1000000]
|
||||
@PBExpTable[PBGrowthRates::Erratic] = [
|
||||
-1, 0, 15, 52, 122, 237, 406, 637, 942, 1326,
|
||||
1800, 2369, 3041, 3822, 4719, 5737, 6881, 8155, 9564, 11111,
|
||||
12800, 14632, 16610, 18737, 21012, 23437, 26012, 28737, 31610, 34632,
|
||||
37800, 41111, 44564, 48155, 51881, 55737, 59719, 63822, 68041, 72369,
|
||||
76800, 81326, 85942, 90637, 95406, 100237, 105122, 110052, 115015, 120001,
|
||||
125000, 131324, 137795, 144410, 151165, 158056, 165079, 172229, 179503, 186894,
|
||||
194400, 202013, 209728, 217540, 225443, 233431, 241496, 249633, 257834, 267406,
|
||||
276458, 286328, 296358, 305767, 316074, 326531, 336255, 346965, 357812, 367807,
|
||||
378880, 390077, 400293, 411686, 423190, 433572, 445239, 457001, 467489, 479378,
|
||||
491346, 501878, 513934, 526049, 536557, 548720, 560922, 571333, 583539, 591882,
|
||||
600000]
|
||||
@PBExpTable[PBGrowthRates::Fluctuating] = [
|
||||
-1, 0, 4, 13, 32, 65, 112, 178, 276, 393,
|
||||
540, 745, 967, 1230, 1591, 1957, 2457, 3046, 3732, 4526,
|
||||
5440, 6482, 7666, 9003, 10506, 12187, 14060, 16140, 18439, 20974,
|
||||
23760, 26811, 30146, 33780, 37731, 42017, 46656, 50653, 55969, 60505,
|
||||
66560, 71677, 78533, 84277, 91998, 98415, 107069, 114205, 123863, 131766,
|
||||
142500, 151222, 163105, 172697, 185807, 196322, 210739, 222231, 238036, 250562,
|
||||
267840, 281456, 300293, 315059, 335544, 351520, 373744, 390991, 415050, 433631,
|
||||
459620, 479600, 507617, 529063, 559209, 582187, 614566, 639146, 673863, 700115,
|
||||
737280, 765275, 804997, 834809, 877201, 908905, 954084, 987754, 1035837, 1071552,
|
||||
1122660, 1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884,
|
||||
1640000]
|
||||
@PBExpTable[PBGrowthRates::Parabolic] = [
|
||||
-1, 0, 9, 57, 96, 135, 179, 236, 314, 419,
|
||||
560, 742, 973, 1261, 1612, 2035, 2535, 3120, 3798, 4575,
|
||||
5460, 6458, 7577, 8825, 10208, 11735, 13411, 15244, 17242, 19411,
|
||||
21760, 24294, 27021, 29949, 33084, 36435, 40007, 43808, 47846, 52127,
|
||||
56660, 61450, 66505, 71833, 77440, 83335, 89523, 96012, 102810, 109923,
|
||||
117360, 125126, 133229, 141677, 150476, 159635, 169159, 179056, 189334, 199999,
|
||||
211060, 222522, 234393, 246681, 259392, 272535, 286115, 300140, 314618, 329555,
|
||||
344960, 360838, 377197, 394045, 411388, 429235, 447591, 466464, 485862, 505791,
|
||||
526260, 547274, 568841, 590969, 613664, 636935, 660787, 685228, 710266, 735907,
|
||||
762160, 789030, 816525, 844653, 873420, 902835, 932903, 963632, 995030, 1027103,
|
||||
1059860]
|
||||
@PBExpTable[PBGrowthRates::Fast] = [
|
||||
-1, 0, 6, 21, 51, 100, 172, 274, 409, 583,
|
||||
800, 1064, 1382, 1757, 2195, 2700, 3276, 3930, 4665, 5487,
|
||||
6400, 7408, 8518, 9733, 11059, 12500, 14060, 15746, 17561, 19511,
|
||||
21600, 23832, 26214, 28749, 31443, 34300, 37324, 40522, 43897, 47455,
|
||||
51200, 55136, 59270, 63605, 68147, 72900, 77868, 83058, 88473, 94119,
|
||||
100000, 106120, 112486, 119101, 125971, 133100, 140492, 148154, 156089, 164303,
|
||||
172800, 181584, 190662, 200037, 209715, 219700, 229996, 240610, 251545, 262807,
|
||||
274400, 286328, 298598, 311213, 324179, 337500, 351180, 365226, 379641, 394431,
|
||||
409600, 425152, 441094, 457429, 474163, 491300, 508844, 526802, 545177, 563975,
|
||||
583200, 602856, 622950, 643485, 664467, 685900, 707788, 730138, 752953, 776239,
|
||||
800000]
|
||||
@PBExpTable[PBGrowthRates::Slow] = [
|
||||
-1, 0, 10, 33, 80, 156, 270, 428, 640, 911,
|
||||
1250, 1663, 2160, 2746, 3430, 4218, 5120, 6141, 7290, 8573,
|
||||
10000, 11576, 13310, 15208, 17280, 19531, 21970, 24603, 27440, 30486,
|
||||
33750, 37238, 40960, 44921, 49130, 53593, 58320, 63316, 68590, 74148,
|
||||
80000, 86151, 92610, 99383, 106480, 113906, 121670, 129778, 138240, 147061,
|
||||
156250, 165813, 175760, 186096, 196830, 207968, 219520, 231491, 243890, 256723,
|
||||
270000, 283726, 297910, 312558, 327680, 343281, 359370, 375953, 393040, 410636,
|
||||
428750, 447388, 466560, 486271, 506530, 527343, 548720, 570666, 593190, 616298,
|
||||
640000, 664301, 689210, 714733, 740880, 767656, 795070, 823128, 851840, 881211,
|
||||
911250, 941963, 973360, 1005446, 1038230, 1071718, 1105920, 1140841, 1176490, 1212873,
|
||||
1250000]
|
||||
|
||||
# Returns the maximum level a Pokémon can attain. If you want to make it vary,
|
||||
# here's where you put your formulae. Note that this is also called by the
|
||||
# Compiler, which happens before anything (e.g. Game Switches/Variables, the
|
||||
# player's data) is loaded, so make sure they exist before using them, and
|
||||
# make this method return the most maximum ever level if they don't.
|
||||
def self.maxLevel
|
||||
return MAXIMUM_LEVEL
|
||||
end
|
||||
|
||||
# Erratic (600000):
|
||||
# For levels 0-50: n**3([100-n]/50)
|
||||
# For levels 51-68: n**3([150-n]/100)
|
||||
# For levels 69-98: n**3(1.274-[1/50][n/3]-p(n mod 3))
|
||||
# where p(x) = array(0.000,0.008,0.014)[x]
|
||||
# For levels 99-100: n**3([160-n]/100)
|
||||
# Fluctuating (1640000):
|
||||
# For levels 0-15 : n**3([24+{(n+1)/3}]/50)
|
||||
# For levels 16-35: n**3([14+n]/50)
|
||||
# For levels 36-100: n**3([32+{n/2}]/50)
|
||||
|
||||
def self.pbGetExpInternal(level,growth)
|
||||
if level <= 100
|
||||
# Refer to experience table for levels 100 and less
|
||||
return @PBExpTable[growth][level]
|
||||
end
|
||||
# Level 101+, use formulae
|
||||
case growth
|
||||
when PBGrowthRates::Medium # 1000000
|
||||
return level ** 3
|
||||
when PBGrowthRates::Erratic # 600000
|
||||
# Different formula that causes 600000 EXP at level 100
|
||||
return ((level ** 4) * 0.6 / 100).floor
|
||||
when PBGrowthRates::Fluctuating # 1640000
|
||||
# Different formula that causes 1640000 EXP at level 100
|
||||
rate = 82
|
||||
if level > 100
|
||||
# Slow rate with increasing level
|
||||
rate -= (level - 100) / 2
|
||||
rate = 40 if rate < 40
|
||||
end
|
||||
return ((level ** 3) * (level * rate / 100) / 50.0).floor
|
||||
when PBGrowthRates::Parabolic # 1059860
|
||||
return ((level ** 3) * 6 / 5) - 15 * (level ** 2) + 100 * level - 140
|
||||
when PBGrowthRates::Fast # 800000
|
||||
return (level ** 3) * 4 / 5
|
||||
when PBGrowthRates::Slow # 1250000
|
||||
return (level ** 3) * 5 / 4
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
# Gets the maximum Exp Points possible for the given growth rate.
|
||||
# growth -- Growth rate.
|
||||
def self.pbGetMaxExperience(growth)
|
||||
if growth<0 || growth>PBGrowthRates.maxValue
|
||||
return ArgumentError.new("The growth rate is invalid.")
|
||||
end
|
||||
return pbGetExpInternal(maxLevel,growth)
|
||||
end
|
||||
|
||||
# Gets the number of Exp Points needed to reach the given
|
||||
# level with the given growth rate.
|
||||
# growth -- Growth rate.
|
||||
def self.pbGetStartExperience(level,growth)
|
||||
if growth<0 || growth>PBGrowthRates.maxValue
|
||||
return ArgumentError.new("The growth rate is invalid.")
|
||||
end
|
||||
if level<0
|
||||
return ArgumentError.new("The level is invalid.")
|
||||
end
|
||||
mLevel = maxLevel
|
||||
level = mLevel if level>mLevel
|
||||
return pbGetExpInternal(level,growth)
|
||||
end
|
||||
|
||||
# Adds experience points ensuring that the new total doesn't
|
||||
# exceed the maximum Exp. Points for the given growth rate.
|
||||
# currexp -- Current Exp Points.
|
||||
# expgain -- Exp. Points to add
|
||||
# growth -- Growth rate.
|
||||
def self.pbAddExperience(currexp,expgain,growth)
|
||||
if growth<0 || growth>PBGrowthRates.maxValue
|
||||
return ArgumentError.new("The growth rate is invalid.")
|
||||
end
|
||||
exp = currexp+expgain
|
||||
maxexp = pbGetExpInternal(maxLevel,growth)
|
||||
exp = maxexp if exp>maxexp
|
||||
return exp
|
||||
end
|
||||
|
||||
# Calculates a level given the number of Exp Points and growth rate.
|
||||
# growth -- Growth rate.
|
||||
def self.pbGetLevelFromExperience(exp,growth)
|
||||
if growth<0 || growth>PBGrowthRates.maxValue
|
||||
return ArgumentError.new("The growth rate is invalid.")
|
||||
end
|
||||
mLevel = maxLevel
|
||||
maxexp = pbGetExpInternal(mLevel,growth)
|
||||
exp = maxexp if exp>maxexp
|
||||
i = 0
|
||||
for j in 0..mLevel
|
||||
currentExp = pbGetExpInternal(i,growth)
|
||||
return i if exp==currentExp
|
||||
return i-1 if exp<currentExp
|
||||
i += 1
|
||||
end
|
||||
return mLevel
|
||||
end
|
||||
end
|
||||
66
Data/Scripts/011_Data/008_PBStats.rb
Normal file
66
Data/Scripts/011_Data/008_PBStats.rb
Normal file
@@ -0,0 +1,66 @@
|
||||
begin
|
||||
module PBStats
|
||||
# NOTE: You can change the order that the compiler expects Pokémon base
|
||||
# stats/EV yields (effort points) to be in, by simply renumbering the
|
||||
# stats here. The "main" stats (i.e. not accuracy/evasion) must still
|
||||
# use up numbers 0 to 5 inclusive, though. It's up to you to write the
|
||||
# base stats/EV yields in pokemon.txt and pokemonforms.txt in the
|
||||
# order expected.
|
||||
HP = 0
|
||||
ATTACK = 1
|
||||
DEFENSE = 2
|
||||
SPEED = 3
|
||||
SPATK = 4
|
||||
SPDEF = 5
|
||||
ACCURACY = 6
|
||||
EVASION = 7
|
||||
|
||||
def self.getName(id)
|
||||
id = getID(PBStats,id)
|
||||
names = []
|
||||
names[HP] = _INTL("HP")
|
||||
names[ATTACK] = _INTL("Attack")
|
||||
names[DEFENSE] = _INTL("Defense")
|
||||
names[SPEED] = _INTL("Speed")
|
||||
names[SPATK] = _INTL("Special Attack")
|
||||
names[SPDEF] = _INTL("Special Defense")
|
||||
names[ACCURACY] = _INTL("accuracy")
|
||||
names[EVASION] = _INTL("evasiveness")
|
||||
return names[id]
|
||||
end
|
||||
def self.getNameBrief(id)
|
||||
id = getID(PBStats,id)
|
||||
names = []
|
||||
names[HP] = _INTL("HP")
|
||||
names[ATTACK] = _INTL("Atk")
|
||||
names[DEFENSE] = _INTL("Def")
|
||||
names[SPEED] = _INTL("Spd")
|
||||
names[SPATK] = _INTL("SpAtk")
|
||||
names[SPDEF] = _INTL("SpDef")
|
||||
names[ACCURACY] = _INTL("acc")
|
||||
names[EVASION] = _INTL("eva")
|
||||
return names[id]
|
||||
end
|
||||
def self.eachStat
|
||||
[HP,ATTACK,DEFENSE,SPATK,SPDEF,SPEED].each { |s| yield s }
|
||||
end
|
||||
|
||||
def self.eachMainBattleStat
|
||||
[ATTACK,DEFENSE,SPATK,SPDEF,SPEED].each { |s| yield s }
|
||||
end
|
||||
|
||||
def self.eachBattleStat
|
||||
[ATTACK,DEFENSE,SPATK,SPDEF,SPEED,ACCURACY,EVASION].each { |s| yield s }
|
||||
end
|
||||
|
||||
def self.validBattleStat?(stat)
|
||||
self.eachBattleStat { |s| return true if s==stat }
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
rescue Exception
|
||||
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
|
||||
raise $!
|
||||
end
|
||||
end
|
||||
259
Data/Scripts/011_Data/009_PBRibbons.rb
Normal file
259
Data/Scripts/011_Data/009_PBRibbons.rb
Normal file
@@ -0,0 +1,259 @@
|
||||
module PBRibbons
|
||||
HOENNCOOL = 1
|
||||
HOENNCOOLSUPER = 2
|
||||
HOENNCOOLHYPER = 3
|
||||
HOENNCOOLMASTER = 4
|
||||
HOENNBEAUTY = 5
|
||||
HOENNBEAUTYSUPER = 6
|
||||
HOENNBEAUTYHYPER = 7
|
||||
HOENNBEAUTYMASTER = 8
|
||||
HOENNCUTE = 9
|
||||
HOENNCUTESUPER = 10
|
||||
HOENNCUTEHYPER = 11
|
||||
HOENNCUTEMASTER = 12
|
||||
HOENNSMART = 13
|
||||
HOENNSMARTSUPER = 14
|
||||
HOENNSMARTHYPER = 15
|
||||
HOENNSMARTMASTER = 16
|
||||
HOENNTOUGH = 17
|
||||
HOENNTOUGHSUPER = 18
|
||||
HOENNTOUGHHYPER = 19
|
||||
HOENNTOUGHMASTER = 20
|
||||
SINNOHCOOL = 21
|
||||
SINNOHCOOLSUPER = 22
|
||||
SINNOHCOOLHYPER = 23
|
||||
SINNOHCOOLMASTER = 24
|
||||
SINNOHBEAUTY = 25
|
||||
SINNOHBEAUTYSUPER = 26
|
||||
SINNOHBEAUTYHYPER = 27
|
||||
SINNOHBEAUTYMASTER = 28
|
||||
SINNOHCUTE = 29
|
||||
SINNOHCUTESUPER = 30
|
||||
SINNOHCUTEHYPER = 31
|
||||
SINNOHCUTEMASTER = 32
|
||||
SINNOHSMART = 33
|
||||
SINNOHSMARTSUPER = 34
|
||||
SINNOHSMARTHYPER = 35
|
||||
SINNOHSMARTMASTER = 36
|
||||
SINNOHTOUGH = 37
|
||||
SINNOHTOUGHSUPER = 38
|
||||
SINNOHTOUGHHYPER = 39
|
||||
SINNOHTOUGHMASTER = 40
|
||||
WINNING = 41
|
||||
VICTORY = 42
|
||||
ABILITY = 43
|
||||
GREATABILITY = 44
|
||||
DOUBLEABILITY = 45
|
||||
MULTIABILITY = 46
|
||||
PAIRABILITY = 47
|
||||
WORLDABILITY = 48
|
||||
CHAMPION = 49
|
||||
SINNOHCHAMP = 50
|
||||
RECORD = 51
|
||||
EVENT = 52
|
||||
LEGEND = 53
|
||||
GORGEOUS = 54
|
||||
ROYAL = 55
|
||||
GORGEOUSROYAL = 56
|
||||
ALERT = 57
|
||||
SHOCK = 58
|
||||
DOWNCAST = 59
|
||||
CARELESS = 60
|
||||
RELAX = 61
|
||||
SNOOZE = 62
|
||||
SMILE = 63
|
||||
FOOTPRINT = 64
|
||||
ARTIST = 65
|
||||
EFFORT = 66
|
||||
BIRTHDAY = 67
|
||||
SPECIAL = 68
|
||||
CLASSIC = 69
|
||||
PREMIER = 70
|
||||
SOUVENIR = 71
|
||||
WISHING = 72
|
||||
NATIONAL = 73
|
||||
COUNTRY = 74
|
||||
BATTLECHAMPION = 75
|
||||
REGIONALCHAMPION = 76
|
||||
EARTH = 77
|
||||
WORLD = 78
|
||||
NATIONALCHAMPION = 79
|
||||
WORLDCHAMPION = 80
|
||||
|
||||
def self.maxValue; 80; end
|
||||
def self.getCount; 80; end
|
||||
|
||||
def self.getName(id)
|
||||
id = getID(PBRibbons,id)
|
||||
names = ["",
|
||||
_INTL("Cool Ribbon"),
|
||||
_INTL("Cool Ribbon Super"),
|
||||
_INTL("Cool Ribbon Hyper"),
|
||||
_INTL("Cool Ribbon Master"),
|
||||
_INTL("Beauty Ribbon"),
|
||||
_INTL("Beauty Ribbon Super"),
|
||||
_INTL("Beauty Ribbon Hyper"),
|
||||
_INTL("Beauty Ribbon Master"),
|
||||
_INTL("Cute Ribbon"),
|
||||
_INTL("Cute Ribbon Super"),
|
||||
_INTL("Cute Ribbon Hyper"),
|
||||
_INTL("Cute Ribbon Master"),
|
||||
_INTL("Smart Ribbon"),
|
||||
_INTL("Smart Ribbon Super"),
|
||||
_INTL("Smart Ribbon Hyper"),
|
||||
_INTL("Smart Ribbon Master"),
|
||||
_INTL("Tough Ribbon"),
|
||||
_INTL("Tough Ribbon Super"),
|
||||
_INTL("Tough Ribbon Hyper"),
|
||||
_INTL("Tough Ribbon Master"),
|
||||
_INTL("Cool Ribbon"),
|
||||
_INTL("Cool Ribbon Great"),
|
||||
_INTL("Cool Ribbon Ultra"),
|
||||
_INTL("Cool Ribbon Master"),
|
||||
_INTL("Beauty Ribbon"),
|
||||
_INTL("Beauty Ribbon Great"),
|
||||
_INTL("Beauty Ribbon Ultra"),
|
||||
_INTL("Beauty Ribbon Master"),
|
||||
_INTL("Cute Ribbon"),
|
||||
_INTL("Cute Ribbon Great"),
|
||||
_INTL("Cute Ribbon Ultra"),
|
||||
_INTL("Cute Ribbon Master"),
|
||||
_INTL("Smart Ribbon"),
|
||||
_INTL("Smart Ribbon Great"),
|
||||
_INTL("Smart Ribbon Ultra"),
|
||||
_INTL("Smart Ribbon Master"),
|
||||
_INTL("Tough Ribbon"),
|
||||
_INTL("Tough Ribbon Great"),
|
||||
_INTL("Tough Ribbon Ultra"),
|
||||
_INTL("Tough Ribbon Master"),
|
||||
_INTL("Winning Ribbon"),
|
||||
_INTL("Victory Ribbon"),
|
||||
_INTL("Ability Ribbon"),
|
||||
_INTL("Great Ability Ribbon"),
|
||||
_INTL("Double Ability Ribbon"),
|
||||
_INTL("Multi Ability Ribbon"),
|
||||
_INTL("Pair Ability Ribbon"),
|
||||
_INTL("World Ability Ribbon"),
|
||||
_INTL("Champion Ribbon"),
|
||||
_INTL("Sinnoh Champ Ribbon"),
|
||||
_INTL("Record Ribbon"),
|
||||
_INTL("Event Ribbon"),
|
||||
_INTL("Legend Ribbon"),
|
||||
_INTL("Gorgeous Ribbon"),
|
||||
_INTL("Royal Ribbon"),
|
||||
_INTL("Gorgeous Royal Ribbon"),
|
||||
_INTL("Alert Ribbon"),
|
||||
_INTL("Shock Ribbon"),
|
||||
_INTL("Downcast Ribbon"),
|
||||
_INTL("Careless Ribbon"),
|
||||
_INTL("Relax Ribbon"),
|
||||
_INTL("Snooze Ribbon"),
|
||||
_INTL("Smile Ribbon"),
|
||||
_INTL("Footprint Ribbon"),
|
||||
_INTL("Artist Ribbon"),
|
||||
_INTL("Effort Ribbon"),
|
||||
_INTL("Birthday Ribbon"),
|
||||
_INTL("Special Ribbon"),
|
||||
_INTL("Classic Ribbon"),
|
||||
_INTL("Premier Ribbon"),
|
||||
_INTL("Souvenir Ribbon"),
|
||||
_INTL("Wishing Ribbon"),
|
||||
_INTL("National Ribbon"),
|
||||
_INTL("Country Ribbon"),
|
||||
_INTL("Battle Champion Ribbon"),
|
||||
_INTL("Regional Champion Ribbon"),
|
||||
_INTL("Earth Ribbon"),
|
||||
_INTL("World Ribbon"),
|
||||
_INTL("National Champion Ribbon"),
|
||||
_INTL("World Champion Ribbon")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
|
||||
def self.getDescription(id)
|
||||
id = getID(PBRibbons,id)
|
||||
desc = ["",
|
||||
_INTL("Hoenn Cool Contest Normal Rank winner!"),
|
||||
_INTL("Hoenn Cool Contest Super Rank winner!"),
|
||||
_INTL("Hoenn Cool Contest Hyper Rank winner!"),
|
||||
_INTL("Hoenn Cool Contest Master Rank winner!"),
|
||||
_INTL("Hoenn Beauty Contest Normal Rank winner!"),
|
||||
_INTL("Hoenn Beauty Contest Super Rank winner!"),
|
||||
_INTL("Hoenn Beauty Contest Hyper Rank winner!"),
|
||||
_INTL("Hoenn Beauty Contest Master Rank winner!"),
|
||||
_INTL("Hoenn Cute Contest Normal Rank winner!"),
|
||||
_INTL("Hoenn Cute Contest Super Rank winner!"),
|
||||
_INTL("Hoenn Cute Contest Hyper Rank winner!"),
|
||||
_INTL("Hoenn Cute Contest Master Rank winner!"),
|
||||
_INTL("Hoenn Smart Contest Normal Rank winner!"),
|
||||
_INTL("Hoenn Smart Contest Super Rank winner!"),
|
||||
_INTL("Hoenn Smart Contest Hyper Rank winner!"),
|
||||
_INTL("Hoenn Smart Contest Master Rank winner!"),
|
||||
_INTL("Hoenn Tough Contest Normal Rank winner!"),
|
||||
_INTL("Hoenn Tough Contest Super Rank winner!"),
|
||||
_INTL("Hoenn Tough Contest Hyper Rank winner!"),
|
||||
_INTL("Hoenn Tough Contest Master Rank winner!"),
|
||||
_INTL("Super Contest Cool Category Normal Rank winner!"),
|
||||
_INTL("Super Contest Cool Category Great Rank winner!"),
|
||||
_INTL("Super Contest Cool Category Ultra Rank winner!"),
|
||||
_INTL("Super Contest Cool Category Master Rank winner!"),
|
||||
_INTL("Super Contest Beauty Category Normal Rank winner!"),
|
||||
_INTL("Super Contest Beauty Category Great Rank winner!"),
|
||||
_INTL("Super Contest Beauty Category Ultra Rank winner!"),
|
||||
_INTL("Super Contest Beauty Category Master Rank winner!"),
|
||||
_INTL("Super Contest Cute Category Normal Rank winner!"),
|
||||
_INTL("Super Contest Cute Category Great Rank winner!"),
|
||||
_INTL("Super Contest Cute Category Ultra Rank winner!"),
|
||||
_INTL("Super Contest Cute Category Master Rank winner!"),
|
||||
_INTL("Super Contest Smart Category Normal Rank winner!"),
|
||||
_INTL("Super Contest Smart Category Great Rank winner!"),
|
||||
_INTL("Super Contest Smart Category Ultra Rank winner!"),
|
||||
_INTL("Super Contest Smart Category Master Rank winner!"),
|
||||
_INTL("Super Contest Tough Category Normal Rank winner!"),
|
||||
_INTL("Super Contest Tough Category Great Rank winner!"),
|
||||
_INTL("Super Contest Tough Category Ultra Rank winner!"),
|
||||
_INTL("Super Contest Tough Category Master Rank winner!"),
|
||||
_INTL("Ribbon awarded for clearing Hoenn's Battle Tower's Lv. 50 challenge."),
|
||||
_INTL("Ribbon awarded for clearing Hoenn's Battle Tower's Lv. 100 challenge."),
|
||||
_INTL("A Ribbon awarded for defeating the Tower Tycoon at the Battle Tower."),
|
||||
_INTL("A Ribbon awarded for defeating the Tower Tycoon at the Battle Tower."),
|
||||
_INTL("A Ribbon awarded for completing the Battle Tower Double challenge."),
|
||||
_INTL("A Ribbon awarded for completing the Battle Tower Multi challenge."),
|
||||
_INTL("A Ribbon awarded for completing the Battle Tower Link Multi challenge."),
|
||||
_INTL("A Ribbon awarded for completing the Wi-Fi Battle Tower challenge."),
|
||||
_INTL("Ribbon for clearing the Pokémon League and entering the Hall of Fame in another region. "),
|
||||
_INTL("Ribbon awarded for beating the Sinnoh Champion and entering the Hall of Fame."),
|
||||
_INTL("A Ribbon awarded for setting an incredible record."),
|
||||
_INTL("Pokémon Event Participation Ribbon."),
|
||||
_INTL("A Ribbon awarded for setting a legendary record."),
|
||||
_INTL("An extraordinarily gorgeous and extravagant Ribbon."),
|
||||
_INTL("An incredibly regal Ribbon with an air of nobility."),
|
||||
_INTL("A gorgeous and regal Ribbon that is the peak of fabulous."),
|
||||
_INTL("A Ribbon for recalling an invigorating event that created life energy."),
|
||||
_INTL("A Ribbon for recalling a thrilling event that made life more exciting."),
|
||||
_INTL("A Ribbon for recalling feelings of sadness that added spice to life."),
|
||||
_INTL("A Ribbon for recalling a careless error that helped steer life decisions."),
|
||||
_INTL("A Ribbon for recalling a refreshing event that added sparkle to life."),
|
||||
_INTL("A Ribbon for recalling a deep slumber that made life soothing."),
|
||||
_INTL("A Ribbon for recalling that smiles enrich the quality of life."),
|
||||
_INTL("A Ribbon awarded to a Pokémon deemed to have a top-quality footprint."),
|
||||
_INTL("Ribbon awarded for being chosen as a super sketch model in Hoenn."),
|
||||
_INTL("Ribbon awarded for being an exceptionally hard worker."),
|
||||
_INTL("A Ribbon to celebrate a birthday."),
|
||||
_INTL("A special Ribbon for a special day."),
|
||||
_INTL("A Ribbon that proclaims love for Pokémon."),
|
||||
_INTL("Special Holiday Ribbon."),
|
||||
_INTL("A Ribbon to cherish a special memory."),
|
||||
_INTL("A Ribbon said to make your wish come true."),
|
||||
_INTL("A Ribbon awarded for overcoming all difficult challenges."),
|
||||
_INTL("Pokémon League Champion Ribbon."),
|
||||
_INTL("Battle Competition Champion Ribbon."),
|
||||
_INTL("Pokémon World Championships Regional Champion Ribbon."),
|
||||
_INTL("A Ribbon awarded for winning 100 matches in a row."),
|
||||
_INTL("Pokémon League Champion Ribbon."),
|
||||
_INTL("Pokémon World Championships National Champion Ribbon."),
|
||||
_INTL("Pokémon World Championships World Champion Ribbon.")
|
||||
]
|
||||
return desc[id]
|
||||
end
|
||||
end
|
||||
42
Data/Scripts/011_Data/010_PBEggGroups.rb
Normal file
42
Data/Scripts/011_Data/010_PBEggGroups.rb
Normal file
@@ -0,0 +1,42 @@
|
||||
module PBEggGroups
|
||||
Undiscovered = 0 # NoEggs, None, NA
|
||||
Monster = 1
|
||||
Water1 = 2
|
||||
Bug = 3
|
||||
Flying = 4
|
||||
Field = 5 # Ground
|
||||
Fairy = 6
|
||||
Grass = 7 # Plant
|
||||
Humanlike = 8 # Humanoid, Humanshape, Human
|
||||
Water3 = 9
|
||||
Mineral = 10
|
||||
Amorphous = 11 # Indeterminate
|
||||
Water2 = 12
|
||||
Ditto = 13
|
||||
Dragon = 14
|
||||
|
||||
def self.maxValue; 14; end
|
||||
def self.getCount; 15; end
|
||||
|
||||
def self.getName(id)
|
||||
id = getID(PBEggGroups,id)
|
||||
names = [
|
||||
_INTL("Undiscovered"),
|
||||
_INTL("Monster"),
|
||||
_INTL("Water 1"),
|
||||
_INTL("Bug"),
|
||||
_INTL("Flying"),
|
||||
_INTL("Field"),
|
||||
_INTL("Fairy"),
|
||||
_INTL("Grass"),
|
||||
_INTL("Human-like"),
|
||||
_INTL("Water 3"),
|
||||
_INTL("Mineral"),
|
||||
_INTL("Amorphous"),
|
||||
_INTL("Water 2"),
|
||||
_INTL("Ditto"),
|
||||
_INTL("Dragon")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
end
|
||||
33
Data/Scripts/011_Data/011_PBColors.rb
Normal file
33
Data/Scripts/011_Data/011_PBColors.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
# Colors must begin at 0 and have no missing numbers
|
||||
module PBColors
|
||||
Red = 0
|
||||
Blue = 1
|
||||
Yellow = 2
|
||||
Green = 3
|
||||
Black = 4
|
||||
Brown = 5
|
||||
Purple = 6
|
||||
Gray = 7
|
||||
White = 8
|
||||
Pink = 9
|
||||
|
||||
def self.maxValue; 9; end
|
||||
def self.getCount; 10; end
|
||||
|
||||
def self.getName(id)
|
||||
id = getID(PBColors,id)
|
||||
names = [
|
||||
_INTL("Red"),
|
||||
_INTL("Blue"),
|
||||
_INTL("Yellow"),
|
||||
_INTL("Green"),
|
||||
_INTL("Black"),
|
||||
_INTL("Brown"),
|
||||
_INTL("Purple"),
|
||||
_INTL("Gray"),
|
||||
_INTL("White"),
|
||||
_INTL("Pink")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
end
|
||||
32
Data/Scripts/011_Data/012_PBHabitats.rb
Normal file
32
Data/Scripts/011_Data/012_PBHabitats.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
module PBHabitats
|
||||
None = 0
|
||||
Grassland = 1
|
||||
Forest = 2
|
||||
WatersEdge = 3
|
||||
Sea = 4
|
||||
Cave = 5
|
||||
Mountain = 6
|
||||
RoughTerrain = 7
|
||||
Urban = 8
|
||||
Rare = 9
|
||||
|
||||
def self.maxValue; 9; end
|
||||
def self.getCount; 10; end
|
||||
|
||||
def self.getName(id)
|
||||
id = getID(PBHabitats,id)
|
||||
names = [
|
||||
_INTL("None"),
|
||||
_INTL("Grassland"),
|
||||
_INTL("Forest"),
|
||||
_INTL("Water's Edge"),
|
||||
_INTL("Sea"),
|
||||
_INTL("Cave"),
|
||||
_INTL("Mountain"),
|
||||
_INTL("Rough Terrain"),
|
||||
_INTL("Urban"),
|
||||
_INTL("Rare")
|
||||
]
|
||||
return names[id]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user