-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Voltorb and Raomers to Gen 3 static encounters #388
Conversation
* | ||
* @return Vector of computed states | ||
*/ | ||
std::vector<GeneratorState> generate(u32 seed) const; | ||
std::vector<GeneratorState> generate(u32 seed, const StaticTemplate &staticTemplate) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary, it gets passed in with the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
@@ -66,11 +66,24 @@ void StaticSearcher3::startSearch(const std::array<u8, 6> &min, const std::array | |||
} | |||
} | |||
|
|||
void buggedRoamerIVsMatcher(std::array<u8, 6> &ivs, const bool buggedRoamer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this approach. It limits how many origin seeds we can search through. See how I handled similar situation for the e-readers in colo https://github.com/Admiral-Fish/PokeFinder/blob/master/Source/Core/Gen3/Searchers/GameCubeSearcher.cpp#L300-L307
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm misunderstanding, this essentially does what colo does. The IVs set but the function aren't passed to the LCRNG reverse function. These are only used for the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right I might to leave this comment in the other spot.
I still prefer the way I had it where it is a simple if statement instead of a function call
std::array<u8, 6> ivs;
if (staticTemplate->getRoamer())
{
ivs = { hp, atk & 7, 0, 0, 0, 0 };
}
else
{
ivs = { hp, atk, def, spa, spd, spe };
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Had to do atk &= 7
outside the array, it was giving me error when it was put directly inside as you wrote above
@@ -44,12 +44,15 @@ std::vector<GeneratorState> StaticGenerator3::generate(u32 seed) const | |||
u32 pid = go.nextUShort(); | |||
pid |= go.nextUShort() << 16; | |||
|
|||
u16 iv1 = go.nextUShort(); | |||
// Raikou/Entei/Suicune/Latias/Latios | |||
bool buggedRoamer = ((staticTemplate.getSpecie() == 380 || staticTemplate.getSpecie() == 381) && (profile.getVersion() & Game::RS) != Game::None) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to a field in a new class for StaticTemplate3 instead of checking the specie each time.
See StaticTemplate4, we would add a roamer field and initialize that in the constructor of the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
*/ | ||
void startSearch(const std::array<u8, 6> &min, const std::array<u8, 6> &max, const StaticTemplate *staticTemplate); | ||
void startSearch(const std::array<u8, 6> &min, const std::array<u8, 6> &max, const StaticTemplate *staticTemplate, const bool buggedRoamer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't need to be passed in with the change I suggested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
* | ||
* @return Vector of computed states | ||
*/ | ||
std::vector<SearcherState> search(u8 hp, u8 atk, u8 def, u8 spa, u8 spd, u8 spe, const StaticTemplate *staticTemplate) const; | ||
std::vector<SearcherState> search(u8 hp, u8 atk, u8 def, u8 spa, u8 spd, u8 spe, const StaticTemplate *staticTemplate, const bool buggedRoamer) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't need to be passed in with the change I suggested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
@@ -66,11 +66,24 @@ void StaticSearcher3::startSearch(const std::array<u8, 6> &min, const std::array | |||
} | |||
} | |||
|
|||
void buggedRoamerIVsMatcher(std::array<u8, 6> &ivs, const bool buggedRoamer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right I might to leave this comment in the other spot.
I still prefer the way I had it where it is a simple if statement instead of a function call
std::array<u8, 6> ivs;
if (staticTemplate->getRoamer())
{
ivs = { hp, atk & 7, 0, 0, 0, 0 };
}
else
{
ivs = { hp, atk, def, spa, spd, spe };
}
for (u8 atk = min[1]; atk <= max[1]; atk++) | ||
for (u8 atk = buggedRoamer ? min[1] & 7 : min[1]; atk <= (buggedRoamer ? max[1] & 7 : max[1]); atk++) | ||
{ | ||
for (u8 def = min[2]; def <= max[2]; def++) | ||
for (u8 def = buggedRoamer ? 0 : min[2]; def <= (buggedRoamer ? 31 : max[2]); def++) | ||
{ | ||
for (u8 spa = min[3]; spa <= max[3]; spa++) | ||
for (u8 spa = buggedRoamer ? 0 : min[3]; spa <= (buggedRoamer ? 31 : max[3]); spa++) | ||
{ | ||
for (u8 spd = min[4]; spd <= max[4]; spd++) | ||
for (u8 spd = buggedRoamer ? 0 : min[4]; spd <= (buggedRoamer ? 31 : max[4]); spd++) | ||
{ | ||
for (u8 spe = min[5]; spe <= max[5]; spe++) | ||
for (u8 spe = buggedRoamer ? 0 : min[5]; spe <= (buggedRoamer ? 31 : max[5]); spe++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this approach. It limits how many origin seeds we can search through. See how I handled similar situation for the e-readers in colo https://github.com/Admiral-Fish/PokeFinder/blob/master/Source/Core/Gen3/Searchers/GameCubeSearcher.cpp#L300-L307
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
atk &= 7; | ||
ivs = { hp, atk, 0, 0, 0, 0 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ivs = { hp, atk & 7, 0, 0, 0, 0 };
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static_cast<u8>(atk & 7)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -28,8 +28,8 @@ def embed_encounters3(): | |||
|
|||
string += f"ShadowTemplate({encounter['version']}, {encounter['specie']}, {encounter.get('shiny', 'Shiny::Random')}, {encounter['level']}, {locks}, {len(encounter['locks'])}, {encounter['type']})" | |||
else: | |||
string += f"StaticTemplate({encounter['version']}, {encounter['specie']}, {encounter.get('form', 0)}, {encounter.get('shiny', 'Shiny::Random')}, 255, 255, 0, {encounter['level']})" | |||
|
|||
string += f"StaticTemplate3({encounter['version']}, {encounter['specie']}, {encounter.get('form', 0)}, {encounter.get('shiny', 'Shiny::Random')}, 255, 255, 0, {encounter['level']}, {str(encounter['buggedRoamer']).lower()})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this here, just have it handled in the constructor of StaticTemplate3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
Source/Core/Gen3/StaticTemplate3.hpp
Outdated
* @param buggedRoamer FRLG/RS roamer | ||
*/ | ||
constexpr StaticTemplate3(Game version, u16 specie, u8 form, Shiny shiny, u8 ability, u8 gender, u8 ivCount, u8 level, bool buggedRoamer) : | ||
StaticTemplate(version, specie, form, shiny, ability, gender, ivCount, level), buggedRoamer(buggedRoamer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roamer(specie == X || specie == X)
I don't know the specie numbers off hand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, i don't think you can handle it this way. Emerald roamers are not bugged, only FRLG/RS roamers. Emerald has both Latios and Latias, Ruby has Latios, Sapphire has latias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like something like this?
roamer(((specie == 380 || specie == 381) && (version & Game::RS) != Game::None) || (specie >= 243 && specie <= 245))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -153,14 +153,15 @@ void Static3::generatorCategoryIndexChanged(int index) | |||
QVariant::fromValue(i)); | |||
} | |||
} | |||
ui->comboBoxGeneratorMethod->setItemHidden(1, templates[ui->comboBoxGeneratorPokemon->getCurrentInt()].getBuggedRoamer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It removes Method 4 from Method selection when a bugged roamer is selected. Method 4 never happens, cause the rng call for ivs2 is not considered at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last change then I will merge it
Add what asked in #366