You are not logged in.
Pages: 1
I recently figured out how I could edit some parts of the assembly code in order to change some things.
For example I managed to locate where the Rest Sleep Turn Count is located, normally a 02 for 2 turns and I edited it successfully to last 4 turns instead.
Problem is I can't seem to edit Recover and Softboiled to heal 20% max HP instead of the usual 50%.
I thought changing the 32 at the offset $3ba16 would do but it didn't change a dang thing.
I'm scouring the aseembly code trying to match them to their hex values as I can only hex edit them due to not having a laptop or pc and only an android phone.
If anyone can help me, I'd appreciate it. Thanks in advance.
Offline
The code you're looking for is here: https://github.com/pret/pokered/blob/ma … s/heal.asm
This is the relevant snippet:
.healHP
ld a, [hld]
ld [wHPBarMaxHP], a
ld c, a
ld a, [hl]
ld [wHPBarMaxHP+1], a
ld b, a
jr z, .gotHPAmountToHeal
; Recover and Softboiled only heal for half the mon's max HP
srl b
rr c
.gotHPAmountToHeal
The amount healed is not a static amount, but is based on the mon's max HP. The max HP is put into bc and then bc is shifted to the right which means the amount healed will be equal to half the max HP.
Also note this is code is used for Softboiled too, so if you only want to change the behavior of Recover then some more modifications will be needed.
Offline
I see.
Makes sense, by shifting the bits of the loaded Max HP value to the right, you get half it's value, which makes it so recover and softboiled heals half the max value.
I read about bit shifting in basic assembly yesterday but as I'm new to learning basic assembly, I've not thought of that.
The question now is: Would it be possible to change the following line of code: [ srl b ]
[ rr c ]
………so that the value is shifted twice thus making recover heal 25% instead?
I greatly appreciate the help, thanks alot. :)
Last edited by Eonbane (2022-01-10 14:26:57)
Offline
Try replacing those two lines with either:
srl b
rr c
srl b
rr c
or:
srl c
srl c
One of those two options will hopefully work.
Offline
Unfortunately after doing some more ASM research, I find that the first option requires that the ASM be redone(and possibly recompiled which I cannot do as I'm limited to my android phone) and the second option won't work for mons that have HP Over 255 as the a combo of 'srl b' and 'rr c' work together to perform a 16 bit shift as the z80 opcode has no other way of doing a 16-bit shift.
Thanks guys I really appreciate your help I really do, but it looks like I'll ax my plans to nerf Recover and Softboiled, for now at least.
Cheers!! :)
Anyways
Offline
If you must hex edit your hack instead of rebuilding the source code, you can always edit the routine to jump to some free space at the end of the bank and add the new (longer) code there
Offline
Pages: 1