release 6.2

This commit is contained in:
infinitefusion
2024-06-28 12:01:39 -04:00
parent 0b9e83f554
commit 3a488c9ba6
7249 changed files with 713866 additions and 136365 deletions

View File

@@ -129,8 +129,8 @@ class RandomizerTrainerOptionsScene < PokemonOption_Scene
def pbStartScene(inloadscreen = false)
super
@sprites["option"].nameBaseColor = Color.new(35, 130, 200)
@sprites["option"].nameShadowColor = Color.new(20, 75, 115)
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
@changedColor = true
for i in 0...@PokemonOptions.length
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
@@ -164,6 +164,13 @@ class RandomizerTrainerOptionsScene < PokemonOption_Scene
"Use only Pokémon that have custom sprites in trainer teams"
)
# options << EnumOption.new(_INTL("Allow legendaries"), [_INTL("On"), _INTL("Off")],
# proc { $game_switches[SWITCH_RANDOM_TRAINER_LEGENDARIES] ? 0 : 1 },
# proc { |value|
# $game_switches[SWITCH_RANDOM_TRAINER_LEGENDARIES] = value == 0
# }, "Regular Pokémon can also be randomized into legendaries"
# )
return options
end
end
@@ -238,11 +245,24 @@ class RandomizerWildPokemonOptionsScene < PokemonOption_Scene
}, "['Fuse everything' & starters] Include only Pokémon with a custom sprite."
)
options << EnumOption.new(_INTL("Starters"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_STARTERS] ? 0 : 1 },
options << EnumOption.new(_INTL("Allow legendaries"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_WILD_LEGENDARIES] ? 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"
$game_switches[SWITCH_RANDOM_WILD_LEGENDARIES] = value == 0
}, ["Regular wild Pokémon can also be randomized into legendaries.",
"Only legendaries can be randomized into legendaries"]
)
options << EnumOption.new(_INTL("Starters"), [_INTL("1st Stage"), _INTL("Any"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_STARTERS] ? 0 : 2 },
proc { |value|
$game_switches[SWITCH_RANDOM_STARTERS] = (value == 0 || value == 1)
if value == 0
$game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE] = true
end
}, ["The starters will always be a first evolution Pokémon",
"The starters can be any Pokémon",
"The starters are not randomized"]
)
options << EnumOption.new(_INTL("Static encounters"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[RANDOM_STATIC] ? 0 : 1 },
@@ -278,8 +298,8 @@ class RandomizerGymOptionsScene < PokemonOption_Scene
def pbStartScene(inloadscreen = false)
super
@sprites["option"].nameBaseColor = Color.new(35, 130, 200)
@sprites["option"].nameShadowColor = Color.new(20, 75, 115)
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
@changedColor = true
for i in 0...@PokemonOptions.length
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
@@ -317,6 +337,14 @@ class RandomizerGymOptionsScene < PokemonOption_Scene
$game_switches[RANDOM_GYM_TYPES] = value == 0
}, "Shuffle the gym types"
)
# options << EnumOption.new(_INTL("Allow legendaries"), [_INTL("On"), _INTL("Off")],
# proc { $game_switches[SWITCH_RANDOM_GYM_LEGENDARIES] ? 0 : 1 },
# proc { |value|
# $game_switches[SWITCH_RANDOM_GYM_LEGENDARIES] = value == 0
# }, "Regular Pokémon can also be randomized into legendaries"
# )
options << EnumOption.new(_INTL("Rerandomize each battle"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_GYM_RANDOM_EACH_BATTLE] ? 0 : 1 },
proc { |value|
@@ -338,8 +366,85 @@ class RandomizerItemOptionsScene < PokemonOption_Scene
def pbStartScene(inloadscreen = false)
super
@sprites["option"].nameBaseColor = Color.new(35, 130, 200)
@sprites["option"].nameShadowColor = Color.new(20, 75, 115)
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
@changedColor = true
for i in 0...@PokemonOptions.length
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
end
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
_INTL("Randomizer settings: Items"), 0, 0, Graphics.width, 64, @viewport)
@sprites["textbox"].text = _INTL("Set the randomizer settings for items")
pbFadeInAndShow(@sprites) { pbUpdate }
end
def pbFadeInAndShow(sprites, visiblesprites = nil)
return if !@changedColor
super
end
def pbGetOptions(inloadscreen = false)
options = [
EnumOption.new(_INTL("Found items"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_FOUND_ITEMS] ? 0 : 1 },
proc { |value|
$game_switches[SWITCH_RANDOM_FOUND_ITEMS] = value == 0
$game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = value == 0
$game_switches[SWITCH_RANDOM_ITEMS] = $game_switches[SWITCH_RANDOM_FOUND_ITEMS] || $game_switches[SWITCH_RANDOM_GIVEN_ITEMS]
}, "Randomize the items picked up on the ground"
),
EnumOption.new(_INTL("Found TMs"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_FOUND_TMS] ? 0 : 1 },
proc { |value|
$game_switches[SWITCH_RANDOM_FOUND_TMS] = value == 0
$game_switches[SWITCH_RANDOM_TMS] = $game_switches[SWITCH_RANDOM_FOUND_TMS] || $game_switches[SWITCH_RANDOM_GIVEN_TMS]
}, "Randomize the TMs picked up on the ground"
),
EnumOption.new(_INTL("Given items"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_GIVEN_ITEMS] ? 0 : 1 },
proc { |value|
$game_switches[SWITCH_RANDOM_GIVEN_ITEMS] = value == 0
$game_switches[SWITCH_RANDOM_ITEMS] = $game_switches[SWITCH_RANDOM_FOUND_ITEMS] || $game_switches[SWITCH_RANDOM_GIVEN_ITEMS]
}, "Randomize the items given by NPCs (may make some quests impossible to complete)"
),
EnumOption.new(_INTL("Given TMs"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_GIVEN_TMS] ? 0 : 1 },
proc { |value|
$game_switches[SWITCH_RANDOM_GIVEN_TMS] = value == 0
$game_switches[SWITCH_RANDOM_TMS] = $game_switches[SWITCH_RANDOM_FOUND_TMS] || $game_switches[SWITCH_RANDOM_GIVEN_TMS]
}, "Randomize the TMs given by NPCs"
),
EnumOption.new(_INTL("Shop items"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_SHOP_ITEMS] ? 0 : 1 },
proc { |value|
$game_switches[SWITCH_RANDOM_SHOP_ITEMS] = value == 0
}, "Randomizes the items available in shops (always mapped)"
),
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 RandomizerItemOptionsScene < PokemonOption_Scene
RANDOM_HELD_ITEMS = 843
def initialize
@changedColor = false
end
def pbStartScene(inloadscreen = false)
super
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
@changedColor = true
for i in 0...@PokemonOptions.length
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
@@ -358,33 +463,6 @@ class RandomizerItemOptionsScene < PokemonOption_Scene
def pbGetOptions(inloadscreen = false)
options = [
# EnumOption.new(_INTL("Type"), [_INTL("Mapped"), _INTL("Dynamic")],
# proc {
# if $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC]
# 1
# else
# 0
# end
# },
# proc { |value|
# if value == 0
# $game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = true
# $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC] = false
# else
# value == 1
# $game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = false
# $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC] = true
# end
# },
# [
# "Random items are decided at the start of the game",
# "Random items are decided as you obtain them"],
# proc { $game_switches[SWITCH_RANDOM_ITEMS_FULL] ? 0 : 1 },
# proc { |value|
# $game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = value == 0
# $game_switches[SWITCH_RANDOM_ITEMS_FULL] = value == 1
# }, ["Random items are decided at the start of the game", "Random items are decided as you obtain them"]
#),
EnumOption.new(_INTL("Found items"), [_INTL("On"), _INTL("Off")],
proc { $game_switches[SWITCH_RANDOM_FOUND_ITEMS] ? 0 : 1 },
proc { |value|

View File

@@ -33,14 +33,15 @@ def Kernel.randomizeWildPokemonByRoute()
end
#input: [[60, :TENTACOOL,5,40, [30, :GOLDEEN, 5, 35], etc.]]
def randomizePokemonList(encountersList,bstRange=50,maxSpecies=420,customOnly=false,customsList=[])
def randomizePokemonList(encountersList,bstRange=50,maxSpecies=NB_POKEMON,customOnly=false,customsList=[])
includeLegendaries = $game_switches[SWITCH_RANDOM_WILD_LEGENDARIES]
newList=[]
for encounter in encountersList
oldPokemon = encounter[1]
if customOnly
newPokemon = getNewCustomSpecies(oldPokemon,customsList,bstRange,false)
newPokemon = getNewCustomSpecies(oldPokemon,customsList,bstRange,false,includeLegendaries)
else
newPokemon = getNewSpecies(oldPokemon,bstRange,false,maxSpecies)
newPokemon = getNewSpecies(oldPokemon,bstRange,false,maxSpecies,includeLegendaries)
end
newEntry =[]
newEntry << encounter[0]

View File

@@ -64,7 +64,7 @@ class PokeBattle_Battle
for pokemon in party
next if !pokemon
newspecies = rand(PBSpecies.maxValue - 1) + 1
while !gymLeaderOk(newspecies) || bstOk(newspecies, pokemon.species, $game_variables[VAR_RANDOMIZER_WILD_POKE_BST])
while !gymLeaderOk(newspecies) || bstNotOk(newspecies, pokemon.species, $game_variables[VAR_RANDOMIZER_WILD_POKE_BST])
newspecies = rand(PBSpecies.maxValue - 1) + 1
end
pokemon.species = newspecies
@@ -120,7 +120,18 @@ end
# end
#
def bstOk(newspecies, oldPokemonSpecies, bst_range = 50)
def legendaryOk(oldspecies,newspecies,includeLegendaries)
oldSpeciesIsLegendary = is_legendary(oldspecies)
if oldSpeciesIsLegendary #legendaries always randomize to legendaries
return is_legendary(newspecies)
else
return true if includeLegendaries
return !is_legendary(newspecies)
end
end
def bstNotOk(newspecies, oldPokemonSpecies, bst_range = 50)
newBST = calcBaseStatsSum(newspecies)
originalBST = calcBaseStatsSum(oldPokemonSpecies)
return newBST < originalBST - bst_range || newBST > originalBST + bst_range
@@ -259,13 +270,13 @@ def Kernel.pbRandomizeTM()
end
end
def getNewSpecies(oldSpecies, bst_range = 50, ignoreRivalPlaceholder = false, maxDexNumber = PBSpecies.maxValue)
def getNewSpecies(oldSpecies, bst_range = 50, ignoreRivalPlaceholder = false, maxDexNumber = PBSpecies.maxValue, includeLegendaries=true)
oldSpecies_dex = dexNum(oldSpecies)
return oldSpecies_dex if (oldSpecies_dex == Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES && !ignoreRivalPlaceholder)
return oldSpecies_dex if oldSpecies_dex >= Settings::ZAPMOLCUNO_NB
newspecies_dex = rand(maxDexNumber - 1) + 1
i = 0
while bstOk(newspecies_dex, oldSpecies_dex, bst_range)
while bstNotOk(newspecies_dex, oldSpecies_dex, bst_range) || !(legendaryOk(oldSpecies_dex,newspecies_dex,includeLegendaries))
newspecies_dex = rand(maxDexNumber - 1) + 1
i += 1
if i % 10 == 0
@@ -275,14 +286,15 @@ def getNewSpecies(oldSpecies, bst_range = 50, ignoreRivalPlaceholder = false, ma
return newspecies_dex
end
def getNewCustomSpecies(oldSpecies, customSpeciesList, bst_range = 50, ignoreRivalPlaceholder = false)
def getNewCustomSpecies(oldSpecies, customSpeciesList, bst_range = 50, ignoreRivalPlaceholder = false,includeLegendaries=true)
oldSpecies_dex = dexNum(oldSpecies)
return oldSpecies_dex if (oldSpecies_dex == Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES && !ignoreRivalPlaceholder)
return oldSpecies_dex if oldSpecies_dex >= Settings::ZAPMOLCUNO_NB
i = rand(customSpeciesList.length - 1) + 1
n = 0
newspecies_dex = customSpeciesList[i]
while bstOk(newspecies_dex, oldSpecies_dex, bst_range)
while bstNotOk(newspecies_dex, oldSpecies_dex, bst_range) || !(legendaryOk(oldSpecies_dex,newspecies_dex,includeLegendaries))
i = rand(customSpeciesList.length - 1) #+1
newspecies_dex = customSpeciesList[i]
n += 1

View File

@@ -1,3 +1,10 @@
LEGENDARIES_LIST = [:ARTICUNO, :ZAPDOS, :MOLTRES, :MEWTWO, :MEW,
:ENTEI, :RAIKOU, :SUICUNE, :HOOH, :LUGIA, :CELEBI,
:GROUDON, :KYOGRE, :RAYQUAZA, :DEOXYS, :JIRACHI, :LATIAS, :LATIOS,
:REGIGIGAS, :DIALGA, :PALKIA, :GIRATINA, :DARKRAI, :CRESSELIA, :ARCEUS,
:GENESECT, :RESHIRAM, :ZEKROM, :KYUREM, :MELOETTA,
:NECROZMA]
class PokemonGlobalMetadata
attr_accessor :psuedoHash
attr_accessor :psuedoBSTHash
@@ -6,7 +13,6 @@ class PokemonGlobalMetadata
attr_accessor :randomItemsHash
attr_accessor :randomTMsHash
alias random_init initialize
def initialize
@@ -21,7 +27,7 @@ class PokemonGlobalMetadata
end
#pense pas que c'est utilisé mais bon...
def get_pokemon_list(include_fusions=false)
def get_pokemon_list(include_fusions = false)
#Create array of all pokemon dex numbers
pokeArray = []
@@ -33,8 +39,7 @@ def get_pokemon_list(include_fusions=false)
return pokeArray
end
def get_randomized_bst_hash(poke_list, bst_range,show_progress=true)
def get_randomized_bst_hash(poke_list, bst_range, show_progress = true)
bst_hash = Hash.new
for i in 1..NB_POKEMON - 1
show_shuffle_progress(i) if show_progress
@@ -43,20 +48,45 @@ def get_randomized_bst_hash(poke_list, bst_range,show_progress=true)
targetStats_max = statsTotal + bst_range
targetStats_min = statsTotal - bst_range
max_bst_allowed=targetStats_max
min_bst_allowed=targetStats_min
max_bst_allowed = targetStats_max
min_bst_allowed = targetStats_min
#if a match, add to hash, remove from array, and cycle to next poke in dex
#only randomize legendaries to legendaries if Allow Legendaries not enabled
#
#
# if !$game_switches[SWITCH_RANDOM_WILD_LEGENDARIES]
# current_species = GameData::Species.get(i).id
# random_poke_species = GameData::Species.get(random_poke).id
# next if !legendaryOk(current_species,random_poke_species,$game_switches[SWITCH_RANDOM_WILD_LEGENDARIES])
#
# if !is_legendary(current_species)
# next if is_legendary(random_poke_species,true)
# else
# next if !is_legendary(random_poke_species,true)
# end
# end
playShuffleSE(i)
random_poke = poke_list.sample
random_poke_bst=getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
j=0
while(random_poke_bst <= min_bst_allowed || random_poke_bst >= max_bst_allowed)
random_poke_bst = getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
j = 0
includeLegendaries = $game_switches[SWITCH_RANDOM_WILD_LEGENDARIES]
current_species = GameData::Species.get(i).id
random_poke_species = GameData::Species.get(random_poke).id
while (random_poke_bst <= min_bst_allowed || random_poke_bst >= max_bst_allowed) || !legendaryOk(current_species,random_poke_species,includeLegendaries)
random_poke = poke_list.sample
random_poke_bst=getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
j+=1
if j % 5 ==0 #to avoid infinite loops if can't find anything
min_bst_allowed-=1
max_bst_allowed+=1
random_poke_species = GameData::Species.get(random_poke).id
#todo: right now, the main function uses dex numbers, but the legendaryOK check needs the ids.
# This can be a hit on performance to recalculate the ids from the dex numbers.
# The function should be optimized to just use the ids everywhere
random_poke_bst = getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
j += 1
if j % 5 == 0 #to avoid infinite loops if can't find anything
min_bst_allowed -= 1
max_bst_allowed += 1
end
end
bst_hash[i] = random_poke
@@ -64,13 +94,22 @@ def get_randomized_bst_hash(poke_list, bst_range,show_progress=true)
return bst_hash
end
def is_legendary(dex_num,printInfo=false)
pokemon_id = getPokemon(dex_num).id
is_legendary = is_fusion_of_any(pokemon_id,LEGENDARIES_LIST)
#echoln "#{pokemon_id} is legendary? : #{is_legendary}"
#echoln _INTL("{1} ({2}) {3}",dex_num,pokemon_id,is_legendary) if printInfo
return is_legendary
end
def show_shuffle_progress(i)
if i % 2 == 0
n = (i.to_f/NB_POKEMON)*100
Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^",sprintf('%.2f', n),NB_POKEMON))
n = (i.to_f / NB_POKEMON) * 100
Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^", sprintf('%.2f', n), NB_POKEMON))
end
end
##############
# randomizer shuffle
# ##############
@@ -84,10 +123,10 @@ def Kernel.pbShuffleDex(range = 50, type = 0)
only_customs = $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && should_include_fusions
# create hash
pokemon_list = only_customs ? getCustomSpeciesList(true) : get_pokemon_list(should_include_fusions)
if !pokemon_list #when not enough custom sprites
if !pokemon_list #when not enough custom sprites
pokemon_list = get_pokemon_list(should_include_fusions)
end
$PokemonGlobal.psuedoBSTHash = get_randomized_bst_hash(pokemon_list,range,should_include_fusions)
$PokemonGlobal.psuedoBSTHash = get_randomized_bst_hash(pokemon_list, range, should_include_fusions)
end
def itemCanBeRandomized(item)
@@ -102,7 +141,7 @@ def pbShuffleItems()
randomItemsHash = Hash.new
available_items = []
for itemElement in GameData::Item.list_all
item=itemElement[1]
item = itemElement[1]
if itemCanBeRandomized(item)
if !available_items.include?(item.id)
available_items << item.id
@@ -120,12 +159,11 @@ def pbShuffleItems()
$PokemonGlobal.randomItemsHash = randomItemsHash
end
def pbShuffleTMs()
randomItemsHash = Hash.new
available_items = []
for itemElement in GameData::Item.list_all
item=itemElement[1]
item = itemElement[1]
if item.is_TM?
if !available_items.include?(item.id)
available_items << item.id
@@ -143,7 +181,6 @@ def pbShuffleTMs()
$PokemonGlobal.randomTMsHash = randomItemsHash
end
#
# # ######
# # #on remet arceus a la fin
@@ -229,7 +266,7 @@ end
# Here is a cheap workaround lol
def getBaseStatsFormattedForRandomizer(dex_num)
statsArray = []
stats = GameData::Species.get(dex_num).base_stats
stats = GameData::Species.get(dex_num).base_stats
statsArray << stats[:HP]
statsArray << stats[:ATTACK]
statsArray << stats[:DEFENSE]
@@ -308,4 +345,22 @@ def tryRandomizeGiftPokemon(pokemon, dontRandomize = false)
pokemon.species = getSpecies($PokemonGlobal.psuedoBSTHash[oldSpecies])
end
end
end
def obtainRandomizedStarter(starterIndex)
case starterIndex
when 0
dexNumber =1
when 1
dexNumber = 4
else
dexNumber = 7
end
random_starter = $PokemonGlobal.psuedoBSTHash[dexNumber]
if $game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE]
species = GameData::Species.get(random_starter)
random_starter = GameData::Species.get(species.get_baby_species(false)).id_number
end
return random_starter
end