Formulae: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
(Created page with "==Combat Formulae== ===Melee=== ====Hit Chance==== hit chance = Attackers weapon skill * 1.25 + Attackers Attack - Defenders Sanctuary + (Attackers Agility - Defenders Agilit...")
 
No edit summary
Line 3: Line 3:
===Melee===
===Melee===
====Hit Chance====
====Hit Chance====
 
<syntaxhighlight lang="cpp">
   hit chance = Attackers weapon skill * 1.25 + Attackers Attack - Defenders Sanctuary + (Attackers Agility - Defenders Agility) * 0.25 + (Attackers Luck - Defenders Luck) * 0.125
   hit chance = Attackers weapon skill * 1.25 + Attackers Attack - Defenders Sanctuary + (Attackers Agility - Defenders Agility) * 0.25 + (Attackers Luck - Defenders Luck) * 0.125
 
</syntaxhighlight>
Example:
Example:


Line 13: Line 13:
====Bodypart Hit Chance====
====Bodypart Hit Chance====
====Damage====
====Damage====
 
<syntaxhighlight lang="cpp">
   Damages dealt = (Damage * Damage) / (Damage + Opponent Armor Rating)
   Damages dealt = (Damage * Damage) / (Damage + Opponent Armor Rating)
 
</syntaxhighlight>
====Melee Mitigation====
====Melee Mitigation====
===Magic===
===Magic===
====Chance of Successful Spell Cast====
====Chance of Successful Spell Cast====
 
<syntaxhighlight lang="cpp">
   chance = (Spells Skill * 2 + Willpower / 5 + Luck / 10 - SpellCost + CastPenalty) * (CurrentFatigue + MaximumFatigue * 1.5) / (MaximumFatigue * 2)
   chance = (Spells Skill * 2 + Willpower / 5 + Luck / 10 - SpellCost + CastPenalty) * (CurrentFatigue + MaximumFatigue * 1.5) / (MaximumFatigue * 2)
 
</syntaxhighlight>
The value for CastPenalty can be accessed with the function GetCastPenalty.
The value for CastPenalty can be accessed with the function GetCastPenalty.


====Cast cost====
====Cast cost====
 
<syntaxhighlight lang="cpp">
   cost = 0.1 + ((min effect value / 20) + (max effect value / 20)) * ((duration - 1) / 2) + (range / 40).
   cost = 0.1 + ((min effect value / 20) + (max effect value / 20)) * ((duration - 1) / 2) + (range / 40).
 
</syntaxhighlight>
x1.5 for ranged spell. Constant effect enchantments use fEnchantmentConstantDurationMult as their duration values (default 100).
x1.5 for ranged spell. Constant effect enchantments use fEnchantmentConstantDurationMult as their duration values (default 100).


* Touch/Self
* Touch/Self
<syntaxhighlight lang="cpp">
   cost = base cost * ((max + min) * duration * 0.025 + area * 0.0125)
   cost = base cost * ((max + min) * duration * 0.025 + area * 0.0125)
 
</syntaxhighlight>
* Target
* Target
<syntaxhighlight lang="cpp">
   cost = base cost * ((max + min) * duration * 0.3125 + area * 0.0125)
   cost = base cost * ((max + min) * duration * 0.3125 + area * 0.0125)
 
</syntaxhighlight>
* Constant effect
* Constant effect
<syntaxhighlight lang="cpp">
   cost = base cost * ((max + min) * 2.5 + area * 0.025)
   cost = base cost * ((max + min) * 2.5 + area * 0.025)
 
