Skip to content

Commit 0fac7fb

Browse files
committed
swapping a certain item should adjust a certain form
wording this awkwardly so ppl dont get mad about spoilers. it's about armored mewtwo and it fixes #1132
1 parent 8ec0fb8 commit 0fac7fb

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

engine/pokemon/mon_menu.asm

+24-8
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ PCGiveItem:
375375
SwapPartyItem:
376376
ld a, [wPartyCount]
377377
cp 2
378-
jr c, .DontSwap
378+
jmp c, .DontSwap
379379
ld a, [wCurPartyMon]
380380
inc a
381381
ld [wSwitchMon], a
@@ -407,11 +407,11 @@ SwapPartyItem:
407407
; First, swap mail metadata. Don't bother checking if we are holding Mail,
408408
; doing the swap either way is harmless and simplifies checks.
409409
; Note that wCurPartyMon is 0-indexed while wSwitchMon is 1-indexed.
410-
push bc
411-
push de
412410
ld a, [wCurPartyMon]
413-
inc a
414411
ld c, a
412+
push bc
413+
push de
414+
inc c
415415
ld a, [wSwitchMon]
416416
ld e, a
417417
farcall SwapPartyMonMail
@@ -422,22 +422,38 @@ SwapPartyItem:
422422
; wCurPartyMon contains second selected pkmn
423423
; getting pkmn2 item and putting into stack item addr + item id
424424
call GetPartyItemLocation
425-
ld a, [hl] ; a pkmn2 contains item
425+
ld a, [hl] ; a contains pkmn2 item
426426
push hl
427427
push af
428428
; getting pkmn 1 item and putting item id into b
429429
ld a, [wSwitchMon]
430430
dec a
431431
ld [wCurPartyMon], a
432432
call GetPartyItemLocation
433-
ld a, [hl] ; a pkmn1 contains item
433+
ld a, [hl] ; a contains pkmn1 item
434434
ld b, a
435435
; actual swap
436436
pop af
437-
ld [hl], a ; pkmn1 get pkm2 item
437+
ld [hl], a ; pkmn1 get pkmn2 item
438+
xor a ; ld a, MON_SPECIES
439+
push hl
440+
call GetPartyParamLocationAndValue
441+
pop hl
442+
ld [wCurPartySpecies], a ; load pkmn1 species
443+
push bc
444+
call UpdateMewtwoForm
445+
pop bc
438446
pop hl
439447
ld a, b
440-
ld [hl], a ; pkmn1 get pkm2 item
448+
ld [hl], a ; pkmn2 get pkmn1 item
449+
ld a, c
450+
ld [wCurPartyMon], a ; restore pkmn2
451+
xor a ; ld a, MON_SPECIES
452+
push hl
453+
call GetPartyParamLocationAndValue
454+
pop hl
455+
ld [wCurPartySpecies], a ; load pkmn2 species
456+
call UpdateMewtwoForm
441457
xor a
442458
ld [wPartyMenuActionText], a
443459
jmp CancelPokemonAction

0 commit comments

Comments
 (0)