Battle Arena Mechanics

  • Thread starter Thread starter nfitc1
  • Start date Start date
Status
Not open for further replies.
N

nfitc1

Guest
While I was looking for the location to adjust the stat cap limitation, I stumbled across what I believe to be the Battle Arena slot effects. I've identified most of them, but some of their effects still elude me. These are the slot effects I've discovered so far:

BreakAllMateria
RemoveAccessory
HalfSpeed (really half dex)
BreakMateria2
BreakMateria4
BreakMateria8
Timex30Damage (see second reply)
Down5Levels
Down10Levels
HalveMaxHP
HalveMaxMP
HalveMaxHPMP
EmptyMP
BreakMateria10
BreakMateria20

The break materia is part of a group of materia that just doesn't get allowed in battle. I'm not sure if it removes them or not. I'm not sure what materia fits into which category either. It looks like the game chooses from an array of 24 values as follows:

00 00 00 00 0E 01 00 00 0E 02 0E 0E 06 05 04 03 0A 09 08 07 0D 0E 0C 0B

From this list it determines which slot to bring up. Another one of those pseudo-random things. It doesn't even chose BreakMateria20 if the value is 0E. At least, not directly. 0E points to a loop that has BreakMateria20 in it.

Now if you look carefully, this leaves out eight slots:

Poison
Toad
Mini
Seal Items
Lucky 7
Weapon broken
Armor broken
RestoreHP

Needless to say I'm quite confused. Can someone tell me where these slots are handled?

I looked at the text in the arena and these are the results of the slots:

00 "Magic Materia is broken"
01 "Summon Materia is broken"
02 "Support Materia is broken"
03 "Independant Materia is broken"
04 "Command Materia is broken"
05 "All Materia is broken"
06 "Accessory is broken"
07 "Item command is sealed"
08 "Armor is broken"
09 "Weapon is broken"
0A "1/2 Speed"
0B "1/2 accuracy"
0C "Minimum"
0D "Poison"
0E "Toad"
0F "Time X30 Damage"
10 "Down 5 levels"
11 "Down 10 levels"
12 "1/2 HP"
13 "1/2 MP"
14 "1/2 HP&MP"
15 "Zero MP"
16 "Yesss!  No handicapp! [sic]"
17 "HP restored"

Look at 0B! I don't remember seeing that in the arena before.
 
Last edited:
Sounds to me as though 'Full HP restore' is 'invoked' at the end of the battle, when HP/MP is reset and BP is calculated. Just an idea.
 
That thought had occurred to me, but it doesn't look like it because MP isn't reset either. Now that I'm actually looking at it it's actually the time x30 damage that I didn't identify earlier.

Here's the function of that particular slot:

Code: [Select]
Code:
Slot6   CurrentHP = CurrentHP - SomeLimitFunction(0x00DC08B8) * 30; //we'll assume this is the address for game timer. It's passed by value.dword (SomeLimitFunction(dword time){   dword some_var;   if (time >= 360000 )  //this is 100 hours in seconds.      time = 359999;     // 99:59:59 which happens to be the game's max   some_var = ((time / 41100); //11:25:00; No remainders. Max result of 8   some_var = some_var * 10;  // some_var is now, at most, 80.   time = (time mod 41100); //it was passed by value so this doesn't really change anything. No remainders. Max of 9   some_var = (time / 4110) + some_var; //some_var is max of 89.   return some_var;}
So if I'm reading the code right, the max damage is 89 * 30 = 2670

boils down to:

damage = 30 * [(10 * time / 11:25) + ((time MOD 11:25) / 1:08:30)]

That's almost 30 damage for every 1:08:30 of game time.


So Full Cure is still out there.
 
A few things:

It looks like the game chooses from an array of 24 values as follows:

00 00 00 00 0E 01 00 00 0E 02 0E 0E 06 05 04 03 0A 09 08 07 0D 0E 0C 0B
You're reversing each dword.  It should be: 00 00 00 00 00 00 01 0E 0E 0E 02 0E 03 04 05 06 07 08 09 0A 0B 0C 0E 0D

And anything marked 0E is skipped at this point: it uses a further array that covers only those values later.  All the Break Materia routines are under 00, anyways.

Now if you look carefully, this leaves out eight slots:

Poison
Toad
Mini
Seal Items
Lucky 7
Weapon broken
Armor broken
RestoreHP

Needless to say I'm quite confused. Can someone tell me where these slots are handled?
Lucky 7 simply never does anything.  Weapon and Armor Broken are set up in the second list of routines, and simply halve your Att or Def (they don't touch your equipment).  The rest simply set bits in 00DC3BA0 which is handled sometime later: I'm not entirely sure when.

Look at 0B! I don't remember seeing that in the arena before.
That's because it can never be called.  FF7 instead has a table of 128 different reel variations, one of which is chosen at "random" (or rather, it just takes the current time and mods it by 128, and that's the reel set it uses) when this run of the battle arena begins.  Each reel variation has all 21 possible disadvantages over the 7 reels that will be used for the upcoming series of battles, as well as their associated BP bonuses.  0B is not used for any one of them.

