Research:Combat

From OpenMW Wiki
Revision as of 10:08, 4 September 2012 by Zini (talk | contribs)
Jump to navigation Jump to search

Combat Formulae

Melee

Hit Chance

Actions affected On melee contact
Description Check applies to melee hits. Does not apply to projectiles or magic.
Implementation status not started yet
Analysis status Inaccurate: Fatigue is not accounted for at all; any kind of knockdown or other bonus is unaccounted for; blind, chameleon or other penalties are not accounted for
hit chance = Attackers weapon skill * 1.25 + Attackers Attack Bonus - Defenders Sanctuary Bonus
  + (Attackers Agility - Defenders Agility) * 0.25 + (Attackers Luck - Defenders Luck) * 0.125


Blocking with a shield

Actions affected On melee contact
Description With a shield equipped, blocking has a chance to negate all damage.
Implementation status not started yet
Analysis status Verified

On enemy hit

theta = angle from player to enemy, negative is enemy left of centreline, positive is enemy right of centreline

if theta < fCombatBlockLeftAngle: no block
if theta > fCombatBlockRightAngle: no block

#Note that the above tests are inaccurate, as each comparison is calculated using a dot product
#which is converted to an angle improperly. The effective value of fCombatBlock*Angle ends up
#slightly different than specified.

blockTerm = pcBlockSkill + 0.2 * pcAgility + 0.1 * pcLuck
enemySwing = random number in range [0.1, 1]
swingTerm = enemySwing * fSwingBlockMult + fSwingBlockBase

fatigueTerm = fFatigueBase - fFatigueMult*(1 - normalisedFatigue)
where normalisedFatigue is a function of fatigue. empty fatigue bar -> 0.0, full fatigue bar -> 1.0
Note fatigueTerm is normally 1.25 at full fatigue.

playerTerm = blockTerm * swingTerm
if player is not moving forward at any speed: playerTerm = playerTerm * 1.25 (note this is not fBlockStillBonus)
playerTerm = playerTerm * fatigueTerm

if npc is a creature: npcSkill = creature combat stat
otherwise: npcSkill = npc skill with wielded weapon

npcTerm = npcSkill + 0.2 * npcAgility + 0.1 * npcLuck
npcFatigueTerm = fFatigueBase - fFatigueMult*(1 - normalisedFatigue)
using NPC normalisedFatigue
npcTerm = npcTerm * npcFatigueTerm

x = int(playerTerm - npcTerm)
if x < iBlockMinChance: x = iBlockMinChance
if x > iBlockMaxChance: x = iBlockMaxChance
roll 100, block if roll < x

if a hit is blocked, the shield durability is reduced by incoming damage, no damage mitigation is applied


The enemySwing variable is effectively how much the enemy has charged their attack. It seems to be uniform random and is not based on weapon damage. The other thing of note is the playerTerm bonus. The fBlockStillBonus GMST is not used at all; the multiplier is hard-coded. Unexpectedly, this bonus is still given if the player is moving backwards or strafing, only moving forward will negate it.


Bodypart Hit Chance

Actions affected On melee hit
Description Damage is directed towards a single random body part. Occurs once a hit is confirmed.
Implementation status not started yet
Analysis status Verified
Chest/Cuirass 30%
Head/Helm 10%
Legs/Greaves 10%
Feet/Boots 10%
L Shoulder/L Pauldron 10%
R Shoulder/R Pauldron 10%
Shield arm/Shield 10%
L Hand/L Gauntlet 5%
R Hand/R Gauntlet 5%

Note that you still take unarmored class hits to the shield arm, if you don't have a shield equipped.


Damage

Actions affected On melee hit
Description Occurs pre armor mitigation.
Implementation status not started yet
Analysis status Sources of melee damage and critical hits are unexplained
if actor is knocked down: damage *= fCombatKODamageMult
if actor is critically hit: damage *= fCombatCriticalStrikeMult


Armor Mitigation

Actions affected On melee hit
Description Occurs once a hit is confirmed.
Implementation status not started yet
Analysis status Inaccurate: AR is underspecified (vs armor part/unarmored/creature); damage to armor is unspecified; shield spell effects are underspecified
if damage < 0.001: skip mitigation to avoid divide by zero, set damage to 0
AR = target overall armor rating including shield spells
x = damage / (damage + target armor rating)
damage *= max(fCombatArmorMinMult, x)


Knockdowns

Actions affected On melee hit
Description Occurs after damage is taken.
Implementation status not started yet
Analysis status Verified
damage = incoming damage before armour reduction
agilityTerm = agility * fKnockDownMult
knockdownTerm = agility * iKnockDownOddsMult * 0.01 + iKnockDownOddsBase

roll 100, knockdown occurs if agilityTerm <= damage and knockdownTerm <= roll


Ranged

Hit chance

Damage

Projectile recovery

Armor Rating and Armor Class

Determining armor class

Actions affected On evaluating AR
Description
Implementation status not started yet
Analysis status Verified

Item armor class:

epsilon = 5e-4
referenceWeight = iHelmWeight, iPauldronWeight, iCuirassWeight, iGauntletWeight, iGreavesWeight, iBootsWeight or iShieldWeight depending on slot

if itemWeight == 0: return NONE
if itemWeight <= referenceWeight * fLightMaxMod + epsilon: return LIGHT
if itemWeight <= referenceWeight * fMedMaxMod + epsilon: return MEDIUM
else: return HEAVY


Armor rating

Actions affected When evaluating effective armor rating
Description
Implementation status not started yet
Analysis status Verified
armorSkill is either npc lightArmorSkill, mediumArmorSkill or heavyArmorSkill dependent on item class

if there is armor in a slot:
if itemWeight == 0: rating = armorBaseRating
else: rating = armorBaseRating * armorSkill / iBaseArmorSkill

otherwise unarmored skill is used instead:
rating = (fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill)

totalRating is a weighted combination of slot ratings:
totalRating = Cuirass * 0.3 + (Shield + Helm + Greaves + Boots + LPauldron + RPauldron) * 0.1
  + (LGauntlet + RGauntlet) * 0.05 + Shield spell effect magnitude


Note that elemental shield spells do not contribute towards armor.


Item durability

Damage Taken

Actions affected On melee hit, weapons and armor
Description Occurs once a hit is confirmed.
Implementation status not started yet
Analysis status Mostly accurate but underspecified

With every successful hit a weapon takes fWeaponDamageMult: (default 0.1) percentage of damage rounded down. Minimum damage to weapon = 1 With weapon health going down, its damage is also going down, thus in turn slowing the rate of damaging weapon. Armor takes an amount of damage that it stopped. Only armor part that took a hit takes any damage.