diff --git a/Data/Actors.rxdata b/Data/Actors.rxdata index 41edc8e26..7967a5432 100644 Binary files a/Data/Actors.rxdata and b/Data/Actors.rxdata differ diff --git a/Data/Animations.rxdata b/Data/Animations.rxdata index 6e93f365d..17f99d75e 100644 Binary files a/Data/Animations.rxdata and b/Data/Animations.rxdata differ diff --git a/Data/Armors.rxdata b/Data/Armors.rxdata index 901f2bb2b..2249bec14 100644 Binary files a/Data/Armors.rxdata and b/Data/Armors.rxdata differ diff --git a/Data/CommonEvents.rxdata b/Data/CommonEvents.rxdata index f5439b6a0..b1f3b4c57 100644 Binary files a/Data/CommonEvents.rxdata and b/Data/CommonEvents.rxdata differ diff --git a/Data/Enemies.rxdata b/Data/Enemies.rxdata index be622f513..004ee903d 100644 Binary files a/Data/Enemies.rxdata and b/Data/Enemies.rxdata differ diff --git a/Data/Items.rxdata b/Data/Items.rxdata index fe767fa0b..3e62ba6d2 100644 Binary files a/Data/Items.rxdata and b/Data/Items.rxdata differ diff --git a/Data/Map355.rxdata b/Data/Map355.rxdata index cee41a37c..338e3d9c4 100644 Binary files a/Data/Map355.rxdata and b/Data/Map355.rxdata differ diff --git a/Data/Map490.rxdata b/Data/Map490.rxdata index 31b5e50e1..8251a377b 100644 Binary files a/Data/Map490.rxdata and b/Data/Map490.rxdata differ diff --git a/Data/Map799.rxdata b/Data/Map799.rxdata index 9ea8ef8ab..31546497b 100644 Binary files a/Data/Map799.rxdata and b/Data/Map799.rxdata differ diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index e3607c8aa..c83f78e50 100644 Binary files a/Data/MapInfos.rxdata and b/Data/MapInfos.rxdata differ diff --git a/Data/Scripts/010_Data/001_GameData.rb b/Data/Scripts/010_Data/001_GameData.rb index ca75946f8..c632e05ef 100644 --- a/Data/Scripts/010_Data/001_GameData.rb +++ b/Data/Scripts/010_Data/001_GameData.rb @@ -24,12 +24,28 @@ module GameData # @return [self] def get(other) validate other => [Symbol, self, String, Integer] + return other if other.is_a?(self) other = other.to_sym if other.is_a?(String) -# if other.is_a?(Integer) -# p "Please switch to symbols, thanks." -# end + + if other.to_s.match?(/\AB\d+H\d+\z/) + species = GameData::FusedSpecies.new(other) + return species + end + if other.is_a?(Integer) #assume it's a species + if other > NB_POKEMON + body_id = getBodyID(other) + head_id = getHeadID(other,body_id) + pokemon_id = getFusedPokemonIdFromDexNum(body_id,head_id) + return GameData::FusedSpecies.new(pokemon_id) + end + end raise "Unknown ID #{other}." unless self::DATA.has_key?(other) + +#if other == :Species + +# end + return self::DATA[other] end 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 0201e6f64..6348af3e2 100644 --- a/Data/Scripts/010_Data/002_PBS data/008_Species.rb +++ b/Data/Scripts/010_Data/002_PBS data/008_Species.rb @@ -59,18 +59,19 @@ module GameData # @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 + return GameData::Species.get(species) rescue nil + # return nil if !species || !form + # validate species => [Symbol, self, String, Integer] + # validate form => Integer + # # if other.is_a?(Integer) + # # p "Please switch to symbols, thanks." + # # end + # species = species.species if species.is_a?(self) + # species = DATA[species].species if species.is_a?(Integer) + # species = species.to_sym if species.is_a?(String) + # trial = sprintf("%s_%d", species, form).to_sym + # species_form = (DATA[trial].nil?) ? species : trial + # return (DATA.has_key?(species_form)) ? DATA[species_form] : nil end def self.schema(compiling_forms = false) @@ -191,22 +192,26 @@ module GameData end # @return [String] the translated name of this species def name - return pbGetMessage(MessageTypes::Species, @id_number) + return @real_name + #return pbGetMessage(MessageTypes::Species, @id_number) end # @return [String] the translated name of this form of this species def form_name - return pbGetMessage(MessageTypes::FormNames, @id_number) + return @real_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) + return @real_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) + return @real_pokedex_entry + #return pbGetMessage(MessageTypes::Entries, @id_number) end def is_fusion diff --git a/Data/Scripts/010_Data/002_PBS data/009_Species_Files.rb b/Data/Scripts/010_Data/002_PBS data/009_Species_Files.rb index 03e4ceb25..8e0c0fe53 100644 --- a/Data/Scripts/010_Data/002_PBS data/009_Species_Files.rb +++ b/Data/Scripts/010_Data/002_PBS data/009_Species_Files.rb @@ -210,10 +210,10 @@ module GameData species_data = GameData::Species.get(getHeadID(species_data)) end - if form > 0 - ret = sprintf("Cries/%s_%d", species_data.species, form) - return ret if pbResolveAudioSE(ret) - end + # if form > 0 + # ret = sprintf("Cries/%s_%d", species_data.species, form) + # return ret if pbResolveAudioSE(ret) + # end ret = sprintf("Cries/%s", species_data.species) return (pbResolveAudioSE(ret)) ? ret : nil end diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index eeba4edd5..04302dcce 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -126,7 +126,8 @@ class Pokemon end def species_data - return GameData::Species.get_species_form(@species, form_simple) + @species_data = GameData::Species.get(@species) if ! @species_data + return @species_data #GameData::Species.get(@species) end #============================================================================= @@ -142,6 +143,7 @@ class Pokemon new_species_data = GameData::Species.get(species_id) return if @species == new_species_data.species @species = new_species_data.species + p @species.name @form = new_species_data.form if new_species_data.form != 0 @forced_form = nil @level = nil # In case growth rate is different for the new species @@ -1221,9 +1223,9 @@ class Pokemon # @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves # @param rechech_form [TrueClass, FalseClass] whether to auto-check the form def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true) - species_data = GameData::Species.get(species) - @species = species_data.species - @form = species_data.form + @species_data = GameData::Species.get(species) + @species = @species_data.species + @form = @species_data.form @forced_form = nil @time_form_set = nil self.level = level @@ -1253,7 +1255,7 @@ class Pokemon @sheen = 0 @pokerus = 0 @name = nil - @happiness = species_data.happiness + @happiness = @species_data.happiness @poke_ball = :POKEBALL @markings = 0 @iv = {} diff --git a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb index 9aaf3360c..f12303c53 100644 --- a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb +++ b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb @@ -80,12 +80,16 @@ class Player < Trainer end def set_seen_fusion(species) + initFusionDexArray() if @seen_fusion.length < NB_POKEMON+2 + bodyId = getBodyID(species) headId = getHeadID(species, bodyId) @seen_fusion[headId][bodyId] = true end def set_seen_normalDex(species) + initStandardDexArray() if @seen_standard.length < NB_POKEMON + dex_num = getDexNumberForSpecies(species) @seen_standard[dex_num] = true end diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 38538ccb3..a2bd500e7 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -328,7 +328,9 @@ module Compiler enumer = GameData.const_get(enumer.to_sym) begin if nil_or_empty?(ret) || !enumer.exists?(ret.to_sym) - raise _INTL("Undefined value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport) + if enumer != GameData::Species + raise _INTL("Undefined value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport) + end end rescue NameError raise _INTL("Incorrect value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport) diff --git a/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb b/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb index 8400e8f12..385bacb2b 100644 --- a/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb +++ b/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb @@ -458,7 +458,7 @@ def getDexNumFromFilename(filename) head = splitPoke[0].to_i body = splitPoke[1].to_i - return nil if (body * NB_POKEMON) + head > (NB_POKEMON * NB_POKEMON) + 420 + return nil if (body * NB_POKEMON) + head > (NB_POKEMON * NB_POKEMON) + NB_POKEMON return (body * NB_POKEMON) + head end diff --git a/Data/Scripts/048_Fusion/FusedSpecies.rb b/Data/Scripts/048_Fusion/FusedSpecies.rb new file mode 100644 index 000000000..8ea9e0f35 --- /dev/null +++ b/Data/Scripts/048_Fusion/FusedSpecies.rb @@ -0,0 +1,188 @@ +module GameData + class FusedSpecies < GameData::Species + attr_reader :growth_rate + + def initialize(id) + if id.is_a?(Integer) + body_id = getBodyID(id) + head_id = getHeadID(id,body_id) + pokemon_id = getFusedPokemonIdFromDexNum(body_id,head_id) + return GameData::FusedSpecies.new(pokemon_id) + end + head_id = get_head_id_from_symbol(id) + body_id = get_body_id_from_symbol(id) + + @body_pokemon = GameData::Species.get(head_id) + @head_pokemon = GameData::Species.get(body_id) + + @id = id + @id_number = calculate_dex_number() + @species = @id + @form = 0 + @real_name = calculate_name() #todo + @real_form_name = nil + @real_category = "???" #todo + @real_pokedex_entry = calculate_dex_entry() #todo + @pokedex_form = @form + #todo type exceptions + @type1 = @head_pokemon.type1 + @type2 = @body_pokemon.type2 + + #Stats + @base_stats = calculate_base_stats() + @evs = calculate_evs() #todo + adjust_stats_with_evs() + + @base_exp = calculate_base_exp() + @growth_rate = calculate_growth_rate() #todo + @gender_ratio = calculate_gender() #todo + @catch_rate = calculate_catch_rate() + @happiness = calculate_base_happiness() + @moves = calculate_moveset() + + #todo : all below + @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 = [:Undiscovered] # hash[:egg_groups] || [:Undiscovered] + @hatch_steps = 1 # hash[:hatch_steps] || 1 + @incense = nil #hash[:incense] + @evolutions = [] # hash[:evolutions] || [] + @height = 1 # hash[:height] || 1 + @weight = 1 #hash[:weight] || 1 + @color = :Red #hash[:color] || :Red + @shape = :Head #hash[:shape] || :Head + @habitat = :None #hash[:habitat] || :None + @generation = 0 #hash[:generation] || 0 + @mega_stone = nil + @mega_move = nil + @unmega_form = 0 + @mega_message = 0 + @back_sprite_x = 0 # hash[:back_sprite_x] || 0 + @back_sprite_y = 0 # hash[:back_sprite_y] || 0 + @front_sprite_x = 0 # hash[:front_sprite_x] || 0 + @front_sprite_y = 0 # hash[:front_sprite_y] || 0 + @front_sprite_altitude = 0 # hash[:front_sprite_altitude] || 0 + @shadow_x = 0 # hash[:shadow_x] || 0 + @shadow_size = 2 # hash[:shadow_size] || 2 + @alwaysUseGeneratedSprite = false + end + + def get_body_id_from_symbol(id) + return id.to_s.match(/\d+/)[0].to_i + end + + def get_head_id_from_symbol(id) + return id.to_s.match(/(?<=H)\d+/)[0].to_i + end + + def adjust_stats_with_evs + GameData::Stat.each_main do |s| + @base_stats[s.id] = 1 if !@base_stats[s.id] || @base_stats[s.id] <= 0 + @evs[s.id] = 0 if !@evs[s.id] || @evs[s.id] < 0 + end + end + + #FUSION CALCULATIONS + + def calculate_dex_number() + return (@head_pokemon.id_number * NB_POKEMON) + @body_pokemon.id_number + end + + def calculate_base_stats() + head_stats = @head_pokemon.base_stats + body_stats = @body_pokemon.base_stats + + fused_stats = {} + + #Head dominant stats + fused_stats[:HP] = calculate_fused_stats(head_stats[:HP], body_stats[:HP]) + fused_stats[:SPECIAL_DEFENSE] = calculate_fused_stats(head_stats[:SPECIAL_DEFENSE], body_stats[:SPECIAL_DEFENSE]) + fused_stats[:SPECIAL_ATTACK] = calculate_fused_stats(head_stats[:SPECIAL_ATTACK], body_stats[:SPECIAL_ATTACK]) + + #Body dominant stats + fused_stats[:ATTACK] = calculate_fused_stats(body_stats[:ATTACK], head_stats[:ATTACK]) + fused_stats[:DEFENSE] = calculate_fused_stats(body_stats[:DEFENSE], head_stats[:DEFENSE]) + fused_stats[:SPEED] = calculate_fused_stats(body_stats[:SPEED], head_stats[:SPEED]) + + return fused_stats + end + + def calculate_base_exp() + head_exp = @head_pokemon.base_exp + body_exp = @body_pokemon.base_exp + return average_values(head_exp, body_exp) + end + + def calculate_catch_rate + return get_lowest_value(@body_pokemon.catch_rate, @head_pokemon.catch_rate) + end + + def calculate_base_happiness + return @head_pokemon.happiness + end + + def calculate_moveset + return combine_arrays(@body_pokemon.moves, @head_pokemon.moves) + end + + #todo + def calculate_name() + return @body_pokemon.name + "/" + @head_pokemon.name + end + + #todo + def calculate_evs() + return {} + end + + #todo + def calculate_growth_rate + return :Medium + end + + #todo + def calculate_dex_entry + return "this is a fused pokemon bro" + end + + #todo + def calculate_gender + return :Genderless + end + + #UTILS + # + def calculate_fused_stats(dominantStat, otherStat) + return ((2 * dominantStat) / 3) + (otherStat / 3).floor + end + + def average_values(value1, value2) + return ((value1 + value2) / 2).floor + end + + def average_map_values(map1, map2) + averaged_map = map1.merge(map2) do |key, value1, value2| + ((value1 + value2) / 2.0).floor + end + return averaged_map + end + + def get_highest_value(value1, value2) + return value1 > value2 ? value1 : value2 + end + + def get_lowest_value(value1, value2) + return value1 < value2 ? value1 : value2 + end + + def combine_arrays(array1, array2) + return array1 + array2 + end + + end +end diff --git a/Data/Scripts/050_AddOns/Gen 2.rb b/Data/Scripts/050_AddOns/Gen 2.rb index 753bced45..32e306f64 100644 --- a/Data/Scripts/050_AddOns/Gen 2.rb +++ b/Data/Scripts/050_AddOns/Gen 2.rb @@ -14,8 +14,8 @@ # PokemonFusion # -NB_POKEMON = 420 #351 #aussi CONST_NB_POKE - +NB_POKEMON = 809#420 #351 #aussi CONST_NB_POKE +CONST_NB_POKE = NB_POKEMON def pbPokemonBitmapFile(species) # Used by the Pokédex # Load normal bitmap diff --git a/Data/Scripts/050_AddOns/GeneralUtils.rb b/Data/Scripts/050_AddOns/GeneralUtils.rb index 8e43e3b42..68feaabde 100644 --- a/Data/Scripts/050_AddOns/GeneralUtils.rb +++ b/Data/Scripts/050_AddOns/GeneralUtils.rb @@ -146,8 +146,24 @@ def getDexNumberForSpecies(species) return dexNum end +def getFusedPokemonIdFromDexNum(body_dex, head_dex) + return ("B" + body_dex.to_s + "H" + head_dex.to_s).to_sym +end + def getPokemon(dexNum) - return GameData::Species.get(dexNum) + if dexNum.is_a?(Integer) + if dexNum > NB_POKEMON + body_id = getBodyID(dexNum) + head_id = getHeadID(dexNum,body_id) + pokemon_id = getFusedPokemonIdFromDexNum(body_id,head_id) + else + pokemon_id = dexNum + end + else + pokemon_id = dexNum + end + + return GameData::Species.get(pokemon_id) end def getSpecies(dexnum) @@ -238,19 +254,30 @@ def getRandomCustomFusion(returnRandomPokemonIfNoneFound = true, customPokeList return randPoke end + + + def getBodyID(species) - dexNum = getDexNumberForSpecies(species) + if species.is_a?(Integer) + dexNum = species + else + dexNum = getDexNumberForSpecies(species) + end if dexNum % NB_POKEMON == 0 return (dexNum / NB_POKEMON) - 1 end return (dexNum / NB_POKEMON).round end - def getHeadID(species, bodyId = nil) + if species.is_a?(Integer) + fused_dexNum = species + else + fused_dexNum = getDexNumberForSpecies(species) + end + if bodyId == nil bodyId = getBodyID(species) end - fused_dexNum = getDexNumberForSpecies(species) body_dexNum = getDexNumberForSpecies(bodyId) calculated_number = (fused_dexNum - (body_dexNum * NB_POKEMON)).round diff --git a/Data/Scripts/050_AddOns/New Items effects.rb b/Data/Scripts/050_AddOns/New Items effects.rb index 0b64e726e..3d4ce4063 100644 --- a/Data/Scripts/050_AddOns/New Items effects.rb +++ b/Data/Scripts/050_AddOns/New Items effects.rb @@ -1393,6 +1393,9 @@ def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false) end def selectFusion(pokemon, poke2, supersplicers = false) + p pokemon + p poke2 + return nil if !pokemon.is_a?(Pokemon) || !poke2.is_a?(Pokemon) return nil if pokemon.egg? || poke2.egg? diff --git a/Data/Skills.rxdata b/Data/Skills.rxdata index a45219f5e..61cba7ea2 100644 Binary files a/Data/Skills.rxdata and b/Data/Skills.rxdata differ diff --git a/Data/States.rxdata b/Data/States.rxdata index 868d49e59..0f9b4ae5d 100644 Binary files a/Data/States.rxdata and b/Data/States.rxdata differ diff --git a/Data/System.rxdata b/Data/System.rxdata index a5f770be7..e44336444 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ diff --git a/Data/Tilesets.rxdata b/Data/Tilesets.rxdata index 6d74b21a8..f52e6f43e 100644 Binary files a/Data/Tilesets.rxdata and b/Data/Tilesets.rxdata differ diff --git a/Data/Weapons.rxdata b/Data/Weapons.rxdata index c7ea19a7a..d9bd35260 100644 Binary files a/Data/Weapons.rxdata and b/Data/Weapons.rxdata differ diff --git a/Data/items.dat b/Data/items.dat index 0d6d118ab..1993adaed 100644 Binary files a/Data/items.dat and b/Data/items.dat differ diff --git a/Data/messages.dat b/Data/messages.dat index cada87e48..b067fc91f 100644 Binary files a/Data/messages.dat and b/Data/messages.dat differ diff --git a/Data/trainers.dat b/Data/trainers.dat index cc4abb8f6..dcfb67873 100644 Binary files a/Data/trainers.dat and b/Data/trainers.dat differ diff --git a/System.rxdata b/System.rxdata deleted file mode 100644 index e69de29bb..000000000