From Legacy Wiki

The Fighting dropdown menu contains links to many combative aspects of Legacy. It is the second dropdown menu from the left and is located at the top of the screen, right below the combat log. It provides links to:
Player vs Player fights and Player vs NPC fights are determined by a comparison of stats, some random numbers and some equations. When you attempt to hit your enemy the process runs something like this.
Contents
Stat Totals
The current value for each of your respective stats is calculated in the order shown below for both yourself and your opponent.
 Base Character Stats.
 Adjustments made based on chosen attack type. (Quick Attack, Aimed Attack, Take Cover)
 + Stats from all equipped Items.
 + Stats from trained Abilities that grant bonuses.
 + Stat bonus from any friendly Warfare Structures in your location.
 + Bonus stats granted from any staff favor you have.
  Any penalty from a staff disfavor you may have.
  Any penalty to stats from warfare fatigue.
 + Bonus from any friendly effect like Alien Artifact armor bonus.
Percentages Calculated
The game then takes the above information and determines your percentage chance to hit and damage. This percentage is not used further by the script it is only displayed to players so they may understand what is going on more clearly. The scripted algorithm used to determine a percentage chance to hit or damage is shown below.
a = Offensive Stat (Accuracy or Weapon Hit Skill)
d = Defensive Stat (Dodge or Defense Skill)
if (d > a) {
x = ( a + 1 )  ( d / 4 )
if ( x < 0 ) x = 0
percentage = ( ( ( x ) * ( x / 2 ) ) / ( ( ( d + 1 )  ( d / 4 ) ) * ( ( a + 1 )  ( a / 4 ) ) ) ) * 100
} else {
x = ( d + 1 )  ( a / 4 )
if ( x < 0 ) x = 0
percentage = ( ( ( ( ( d + 1 )  ( d / 4 ) ) * ( ( a + 1 )  ( a / 4 ) ) )  ( ( x ) * ( x / 2 ) ) ) / ( ( ( d + 1 )  ( d / 4 ) ) * ( ( a + 1 )  ( a / 4 ) ) ) ) * 100
}
Determine First Hit
This is a basic comparison of the attacker and defenders Speed stat. The player with the highest speed gets the first hit, if both speeds are equal the attacker hits first.
Determine Hit
To determine if a player hits or misses an opponent their Accuracy stat is compared to their opponents Dodge stat with a degree of randomness using the following calculation:
x = random(accuracy/4, accuracy)  random(dodge/4, dodge)
if ( x > 0 ) Hit Scored
The game calculates a random number between 25% of the attacker's Accuracy and 100% of the attacker's Accuracy e.g. if your Accuracy was 100 it would return a random number between 25 and 100. The game then calculates a random number between 25% of the defender's Dodge and 100% of the defender's Dodge e.g. if their Dodge was 100 it would return a random number between 25 and 100. The game then compares these values, and if the Accuracy value is higher than the Dodge value, a hit is scored.
If a hit is scored, the same is then done for Weapon Skill vs Defense skill. This determines if you do damage or not, if successful a hit will be scored and damage calculated. Failure at this stage results in a "You hit but did no damage." message.
Determine Damage
If you won both the above rolls you scored a damaging hit on your opponent, the amount of Damage done is determined by your Weapon Damage compared to your opponents Armor.
The weapon damage is randomized between the minimum and maximum damage value of your current weapon. (Each attack pageconsists of 2 attacks, 1 with each weapon). The damage done is then decreased to match the amount absorbed by your opponents armor.
The following was the older calculation for damage deal:
Armor absorbs damage equal to its value but cannot absorb more than 60% of the damage done. The scripting that determines absorbtion is shown below.
min = Current weapons minimum damage
max = Current weapons maximum damage
armor = Opponents armor value
damage = round ( random ( min, max) );
if ( ( damage* 0.6 ) < armor) absorb = floor ( damage* 0.6 )
else absorb= armor
damage = damage  absorb
The round function rounds to the nearest whole number, the floor function always rounds down. The point of this is even if your opponents armor is far superior to your weapons, a damaging hit will still do 40% of your weapons damage at least.
The following is the new and current calculation for damage dealt:
min = Attacker's weapons' minimum damage
max = Attacker's weapons' maximum damage
damage = round(random(min, max));
armor = Defender's armor value
modifier = Attacker's Level (capped at 80) * 7 / 2
Damage dealt = damage * (modifier/ (modifier+ armor)
Double Hits
This whole process is done twice (once for each weapon), the total stats from all equipped items are added up apart from Armor which only comes from your current armor item and weapon damage which only comes from the attacking weapon. If both hit and damage you score a double hit. The end damage is then deducted from your opponents hit points, if they're still alive they will hit back (if they have the second attack).