Formulae: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
No edit summary
(Redirect to newly organized Research namespace.)
 
(51 intermediate revisions by 8 users not shown)
Line 1: Line 1:
==Combat Formulae==
#REDIRECT [[Research]]
 
===Melee===
====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
</syntaxhighlight>
Example:
 
* Warrior's Attack = 10
* Thief's Sanctuary = 10
 
====Bodypart Hit Chance====
====Damage====
<syntaxhighlight lang="cpp">
  Damages dealt = (Damage * Damage) / (Damage + Opponent Armor Rating)
</syntaxhighlight>
====Melee Mitigation====
===Magic===
====Chance of Successful Spell Cast====
<syntaxhighlight lang="cpp">
  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.
 
====Cast cost====
<syntaxhighlight lang="cpp">
  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).
 
* Touch/Self
<syntaxhighlight lang="cpp">
  cost = base cost * ((max + min) * duration * 0.025 + area * 0.0125)
</syntaxhighlight>
* Target
<syntaxhighlight lang="cpp">
  cost = base cost * ((max + min) * duration * 0.3125 + area * 0.0125)
</syntaxhighlight>
* Constant effect
<syntaxhighlight lang="cpp">
  cost = base cost * ((max + min) * 2.5 + area * 0.025)
</syntaxhighlight>
The base cost are [http://www.uesp.net/wiki/Morrowind:Spell_Effects 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===
<syntaxhighlight lang="cpp">
  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
</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.
 
===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:
<syntaxhighlight lang="cpp">
  if (iHelmWeight * fLightMaxMod <= helm. weight):
    return LIGHT
  else if (iHelmWeight * fMedMaxMod <= helm. weight):
    return MEDIUM
  else:
    return HEAVY
</syntaxhighlight>
 
For other armor types another variable should be used:
 
* iHelmWeight
* iPauldronWeight
* iGauntletWeight
* iCuirassWeight
* iGreavesWeight
* iBootsWeight
 
===Armor rating===
<syntaxhighlight lang="cpp">
  rating = armor. rating * ArmorSkill / iBaseArmorSkill
</syntaxhighlight>
 
if player don't have armor piece unarmored skill is used instead:
<syntaxhighlight lang="cpp">
  rating = UnarmoredSkill * UnarmoredSkill * 0.0065
</syntaxhighlight>
 
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
</syntaxhighlight>
===How Unarmored Works===
==Persuasion Formulae==
 
Persuasion options in the NPC dialogue menu.
 
===Shared terms===
<syntaxhighlight lang="cpp">
  persTerm = personality / fPersonalityMod
 
  luckTerm = luck / fLuckMod
 
  repTerm = reputation * fReputationMod
 
  levelTerm = level * fLevelMod
 
  fatigueTerm = fFatigueBase - fFatigueMult * (1 - normalisedFatigue)
</syntaxhighlight>
where normalisedFatigue is a function of fatigue: empty fatigue bar -> 0.0, full fatigue bar -> 1.0
<syntaxhighlight lang="cpp">
  //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
</syntaxhighlight>
where bribeMod is fBribe10Mod, fBribe100Mod or fBribe1000Mod
 
===Admire===
<syntaxhighlight lang="cpp">
  target1 = max(iPerMinChance, target1)
  roll 100, win if roll <= target1
  c = int(fPerDieRollMult * (target1 - roll))
  x = max(iPerMinChange, c) on success, c on fail
</syntaxhighlight>

Latest revision as of 18:29, 3 September 2012

Redirect to: