mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Remove Scripts folder to convert to submodule
This commit is contained in:
@@ -1,198 +0,0 @@
|
||||
################################################################################
|
||||
# Randomized Pokemon Script
|
||||
# By Umbreon
|
||||
################################################################################
|
||||
# Used for a randomized pokemon challenge mainly.
|
||||
#
|
||||
# By randomized, I mean EVERY pokemon will be random, even interacted pokemon
|
||||
# like legendaries. (You may easily disable the randomizer for certain
|
||||
# situations like legendary battles and starter selecting.)
|
||||
#
|
||||
# To use: simply activate Switch Number X
|
||||
# (X = the number listed After "Switch = ", default is switch number 36.)
|
||||
#
|
||||
# If you want certain pokemon to NEVER appear, add them inside the black list.
|
||||
# (This does not take into effect if the switch stated above is off.)
|
||||
#
|
||||
# If you want ONLY certain pokemon to appear, add them to the whitelist. This
|
||||
# is only recommended when the amount of random pokemon available is around
|
||||
# 32 or less.(This does not take into effect if the switch stated above is off.)
|
||||
#
|
||||
################################################################################
|
||||
|
||||
########################## You may edit any settings below this freely.
|
||||
# module RandomizedChallenge
|
||||
# Switch = 36 # switch ID to randomize a pokemon, if it's on then ALL
|
||||
# # pokemon will be randomized. No exceptions.
|
||||
#
|
||||
# BlackListedPokemon = [] #[PBSpecies::MEW, PBSpecies::ARCEUS]
|
||||
# # Pokemon to Black List. Any pokemon in here will NEVER appear.
|
||||
#
|
||||
# WhiteListedPokemon = []
|
||||
# # Leave this empty if all pokemon are allowed, otherwise only pokemon listed
|
||||
# # above will be selected.
|
||||
# end
|
||||
#
|
||||
# ######################### Do not edit anything below here.
|
||||
# class PokeBattle_Pokemon
|
||||
#
|
||||
# alias randomized_init initialize
|
||||
#
|
||||
# def initialize(species, level, player = nil, withMoves = true)
|
||||
#
|
||||
# if $game_switches && $game_switches[RandomizedChallenge::Switch]
|
||||
# if $game_switches[991]
|
||||
# species = rand(PBSpecies.maxValue - 1) + 1
|
||||
# basestatsum = $pkmn_dex[species][5][0] # HP
|
||||
# basestatsum += $pkmn_dex[species][5][1] # Attack
|
||||
# basestatsum += $pkmn_dex[species][5][2] # Defense
|
||||
# basestatsum += $pkmn_dex[species][5][3] # Speed
|
||||
# basestatsum += $pkmn_dex[species][5][4] # Special Attack
|
||||
# basestatsum += $pkmn_dex[species][5][5] # Special Defense
|
||||
#
|
||||
# while basestatsum > $game_variables[53] || basestatsum < $game_variables[87]
|
||||
# species = rand(PBSpecies.maxValue - 1) + 1
|
||||
# basestatsum = $pkmn_dex[species][5][0] # HP
|
||||
# basestatsum += $pkmn_dex[species][5][1] # Attack
|
||||
# basestatsum += $pkmn_dex[species][5][2] # Defense
|
||||
# basestatsum += $pkmn_dex[species][5][3] # Speed
|
||||
# basestatsum += $pkmn_dex[species][5][4] # Special Attack
|
||||
# basestatsum += $pkmn_dex[species][5][5] # Special Defense
|
||||
# end
|
||||
# #Kernel.pbMessage(_INTL("total = {1}, {2}",basestatsum, PBSpecies.getName(species)))
|
||||
# else
|
||||
# if $game_switches[841]
|
||||
# species = getRandomCustomSprite()
|
||||
# else
|
||||
# species = rand(PBSpecies.maxValue - 1) + 1
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# randomized_init(species, level, player, withMoves)
|
||||
# end
|
||||
# end
|
||||
#
|
||||
#
|
||||
# def getRandomCustomSprite()
|
||||
# filesList = Dir["./Graphics/CustomBattlers/*"]
|
||||
# i = rand(filesList.length - 1)
|
||||
# path = filesList[i]
|
||||
# file = File.basename(path, ".*")
|
||||
# splitPoke = file.split(".")
|
||||
# head = splitPoke[0].to_i
|
||||
# body = splitPoke[1].to_i
|
||||
# return (body * NB_POKEMON) + head
|
||||
# end
|
||||
|
||||
=begin
|
||||
|
||||
##########################
|
||||
# Trainer house shit
|
||||
#########################
|
||||
#Battleformat : 0 = single
|
||||
# 1 = double
|
||||
def Kernel.pbTrainerHouse(bstMin,bstMax,level,battleformat)
|
||||
return false if !validateLevel()
|
||||
#activate random Pokemon
|
||||
$game_switches[991] = true
|
||||
|
||||
#Set game variables
|
||||
$game_variables[87]=bstMin
|
||||
$game_variabes[53]=bstMax
|
||||
|
||||
#initialize variables
|
||||
trainerHouse=true
|
||||
currentStreak=0
|
||||
backupTeamLevels()
|
||||
doubleBattle = battleformat == 1 ? true : false
|
||||
|
||||
|
||||
while trainerHouse
|
||||
currentStreak += 1
|
||||
TrainerHouseVictory(currentStreak) if TrainerHouseBattle(level)
|
||||
end
|
||||
end
|
||||
|
||||
def backupTeamLevels()
|
||||
$game_variables[91] = $Trainer.pokemonParty[0].level
|
||||
$game_variables[92] = $Trainer.pokemonParty[1].level
|
||||
$game_variables[93] = $Trainer.pokemonParty[2].level
|
||||
end
|
||||
|
||||
#choisir le trainer a combattre en fonction du level
|
||||
def TrainerHouseBattle(level,battleformat)
|
||||
victoryMessage = getVictoryMessage()
|
||||
getTrainerHouseBattle(rand(1),level,battleformat)
|
||||
return
|
||||
end
|
||||
|
||||
#initialiser background & musique pour le combat
|
||||
def setBattleConstants()
|
||||
$PokemonGlobal.nextBattleBGM="SubwayTrainerBattle"
|
||||
$PokemonGlobal.nextBattleBack="IndoorC"
|
||||
end
|
||||
|
||||
#Ajouter les TP après un victoire
|
||||
def TrainerHouseVictory(currentStreak)
|
||||
tp_won = currentStreak + 1
|
||||
$game_variables[49] = tp_won
|
||||
end
|
||||
|
||||
#Valider si le niveau est un challenge possible
|
||||
def validateLevel(level)
|
||||
validLevels=[25,50,100]
|
||||
return validLevels.include?(level)
|
||||
end
|
||||
|
||||
def getVictoryMessage()
|
||||
return "You're good!"
|
||||
end
|
||||
|
||||
def getTrainerHouseBattle(IsMale,level,single=true)
|
||||
victoryMessage = getVictoryMessage()
|
||||
|
||||
LV25MALE_SINGLE = pbTrainerBattle(PBTrainers::COOLTRAINER_M2,"Matthew",_I(victoryMessage),false,0,true)
|
||||
LV25FEMALE_SINGLE = pbTrainerBattle(PBTrainers::COOLTRAINER_F2,"Jessica",_I(victoryMessage),false,0,true)
|
||||
LV25MALE_DOUBLE = pbTrainerBattle(PBTrainers::COOLTRAINER_M2,"Alex",_I(victoryMessage),false,0,true)
|
||||
LV25FEMALE_DOUBLE = pbTrainerBattle(PBTrainers::COOLTRAINER_F2,"Laurie",_I(victoryMessage),false,0,true)
|
||||
|
||||
LV50MALE_SINGLE = pbTrainerBattle(PBTrainers::COOLTRAINER_M2,"Alberto",_I(victoryMessage),false,0,true)
|
||||
LV50FEMALE_SINGLE = pbTrainerBattle(PBTrainers::COOLTRAINER_F2,"Skyler",_I(victoryMessage),true,0,true)
|
||||
LV50MALE_DOUBLE = pbTrainerBattle(PBTrainers::COOLTRAINER_M2,"Patrick",_I(victoryMessage),false,0,true)
|
||||
LV50FEMALE_DOUBLE = pbTrainerBattle(PBTrainers::COOLTRAINER_F2,"Heather",_I(victoryMessage),true,0,true)
|
||||
|
||||
LV100MALE_SINGLE = pbTrainerBattle(PBTrainers::COOLTRAINER_M2,"Joe",_I(victoryMessage),false,0,true)
|
||||
LV100FEMALE_SINGLE = pbTrainerBattle(PBTrainers::COOLTRAINER_F2,"Melissa",_I(victoryMessage),true,0,true)
|
||||
LV100MALE_DOUBLE = pbTrainerBattle(PBTrainers::COOLTRAINER_M2,"Stephen",_I(victoryMessage),false,0,true)
|
||||
LV100FEMALE_DOUBLE = pbTrainerBattle(PBTrainers::COOLTRAINER_F2,"Kim",_I(victoryMessage),true,0,true)
|
||||
|
||||
|
||||
|
||||
if single #SINGLE
|
||||
if level == 25
|
||||
return LV25MALE_SINGLE if IsMale == 1
|
||||
return LV25FEMALE_SINGLE
|
||||
elsif level == 50
|
||||
return LV50MALE_SINGLE if IsMale == 1
|
||||
return LV50FEMALE_SINGLE
|
||||
else
|
||||
return LV100MALE_SINGLE if IsMale == 1
|
||||
return LV100FEMALE_SINGLE
|
||||
end
|
||||
else #DOUBLE
|
||||
if level == 25
|
||||
return LV25MALE_DOUBLE if IsMale == 1
|
||||
return LV25FEMALE_DOUBLE
|
||||
elsif level == 50
|
||||
return LV50MALE_DOUBLE if IsMale == 1
|
||||
return LV50FEMALE_DOUBLE
|
||||
else
|
||||
return LV100MALE_DOUBLE if IsMale == 1
|
||||
return LV100FEMALE_DOUBLE
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
=end
|
||||
@@ -1,535 +0,0 @@
|
||||
module OptionTypes
|
||||
WILD_POKE = 0
|
||||
TRAINER_POKE = 1
|
||||
end
|
||||
|
||||
class RandomizerOptionsScene < PokemonOption_Scene
|
||||
def initialize
|
||||
super
|
||||
@openTrainerOptions = false
|
||||
@openWildOptions = false
|
||||
@openGymOptions = false
|
||||
@openItemOptions = false
|
||||
$game_switches[SWITCH_RANDOMIZED_AT_LEAST_ONCE] = true
|
||||
end
|
||||
|
||||
def getDefaultDescription
|
||||
return _INTL("Set the randomizer settings")
|
||||
end
|
||||
|
||||
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
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = [
|
||||
EnumOption.new(_INTL("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 Pokémon"
|
||||
),
|
||||
EnumOption.new(_INTL("NPC 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 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("Items"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_ITEMS_GENERAL] ? 0 : 1 },
|
||||
proc { |value|
|
||||
if !$game_switches[SWITCH_RANDOM_ITEMS_GENERAL] && value == 0
|
||||
@openItemOptions = true
|
||||
openItemOptionsMenu()
|
||||
end
|
||||
$game_switches[SWITCH_RANDOM_ITEMS_GENERAL] = value == 0
|
||||
}, "Select the randomizer options for items"
|
||||
),
|
||||
|
||||
]
|
||||
return options
|
||||
end
|
||||
|
||||
def openGymOptionsMenu()
|
||||
return if !@openGymOptions
|
||||
pbFadeOutIn {
|
||||
scene = RandomizerGymOptionsScene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
}
|
||||
@openGymOptions = false
|
||||
end
|
||||
|
||||
def openItemOptionsMenu()
|
||||
return if !@openItemOptions
|
||||
pbFadeOutIn {
|
||||
scene = RandomizerItemOptionsScene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
}
|
||||
@openItemOptions = false
|
||||
end
|
||||
|
||||
def openTrainerOptionsMenu()
|
||||
return if !@openTrainerOptions
|
||||
pbFadeOutIn {
|
||||
scene = RandomizerTrainerOptionsScene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
}
|
||||
@openTrainerOptions = false
|
||||
end
|
||||
|
||||
def openWildPokemonOptionsMenu()
|
||||
return if !@openWildOptions
|
||||
pbFadeOutIn {
|
||||
scene = RandomizerWildPokemonOptionsScene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
}
|
||||
@openWildOptions = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class RandomizerTrainerOptionsScene < PokemonOption_Scene
|
||||
RANDOM_TEAMS_CUSTOM_SPRITES = 600
|
||||
RANDOM_GYM_TYPES = 921
|
||||
|
||||
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)
|
||||
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")
|
||||
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbFadeInAndShow(sprites, visiblesprites = nil)
|
||||
return if !@changedColor
|
||||
super
|
||||
end
|
||||
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = []
|
||||
if !$game_switches[SWITCH_DURING_INTRO]
|
||||
options << SliderOption.new(_INTL("Randomness degree"), 25, 500, 5,
|
||||
proc { $game_variables[VAR_RANDOMIZER_TRAINER_BST] },
|
||||
proc { |value|
|
||||
$game_variables[VAR_RANDOMIZER_TRAINER_BST] = value
|
||||
})
|
||||
end
|
||||
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"
|
||||
)
|
||||
|
||||
# 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
|
||||
|
||||
class RandomizerWildPokemonOptionsScene < PokemonOption_Scene
|
||||
RANDOM_WILD_AREA = 777
|
||||
RANDOM_WILD_GLOBAL = 956
|
||||
RANDOM_STATIC = 955
|
||||
REGULAR_TO_FUSIONS = 953
|
||||
GIFT_POKEMON = 780
|
||||
|
||||
def initialize
|
||||
@changedColor = false
|
||||
end
|
||||
|
||||
def pbStartScene(inloadscreen = false)
|
||||
super
|
||||
@sprites["option"].nameBaseColor = Color.new(70, 170, 40)
|
||||
@sprites["option"].nameShadowColor = Color.new(40, 100, 20)
|
||||
@changedColor = true
|
||||
for i in 0...@PokemonOptions.length
|
||||
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
|
||||
end
|
||||
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
|
||||
_INTL("Randomizer settings: Pokémon"), 0, 0, Graphics.width, 64, @viewport)
|
||||
@sprites["textbox"].text = _INTL("Set the randomizer settings for wild Pokémon")
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbFadeInAndShow(sprites, visiblesprites = nil)
|
||||
return if !@changedColor
|
||||
super
|
||||
end
|
||||
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = []
|
||||
if !$game_switches[SWITCH_DURING_INTRO]
|
||||
options << SliderOption.new(_INTL("Randomness degree"), 25, 500, 5,
|
||||
proc { $game_variables[VAR_RANDOMIZER_WILD_POKE_BST] },
|
||||
proc { |value|
|
||||
$game_variables[VAR_RANDOMIZER_WILD_POKE_BST] = value
|
||||
})
|
||||
end
|
||||
|
||||
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
|
||||
},
|
||||
[
|
||||
"Randomizes Pokémon using a one-to-one mapping of the Pokedex",
|
||||
"Randomizes the encounters in each route individually"
|
||||
]
|
||||
)
|
||||
options << 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
|
||||
}, "['Fuse everything' & starters] Include only Pokémon with a custom sprite."
|
||||
)
|
||||
|
||||
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_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 {
|
||||
getStarterRandomizerSelectedOption() },
|
||||
proc { |value|
|
||||
case value
|
||||
when 0
|
||||
$game_switches[SWITCH_RANDOM_STARTERS] = true
|
||||
$game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE] = true
|
||||
when 1
|
||||
$game_switches[SWITCH_RANDOM_STARTERS] = true
|
||||
$game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE] = false
|
||||
else
|
||||
$game_switches[SWITCH_RANDOM_STARTERS] = false
|
||||
$game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE] = false
|
||||
end
|
||||
|
||||
echoln "random starters: #{$game_switches[SWITCH_RANDOM_STARTERS]}"
|
||||
echoln "random 1st stage: #{$game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE]}"
|
||||
|
||||
}, ["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 },
|
||||
proc { |value|
|
||||
$game_switches[RANDOM_STATIC] = value == 0
|
||||
},
|
||||
"Randomize Pokémon that appear in the overworld (including legendaries)"
|
||||
)
|
||||
|
||||
options << 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"
|
||||
)
|
||||
|
||||
options << 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
|
||||
}, "All wild Pokémon will already be pre-fused"
|
||||
)
|
||||
return options
|
||||
end
|
||||
|
||||
|
||||
def getStarterRandomizerSelectedOption()
|
||||
return 0 if $game_switches[SWITCH_RANDOM_STARTERS] && $game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE]
|
||||
return 1 if $game_switches[SWITCH_RANDOM_STARTERS]
|
||||
return 2
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class RandomizerGymOptionsScene < PokemonOption_Scene
|
||||
RANDOM_GYM_TYPES = 921
|
||||
|
||||
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)
|
||||
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")
|
||||
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbFadeInAndShow(sprites, visiblesprites = nil)
|
||||
return if !@changedColor
|
||||
super
|
||||
end
|
||||
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = []
|
||||
if !$game_switches[SWITCH_DURING_INTRO]
|
||||
options << SliderOption.new(_INTL("Randomness degree"), 25, 500, 5,
|
||||
proc { $game_variables[VAR_RANDOMIZER_TRAINER_BST] },
|
||||
proc { |value|
|
||||
$game_variables[VAR_RANDOMIZER_TRAINER_BST] = value
|
||||
})
|
||||
end
|
||||
options << EnumOption.new(_INTL("Custom sprites only"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_GYM_CUSTOMS] = value == 0
|
||||
}, ["Use only Pokémon that have custom sprites in gym trainers or gym leader teams",
|
||||
"Pick any possible fusion, including auto-generated sprites."]
|
||||
)
|
||||
options << EnumOption.new(_INTL("Gym types"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[RANDOM_GYM_TYPES] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$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|
|
||||
$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"
|
||||
)
|
||||
|
||||
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)
|
||||
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)
|
||||
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
|
||||
@@ -1,126 +0,0 @@
|
||||
NON_RANDOMIZE_ITEMS = [:CELLBATTERY, :MAGNETSTONE, :TM94, :DYNAMITE]
|
||||
HELD_ITEMS = [:AIRBALLOON, :BRIGHTPOWDER, :EVIOLITE, :FLOATSTONE, :DESTINYKNOT, :ROCKYHELMET, :EJECTBUTTON, :REDCARD,
|
||||
:SHEDSHELL, :SMOKEBALL, :CHOICEBAND, :CHOICESPECS, :CHOICESCARF, :HEATROCK, :DAMPROCK, :SMOOTHROCK, :ICYROCK,
|
||||
:LIGHTCLAY, :GRIPCLAW, :BINDINGBAND, :BIGROOT, :BLACKSLUDGE, :LEFTOVERS, :SHELLBELL, :MENTALHERB, :WHITEHERB,
|
||||
:POWERHERB, :ABSORBBULB, :CELLBATTERY, :LIFEORB, :EXPERTBELT, :METRONOME, :MUSCLEBAND, :WISEGLASSES,
|
||||
:RAZORCLAW, :SCOPELENS, :WIDELENS, :ZOOMLENS, :KINGSROCK, :RAZORFANG, :LAGGINGTAIL, :QUICKCLAW,
|
||||
:FOCUSBAND, :FOCUSSASH, :FLAMEORB, :TOXICORB, :STICKYBARB, :IRONBALL, :RINGTARGET,
|
||||
:MACHOBRACE, :POWERWEIGHT, :POWERBRACER, :POWERBELT, :POWERLENS, :POWERBAND, :POWERANKLET,
|
||||
:LAXINCENSE, :FULLINCENSE, :LUCKINCENSE, :PUREINCENSE, :SEAINCENSE, :WAVEINCENSE, :ROSEINCENSE,
|
||||
:ODDINCENSE, :ROCKINCENSE, :CHARCOAL, :MYSTICWATER, :MAGNET, :HARDSTONE, :SILVERPOWDER,
|
||||
:TWISTEDSPOON, :SHARPBEAK, :POISONBARB, :BLACKBELT, :NEVERMELTICE, :MIRACLESEED, :SILKSCARF,
|
||||
:METALCOAT, :BLACKGLASSES, :DRAGONFANG, :SPELLTAG, :FIREGEM, :WATERGEM, :ELECTRICGEM,
|
||||
:GRASSGEM, :ICEGEM, :FIGHTINGGEM, :POISONGEM, :GROUNDGEM, :FLYINGGEM, :PSYCHICGEM,
|
||||
:BUGGEM, :ROCKGEM, :GHOSTGEM, :DRAGONGEM, :DARKGEM, :STEELGEM, :NORMALGEM,
|
||||
:CHERIBERRY, :CHESTOBERRY, :PECHABERRY, :RAWSTBERRY, :ASPEARBERRY, :LEPPABERRY, :ORANBERRY,
|
||||
:PERSIMBERRY, :LUMBERRY, :SITRUSBERRY, :FIGYBERRY, :WIKIBERRY, :MAGOBERRY, :AGUAVBERRY,
|
||||
:IAPAPABERRY, :OCCABERRY, :PASSHOBERRY, :WACANBERRY, :RINDOBERRY, :YACHEBERRY, :CHOPLEBERRY,
|
||||
:KEBIABERRY, :SHUCABERRY, :COBABERRY, :PAYAPABERRY, :TANGABERRY, :CHARTIBERRY, :KASIBBERRY,
|
||||
:HABANBERRY, :COLBURBERRY, :BABIRIBERRY, :CHILANBERRY, :LIECHIBERRY, :GANLONBERRY, :SALACBERRY,
|
||||
:PETAYABERRY, :APICOTBERRY, :LANSATBERRY, :STARFBERRY, :ENIGMABERRY, :MICLEBERRY, :CUSTAPBERRY,
|
||||
:JABOCABERRY, :ROWAPBERRY, :FAIRYGEM]
|
||||
|
||||
INVALID_ITEMS = [:COVERFOSSIL, :PLUMEFOSSIL, :ACCURACYUP, :DAMAGEUP, :ANCIENTSTONE, :ODDKEYSTONE_FULL,
|
||||
:DEVOLUTIONSPRAY, :INVISIBALL]
|
||||
RANDOM_ITEM_EXCEPTIONS = [:DNASPLICERS,:POKEBALL, :DYNAMITE, :PINKANBERRY]
|
||||
|
||||
def getRandomGivenTM(item)
|
||||
return item if item == nil
|
||||
return item if RANDOM_TM_EXCEPTIONS.include?(item.id)
|
||||
if $game_switches[SWITCH_RANDOM_ITEMS_MAPPED]
|
||||
newItem = $PokemonGlobal.randomTMsHash[item.id]
|
||||
return GameData::Item.get(newItem) if newItem != nil
|
||||
end
|
||||
# if $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC]
|
||||
# return pbGetRandomTM
|
||||
# end
|
||||
return item
|
||||
end
|
||||
|
||||
def getMappedRandomItem(item)
|
||||
if (item.is_TM?)
|
||||
return item if NON_RANDOMIZE_ITEMS.include?(item.id)
|
||||
return item if !$game_switches[SWITCH_RANDOM_TMS]
|
||||
if $game_switches[SWITCH_RANDOM_TMS]
|
||||
newItem = $PokemonGlobal.randomTMsHash[item.id]
|
||||
return GameData::Item.get(newItem) if newItem != nil
|
||||
end
|
||||
return item
|
||||
else
|
||||
return item if !$game_switches[SWITCH_RANDOM_ITEMS]
|
||||
if $game_switches[SWITCH_RANDOM_ITEMS]
|
||||
newItem = $PokemonGlobal.randomItemsHash[item.id]
|
||||
return GameData::Item.get(newItem) if newItem != nil
|
||||
return item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def getDynamicRandomItem(item)
|
||||
return item
|
||||
# #keyItem ou HM -> on randomize pas
|
||||
# return item if item.is_key_item?
|
||||
# return item if item.is_HM?
|
||||
# return item if NON_RANDOMIZE_ITEMS.include?(item.id)
|
||||
#
|
||||
# #TM
|
||||
# if (item.is_TM?)
|
||||
# return $game_switches[SWITCH_RANDOM_TMS] ? pbGetRandomTM() : item
|
||||
# end
|
||||
# #item normal
|
||||
# return item if !$game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC] || !$game_switches[SWITCH_RANDOM_ITEMS]
|
||||
#
|
||||
#
|
||||
# #berries
|
||||
# return pbGetRandomBerry() if item.is_berry?
|
||||
#
|
||||
# items_list = GameData::Item.list_all
|
||||
# newItem_id = items_list.keys.sample
|
||||
# newItem = GameData::Item.get(newItem_id)
|
||||
# while (newItem.is_machine? || newItem.is_key_item? || INVALID_ITEMS.include?(newItem))
|
||||
# newItem_id = items_list.keys.sample
|
||||
# newItem = GameData::Item.get(newItem_id)
|
||||
# end
|
||||
# return newItem
|
||||
end
|
||||
|
||||
def pbGetRandomItem(item_id)
|
||||
return nil if item_id == nil
|
||||
item = GameData::Item.get(item_id)
|
||||
return item if !($game_switches[SWITCH_RANDOM_ITEMS] || $game_switches[SWITCH_RANDOM_TMS])
|
||||
if $game_switches[SWITCH_RANDOM_ITEMS_MAPPED]
|
||||
return getMappedRandomItem(item)
|
||||
# elsif $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC]
|
||||
# return getDynamicRandomItem(item)
|
||||
end
|
||||
return item
|
||||
end
|
||||
|
||||
def pbGetRandomHeldItem()
|
||||
newItem_id = HELD_ITEMS.sample
|
||||
newItem = GameData::Item.get(newItem_id)
|
||||
return newItem
|
||||
end
|
||||
|
||||
def pbGetRandomBerry()
|
||||
items_list = GameData::Item.list_all
|
||||
newItem_id = items_list.keys.sample
|
||||
newItem = GameData::Item.get(newItem_id)
|
||||
while (!newItem.is_berry?)
|
||||
newItem_id = items_list.keys.sample
|
||||
newItem = GameData::Item.get(newItem_id)
|
||||
end
|
||||
return newItem
|
||||
end
|
||||
|
||||
def pbGetRandomTM()
|
||||
items_list = GameData::Item.list_all
|
||||
newItem_id = items_list.keys.sample
|
||||
newItem = GameData::Item.get(newItem_id)
|
||||
while (!newItem.is_TM?)
|
||||
newItem_id = items_list.keys.sample
|
||||
newItem = GameData::Item.get(newItem_id)
|
||||
end
|
||||
return newItem
|
||||
end
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
##### by route
|
||||
#
|
||||
# Randomize encounter by routes
|
||||
# Script by Frogman
|
||||
#
|
||||
def Kernel.randomizeWildPokemonByRoute()
|
||||
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
|
||||
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,onlyCustoms,customsList)
|
||||
types_hash[key]= newType
|
||||
end
|
||||
encounters_hash[:types] = types_hash
|
||||
GameData::EncounterRandom.register(encounters_hash)
|
||||
end
|
||||
|
||||
# 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=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,includeLegendaries)
|
||||
else
|
||||
newPokemon = getNewSpecies(oldPokemon,bstRange,false,maxSpecies,includeLegendaries)
|
||||
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
|
||||
#
|
||||
# def setup(mapID)
|
||||
# @density=nil
|
||||
# @stepcount=0
|
||||
# @enctypes=[]
|
||||
# begin
|
||||
#
|
||||
# data=load_data(getEncountersFilePath())
|
||||
# if data.is_a?(Hash) && data[mapID]
|
||||
# @density=data[mapID][0]
|
||||
# @enctypes=data[mapID][1]
|
||||
# else
|
||||
# @density=nil
|
||||
# @enctypes=[]
|
||||
# end
|
||||
# rescue
|
||||
# @density=nil
|
||||
# @enctypes=[]
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def getEncountersFilePath()
|
||||
# if $game_switches[777] && $game_switches[778] #[777] = random-by-area [778] = wildpokerandom activated
|
||||
# return "Data/encounters_randomized.dat"
|
||||
# else
|
||||
# return "Data/encounters.dat"
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def pbMapEncounter(mapID,enctype)
|
||||
# if enctype<0 || enctype>EncounterTypes::EnctypeChances.length
|
||||
# raise ArgumentError.new(_INTL("Encounter type out of range"))
|
||||
# end
|
||||
# data=load_data(getEncountersFilePath())
|
||||
# if data.is_a?(Hash) && data[mapID]
|
||||
# enctypes=data[mapID][1]
|
||||
# else
|
||||
# return nil
|
||||
# end
|
||||
# return nil if enctypes[enctype]==nil
|
||||
# chances=EncounterTypes::EnctypeChances[enctype]
|
||||
# chancetotal=0
|
||||
# chances.each {|a| chancetotal+=a}
|
||||
# rnd=rand(chancetotal)
|
||||
# chosenpkmn=0
|
||||
# chance=0
|
||||
# for i in 0...chances.length
|
||||
# chance+=chances[i]
|
||||
# if rnd<chance
|
||||
# chosenpkmn=i
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
# encounter=enctypes[enctype][chosenpkmn]
|
||||
# level=encounter[1]+rand(1+encounter[2]-encounter[1])
|
||||
# return [encounter[0],level]
|
||||
# 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
|
||||
|
||||
|
||||
######################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,773 +0,0 @@
|
||||
#A l'entrée d'un gym: mettre $game_variables[113] = au numéro du gym
|
||||
#pewter = 0, ceruean = 1 etc.
|
||||
#Le remettre a -1 à la sortie du gym
|
||||
#Le mettre a -1 au début du jeu
|
||||
#
|
||||
#Aussi des trucs modifiés dans le dude qui donne les freshwater au début
|
||||
#Faudrait aussi s'assurer que il dise pas n'importe quoi en pas randomized
|
||||
#
|
||||
#Voir cerulean gym pour implantation
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#initialiser la RANDOM_TYPE_ARRAY au début du jeu en runnant Kernel.initRandomTypeArray(8)
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
##################################################################
|
||||
# TODO:
|
||||
#
|
||||
#
|
||||
#
|
||||
###
|
||||
###############################################################
|
||||
#
|
||||
|
||||
#GYM_TYPES_ARRAY = [0,5,11,13,12,3,14,10,4,1,0,6,2,16,7,15,1,8,15,1,7,16,18,17,7,16]
|
||||
GYM_TYPES_CLASSIC = [:NORMAL, :ROCK, :WATER, :ELECTRIC, :GRASS, :POISON, :PSYCHIC, :FIRE, :GROUND, :FIGHTING, :NORMAL, :BUG, :FLYING, :DRAGON, :GHOST, :ICE, :FIGHTING, :STEEL, :ICE, :FIGHTING, :GHOST, :DRAGON, :FAIRY, :DARK, :GHOST, :ROCK]
|
||||
GYM_TYPES_MODERN = [:NORMAL, :STEEL, :ICE, :FIGHTING, :BUG, :DARK, :FAIRY, :PSYCHIC, :NORMAL, :FIGHTING, :FAIRY, :GRASS, :BUG, :DRAGON, :FIRE, :GHOST, :GROUND, :ELECTRIC, :WATER, :ROCK, :POISON, :FLYING, :FAIRY, :DARK, :GHOST, :DRAGON]
|
||||
GYM_TYPES_ARRAY = ($game_switches && $game_switches[SWITCH_MODERN_MODE]) ? GYM_TYPES_MODERN : GYM_TYPES_CLASSIC
|
||||
|
||||
#$randomTrainersArray = []
|
||||
|
||||
#[fighting dojo est 9eme (1), 0 au debut pour pasavoir a faire -1]
|
||||
|
||||
def Kernel.initRandomTypeArray()
|
||||
typesArray = GYM_TYPES_ARRAY.shuffle #ne pas remettre 10 (QMARKS)
|
||||
$game_variables[VAR_GYM_TYPES_ARRAY] = $game_switches[SWITCH_RANDOMIZED_GYM_TYPES] ? typesArray : GYM_TYPES_ARRAY
|
||||
end
|
||||
|
||||
# def setRivalStarter(starter1, starter2, starter3, choice)
|
||||
# starters = [starter1, starter2, starter3]
|
||||
# starters.delete_at(choice)
|
||||
# if starters[0] > NB_POKEMON || starters[1] > NB_POKEMON
|
||||
# rivalStarter = starters[0]
|
||||
# else
|
||||
# rivalStarter = starters[0] * NB_POKEMON + starters[1]
|
||||
# end
|
||||
# pbSet(VAR_RIVAL_STARTER, rivalStarter)
|
||||
# $game_switches[SWITCH_DEFINED_RIVAL_STARTER] = true
|
||||
# end
|
||||
|
||||
def setRivalStarterSpecific(rivalStarter)
|
||||
pbSet(VAR_RIVAL_STARTER, rivalStarter)
|
||||
$game_switches[SWITCH_DEFINED_RIVAL_STARTER] = true
|
||||
end
|
||||
|
||||
class PokeBattle_Battle
|
||||
CONST_BST_RANGE = 25 #unused. $game_variables[197] a la place
|
||||
def randomize_opponent_party(party)
|
||||
for pokemon in party
|
||||
next if !pokemon
|
||||
newspecies = rand(PBSpecies.maxValue - 1) + 1
|
||||
while !gymLeaderOk(newspecies) || bstNotOk(newspecies, pokemon.species, $game_variables[VAR_RANDOMIZER_WILD_POKE_BST])
|
||||
newspecies = rand(PBSpecies.maxValue - 1) + 1
|
||||
end
|
||||
pokemon.species = newspecies
|
||||
pokemon.name = PBSpecies.getName(newspecies)
|
||||
pokemon.resetMoves
|
||||
pokemon.calcStats
|
||||
end
|
||||
|
||||
return party
|
||||
end
|
||||
|
||||
def randomizedRivalFirstBattle(party)
|
||||
return party if $game_switches[953] #full random
|
||||
starter1 = $PokemonGlobal.psuedoBSTHash[1]
|
||||
starter2 = $PokemonGlobal.psuedoBSTHash[4]
|
||||
starter3 = $PokemonGlobal.psuedoBSTHash[7]
|
||||
playerChoice = $game_variables[7]
|
||||
|
||||
for m in party
|
||||
next if !m
|
||||
case playerChoice
|
||||
when 0 then
|
||||
newspecies = starter2 * NB_POKEMON + starter3
|
||||
when 1 then
|
||||
newspecies = starter1 * NB_POKEMON + starter3
|
||||
when 2 then
|
||||
newspecies = starter1 * NB_POKEMON + starter2
|
||||
else
|
||||
end
|
||||
m.species = newspecies
|
||||
m.name = PBSpecies.getName(newspecies)
|
||||
m.resetMoves
|
||||
m.calcStats
|
||||
end
|
||||
return party
|
||||
end
|
||||
end
|
||||
|
||||
#######
|
||||
# end of class
|
||||
######
|
||||
|
||||
####methodes utilitaires
|
||||
|
||||
# def getBaseStats(species)
|
||||
# basestatsum = $pkmn_dex[species][5][0] # HP
|
||||
# basestatsum +=$pkmn_dex[species][5][1] # Attack
|
||||
# basestatsum +=$pkmn_dex[species][5][2] # Defense
|
||||
# basestatsum +=$pkmn_dex[species][5][3] # Speed
|
||||
# basestatsum +=$pkmn_dex[species][5][4] # Special Attack
|
||||
# basestatsum +=$pkmn_dex[species][5][5] # Special Defense
|
||||
# return basestatsum
|
||||
# end
|
||||
#
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
def gymLeaderOk(newspecies)
|
||||
return true if $game_variables[VAR_CURRENT_GYM_TYPE] == -1 #not in a gym
|
||||
leaderType = getLeaderType()
|
||||
if leaderType == nil
|
||||
return true
|
||||
else
|
||||
return true if SpeciesHasType?(leaderType, newspecies)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def getLeaderType()
|
||||
currentGym = $game_variables[VAR_CURRENT_GYM_TYPE]
|
||||
if currentGym > $game_variables[151].length
|
||||
return nil
|
||||
else
|
||||
typeIndex = $game_variables[151][currentGym]
|
||||
type = PBTypes.getName(typeIndex)
|
||||
end
|
||||
return typeIndex
|
||||
end
|
||||
|
||||
##Version alternatives de fonctions pour fonctionner avec numero de species
|
||||
def SpeciesHasType?(type, species)
|
||||
if type.is_a?(String) || type.is_a?(Symbol)
|
||||
return isConst?(getSpeciesType1(species), PBTypes, type) || isConst?(getSpeciesType2(species), PBTypes, type)
|
||||
else
|
||||
return getSpeciesType1(species) == type || getSpeciesType2(species) == type
|
||||
end
|
||||
end
|
||||
|
||||
# Returns this Pokémon's first type.
|
||||
def getSpeciesType1(species)
|
||||
return $pkmn_dex[species][3]
|
||||
end
|
||||
|
||||
# Returns this Pokémon's second type.
|
||||
def getSpeciesType2(species)
|
||||
return $pkmn_dex[species][4]
|
||||
end
|
||||
|
||||
############
|
||||
|
||||
#summarize random options
|
||||
def Kernel.sumRandomOptions()
|
||||
answer = $game_switches[SWITCH_RANDOM_STARTERS] ? "On" : "Off"
|
||||
stringOptions = "\nStarters: " << answer
|
||||
|
||||
answer = $game_switches[SWITCH_RANDOM_WILD] ? "On" : "Off"
|
||||
stringOptions << "\nWild Pokémon: " << answer << " "
|
||||
if $game_switches[SWITCH_RANDOM_WILD_AREA]
|
||||
stringOptions << "(Area)"
|
||||
else
|
||||
stringOptions << "(Global)"
|
||||
end
|
||||
|
||||
answer = $game_switches[SWITCH_RANDOM_TRAINERS] ? "On" : "Off"
|
||||
stringOptions << "\nTrainers: " << answer
|
||||
|
||||
answer = $game_switches[SWITCH_RANDOM_STATIC_ENCOUNTERS] ? "On" : "Off"
|
||||
stringOptions << "\nStatic encounters: " << answer
|
||||
|
||||
answer = $game_switches[SWITCH_RANDOM_GIFT_POKEMON] ? "On" : "Off"
|
||||
stringOptions << "\nGift Pokémon: " << answer
|
||||
|
||||
answer = $game_switches[SWITCH_RANDOM_ITEMS] ? "On" : "Off"
|
||||
stringOptions << "\nItems: " << answer
|
||||
|
||||
answer = $game_switches[SWITCH_RANDOM_TMS] ? "On" : "Off"
|
||||
stringOptions << "\nTMs: " << answer
|
||||
|
||||
return stringOptions
|
||||
end
|
||||
|
||||
def countVisitedMaps
|
||||
count = 0
|
||||
for i in 0..$PokemonGlobal.visitedMaps.length
|
||||
count += 1 if $PokemonGlobal.visitedMaps[i]
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
def Kernel.sumGameStats()
|
||||
stringStats = ""
|
||||
|
||||
stringStats << "Seen " << $Trainer.pokedexSeen.to_s << " Pokémon"
|
||||
stringStats << "\nCaught " << $Trainer.pokedexOwned.to_s << " Pokémon"
|
||||
|
||||
stringStats << "\nBeat the Elite Four " << $game_variables[VAR_STAT_NB_ELITE_FOUR].to_s << " times"
|
||||
stringStats << "\nFused " << $game_variables[VAR_STAT_NB_FUSIONS].to_s << " Pokémon"
|
||||
|
||||
stringStats << "\nRematched " << $game_variables[VAR_STAT_LEADER_REMATCH].to_s << " Gym Leaders"
|
||||
stringStats << "\nTook " << $PokemonGlobal.stepcount.to_s << " steps"
|
||||
stringStats << "\nVisited " << countVisitedMaps.to_s << " different areas"
|
||||
stringStats << "\nUsed " << $game_variables[VAR_STAT_RARE_CANDY] << " Rare Candies"
|
||||
|
||||
if $game_switches[910]
|
||||
stringStats << "\nMade " << $game_variables[VAR_STAT_NB_WONDERTRADES].to_s << " Wonder Trades"
|
||||
end
|
||||
|
||||
stringStats << "\nTipped $" << $game_variables[VAR_STAT_CLOWN_TIP_TOTAL].to_s << " to clowns"
|
||||
stringStats << "\nDestroyed " << $game_variables[VAR_STAT_NB_SANDCASTLES].to_s << " sandcastles"
|
||||
stringStats << "\nReported " << $game_variables[VAR_NB_CRIMES_REPORTED].to_s << " crimes" if $game_variables[VAR_NB_CRIMES_REPORTED] > 0
|
||||
|
||||
|
||||
if $game_variables[VAR_STAT_GAMBLER_WINS] > 0 || $game_variables[VAR_STAT_GAMBLER_LOSSES] > 0
|
||||
stringStats << "\nWon $" << $game_variables[VAR_STAT_GAMBLER_WINS].to_s << " against gamblers"
|
||||
stringStats << "\nLost $" << $game_variables[VAR_STAT_GAMBLER_LOSSES].to_s << " against gamblers"
|
||||
end
|
||||
stringStats << "\nSpent $" << $game_variables[VAR_STAT_HOTELS_SPENT].to_s << " at hotels"
|
||||
|
||||
stringStats << "\nAccepted " << $game_variables[VAR_STAT_QUESTS_ACCEPTED].to_s << " quests"
|
||||
stringStats << "\nCompleted " << $game_variables[VAR_STAT_QUESTS_COMPLETED].to_s << " quests"
|
||||
stringStats << "\nDiscovered " << $game_variables[VAR_STAT_NB_SECRETS].to_s << " secrets"
|
||||
|
||||
if $game_switches[912]
|
||||
stringStats << "\nDied " << $game_variables[191].to_s << " times in Pikachu's adventure"
|
||||
if $game_variables[193] >= 1
|
||||
stringStats << "\nCollected " << $game_variables[194].to_s << " coins with Pikachu"
|
||||
end
|
||||
end
|
||||
return stringStats
|
||||
end
|
||||
|
||||
def Kernel.pbRandomizeTM()
|
||||
tmList = []
|
||||
for item in $itemData
|
||||
#machine=$ItemData[item][ITEMMACHINE]
|
||||
#movename=PBMoves.getName(machine)
|
||||
#Kernel.pbMessage(_INTL("It contained {1}.\1",item))
|
||||
|
||||
tmList << item if pbIsHiddenMachine?(item)
|
||||
end
|
||||
end
|
||||
|
||||
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 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
|
||||
bst_range += 5
|
||||
end
|
||||
end
|
||||
return newspecies_dex
|
||||
end
|
||||
|
||||
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 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
|
||||
if n % 10 == 0
|
||||
bst_range += 5
|
||||
end
|
||||
end
|
||||
return newspecies_dex
|
||||
end
|
||||
|
||||
def playShuffleSE(i)
|
||||
if i % 40 == 0 || i == 0
|
||||
pbSEPlay("Charm", 60)
|
||||
end
|
||||
end
|
||||
|
||||
def getTrainersDataMode
|
||||
mode = GameData::Trainer
|
||||
if $game_switches && $game_switches[SWITCH_MODERN_MODE]
|
||||
mode = GameData::TrainerModern
|
||||
elsif $game_switches && $game_switches[SWITCH_EXPERT_MODE]
|
||||
mode = GameData::TrainerExpert
|
||||
end
|
||||
return mode
|
||||
end
|
||||
|
||||
def Kernel.pbShuffleTrainers(bst_range = 50, customsOnly = false, customsList = nil)
|
||||
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
|
||||
|
||||
if customsOnly && customsList == nil
|
||||
customsOnly = false
|
||||
end
|
||||
randomTrainersHash = Hash.new
|
||||
trainers_data = GameData::Trainer.list_all
|
||||
trainers_data.each do |key, value|
|
||||
trainer = trainers_data[key]
|
||||
i = 0
|
||||
new_party = []
|
||||
for poke in trainer.pokemon
|
||||
old_poke = GameData::Species.get(poke[:species]).id_number
|
||||
new_poke = customsOnly ? getNewCustomSpecies(old_poke, customsList, bst_range) : getNewSpecies(old_poke, bst_range)
|
||||
new_party << new_poke
|
||||
end
|
||||
randomTrainersHash[trainer.id] = new_party
|
||||
playShuffleSE(i)
|
||||
i += 1
|
||||
if i % 2 == 0
|
||||
n = (i.to_f / trainers.length) * 100
|
||||
Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling trainers...\\n {1}%\\^", sprintf('%.2f', n), PBSpecies.maxValue))
|
||||
end
|
||||
end
|
||||
$PokemonGlobal.randomTrainersHash = randomTrainersHash
|
||||
end
|
||||
|
||||
# def Kernel.pbShuffleTrainers(bst_range = 50)
|
||||
# randomTrainersHash = Hash.new
|
||||
#
|
||||
# trainers=load_data("Data/trainers.dat")
|
||||
# i=0
|
||||
# for trainer in trainers
|
||||
# for poke in trainer[3]
|
||||
# poke[TPSPECIES]=getNewSpecies(poke[TPSPECIES])
|
||||
# end
|
||||
# randomTrainersHash[i] = (trainer)
|
||||
# playShuffleSE(i)
|
||||
# i += 1
|
||||
# if i % 2 == 0
|
||||
# n = (i.to_f/trainers.length)*100
|
||||
# Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling trainers...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue))
|
||||
# end
|
||||
# #Kernel.pbMessage(_INTL("pushing trainer {1}: {2} ",i,trainer))
|
||||
# end
|
||||
# $PokemonGlobal.randomTrainersHash = randomTrainersHash
|
||||
# end
|
||||
|
||||
def Kernel.pbShuffleTrainersCustom(bst_range = 50)
|
||||
randomTrainersHash = Hash.new
|
||||
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
|
||||
|
||||
Kernel.pbMessage(_INTL("Parsing custom sprites folder"))
|
||||
customsList = getCustomSpeciesList(true, true)
|
||||
Kernel.pbMessage(_INTL("{1} sprites found", customsList.length.to_s))
|
||||
|
||||
if customsList.length == 0
|
||||
Kernel.pbMessage(_INTL("To use custom sprites, please place correctly named sprites in the /CustomBattlers folder. See readMe.txt for more information"))
|
||||
Kernel.pbMessage(_INTL("Trainer Pokémon will include auto-generated sprites."))
|
||||
return Kernel.pbShuffleTrainers(bst_range)
|
||||
elsif customsList.length < 200
|
||||
if Kernel.pbConfirmMessage(_INTL("Too few custom sprites were found. This will result in a very low Pokémon variety for trainers. Would you like to disable the Custom Sprites only option?"))
|
||||
Kernel.pbMessage(_INTL("Trainer Pokémon will include auto-generated sprites."))
|
||||
return Kernel.pbShuffleTrainers(bst_range) ##use regular shuffle if not enough sprites
|
||||
end
|
||||
if Kernel.pbConfirmMessage(_INTL("This will result in a very low Pokémon variety for trainers. Continue anyway?"))
|
||||
bst_range = 999
|
||||
else
|
||||
Kernel.pbMessage(_INTL("Trainer Pokémon will include auto-generated sprites."))
|
||||
return Kernel.pbShuffleTrainers(bst_range) ##use regular shuffle if not enough sprites
|
||||
end
|
||||
end
|
||||
Kernel.pbShuffleTrainers(bst_range, true, customsList)
|
||||
end
|
||||
|
||||
# trainers=load_data("Data/trainers.dat")
|
||||
# i=0
|
||||
# for trainer in trainers
|
||||
# for poke in trainer[3]
|
||||
# poke[TPSPECIES]=getNewCustomSpecies(poke[TPSPECIES],customsList)
|
||||
# end
|
||||
# randomTrainersHash[i] = (trainer)
|
||||
# playShuffleSE(i)
|
||||
# i += 1
|
||||
# if i % 2 == 0
|
||||
# n = (i.to_f/trainers.length)*100
|
||||
# Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling trainers (custom sprites only)...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue))
|
||||
# end
|
||||
# #Kernel.pbMessage(_INTL("pushing trainer {1}: {2} ",i,trainer))
|
||||
# end
|
||||
# $PokemonGlobal.randomTrainersHash = randomTrainersHash
|
||||
|
||||
#def getRandomCustomSprite()
|
||||
# filesList = Dir["./Graphics/CustomBattlers/*"]
|
||||
# i = rand(filesList.length-1)
|
||||
# path = filesList[i]
|
||||
# file = File.basename(path, ".*")
|
||||
# splitPoke = file.split(".")
|
||||
# head = splitPoke[0].to_i
|
||||
# body = splitPoke[1].to_i
|
||||
# return (body*NB_POKEMON)+head
|
||||
#end
|
||||
|
||||
def getCustomSpeciesList(allowOnline = true, redownload_file = false)
|
||||
speciesList = []
|
||||
|
||||
for num in 1..NB_POKEMON
|
||||
path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + num.to_s + "/*"
|
||||
filesList = Dir[path]
|
||||
maxDexNumber = (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||
maxVal = filesList.length - 1
|
||||
for i in 0..maxVal
|
||||
path = filesList[i]
|
||||
file = File.basename(path, ".*")
|
||||
fused = getDexNumFromFilename(file)
|
||||
if fused && (fused <= maxDexNumber && fused > 0)
|
||||
speciesList << fused
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# if speciesList.length <= 20000 && allowOnline
|
||||
# if redownload_file && Kernel.pbConfirmMessage(_INTL("Not enough local sprites found. Attempt to fetch list from the internet?"))
|
||||
# updateOnlineCustomSpritesFile
|
||||
# end
|
||||
#try to get list from github
|
||||
online_list = list_online_custom_sprites(true)
|
||||
return speciesList if !online_list
|
||||
species_id_list = []
|
||||
for file in online_list
|
||||
dexnum = getDexNumFromFilename(file)
|
||||
species_id_list << dexnum if dexnum && dexnum <= maxDexNumber && dexnum > 0
|
||||
end
|
||||
return species_id_list
|
||||
#end
|
||||
return speciesList
|
||||
end
|
||||
|
||||
|
||||
|
||||
def is_file_alt(file)
|
||||
filename = file.split(".")[0]
|
||||
return filename.match(/[a-zA-Z]/)
|
||||
end
|
||||
|
||||
#input: ex: 10.10.png
|
||||
def getDexNumFromFilename(filename)
|
||||
begin
|
||||
splitPoke = filename.split(".")
|
||||
head = splitPoke[0].to_i
|
||||
body = splitPoke[1].to_i
|
||||
|
||||
return nil if (body * NB_POKEMON) + head > (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||
return (body * NB_POKEMON) + head
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# def getCustomSpeciesList()
|
||||
# filesList = Dir["./Graphics/CustomBattlers/*"]
|
||||
# maxDexNumber = (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||
# maxVal = filesList.length - 1
|
||||
# for i in 0..maxVal
|
||||
# path = filesList[i]
|
||||
# file = File.basename(path, ".*")
|
||||
# splitPoke = file.split(".")
|
||||
# head = splitPoke[0].to_i
|
||||
# body = splitPoke[1].to_i
|
||||
# fused = (body * NB_POKEMON) + head
|
||||
# if fused <= maxDexNumber && fused > 0
|
||||
# speciesList << fused
|
||||
# end
|
||||
#
|
||||
# end
|
||||
# end
|
||||
|
||||
def Kernel.getBaseStats(species)
|
||||
if $pkmn_dex[species] == nil
|
||||
print species
|
||||
end
|
||||
|
||||
basestatsum = $pkmn_dex[species][5][0] # HP
|
||||
basestatsum += $pkmn_dex[species][5][1] # Attack
|
||||
basestatsum += $pkmn_dex[species][5][2] # Defense
|
||||
basestatsum += $pkmn_dex[species][5][3] # Speed
|
||||
basestatsum += $pkmn_dex[species][5][4] # Special Attack
|
||||
basestatsum += $pkmn_dex[species][5][5] # Special Defense
|
||||
return basestatsum
|
||||
end
|
||||
|
||||
def Kernel.gymLeaderRematchHint()
|
||||
hints = [
|
||||
"I heard that Brock has a huge interest in Pokémon fossils. He donated a lot of fossils he excavated to the Pewter City Museum.",
|
||||
"Misty is a pro at swimming. I heard she trains every single morning.",
|
||||
"Did you know that Lt. Surge used the magnetic fields generated by his Pokémon to navigate his plane back when he was in the army. He still loves a good magnetic field.",
|
||||
"Erika is a lover of nature. She loves going to parks to relax during the day.",
|
||||
"Koga has been seen leaving Fuschia city in the evenings. The rumors say he's preparing for a new job somewhere else...",
|
||||
"People say that Sabrina never sleeps. I wonder where she goes when she leaves her gym at night.",
|
||||
"The hot-headed Blaine is a man of extremes. He likes to explore around his hometown during the day.",
|
||||
"Giovanni is a mysterious man. I wonder where he goes in the evening. Probably somewhere as remote as possible to meditate in peace...",
|
||||
"I heard that Whitney went to school in one of the towns near Goldenrod before becoming a Gym Leader. She kept in touch with her old teacher and she goes to visit sometimes in the evening.",
|
||||
"Kurt is always on the lookout for Bug-type Pokémon. He goes hunting early in the morning.",
|
||||
"Falkner rises up early in the morning. You can usually find him in high places.",
|
||||
"Clair is a member of a famous clan of dragon masters. She goes to a special place to pray at night.",
|
||||
"Chuck is a martial arts pro. I've seen him train with Saffron City's dojo master back in the days.",
|
||||
"Morty is a mysterious man. He's been known to be one of the few people who dare enter Pokémon Tower at night.",
|
||||
"Pryce is an ice-type expert who has been around for a long time. He used to train in the Ice Tunnel between Mahogany Town and Blackthorn City before it froze over.",
|
||||
"Jasmine is on vacation in the Sevii Islands. She likes to rise up early to explore around the islands when no one's around."
|
||||
]
|
||||
arr = []
|
||||
n = 0
|
||||
for i in 426..437
|
||||
if !$game_switches[i]
|
||||
arr.push(n)
|
||||
end
|
||||
n += 1
|
||||
end
|
||||
arr.push(508); arr.push(509); arr.push(510); arr.push(511);
|
||||
n += 4
|
||||
|
||||
if arr.length > 0
|
||||
return hints[arr[rand(arr.length)]]
|
||||
end
|
||||
return "You got every Gym Leader to come here. This place is more popular than ever!\nNow go and battle them!"
|
||||
end
|
||||
|
||||
def getTrainerParty(trainer)
|
||||
if $game_switches[47]
|
||||
for poke in trainer[3]
|
||||
inverseFusion(poke)
|
||||
end
|
||||
end
|
||||
return trainer[3]
|
||||
end
|
||||
|
||||
def inverseFusion(pokemon)
|
||||
species = pokemon[TPSPECIES]
|
||||
return pokemon if species <= CONST_NB_POKE
|
||||
return pokemon if species > (CONST_NB_POKE * CONST_NB_POKE) + CONST_NB_POKE
|
||||
body = getBasePokemonID(species, true)
|
||||
head = getBasePokemonID(species, false)
|
||||
newspecies = (head) * CONST_NB_POKE + body
|
||||
pokemon[TPSPECIES] = newspecies
|
||||
return pokemon
|
||||
end
|
||||
|
||||
def addRandomHeldItems(trainerParty)
|
||||
for poke in trainerParty
|
||||
if poke.item == nil
|
||||
poke.item = PBItems::ORANBERRY #PBItems.sample
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def addHealingItem(items)
|
||||
if $Trainer.numbadges < 1
|
||||
items << PBItems::ORANBERRY
|
||||
elsif $Trainer.numbadges <= 2
|
||||
items << PBItems::POTION
|
||||
elsif $Trainer.numbadges <= 4
|
||||
items << PBItems::SUPERPOTION
|
||||
elsif $Trainer.numbadges <= 6
|
||||
items << PBItems::FULLHEAL
|
||||
items << PBItems::SUPERPOTION
|
||||
elsif $Trainer.numbadges <= 8
|
||||
items << PBItems::FULLHEAL
|
||||
items << PBItems::HYPERPOTION
|
||||
elsif $Trainer.numbadges >= 9
|
||||
items << PBItems::FULLRESTORE
|
||||
end
|
||||
|
||||
return items
|
||||
end
|
||||
|
||||
#####Overload de pbLoadTrainer
|
||||
#
|
||||
# def pbLoadTrainer(trainerid,trainername,partyid=0)
|
||||
# if trainerid.is_a?(String) || trainerid.is_a?(Symbol)
|
||||
# if !hasConst?(PBTrainers,trainerid)
|
||||
# raise _INTL("Trainer type does not exist ({1}, {2}, ID {3})",trainerid,trainername,partyid)
|
||||
# end
|
||||
# trainerid=getID(PBTrainers,trainerid)
|
||||
# end
|
||||
# success=false
|
||||
# items=[]
|
||||
# party=[]
|
||||
# opponent=nil
|
||||
# trainers=load_data("Data/trainers.dat")
|
||||
# trainerIndex=-1
|
||||
#
|
||||
# for trainer in trainers
|
||||
# trainerIndex+=1
|
||||
# name=trainer[1]
|
||||
# thistrainerid=trainer[0]
|
||||
# thispartyid=trainer[4]
|
||||
# next if trainerid!=thistrainerid || name!=trainername || partyid!=thispartyid
|
||||
# items=trainer[2].clone
|
||||
#
|
||||
# if $game_switches[666] #hard mode
|
||||
# items = addHealingItem(items)
|
||||
# end
|
||||
#
|
||||
#
|
||||
# name=pbGetMessageFromHash(MessageTypes::TrainerNames,name)
|
||||
# for i in RIVALNAMES
|
||||
# if isConst?(trainerid,PBTrainers,i[0]) && $game_variables[i[1]]!=0
|
||||
# name=$game_variables[i[1]]
|
||||
# end
|
||||
# end
|
||||
# opponent=PokeBattle_Trainer.new(name,thistrainerid)
|
||||
# opponent.setForeignID($Trainer) if $Trainer
|
||||
#
|
||||
#
|
||||
# #use le random Array si randomized starters (et pas 1ere rival battle)
|
||||
# isPlayingRandomized = $game_switches[987] && !$game_switches[46]
|
||||
# if isPlayingRandomized && $PokemonGlobal.randomTrainersHash[trainerIndex] == nil
|
||||
# Kernel.pbMessage(_INTL("The trainers need to be re-shuffled."))
|
||||
# Kernel.pbShuffleTrainers()
|
||||
# end
|
||||
# trainerParty = isPlayingRandomized ? $PokemonGlobal.randomTrainersHash[trainerIndex][3] : getTrainerParty(trainer)
|
||||
#
|
||||
#
|
||||
# isRematch = $game_switches[200]
|
||||
# rematchId = getRematchId(trainername,trainerid)
|
||||
# for poke in trainerParty
|
||||
# ##
|
||||
# species=poke[TPSPECIES]
|
||||
# species = replaceRivalStarterIfNecessary(species)
|
||||
#
|
||||
#
|
||||
# level= $game_switches[666] ? (poke[TPLEVEL]*1.1).ceil : poke[TPLEVEL]
|
||||
#
|
||||
# if isRematch
|
||||
# nbRematch = getNumberRematch(rematchId)
|
||||
# level = getRematchLevel(level,nbRematch)
|
||||
# species = evolveRematchPokemon(nbRematch,species)
|
||||
# end
|
||||
#
|
||||
# pokemon=PokeBattle_Pokemon.new(species,level,opponent)
|
||||
# #pokemon.form=poke[TPFORM]
|
||||
# pokemon.resetMoves
|
||||
#
|
||||
#
|
||||
# pokemon.setItem( $game_switches[843] ? rand(PBItems.maxValue) : poke[TPITEM])
|
||||
#
|
||||
# if poke[TPMOVE1]>0 || poke[TPMOVE2]>0 || poke[TPMOVE3]>0 || poke[TPMOVE4]>0
|
||||
# k=0
|
||||
# for move in [TPMOVE1,TPMOVE2,TPMOVE3,TPMOVE4]
|
||||
# pokemon.moves[k]=PBMove.new(poke[move])
|
||||
# k+=1
|
||||
# end
|
||||
# pokemon.moves.compact!
|
||||
# end
|
||||
# pokemon.setAbility(poke[TPABILITY])
|
||||
# pokemon.setGender(poke[TPGENDER])
|
||||
# if poke[TPSHINY] # if this is a shiny Pokémon
|
||||
# pokemon.makeShiny
|
||||
# else
|
||||
# pokemon.makeNotShiny
|
||||
# end
|
||||
# pokemon.setNature(poke[TPNATURE])
|
||||
# iv=poke[TPIV]
|
||||
# for i in 0...6
|
||||
# pokemon.iv[i]=iv&0x1F
|
||||
# pokemon.ev[i]=[85,level*3/2].min
|
||||
# end
|
||||
# pokemon.happiness=poke[TPHAPPINESS]
|
||||
# pokemon.name=poke[TPNAME] if poke[TPNAME] && poke[TPNAME]!=""
|
||||
# if poke[TPSHADOW] # if this is a Shadow Pokémon
|
||||
# pokemon.makeShadow rescue nil
|
||||
# pokemon.pbUpdateShadowMoves(true) rescue nil
|
||||
# pokemon.makeNotShiny
|
||||
# end
|
||||
# pokemon.ballused=poke[TPBALL]
|
||||
# pokemon.calcStats
|
||||
# party.push(pokemon)
|
||||
# end
|
||||
# success=true
|
||||
# break
|
||||
# end
|
||||
# return success ? [opponent,items,party] : nil
|
||||
# end
|
||||
|
||||
def getRematchId(trainername, trainerid)
|
||||
return trainername + trainerid.to_s
|
||||
end
|
||||
|
||||
def replaceRivalStarterIfNecessary(species)
|
||||
if species == RIVAL_STARTER_PLACEHOLDER_SPECIES
|
||||
if !$game_switches[840] || pbGet(250) == 0 #not DEFINED_RIVAL_STARTER
|
||||
fixRivalStarter()
|
||||
end
|
||||
rivalStarter = pbGet(250)
|
||||
if rivalStarter > 0
|
||||
species = pbGet(250)
|
||||
end
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
def fixRivalStarter()
|
||||
#set starter baseform
|
||||
if $PokemonGlobal.psuedoBSTHash == nil
|
||||
psuedoHash = Hash.new
|
||||
for i in 0..NB_POKEMON
|
||||
psuedoHash[i] = i
|
||||
end
|
||||
$PokemonGlobal.psuedoBSTHash = psuedoHash
|
||||
end
|
||||
starterChoice = pbGet(7)
|
||||
|
||||
setRivalStarter(0, 1) if starterChoice == 2
|
||||
setRivalStarter(0, 2) if starterChoice == 1
|
||||
setRivalStarter(1, 2) if starterChoice == 0
|
||||
setRivalStarter(0, 1) if starterChoice > 2
|
||||
echoln pbGet(VAR_RIVAL_STARTER)
|
||||
#evolve en fct des badges
|
||||
rivalStarter = pbGet(VAR_RIVAL_STARTER)
|
||||
|
||||
if $game_switches[68] #beat blue cerulean
|
||||
rivalStarter = evolveBody(rivalStarter)
|
||||
end
|
||||
|
||||
if $game_switches[89] #beat blue SS Anne
|
||||
rivalStarter = evolveHead(rivalStarter)
|
||||
end
|
||||
|
||||
if $game_switches[228] #beat silph co
|
||||
rivalStarter = evolveBody(rivalStarter)
|
||||
end
|
||||
|
||||
if $game_switches[11] #got badge 8
|
||||
rivalStarter = evolveHead(rivalStarter)
|
||||
end
|
||||
|
||||
if $game_switches[12] #beat league
|
||||
rivalStarter = evolveBody(rivalStarter)
|
||||
rivalStarter = evolveHead(rivalStarter)
|
||||
end
|
||||
|
||||
#RIVAL_STARTER_IS_DEFINED
|
||||
pbSet(250, rivalStarter)
|
||||
$game_switches[840] = true
|
||||
end
|
||||
@@ -1,366 +0,0 @@
|
||||
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
|
||||
attr_accessor :randomTrainersHash
|
||||
attr_accessor :randomGymTrainersHash
|
||||
attr_accessor :randomItemsHash
|
||||
attr_accessor :randomTMsHash
|
||||
|
||||
alias random_init initialize
|
||||
|
||||
def initialize
|
||||
random_init
|
||||
@randomGymTrainersHash = nil
|
||||
@psuedoHash = nil
|
||||
@psuedoBSTHash = nil
|
||||
@randomItemsHash = nil
|
||||
@randomTMsHash = nil
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
#pense pas que c'est utilisé mais bon...
|
||||
def get_pokemon_list(include_fusions = false)
|
||||
#Create array of all pokemon dex numbers
|
||||
pokeArray = []
|
||||
|
||||
monLimit = include_fusions ? PBSpecies.maxValue : NB_POKEMON - 1
|
||||
for i in 1..monLimit
|
||||
pokeArray.push(i)
|
||||
end
|
||||
#randomize hash
|
||||
return pokeArray
|
||||
end
|
||||
|
||||
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
|
||||
baseStats = getBaseStatsFormattedForRandomizer(i)
|
||||
statsTotal = getStatsTotal(baseStats)
|
||||
|
||||
targetStats_max = statsTotal + bst_range
|
||||
targetStats_min = statsTotal - bst_range
|
||||
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
|
||||
|
||||
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_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
|
||||
end
|
||||
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))
|
||||
end
|
||||
end
|
||||
|
||||
##############
|
||||
# randomizer shuffle
|
||||
# ##############
|
||||
def Kernel.pbShuffleDex(range = 50, type = 0)
|
||||
$game_switches[SWITCH_RANDOMIZED_AT_LEAST_ONCE] = true
|
||||
|
||||
#type 0: BST
|
||||
#type 1: full random
|
||||
range = 1 if range == 0
|
||||
should_include_fusions = $game_switches[SWITCH_RANDOM_WILD_TO_FUSION]
|
||||
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
|
||||
pokemon_list = get_pokemon_list(should_include_fusions)
|
||||
end
|
||||
$PokemonGlobal.psuedoBSTHash = get_randomized_bst_hash(pokemon_list, range, should_include_fusions)
|
||||
end
|
||||
|
||||
def itemCanBeRandomized(item)
|
||||
return false if item.is_machine?
|
||||
return false if item.is_key_item?
|
||||
return false if INVALID_ITEMS.include?(item.id)
|
||||
return false if RANDOM_ITEM_EXCEPTIONS.include?(item.id)
|
||||
return true
|
||||
end
|
||||
|
||||
def pbShuffleItems()
|
||||
randomItemsHash = Hash.new
|
||||
available_items = []
|
||||
for itemElement in GameData::Item.list_all
|
||||
item = itemElement[1]
|
||||
if itemCanBeRandomized(item)
|
||||
if !available_items.include?(item.id)
|
||||
available_items << item.id
|
||||
end
|
||||
end
|
||||
end
|
||||
remaining_items = available_items.clone
|
||||
for itemId in available_items
|
||||
if itemCanBeRandomized(GameData::Item.get(itemId))
|
||||
chosenItem = remaining_items.sample
|
||||
randomItemsHash[itemId] = chosenItem
|
||||
remaining_items.delete(chosenItem)
|
||||
end
|
||||
end
|
||||
$PokemonGlobal.randomItemsHash = randomItemsHash
|
||||
end
|
||||
|
||||
def pbShuffleTMs()
|
||||
randomItemsHash = Hash.new
|
||||
available_items = []
|
||||
for itemElement in GameData::Item.list_all
|
||||
item = itemElement[1]
|
||||
if item.is_TM?
|
||||
if !available_items.include?(item.id)
|
||||
available_items << item.id
|
||||
end
|
||||
end
|
||||
end
|
||||
remaining_items = available_items.clone
|
||||
for itemId in available_items
|
||||
if GameData::Item.get(itemId).is_TM?
|
||||
chosenItem = remaining_items.sample
|
||||
randomItemsHash[itemId] = chosenItem
|
||||
remaining_items.delete(chosenItem)
|
||||
end
|
||||
end
|
||||
$PokemonGlobal.randomTMsHash = randomItemsHash
|
||||
end
|
||||
|
||||
#
|
||||
# # ######
|
||||
# # #on remet arceus a la fin
|
||||
# # pokeArray.push(NB_POKEMON)
|
||||
#
|
||||
# # fill random hash
|
||||
# #random hash will have to be accessed by number, not internal name
|
||||
#
|
||||
# #use pokeArrayRand to fill in the BST hash also
|
||||
# #loop through the actual dex, and use the first mon in pokeArrayRand with
|
||||
# #BST in the same 100 range
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# for i in 1..NB_POKEMON-1
|
||||
# baseStats=getBaseStatsFormattedForRandomizer(i)
|
||||
# baseStat_target = 0
|
||||
# for k in 0...baseStats.length
|
||||
# baseStat_target+=baseStats[k]
|
||||
# end
|
||||
# baseStat_target = (baseStat_target+range).floor
|
||||
# for j in 1...pokeArrayRand.length
|
||||
# if $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] && !customSpriteExists(pokeArrayRand[j])
|
||||
# next
|
||||
# end
|
||||
# baseStats=getBaseStatsFormattedForRandomizer(pokeArrayRand[j])
|
||||
# baseStat_temp = 0
|
||||
# for l in 0...baseStats.length
|
||||
# baseStat_temp+=baseStats[l]
|
||||
# end
|
||||
# baseStat_temp = (baseStat_temp+range).floor
|
||||
#
|
||||
#
|
||||
# playShuffleSE(i)
|
||||
#
|
||||
# #if a match, add to hash, remove from array, and cycle to next poke in dex
|
||||
# if (baseStat_temp == baseStat_target)
|
||||
# psuedoBSTHash[i]=pokeArrayRand[j]
|
||||
# pokeArrayRand.delete(pokeArrayRand[j])
|
||||
# if i % 2 == 0 && type == 1
|
||||
# n = (i.to_f/NB_POKEMON)*100
|
||||
# Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^",sprintf('%.2f', n),NB_POKEMON))
|
||||
# end
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# psuedoBSTHash[NB_POKEMON] = NB_POKEMON
|
||||
# #add hashes to global data
|
||||
# $PokemonGlobal.psuedoHash = psuedoHash
|
||||
# $PokemonGlobal.psuedoBSTHash = psuedoBSTHash
|
||||
# end
|
||||
|
||||
def getStatsTotal(baseStats)
|
||||
bst = 0
|
||||
for k in 0...baseStats.length
|
||||
bst += baseStats[k]
|
||||
end
|
||||
return bst
|
||||
end
|
||||
|
||||
def isPartArceus(poke, type = 0)
|
||||
return true if poke == NB_POKEMON
|
||||
if type == 1
|
||||
return true if getBasePokemonID(poke, true) == NB_POKEMON
|
||||
return true if getBasePokemonID(poke, false) == NB_POKEMON
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
#ajoute x happiness a tous les party member
|
||||
def Kernel.raisePartyHappiness(increment)
|
||||
return
|
||||
# for poke in $Trainer.party
|
||||
# next if poke.isEgg?
|
||||
# poke.happiness += increment
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
#Randomizer code is shit. Too lazy to redo it.
|
||||
# Here is a cheap workaround lol
|
||||
def getBaseStatsFormattedForRandomizer(dex_num)
|
||||
statsArray = []
|
||||
stats = GameData::Species.get(dex_num).base_stats
|
||||
statsArray << stats[:HP]
|
||||
statsArray << stats[:ATTACK]
|
||||
statsArray << stats[:DEFENSE]
|
||||
statsArray << stats[:SPECIAL_ATTACK]
|
||||
statsArray << stats[:SPECIAL_DEFENSE]
|
||||
statsArray << stats[:SPEED]
|
||||
return statsArray
|
||||
end
|
||||
|
||||
# def Kernel.pbShuffleDexTrainers()
|
||||
# # create hash
|
||||
# psuedoHash = Hash.new
|
||||
# psuedoBSTHash = Hash.new
|
||||
#
|
||||
# #Create array of all pokemon dex numbers
|
||||
# pokeArray = []
|
||||
# for i in 1..PBSpecies.maxValue
|
||||
# pokeArray.push(i)
|
||||
# end
|
||||
# #randomize hash
|
||||
# pokeArrayRand = pokeArray.dup
|
||||
# pokeArrayRand.shuffle!
|
||||
# pokeArray.insert(0,nil)
|
||||
# # fill random hash
|
||||
# #random hash will have to be accessed by number, not internal name
|
||||
# for i in 1...pokeArrayRand.length
|
||||
# psuedoHash[i]=pokeArrayRand[i]
|
||||
# end
|
||||
#
|
||||
# #use pokeArrayRand to fill in the BST hash also
|
||||
# #loop through the actual dex, and use the first mon in pokeArrayRand with
|
||||
# #BST in the same 100 range
|
||||
# for i in 1..PBSpecies.maxValue
|
||||
# if i % 20 == 0
|
||||
# n = (i.to_f/PBSpecies.maxValue)*100
|
||||
# #Kernel.pbMessage(_INTL("\\ts[]Shuffling...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue))
|
||||
# end
|
||||
#
|
||||
# baseStats=calcBaseStats(i)
|
||||
# baseStat_target = 0
|
||||
# for k in 0...baseStats.length
|
||||
# baseStat_target+=baseStats[k]
|
||||
# end
|
||||
# baseStat_target = (baseStat_target/50).floor
|
||||
# for j in 1...pokeArrayRand.length
|
||||
# baseStats=calcBaseStats([pokeArrayRand[j]])
|
||||
# baseStat_temp = 0
|
||||
# for l in 0...baseStats.length
|
||||
# baseStat_temp+=baseStats[l]
|
||||
# end
|
||||
# baseStat_temp = (baseStat_temp/50).floor
|
||||
# #if a match, add to hash, remove from array, and cycle to next poke in dex
|
||||
# if baseStat_temp == baseStat_target
|
||||
# psuedoBSTHash[i]=pokeArrayRand[j]
|
||||
# pokeArrayRand.delete(pokeArrayRand[j])
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# #add hashes to global data0
|
||||
# #$PokemonGlobal.psuedoHash = psuedoHash
|
||||
# $PokemonGlobal.pseudoBSTHashTrainers = psuedoBSTHash
|
||||
# end
|
||||
|
||||
def getRandomizedTo(species)
|
||||
return species if !$PokemonGlobal.psuedoBSTHash
|
||||
return $PokemonGlobal.psuedoBSTHash[dexNum(species)]
|
||||
# code here
|
||||
end
|
||||
|
||||
def tryRandomizeGiftPokemon(pokemon, dontRandomize = false)
|
||||
if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !dontRandomize
|
||||
oldSpecies = pokemon.is_a?(Pokemon) ? dexNum(pokemon) : dexNum(pokemon.species)
|
||||
if $PokemonGlobal.psuedoBSTHash[oldSpecies]
|
||||
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
|
||||
Reference in New Issue
Block a user