Editing Damage Formulas

  • Thread starter Thread starter Sega Chief
  • Start date Start date
Status
Not open for further replies.
You left out Spirit, btw. In the vanilla game that's all that influences MEvade.

Here's how I think it should be:
Code: [Select]
Code:
Strength = Base + LvBonus + PowerSourceAttack = Strength + MateriaBonus + WepArmAccBonus* + WeaponStrength
*I just call this "EquipBonus"

This way the "Primary" stat never decreases and it's Attack that fluctuates.

They probably shouldn't be referred to as "Primary/Secondary" stats, however. That implies (to me) they're all separate stats from each other. I've always called them "Base/Final" stats, but that's just me.
Hmmm... no, that's "Intellect" and it affects Magic def. Magic Evade is entirely from Armour.
 
Last edited:
Hey, NFITC1... I went into the Physical Accuracy thing  a little but ran into a problem.  Also cross checked the assembly with terence guide
http://www.gamefaqs.com/ps/197341-final-fantasy-vii/faqs/22395

5DDBB0

 Any of the following will give an automatic 255 Hit%:
  * Back Attacking an enemy
   * Using an Element that the target has Death Weakness to
   * Using an Element that the target has Auto Hit Weakness to
   * Using an Element that the target is Immune to
   * Using an Element that the target Absorbs
   * If the target has any of the following statuses:
        Death, Sleep, Confusion, Stop, Petrify, Manipulate, Paralysed
   * If the target is Covering someone

Code: [Select]
Code:
5DDD38Hit% = ([Attacker's Dex / 4] 5DDD47+ At%) UNSURE.  Also unsure why there are more divisions by 4 in function immediately after.+ Attacker's Df% - Target's Df%
Code: [Select]
Code:
5DDD8E(If Fury status)Hit% = Hit% - [Hit% * 3 / 10]


Code: [Select]
Code:
5DDD9F if (Hit% < 1) then Hit% = 1
Code: [Select]
Code:
5DDDDBif Random (0..99) < (Attacker'sLuck / 4) then Hit% = 255 (Lucky Hit)
Code: [Select]
Code:
5DDE22 (uses same random number as above. Will only reach this stage if enemy does not get a Lucky Hit.  only characters can Lucky Evade.)if Random(0..99) < (CharacterLuck / 4) then Hit% = 0 (Lucky Evade )
Code: [Select]
Code:
5DDE29Random = [Rnd(0..65535) * 99 / 65535] + 1
Code: [Select]
Code:
5DDE37If (Random < Hit%) Then Attack Hits
1. Need to know which part deals with the UNSURE part...
2. compiler mistake 5DDD2C (mov [ebp-10],eax and then mov eax,[ebp-10])??
3. why "and edx,03" at 5DDD33

Also Magic Accuracy:

          if target's M_Evade > rand_0 OR
                acc + acc_bonus < rand_1 then
is this

          if target's M_Evade > rand_0 OR
                acc + acc_bonus > rand_1 then
 
Last edited:
1. Need to know which part deals with the UNSURE part...
I've got this listed as
Code: [Select]
Code:
Actor Dex + Action Acc%
2. compiler mistake 5DDD2C (mov [ebp-10],eax and then mov eax,[ebp-10])??
Mistake? I don't know if I'd go that far. Unoptimized certainly, but you won't get better than that from a compiler.

3. why "and edx,03" at 5DDD33
That has to do with the cdq command immediately preceding that line. It's attempting to change the scope of the value that comes out of the function at 0x5C7EB3. I've got documentation on what that means and why it's done, but I've actually never read it. :P

Also Magic Accuracy:

is this

          if target's M_Evade > rand_0 OR
                acc + acc_bonus > rand_1 then
Neither. It's actually:
Code: [Select]
Code:
If target's M_Evade > rand_0 then   GOTO Action Missif acc + acc_bonus > rand_1 then   GOTO Check CompleteACTION MISS:   Action missesCHECK COMPLETE:Return
If the target's M_Evade is high enough then the action misses. If that check fails then it checks the accuracy. If the accuracy is high enough then it doesn't miss. That's the same logically as what I wrote.
 
I've got this listed as
Code: [Select]
Code:
Actor Dex + Action Acc%
Ah yeah, what I mean is, how is this done in assembly.  I can't follow it well because there are functions with a div  4 and I can't see why there have to be 3 of them at the start of code (2 from a function that gets called twice).  I want to edit this but without understanding how it's working in assembly I am at a loose end.  I guess if I could find out, but you prob already know :P  Also, Terrence has it different to you.

Edit... I think I might understand it now... Possibly.  Evasion (DF%) is calculated by Agility (dex) / 4, and then the armour stat is added.  I didn't know this.
Mistake? I don't know if I'd go that far. Unoptimized certainly, but you won't get better than that from a compiler.
What I mean is one of those instructions is redundant?  It's putting the value into ebp from eax and then just putting ebp back into eax again.

mov [ebp-10],eax
mov eax,[ebp-10]

could just be

mov [ebp-10],eax
 
Last edited:
What I mean is one of those instructions is redundant?
Yes, but compilers usually aren't in the habit of merging lines of code like that. If I had a snippet like this:

Code: [Select]
Code:
int foo = bar();foo += 2;
Then the assembler would likely turn out something like this:
Code: [Select]
Code:
call   barmov    foo, eaxmov    eax, fooadd    eax, 2mov    foo, eax
That's obviously two lines too long for what I want to happen, but it accomplishes the same goal. This is also partly for debugging purposes that it treats each line like its own chunk of isolated code. If I wrote it like:

Code: [Select]
Code:
int foo = bar() + 2
Then it would likely give me a more optimized assembler:
Code: [Select]
Code:
call   baradd    eax, 2mov    foo, eax
 
I figured it out, anyway... if I am right, this should work.

{New physical accuracy
#Hit% = Accuracy_of_Attack-  Target's_Evade
5DDD47 = 90 90
5DDD81 = 90 90 90

Old was

 Hit% = ([Attacker's Agility / 4] + Accuracy_of_Attack) + Attacker's Evade - Target's Evade

And why the attacker's evasion should be part of an attacker's accuracy calculation is truly beyond me.
 
Last edited:
Status
Not open for further replies.
Back
Top