diff --git a/Data/Scripts/003_Game processing/001_StartGame.rb b/Data/Scripts/003_Game processing/001_StartGame.rb index f4215ec88..c18374a67 100644 --- a/Data/Scripts/003_Game processing/001_StartGame.rb +++ b/Data/Scripts/003_Game processing/001_StartGame.rb @@ -81,7 +81,7 @@ module Game rescue Errno::ENOENT if $DEBUG pbMessage(_INTL('Map {1} was not found.', $game_map.map_id)) - map = pbWarpToMap + map = pbWarpToMapList exit unless map $MapFactory.setup(map[0]) $game_player.moveto(map[1], map[2]) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb index dbc14cdaf..9c7337537 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb @@ -154,7 +154,7 @@ class PokemonIconSprite < SpriteWrapper end def useRegularIcon(species) - dexNum = getDexNumberFromSpecies(species) + dexNum = convertSpeciesSymbolToDexNumber(species) return true if dexNum <= Settings::NB_POKEMON return false if $game_variables == nil return true if $game_variables[220] != 0 diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index ea3dea74c..dc9371dfe 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -15,7 +15,7 @@ class PokemonBoxIcon < IconSprite end def useRegularIcon(species) - dexNum = getDexNumberFromSpecies(species) + dexNum = convertSpeciesSymbolToDexNumber(species) return true if dexNum <= Settings::NB_POKEMON return false if $game_variables == nil return true if $game_variables[220] != 0 diff --git a/Data/Scripts/020_Debug/001_Editor_Utilities.rb b/Data/Scripts/020_Debug/001_Editor_Utilities.rb index e6098e142..454b7896a 100644 --- a/Data/Scripts/020_Debug/001_Editor_Utilities.rb +++ b/Data/Scripts/020_Debug/001_Editor_Utilities.rb @@ -116,9 +116,13 @@ end # the ID of the species to initially select. Pressing Input::ACTION will toggle # the list sorting between numerical and alphabetical. def pbChooseSpeciesList(default = nil) - commands = [] - GameData::Species.each { |s| commands.push([s.id_number, s.real_name, s.id]) if s.form == 0 } - return pbChooseList(commands, default, nil, -1) + # commands = [] + # GameData::Species.each { |s| commands.push([s.id_number, s.real_name, s.id]) if s.form == 0 } + # return pbChooseList(commands, default, nil, -1) + params = ChooseNumberParams.new + params.setRange(1,PBSpecies.maxValue) + dexNum = pbMessageChooseNumber("dex number?",params) + return GameData::Species.get(dexNum) end def pbChooseSpeciesFormList(default = nil) diff --git a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb index e89bf9e0f..e0247cb8d 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb @@ -7,7 +7,27 @@ def pbDefaultMap return 0 end +def pbWarpToMapId + params = ChooseNumberParams.new + params.setRange(1,pbMapTree().length) + map_id = pbMessageChooseNumber("map id?",params) + return [map_id,0,0] +end + def pbWarpToMap + choice = pbMessage("type", [_INTL("List"),_INTL("Map id"), _INTL("Town map")], 0) + if choice == 0 + map = pbWarpToMapList + elsif choice == 1 + map = pbWarpToMapId + elsif choice == 2 + Kernel.pbMessage("Not currently supported") + map = pbWarpToMapList + end + return map +end + +def pbWarpToMapList mapid = pbListScreen(_INTL("WARP TO MAP"),MapLister.new(pbDefaultMap)) if mapid>0 map = Game_Map.new diff --git a/Data/Scripts/049_Compatibility/PBSpecies.rb b/Data/Scripts/049_Compatibility/PBSpecies.rb index bf1fa1164..acca35f96 100644 --- a/Data/Scripts/049_Compatibility/PBSpecies.rb +++ b/Data/Scripts/049_Compatibility/PBSpecies.rb @@ -3,5 +3,9 @@ module PBSpecies def PBSpecies.maxValue return 176832 end + + def PBSpecies.getName(species) + return GameData::Species.get(species).real_name + end end diff --git a/Data/Scripts/050_AddOns/Gen 2.rb b/Data/Scripts/050_AddOns/Gen 2.rb index 87ad0f1a1..031a75e6b 100644 --- a/Data/Scripts/050_AddOns/Gen 2.rb +++ b/Data/Scripts/050_AddOns/Gen 2.rb @@ -161,6 +161,8 @@ end #in: pokemon number def Kernel.isPartPokemon(src, target) + src = convertSpeciesSymbolToDexNumber(src) + target = convertSpeciesSymbolToDexNumber(target) return true if src == target return false if src <= NB_POKEMON bod = getBasePokemonID(src, true) diff --git a/Data/Scripts/050_AddOns/GeneralUtils.rb b/Data/Scripts/050_AddOns/GeneralUtils.rb index ea5359361..2a3684ae9 100644 --- a/Data/Scripts/050_AddOns/GeneralUtils.rb +++ b/Data/Scripts/050_AddOns/GeneralUtils.rb @@ -116,7 +116,8 @@ def pbCheckPokemonIconFiles(speciesNum,egg=false, dna=false) end -def getDexNumberFromSpecies(species) +def convertSpeciesSymbolToDexNumber(species) + return species if species.is_a?(Integer) if species.is_a?(Symbol) dexNum = GameData::Species.get(species).id_number elsif species.is_a?(Pokemon) @@ -127,14 +128,43 @@ def getDexNumberFromSpecies(species) return dexNum end +def getRandomCustomFusion(returnRandomPokemonIfNoneFound=true,customPokeList=[],maxPoke=-1,recursionLimit=3) + if customPokeList.length==0 + customPokeList = getCustomSpeciesList() + end + randPoke = [] + if customPokeList.length >= 5000 + chosen=false + i=0 #loop pas plus que 3 fois pour pas lag + while chosen == false + fusedPoke = customPokeList[rand(customPokeList.length)] + poke1 = getBasePokemonID(fusedPoke,false) + poke2 = getBasePokemonID(fusedPoke,true) + + if ((poke1 <= maxPoke && poke2 <= maxPoke) || i >= recursionLimit) || maxPoke == -1 + randPoke << getBasePokemonID(fusedPoke,false) + randPoke << getBasePokemonID(fusedPoke,true) + chosen = true + end + end + else + if returnRandomPokemonIfNoneFound + randPoke << rand(maxPoke)+1 + randPoke << rand(maxPoke)+1 + end + end + + return randPoke +end + def getBodyID(species) - dexNum = getDexNumberFromSpecies(species) + dexNum = convertSpeciesSymbolToDexNumber(species) return (dexNum / NB_POKEMON).round end def getHeadID(species, bodyId) - head_dexNum = getDexNumberFromSpecies(species) - body_dexNum = getDexNumberFromSpecies(bodyId) + head_dexNum = convertSpeciesSymbolToDexNumber(species) + body_dexNum = convertSpeciesSymbolToDexNumber(bodyId) return (head_dexNum - (body_dexNum * NB_POKEMON)).round end diff --git a/Data/Scripts/050_AddOns/IntroScreen.rb b/Data/Scripts/050_AddOns/IntroScreen.rb index b8d4af295..4e6af3e9b 100644 --- a/Data/Scripts/050_AddOns/IntroScreen.rb +++ b/Data/Scripts/050_AddOns/IntroScreen.rb @@ -113,30 +113,6 @@ end #=============================================================================== class GenOneStyle - #currently unused - def getRandomCustomFusion() - randPoke = [] - if @customPokeList.length >= 5000 - chosen=false - i=0 #loop pas plus que 3 fois pour pas lag - while chosen == false - fusedPoke = @customPokeList[rand(@customPokeList.length)] - poke1 = getBasePokemonID(fusedPoke,false) - poke2 = getBasePokemonID(fusedPoke,true) - - if ((poke1 <= @maxPoke && poke2 <= @maxPoke) || i >= 3) - randPoke << getBasePokemonID(fusedPoke,false) - randPoke << getBasePokemonID(fusedPoke,true) - chosen = true - end - end - else - randPoke << rand(@maxPoke)+1 - randPoke << rand(@maxPoke)+1 - end - - return randPoke - end @@ -146,7 +122,7 @@ class GenOneStyle @customPokeList = getCustomSpeciesList() #Get random Pokemon (1st gen orandPokenly, pas de legend la prmeiere fois) - randPoke = getRandomCustomFusion() + randPoke = getRandomCustomFusion(true,@customPokeList,@maxPoke) randpoke1 = randPoke[0] #rand(@maxPoke)+1 randpoke2 = randPoke[1] #rand(@maxPoke)+1 @@ -364,7 +340,7 @@ class GenOneStyle if @maxPoke < NB_POKEMON-1 @maxPoke += 5 #-1 pour que ca arrive pile. tant pis pour kyurem end - randPoke = getRandomCustomFusion() + randPoke = getRandomCustomFusion(true,@customPokeList,@maxPoke) randpoke1 = randPoke[0] #rand(@maxPoke)+1 randpoke2 = randPoke[1] #rand(@maxPoke)+1