MrDollSteak
Formerly known as 11bayerf1
- 858
- Posts
- 16
- Years
- Age 30
- Hong Kong
- Seen Aug 19, 2023
EV-enhancing items (Power Items)
Spoiler:
The routines assume that the Held Item Effect Bytes of the Power Items are in a particular order (same as that of Stat EVs in Pokemon Party Data Structure) and are consecutive.
For example, if Power Weight has Held Item Effect Byte 68, then Power Bracer will have 69, Power Belt 6A, Power Anklet 6B, Power Lens 6C and Power Band 6D.
So in the routines, you only need to specify the Held Item Effect Byte for Power Weight by replacing KK. The routine will automatically recognize other Power items.
Also I have not coded the Speed Drop, I might do it later and update the OP.
If you want to code the Speed Drop yourself, you can make a hook around the Macho Brace check for Speed Drop.
Fire Red:-
Spoiler:
Code:.text .align 2 .thumb .thumb_func add r4, r0, #0x0 /*EV of a particular stat before checking pokerus and applying EV enhancers*/ push {r2} /*Store pokerus factor*/ mov r0, r8 /*Load pokemon slot no*/ mov r1, #0xC mov r2, #0x0 bl Decrypter /* Load pokemon's item */ lsl r0, r0, #0x10 lsr r0, r0, #0x10 bl GetItemEffect /* Get Held Item's Effect Byte*/ lsl r0, r0, #0x18 lsr r0, r0, #0x18 mov r3, #0xKK add r1, r6, r3 /* Load Power Item's Effect Byte*/ pop {r2} cmp r1, r0 /*Match items*/ bne NoPowerItem /*No Power Item or No Match for that particular stat*/ add r4, r4, #0x4 /* Add Bonus 4+ EV */ mul r4, r2 /*Use pokerus multiplier*/ ldr r3, =0x080439D9 bx r3 NoPowerItem: mul r4, r2 mov r0, r8 mov r1, #0xC ldr r3, =0x08043981 bx r3 Decrypter: ldr r3, =0x0803FBE9 bx r3 GetItemEffect: ldr r1, =0x0809A925 bx r1 /*At 43978:00 49 08 47 XX+1 XX XX 08*/
Emerald:-
Spoiler:
Code:.text .align 2 .thumb .thumb_func add r4, r0, #0x0 /*EV of a particular stat before checking pokerus and applying EV enhancers*/ push {r2} /*Store pokerus factor*/ mov r0, r8 /*Load pokemon slot no*/ mov r1, #0xC mov r2, #0x0 bl Decrypter /* Load pokemon's item */ lsl r0, r0, #0x10 lsr r0, r0, #0x10 bl GetItemEffect /* Get Held Item's Effect Byte*/ lsl r0, r0, #0x18 lsr r0, r0, #0x18 mov r3, #0xKK add r1, r6, r3 /* Load Power Item's Effect Byte*/ pop {r2} /*Restore Pokerus Muliplier*/ cmp r1, r0 /*Match items*/ bne NoPowerItem /*No Power Item or No Match for that particular stat*/ add r4, r4, #0x4 /* Add B Bonus 4+ EV */ mul r4, r2 /*Use pokerus multiplier*/ ldr r3, =0x0806DC25 bx r3 NoPowerItem: mul r4, r2 mov r0, r8 mov r1, #0xC ldr r3, =0x0806DBCD bx r3 Decrypter: ldr r3, =0x0806A519 bx r3 GetItemEffect: ldr r1, =0x080D74DD bx r1 /*At 6DBC4:00 49 08 47 XX+1 XX XX 08*/
KDS to make it easier, what you should do is have the same effect as the Macho Brace, and make the individual EV enhancing items use the secondary byte as 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 etc.
That way you don't need to code the extra speed drop for each individual effect.