mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixed regional form-exclusive species producing eggs of the wrong species, fixed eggs not being the appropriate form based on the region they were made in
This commit is contained in:
@@ -244,7 +244,7 @@ module GameData
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_family_evolutions(exclude_invalid = true)
|
def get_family_evolutions(exclude_invalid = true)
|
||||||
evos = self.get_evolutions(exclude_invalid)
|
evos = get_evolutions(exclude_invalid)
|
||||||
evos = evos.sort { |a, b| GameData::Species.keys.index(a[0]) <=> GameData::Species.keys.index(b[0]) }
|
evos = evos.sort { |a, b| GameData::Species.keys.index(a[0]) <=> GameData::Species.keys.index(b[0]) }
|
||||||
ret = []
|
ret = []
|
||||||
evos.each do |evo|
|
evos.each do |evo|
|
||||||
@@ -280,7 +280,7 @@ module GameData
|
|||||||
|
|
||||||
# Returns an array of all the species in this species' evolution family.
|
# Returns an array of all the species in this species' evolution family.
|
||||||
def get_family_species
|
def get_family_species
|
||||||
sp = self.get_baby_species
|
sp = get_baby_species
|
||||||
evos = GameData::Species.get(sp).get_family_evolutions(false)
|
evos = GameData::Species.get(sp).get_family_evolutions(false)
|
||||||
return [sp] if evos.length == 0
|
return [sp] if evos.length == 0
|
||||||
return [sp].concat(evos.map { |e| e[1] }).uniq
|
return [sp].concat(evos.map { |e| e[1] }).uniq
|
||||||
@@ -292,7 +292,7 @@ module GameData
|
|||||||
if @offspring.length > 0
|
if @offspring.length > 0
|
||||||
return (other_family & @offspring).length > 0
|
return (other_family & @offspring).length > 0
|
||||||
end
|
end
|
||||||
return other_family.include?(@id)
|
return other_family.include?(@species)
|
||||||
end
|
end
|
||||||
|
|
||||||
# If this species doesn't have egg moves, looks at prevolutions one at a
|
# If this species doesn't have egg moves, looks at prevolutions one at a
|
||||||
@@ -305,7 +305,7 @@ module GameData
|
|||||||
end
|
end
|
||||||
|
|
||||||
def family_evolutions_have_method?(check_method, check_param = nil)
|
def family_evolutions_have_method?(check_method, check_param = nil)
|
||||||
sp = self.get_baby_species
|
sp = get_baby_species
|
||||||
evos = GameData::Species.get(sp).get_family_evolutions
|
evos = GameData::Species.get(sp).get_family_evolutions
|
||||||
return false if evos.length == 0
|
return false if evos.length == 0
|
||||||
evos.each do |evo|
|
evos.each do |evo|
|
||||||
@@ -322,7 +322,7 @@ module GameData
|
|||||||
# Used by the Moon Ball when checking if a Pokémon's evolution family
|
# Used by the Moon Ball when checking if a Pokémon's evolution family
|
||||||
# includes an evolution that uses the Moon Stone.
|
# includes an evolution that uses the Moon Stone.
|
||||||
def family_item_evolutions_use_item?(check_item = nil)
|
def family_item_evolutions_use_item?(check_item = nil)
|
||||||
sp = self.get_baby_species
|
sp = get_baby_species
|
||||||
evos = GameData::Species.get(sp).get_family_evolutions
|
evos = GameData::Species.get(sp).get_family_evolutions
|
||||||
return false if !evos || evos.length == 0
|
return false if !evos || evos.length == 0
|
||||||
evos.each do |evo|
|
evos.each do |evo|
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ class DayCare
|
|||||||
egg.obtain_text = _INTL("Day-Care Couple")
|
egg.obtain_text = _INTL("Day-Care Couple")
|
||||||
egg.happiness = 120
|
egg.happiness = 120
|
||||||
egg.form = 0 if species == :SINISTEA
|
egg.form = 0 if species == :SINISTEA
|
||||||
|
# Set regional form
|
||||||
|
new_form = MultipleForms.call("getFormOnEggCreation", egg)
|
||||||
|
egg.form = new_form if new_form
|
||||||
return egg
|
return egg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -707,10 +707,39 @@ MultipleForms.register(:CALYREX, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Regional forms
|
||||||
|
# This code is for determining the form of a Pokémon in an egg created at the
|
||||||
|
# Day Care, where that Pokémon's species has regional forms. The regional form
|
||||||
|
# chosen depends on the region in which the egg was produced (not where it
|
||||||
|
# hatches).
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
# The code in this proc assumes that the appropriate regional form for a Pokémon
|
||||||
|
# is equal to the region's number. This may not be true in your game.
|
||||||
|
# Note that this proc only produces a non-zero form number if the species has a
|
||||||
|
# defined form with that number, which means it can be used for both Alolan and
|
||||||
|
# Galarian forms separately (and for Meowth which has both).
|
||||||
|
MultipleForms.register(:RATTATA, {
|
||||||
|
"getFormOnEggCreation" => proc { |pkmn|
|
||||||
|
if $game_map
|
||||||
|
map_pos = $game_map.metadata&.town_map_position
|
||||||
|
next map_pos[0] if map_pos &&
|
||||||
|
GameData::Species.get_species_form(pkmn.species, map_pos[0]).form == map_pos[0]
|
||||||
|
end
|
||||||
|
next 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
MultipleForms.copy(:RATTATA, :SANDSHREW, :VULPIX, :DIGLETT, :MEOWTH, :GEODUDE,
|
||||||
|
:GRIMER, :PONYTA, :FARFETCHD, :CORSOLA, :ZIGZAGOON,
|
||||||
|
:DARUMAKA, :YAMASK, :STUNFISK, :SLOWPOKE, :ARTICUNO, :ZAPDOS,
|
||||||
|
:MOLTRES)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Regional forms
|
# Regional forms
|
||||||
# These species don't have visually different regional forms, but they need to
|
# These species don't have visually different regional forms, but they need to
|
||||||
# evolve into different forms depending on the location where they evolved.
|
# evolve into different forms depending on the location where they evolve.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# Alolan forms
|
# Alolan forms
|
||||||
|
|||||||
@@ -649,39 +649,39 @@ module Compiler
|
|||||||
types = [types] if !types.is_a?(Array)
|
types = [types] if !types.is_a?(Array)
|
||||||
types = types.uniq.compact
|
types = types.uniq.compact
|
||||||
species_hash = {
|
species_hash = {
|
||||||
:id => contents["InternalName"].to_sym,
|
:id => contents["InternalName"].to_sym,
|
||||||
:name => contents["Name"],
|
:name => contents["Name"],
|
||||||
:form_name => contents["FormName"],
|
:form_name => contents["FormName"],
|
||||||
:category => contents["Category"] || contents["Kind"],
|
:category => contents["Category"] || contents["Kind"],
|
||||||
:pokedex_entry => contents["Pokedex"],
|
:pokedex_entry => contents["Pokedex"],
|
||||||
:types => types,
|
:types => types,
|
||||||
:base_stats => contents["BaseStats"],
|
:base_stats => contents["BaseStats"],
|
||||||
:evs => contents["EVs"] || contents["EffortPoints"],
|
:evs => contents["EVs"] || contents["EffortPoints"],
|
||||||
:base_exp => contents["BaseExp"] || contents["BaseEXP"],
|
:base_exp => contents["BaseExp"] || contents["BaseEXP"],
|
||||||
:growth_rate => contents["GrowthRate"],
|
:growth_rate => contents["GrowthRate"],
|
||||||
:gender_ratio => contents["GenderRatio"] || contents["GenderRate"],
|
:gender_ratio => contents["GenderRatio"] || contents["GenderRate"],
|
||||||
:catch_rate => contents["CatchRate"] || contents["Rareness"],
|
:catch_rate => contents["CatchRate"] || contents["Rareness"],
|
||||||
:happiness => contents["Happiness"],
|
:happiness => contents["Happiness"],
|
||||||
:moves => contents["Moves"],
|
:moves => contents["Moves"],
|
||||||
:tutor_moves => contents["TutorMoves"],
|
:tutor_moves => contents["TutorMoves"],
|
||||||
:egg_moves => contents["EggMoves"],
|
:egg_moves => contents["EggMoves"],
|
||||||
:abilities => contents["Abilities"],
|
:abilities => contents["Abilities"],
|
||||||
:hidden_abilities => contents["HiddenAbilities"] || contents["HiddenAbility"],
|
:hidden_abilities => contents["HiddenAbilities"] || contents["HiddenAbility"],
|
||||||
:wild_item_common => contents["WildItemCommon"],
|
:wild_item_common => contents["WildItemCommon"],
|
||||||
:wild_item_uncommon => contents["WildItemUncommon"],
|
:wild_item_uncommon => contents["WildItemUncommon"],
|
||||||
:wild_item_rare => contents["WildItemRare"],
|
:wild_item_rare => contents["WildItemRare"],
|
||||||
:egg_groups => contents["EggGroups"] || contents["Compatibility"],
|
:egg_groups => contents["EggGroups"] || contents["Compatibility"],
|
||||||
:hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"],
|
:hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"],
|
||||||
:incense => contents["Incense"],
|
:incense => contents["Incense"],
|
||||||
:offspring => contents["Offspring"],
|
:offspring => contents["Offspring"],
|
||||||
:evolutions => contents["Evolutions"],
|
:evolutions => contents["Evolutions"],
|
||||||
:height => contents["Height"],
|
:height => contents["Height"],
|
||||||
:weight => contents["Weight"],
|
:weight => contents["Weight"],
|
||||||
:color => contents["Color"],
|
:color => contents["Color"],
|
||||||
:shape => contents["Shape"],
|
:shape => contents["Shape"],
|
||||||
:habitat => contents["Habitat"],
|
:habitat => contents["Habitat"],
|
||||||
:generation => contents["Generation"],
|
:generation => contents["Generation"],
|
||||||
:flags => contents["Flags"]
|
:flags => contents["Flags"]
|
||||||
}
|
}
|
||||||
# Add species' data to records
|
# Add species' data to records
|
||||||
GameData::Species.register(species_hash)
|
GameData::Species.register(species_hash)
|
||||||
@@ -850,46 +850,46 @@ module Compiler
|
|||||||
base_data.evolutions.each { |e| evolutions.push(e.clone) }
|
base_data.evolutions.each { |e| evolutions.push(e.clone) }
|
||||||
end
|
end
|
||||||
species_hash = {
|
species_hash = {
|
||||||
:id => form_symbol,
|
:id => form_symbol,
|
||||||
:species => species_symbol,
|
:species => species_symbol,
|
||||||
:form => form,
|
:form => form,
|
||||||
:name => base_data.real_name,
|
:name => base_data.real_name,
|
||||||
:form_name => contents["FormName"],
|
:form_name => contents["FormName"],
|
||||||
:category => contents["Category"] || contents["Kind"] || base_data.real_category,
|
:category => contents["Category"] || contents["Kind"] || base_data.real_category,
|
||||||
:pokedex_entry => contents["Pokedex"] || base_data.real_pokedex_entry,
|
:pokedex_entry => contents["Pokedex"] || base_data.real_pokedex_entry,
|
||||||
:pokedex_form => contents["PokedexForm"],
|
:pokedex_form => contents["PokedexForm"],
|
||||||
:types => types,
|
:types => types,
|
||||||
:base_stats => contents["BaseStats"] || base_data.base_stats,
|
:base_stats => contents["BaseStats"] || base_data.base_stats,
|
||||||
:evs => contents["EVs"] || contents["EffortPoints"] || base_data.evs,
|
:evs => contents["EVs"] || contents["EffortPoints"] || base_data.evs,
|
||||||
:base_exp => contents["BaseExp"] || contents["BaseEXP"] || base_data.base_exp,
|
:base_exp => contents["BaseExp"] || contents["BaseEXP"] || base_data.base_exp,
|
||||||
:growth_rate => base_data.growth_rate,
|
:growth_rate => base_data.growth_rate,
|
||||||
:gender_ratio => base_data.gender_ratio,
|
:gender_ratio => base_data.gender_ratio,
|
||||||
:catch_rate => contents["CatchRate"] || contents["Rareness"] || base_data.catch_rate,
|
:catch_rate => contents["CatchRate"] || contents["Rareness"] || base_data.catch_rate,
|
||||||
:happiness => contents["Happiness"] || base_data.happiness,
|
:happiness => contents["Happiness"] || base_data.happiness,
|
||||||
:moves => moves,
|
:moves => moves,
|
||||||
:tutor_moves => contents["TutorMoves"] || base_data.tutor_moves.clone,
|
:tutor_moves => contents["TutorMoves"] || base_data.tutor_moves.clone,
|
||||||
:egg_moves => contents["EggMoves"] || base_data.egg_moves.clone,
|
:egg_moves => contents["EggMoves"] || base_data.egg_moves.clone,
|
||||||
:abilities => contents["Abilities"] || base_data.abilities.clone,
|
:abilities => contents["Abilities"] || base_data.abilities.clone,
|
||||||
:hidden_abilities => contents["HiddenAbilities"] || contents["HiddenAbility"] || base_data.hidden_abilities.clone,
|
:hidden_abilities => contents["HiddenAbilities"] || contents["HiddenAbility"] || base_data.hidden_abilities.clone,
|
||||||
:wild_item_common => contents["WildItemCommon"] || base_data.wild_item_common.clone,
|
:wild_item_common => contents["WildItemCommon"] || base_data.wild_item_common.clone,
|
||||||
:wild_item_uncommon => contents["WildItemUncommon"] || base_data.wild_item_uncommon.clone,
|
:wild_item_uncommon => contents["WildItemUncommon"] || base_data.wild_item_uncommon.clone,
|
||||||
:wild_item_rare => contents["WildItemRare"] || base_data.wild_item_rare.clone,
|
:wild_item_rare => contents["WildItemRare"] || base_data.wild_item_rare.clone,
|
||||||
:egg_groups => contents["EggGroups"] || contents["Compatibility"] || base_data.egg_groups.clone,
|
:egg_groups => contents["EggGroups"] || contents["Compatibility"] || base_data.egg_groups.clone,
|
||||||
:hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"] || base_data.hatch_steps,
|
:hatch_steps => contents["HatchSteps"] || contents["StepsToHatch"] || base_data.hatch_steps,
|
||||||
:incense => base_data.incense,
|
:incense => base_data.incense,
|
||||||
:offspring => contents["Offspring"] || base_data.offspring.clone,
|
:offspring => contents["Offspring"] || base_data.offspring.clone,
|
||||||
:evolutions => evolutions,
|
:evolutions => evolutions,
|
||||||
:height => contents["Height"] || base_data.height,
|
:height => contents["Height"] || base_data.height,
|
||||||
:weight => contents["Weight"] || base_data.weight,
|
:weight => contents["Weight"] || base_data.weight,
|
||||||
:color => contents["Color"] || base_data.color,
|
:color => contents["Color"] || base_data.color,
|
||||||
:shape => contents["Shape"] || base_data.shape,
|
:shape => contents["Shape"] || base_data.shape,
|
||||||
:habitat => contents["Habitat"] || base_data.habitat,
|
:habitat => contents["Habitat"] || base_data.habitat,
|
||||||
:generation => contents["Generation"] || base_data.generation,
|
:generation => contents["Generation"] || base_data.generation,
|
||||||
:flags => contents["Flags"] || base_data.flags.clone,
|
:flags => contents["Flags"] || base_data.flags.clone,
|
||||||
:mega_stone => contents["MegaStone"],
|
:mega_stone => contents["MegaStone"],
|
||||||
:mega_move => contents["MegaMove"],
|
:mega_move => contents["MegaMove"],
|
||||||
:unmega_form => contents["UnmegaForm"],
|
:unmega_form => contents["UnmegaForm"],
|
||||||
:mega_message => contents["MegaMessage"]
|
:mega_message => contents["MegaMessage"]
|
||||||
}
|
}
|
||||||
# If form has any wild items, ensure none are inherited from base species
|
# If form has any wild items, ensure none are inherited from base species
|
||||||
if (contents["WildItemCommon"] && !contents["WildItemCommon"].empty?) ||
|
if (contents["WildItemCommon"] && !contents["WildItemCommon"].empty?) ||
|
||||||
@@ -941,9 +941,15 @@ module Compiler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
GameData::Species.each do |species| # Distribute prevolutions
|
GameData::Species.each do |species| # Distribute prevolutions
|
||||||
next if species.form == 0 # Looking at alternate forms only
|
|
||||||
next if species.evolutions.any? { |evo| evo[3] } # Already has prevo listed
|
next if species.evolutions.any? { |evo| evo[3] } # Already has prevo listed
|
||||||
species.evolutions.push(all_evos[species.species].clone) if all_evos[species.species]
|
next if !all_evos[species.species]
|
||||||
|
# Record what species evolves from
|
||||||
|
species.evolutions.push(all_evos[species.species].clone)
|
||||||
|
# Record that the prevolution can evolve into species
|
||||||
|
prevo = GameData::Species.get(all_evos[species.species][0])
|
||||||
|
if prevo.evolutions.none? { |evo| !evo[3] && evo[0] == species.species }
|
||||||
|
prevo.evolutions.push([species.species, :None, nil])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
# Save all data
|
# Save all data
|
||||||
GameData::Species.save
|
GameData::Species.save
|
||||||
|
|||||||
Reference in New Issue
Block a user