</syntaxhighlight>
The base cost are [http://www.uesp.net/wiki/Morrowind:Spell_Effects here]
The base cost are [http://www.uesp.net/wiki/Morrowind:Spell_Effects here]


Line 49: Line 52:
==Item Values==
==Item Values==
===Spell cost in gold===
===Spell cost in gold===
   cost of puchasing existing spell. = spell cost in magicka * fSpellValueMult
<syntaxhighlight lang="cpp">
   cost of puchasing existing spell = spell cost in magicka * fSpellValueMult


   cost of spellmaking = spell cost in magicka * fSpellMakingValueMult
   cost of spellmaking = spell cost in magicka * fSpellMakingValueMult


   cost of enchanting service = Enchantment points * fEnchantmentValueMult
   cost of enchanting service = Enchantment points * fEnchantmentValueMult
</syntaxhighlight>


This is adjusted as follows: 0.5% per point of disposition (base 50). 0.5% per point of mercantile skill difference. 0.05% per point of personality value difference. 0.05% per point of luck value difference.
This is adjusted as follows: 0.5% per point of disposition (base 50). 0.5% per point of mercantile skill difference. 0.05% per point of personality value difference. 0.05% per point of luck value difference.
Line 73: Line 78:


Armor class (in case of helm) is determined by these code:
Armor class (in case of helm) is determined by these code:
 
<syntaxhighlight lang="cpp">
 
   if (iHelmWeight * fLightMaxMod <= helm. weight):
   if (</span> iHelmWeight * fLightMaxMod <= helm. weight):
     return LIGHT
     return LIGHT
   elif (iHelmWeight * fMedMaxMod <= helm. weight):
   else if (iHelmWeight * fMedMaxMod <= helm. weight):
     return MEDIUM
     return MEDIUM
   else:
   else:
     return HEAVY
     return HEAVY
</syntaxhighlight>


For other armor types another variable should be used:
For other armor types another variable should be used:
Line 92: Line 97:


===Armor rating===
===Armor rating===
<syntaxhighlight lang="cpp">
   rating = armor. rating * ArmorSkill / iBaseArmorSkill
   rating = armor. rating * ArmorSkill / iBaseArmorSkill
</syntaxhighlight>


if player don't have armor piece unarmored skill is used instead:
if player don't have armor piece unarmored skill is used instead:
 
<syntaxhighlight lang="cpp">
   rating = UnarmoredSkill * UnarmoredSkill * 0.0065
   rating = UnarmoredSkill * UnarmoredSkill * 0.0065
</syntaxhighlight>


Total armor rating determined by these formula:
Total armor rating determined by these formula:
 
<syntaxhighlight lang="cpp">
   totalRating = Cuirass * 0.3 + (Shield + Helm + Greaves + Boots + RPauldron + LPauldron) * 0.1 + (RGauntlet + LGauntlet) * 0.05
   totalRating = Cuirass * 0.3 + (Shield + Helm + Greaves + Boots + RPauldron + LPauldron) * 0.1 + (RGauntlet + LGauntlet) * 0.05
 
</syntaxhighlight>
===How Unarmored Works===
===How Unarmored Works===
==Persuasion Formulae==
==Persuasion Formulae==
Line 108: Line 116:


===Shared terms===
===Shared terms===
 
<syntaxhighlight lang="cpp">
   persTerm = personality / fPersonalityMod
   persTerm = personality / fPersonalityMod


Line 118: Line 126:


   fatigueTerm = fFatigueBase - fFatigueMult * (1 - normalisedFatigue)
   fatigueTerm = fFatigueBase - fFatigueMult * (1 - normalisedFatigue)
</syntaxhighlight>
where normalisedFatigue is a function of fatigue: empty fatigue bar -> 0.0, full fatigue bar -> 1.0
where normalisedFatigue is a function of fatigue: empty fatigue bar -> 0.0, full fatigue bar -> 1.0
<syntaxhighlight lang="cpp">
   #using player stats
   //using player stats
   playerRating1 = (repTerm + luckTerm + persTerm + speechcraft) * fatigueTerm
   playerRating1 = (repTerm + luckTerm + persTerm + speechcraft) * fatigueTerm
   playerRating2 = playerRating1 + levelTerm
   playerRating2 = playerRating1 + levelTerm
Line 127: Line 135:
   
   


   #using NPC stats (note differences)
   //using NPC stats (note differences)
   npcRating1 = (repTerm + luckTerm + persTerm + speechcraft) * fatigueTerm
   npcRating1 = (repTerm + luckTerm + persTerm + speechcraft) * fatigueTerm
   npcRating2 = (levelTerm + repTerm + luckTerm + persTerm + npcSpeechcraft) * fatigueTerm
   npcRating2 = (levelTerm + repTerm + luckTerm + persTerm + npcSpeechcraft) * fatigueTerm
Line 136: Line 144:
   target2 = d * (playerRating2 - npcRating2 + 50)
   target2 = d * (playerRating2 - npcRating2 + 50)
   target3 = d * (playerRating3 - npcRating3 + 50) + bribeMod
   target3 = d * (playerRating3 - npcRating3 + 50) + bribeMod
 
</syntaxhighlight>
where bribeMod is fBribe10Mod, fBribe100Mod or fBribe1000Mod
where bribeMod is fBribe10Mod, fBribe100Mod or fBribe1000Mod
<br />


===Admire===
===Admire===
 
<syntaxhighlight lang="cpp">
   target1 = max(iPerMinChance, target1)
   target1 = max(iPerMinChance, target1)
   roll 100, win if roll <= target1
   roll 100, win if roll <= target1
   c = int(fPerDieRollMult * (target1 - roll))
   c = int(fPerDieRollMult * (target1 - roll))
   x = max(iPerMinChange, c) on success, c on fail
   x = max(iPerMinChange, c) on success, c on fail
</syntaxhighlight>

Revision as of 18:44, 7 August 2011

Combat Formulae

Melee

Hit Chance

  hit chance = Attackers weapon skill * 1.25 + Attackers Attack - Defenders Sanctuary + (Attackers Agility - Defenders Agility) * 0.25 + (Attackers Luck - Defenders Luck) * 0.125

Example:

  • Warrior's Attack = 10
  • Thief's Sanctuary = 10

Bodypart Hit Chance

Damage

  Damages dealt = (Damage * Damage) / (Damage + Opponent Armor Rating)

Melee Mitigation

Magic

Chance of Successful Spell Cast

  chance = (Spells Skill * 2 + Willpower / 5 + Luck / 10 - SpellCost + CastPenalty) * (CurrentFatigue + MaximumFatigue * 1.5) / (MaximumFatigue * 2)

The value for CastPenalty can be accessed with the function GetCastPenalty.

Cast cost

  cost = 0.1 + ((min effect value / 20) + (max effect value / 20)) * ((duration - 1) / 2) + (range / 40).

x1.5 for ranged spell. Constant effect enchantments use fEnchantmentConstantDurationMult as their duration values (default 100).

  • Touch/Self
  cost = base cost * ((max + min) * duration * 0.025 + area * 0.0125)
  • Target
  cost = base cost * ((max + min) * duration * 0.3125 + area * 0.0125)
  • Constant effect
  cost = base cost * ((max + min) * 2.5 + area * 0.025)

The base cost are here

Comments

They are more than one formulae on internet, witch one is the real?

Magic Mitigation

Magic Damage

Ranged

Item Values

Spell cost in gold

  cost of puchasing existing spell = spell cost in magicka * fSpellValueMult

  cost of spellmaking = spell cost in magicka * fSpellMakingValueMult

  cost of enchanting service = Enchantment points * fEnchantmentValueMult

This is adjusted as follows: 0.5% per point of disposition (base 50). 0.5% per point of mercantile skill difference. 0.05% per point of personality value difference. 0.05% per point of luck value difference.

Item costs in Gold

Travel Costs in Gold

Item Durability, Item Charge

Damages

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, while each armor part equipped contributes to the armor rating.

Charge

Armor Rating and Armor Class

Determining armor class

Armor class (in case of helm) is determined by these code:

  if (iHelmWeight * fLightMaxMod <= helm. weight):
    return LIGHT
  else if (iHelmWeight * fMedMaxMod <= helm. weight):
     return MEDIUM
  else:
     return HEAVY

For other armor types another variable should be used:

  • iHelmWeight
  • iPauldronWeight
  • iGauntletWeight
  • iCuirassWeight
  • iGreavesWeight
  • iBootsWeight

Armor rating

  rating = armor. rating * ArmorSkill / iBaseArmorSkill

if player don't have armor piece unarmored skill is used instead:

  rating = UnarmoredSkill * UnarmoredSkill * 0.0065

Total armor rating determined by these formula:

  totalRating = Cuirass * 0.3 + (Shield + Helm + Greaves + Boots + RPauldron + LPauldron) * 0.1 + (RGauntlet + LGauntlet) * 0.05

How Unarmored Works

Persuasion Formulae

Persuasion options in the NPC dialogue menu.

Shared terms

  persTerm = personality / fPersonalityMod

  luckTerm = luck / fLuckMod

  repTerm = reputation * fReputationMod

  levelTerm = level * fLevelMod

  fatigueTerm = fFatigueBase - fFatigueMult * (1 - normalisedFatigue)

where normalisedFatigue is a function of fatigue: empty fatigue bar -> 0.0, full fatigue bar -> 1.0

  //using player stats
  playerRating1 = (repTerm + luckTerm + persTerm + speechcraft) * fatigueTerm
  playerRating2 = playerRating1 + levelTerm
  playerRating3 = (mercantile + luckTerm + persTerm) * fatigueTerm
 

  //using NPC stats (note differences)
  npcRating1 = (repTerm + luckTerm + persTerm + speechcraft) * fatigueTerm
  npcRating2 = (levelTerm + repTerm + luckTerm + persTerm + npcSpeechcraft) * fatigueTerm
  npcRating3 = (mercantile + repTerm + luckTerm + persTerm) * fatigueTerm
 
  d = 1 - 0.02 * abs(npcDisposition - 50)
  target1 = d * (playerRating1 - npcRating1 + 50)
  target2 = d * (playerRating2 - npcRating2 + 50)
  target3 = d * (playerRating3 - npcRating3 + 50) + bribeMod

where bribeMod is fBribe10Mod, fBribe100Mod or fBribe1000Mod

Admire

  target1 = max(iPerMinChance, target1)
  roll 100, win if roll <= target1
  c = int(fPerDieRollMult * (target1 - roll))
  x = max(iPerMinChange, c) on success, c on fail