# Plan 6 Task 4: a ball catches the LAST wild Pokémon whichever slot it is in: foe 1 is down (absent, 0 HP), foe 3 sleeps with 1 HP, and the HOST's
# ball (which the game aims at foe 1) catches foe 3: the master retargets it (link_entry_BALLTHROW). link_catch_host's twin; same checks:
# ball -1 in the host's bag only, outcome 7 on both cores, the catch (a POOCHYENA this time) given to the host's own game after the battle.
#
#
# want: PASS linkwait 2
# want: PASS linkwait 3
# want: link: caught by 1
# want: PASS expectdelta a_ball -> a_ball2 = -1
# want: PASS expectdelta b_ball -> b_ball2 = 0
# want: PASS expectnum a_out = 7
# want: PASS expectnum b_out = 7
# want: PASS expectnum a_count2 = 4
# want: PASS expectnum b_count2 = 3
# want: PASS expectnum b_slot3b = 0
# want: PASS expectmon 02024618
# want: PASS expectotname 02024618
pair $PARTNER_SAVE
on b
@boot
poke16 0x02024542 999
poke16 0x02024544 999
bagqty b_ball 4
on a
poke16 0x02024542 999
poke16 0x02024544 999
bagqty a_ball 4
coopbegin 1 2 333 318
on b
coopbegin 0 2 333 318
linkwait 2 1500
on a
waitmem32 0x03005D60 0x08057589 3000
poke32 0x02022FEC 0x800163
poke8 0x02024210 2
poke16 0x02024104 0
poke16 0x0202479A 0
poke32 0x020241D8 7
poke16 0x020241B4 1
on b
waitmem32 0x03005D68 0x08057589 3000
poke16 0x0202479A 0
poke32 0x02022FEC 0x800163
hold A 4
linkrun 40
hold A 4
linkrun 40
hold A 4
linkrun 40
on a
hold RIGHT 4
linkrun 30
hold A 4
linkrun 120
hold RIGHT 4
linkrun 30
hold A 4
linkrun 30
hold A 4
linkrun 100
hold A 4
linkrun 100
linkrun 800
hold B 4
linkrun 60
hold B 4
linkrun 60
linkwait 3 4000
bagqty a_ball2 4
peeknum a_out 0x0202433A 1
expectnum a_out 7
linkcaught /work/caught_host_far.bin
on b
bagqty b_ball2 4
peeknum b_out 0x0202433A 1
expectnum b_out 7
linkreset
on a
linkreset
waitmem32 0x030022C4 0x08085E5D 4000
on b
waitmem32 0x030022C4 0x08085E5D 4000
peeknum b_count2 0x020244E9 1
expectnum b_count2 3
monexp b_slot3b 0x02024618
expectnum b_slot3b 0
on a
linkrun 200
coopgive /work/caught_host_far.bin
linkrun 5
peeknum a_count2 0x020244E9 1
expectnum a_count2 4
expectmon 0x02024618 own 286 own
expectotname 0x02024618
expectdelta a_ball a_ball2 -1
expectdelta b_ball b_ball2 0
