diff --git a/Data/Actors.rxdata b/Data/Actors.rxdata index 7967a5432..41edc8e26 100644 Binary files a/Data/Actors.rxdata and b/Data/Actors.rxdata differ diff --git a/Data/Animations.rxdata b/Data/Animations.rxdata index 8e67182ba..826e1e8a6 100644 Binary files a/Data/Animations.rxdata and b/Data/Animations.rxdata differ diff --git a/Data/Armors.rxdata b/Data/Armors.rxdata index 2249bec14..901f2bb2b 100644 Binary files a/Data/Armors.rxdata and b/Data/Armors.rxdata differ diff --git a/Data/CommonEvents.rxdata b/Data/CommonEvents.rxdata index a0b574700..20d8e8f84 100644 Binary files a/Data/CommonEvents.rxdata and b/Data/CommonEvents.rxdata differ diff --git a/Data/Enemies.rxdata b/Data/Enemies.rxdata index 004ee903d..be622f513 100644 Binary files a/Data/Enemies.rxdata and b/Data/Enemies.rxdata differ diff --git a/Data/Items.rxdata b/Data/Items.rxdata index 3e62ba6d2..fe767fa0b 100644 Binary files a/Data/Items.rxdata and b/Data/Items.rxdata differ diff --git a/Data/Map001.rxdata b/Data/Map001.rxdata index 8de12b105..4718bd45f 100644 Binary files a/Data/Map001.rxdata and b/Data/Map001.rxdata differ diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index a0cf80efd..a4bf549b8 100644 Binary files a/Data/MapInfos.rxdata and b/Data/MapInfos.rxdata differ 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 774e21ee5..c99d18dce 100644 --- a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb +++ b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb @@ -22,24 +22,55 @@ class Player < Trainer # Clears the Pokédex. def clear - @seen = {} - @owned = {} + @seen = {} #deprecated + @owned = {} #deprecated - @seen_fusion = {} - @owned_fusion = {} + @seen_standard = initStandardDexArray() + @owned_standard = initStandardDexArray() - @seen_forms = {} + @seen_fusion = initFusionDexArray() + @owned_fusion = initFusionDexArray() + + @seen_forms = {} @last_seen_forms = {} - @owned_shadow = {} + @owned_shadow = {} self.refresh_accessible_dexes end + def initStandardDexArray() + dex_array = [] + for poke in 0..NB_POKEMON + if poke == 0 + dex_array << nil + end + dex_array << false + end + return dex_array + end + def initFusionDexArray() + head_array = [] + for head in 0..NB_POKEMON + body_array = [] + if head == 0 + head_array << nil + end + for body in 0..NB_POKEMON + if body == 0 + body_array << nil + end + body_array << false + end + head_array << body_array + end + return head_array + 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. @@ -47,21 +78,22 @@ class Player < Trainer # @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated def set_seen_fusion(species) bodyId = getBodyID(species) - headId = getHeadID(species,bodyId) + 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_normalDex(species) - species_id = GameData::Species.try_get(species)&.species - return if species_id.nil? - @seen[species_id] = true + dex_num = getDexNumberForSpecies(species) + @seen_standard[dex_num] = true end def set_seen(species, should_refresh_dexes = true) - return #TODO - - if isFusion(species) set_seen_fusion(species) else @@ -75,20 +107,20 @@ class Player < Trainer def seen_fusion?(species) bodyId = getBodyID(species) - headId = getHeadID(species,bodyId) + 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_normalDex?(species) - species_id = GameData::Species.try_get(species)&.species - return false if species_id.nil? - return @seen[species_id] == true + return @seen_standard[getDexNumberForSpecies(species)] end def seen?(species) - return false#TODO - - if isFusion(species) return seen_fusion?(species) else @@ -101,7 +133,7 @@ class Player < Trainer # @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) - return true + return false # species_id = GameData::Species.try_get(species)&.species # return false if species_id.nil? # @seen_forms[species_id] ||= [[], []] @@ -113,8 +145,10 @@ class Player < Trainer # in that region. # @param dex [Integer] region ID def seen_count(dex = -1) - validate dex => Integer - return self.count_species(@seen, dex) + if @seen_standard == nil || @owned_standard == nil + resync_pokedex() + end + count_dex(@seen_standard,@seen_fusion) end # Returns whether there are any seen Pokémon. @@ -123,29 +157,38 @@ class Player < Trainer # @param region [Integer] region ID # @return [Boolean] whether there are any seen Pokémon def seen_any?(dex = -1) - validate dex => Integer - if dex == -1 - GameData::Species.each { |s| return true if s.form == 0 && @seen[s.species] } - else - pbAllRegionalSpecies(dex).each { |s| return true if s && @seen[s] } - end - return false + return seen_count >= 1 end + # def seen_any?(dex = -1) + # validate dex => Integer + # if dex == -1 + # GameData::Species.each { |s| return true if s.form == 0 && @seen[s.species] } + # else + # pbAllRegionalSpecies(dex).each { |s| return true if s && @seen[s] } + # end + # return false + # end + + # Returns the amount of seen forms for the given species. # @param species [Symbol, GameData::Species] Pokémon species # @return [Integer] amount of seen forms def seen_forms_count(species) - species_id = GameData::Species.try_get(species)&.species - return 0 if species_id.nil? - ret = 0 - @seen_forms[species_id] ||= [[], []] - array = @seen_forms[species_id] - for i in 0...[array[0].length, array[1].length].max - ret += 1 if array[0][i] || array[1][i] - end - return ret + return 0 end + # def seen_forms_count(species) + # species_id = GameData::Species.try_get(species)&.species + # return 0 if species_id.nil? + # ret = 0 + # @seen_forms[species_id] ||= [[], []] + # array = @seen_forms[species_id] + # for i in 0...[array[0].length, array[1].length].max + # ret += 1 if array[0][i] || array[1][i] + # end + # return ret + # end + # @param species [Symbol, GameData::Species] Pokémon species def last_form_seen(species) @@ -167,22 +210,21 @@ class Player < Trainer # @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated def set_owned_fusion(species) bodyId = getBodyID(species) - headId = getHeadID(species,bodyId) - @owned_fusion[headId][bodyId]=true - - p @owned_fusion + headId = getHeadID(species, bodyId) + @owned_fusion[headId][bodyId] = true 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_normalDex(species) - species_id = GameData::Species.try_get(species)&.species - return if species_id.nil? - @owned[species_id] = true + @owned_standard[getDexNumberForSpecies(species)] = true end def set_owned(species, should_refresh_dexes = true) - return #TODO - if isFusion(species) set_owned_fusion(species) else @@ -205,21 +247,11 @@ class Player < Trainer # @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 - + headId = getHeadID(species, bodyId) + return @owned_fusion[headId][bodyId] == true end - - def owned?(species) - return false #TODO - - if isFusion(species) return owned_fusion?(species) else @@ -227,13 +259,14 @@ class Player < Trainer 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 + # end def owned_normalDex?(species) - species_id = GameData::Species.try_get(species)&.species - return false if species_id.nil? - return @owned[species_id] == true + return @owned_standard[getDexNumberForSpecies(species)] end - # @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) @@ -248,18 +281,52 @@ class Player < Trainer # in that region. # @param region [Integer] region ID def owned_count(dex = -1) - validate dex => Integer - return self.count_species(@owned, dex) + if @owned_standard == nil || @owned_fusion == nil + resync_pokedex() + end + count_dex(@owned_standard,@owned_fusion) + # + # validate dex => Integer + # return self.count_species(@owned, dex) end + def count_dex(standardList,fusedList) + owned_standard = count_true(standardList) + owned_fused = 0 + for head_poke_list in fusedList + if head_poke_list != nil + owned_fused += count_true(head_poke_list) + end + end + return owned_standard + owned_fused + end + + def count_true(list) + count=0 + for owned in list + if owned + count+=1 + end + end + return count + end + + + #todo: + # loop on @owned and @seen and add the pokemon in @owned_standard/fusion @seen_standard/fusion + # then clear @owned and @seen + def resync_pokedex() + self.clear + end + + #=========================================================================== # @param pkmn [Pokemon, Symbol, GameData::Species] Pokemon to register as seen # @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) - set_owned(species,should_refresh_dexes) - set_seen(species,should_refresh_dexes) + set_seen(species, should_refresh_dexes) # return # if species.is_a?(Pokemon) # species_data = species.species_data @@ -330,11 +397,12 @@ class Player < Trainer @accessible_dexes[0] = region if self.seen_any?(region) return end - if dexes_count == 1 # Only National Dex is defined + if dexes_count == 1 # Only National Dex is defined if self.unlocked?(0) && self.seen_any? @accessible_dexes.push(-1) end - else # Regional Dexes + National Dex + else + # Regional Dexes + National Dex for i in 0...dexes_count dex_list_to_check = (i == dexes_count - 1) ? -1 : i if self.unlocked?(i) && self.seen_any?(dex_list_to_check) diff --git a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb index 3237ef66f..1b35d463c 100644 --- a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb +++ b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb @@ -25,7 +25,11 @@ class Window_Pokedex < Window_DrawableCommand end def species - return (@commands.length==0) ? 0 : @commands[self.index][0] + if self.index > @commands.size + self.index = 0 + end + current_position= self.index + return (@commands.length==0) ? 0 : @commands[current_position][0] end def itemCount diff --git a/Data/Scripts/050_AddOns/PokemonFusion.rb b/Data/Scripts/050_AddOns/PokemonFusion.rb index 3ace25f63..17df5ba48 100644 --- a/Data/Scripts/050_AddOns/PokemonFusion.rb +++ b/Data/Scripts/050_AddOns/PokemonFusion.rb @@ -708,14 +708,14 @@ class PokemonFusionScene #first check if hidden ability hiddenAbility1 = @pokemon1.ability == @pokemon1.getAbilityList[0][-1] hiddenAbility2 = @pokemon2.ability == @pokemon2.getAbilityList[0][-1] + + setFusionMoves(@pokemon1, @pokemon2) if !noMoves + #change species + @pokemon1.species = newSpecies @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 diff --git a/Data/Skills.rxdata b/Data/Skills.rxdata index 61cba7ea2..a45219f5e 100644 Binary files a/Data/Skills.rxdata and b/Data/Skills.rxdata differ diff --git a/Data/States.rxdata b/Data/States.rxdata index 0f9b4ae5d..868d49e59 100644 Binary files a/Data/States.rxdata and b/Data/States.rxdata differ diff --git a/Data/System.rxdata b/Data/System.rxdata index a9eba3840..b8bc6ff32 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ diff --git a/Data/Tilesets.rxdata b/Data/Tilesets.rxdata index 8d34a0eef..9873e9ae6 100644 Binary files a/Data/Tilesets.rxdata and b/Data/Tilesets.rxdata differ diff --git a/Data/Weapons.rxdata b/Data/Weapons.rxdata index d9bd35260..c7ea19a7a 100644 Binary files a/Data/Weapons.rxdata and b/Data/Weapons.rxdata differ diff --git a/PBS/types.txt b/PBS/types.txt index 587eb7862..78779f9f9 100644 --- a/PBS/types.txt +++ b/PBS/types.txt @@ -178,3 +178,10 @@ Resistances=NORMAL,ROCK,GHOST,STEEL,GRASS,PSYCHIC,DRAGON,DARK,FAIRY,WATER,GRASS, Immunities=POISON +[26] +Name=Bug/Steel/Psychic +InternalName=BUGSTEELPSYCHIC +IsSpecialType=true +Weaknesses=FIRE +Resistances=PSYCHIC,NORMAL,STEEL,GRASS,PSYCHIC,ICE,DRAGON,FAIRY,FIGHTING,GRASS +Immunities=POISON \ No newline at end of file