From 801706ed0d624184b19e9b2275c1ca4e0826e02e Mon Sep 17 00:00:00 2001 From: infinitefusion Date: Sat, 16 Apr 2022 12:15:13 -0400 Subject: [PATCH] [wip] pokedex refactor for fusions --- Data/CommonEvents.rxdata | Bin 113738 -> 113638 bytes Data/MapInfos.rxdata | Bin 36404 -> 36404 bytes Data/Scripts/001_Settings.rb | 2 +- .../005_Player_Pokedex.rb | 143 +++++++++++++++--- Data/Scripts/050_AddOns/PokemonFusion.rb | 60 ++++---- Data/System.rxdata | Bin 27467 -> 27467 bytes 6 files changed, 154 insertions(+), 51 deletions(-) diff --git a/Data/CommonEvents.rxdata b/Data/CommonEvents.rxdata index 689b833e759ddc433635a283bfce901baf4a1e44..a0b5747005ba52f24cd29e490afabc56d7b891b1 100644 GIT binary patch delta 177 zcmX^0gYDUOwheFJa!MB@1*ev180&0$H=UVN0><0C>f;nY_d- delta 310 zcmaF%o$b^QwheFJ3ab_*1*ev180!Q$1s9|yXQmcgZT|LlIyA-B({`Ib|#g0~~!^JRL(k{UGY(e)?cHFv`_CGBnu3Gsw{w xY~a2>LCo0Px>b^K8CHqyCzu(RV3#RnXI#iEjKy`^<+&MwKF21rpN~;}EdcOtZJ_`F diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index cfeed30cba0c83c919b499b4fe6666740bb52ea8..a0cf80efd0317de11651c7b497bda205c74f612f 100644 GIT binary patch delta 24 gcmdlohiS_krVWb{m^4{8FG-jv#Tc^Ltool20DSKWvH$=8 delta 24 gcmdlohiS_krVWb{m=u^dFG-jv#pt%#tool20DJ=pnE(I) diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index 02a32e350..a9a6a2d1c 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -6,7 +6,7 @@ module Settings # The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format. GAME_VERSION = '5.0.0' - GAME_VERSION_NUMBER = "5.0.18 - beta" + GAME_VERSION_NUMBER = "5.0.18.1 - beta" POKERADAR_LIGHT_ANIMATION_RED_ID = 17 POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18 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 26d78132b..774e21ee5 100644 --- a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb +++ b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb @@ -24,41 +24,88 @@ class Player < Trainer def clear @seen = {} @owned = {} + + @seen_fusion = {} + @owned_fusion = {} + @seen_forms = {} @last_seen_forms = {} @owned_shadow = {} self.refresh_accessible_dexes end + + + def isFusion(species) + num = getDexNumberForSpecies(species) + return num > Settings::NB_POKEMON && num < Settings::ZAPMOLCUNO_NB + end #=========================================================================== # Sets the given species as seen in the Pokédex. # @param species [Symbol, GameData::Species] species to set as seen # @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated - def set_seen(species, should_refresh_dexes = true) + def set_seen_fusion(species) + bodyId = getBodyID(species) + headId = getHeadID(species,bodyId) + @seen_fusion[headId][bodyId] = true + p @seen_fusion + end + + def set_seen_normalDex(species) species_id = GameData::Species.try_get(species)&.species return if species_id.nil? @seen[species_id] = true + end + + def set_seen(species, should_refresh_dexes = true) + return #TODO + + + if isFusion(species) + set_seen_fusion(species) + else + set_seen_normalDex(species) + end self.refresh_accessible_dexes if should_refresh_dexes end # @param species [Symbol, GameData::Species] species to check # @return [Boolean] whether the species is seen - def seen?(species) + + def seen_fusion?(species) + bodyId = getBodyID(species) + headId = getHeadID(species,bodyId) + return @seen_fusion[headId][bodyId] + end + + def seen_normalDex?(species) species_id = GameData::Species.try_get(species)&.species return false if species_id.nil? return @seen[species_id] == true end + def seen?(species) + return false#TODO + + + if isFusion(species) + return seen_fusion?(species) + else + return seen_normalDex?(species) + end + end + # @param species [Symbol, GameData::Species] species to check # @param gender [Integer] gender to check # @param form [Integer] form to check # @return [Boolean] whether the species of the given gender and form is seen def seen_form?(species, gender, form) - species_id = GameData::Species.try_get(species)&.species - return false if species_id.nil? - @seen_forms[species_id] ||= [[], []] - return @seen_forms[species_id][gender][form] == true + return true + # species_id = GameData::Species.try_get(species)&.species + # return false if species_id.nil? + # @seen_forms[species_id] ||= [[], []] + # return @seen_forms[species_id][gender][form] == true end # Returns the amount of seen Pokémon. @@ -118,25 +165,70 @@ class Player < Trainer # Sets the given species as owned in the Pokédex. # @param species [Symbol, GameData::Species] species to set as owned # @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated - def set_owned(species, should_refresh_dexes = true) + def set_owned_fusion(species) + bodyId = getBodyID(species) + headId = getHeadID(species,bodyId) + @owned_fusion[headId][bodyId]=true + + p @owned_fusion + end + + + def set_owned_normalDex(species) species_id = GameData::Species.try_get(species)&.species return if species_id.nil? @owned[species_id] = true + end + + def set_owned(species, should_refresh_dexes = true) + return #TODO + + if isFusion(species) + set_owned_fusion(species) + else + set_owned_normalDex(species) + end self.refresh_accessible_dexes if should_refresh_dexes end # Sets the given species as owned in the Pokédex. # @param species [Symbol, GameData::Species] species to set as owned def set_shadow_pokemon_owned(species) - species_id = GameData::Species.try_get(species)&.species - return if species_id.nil? - @owned_shadow[species_id] = true - self.refresh_accessible_dexes + return + # species_id = GameData::Species.try_get(species)&.species + # return if species_id.nil? + # @owned_shadow[species_id] = true + # self.refresh_accessible_dexes end # @param species [Symbol, GameData::Species] species to check # @return [Boolean] whether the species is owned + def owned_fusion?(species) + bodyId = getBodyID(species) + headId = getHeadID(species,bodyId) + + p @owned + p @owned[headId] + + return @owned[headId][bodyId] == true + + end + + + def owned?(species) + return false #TODO + + + if isFusion(species) + return owned_fusion?(species) + else + return owned_normalDex?(species) + end + end + + + def owned_normalDex?(species) species_id = GameData::Species.try_get(species)&.species return false if species_id.nil? return @owned[species_id] == true @@ -145,9 +237,10 @@ class Player < Trainer # @param species [Symbol, GameData::Species] species to check # @return [Boolean] whether a Shadow Pokémon of the species is owned def owned_shadow_pokemon?(species) - species_id = GameData::Species.try_get(species)&.species - return false if species_id.nil? - return @owned_shadow[species_id] == true + return + # species_id = GameData::Species.try_get(species)&.species + # return false if species_id.nil? + # return @owned_shadow[species_id] == true end # Returns the amount of owned Pokémon. @@ -165,16 +258,18 @@ class Player < Trainer # @param gender [Integer] gender to register (0=male, 1=female, 2=genderless) # @param form [Integer] form to register def register(species, gender = 0, form = 0, should_refresh_dexes = true) - return - if species.is_a?(Pokemon) - species_data = species.species_data - #gender = species.gender - else - species_data = GameData::Species.get(species) - end - species = species_data.species - @seen[species] = true - self.refresh_accessible_dexes if should_refresh_dexes + set_owned(species,should_refresh_dexes) + set_seen(species,should_refresh_dexes) + # return + # if species.is_a?(Pokemon) + # species_data = species.species_data + # #gender = species.gender + # else + # species_data = GameData::Species.get(species) + # end + # species = species_data.species + # @seen[species] = true + # self.refresh_accessible_dexes if should_refresh_dexes end # @param pkmn [Pokemon] Pokemon to register as most recently seen diff --git a/Data/Scripts/050_AddOns/PokemonFusion.rb b/Data/Scripts/050_AddOns/PokemonFusion.rb index 3c3e7edbe..3ace25f63 100644 --- a/Data/Scripts/050_AddOns/PokemonFusion.rb +++ b/Data/Scripts/050_AddOns/PokemonFusion.rb @@ -692,9 +692,9 @@ class PokemonFusionScene _INTL("\\se[]Congratulations! Your Pokémon were fused into {2}!\\wt[80]", @pokemon1.name, newspeciesname)) #exp - @pokemon1.exp_when_fused_head = @pokemon2.exp #peut-être l'inverse - @pokemon1.exp_when_fused_body = @pokemon1.exp #peut-être l'inverse - @pokemon1.exp_gained_since_fused=0 + @pokemon1.exp_when_fused_head = @pokemon2.exp #peut-être l'inverse + @pokemon1.exp_when_fused_body = @pokemon1.exp #peut-être l'inverse + @pokemon1.exp_gained_since_fused = 0 averageFusionIvs() #add to pokedex @@ -708,17 +708,21 @@ class PokemonFusionScene #first check if hidden ability hiddenAbility1 = @pokemon1.ability == @pokemon1.getAbilityList[0][-1] hiddenAbility2 = @pokemon2.ability == @pokemon2.getAbilityList[0][-1] - + @pokemon1.ability = pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2) + if superSplicer + @pokemon1.nature = pbChooseNature(@pokemon1.nature, @pokemon2.nature) + end + setFusionMoves(@pokemon1, @pokemon2) if !noMoves #change species @pokemon1.species = newSpecies #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 + # 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? @@ -730,21 +734,8 @@ class PokemonFusionScene @pokemon1.owner = Pokemon::Owner.new_from_trainer($Trainer) - @pokemon1.ability = pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2) - if superSplicer - @pokemon1.nature = pbChooseNature(@pokemon1.nature, @pokemon2.nature) - end - - movelist = @pokemon2.moves - for k in movelist - if k.id != 0 - pbLearnMove(@pokemon1, k.id, true, false,true) if !noMoves #todo: learn moves faster - end - end - pbSEPlay("Voltorb Flip Point") - #@pokemon1.firstmoves = [] @pokemon1.name = newspeciesname if @pokemon1.name == oldspeciesname @pokemon1.level = setPokemonLevel(@pokemon1.level, @pokemon2.level, superSplicer) @@ -755,6 +746,24 @@ class PokemonFusionScene end end +def setFusionMoves(fusedPoke, poke2) + choice = Kernel.pbMessage("What to do with the moveset?", [_INTL("Learn moves"), _INTL("Keep {1}'s moveset", fusedPoke.name), _INTL("Keep {1}'s moveset", poke2.name)], 2) + if choice == 1 + return + elsif choice == 2 + fusedPoke.moves = poke2.moves + return + else + #Learn moves + movelist = poke2.moves + for move in movelist + if move.id != 0 + pbLearnMove(fusedPoke, move.id, true, false, true) + end + end + end +end + def setPokemonLevel(pokemon1, pokemon2, superSplicers) lv1 = @pokemon1.level lv2 = @pokemon2.level @@ -794,14 +803,13 @@ def pbChooseAbility(poke, hidden1 = false, hidden2 = false) 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 if (Kernel.pbMessage("Choose an ability.", [_INTL("{1}", ability1_name), _INTL("{1}", ability2_name)], 2)) == 0 - return abID1#hidden1 ? 4 : 0 + return abID1 #hidden1 ? 4 : 0 end - return abID2#hidden2 ? 5 : 1 + return abID2 #hidden2 ? 5 : 1 end def pbChooseNature(species1_nature, species2_nature) diff --git a/Data/System.rxdata b/Data/System.rxdata index ecdd5ec0cf4f631c27826cc3c6c4c5ec3d03b33a..a9eba3840620632641204a31571bd2207fcfea05 100644 GIT binary patch delta 26 icmX?ojq&s~#tj_eERnybv25lMj}K%t+?