• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Battle] Removing badge stat boosts in FireRed

14
Posts
11
Years
  • Hey everyone!

    I'm making a harder version (partially inspired from Crystal_'s Pok?mon Pyrite) of FireRed and one of its features is the removal of stat boosts granted by badges. All I've found is a post referencing flag checks which didn't really help me, but is there a script or another way to remove these boosts?
     
    239
    Posts
    8
    Years
    • Seen Apr 15, 2024
    Hey everyone!

    I'm making a harder version (partially inspired from Crystal_'s Pok?mon Pyrite) of FireRed and one of its features is the removal of stat boosts granted by badges. All I've found is a post referencing flag checks which didn't really help me, but is there a script or another way to remove these boosts?

    Unfortunately this would require assembly hacking. You would need to edit the battle engine routines to skip the flag checks / automatically jump to the portion of the routine as if the badge flag were never set.

    For starters, Mr. Dollsteak had rewritten the turn order loader routine which includes the relevant badge check. Removing the badge check would simply require removing the BadgeCheck portion, like so:

    Code:
    ChoiceScarfCheck:
    	cmp r0, #0x1D
    	bne StatusCheck
    	bl 0x9A948
    	lsl r0, r0, #0x18
    	lsl r0, r0, #0x18
    	cmp r0, #0x2
    	bne StatusCheck
    	lsr r0, r5, #0x1
    	add r5, r0, r5
    
    StatusCheck:
    	ldr r0, [r6, #0x4c]
    	add r6, #0x20
    	ldrb r1, [r6, #0x0]
    	cmp r1, #0x9B
    	bne ParalysisCheck


    The attack and defense boosts would likely be found in the base damage calculation function, or battle command 0x5 (starting at 0x0801E59C)
     
    14
    Posts
    11
    Years
  • Thanks for your answer. I'm a beginner in ASM and I only know hex editing at small scale and inserting existing routines (also, battle commands?). I'm currently reading a few ASM tutorials. Still, even if I learn ASM, is there a way to find out when the function is called in-game with an emulator? (I'm using mGBA)
     
    Last edited:
    239
    Posts
    8
    Years
    • Seen Apr 15, 2024
    Thanks for your answer. I'm a beginner in ASM and I only know hex editing at small scale and inserting existing routines (also, battle commands?). I'm currently reading a few ASM tutorials. Still, even if I learn ASM, is there a way to find out when the function is called in-game with an emulator? (I'm using mGBA)

    battle commands are called by the battle engine when you use a move in battle. Every damaging move will call the damage calculation commands within 'battle scripts,' which are essentially just strings of battle commands for move effects, between-turn effects, etc. You can use VBA-SDL-H or IDA Pro to see where the game is calling certain functions. FBI's ASM tutorials teach you how to use the former. But that shouldn't be necessary, I've given you the address of the basic damage calculation function (0801E59C). If you open the disassembler tool in VBA, or use IDA Pro you can view the assembly code of this function and you will likely find the badge flag checks. Then it 's just a matter of writing your own assembly routine to skip the checks.
     
    14
    Posts
    11
    Years
  • After learning ASM and studying the battle function and MDS's speed routine, I've made significant progress.

    I've found the badge-relevant subroutines starting at 0x3EE10 for attack/defense stats (0x3EE10 for Attack, 0x3EE44 for Defense, 0x3EE7A for Special Attack, and 0x3EEB2 for Special Defense) and two subroutines for Speed at 0x14E08 and 0x14EF0. They all have similar bodies, notably a "beq" instruction happening four lines after the loading into r0 of a badge flag (Boulder Badge: 0x820, Soul Badge: 0x824, Volcano Badge: 0x826, Thunder Badge: 0x822). That "beq" never branches if you have the badge, and always branches without it. I need to study further the register values, but it could be done with simple hex editing. As all six branches compare r0 with 0, just setting r0 to 0 (= 00 20 in hex) before the comparisons (instead of a left shift) should do the trick. The locations of the left shifts which must be replaced are 0x3EE24, 0x3EE56, 0x3EE8C, 0x3EEC4, 0x14E1A and 0x14F02.
     
    Last edited:
    Back
    Top