diff --git a/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb b/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb index f12b1ca26..240560b6a 100644 --- a/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb +++ b/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb @@ -35,7 +35,7 @@ module GameData return nil if !species || !form validate species => [Symbol, String] validate form => Integer - raise _INTL("Undefined species {1}.", species) if !GameData::Species.exists?(species) + #raise _INTL("Undefined species {1}.", species) if !GameData::Species.exists?(species) species = species.to_sym if species.is_a?(String) if form > 0 trial = sprintf("%s_%d", species, form).to_sym diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb index 8380d9a25..154081aec 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb @@ -23,7 +23,7 @@ class PokemonEvolutionScene def pbStartScreen(pokemon, newspecies) @pokemon = pokemon - @newspecies = newspecies + @fused_pokemon_dex_number = newspecies @sprites = {} @bgviewport = Viewport.new(0, 0, Graphics.width, Graphics.height) @bgviewport.z = 99999 @@ -40,7 +40,7 @@ class PokemonEvolutionScene rsprite1.y = (Graphics.height - 64) / 2 rsprite2 = PokemonSprite.new(@viewport) rsprite2.setOffset(PictureOrigin::CENTER) - rsprite2.setPokemonBitmapSpecies(@pokemon, @newspecies, false) + rsprite2.setPokemonBitmapSpecies(@pokemon, @fused_pokemon_dex_number, false) rsprite2.x = rsprite1.x rsprite2.y = rsprite1.y rsprite2.visible = false @@ -197,8 +197,8 @@ class PokemonEvolutionScene def pbEvolutionSuccess $stats.evolution_count += 1 # Play cry of evolved species - cry_time = GameData::Species.cry_length(@newspecies, @pokemon.form) - Pokemon.play_cry(@newspecies, @pokemon.form) + cry_time = GameData::Species.cry_length(@fused_pokemon_dex_number, @pokemon.form) + Pokemon.play_cry(@fused_pokemon_dex_number, @pokemon.form) timer_start = System.uptime loop do Graphics.update @@ -208,7 +208,7 @@ class PokemonEvolutionScene pbBGMStop # Success jingle/message pbMEPlay("Evolution success") - newspeciesname = GameData::Species.get(@newspecies).name + newspeciesname = GameData::Species.get(@fused_pokemon_dex_number).name pbMessageDisplay(@sprites["msgwindow"], "\\se[]" + _INTL("Congratulations! Your {1} evolved into {2}!", @pokemon.name, newspeciesname) + "\\wt[80]") { pbUpdate } @@ -217,14 +217,14 @@ class PokemonEvolutionScene pbEvolutionMethodAfterEvolution # Modify Pokémon to make it evolved was_fainted = @pokemon.fainted? - @pokemon.species = @newspecies + @pokemon.species = @fused_pokemon_dex_number @pokemon.hp = 0 if was_fainted @pokemon.calc_stats @pokemon.ready_to_evolve = false # See and own evolved species - was_owned = $player.owned?(@newspecies) + was_owned = $player.owned?(@fused_pokemon_dex_number) $player.pokedex.register(@pokemon) - $player.pokedex.set_owned(@newspecies) + $player.pokedex.set_owned(@fused_pokemon_dex_number) moves_to_learn = [] movelist = @pokemon.getMoveList movelist.each do |i| @@ -252,7 +252,7 @@ class PokemonEvolutionScene end def pbEvolutionMethodAfterEvolution - @pokemon.action_after_evolution(@newspecies) + @pokemon.action_after_evolution(@fused_pokemon_dex_number) end def pbUpdate(animating = false) diff --git a/Data/Scripts/998_InfiniteFusion/02_Migration/Migration_Species.rb b/Data/Scripts/998_InfiniteFusion/02_Migration/Migration_Species.rb index f0e487183..7e1a7cd03 100644 --- a/Data/Scripts/998_InfiniteFusion/02_Migration/Migration_Species.rb +++ b/Data/Scripts/998_InfiniteFusion/02_Migration/Migration_Species.rb @@ -32,6 +32,19 @@ module GameData return self.types.include?(type) end + def self.get_species_form(species, form) + return nil if !species || !form + return GameData::Species.get(species) + + validate species => [Symbol, self, String] + validate form => Integer + species = species.species if species.is_a?(self) + 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 + end end diff --git a/Data/Scripts/998_InfiniteFusion/Fusion/Fusing.rb b/Data/Scripts/998_InfiniteFusion/Fusion/Fusing.rb index d983b512a..5f539bcc8 100644 --- a/Data/Scripts/998_InfiniteFusion/Fusion/Fusing.rb +++ b/Data/Scripts/998_InfiniteFusion/Fusion/Fusing.rb @@ -54,7 +54,7 @@ def pbDNASplicing(pokemon, scene, item = :DNASPLICERS) if (Kernel.pbConfirmMessage(_INTL("Fuse {1} and {2}?", selectedHead.name, selectedBase.name))) pbFuse(selectedHead, selectedBase, item) - pbRemovePokemonAt(chosen) + $Trainer.remove_pokemon_at_index(chosen) scene.pbHardRefresh pbBGMPlay(playingBGM) return true diff --git a/Data/Scripts/998_InfiniteFusion/Fusion/PIF_Pokemon.rb b/Data/Scripts/998_InfiniteFusion/Fusion/PIF_Pokemon.rb new file mode 100644 index 000000000..59f7f9b2f --- /dev/null +++ b/Data/Scripts/998_InfiniteFusion/Fusion/PIF_Pokemon.rb @@ -0,0 +1,453 @@ +class Pokemon + attr_accessor :exp_when_fused_head + attr_accessor :exp_when_fused_body + attr_accessor :exp_gained_since_fused + + attr_accessor :hat + attr_accessor :hat_x + attr_accessor :hat_y + + attr_accessor :glitter + attr_accessor :head_shiny + attr_accessor :body_shiny + attr_accessor :debug_shiny + attr_accessor :natural_shiny + + attr_writer :ability_index + attr_accessor :body_original_ability_index + attr_accessor :head_original_ability_index + + # @return [Array] All the move (ids) ever learned by this Pokémon + attr_accessor :learned_moves + + attr_accessor :force_disobey + + + def print_all_attributes + instance_variables.each do |var| + begin + value = instance_variable_get(var) + echoln("#{var}: #{value.inspect}") + rescue => e + echoln("#{var}: [Error reading value: #{e.message}]") + end + end + end + + + def id_number + return species_data.id_number + end + + def hiddenPower=(type) + @hiddenPowerType = type + end + + def sprite_scale() + @sprite_scale = 1 if !@sprite_scale + return @sprite_scale + end + + def sprite_scale=(scale) + @sprite_scale = scale + end + + + def size_category() + @size_category = :AVERAGE if !@size_category + return @size_category + end + + def size_category=(category) + @size_category = category + end + + def hasBodyOf?(check_species) + if !self.isFusion? + return isSpecies?(check_species) + end + bodySpecies = getBodyID(species) + checkSpeciesId = getID(nil, check_species) + return bodySpecies == checkSpeciesId + end + + def hasHeadOf?(check_species) + if !self.isFusion? + return isSpecies?(check_species) + end + headSpecies = getHeadID(species) + checkSpeciesId = getID(nil, check_species) + return headSpecies == checkSpeciesId + end + + def head_id() + return get_head_id_from_symbol(@species) + end + + def body_id() + return get_body_id_from_symbol(@species) + end + + def shiny=(value) + @shiny = value + if value && Settings::SHINY_POKEMON_CHANCE != S_CHANCE_VALIDATOR + @debug_shiny = true + end + end + + def isShiny?() + return @shiny || @body_shiny || @head_shiny + end + + def naturalShiny? + return @natural_shiny + end + + def debugShiny? + return !@natural_shiny || @debug_shiny + end + + def bodyShiny? + return @body_shiny + end + + def headShiny? + return @head_shiny + end + + + def isFusionOf(check_species) + return hasBodyOf?(check_species) || hasHeadOf?(check_species) + end + + + def dexNum + return species_data.id_number + end + + def isSelfFusion? + return isFusion? && getHeadID(species) == getBodyID(species) + end + + def isFusion? + return species_data.id_number > NB_POKEMON && !self.isTripleFusion? + end + + def isTripleFusion? + return species_data.id_number >= Settings::ZAPMOLCUNO_NB + end + + def changeFormSpecies(oldForm, newForm) + + is_already_old_form = self.isFusionOf(oldForm) #A 466 + is_already_new_form = self.isFusionOf(newForm) #P + + #reverse the fusion if it's a meloA and meloP fusion + # There's probably a smarter way to do this but laziness lol + if is_already_old_form && is_already_new_form + body_id = self.species_data.get_body_species() + body_species = GameData::Species.get(body_id) + + if body_species == oldForm + changeSpeciesSpecific(self, getFusedPokemonIdFromSymbols(newForm, oldForm)) + else + changeSpeciesSpecific(self, getFusedPokemonIdFromSymbols(oldForm, newForm)) + end + else + echoln "changing species...." + changeSpecies(self, oldForm, newForm) if is_already_old_form + changeSpecies(self, newForm, oldForm) if is_already_new_form + end + + calc_stats + end + + def changeSpecies(pokemon, speciesToReplace, newSpecies) + if pokemon.isFusion?() + replaceFusionSpecies(pokemon, speciesToReplace, newSpecies) + else + changeSpeciesSpecific(pokemon, newSpecies) + end + $Trainer.pokedex.set_seen(pokemon.species) + $Trainer.pokedex.set_owned(pokemon.species) + end + + def type1 + if @ability == :MULTITYPE && species_data.type1 == :NORMAL + return getHeldPlateType() + end + return @type1 if @type1 + return species_data.type1 + end + + # @return [Symbol] this Pokémon's second type, or the first type if none is defined + def type2 + if @ability == :MULTITYPE && species_data.type2 == :NORMAL + return getHeldPlateType() + end + sp_data = species_data + return sp_data.type2 || sp_data.type1 + end + + + def type1=(value) + @type1 = value + end + + def type2=(value) + @type2 = value + end + + def getHeldPlateType() + return getArceusPlateType(@item) + end + + def makeMale + @gender = 0 + end + + # Makes this Pokémon female. + def makeFemale + @gender = 1 + end + + # @return [Boolean] whether this Pokémon is male + def male? + return self.gender == 0; + end + + # @return [Boolean] whether this Pokémon is female + def female? + return self.gender == 1; + end + + # @return [Boolean] whether this Pokémon is genderless + def genderless? + return self.gender == 2; + end + + def add_learned_move(move) + @learned_moves = [] if !@learned_moves + if move.is_a?(Symbol) + @learned_moves << move unless @learned_moves.include?(move) + else + move_id = move.id + if move_id + @learned_moves << move_id unless @learned_moves.include?(move_id) + end + end + end + + + alias pokemonEssentials_Pokemon_learn_move learn_move + def learn_move(move) + pokemonEssentials_Pokemon_learn_move(move) + add_learned_move(move) + end + + alias pokemonEssentials_Pokemon_forget_move forget_move + def forget_move(move_id) + pokemonEssentials_Pokemon_forget_move(move_id) + add_learned_move(move_id) + end + + def forget_move_at_index(index) + move_id = @moves[index].id + add_learned_move(move_id) + @moves.delete_at(index) + end + + # Deletes all moves from the Pokémon. + def forget_all_moves + for move in @moves + add_learned_move(move) + end + @moves.clear + end + + def compatible_with_move?(move_id) + move_data = GameData::Move.try_get(move_id) + if isFusion?() + head_species_id = getBasePokemonID(species, false) + body_species_id = getBasePokemonID(species) + head_species = GameData::Species.get(head_species_id) + body_species = GameData::Species.get(body_species_id) + return move_data && (pokemon_can_learn_move(head_species, move_data) || pokemon_can_learn_move(body_species, move_data)) + else + return move_data && pokemon_can_learn_move(species_data, move_data) + end + end + + def pokemon_can_learn_move(species_data, move_data) + moveset = species_data.moves.map { |pair| pair[1] } + return species_data.tutor_moves.include?(move_data.id) || + species_data.moves.include?(move_data.id) || ##this is formatted as such [[1, :PECK],[etc.]] so it never finds anything when move_data is just the symbol. Leaving it there in case something depends on that for some reason. + moveset.include?(move_data.id) || + species_data.egg_moves.include?(move_data.id) + end + + def has_egg_move? + return false if egg? || shadowPokemon? + baby = pbGetBabySpecies(self.species) + moves = pbGetSpeciesEggMoves(baby) + return true if moves.size >= 1 + end + + def foreign?(trainer) + return @owner.id != trainer.id# || @owner.name != trainer.name + end + + def always_disobey(value) + @force_disobey = value + end + + #============================================================================= + # Evolution checks + #============================================================================= + # Checks whether this Pokemon can evolve because of levelling up. + # @return [Symbol, nil] the ID of the species to evolve into + def prompt_evolution_choice(body_evolution, head_evolution) + current_body = @species_data.body_pokemon + current_head = @species_data.head_pokemon + + choices = [ + #_INTL("Evolve both!"), + _INTL("Evolve head!"), + _INTL("Evolve body!"), + _INTL("Don't evolve") + ] + choice = pbMessage(_INTL('Both halves of {1} are ready to evolve!', self.name), choices, 0) + # if choice == 0 #EVOLVE BOTH + # newspecies = getFusionSpecies(body_evolution,head_evolution) + if choice == 0 #EVOLVE HEAD + newspecies = getFusionSpecies(current_body, head_evolution) + elsif choice == 1 #EVOLVE BODY + newspecies = getFusionSpecies(body_evolution, current_head) + else + newspecies = nil + end + return newspecies + end + + def check_evolution_on_level_up(prompt_choice=true) + if @species_data.is_a?(GameData::FusedSpecies) + body = self.species_data.body_pokemon + head = self.species_data.head_pokemon + + body_evolution = check_evolution_internal(@species_data.body_pokemon) { |pkmn, new_species, method, parameter| + success = GameData::Evolution.get(method).call_level_up(pkmn, parameter) + next (success) ? new_species : nil + } + head_evolution = check_evolution_internal(@species_data.head_pokemon) { |pkmn, new_species, method, parameter| + success = GameData::Evolution.get(method).call_level_up(pkmn, parameter) + next (success) ? new_species : nil + } + if body_evolution && head_evolution + return prompt_evolution_choice(body_evolution, head_evolution) if prompt_choice + return [body_evolution,head_evolution].sample + end + end + + return check_evolution_internal { |pkmn, new_species, method, parameter| + success = GameData::Evolution.get(method).call_level_up(pkmn, parameter) + next (success) ? new_species : nil + } + end + def getBaseStatsFormException() + if @species == :PUMPKABOO + case @size_category + when :SMALL + return { :HP => 44, :ATTACK => 66, :DEFENSE => 70, :SPECIAL_ATTACK => 44, :SPECIAL_DEFENSE => 55, :SPEED => 56} + when :AVERAGE + return nil + when :LARGE + return { :HP => 54, :ATTACK => 66, :DEFENSE => 70, :SPECIAL_ATTACK => 44, :SPECIAL_DEFENSE => 55, :SPEED => 46} + when :SUPER + return { :HP => 59, :ATTACK => 66, :DEFENSE => 70, :SPECIAL_ATTACK => 44, :SPECIAL_DEFENSE => 55, :SPEED => 41} + end + end + if @species == :GOURGEIST + case @size_category + when :SMALL + return { :HP => 55, :ATTACK => 85, :DEFENSE => 122, :SPECIAL_ATTACK => 58, :SPECIAL_DEFENSE => 75, :SPEED => 99} + when :AVERAGE + return nil + when :LARGE + return { :HP => 75, :ATTACK => 95, :DEFENSE => 122, :SPECIAL_ATTACK => 58, :SPECIAL_DEFENSE => 75, :SPEED => 69} + when :SUPER + return { :HP => 85, :ATTACK => 100, :DEFENSE => 122, :SPECIAL_ATTACK => 58, :SPECIAL_DEFENSE => 75, :SPEED => 54} + end + end + return nil + end + + def adjust_level_for_base_stats_mode() + nb_badges = $Trainer.badge_count + this_level = ((nb_badges * Settings::NO_LEVEL_MODE_LEVEL_INCR) + Settings::NO_LEVEL_MODE_LEVEL_BASE).ceil + if this_level > Settings::MAXIMUM_LEVEL + this_level = Settings::MAXIMUM_LEVEL + end + return this_level + end + + def adjustHPForWonderGuard(stats) + return self.ability == :WONDERGUARD ? 1 : stats[:HP] + end + + def checkHPRelatedFormChange() + if @ability == :SHIELDSDOWN + return if $game_temp.in_battle #handled in battlers class in-battle + if isFusionOf(:MINIOR_M) + if @hp <= (@totalhp / 2) + changeFormSpecies(:MINIOR_M, :MINIOR_C) + end + end + if isFusionOf(:MINIOR_C) + if @hp > (@totalhp / 2) + changeFormSpecies(:MINIOR_C, :MINIOR_M) + end + end + end + end + + def determine_scale + return :AVERAGE if !@size_category + size_roll = rand(100) # Random number between 0-99 + if @size_category == :SMALL + return 0.75 + elsif @size_category == :AVERAGE + return 1 + elsif @size_category == :LARGE + return 1 + (1.0 /3) #"Large Size" + elsif @size_category == :SUPER + return 1 + (2.0 /3) #"Super Size" + end + return 1 + end + + def determine_size_category + return :AVERAGE if !(Kernel.isPartPokemon(self,:PUMPKABOO) || Kernel.isPartPokemon(self,:GOURGEIST)) + size_roll = rand(100) # Random number between 0-99 + if size_roll < 10 + return :SMALL + elsif size_roll < 50 + return :AVERAGE + elsif size_roll < 90 + return :LARGE + else + return :SUPER + end + end + + def species=(species_id) + new_species_data = GameData::Species.get(species_id) + return if @species == new_species_data.species + @species = new_species_data.species + @forced_form = nil + @gender = nil if singleGendered? + @level = nil # In case growth rate is different for the new species + @ability = nil + calc_stats + end + +end \ No newline at end of file diff --git a/Data/Scripts/998_InfiniteFusion/Fusion/PokemonFusion.rb b/Data/Scripts/998_InfiniteFusion/Fusion/PokemonFusion.rb index 210f0aa0e..228649ef8 100644 --- a/Data/Scripts/998_InfiniteFusion/Fusion/PokemonFusion.rb +++ b/Data/Scripts/998_InfiniteFusion/Fusion/PokemonFusion.rb @@ -453,6 +453,47 @@ class PokemonFusionScene end + def pbChooseAbility(ability1Id,ability2Id) + ability1 = GameData::Ability.get(ability1Id) + ability2 = GameData::Ability.get(ability2Id) + availableNatures = [] + availableNatures << @pokemon1.nature + availableNatures << @pokemon2.nature + + setAbilityAndNatureAndNickname([ability1,ability2], availableNatures) + end + + + def setAbilityAndNatureAndNickname(abilitiesList, naturesList) + return #todo + clearUIForMoves + if $game_switches[SWITCH_DOUBLE_ABILITIES] + scene = FusionSelectOptionsScene.new(nil, naturesList, @pokemon1, @pokemon2) + screen = PokemonOptionScreen.new(scene) + screen.pbStartScreen + + @pokemon1.ability = abilitiesList[0] + @pokemon1.ability2 = abilitiesList[1] + else + scene = FusionSelectOptionsScene.new(abilitiesList, naturesList, @pokemon1, @pokemon2) + screen = PokemonOptionScreen.new(scene) + screen.pbStartScreen + + selectedAbility = scene.selectedAbility + @pokemon1.body_original_ability_index = @pokemon1.ability_index + @pokemon1.head_original_ability_index = @pokemon2.ability_index + + @pokemon1.ability = selectedAbility + @pokemon1.ability_index = getAbilityIndexFromID(selectedAbility.id,@pokemon1) + end + + @pokemon1.nature = scene.selectedNature + if scene.hasNickname + @pokemon1.name = scene.nickname + end + end + + #NEW FUSION ANIMATION (WIP) # def pbGenerateMetafiles(nb_seconds,ellipse_center_x,ellipse_center_y,ellipse_major_axis_length,ellipse_minor_axis_length) # sprite_head = SpriteMetafile.new @@ -670,7 +711,7 @@ class PokemonFusionScene @pokemon1 = pokemon_body @pokemon2 = pokemon_head - @newspecies = newspecies + @fused_pokemon_dex_number = newspecies addBackgroundOrColoredPlane(@sprites, "background", "DNAbg", Color.new(248, 248, 248), @viewport) @@ -693,7 +734,7 @@ class PokemonFusionScene @fusion_pif_sprite = spriteLoader.obtain_fusion_pif_sprite(poke_head_number,poke_body_number) #this will use the sprite that is set when we call obtain_fusion_pif_sprite, and apply the shiny effect - @sprites["rsprite2"].setPokemonBitmapFromId(@newspecies, false, pokemon_head.shiny? || pokemon_body.shiny?, pokemon_head.shiny?, pokemon_body.shiny?) + @sprites["rsprite2"].setPokemonBitmapFromId(@fused_pokemon_dex_number, false, pokemon_head.shiny? || pokemon_body.shiny?, pokemon_head.shiny?, pokemon_body.shiny?) splicer_bitmap = _INTL("Graphics/Items/{1}",splicerItem) @sprites["dnasplicer"].setBitmap(splicer_bitmap) @@ -850,15 +891,15 @@ class PokemonFusionScene @pbEndScreen _INTL("Huh? The fusion was cancelled!") else - frames = pbCryFrameLength(@newspecies) + frames = pbCryFrameLength(@fused_pokemon_dex_number).to_i pbBGMStop() - pbPlayCry(@newspecies) + pbPlayCry(@fused_pokemon_dex_number) frames.times do Graphics.update end #pbMEPlay("Voltorb Flip Win") - newSpecies = GameData::Species.get(@newspecies) - newspeciesname = newSpecies.real_name + fused_pokemon_species = GameData::Species.get(@fused_pokemon_dex_number) + fused_pokemon_name = fused_pokemon_species.real_name oldspeciesname = GameData::Species.get(@pokemon1.species).real_name overlay = BitmapSprite.new(Graphics.width, Graphics.height, @viewport).bitmap @@ -866,9 +907,9 @@ class PokemonFusionScene sprite_bitmap = @sprites["rsprite2"].getBitmap drawSpriteCredits(@fusion_pif_sprite, @viewport) - pbBGMPlay(pbGetWildVictoryME) + pbBGMPlay(pbGetWildVictoryBGM) Kernel.pbMessageDisplay(@sprites["msgwindow"], - _INTL("\\se[]Congratulations! Your Pokémon were fused into {2}!\\wt[80]", @pokemon1.name, newspeciesname)) + _INTL("\\se[]Congratulations! Your Pokémon were fused into {2}!\\wt[80]", @pokemon1.name, fused_pokemon_name)) #exp @pokemon1.exp_when_fused_head = @pokemon2.exp @@ -885,47 +926,26 @@ class PokemonFusionScene setFusionIVs(superSplicer) #add to pokedex - if !$Trainer.pokedex.owned?(newSpecies) - $Trainer.pokedex.set_seen(newSpecies) - $Trainer.pokedex.set_owned(newSpecies) + if !$Trainer.pokedex.owned?(fused_pokemon_species) + $Trainer.pokedex.set_seen(fused_pokemon_species) + $Trainer.pokedex.set_owned(fused_pokemon_species) Kernel.pbMessageDisplay(@sprites["msgwindow"], - _INTL("{1}'s data was added to the Pokédex", newspeciesname)) - @scene.pbShowPokedex(@newspecies) + _INTL("{1}'s data was added to the Pokédex", fused_pokemon_name)) + + @scene.pbShowPokedex(fused_pokemon_species.species) end overlay.dispose - #first check if hidden ability - # getAbilityList format: [[:ABILITY, index],...] - # hiddenAbility1 = @pokemon1.ability == @pokemon1.getAbilityList[-1][0] - # hiddenAbility2 = @pokemon2.ability == @pokemon2.getAbilityList[-1][0] - - # ability1 = @pokemon1.ability_index - # ability2 = @pokemon2.ability_index - #change species ability1 = @pokemon1.ability ability2 = @pokemon2.ability - @pokemon1.species = newSpecies + @pokemon1.species = fused_pokemon_species if @pokemon2.egg? || @pokemon1.egg? @pokemon1.steps_to_hatch = @pokemon1.species_data.hatch_steps end - #@pokemon1.ability = pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2) - # pbChooseAbility(ability1,ability2) setFusionMoves(@pokemon1, @pokemon2, firstOptionSelected) if !noMoves - - # if superSplicer - # @pokemon1.nature = pbChooseNature(@pokemon1.nature, @pokemon2.nature) - # end - #Check moves for new species - # movelist = @pokemon1.getMoveList - # for i in movelist - # if i[0] == @pokemon1.level - # pbLearnMove(@pokemon1, i[1]) if !noMoves #(pokemon,move,ignoreifknown=true, byTM=false , quick =true) - # end - # end - #@pokemon1.ability = pbChooseAbility(@pokemon1,@pokemon2) removeItem = false if @pokemon2.isShiny? || @pokemon1.isShiny? @pokemon1.makeShiny @@ -938,15 +958,15 @@ class PokemonFusionScene @pokemon1.obtain_method = 0 @pokemon1.owner = Pokemon::Owner.new_from_trainer($Trainer) - pbSEPlay("Voltorb Flip Point") + #pbSEPlay("Voltorb Flip Point") - @pokemon1.name = newspeciesname if @pokemon1.name == oldspeciesname + @pokemon1.name = fused_pokemon_name if @pokemon1.name == oldspeciesname @pokemon1.level = setPokemonLevel(@pokemon1.level, @pokemon2.level, superSplicer) @pokemon1.calc_stats @pokemon1.obtain_method = 0 pbBGMStop - pbBGMPlay($PokemonTemp.cueBGM) + pbBGMPlay($game_temp.cue_bgm) end end end @@ -1088,32 +1108,32 @@ def pbShowPokedex(species) screen.pbDexEntry(species) } end - -def pbChooseAbility(poke, hidden1 = false, hidden2 = false) - abilityList = poke.getAbilityList - #pas sur de l'ordre pour les hidden (3 et 4) peut-être a inverser - #Mais les fusions ont tjrs 4 hidden abilities - #2. l'autre ability du poke 1 - #3. l'autre ability du poke 2 - #4. hidden du poke 1 - #5. hidden du poke2 - - abID1 = hidden1 ? abilityList[4][0] : abilityList[0][0] - abID2 = hidden2 ? abilityList[5][0] : abilityList[1][0] - - ability1_name = GameData::Ability.get(abID1).name - ability2_name = GameData::Ability.get(abID2).name - availableNatures = [] - availableNatures << @pokemon1.nature - availableNatures << @pokemon2.nature - - setAbilityAndNatureAndNickname([GameData::Ability.get(abID1), GameData::Ability.get(abID2)], availableNatures) - - # if (Kernel.pbMessage("Choose an ability. ???", [_INTL("{1}", ability1_name), _INTL("{1}", ability2_name)], 2)) == 0 - # return abID1 #hidden1 ? 4 : 0 - # end - # return abID2 #hidden2 ? 5 : 1 -end +# +# def pbChooseAbility(poke, hidden1 = false, hidden2 = false) +# abilityList = poke.getAbilityList +# #pas sur de l'ordre pour les hidden (3 et 4) peut-être a inverser +# #Mais les fusions ont tjrs 4 hidden abilities +# #2. l'autre ability du poke 1 +# #3. l'autre ability du poke 2 +# #4. hidden du poke 1 +# #5. hidden du poke2 +# +# abID1 = hidden1 ? abilityList[4][0] : abilityList[0][0] +# abID2 = hidden2 ? abilityList[5][0] : abilityList[1][0] +# +# ability1_name = GameData::Ability.get(abID1).name +# ability2_name = GameData::Ability.get(abID2).name +# availableNatures = [] +# availableNatures << @pokemon1.nature +# availableNatures << @pokemon2.nature +# +# setAbilityAndNatureAndNickname([GameData::Ability.get(abID1), GameData::Ability.get(abID2)], availableNatures) +# +# # if (Kernel.pbMessage("Choose an ability. ???", [_INTL("{1}", ability1_name), _INTL("{1}", ability2_name)], 2)) == 0 +# # return abID1 #hidden1 ? 4 : 0 +# # end +# # return abID2 #hidden2 ? 5 : 1 +# end def pbChooseNature(species1_nature, species2_nature) nature1 = GameData::Nature.get(species1_nature) diff --git a/Data/Scripts/998_InfiniteFusion/Sprites/FusionSprites.rb b/Data/Scripts/998_InfiniteFusion/Sprites/FusionSprites.rb index d36172262..bea92c83c 100644 --- a/Data/Scripts/998_InfiniteFusion/Sprites/FusionSprites.rb +++ b/Data/Scripts/998_InfiniteFusion/Sprites/FusionSprites.rb @@ -13,8 +13,6 @@ module GameData return ret end - - def self.sprite_bitmap_from_pokemon_id(id, back = false, shiny = false, bodyShiny = false, headShiny = false) if back ret = self.back_sprite_bitmap(id, shiny, bodyShiny, headShiny) @@ -24,6 +22,16 @@ module GameData return ret end + def self.sprite_bitmap(species, form = 0, gender = 0, shiny = false, shadow = false, back = false, egg = false) + return self.egg_sprite_bitmap(species, form) if egg + + dex_number= GameData::Species.get(species).id_number + + return self.back_sprite_bitmap(dex_number, shiny) if back + return self.front_sprite_bitmap(dex_number, shiny) + end + + MAX_SHIFT_VALUE = 360 MINIMUM_OFFSET = 40 ADDITIONAL_OFFSET_WHEN_TOO_CLOSE = 40 @@ -79,6 +87,7 @@ module GameData # species can be either a number, a Species objet of a symbol + # def self.front_sprite_bitmap(species, isShiny = false, bodyShiny = false, headShiny = false) dex_number = getDexNumberForSpecies(species) if species.is_a?(Species) @@ -126,12 +135,6 @@ module GameData # end def self.back_sprite_bitmap(dex_number, isShiny = false, bodyShiny = false, headShiny = false) - # filename = self.sprite_filename(dex_number) - # sprite = (filename) ? AnimatedBitmap.new(filename) : nil - # if isShiny - # sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny)) - # end - # return sprite sprite = self.front_sprite_bitmap(dex_number,isShiny,bodyShiny,headShiny) return sprite#.mirror end