The full table's in the 2nd file in co.bin, in case you're interested.

Code: [Select]
Code:
dword (SomeLimitFunction(dword time){   dword some_var;   if (time >= 360000 )  //this is 100 hours in seconds.      time = 359999;     // 99:59:59 which happens to be the game's max   some_var = ((time / 41100); //11:25:00; No remainders. Max result of 8   some_var = some_var * 10;  // some_var is now, at most, 80.   time = (time mod 41100); //it was passed by value so this doesn't really change anything. No remainders. Max of 9   some_var = (time / 4110) + some_var; //some_var is max of 89.   return some_var;}
Once again, you're reversing your words.  It's 0x8CA0, not 0xA08C.
 
:O !!!!

Terence, you're.....ALIVE!!! :O


You are correct that I'm reversing my DWords. I was getting overzealous and didn't remember that my debugger already formatted them correctly. All that does, really, is change the time interval from 1 damage per 1:08:30 to 1 damage per 1:00:00 which makes a LOT more sense.

Code: [Select]
Code:
Slot6   CurrentHP = CurrentHP - SomeLimitFunction(0x00DC08B8) * 30; //we'll assume this is the address for game timer. It's passed by value.dword (SomeLimitFunction(dword time){   dword some_var;   if (time >= 360000 )  //this is 100 hours in seconds.      time = 359999;     // 99:59:59 which happens to be the game's max   some_var = ((time / 36000); //11:25:00; No remainders. Max result of 8   some_var = some_var * 10;  // some_var is now, at most, 90.   time = (time mod 36000); //it was passed by value so this doesn't really change anything. No remainders. Max of 9   some_var = (time / 3600) + some_var; //some_var is max of 99.   return some_var;}
It looks like the game chooses from an array of 24 values as follows:

00 00 00 00 0E 01 00 00 0E 02 0E 0E 06 05 04 03 0A 09 08 07 0D 0E 0C 0B
You're reversing each dword.  It should be: 00 00 00 00 00 00 01 0E 0E 0E 02 0E 03 04 05 06 07 08 09 0A 0B 0C 0E 0D

And anything marked 0E is skipped at this point: it uses a further array that covers only those values later.  All the Break Materia routines are under 00, anyways.
I didn't know these were dwords, actually, and just read them as plain bytes. ;)

Look at 0B! I don't remember seeing that in the arena before.
That's because it can never be called.  FF7 instead has a table of 128 different reel variations, one of which is chosen at "random" (or rather, it just takes the current time and mods it by 128, and that's the reel set it uses) when this run of the battle arena begins.  Each reel variation has all 21 possible disadvantages over the 7 reels that will be used for the upcoming series of battles, as well as their associated BP bonuses.  0B is not used for any one of them.

The full table's in the 2nd file in co.bin, in case you're interested.
I am! I think I'll check that out.

Now if you look carefully, this leaves out eight slots:

Poison
Toad
Mini
Seal Items
Lucky 7
Weapon broken
Armor broken
RestoreHP

Needless to say I'm quite confused. Can someone tell me where these slots are handled?
Lucky 7 simply never does anything.  Weapon and Armor Broken are set up in the second list of routines, and simply halve your Att or Def (they don't touch your equipment).  The rest simply set bits in 00DC3BA0 which is handled sometime later: I'm not entirely sure when.
I imagined that Lucky 7 would have just not executed any code. But my personal practice is to leave blank things like that at the end of a list of choices. I gotta stop thinking like I'm writing this, I guess. :)
It seems to me that RestoreHP queues an attack that gets performed on the player at the beginning of the next battle. I don't know where the data for this attack is. Might be in the first file of co.bin. I'll check that out too.
 
You're reversing each dword.  It should be: 00 00 00 00 00 00 01 0E 0E 0E 02 0E 03 04 05 06 07 08 09 0A 0B 0C 0E 0D

And anything marked 0E is skipped at this point: it uses a further array that covers only those values later.  All the Break Materia routines are under 00, anyways.
I didn't know these were dwords, actually, and just read them as plain bytes. ;)
They aren't dwords: I'm just predicting what your debugger/disassembler was doing when you were reading this code.  A hex editor used on FF7.exe confirms that they're in the order I stated, when taken as an array of bytes (which is exactly how FF7 reads them in this case).
 
I get'cha.

One question regarding co.bin. I'm looking at the second file and it's all easy enough stuff to read (the first file just looks like a graphic of some sort). 384 rows of seven values of BP and slot index. Does the mechanics pick an slot config based on three rows at a time or something more complicated than that?

Ex.
Battle Arena wants slot config 100. Does it take from rows at 0x20D0, 0x20EC, 0x2108 (consecutive rows) or from 0x0AF0, 0x15E0, 0x20D0 (correlated rows) or something like that?
 
One question regarding co.bin. I'm looking at the second file and it's all easy enough stuff to read (the first file just looks like a graphic of some sort). 384 rows of seven values of BP and slot index. Does the mechanics pick an slot config based on three rows at a time or something more complicated than that?

Ex.
Battle Arena wants slot config 100. Does it take from rows at 0x20D0, 0x20EC, 0x2108 (consecutive rows) or from 0x0AF0, 0x15E0, 0x20D0 (correlated rows) or something like that?
Consecutive.  The code for, say, calculating earned BP is at 006E37A3, and that should demonstrate how FF7 expects the data to be laid out.
 
So thanks to Terence Fergusson, I believe I've constructed a definitive list of BP values for various slots at different stages. I have a pretty large spreadsheet of slot combinations that's too large to print here. But I will share the BP values for the various results:

So far, the one on GFAQs (the one that's almost to-the-day eleven years old!) states the listing is thus:

Code: [Select]
Code:
        Handicap:      1      2      3      4      5      6      7  Break Accessory  --  10  -  18  -  X   -  X   -  X    - X    - XBreak All Materia  --  X   -  X   -  X   -  X   -  463  - X    - 10000      Break Armor  --  X   -  17  -  33  -  X   -  X    - 654  - X    Break Command  --  X   -  X   -  17  -  41  -  X    - X    - X   Down 10 Levels  --  X   -  16  -  28  -  53  -  118  - 308  - 968    Down 5 Levels  --  5   -  8   -  13  -  X   -  X    - X    - X             Toad  --  6   -  10  -  19  -  44  -  130  - 520  - 3069       Restore HP  --  1   -  1   -  1   -  1   -  1    - 1    - 1           1/2 HP  --  13  -  X   -  40  -  84  -  204  - X    - X        1/2 HP&MP  --  X   -  X   -  X   -  94  -  244  - 775  - 3134           1/2 MP  --  12  -  20  -  36  -  73  -  173  - X    - X        1/2 Speed  --  5   -  7   -  X   -  19  -  X    - X    - XBreak Independent  --  X   -  X   -  X   -  99  -  X    - X    - X       Seal Items  --  X   -  X   -  X   -  X   -  355  - 1368 - 7200      No Handicap  --  7   -  7   -  7   -  7   -  7    - 7    - 7      Break Magic  --  15  -  28  -  X   -  145 -  445  - 1755 - 9425          Minimum  --  5   -  8   -  16  -  36  -  108  - 453  - 2940           Poison  --  4   -  6   -  X   -  16  -  33   - 82   - X     Break Summon  --  37  -  X   -  X   -  X   -  X    - X    - X    Break Support  --  X   -  X   -  X   -  91  -  X    - X    - X  Time X30 Damage  --  X   -  X   -  26  -  54  -  130  - X    - X     Break Weapon  --  X   -  X   -  X   -  140 -  X    - X    - X          Zero MP  --  X   -  X   -  X   -  X   -  171  - 502  - X
I only reordered his to fit the order of mine, which looks like this:

Code: [Select]
Code:
   1 2 3 4 5 6 7Accessory Broken  10  18  35  84  248  953  XAll Materia Broken  X X 59  X 463  1866  10000 Armor Broken   X 17  33  X X 654  XCommand Materia Broken  5  8  17  41  X X XDown 10 levels   X 16  28  53  118  308  968 Down 5 Levels   5  8  13  X X X XFrog    6  10  19  44  130  520  3069 FullCure   1  1  1  1  1  1  1 Half HP   13  22  40  84  204  591  XHalf HP&MP   X X 43  94  244  775  3134 Half MP   12  20  36  73  173  485  XHalf Speed   5  7  48  19  X X XIndep. Materia Broken  11  20  X 99  301  1196  6645 Item Broken   13  23  X 118  355  1368  7201 Lucky 7   7  7  7  7  7  7  XMagic Materia Broken  15  28  X 145  445  1755  9425 Mini    5  8  16  36  108  453  2940 Poison    4  6  X 16  33  82  XSummon Materia Broken  10  18  37  90  281  X XSupport Materia Broken  X X 37  91  X X XTime Damage   X 15  26  54  130  379  1401 Weapon Broken   15  27  57  140  171  1602  8246 Zero MP   11  X X 70  X 502  1855
Several values have been filled in and some that were in the wrong place are now correct. It does seem that the minimum BP for all seven rounds is 7 (there are a few that have a full cure available after every battle) and the max is just over 12.5K (breaking nothing but materia and "break all" after battles six AND seven).

I've actually had this list for a while but got lazy with the formatting of it. Now if only I could figure out how to display the graphics (looks like there are 25  16x32p pictures in one image file of 80x160p) in the first file of co.bin and the other data in it I'd be in business. I might even make another editor ("Dio" :) ) that allows the editing of the slot reels and maybe replacement of the images.
 
Images can be replaced right now on the slots. I have done it.
Are they in that first file in co.bin? What's the format of that header? So far all I recognize is the first two dwords being dimensions / 10. There's bound to be palette info in there too, but I don't have the tools to analyze it.
 
Status
Not open for further replies.
Back
Top