From 899d03725525fd0956872c092549d4b937ec6eea Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Fri, 29 Oct 2021 20:34:50 +0100 Subject: [PATCH] Added pokemon.txt/pokemon_forms.txt property "Offspring" for species that could be produced by breeding --- .../Scripts/010_Data/002_PBS data/008_Species.rb | 16 +++++++++++++++- .../001_Editor screens/001_EditorScreens.rb | 3 ++- .../021_Compiler/002_Compiler_CompilePBS.rb | 12 +++++++++++- .../021_Compiler/003_Compiler_WritePBS.rb | 10 ++++++++-- PBS/Gen 5/pokemon.txt | 5 +++++ PBS/Gen 7/pokemon.txt | 5 +++++ PBS/Gen 8/pokemon.txt | 5 +++++ PBS/pokemon.txt | 5 +++++ 8 files changed, 56 insertions(+), 5 deletions(-) diff --git a/Data/Scripts/010_Data/002_PBS data/008_Species.rb b/Data/Scripts/010_Data/002_PBS data/008_Species.rb index 7a8ab085f..1f8f4547e 100644 --- a/Data/Scripts/010_Data/002_PBS data/008_Species.rb +++ b/Data/Scripts/010_Data/002_PBS data/008_Species.rb @@ -28,6 +28,7 @@ module GameData attr_reader :egg_groups attr_reader :hatch_steps attr_reader :incense + attr_reader :offspring attr_reader :evolutions attr_reader :height attr_reader :weight @@ -119,6 +120,7 @@ module GameData } if compiling_forms ret["PokedexForm"] = [0, "u"] + ret["Offspring"] = [0, "*e", :Species] ret["Evolutions"] = [0, "*ees", :Species, :Evolution, nil] ret["MegaStone"] = [0, "e", :Item] ret["MegaMove"] = [0, "e", :Move] @@ -130,6 +132,7 @@ module GameData ret["GrowthRate"] = [0, "e", :GrowthRate] ret["GenderRatio"] = [0, "e", :GenderRatio] ret["Incense"] = [0, "e", :Item] + ret["Offspring"] = [0, "*s"] ret["Evolutions"] = [0, "*ses", nil, :Evolution, nil] # All properties below here are old names for some properties above. # They will be removed in v21. @@ -171,6 +174,7 @@ module GameData @egg_groups = hash[:egg_groups] || [:Undiscovered] @hatch_steps = hash[:hatch_steps] || 1 @incense = hash[:incense] + @offspring = hash[:offspring] || [] @evolutions = hash[:evolutions] || [] @height = hash[:height] || 1 @weight = hash[:weight] || 1 @@ -275,13 +279,23 @@ module GameData return ret end - def get_related_species + # Returns an array of all the species in this species' evolution family. + def get_family_species sp = self.get_baby_species evos = GameData::Species.get(sp).get_family_evolutions(false) return [sp] if evos.length == 0 return [sp].concat(evos.map { |e| e[1] }).uniq end + # This takes into account whether other_species is evolved. + def breeding_can_produce?(other_species) + other_family = GameData::Species.get(other_species).get_family_species + if @offspring.length > 0 + return (other_family & @offspring).length > 0 + end + return other_family.include?(@id) + end + def family_evolutions_have_method?(check_method, check_param = nil) sp = self.get_baby_species evos = GameData::Species.get(sp).get_family_evolutions diff --git a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb index adfd2f64f..b7e9cff30 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb @@ -1131,6 +1131,7 @@ def pbPokemonEditor :egg_groups => egg_groups, # 26, 27 :hatch_steps => data[28], :incense => data[29], + :offspring => spec.offspring, :evolutions => data[30], :height => data[31], :weight => data[32], @@ -1321,7 +1322,7 @@ def pbRegionalDexEditorMain seen = [] GameData::Species.each_species do |s| next if seen.include?(s.species) - family = s.get_related_species + family = s.get_family_species new_dex.concat(family) seen.concat(family) end diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index 96356c7f6..1f9248370 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -630,6 +630,7 @@ module Compiler :egg_groups => contents["EggGroups"] || contents["Compatibility"], :hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"], :incense => contents["Incense"], + :offspring => contents["Offspring"], :evolutions => contents["Evolutions"], :height => contents["Height"], :weight => contents["Weight"], @@ -662,7 +663,15 @@ module Compiler end } } - # Enumerate all evolution species and parameters (this couldn't bedone earlier) + # Enumerate all offspring species (this couldn't be done earlier) + GameData::Species.each do |species| + FileLineData.setSection(species.id.to_s, "Offspring", nil) # For error reporting + offspring = species.offspring + offspring.each_with_index do |sp, i| + offspring[i] = csvEnumField!(sp, :Species, "Offspring", species.id) + end + end + # Enumerate all evolution species and parameters (this couldn't be done earlier) GameData::Species.each do |species| FileLineData.setSection(species.id.to_s, "Evolutions", nil) # For error reporting species.evolutions.each do |evo| @@ -821,6 +830,7 @@ module Compiler :egg_groups => contents["EggGroups"] || contents["Compatibility"] || base_data.egg_groups.clone, :hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"] || base_data.hatch_steps, :incense => base_data.incense, + :offspring => contents["Offspring"] || base_data.offspring.clone, :evolutions => evolutions, :height => contents["Height"] || base_data.height, :weight => contents["Weight"] || base_data.weight, diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index 0d3f85589..5f939f643 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -315,6 +315,10 @@ module Compiler f.write(sprintf("EggGroups = %s\r\n", species.egg_groups.join(","))) end f.write(sprintf("HatchSteps = %d\r\n", species.hatch_steps)) + f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense + if species.offspring.length > 0 + f.write(sprintf("Offspring = %s\r\n", species.offspring.join(","))) + end f.write(sprintf("Height = %.1f\r\n", species.height / 10.0)) f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0)) f.write(sprintf("Color = %s\r\n", species.color)) @@ -348,7 +352,6 @@ module Compiler end f.write("\r\n") end - f.write(sprintf("Incense = %s\r\n", species.incense)) if species.incense end } process_pbs_file_message_end @@ -411,6 +414,9 @@ module Compiler f.write(sprintf("EggGroups = %s\r\n", species.egg_groups.join(","))) end f.write(sprintf("HatchSteps = %d\r\n", species.hatch_steps)) if species.hatch_steps != base_species.hatch_steps + if species.offspring.length > 0 && species.offspring != base_species.offspring + f.write(sprintf("Offspring = %s\r\n", species.offspring.join(","))) + end f.write(sprintf("Height = %.1f\r\n", species.height / 10.0)) if species.height != base_species.height f.write(sprintf("Weight = %.1f\r\n", species.weight / 10.0)) if species.weight != base_species.weight f.write(sprintf("Color = %s\r\n", species.color)) if species.color != base_species.color @@ -546,7 +552,7 @@ module Compiler if current_family && current_family.include?(species) f.write(",") if comma else - current_family = GameData::Species.get(species).get_related_species + current_family = GameData::Species.get(species).get_family_species comma = false f.write("\r\n") end diff --git a/PBS/Gen 5/pokemon.txt b/PBS/Gen 5/pokemon.txt index 6a696d1d3..a40c92706 100644 --- a/PBS/Gen 5/pokemon.txt +++ b/PBS/Gen 5/pokemon.txt @@ -762,6 +762,7 @@ TutorMoves = AERIALACE,ATTRACT,BLIZZARD,CUT,DIG,DOUBLETEAM,ECHOEDVOICE,FACADE,FR EggMoves = BEATUP,CHARM,CHIPAWAY,COUNTER,DISABLE,ENDURE,FOCUSENERGY,IRONTAIL,POISONTAIL,PURSUIT,SKULLBASH,SUPERSONIC,TAKEDOWN EggGroups = Monster,Field HatchSteps = 5140 +Offspring = NIDORANfE,NIDORANmA Height = 0.4 Weight = 7.0 Color = Blue @@ -841,6 +842,7 @@ TutorMoves = ATTRACT,BLIZZARD,CUT,DIG,DOUBLETEAM,DRILLRUN,ECHOEDVOICE,FACADE,FRU EggMoves = AMNESIA,BEATUP,CHIPAWAY,CONFUSION,COUNTER,DISABLE,ENDURE,HEADSMASH,IRONTAIL,POISONTAIL,SUCKERPUNCH,SUPERSONIC,TAKEDOWN EggGroups = Monster,Field HatchSteps = 5140 +Offspring = NIDORANfE,NIDORANmA Height = 0.5 Weight = 9.0 Color = Purple @@ -8383,6 +8385,7 @@ TutorMoves = ACROBATICS,AERIALACE,AIRCUTTER,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEA EggMoves = BATONPASS,BUGBUZZ,DIZZYPUNCH,ENCORE,SEISMICTOSS,SILVERWIND,TRICK EggGroups = Bug,Humanlike HatchSteps = 3855 +Offspring = VOLBEAT,ILLUMISE Height = 0.7 Weight = 17.7 Color = Gray @@ -8409,6 +8412,7 @@ TutorMoves = ACROBATICS,AERIALACE,AIRCUTTER,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEA EggMoves = BATONPASS,BUGBUZZ,CAPTIVATE,CONFUSERAY,ENCORE,FAKETEARS,GROWTH,SILVERWIND EggGroups = Bug,Humanlike HatchSteps = 3855 +Offspring = VOLBEAT,ILLUMISE Height = 0.6 Weight = 17.7 Color = Purple @@ -13016,6 +13020,7 @@ Moves = 1,TAILGLOW,1,BUBBLE,1,WATERSPORT,9,CHARM,16,SUPERSONIC,24,BUBBLEBEAM,31, TutorMoves = ANCIENTPOWER,BLIZZARD,BOUNCE,CALMMIND,COVET,DIVE,DOUBLETEAM,ENERGYBALL,FACADE,FLASH,FLING,FRUSTRATION,GIGAIMPACT,GRASSKNOT,HAIL,HEALBELL,HELPINGHAND,HIDDENPOWER,HYPERBEAM,ICEBEAM,ICYWIND,KNOCKOFF,LASTRESORT,LIGHTSCREEN,MUDSLAP,PROTECT,PSYCHIC,PSYCHUP,RAINDANCE,REFLECT,REST,RETURN,ROUND,SAFEGUARD,SCALD,SHADOWBALL,SIGNALBEAM,SKILLSWAP,SLEEPTALK,SNORE,SUBSTITUTE,SURF,SWAGGER,SWIFT,TOXIC,UPROAR,UTURN,WATERFALL EggGroups = Water1,Fairy HatchSteps = 2570 +Offspring = PHIONE Height = 0.3 Weight = 1.4 Color = Blue diff --git a/PBS/Gen 7/pokemon.txt b/PBS/Gen 7/pokemon.txt index 931afca93..5456887cd 100644 --- a/PBS/Gen 7/pokemon.txt +++ b/PBS/Gen 7/pokemon.txt @@ -762,6 +762,7 @@ TutorMoves = AERIALACE,ATTRACT,BLIZZARD,CONFIDE,CUT,DOUBLETEAM,ECHOEDVOICE,FACAD EggMoves = BEATUP,CHARM,CHIPAWAY,COUNTER,DISABLE,ENDURE,FOCUSENERGY,IRONTAIL,POISONTAIL,PURSUIT,SKULLBASH,SUPERSONIC,TAKEDOWN,VENOMDRENCH EggGroups = Monster,Field HatchSteps = 5120 +Offspring = NIDORANfE,NIDORANmA Height = 0.4 Weight = 7.0 Color = Blue @@ -841,6 +842,7 @@ TutorMoves = ATTRACT,BLIZZARD,CONFIDE,CUT,DOUBLETEAM,DRILLRUN,ECHOEDVOICE,FACADE EggMoves = AMNESIA,BEATUP,CHIPAWAY,CONFUSION,COUNTER,DISABLE,ENDURE,HEADSMASH,IRONTAIL,POISONTAIL,SUCKERPUNCH,SUPERSONIC,TAKEDOWN,VENOMDRENCH EggGroups = Monster,Field HatchSteps = 5120 +Offspring = NIDORANfE,NIDORANmA Height = 0.5 Weight = 9.0 Color = Purple @@ -8388,6 +8390,7 @@ TutorMoves = ACROBATICS,AERIALACE,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEAM,CONFIDE, EggMoves = BATONPASS,BUGBUZZ,DIZZYPUNCH,ENCORE,LUNGE,SEISMICTOSS,SILVERWIND,TRICK EggGroups = Bug,Humanlike HatchSteps = 3840 +Offspring = VOLBEAT,ILLUMISE Height = 0.7 Weight = 17.7 Color = Gray @@ -8415,6 +8418,7 @@ TutorMoves = ACROBATICS,AERIALACE,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEAM,CONFIDE, EggMoves = AROMATHERAPY,BATONPASS,BUGBUZZ,CAPTIVATE,CONFUSERAY,ENCORE,FAKETEARS,GROWTH,SILVERWIND EggGroups = Bug,Humanlike HatchSteps = 3840 +Offspring = VOLBEAT,ILLUMISE Height = 0.6 Weight = 17.7 Color = Purple @@ -13001,6 +13005,7 @@ Moves = 1,TAILGLOW,1,BUBBLE,1,WATERSPORT,9,CHARM,16,SUPERSONIC,24,BUBBLEBEAM,31, TutorMoves = BLIZZARD,BOUNCE,CALMMIND,CONFIDE,COVET,DAZZLINGGLEAM,DIVE,DOUBLETEAM,ENERGYBALL,FACADE,FLING,FRUSTRATION,GIGAIMPACT,GRASSKNOT,HAIL,HEALBELL,HELPINGHAND,HIDDENPOWER,HYPERBEAM,ICEBEAM,ICYWIND,KNOCKOFF,LASTRESORT,LIGHTSCREEN,LIQUIDATION,PROTECT,PSYCHIC,PSYCHUP,RAINDANCE,REFLECT,REST,RETURN,ROUND,SAFEGUARD,SCALD,SHADOWBALL,SIGNALBEAM,SKILLSWAP,SLEEPTALK,SNORE,SUBSTITUTE,SURF,SWAGGER,TOXIC,UPROAR,UTURN,WATERFALL,WATERPULSE EggGroups = Water1,Fairy HatchSteps = 2560 +Offspring = PHIONE Height = 0.3 Weight = 1.4 Color = Blue diff --git a/PBS/Gen 8/pokemon.txt b/PBS/Gen 8/pokemon.txt index 0f6783516..4719fc4ba 100644 --- a/PBS/Gen 8/pokemon.txt +++ b/PBS/Gen 8/pokemon.txt @@ -762,6 +762,7 @@ TutorMoves = ATTRACT,BEATUP,BLIZZARD,BODYSLAM,CHARM,CRUNCH,DIG,EARTHPOWER,ENDURE EggMoves = COUNTER,DISABLE,POISONFANG,POISONTAIL,SKULLBASH,SUPERSONIC,TAKEDOWN EggGroups = Monster,Field HatchSteps = 5120 +Offspring = NIDORANfE,NIDORANmA Height = 0.4 Weight = 7.0 Color = Blue @@ -841,6 +842,7 @@ TutorMoves = AMNESIA,ATTRACT,BEATUP,BLIZZARD,BODYSLAM,DIG,DRILLRUN,EARTHPOWER,EN EggMoves = CONFUSION,COUNTER,DISABLE,HEADSMASH,HORNDRILL,POISONTAIL,SUCKERPUNCH,SUPERSONIC,TAKEDOWN,THRASH EggGroups = Monster,Field HatchSteps = 5120 +Offspring = NIDORANfE,NIDORANmA Height = 0.5 Weight = 9.0 Color = Purple @@ -8390,6 +8392,7 @@ TutorMoves = ACROBATICS,AERIALACE,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEAM,CONFIDE, EggMoves = BATONPASS,BUGBUZZ,DIZZYPUNCH,ENCORE,LUNGE,SEISMICTOSS,SILVERWIND,TRICK EggGroups = Bug,Humanlike HatchSteps = 3840 +Offspring = VOLBEAT,ILLUMISE Height = 0.7 Weight = 17.7 Color = Gray @@ -8417,6 +8420,7 @@ TutorMoves = ACROBATICS,AERIALACE,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEAM,CONFIDE, EggMoves = AROMATHERAPY,BATONPASS,BUGBUZZ,CAPTIVATE,CONFUSERAY,ENCORE,FAKETEARS,GROWTH,SILVERWIND EggGroups = Bug,Humanlike HatchSteps = 3840 +Offspring = VOLBEAT,ILLUMISE Height = 0.6 Weight = 17.7 Color = Purple @@ -13003,6 +13007,7 @@ Moves = 1,TAILGLOW,1,BUBBLE,1,WATERSPORT,9,CHARM,16,SUPERSONIC,24,BUBBLEBEAM,31, TutorMoves = BLIZZARD,BOUNCE,CALMMIND,CONFIDE,COVET,DAZZLINGGLEAM,DIVE,DOUBLETEAM,ENERGYBALL,FACADE,FLING,FRUSTRATION,GIGAIMPACT,GRASSKNOT,HAIL,HEALBELL,HELPINGHAND,HIDDENPOWER,HYPERBEAM,ICEBEAM,ICYWIND,KNOCKOFF,LASTRESORT,LIGHTSCREEN,LIQUIDATION,PROTECT,PSYCHIC,PSYCHUP,RAINDANCE,REFLECT,REST,RETURN,ROUND,SAFEGUARD,SCALD,SHADOWBALL,SIGNALBEAM,SKILLSWAP,SLEEPTALK,SNORE,SUBSTITUTE,SURF,SWAGGER,TOXIC,UPROAR,UTURN,WATERFALL,WATERPULSE EggGroups = Water1,Fairy HatchSteps = 2560 +Offspring = PHIONE Height = 0.3 Weight = 1.4 Color = Blue diff --git a/PBS/pokemon.txt b/PBS/pokemon.txt index 0f6783516..4719fc4ba 100644 --- a/PBS/pokemon.txt +++ b/PBS/pokemon.txt @@ -762,6 +762,7 @@ TutorMoves = ATTRACT,BEATUP,BLIZZARD,BODYSLAM,CHARM,CRUNCH,DIG,EARTHPOWER,ENDURE EggMoves = COUNTER,DISABLE,POISONFANG,POISONTAIL,SKULLBASH,SUPERSONIC,TAKEDOWN EggGroups = Monster,Field HatchSteps = 5120 +Offspring = NIDORANfE,NIDORANmA Height = 0.4 Weight = 7.0 Color = Blue @@ -841,6 +842,7 @@ TutorMoves = AMNESIA,ATTRACT,BEATUP,BLIZZARD,BODYSLAM,DIG,DRILLRUN,EARTHPOWER,EN EggMoves = CONFUSION,COUNTER,DISABLE,HEADSMASH,HORNDRILL,POISONTAIL,SUCKERPUNCH,SUPERSONIC,TAKEDOWN,THRASH EggGroups = Monster,Field HatchSteps = 5120 +Offspring = NIDORANfE,NIDORANmA Height = 0.5 Weight = 9.0 Color = Purple @@ -8390,6 +8392,7 @@ TutorMoves = ACROBATICS,AERIALACE,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEAM,CONFIDE, EggMoves = BATONPASS,BUGBUZZ,DIZZYPUNCH,ENCORE,LUNGE,SEISMICTOSS,SILVERWIND,TRICK EggGroups = Bug,Humanlike HatchSteps = 3840 +Offspring = VOLBEAT,ILLUMISE Height = 0.7 Weight = 17.7 Color = Gray @@ -8417,6 +8420,7 @@ TutorMoves = ACROBATICS,AERIALACE,ATTRACT,BRICKBREAK,BUGBITE,CHARGEBEAM,CONFIDE, EggMoves = AROMATHERAPY,BATONPASS,BUGBUZZ,CAPTIVATE,CONFUSERAY,ENCORE,FAKETEARS,GROWTH,SILVERWIND EggGroups = Bug,Humanlike HatchSteps = 3840 +Offspring = VOLBEAT,ILLUMISE Height = 0.6 Weight = 17.7 Color = Purple @@ -13003,6 +13007,7 @@ Moves = 1,TAILGLOW,1,BUBBLE,1,WATERSPORT,9,CHARM,16,SUPERSONIC,24,BUBBLEBEAM,31, TutorMoves = BLIZZARD,BOUNCE,CALMMIND,CONFIDE,COVET,DAZZLINGGLEAM,DIVE,DOUBLETEAM,ENERGYBALL,FACADE,FLING,FRUSTRATION,GIGAIMPACT,GRASSKNOT,HAIL,HEALBELL,HELPINGHAND,HIDDENPOWER,HYPERBEAM,ICEBEAM,ICYWIND,KNOCKOFF,LASTRESORT,LIGHTSCREEN,LIQUIDATION,PROTECT,PSYCHIC,PSYCHUP,RAINDANCE,REFLECT,REST,RETURN,ROUND,SAFEGUARD,SCALD,SHADOWBALL,SIGNALBEAM,SKILLSWAP,SLEEPTALK,SNORE,SUBSTITUTE,SURF,SWAGGER,TOXIC,UPROAR,UTURN,WATERFALL,WATERPULSE EggGroups = Water1,Fairy HatchSteps = 2560 +Offspring = PHIONE Height = 0.3 Weight = 1.4 Color = Blue