Skip to content

Commit

Permalink
YGO06: when the item from a challenge is collected set it to completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Rensen3 committed Dec 21, 2024
1 parent dd9c037 commit 83d6c46
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion worlds/yugioh06/client_bh.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,27 @@ async def game_watcher(self, ctx: "BizHawkClientContext") -> None:
if locs_to_send is not None:
await ctx.send_msgs([{"cmd": "LocationChecks", "locations": list(locs_to_send)}])

# Send game clear if we're in either any ending cutscene or the credits state.
# Set collected Challenges to complete
for location in ctx.checked_locations:
if location not in ctx.locations_checked:
cid = location - 5730038
old_score = await bizhawk.read(
ctx.bizhawk_ctx, [
(cid * 4 + 0x6CC8, 1, "EWRAM")]
)
# set last 2 bits to 01
old_score = old_score[0][0]
new_score = old_score & 252 | 1
await bizhawk.guarded_write(
ctx.bizhawk_ctx,[
(cid * 4 + 0x6CC8, new_score.to_bytes(1, "little"), "EWRAM"),
],
[
(cid * 4 + 0x6CC8, old_score.to_bytes(1, "little"), "EWRAM"),
]
)

# Send game clear if the fifth tier 5 campaign opponent was beaten.
if not ctx.finished_game and locations[18] & (1 << 5) != 0:
await ctx.send_msgs([{"cmd": "StatusUpdate", "status": ClientStatus.CLIENT_GOAL}])

Expand Down

0 comments on commit 83d6c46

Please sign in to comment.