[FE8] Could I get some help tapping into the battle routine?

For a while now I’ve been working on an FE8 rebalance that would address some of the core issues I have with the game, but eventually it kind of turned into a full on overhaul of the entire game. I wanted it to be FE8, but a fresh experience at the same time, with new features and mechanics (nothing crazy) to help it feel very distinct from the vanilla game. Such features include:

-Equipment a la Final Fantasy (done, working on balance)
-Splitting Anima into 3 types (done, just need to apply weapon locks)
-Rebalanced characters (in progress, but happy so far)
-Personal caps/class variations for each character (done)
-Difficulty that exists (I like to think I’m doing alright)
-A myriad of other balancing changes (in progress)
-Many new items (mostly implemented/can be easily added)
-More talk events (in progress, can be easily added)
-Talk events/special events that give items/stat boosts (done, still adding more where appropriate)
-Anti-loltowergrinding measures (because I’m a dick like that)
-Special skirmishes that would yield rare/unique items
-A partridge in a pear tree

Unfortunately, my ROM and several back-up files imploded a few months back (my only guess is some kind of hard drive failure), but I’ve been thinking about getting back into it. My problem is that for some of the final changes I wanted to make, to give the hack that ‘little extra’ are beyond my grasp. I’m not completely helpless when it comes to ASM, but I remember racking my brain for quite a while and not making any significant headway on this front. Basically, I’m trying to change a few formulas in a few specific circumstances, but I couldn’t narrow down the point in the routine I need to branch from.

To give you an idea, I was trying to do the following, specifically.

-Bows deal damage equal to [STR+SKL]/2 before subtracting defense
-Knives (piggybacking off sword rank, if you’re wondering) deal damage equal to [STR+SPD]/2 before subtracting defense
-RES for Magic Swords
-RES for Healing (this is the odd man out, not needed but would be nice)

Additionally, I’d planned to create a few spells, one for Wind Mages (the annoying class) and one for Fire Mages (the magic nuke class). Both spells would deal fixed damage, with the wind spell dealing MAG/2, and the fire spell dealing Current HP-1, User HP set to 1 after battle. Why yes, the enemy will have access to that as well. Now, I do have a fairly good idea about how I’d go about coding that thanks to the great documentation on FE7 and some pointers I received a while back on this forum, but again, I don’t know where that damage routine is calculated in FE8.

Now, let me be clear. I’m definitely not asking for anyone to come along and do all that for me. I know that most, if not all of those things bar the healing porting will be branching out from the same point. I am fairly confident in my ability to add the various checks that would need to be added for these items/formulas, though admittedly it might take a while haha. What I am asking, however, is that if anyone knows where exactly in FE8 damage is calculated, or is willing to help me find out, please shoot me a message. I’ve wanted to dive back into hacking for a while, but there’s no sense in trying to balance if I don’t even have my mechanics sorted out. It should go without saying, but any help would of course be credited fully in any full release. Thanks guys.

This may be relevant:

0802A95C B530     push    r4,r5,r14                               ;18 238
0802A95E 1C04     mov     r4,r0                                   ;2  240 @attacker's data in r4
0802A960 1C0D     mov     r5,r1                                   ;2  242 @defender's data in r5
0802A962 F000F86F bl      802AA44h                                ;10 252 @get def/res and store
0802A966 1C20     mov     r0,r4                                   ;2  254
0802A968 1C29     mov     r1,r5                                   ;2  256
0802A96A F000F8A7 bl      802AABCh                                ;10 266 @calculate power (include effectiveness/WTA)
0802A96E 1C20     mov     r0,r4                                   ;2  268
0802A970 F000F900 bl      802AB74h                                ;10 278 @get AS from wt and con
0802A974 1C20     mov     r0,r4                                   ;2  280
0802A976 F000F919 bl      802ABACh                                ;10 290 @calculate hit
0802A97A 1C20     mov     r0,r4                                   ;2  292
0802A97C F000F932 bl      802ABE4h                                ;10 302 @calculate avo
0802A980 1C20     mov     r0,r4                                   ;2  304
0802A982 F000F949 bl      802AC18h                                ;10 314 @calculate crit
0802A986 1C20     mov     r0,r4                                   ;2  316
0802A988 F000F964 bl      802AC54h                                ;10 326 @calculate dodge
0802A98C 1C20     mov     r0,r4                                   ;2  328
0802A98E 1C29     mov     r1,r5                                   ;2  330
0802A990 F000F81E bl      802A9D0h                                ;10 340 @calculate support bonuses...?
0802A994 1C20     mov     r0,r4                                   ;2  342
0802A996 F000F9DD bl      802AD54h                                ;10 352 @S rank bonus
0802A99A 1C20     mov     r0,r4                                   ;2  354
0802A99C F000F9F8 bl      802AD90h                                ;10 364 @status effect
0802A9A0 BC30     pop     r4,r5                                   ;13 377
0802A9A2 BC01     pop     r0                                      ;9  386

This is called by 802a398 for pre-battle
802b278 is the pierce skill check, called by 802b3ec which itself is called by 802b018??

I think it follows the same sequence as the FE7 calculations (with a few additions, such as hard-coded checks for Stone).

1 Like

Funnily enough, I’ve been moving all the battle calculations today. I found this to be very helpful in what I’ve been doing.

At the bottom, it tells you the offsets of where all the different things are calculated, and at the top it gives a pretty detailed explaination of what each thing does. Based on what I know, I could probably do all but the RES for healing (Given I don’t think it branches from the same place).

This is the main battle stat computation routine for FE8:

There’s some other doc if you look around the Unified FE Hacking Doc, like this folder in CC’s one:

And finally I have a FE8 battle calculations loop hack floating around somewhere in the dropbox that lets you add new calculation routines easily.

1 Like

This is some great information, thanks everyone!

This is done, in FE7 at least. It should be easy to retrace the steps and get it done in FE8 as well.

It’s not in the same place as damage; it’s within the healing routines.