Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Part One: What precisely does wrong-pocket TM13 do?
- For the Pokemon that was last selected in the party menu (with the A Button),
- For all of that Pokemon's moves,
- Add more 'Remaining PP' equal to:
- < Move's current 'Maximum PP' (considering PP UPs) - Move's original 'Maximum PP' (ignoring PP UPs) >
- So...
- For any move with 0 PP UPs used on it:
- the 'Remaining PP' doesn't change.
- For a move that had 20 'Maximum PP', had 1 PP UP used, and now has 24 'Maximum PP':
- the 'Remaining PP' increases by 4.
- For a move that had 20 'Maximum PP', had 3 PP UPs used, and now has 32 'Maximum PP':
- the 'Remaining PP' increases by 12.
- etc.
- Note 1: This allows for a 'Remaining PP' value higher than the current allowed 'Maximum PP' value.
- Note 2: If the 'Remaining PP' goes over 63, it overflows and turns into a smaller number.
- BUT ALSO, increments* the number of PP UPs used.
- (If it was 1, it becomes 2. If it was 2, it becomes 3. If it was 3, it becomes 0.)
- ----------------------------------------------------------------------------------------------------
- Part Two: Adding notes and tracing through the code
- ApplyPPUp:
- ld a, MON_MOVES
- call GetPartyParamLocation
- push hl
- ld de, wPPUpPPBuffer
- predef FillPP
- pop hl
- ld bc, MON_PP - MON_MOVES
- add hl, bc
- ld de, wPPUpPPBuffer
- ld b, 0
- .loop
- inc b
- ld a, b
- cp NUM_MOVES + 1
- ret z ; (After <=5 loops) if we reach the end of the move list, give up and return.
- ld a, [wUsePPUp]
- dec a
- jr nz, .use ; Problem #1, wTempTMHM (wUsePPUp) is supposed to be $01 but instead it is $CC. (This happens in the function RestorePPEffect.do_ppup)
- ; Execution SHOULD fall through but it jumps to .use
- ; Comment: Why is the previous line even in the code? The ApplyPPUp function is only referenced once in the code.
- ; Perhaps earlier in development, PP-restoring items also used this code path.
- ld a, [wMenuCursorY] ; In normal execution, we check if the current 'focused' move is or isnt the one that
- inc a ; the player selected. If it isn't, then jump to .skip and loop back.
- cp b ; But if it IS, then fall through to .use
- jr nz, .skip ; But this section of code is always skipped by TM13 anyway (:
- .use
- ld a, [hl] ; Problem #2!!!
- and PP_UP_MASK ; Normally when a PP UP has been used, it adds one to the "PP UPs used"
- ld a, [de] ; counter for the given move *BEFORE* reaching this code. (This happens in the function RestorePPEffect.do_ppup)
- call nz, ComputeMaxPP ; As a result, TM13 doesn't quite work as a PP UP.
- .skip
- inc hl ; Try the next move in the list
- inc de
- jr .loop ; Loop.
- ; Fun facts / what else matters?:
- ; The last selected party Pokemon matters
- ; All of the registers do not matter (each one is overwritten before being used within this function).
- ; Note! There is another area of code that gets executed related to
- ; adding more 'Remaining PP' to a given move.
- ; Because it was easy enough to empirically observe, I have chosen not to debug that code.
- ; (I debugged this code first anyway, and this whole process has already taken 4 hours.)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement