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 ae45168bf..6f0a5a836 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/Map229.rxdata b/Data/Map229.rxdata index b9e00df0f..8d072ff60 100644 Binary files a/Data/Map229.rxdata and b/Data/Map229.rxdata differ diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index 9227c8a45..bf906a182 100644 Binary files a/Data/MapInfos.rxdata and b/Data/MapInfos.rxdata differ diff --git a/Data/Scripts/010_Data/002_PBS data/011_Encounter.rb b/Data/Scripts/010_Data/002_PBS data/011_Encounter.rb index e0e75bb3f..8085c6435 100644 --- a/Data/Scripts/010_Data/002_PBS data/011_Encounter.rb +++ b/Data/Scripts/010_Data/002_PBS data/011_Encounter.rb @@ -3,6 +3,7 @@ module GameData attr_accessor :id attr_accessor :map attr_accessor :version + attr_reader :step_chances attr_reader :types diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb index 578b80a96..96ec29499 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb @@ -332,6 +332,12 @@ end # Used when walking in tall grass, hence the additional code. def pbWildBattle(species, level, outcomeVar=1, canRun=true, canLose=false) species = GameData::Species.get(species).id + dexnum = getDexNumberForSpecies(species) + if $game_switches[SWITCH_RANDOM_STATIC_ENCOUNTERS] && dexnum <= NB_POKEMON + newSpecies = $PokemonGlobal.psuedoBSTHash[dexnum] + species = getSpecies(newSpecies) + end + # Potentially call a different pbWildBattle-type method instead (for roaming # Pokémon, Safari battles, Bug Contest battles) handled = [nil] diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index d3c408a7d..2d7ec62bf 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -984,6 +984,7 @@ module Compiler slots.compact! slots.sort! { |a, b| (a[0] == b[0]) ? a[1].to_s <=> b[1].to_s : b[0] <=> a[0] } end + p encounter_hash GameData::Encounter.register(encounter_hash) end # Raise an error if a map/version combo is used twice @@ -1055,6 +1056,7 @@ module Compiler slots.compact! slots.sort! { |a, b| (a[0] == b[0]) ? a[1].to_s <=> b[1].to_s : b[0] <=> a[0] } end + p encounter_hash GameData::Encounter.register(encounter_hash) end # Save all data diff --git a/Data/Scripts/025-Randomizer/RandomizerSettings.rb b/Data/Scripts/025-Randomizer/RandomizerSettings.rb index 3d7d13a56..3bdd01afa 100644 --- a/Data/Scripts/025-Randomizer/RandomizerSettings.rb +++ b/Data/Scripts/025-Randomizer/RandomizerSettings.rb @@ -18,67 +18,67 @@ class RandomizerOptionsScene < PokemonOption_Scene def pbStartScene(inloadscreen = false) super @changedColor = true - @sprites["title"]=Window_UnformattedTextPokemon.newWithSize( - _INTL("Randomizer settings"),0,0,Graphics.width,64,@viewport) - @sprites["textbox"].text= getDefaultDescription + @sprites["title"] = Window_UnformattedTextPokemon.newWithSize( + _INTL("Randomizer settings"), 0, 0, Graphics.width, 64, @viewport) + @sprites["textbox"].text = getDefaultDescription pbFadeInAndShow(@sprites) { pbUpdate } end def pbGetOptions(inloadscreen = false) options = [ - EnumOption.new(_INTL("Starters"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[SWITCH_RANDOM_STARTERS] ? 0 : 1 }, - proc { |value| - $game_switches[SWITCH_RANDOM_STARTERS] = value == 0 - }, "Randomize the selection of starters to choose from at the start of the game" - ), + EnumOption.new(_INTL("Starters"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[SWITCH_RANDOM_STARTERS] ? 0 : 1 }, + proc { |value| + $game_switches[SWITCH_RANDOM_STARTERS] = value == 0 + }, "Randomize the selection of starters to choose from at the start of the game" + ), - EnumOption.new(_INTL("Trainers"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[SWITCH_RANDOM_TRAINERS] ? 0 : 1 }, - proc { |value| - if !$game_switches[SWITCH_RANDOM_TRAINERS] && value == 0 - @openTrainerOptions = true - openTrainerOptionsMenu() - end - $game_switches[SWITCH_RANDOM_TRAINERS] = value == 0 - }, "Select the randomizer options for regular trainers" - ), + EnumOption.new(_INTL("Trainers"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[SWITCH_RANDOM_TRAINERS] ? 0 : 1 }, + proc { |value| + if !$game_switches[SWITCH_RANDOM_TRAINERS] && value == 0 + @openTrainerOptions = true + openTrainerOptionsMenu() + end + $game_switches[SWITCH_RANDOM_TRAINERS] = value == 0 + }, "Select the randomizer options for regular trainers" + ), - EnumOption.new(_INTL("Gym trainers"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] ? 0 : 1 }, - proc { |value| - if !$game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] && value == 0 - @openGymOptions = true - openGymOptionsMenu() - end - $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] = value == 0 - }, "Limit gym trainers to a single type" - ), + EnumOption.new(_INTL("Gym trainers"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] ? 0 : 1 }, + proc { |value| + if !$game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] && value == 0 + @openGymOptions = true + openGymOptionsMenu() + end + $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] = value == 0 + }, "Limit gym trainers to a single type" + ), - EnumOption.new(_INTL("Wild Pokémon"), [_INTL("On"), _INTL("Off")], - proc { - $game_switches[SWITCH_RANDOM_WILD] ? 0 : 1 - }, - proc { |value| - if !$game_switches[SWITCH_RANDOM_WILD] && value == 0 - @openWildOptions = true - openWildPokemonOptionsMenu() - end - $game_switches[SWITCH_RANDOM_WILD] = value == 0 - },"Select the randomizer options for wild Pokémon" - ), - EnumOption.new(_INTL("Items"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[SWITCH_RANDOM_ITEMS] ? 0 : 1 }, - proc { |value| - $game_switches[SWITCH_RANDOM_ITEMS] = value == 0 - }, "Randomize the items picked up on the ground" - ), - EnumOption.new(_INTL("TMs"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[SWITCH_RANDOM_TMS] ? 0 : 1 }, - proc { |value| - $game_switches[SWITCH_RANDOM_TMS] = value == 0 - },"Randomize the TMs picked up on the ground" - ), + EnumOption.new(_INTL("Wild Pokémon"), [_INTL("On"), _INTL("Off")], + proc { + $game_switches[SWITCH_RANDOM_WILD] ? 0 : 1 + }, + proc { |value| + if !$game_switches[SWITCH_RANDOM_WILD] && value == 0 + @openWildOptions = true + openWildPokemonOptionsMenu() + end + $game_switches[SWITCH_RANDOM_WILD] = value == 0 + }, "Select the randomizer options for wild Pokémon" + ), + EnumOption.new(_INTL("Items"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[SWITCH_RANDOM_ITEMS] ? 0 : 1 }, + proc { |value| + $game_switches[SWITCH_RANDOM_ITEMS] = value == 0 + }, "Randomize the items picked up on the ground" + ), + EnumOption.new(_INTL("TMs"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[SWITCH_RANDOM_TMS] ? 0 : 1 }, + proc { |value| + $game_switches[SWITCH_RANDOM_TMS] = value == 0 + }, "Randomize the TMs picked up on the ground" + ), ] return options end @@ -113,10 +113,8 @@ class RandomizerOptionsScene < PokemonOption_Scene @openWildOptions = false end - end - class RandomizerTrainerOptionsScene < PokemonOption_Scene RANDOM_TEAMS_CUSTOM_SPRITES = 600 RANDOM_HELD_ITEMS = 843 @@ -134,10 +132,9 @@ class RandomizerTrainerOptionsScene < PokemonOption_Scene for i in 0...@PokemonOptions.length @sprites["option"][i] = (@PokemonOptions[i].get || 0) end - @sprites["title"]=Window_UnformattedTextPokemon.newWithSize( - _INTL("Randomizer settings: Trainers"),0,0,Graphics.width,64,@viewport) - @sprites["textbox"].text=_INTL("Set the randomizer settings for trainers") - + @sprites["title"] = Window_UnformattedTextPokemon.newWithSize( + _INTL("Randomizer settings: Trainers"), 0, 0, Graphics.width, 64, @viewport) + @sprites["textbox"].text = _INTL("Set the randomizer settings for trainers") pbFadeInAndShow(@sprites) { pbUpdate } end @@ -149,25 +146,24 @@ class RandomizerTrainerOptionsScene < PokemonOption_Scene def pbGetOptions(inloadscreen = false) options = [ - EnumOption.new(_INTL("Custom Sprites only"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[RANDOM_TEAMS_CUSTOM_SPRITES] ? 0 : 1 }, - proc { |value| - $game_switches[RANDOM_TEAMS_CUSTOM_SPRITES] = value == 0 - }, - "Use only Pokémon that have custom sprites in trainer teams" - ), - EnumOption.new(_INTL("Trainer Held items"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[RANDOM_HELD_ITEMS] ? 0 : 1 }, - proc { |value| - $game_switches[RANDOM_HELD_ITEMS] = value == 0 - },"Give random held items to all trainers" - ) + EnumOption.new(_INTL("Custom Sprites only"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[RANDOM_TEAMS_CUSTOM_SPRITES] ? 0 : 1 }, + proc { |value| + $game_switches[RANDOM_TEAMS_CUSTOM_SPRITES] = value == 0 + }, + "Use only Pokémon that have custom sprites in trainer teams" + ), + EnumOption.new(_INTL("Trainer Held items"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[RANDOM_HELD_ITEMS] ? 0 : 1 }, + proc { |value| + $game_switches[RANDOM_HELD_ITEMS] = value == 0 + }, "Give random held items to all trainers" + ) ] return options end end - class RandomizerWildPokemonOptionsScene < PokemonOption_Scene RANDOM_WILD_AREA = 777 RANDOM_WILD_GLOBAL = 956 @@ -187,9 +183,9 @@ class RandomizerWildPokemonOptionsScene < PokemonOption_Scene for i in 0...@PokemonOptions.length @sprites["option"][i] = (@PokemonOptions[i].get || 0) end - @sprites["title"]=Window_UnformattedTextPokemon.newWithSize( - _INTL("Randomizer settings: Wild Pokémon"),0,0,Graphics.width,64,@viewport) - @sprites["textbox"].text=_INTL("Set the randomizer settings for wild Pokémon") + @sprites["title"] = Window_UnformattedTextPokemon.newWithSize( + _INTL("Randomizer settings: Wild Pokémon"), 0, 0, Graphics.width, 64, @viewport) + @sprites["textbox"].text = _INTL("Set the randomizer settings for wild Pokémon") pbFadeInAndShow(@sprites) { pbUpdate } end @@ -200,57 +196,61 @@ class RandomizerWildPokemonOptionsScene < PokemonOption_Scene def pbGetOptions(inloadscreen = false) options = [ - EnumOption.new(_INTL("Type"), [_INTL("Global")],#, _INTL("Area")], - proc { - if $game_switches[RANDOM_WILD_AREA] - 1 - else - 0 - end - }, - proc { |value| - if value == 0 - $game_switches[RANDOM_WILD_GLOBAL] = true - $game_switches[RANDOM_WILD_AREA] = false - else - value == 1 - $game_switches[RANDOM_WILD_GLOBAL] = false - $game_switches[RANDOM_WILD_AREA] = true - end - } - ), - # EnumOption.new(_INTL("Static encounters"), [_INTL("On"), _INTL("Off")], - # proc { $game_switches[RANDOM_STATIC] ? 0 : 1 }, - # proc { |value| - # $game_switches[RANDOM_STATIC] = value == 0 - # } - # ), - - EnumOption.new(_INTL("Gift Pokémon"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[GIFT_POKEMON] ? 0 : 1 }, - proc { |value| - $game_switches[GIFT_POKEMON] = value == 0 - },"Randomize Pokémon that are gifted to the player" - ), - - EnumOption.new(_INTL("Fuse everything"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[REGULAR_TO_FUSIONS] ? 0 : 1 }, - proc { |value| - $game_switches[REGULAR_TO_FUSIONS] = value == 0 - },"Include fused Pokémon in the randomize pool for wild Pokémon" - ), - EnumOption.new(_INTL("Custom sprites only"), [_INTL("On"), _INTL("Off")], - proc { $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] ? 0 : 1 }, - proc { |value| - $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] = value == 0 - }, "(When fuse everything option is on) Randomize only to Pokémon that have a custom sprite." - ) + EnumOption.new(_INTL("Type"), [_INTL("Global"), _INTL("Area")], + proc { + if $game_switches[RANDOM_WILD_AREA] + 1 + else + 0 + end + }, + proc { |value| + if value == 0 + $game_switches[RANDOM_WILD_GLOBAL] = true + $game_switches[RANDOM_WILD_AREA] = false + else + value == 1 + $game_switches[RANDOM_WILD_GLOBAL] = false + $game_switches[RANDOM_WILD_AREA] = true + end + }, + [ + "Randomizes Pokémon using a one-to-one mapping of the Pokedex", + "Randomizes the encounters in each route individually" + ] + ), + EnumOption.new(_INTL("Static encounters"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[RANDOM_STATIC] ? 0 : 1 }, + proc { |value| + $game_switches[RANDOM_STATIC] = value == 0 + }, + "Randomize Pokémon that appear in the overworld (including legendaries)" + ), + + EnumOption.new(_INTL("Gift Pokémon"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[GIFT_POKEMON] ? 0 : 1 }, + proc { |value| + $game_switches[GIFT_POKEMON] = value == 0 + }, "Randomize Pokémon that are gifted to the player" + ), + + EnumOption.new(_INTL("Fuse everything"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[REGULAR_TO_FUSIONS] ? 0 : 1 }, + proc { |value| + $game_switches[REGULAR_TO_FUSIONS] = value == 0 + }, "Include fused Pokémon in the randomize pool for wild Pokémon" + ), + EnumOption.new(_INTL("Custom sprites only"), [_INTL("On"), _INTL("Off")], + proc { $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] ? 0 : 1 }, + proc { |value| + $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] = value == 0 + }, "(With fuse everything option) Randomize only to Pokémon that have a custom sprite." + ) ] return options end end - class RandomizerGymOptionsScene < PokemonOption_Scene RANDOM_GYM_TYPES = 921 @@ -266,10 +266,9 @@ class RandomizerGymOptionsScene < PokemonOption_Scene for i in 0...@PokemonOptions.length @sprites["option"][i] = (@PokemonOptions[i].get || 0) end - @sprites["title"]=Window_UnformattedTextPokemon.newWithSize( - _INTL("Randomizer settings: Gyms"),0,0,Graphics.width,64,@viewport) - @sprites["textbox"].text=_INTL("Set the randomizer settings for gyms") - + @sprites["title"] = Window_UnformattedTextPokemon.newWithSize( + _INTL("Randomizer settings: Gyms"), 0, 0, Graphics.width, 64, @viewport) + @sprites["textbox"].text = _INTL("Set the randomizer settings for gyms") pbFadeInAndShow(@sprites) { pbUpdate } end @@ -292,7 +291,7 @@ class RandomizerGymOptionsScene < PokemonOption_Scene proc { |value| $game_switches[SWITCH_GYM_RANDOM_EACH_BATTLE] = value == 0 $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS] = !$game_switches[SWITCH_GYM_RANDOM_EACH_BATTLE] - },"Gym trainers and leaders have a new team each try instead of keeping the same one" + }, "Gym trainers and leaders have a new team each try instead of keeping the same one" ), EnumOption.new(_INTL("Custom sprites only"), [_INTL("On"), _INTL("Off")], proc { $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? 0 : 1 }, diff --git a/Data/Scripts/025-Randomizer/randomizer - encounters.rb b/Data/Scripts/025-Randomizer/randomizer - encounters.rb index b33a49c16..97816492e 100644 --- a/Data/Scripts/025-Randomizer/randomizer - encounters.rb +++ b/Data/Scripts/025-Randomizer/randomizer - encounters.rb @@ -3,62 +3,114 @@ # Randomize encounter by routes # Script by Frogman # - def Kernel.randomizeWildPokemonByRoute() - bstRange = $game_variables[197] - randomizeToFusions = $game_switches[953] - $game_switches[829] = randomizeToFusions #unused mais probab. utile pour débugger les inévitables bugs quand les gens vont se partager leurs fichiers + bstRange = $game_variables[VAR_RANDOMIZER_WILD_POKE_BST] + randomizeToFusions = $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] + onlyCustoms = $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && randomizeToFusions + customsList = onlyCustoms ? getCustomSpeciesList() : [] maxSpecies = randomizeToFusions ? PBSpecies.maxValue : NB_POKEMON - data=load_data("Data/encounters.dat") - map_index = 0 - nb_maps= data.size - if data.is_a?(Hash) - for map in data - map_index += 1 - displayProgress(map_index,nb_maps,bstRange) - map_id = map[0] - encountersList = map[1][1] - next if encountersList== nil - type_index =-1 - for encounterType in encountersList - type_index +=1 - next if encounterType == nil - previousSpecies = -1 - previousNewSpecies = -1 - encounter_index = 0 - for encounter in encounterType - species = encounter[0] - if species != previousSpecies - newSpecies= getNewSpecies(species,bstRange,true,maxSpecies) - previousSpecies = species - previousNewSpecies = newSpecies - else - newSpecies = previousNewSpecies - end - if data[map_id][1][type_index][encounter_index] != nil - data[map_id][1][type_index][encounter_index][0] = newSpecies - end - encounter_index +=1 - end #for -encounter - end #for encountertype - end #for - map - end #if - filename = "Data/encounters_randomized.dat" - save_data(Marshal.load(Marshal.dump(data)),filename) - $PokemonEncounters.setup($game_map.map_id) - end - - - #file = File.new('Data/test.txt', 'w') - #file.puts data.inspect - + GameData::EncounterRandom::DATA.clear + GameData::Encounter.each do |enc_data| + encounters_hash = {} + encounters_hash[:id] = enc_data.id + encounters_hash[:map] = enc_data.map + encounters_hash[:version] = enc_data.version + encounters_hash[:step_chances] = enc_data.step_chances + types_hash = {} + enc_data.types.each do |key, value| + pokemonList = value + newType = randomizePokemonList(pokemonList,bstRange,maxSpecies,randomizeToFusions,customsList) + types_hash[key]= newType + end + encounters_hash[:types] = types_hash + GameData::EncounterRandom.register(encounters_hash) + end -def displayProgress(current,total,bst) - return if bst >= 100 - return if bst >= 20 && current % 10 != 0 - Kernel.pbMessageNoSound(_INTL("\\ts[]Generating encounters file...\\n Map {1}/{2}\\^",current,total)) + # Save all data + GameData::EncounterRandom.save + Graphics.update + GameData::EncounterRandom.load end +#input: [[60, :TENTACOOL,5,40, [30, :GOLDEEN, 5, 35], etc.]] +def randomizePokemonList(encountersList,bstRange=50,maxSpecies=420,customOnly=false,customsList=[]) + newList=[] + for encounter in encountersList + oldPokemon = encounter[1] + if customOnly + newPokemon = getNewCustomSpecies(oldPokemon,customsList,bstRange,false) + else + newPokemon = getNewSpecies(oldPokemon,bstRange,false,maxSpecies) + end + newEntry =[] + newEntry << encounter[0] + newEntry << getSpecies(newPokemon).species + newEntry << encounter[2] + newEntry << encounter[3] + newList << newEntry + end + return newList +end + + +# +# def Kernel.randomizeWildPokemonByRouteOld() +# bstRange = $game_variables[VAR_RANDOMIZER_WILD_POKE_BST] +# randomizeToFusions = $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] +# $game_switches[SWITCH_RANDOMIZED_WILD_POKEMON_TO_FUSIONS] = randomizeToFusions #unused mais probab. utile pour débugger les inévitables bugs quand les gens vont se partager leurs fichiers +# maxSpecies = randomizeToFusions ? PBSpecies.maxValue : NB_POKEMON +# data=load_data("Data/encounters.dat") +# map_index = 0 +# nb_maps= data.size +# if data.is_a?(Hash) +# for map in data +# map_index += 1 +# displayProgress(map_index,nb_maps,bstRange) +# map_id = map[0] +# +# encountersList = GameData::Encounter.get(map_id) +# p encountersList +# next if encountersList== nil +# type_index =-1 +# for encounterType in encountersList +# type_index +=1 +# next if encounterType == nil +# previousSpecies = -1 +# previousNewSpecies = -1 +# encounter_index = 0 +# for encounter in encounterType +# species = encounter[0] +# if species != previousSpecies +# newSpecies= getNewSpecies(species,bstRange,true,maxSpecies) +# previousSpecies = species +# previousNewSpecies = newSpecies +# else +# newSpecies = previousNewSpecies +# end +# if data[map_id][1][type_index][encounter_index] != nil +# data[map_id][1][type_index][encounter_index][0] = newSpecies +# end +# encounter_index +=1 +# end #for -encounter +# end #for encountertype +# end #for - map +# end #if +# filename = "Data/encounters_randomized.dat" +# save_data(Marshal.load(Marshal.dump(data)),filename) +# $PokemonEncounters.setup($game_map.map_id) +# end + + +#file = File.new('Data/test.txt', 'w') +#file.puts data.inspect + + +# def displayProgress(current,total,bst) +# return if bst >= 100 +# return if bst >= 20 && current % 10 != 0 +# Kernel.pbMessageNoSound(_INTL("\\ts[]Generating encounters file...\\n Map {1}/{2}\\^",current,total)) +# end + # # class PokemonEncounters # @@ -121,37 +173,37 @@ end # end - -def getRandomPokemon(originalPokemon,bstRange,maxDexNumber) - originalBst = getBaseStatsTotal(originalPokemon) - bstMin = originalBst-bstRange - bstMax = originalBst+bstRange - - foundAPokemon = false - int i=0 - while ! foundAPokemon - newPoke = rand(maxDexNumber-1)+1 - newPokeBST = getBaseStatsTotal(newPoke) - if newPokeBST >= bstMin && newPokeBST <= bstMax - foundAPokemon = true - end - i+=1 - if i %10 ==0 - bstMin-=5 - bstMax+=5 - end - end - return newPoke -end - -def getBaseStatsTotal(species) - baseStats=$pkmn_dex[species][5] - baseStat_temp = 0 - for i in 0...baseStats.length - baseStat_temp+=baseStats[i] - end - return (baseStat_temp/range).floor -end +# +# def getRandomPokemon(originalPokemon,bstRange,maxDexNumber) +# originalBst = getBaseStatsTotal(originalPokemon) +# bstMin = originalBst-bstRange +# bstMax = originalBst+bstRange +# +# foundAPokemon = false +# int i=0 +# while ! foundAPokemon +# newPoke = rand(maxDexNumber-1)+1 +# newPokeBST = getBaseStatsTotal(newPoke) +# if newPokeBST >= bstMin && newPokeBST <= bstMax +# foundAPokemon = true +# end +# i+=1 +# if i %10 ==0 +# bstMin-=5 +# bstMax+=5 +# end +# end +# return newPoke +# end +# +# def getBaseStatsTotal(species) +# baseStats=$pkmn_dex[species][5] +# baseStat_temp = 0 +# for i in 0...baseStats.length +# baseStat_temp+=baseStats[i] +# end +# return (baseStat_temp/range).floor +# end ###################################################### diff --git a/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb b/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb index 5c2dc525b..46705288c 100644 --- a/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb +++ b/Data/Scripts/025-Randomizer/randomizer gym leader edit.rb @@ -315,6 +315,14 @@ def playShuffleSE(i) end end +def getTrainersDataMode + mode = GameData::Trainer + if $game_switches && $game_switches[SWITCH_MODERN_MODE] + mode = GameData::TrainerModern + end + return mode +end + def Kernel.pbShuffleTrainers(bst_range = 50,customsOnly=false,customsList=nil) bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST) @@ -323,7 +331,7 @@ def Kernel.pbShuffleTrainers(bst_range = 50,customsOnly=false,customsList=nil) customsOnly = false end randomTrainersHash = Hash.new - trainers_data = getTrainersDataMode.list_all + trainers_data = GameData::Trainer.list_all trainers_data.each do |key, value| trainer = trainers_data[key] i=0 diff --git a/Data/Scripts/049_Compatibility/Constants.rb b/Data/Scripts/049_Compatibility/Constants.rb index 3aaeae817..8b90708f9 100644 --- a/Data/Scripts/049_Compatibility/Constants.rb +++ b/Data/Scripts/049_Compatibility/Constants.rb @@ -63,6 +63,7 @@ SWITCH_RANDOMIZED_GYM_TYPES=921 SWITCH_RANDOM_GIFT_POKEMON = 780 SWITCH_RANDOM_HELD_ITEMS = 843 SWITCH_DEFINED_RIVAL_STARTER=840 +SWITCH_RANDOMIZED_WILD_POKEMON_TO_FUSIONS=829 #Other switches SWITCH_RACE_BIKE = 984 SWITCH_IS_REMATCH=200 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 7817d19b1..04d111aeb 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ diff --git a/Data/Tilesets.rxdata b/Data/Tilesets.rxdata index 6d18cb3a3..8d4c2fd59 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/Data/encounters_randomized.dat b/Data/encounters_randomized.dat index 1a353d4ab..35e37e06b 100644 Binary files a/Data/encounters_randomized.dat and b/Data/encounters_randomized.dat differ diff --git a/Data/encounters_randomized2.dat b/Data/encounters_randomized2.dat new file mode 100644 index 000000000..eea72a02a Binary files /dev/null and b/Data/encounters_randomized2.dat differ