Skip to content

Commit cae5b36

Browse files
committed
Kilika look ahead extends.
And also, other minor bug fixes for other bosses.
1 parent 7cb9c43 commit cae5b36

File tree

5 files changed

+39
-13
lines changed

5 files changed

+39
-13
lines changed

area/kilika.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def select_best_of_two(coming_battles):
9292
def forest_1():
9393
logger.info("Kilika forest 1")
9494
kilika_battles = 0
95+
best_of_two = 99 # Used to find the best battle coming up.
96+
advances = 2 # Used to find the best battle coming up.
9597
next_battle = []
9698
import rng_track
9799

@@ -117,7 +119,6 @@ def forest_1():
117119
checkpoint = 83
118120
if checkpoint == 83 and not valefor_charge:
119121
checkpoint = 81
120-
best_of_two = 99
121122
if checkpoint == 83 and memory.main.get_map() == 65:
122123
checkpoint = 84
123124
if checkpoint == 37 and game_vars.skip_kilika_luck():
@@ -158,10 +159,15 @@ def forest_1():
158159
if memory.main.battle_active():
159160
if checkpoint < 9:
160161
battle.main.lancet_tutorial()
161-
next_two = rng_track.coming_battles(
162-
area="kilika_woods", battle_count=2
163-
)
164-
best_of_two = select_best_of_two(next_two)
162+
while best_of_two == 99:
163+
next_two = rng_track.coming_battles(
164+
area="kilika_woods", battle_count=advances
165+
)
166+
best_of_two = select_best_of_two(next_two)
167+
advances += 1
168+
if advances > 150:
169+
logger.error("No valid battles in the next 150.")
170+
break
165171
next_battle = rng_track.coming_battles(
166172
area="kilika_woods", battle_count=1
167173
)[0]

battle/boss.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,15 @@ def sin_fin():
301301
logger.debug("Tidus defend")
302302
elif Yuna.is_turn():
303303
battle.main.buddy_swap(Lulu) # Yuna out, Lulu in
304-
CurrentPlayer().cast_black_magic_spell(1, target_id=23, direction="r")
305304
elif Kimahri.is_turn():
306305
battle.main.lancet_target(target=23, direction="r")
307306
kim_turn = True
308307
elif Lulu.is_turn():
309308
CurrentPlayer().cast_black_magic_spell(1, target_id=23, direction="r")
309+
elif not 5 in memory.main.get_active_battle_formation():
310+
battle.main.buddy_swap(Lulu)
311+
elif not 3 in memory.main.get_active_battle_formation():
312+
battle.main.buddy_swap(Kimahri)
310313
else:
311314
CurrentPlayer().defend()
312315
if fin_turns >= 3 and kim_turn:

battle/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,12 @@ def kilika_woods(valefor_charge=True, best_charge: int = 99, next_battle=[]):
419419
break
420420
elif screen.faint_check():
421421
revive()
422-
elif not 1 in memory.main.get_active_battle_formation():
423-
buddy_swap(Yuna)
424422
elif Kimahri.is_turn() or Lulu.is_turn():
425-
if memory.main.get_battle_char_slot(4) >= 3:
423+
if not 1 in memory.main.get_active_battle_formation():
424+
buddy_swap(Yuna)
425+
elif not 4 in memory.main.get_active_battle_formation():
426426
buddy_swap(Wakka)
427-
elif memory.main.get_battle_char_slot(0) >= 3:
427+
elif not 0 in memory.main.get_active_battle_formation():
428428
buddy_swap(Tidus)
429429
else:
430430
buddy_swap(Yuna)

load_game.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,24 @@ def kilika_rng_manip():
553553
# Kilika start, RNG01
554554
# 1904657448
555555
logger.warning("==== Hard setting value for testing")
556-
memory.main.set_rng_by_index(value=1904657448, index=1)
556+
rng_value = 1904657448
557+
memory.main.set_rng_by_index(value=rng_value, index=1)
558+
559+
#Basically, hunt until we don't find a good battle in 'advances'
560+
advances = 5
561+
import rng_track
562+
import area.kilika
563+
next_two = rng_track.coming_battles(
564+
area="kilika_woods", battle_count=advances, extra_advances=1
565+
)
566+
while area.kilika.select_best_of_two(next_two) != 99:
567+
rng_value += 1
568+
memory.main.set_rng_by_index(value=rng_value, index=1)
569+
next_two = rng_track.coming_battles(
570+
area="kilika_woods", battle_count=advances, extra_advances=1
571+
)
572+
logger.warning(f"==== Chosen Value: {rng_value}")
573+
557574

558575
def besaid_trials():
559576
# Exit Tent

memory/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,8 +2409,8 @@ def reset_battle_end():
24092409
def set_rng_by_index(value:int=0, index:int=1):
24102410
global base_value
24112411
global process
2412-
key = base_value + 0x00D35ED8 + (index * 4)
2413-
process.write_bytes(key, 0x7E9F20D2, 4)
2412+
key = base_value + 0x00D35ED8 + (index * 0x4)
2413+
process.write_bytes(key, value, 4)
24142414

24152415
def set_rng_2():
24162416
global base_value

0 commit comments

Comments
 (0)