McPaul
On my way to become a controversial and hated memb
- 289
- Posts
- 7
- Years
- He/ Him
- Switzerland
- Seen Apr 20, 2025
Hello! I have a rom hack project where "stat exp" as we know it doesn't exist, but they do as a kind of hyper training. You will be able to use vitamins to raise a stat to the equivalent of a DV of 15.
I already began to code something for this in engine\items\item_effects.asm in .useVitamin section. I intend to modify from the .noCarry2 part so that giving one vitamin in one sat gives it virtually a DV of 15 in that stat.
Here is what I currently made. This is not tested and I'm pretty sure it won't work but the structure is there:
And I'll continue with .dv2, .dv3, .dv4, etc. until .dv15 where vitamins won't work.
Can someone help me to make my code work please? Thanks a lot in advance!
I already began to code something for this in engine\items\item_effects.asm in .useVitamin section. I intend to modify from the .noCarry2 part so that giving one vitamin in one sat gives it virtually a DV of 15 in that stat.
Here is what I currently made. This is not tested and I'm pretty sure it won't work but the structure is there:
Code:
.dv0
ld bc, wPartyMon1DVs
ld a, 0 ; the Pokémon has a DV of 0 in the stat
ld b, 56 ; the Pokémon must gain 14336 stat experience (256 * 56) to reach the equivalent of a DV of 15
ld c, b
ld b, [hl] ; b = MSB of stat experience of the appropriate stat
cp 56 ; is there already at least 14336 (256 * 56) stat experience?
jr nc, .vitaminNoEffect ; if so, vitamins can't add any more
add c ; add 14336 (256 * 56) stat experience
jr nc, .dv1
ld b, 255
.dv1
ld bc, wPartyMon1DVs
ld a, 1 ; the Pokémon has a DV of 1 in the stat
ld b, 49 ; the Pokémon must gain 12544 stat experience (256 * 49) to reach the equivalent of a DV of 15
ld c, b
ld b, [hl] ; b = MSB of stat experience of the appropriate stat
cp 49 ; is there already at least 12544 (256 * 49) stat experience?
jr nc, .vitaminNoEffect ; if so, vitamins can't add any more
add c ; add 12544 (256 * 49) stat experience
jr nc, .dv2
ld b, 255
And I'll continue with .dv2, .dv3, .dv4, etc. until .dv15 where vitamins won't work.
Can someone help me to make my code work please? Thanks a lot in advance!