Changes
From Final Fantasy Inside
Added detailed damage calculations. Accuracy functions will have to wait.
For standard damage functions
X0:
:Sets Target's 02h flag to 1. (Unknown effect)
----
X1:
:If Attack Property "Always Critical" is Set
::Set Critical Damage Flag
:End If
:x = ( Actor's Level * Actor's (M)Attack ) / 32
:y = ( Actor's Level + Actor's (M)Attack ) / 32
:z = Actor's (M)Attack + ( x * y )
:z = z * ( 512 - target's defense ) * Attack's Power
:Damage = z / 4096
:If Critical Damage Flag is set
::Damage = Damage * 2
:End If
:If Actor's Statuses include Berserk
::Damage = Damage * 3 / 2
:End If
:Long_Range = 0
:If Target is in Back Row
::Set Long_Range = 1
:End If
:If Attack is Short Range OR Command is Enemy Attack
::If Actor is in Back Row
:::Long_Range = 1
::End If
:Else
::Long_Range = 0
:End If
:If Long_Range != 0
::Damage = Damage / 2
:End If
:If Target is Defending
::Damage = Damage / 2
:End If
:x = AttackerIf Actor's level * attacker's damage stat (depending on physical or magic type)Statuses includes Frog:x = (x + Attacker's level AND 31) >> 5:y Damage = Attacker's level + attacker's damage stat (depending on physical or magic type):y = (y + Attacker's level AND 31) >> 5Damage / 4:z = attacker's damage stat + (x * y):z = z * ( 512 - target's defense ) * attack's power:Damage = z / 16End If
:If Actor's Statuses include Mini:: Damage = 0:End If :Damage = Variance( Damage )----X2::multiNoSplit = ( ( ( Attack's Target Flags AND Ch ) - 4 ) == 0 ? 1 : 0 ):Base = (Actor's Attack + Actor's Level) * 6:Damage = (512 - Target's Defense) * Base * Attack's Power:Damage = Sadness( Damage ):Damage = SplitDamage( Damage, multiNoSplit ):Damage = Barrier(0x5DE8BF Damage ):Damage = Variance( Damage )----X3::If Attack Properties Damage MP is clear::Damage = Target's HP:Else::Damage = Target's MP:End If:Damage = Damage * Attack's Power / 10032:If ActionData[AC] != 0 (?)::Damage = Damage / 2:End If:Damage----X4::If Attack Properties Damage MP is clear::Damage = Target's MHP:Else::Damage = Target's MMP:End If:Damage = Damage * Attack's Power / 32:If ActionData[AC] != 0 (?)::Damage = Damage / 2:End If:Damage----X5::Damage = (Actor's (M)Attack + Actor's Level) * 6 + (Attack's Power * 22):Damage = SplitDamage( Damage ):Damage = Barrier( Damage ):Damage = Variance( Damage )----X6::Damage = Attack's Power * 20----X7::Damage = ( ( 512 - Target's Def ) * Attack's Power / 32 ):Damage = Variance( Damage )----X8::If ActionData[0x230] AND 40h::ActionData[0x230] = 1:Else::ActionData[0x230] = 80h:End If----X9::Actor's Attack = Actor's Strength * 2:Use Damage X1 with adjusted stat----XA:Damage = ( Attack's Power + Number of Targets - 1 ) / Number of Targets----Sadness( Damage )::If Target's Status includes Sadness::Damage = Damage - (Damage * 3 / 10):End If:Return Damage----SplitDamage( Damage, multiNoSplit )::If multiNoSplit == 0::If No. of Attack's Targets >= 2:::Set Attack's split damage Target Flag::Else:::Set multiNoSplit == 1::End If:End If:If ActionData[0xAC] == 0::Damage = Damage / 2:Else::If attacker multiNoSplit == 0:::Damage = Damage * 3 / 2::End If:End If:Return Damage----Barrier( Damage )::If Attack Property "Physical" is Mini0::If Target's Statuses include MBarrier:::Set ActionData "MBarrier Active" flag::End If:Else::If Target'ds Statuses include Barrier:::Set ActionData "Barrier Active" flag::End If:End If:If ActionData "MBarrier Active" or "Barrier Active" flags are set:: Damage = Damage / 2:End If:If attack is Magic and EnabledMagic[7] == 0(?)::Damage = MaxDamage + ( Damage * ( EnabledMagic[38417] * (10 / 32) ) / 100 ):End If:Return Damage----Variance( Damage )::Damage = Damage ([0..4096255] + 3841) / 4096 , //from RNGLUT in KERNEL.BIN:If Damage == 0::Damage == 1 ):End If:Return Damage