Changes

Jump to navigation Jump to search

FF7/DamageFormula

3,158 bytes added, 23:36, 3 July 2012
Pretty sloppy. Clean up needed, but mechanics should be correct.
//This will cause a memory leak if done on enemies
</pre>
 
 
=Accuracy Functions=
The point of these is to set the "attack will miss" flag in the current action memory structure.
 
0: Physical Accuracy Check
<pre>
todo
It's long so I'll tackle it when I have a lot of time on my hands
</pre>
 
1: Magical Accuracy Check
<pre>
acc = Action's Accuracy
tar_save = level / 2; //rounded down
acc_bonus = actor's level - tar_save
rand_0 = [0..99]
rand_1 = [0..99]
if acc < 255 then
if target does not have instant-death, null, or heal properties to current attack then
if attack is not (reflectable and target in reflect status) then
if attack does not inflict statuses or inflicting status include: Death, Sleep, Confu, Stop, Petrify, or Paralysis then
acc = Fury_Adj( acc );
if target's M_Evade > rand_0 OR
acc + acc_bonus < rand_1 then
Set action miss flag
end if
end if
end if
end if
end if
</pre>
 
2: Critical Hit Check
<pre>
If attack does not miss then
if actor in lucky girl status then
critical_chance = 255
else
critical_chance = ((actor's luck + actor's level) - target's level ) >> 2;
if actor is playable character then
critical_chance += weapon's critical bonus //?
end if
Critical_random = ( ( [0..65535] * 99 ) / 65535 ) + 1;
if critical_chance > critical_random then
attack set to critical
end if
end if
end if
</pre>
 
3, 4, and 5 don't exist. Since they don't set miss they will always hit.
 
6: Manipulate Accuracy (intended solely for playable characters)
<pre>
int ally_loop;
ManipSuccess = 0;
for ( ally_loop = 0; ally_loop < 3; ally_loop++ )
{
if target is currently under manipulation by an actor then
break;
end if
}
if target is not currently being manipulated AND
target is not a playable character AND
target is an enemy AND
actor is not currently manipulating an enemy AND
target is not under manipulate status AND
target's timer bar is running AND //like they're not stopped, petrified, etc
target's attack resistance is "always-hit" then //?
Manip_Chance = actor's level + 50 - target's level; //no less than 0
if target count > 1 then
Manip_Chance = ( Manip_Chance << 2 ) / 5;
end if
if actor's [0xAC] == 0 then
Manip_Chance >> 1;
end if
if target's attack resistance is "always-hit" then
Manip_Chance = 255;
end if
if actor's <unknown> == 5 and Manip_Chance >= 100 then
Manip_Chance = 100;
end if
If Manip_Chance >= [0..99] then
ManipSuccess = 1;
end if
end if
If ManipSuccess == 1 then
Set actor's manipulated enemy to target
Display String 5Ah {"Manipulated <Enemy>"}
Clear Actor's 0xE4 value //unknown
else
Set attack missed
end if
</pre>
This doesn't actually place the target in the manipulate status. That happens elsewhere.
 
7: Level-based Accuracy
<pre>
If Action's Accuracy > 0 then
If the remainder of ( Target's level / Action accuracy ) is non-zero then
Set attack missed
end if
end if
</pre>
So if the accuracy IS 0, then it will always hit. This is to prevent a divide by zero error.
Anonymous user

Navigation menu