EV-enhancing items (Power Items)


Spoiler:


The routine now does not require any new Held Effect Item Byte. The new power items are tied to Macho Brace's Held Item Effect Byte. (Thanks to MrDollSteak for giving the idea.)
The type of EV gain is now differentiated by the Second Held Effect Byte (the byte just after the Primary Held Effect Byte in the Item Table).
There is no need to code the Speed Drop explicitly for Power Items.

Usage is now like this by using the following parameters in the Item Table:
Primary Byte | Secondary Byte | Item Name
0x18 | 0x0 | Macho Brace
0x18 | 0x1 | Power Weight
0x18 | 0x2 | Power Bracer
0x18 | 0x3 | Power Belt
0x18 | 0x4 | Power Anklet
0x18 | 0x5 | Power Lens
0x18 | 0x6 | Power Band

Also, there are additional byte changes mentioned in the Spoiler to limit the EVs for each stat from 255 to 252 to avoid wastage of EVs by normal battling.

Fire Red:-
Spoiler:

.text
.align 2
.thumb
.thumb_func

Main:
    push {r2}
    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
    pop {r2} /* Restore Pokerus Factor*/
    cmp r0, #0xAF
    beq EnigmaBerry
    add r3, r0, #0x0
    bl GetItemEffect /* Get Held Item's Effect Byte*/
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x18
    bne NoPowerItem
    add r0, r3, #0x0
    bl GetSecondEffectByte
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x0
    beq MachoBrace
    add r1, r6, #0x1 /*Load a Power Item's Secondary Effect Byte*/
    cmp r1, r0 /*Match items*/ 
    bne NoPowerItem /*No Power Item or No Match for that particular stat*/
    lsl r2, r2, #0x2
    add r4, r4, r2 /* Add 4 EVs or 8 (due to Pokerus) */
NoPowerItem:    
    ldr r3, =0x080439D9
    bx r3

EnigmaBerry:
    ldr r3, =0x0804398F
    bx r3

MachoBrace:
    ldr r3, =0x080439D5
    bx r3

Decrypter:
    ldr r3, =0x0803FBE9
    bx r3

GetItemEffect:
    ldr r1, =0x0809A925
    bx r1

GetSecondEffectByte:
    ldr r1, =0x0809A949
    bx r1

/*At 43978: 04 1C 54 43 00 49 08 47 XX+1 XX XX 08 00 00 00 00 00 00 00 00 00 00*/
/*At 439FC && 43A02: FC to limit EV growth for each stat to 252 */


Emerald:-
Spoiler:

.text
.align 2
.thumb
.thumb_func

Main:
    push {r2}
    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
    pop {r2} /* Restore Pokerus Factor*/
    cmp r0, #0xAF
    beq EnigmaBerry
    add r3, r0, #0x0
    bl GetItemEffect /* Get Held Item's Effect Byte*/
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x18
    bne NoPowerItem
    add r0, r3, #0x0
    bl GetSecondEffectByte
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x0
    beq MachoBrace
    add r1, r6, #0x1 /*Load a Power Item's Secondary Effect Byte*/
    cmp r1, r0 /*Match items*/ 
    bne NoPowerItem /*No Power Item or No Match for that particular stat*/
    lsl r2, r2, #0x2
    add r4, r4, r2 /* Add 4 EVs or 8 (due to Pokerus) */
NoPowerItem:    
    ldr r3, =0x0806DC25
    bx r3

EnigmaBerry:
    ldr r3, =0x0806DBDB
    bx r3

MachoBrace:
    ldr r3, =0x0806DC21
    bx r3

Decrypter:
    ldr r3, =0x0806A519
    bx r3

GetItemEffect:
    ldr r1, =0x080D74DD
    bx r1

GetSecondEffectByte:
    ldr r1, =0x080D7501
    bx r1

/*At 6DBC4: 04 1C 54 43 00 49 08 47 XX+1 XX XX 08 00 00 00 00 00 00 00 00 00 00*/
/*At 6DC48 && 6DC4E: FC to limit EV growth for each stat to 252 */