Is My Math Right or Wrong for The Hit Formula?
Posted: Thu Feb 27, 2020 4:02 pm
I was looking more into how DFU calculates how the player rolls for their attacks against a monster, such as a skeleton warrior or a rat. I went through the code here "https://github.com/Interkarma/daggerfal ... r.cs/#L944" for the FormulaHelper script and made this equation based on it.
chanceToHit = (armorValue) + (attacker.ChanceToHitModifier + ChanceToHitMod) + ((attacker.Stats.LiveLuck - target.Stats.LiveLuck) / 10) + ((attacker.Stats.LiveAgility - target.Stats.LiveAgility) / 10) - (target.Skills.GetLiveSkillValue(DFCareer.Skills.Dodging) / 4) + (attacker.Skills.GetLiveSkillValue(DFCareer.Skills.CriticalStrike) / 10) + (40 if enemy is a monster/non-human) - 50
and you get "attacker.ChanceToHitModifier" with this equation.
ChanceToHitMod = (attacker.Skills.GetLiveSkillValue(skillID)) + (WeaponStates [StrikeUp = +10, StrikeDownRight = +5, StrikeDownLeft = -5, StrikeDown = -10, Horizontal prob. = 0]) + (ExpertProficiencies.attacker.Level [Assuming level is just player current level, so if level 4, would just add 4 to total hit mod]) + (Racial_Bonus.Level/3 or 4 [Depends on Race]) + (backstabChance [If behind target]) + (weapon.GetWeaponMaterialModifier() * 10)
and I guess "ChanceToHitMod" is just the value that is displayed when you click on your agility attribute, so if it's say 60, it would be +1 and 70 +2? I omitted adding the Adrenaline Rush variables to the chanceToHit equation for simplicity, but I know they exist.
Then all of this gets ran through a 1-100 Diceroll method, where you can't go below 3 nor above 97.
__________________________________________________________________________
So with all of that mess aside, let me put up an example or two to see if i'm understanding this correctly.
Example 1:
Level 4 Argonian custom class that has Axe expertise, 40 Axe skill, 30 crit strike, 60 agility, 50 luck, using an elven battle-axe.
Is attacking a Rat, with a horizontal slash, from the front. Rat stats from here: https://en.uesp.net/wiki/Daggerfall:Rat
ChanceToHitMod = (40) + (0) + (4) + (0) + (0) + (10) = 54
chanceToHit = (6) + (54 + 1) + ((50-50)/10) +((60-80)/10) - (0 [Do non-human monsters have dodge skill?]) + (30/10) + (40) - (50) = 52%
So when the 100 sided dice is rolled, if it rolls any number BELOW 52, my hit will collide and deal all of the other damage modification formula damage. Likewise, if it rolls ABOVE 52, my hit will miss.
__________________________________________________________________________
Example 2:
Level 12 Red-guard custom class that has Short-blade expertise, 70 short-blade skill, 60 crit strike, 90 agility, 60 luck, using an ebony dagger.
Is attacking an Ancient Lich, with a downward slash, from the front. Ancient Lich stats from here: https://en.uesp.net/wiki/Daggerfall:Ancient_Lich
ChanceToHitMod = (70) + (-10) + (12) + (12/3) + (0) + (40) = 116
chanceToHit = (-12) + (116 + 4) + ((60-50)/10) +((90-90)/10) - (0 [Do non-human monsters have dodge skill?]) + (60/10) + (40) - (50) = 105%
So when the 100 sided dice is rolled, if it rolls any number BELOW 97, my hit will collide and deal all of the other damage modification formula damage. Likewise, if it rolls ABOVE 97, my hit will miss.
__________________________________________________________________________
Before I ask more about details like "So difference in luck stat only effects hit chance by 1% per 10 point difference" or "So every 10 points of agility has a 2% effect on hit chance" or "Do monsters not have a dodge stat?". I want to make sure that I am understanding the math here correctly, am I missing anything?
chanceToHit = (armorValue) + (attacker.ChanceToHitModifier + ChanceToHitMod) + ((attacker.Stats.LiveLuck - target.Stats.LiveLuck) / 10) + ((attacker.Stats.LiveAgility - target.Stats.LiveAgility) / 10) - (target.Skills.GetLiveSkillValue(DFCareer.Skills.Dodging) / 4) + (attacker.Skills.GetLiveSkillValue(DFCareer.Skills.CriticalStrike) / 10) + (40 if enemy is a monster/non-human) - 50
and you get "attacker.ChanceToHitModifier" with this equation.
ChanceToHitMod = (attacker.Skills.GetLiveSkillValue(skillID)) + (WeaponStates [StrikeUp = +10, StrikeDownRight = +5, StrikeDownLeft = -5, StrikeDown = -10, Horizontal prob. = 0]) + (ExpertProficiencies.attacker.Level [Assuming level is just player current level, so if level 4, would just add 4 to total hit mod]) + (Racial_Bonus.Level/3 or 4 [Depends on Race]) + (backstabChance [If behind target]) + (weapon.GetWeaponMaterialModifier() * 10)
and I guess "ChanceToHitMod" is just the value that is displayed when you click on your agility attribute, so if it's say 60, it would be +1 and 70 +2? I omitted adding the Adrenaline Rush variables to the chanceToHit equation for simplicity, but I know they exist.
Then all of this gets ran through a 1-100 Diceroll method, where you can't go below 3 nor above 97.
__________________________________________________________________________
So with all of that mess aside, let me put up an example or two to see if i'm understanding this correctly.
Example 1:
Level 4 Argonian custom class that has Axe expertise, 40 Axe skill, 30 crit strike, 60 agility, 50 luck, using an elven battle-axe.
Is attacking a Rat, with a horizontal slash, from the front. Rat stats from here: https://en.uesp.net/wiki/Daggerfall:Rat
ChanceToHitMod = (40) + (0) + (4) + (0) + (0) + (10) = 54
chanceToHit = (6) + (54 + 1) + ((50-50)/10) +((60-80)/10) - (0 [Do non-human monsters have dodge skill?]) + (30/10) + (40) - (50) = 52%
So when the 100 sided dice is rolled, if it rolls any number BELOW 52, my hit will collide and deal all of the other damage modification formula damage. Likewise, if it rolls ABOVE 52, my hit will miss.
__________________________________________________________________________
Example 2:
Level 12 Red-guard custom class that has Short-blade expertise, 70 short-blade skill, 60 crit strike, 90 agility, 60 luck, using an ebony dagger.
Is attacking an Ancient Lich, with a downward slash, from the front. Ancient Lich stats from here: https://en.uesp.net/wiki/Daggerfall:Ancient_Lich
ChanceToHitMod = (70) + (-10) + (12) + (12/3) + (0) + (40) = 116
chanceToHit = (-12) + (116 + 4) + ((60-50)/10) +((90-90)/10) - (0 [Do non-human monsters have dodge skill?]) + (60/10) + (40) - (50) = 105%
So when the 100 sided dice is rolled, if it rolls any number BELOW 97, my hit will collide and deal all of the other damage modification formula damage. Likewise, if it rolls ABOVE 97, my hit will miss.
__________________________________________________________________________
Before I ask more about details like "So difference in luck stat only effects hit chance by 1% per 10 point difference" or "So every 10 points of agility has a 2% effect on hit chance" or "Do monsters not have a dodge stat?". I want to make sure that I am understanding the math here correctly, am I missing anything?