@@ -47,67 +47,60 @@ RaidItemFarmerOHKO::RaidItemFarmerOHKO()
4747// , m_advanced_options(
4848// "<font size=4><b>Advanced Options:</b> You should not need to touch anything below here.</font>"
4949// )
50- , WAIT_FOR_STAMP_DELAY (
50+ , WAIT_FOR_STAMP_DELAY0 (
5151 " <b>Wait for Stamp Delay:</b><br>Wait this long for the stamp to show up." ,
5252 LockMode::LOCK_WHILE_RUNNING,
53- TICKS_PER_SECOND,
54- " 3 * TICKS_PER_SECOND"
53+ " 3000 ms"
5554 )
56- , ENTER_STAMP_MASH_DURATION (
55+ , ENTER_STAMP_MASH_DURATION0 (
5756 " <b>Enter Stamp Mash Duration:</b><br>Mash A this long to enter a raid from its stamp." ,
5857 LockMode::LOCK_WHILE_RUNNING,
59- TICKS_PER_SECOND,
60- " 5 * TICKS_PER_SECOND"
58+ " 5000 ms"
6159 )
62- , RAID_START_MASH_DURATION (
60+ , RAID_START_MASH_DURATION0 (
6361 " <b>Raid Start Mash Duration:</b><br>Mash A this long to start raid." ,
6462 LockMode::LOCK_WHILE_RUNNING,
65- TICKS_PER_SECOND,
66- " 10 * TICKS_PER_SECOND"
63+ " 10 s"
6764 )
68- , RAID_START_TO_ATTACK_DELAY (
65+ , RAID_START_TO_ATTACK_DELAY0 (
6966 " <b>Raid Start to Attack Delay:</b><br>Time from start raid to when the raiders attack.<br>"
7067 " Do not over-optimize this timing unless you are running with 4 Switches. The Wishiwashi NPC will break the program." ,
7168 LockMode::LOCK_WHILE_RUNNING,
72- TICKS_PER_SECOND,
73- " 30 * TICKS_PER_SECOND"
69+ " 30 s"
7470 )
75- , ATTACK_TO_CATCH_DELAY (
71+ , ATTACK_TO_CATCH_DELAY0 (
7672 " <b>Attack to Catch Delay:</b><br>Time from when you attack to when the catch selection appears.<br>"
7773 " Do not over-optimize this timing unless you are running with 4 Switches. The Clefairy NPC's Follow Me will break the program." ,
7874 LockMode::LOCK_WHILE_RUNNING,
79- TICKS_PER_SECOND,
80- " 18 * TICKS_PER_SECOND"
75+ " 18 s"
8176 )
82- , RETURN_TO_OVERWORLD_DELAY (
77+ , RETURN_TO_OVERWORLD_DELAY0 (
8378 " <b>Return to Overworld Delay:</b><br>Time from when you don't catch to when you return to the overworld." ,
8479 LockMode::LOCK_WHILE_RUNNING,
85- TICKS_PER_SECOND,
86- " 18 * TICKS_PER_SECOND"
80+ " 18 s"
8781 )
88- , TOUCH_DATE_INTERVAL (
82+ , TOUCH_DATE_INTERVAL0 (
8983 " <b>Rollover Prevention:</b><br>Prevent the den from rolling over by periodically touching the date. If set to zero, this feature is disabled." ,
9084 LockMode::LOCK_WHILE_RUNNING,
91- TICKS_PER_SECOND,
92- " 4 * 3600 * TICKS_PER_SECOND"
85+ " 4 hours"
9386 )
9487{
9588 PA_ADD_OPTION (BACKUP_SAVE);
9689// PA_ADD_STATIC(m_advanced_options);
97- PA_ADD_OPTION (WAIT_FOR_STAMP_DELAY );
98- PA_ADD_OPTION (ENTER_STAMP_MASH_DURATION );
99- PA_ADD_OPTION (RAID_START_MASH_DURATION );
100- PA_ADD_OPTION (RAID_START_TO_ATTACK_DELAY );
101- PA_ADD_OPTION (ATTACK_TO_CATCH_DELAY );
102- PA_ADD_OPTION (RETURN_TO_OVERWORLD_DELAY );
103- PA_ADD_OPTION (TOUCH_DATE_INTERVAL );
90+ PA_ADD_OPTION (WAIT_FOR_STAMP_DELAY0 );
91+ PA_ADD_OPTION (ENTER_STAMP_MASH_DURATION0 );
92+ PA_ADD_OPTION (RAID_START_MASH_DURATION0 );
93+ PA_ADD_OPTION (RAID_START_TO_ATTACK_DELAY0 );
94+ PA_ADD_OPTION (ATTACK_TO_CATCH_DELAY0 );
95+ PA_ADD_OPTION (RETURN_TO_OVERWORLD_DELAY0 );
96+ PA_ADD_OPTION (TOUCH_DATE_INTERVAL0 );
10497}
10598
10699void RaidItemFarmerOHKO::program (MultiSwitchProgramEnvironment& env, CancellableScope& scope){
107100 SwitchControllerContext host (scope, env.consoles [0 ].controller ());
108101 size_t switches = env.consoles .size ();
109102
110- WallDuration TOUCH_DATE_INTERVAL0 = std::chrono::milliseconds (TOUCH_DATE_INTERVAL * 1000 / TICKS_PER_SECOND) ;
103+ WallDuration TOUCH_DATE_INTERVAL = TOUCH_DATE_INTERVAL0 ;
111104
112105 env.run_in_parallel (
113106 scope,
@@ -118,7 +111,7 @@ void RaidItemFarmerOHKO::program(MultiSwitchProgramEnvironment& env, Cancellable
118111
119112 WallClock last_touch = current_time ();
120113// uint32_t last_touch = 0;
121- if (TOUCH_DATE_INTERVAL > 0 ){
114+ if (TOUCH_DATE_INTERVAL > 0ms ){
122115 touch_date_from_home (host, ConsoleSettings::instance ().SETTINGS_TO_HOME_DELAY0 );
123116 last_touch = current_time ();
124117// last_touch = system_clock(host);
@@ -159,10 +152,10 @@ void RaidItemFarmerOHKO::program(MultiSwitchProgramEnvironment& env, Cancellable
159152 env.run_in_parallel (
160153 scope, 1 , switches,
161154 [&](ConsoleHandle& console, SwitchControllerContext& context){
162- pbf_wait (context, WAIT_FOR_STAMP_DELAY );
155+ pbf_wait (context, WAIT_FOR_STAMP_DELAY0 );
163156 pbf_press_button (context, BUTTON_X, 10 , 10 );
164157 pbf_press_dpad (context, DPAD_RIGHT, 10 , 10 );
165- pbf_mash_button (context, BUTTON_A, ENTER_STAMP_MASH_DURATION );
158+ pbf_mash_button (context, BUTTON_A, ENTER_STAMP_MASH_DURATION0 );
166159 }
167160 );
168161
@@ -173,10 +166,10 @@ void RaidItemFarmerOHKO::program(MultiSwitchProgramEnvironment& env, Cancellable
173166 env.run_in_parallel (
174167 scope,
175168 [&](ConsoleHandle& console, SwitchControllerContext& context){
176- pbf_mash_button (context, BUTTON_A, RAID_START_MASH_DURATION );
177- pbf_wait (context, RAID_START_TO_ATTACK_DELAY );
169+ pbf_mash_button (context, BUTTON_A, RAID_START_MASH_DURATION0 );
170+ pbf_wait (context, RAID_START_TO_ATTACK_DELAY0 );
178171 pbf_mash_button (context, BUTTON_A, 5 * TICKS_PER_SECOND);
179- pbf_wait (context, ATTACK_TO_CATCH_DELAY );
172+ pbf_wait (context, ATTACK_TO_CATCH_DELAY0 );
180173
181174 if (console.index () == 0 ){
182175 // Add a little extra wait time since correctness matters here.
@@ -185,11 +178,9 @@ void RaidItemFarmerOHKO::program(MultiSwitchProgramEnvironment& env, Cancellable
185178 close_game (console, context);
186179
187180 // Touch the date.
188- if (TOUCH_DATE_INTERVAL > 0 && current_time () - last_touch >= TOUCH_DATE_INTERVAL0){
189- // if (TOUCH_DATE_INTERVAL > 0 && system_clock(context) - last_touch >= TOUCH_DATE_INTERVAL){
181+ if (TOUCH_DATE_INTERVAL > 0ms && current_time () - last_touch >= TOUCH_DATE_INTERVAL){
190182 touch_date_from_home (context, ConsoleSettings::instance ().SETTINGS_TO_HOME_DELAY0 );
191- last_touch += TOUCH_DATE_INTERVAL0;
192- // last_touch += TOUCH_DATE_INTERVAL;
183+ last_touch += TOUCH_DATE_INTERVAL;
193184 }
194185 start_game_from_home_with_inference (
195186 console, context,
@@ -199,11 +190,12 @@ void RaidItemFarmerOHKO::program(MultiSwitchProgramEnvironment& env, Cancellable
199190 );
200191 }else {
201192 pbf_press_dpad (context, DPAD_DOWN, 10 , 10 );
202- if (RETURN_TO_OVERWORLD_DELAY > 5 * TICKS_PER_SECOND){
203- pbf_mash_button (context, BUTTON_A, RETURN_TO_OVERWORLD_DELAY - 5 * TICKS_PER_SECOND);
204- pbf_mash_button (context, BUTTON_B, 5 * TICKS_PER_SECOND);
193+ Milliseconds delay = RETURN_TO_OVERWORLD_DELAY0;
194+ if (delay > 5000ms){
195+ pbf_mash_button (context, BUTTON_A, delay - 5000ms);
196+ pbf_mash_button (context, BUTTON_B, 5000ms);
205197 }else {
206- pbf_mash_button (context, BUTTON_A, RETURN_TO_OVERWORLD_DELAY );
198+ pbf_mash_button (context, BUTTON_A, delay );
207199 }
208200 }
209201 }
0 commit comments