-
Notifications
You must be signed in to change notification settings - Fork 58
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
Update EggHatcher_Core.c #438
Open
Vardan2210
wants to merge
6
commits into
PokemonAutomation:main
Choose a base branch
from
Vardan2210:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7133de1
Update EggHatcher_Core.c
Vardan2210 9cf120a
Update EggHatcher_Core.c
Vardan2210 d2fdc1b
Update EggHatcher_Core.c
Vardan2210 2256aa5
Update EggHatcher_Core.c
Vardan2210 7d46eca
Update EggHatcher_Core.c
Vardan2210 d4a87eb
Update EggHatcher_Core.c
Vardan2210 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,72 +7,73 @@ | |
|
||
void fly_to_gate(void) { | ||
pbf_press_button(BUTTON_A, 20, 500); | ||
pbf_press_button(BUTTON_Y, 20, 800); | ||
pbf_press_button(BUTTON_Y, 20, 1000); | ||
pbf_move_left_joystick(STICK_MAX, STICK_MAX, 6, 500); | ||
pbf_mash_button(BUTTON_A, 1000); | ||
}; | ||
|
||
void move_to_location(void) { | ||
pbf_move_left_joystick(STICK_MIN, STICK_CENTER, 190, 0); | ||
pbf_press_button(BUTTON_L, 20, 0); | ||
pbf_move_left_joystick(STICK_CENTER, STICK_MIN, 150, 100); | ||
pbf_press_button(BUTTON_L, 20, 200); | ||
pbf_move_left_joystick(STICK_CENTER, STICK_MIN, 175, 200); | ||
pbf_move_left_joystick(STICK_CENTER, STICK_MAX, 20, 0); | ||
pbf_press_button(BUTTON_L, 20, 300); | ||
}; | ||
|
||
void open_box(void) { | ||
pbf_press_button(BUTTON_A, 20, 500); | ||
pbf_press_button(BUTTON_X, 20, 200); | ||
pbf_press_button(BUTTON_A, 20, 500); | ||
pbf_press_button(BUTTON_A, 20, 700); | ||
pbf_press_button(BUTTON_X, 20, 400); | ||
pbf_press_button(BUTTON_A, 20, 700); | ||
}; | ||
|
||
void get_egg(int boxCol) { | ||
pbf_press_dpad(DPAD_RIGHT, 20, 100); | ||
pbf_press_button(BUTTON_MINUS, 20, 100); | ||
for (int i = 0; i < 40; i++) { | ||
pbf_press_dpad(DPAD_RIGHT, 20, 400); | ||
pbf_press_button(BUTTON_MINUS, 20, 800); | ||
for (int i = 0; i < 60; i++) { | ||
pbf_press_dpad(DPAD_DOWN, 5, 0); | ||
}; | ||
pbf_wait(100); | ||
pbf_press_button(BUTTON_A, 20, 100); | ||
pbf_wait(500); | ||
pbf_press_button(BUTTON_A, 20, 400); | ||
for (int curCol = 0; curCol < boxCol + 1; curCol++) { | ||
pbf_press_dpad(DPAD_LEFT, 20, 100); | ||
pbf_press_dpad(DPAD_LEFT, 20, 250); | ||
}; | ||
pbf_press_dpad(DPAD_DOWN, 20, 100); | ||
pbf_press_button(BUTTON_A, 20, 100); | ||
pbf_press_button(BUTTON_B, 20, 200); | ||
pbf_press_button(BUTTON_B, 20, 800); | ||
pbf_press_dpad(DPAD_DOWN, 20, 400); | ||
pbf_press_button(BUTTON_A, 20, 600); | ||
pbf_mash_button(BUTTON_B,600); | ||
|
||
}; | ||
|
||
void deposit_pokemon(int boxCol) { | ||
pbf_press_dpad(DPAD_LEFT, 20, 100); | ||
pbf_press_dpad(DPAD_DOWN, 20, 100); | ||
pbf_press_dpad(DPAD_LEFT, 20, 400); | ||
pbf_press_dpad(DPAD_DOWN, 20, 400); | ||
if (HAS_CLONED_RIDER) { | ||
pbf_press_dpad(DPAD_DOWN, 20, 100); | ||
}; | ||
pbf_press_button(BUTTON_MINUS, 20, 100); | ||
for (int i = 0; i < 40; i++) { | ||
pbf_press_button(BUTTON_MINUS, 20, 300); | ||
for (int i = 0; i < 60; i++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here for the if and wait |
||
pbf_press_dpad(DPAD_DOWN, 5, 0); | ||
}; | ||
pbf_wait(100); | ||
pbf_press_button(BUTTON_A, 20, 100); | ||
for (int curCol = 0; curCol < boxCol + 1; curCol++) { | ||
pbf_press_dpad(DPAD_RIGHT, 20, 100); | ||
pbf_wait(400); | ||
pbf_press_button(BUTTON_A, 20, 400); | ||
for (int curCol = 0; curCol < boxCol; curCol++) { | ||
pbf_press_dpad(DPAD_RIGHT, 20, 300); | ||
}; | ||
pbf_press_dpad(DPAD_UP, 20, 100); | ||
pbf_press_button(BUTTON_A, 20, 100); | ||
pbf_press_dpad(DPAD_UP, 20, 400); | ||
pbf_press_button(BUTTON_A, 20, 400); | ||
}; | ||
|
||
void ride_hatch(void) { | ||
pbf_press_button(BUTTON_PLUS, 20, 400); | ||
pbf_press_button(BUTTON_PLUS, 20, 500); | ||
// hatch the first egg at full speed, sometimes the speed boost can fail %point for optimizing% | ||
pbf_move_left_joystick(STICK_MAX, STICK_CENTER, 50, 0); | ||
pbf_press_button(BUTTON_LCLICK, 5, 0); | ||
pbf_move_left_joystick(STICK_MAX, STICK_CENTER, STEPS_TO_HATCH * SAFETY_COEFF, 0); | ||
pbf_move_left_joystick(STICK_MAX, STICK_CENTER, STEPS_TO_HATCH * 1.9 * SAFETY_COEFF , 0); | ||
// hatch the remaining 4 eggs, not speed boosted to reduce error due to random positioning | ||
for (int checkEggLoop = 0; checkEggLoop < 80; checkEggLoop++) { | ||
for (int checkEggLoop = 0; checkEggLoop < 90; checkEggLoop++) { | ||
pbf_move_left_joystick(STICK_MAX, STICK_CENTER, 220, 0); | ||
pbf_press_button(BUTTON_A, 5, 0); | ||
}; | ||
pbf_mash_button(BUTTON_A, 1250); | ||
}; | ||
|
||
int main(void) { | ||
|
@@ -90,31 +91,43 @@ int main(void) { | |
|
||
for(int curBox = 0; curBox < BOXES_TO_HATCH; curBox++) { | ||
// ########## Intial loop setup ########## | ||
fly_to_gate(); | ||
move_to_location(); | ||
open_box(); | ||
pbf_press_dpad(DPAD_LEFT, 20, 200); | ||
if (HAS_CLONED_RIDER) { | ||
pbf_press_dpad(DPAD_DOWN, 20, 100); | ||
}; | ||
pbf_wait(500); | ||
get_egg(0); | ||
pbf_wait(100); | ||
ride_hatch(); | ||
|
||
// ########## Main hatching loop ########## | ||
for(int boxCol = 0; boxCol < 6; boxCol++) { | ||
get_egg(boxCol); | ||
move_to_location(); | ||
ride_hatch(); | ||
for(int boxCol = 1; boxCol < 7; boxCol++) { | ||
|
||
fly_to_gate(); | ||
move_to_location(); | ||
open_box(); | ||
pbf_wait(500); | ||
deposit_pokemon(boxCol); | ||
if (boxCol < 6) { | ||
pbf_wait(500); | ||
get_egg(boxCol); | ||
pbf_wait(100); | ||
ride_hatch(); | ||
} | ||
}; | ||
|
||
// ########## End loop setup ########## | ||
pbf_wait(200); | ||
pbf_press_button(BUTTON_R, 20, 200); | ||
pbf_press_button(BUTTON_B, 20, 200); | ||
pbf_press_button(BUTTON_B, 20, 800); | ||
pbf_mash_button(BUTTON_B,600); | ||
pbf_wait(500); | ||
}; | ||
|
||
// ########## End idling in home ########## | ||
pbf_press_button(BUTTON_HOME, 20, 100); | ||
end_program_callback(); | ||
end_program_loop(); | ||
}; | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 was there before but I do not get what this is doing. Why not multiply 5 by 60? Wouldn't it do the same ? And also allow to merge the wait at the end?
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.
Honestly same, I just saw that it was used to select the row of pokemon and it was working pretty well so didn't want to touch anything...I just increased its duration because in some instances 40 wasn't cutting it. I can try to just put the timer as 300 in the press dpad function. Though my hunch is they wanted to repeatedly press it instead of holding due to some weird interaction with the game.