Advertisement
Guest User

StatSystem.cpp

a guest
Mar 12th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. const float m_diminishing_k[MAX_CLASSES] =
  2. {
  3. 0.9560f, // Warrior
  4. 0.9560f, // Paladin
  5. 0.9880f, // Hunter
  6. 0.9880f, // Rogue
  7. 0.9830f, // Priest
  8. 0.9560f, // DK
  9. 0.9880f, // Shaman
  10. 0.9830f, // Mage
  11. 0.9830f, // Warlock
  12. 0.0f, // ??
  13. 0.9720f, // Druid
  14. 0.9830f // Necromancer
  15. };
  16.  
  17. float Player::GetMissPercentageFromDefence() const
  18. {
  19. float const miss_cap[MAX_CLASSES] =
  20. {
  21. 16.00f, // Warrior //correct
  22. 16.00f, // Paladin //correct
  23. 16.00f, // Hunter //?
  24. 16.00f, // Rogue //?
  25. 16.00f, // Priest //?
  26. 16.00f, // DK //correct
  27. 16.00f, // Shaman //?
  28. 16.00f, // Mage //?
  29. 16.00f, // Warlock //?
  30. 0.0f, // ??
  31. 16.00f, // Druid //?
  32. 16.00f // Necromancer//?
  33. };
  34.  
  35. float diminishing = 0.0f, nondiminishing = 0.0f;
  36. // Modify value from defense skill (only bonus from defense rating diminishes)
  37. nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
  38. diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
  39.  
  40. // apply diminishing formula to diminishing miss chance
  41. uint32 pclass = getClass()-1;
  42. return nondiminishing + (diminishing * miss_cap[pclass] / (diminishing + miss_cap[pclass] * m_diminishing_k[pclass]));
  43. }
  44.  
  45. void Player::UpdateParryPercentage()
  46. {
  47. const float parry_cap[MAX_CLASSES] =
  48. {
  49. 47.003525f, // Warrior
  50. 47.003525f, // Paladin
  51. 145.560408f, // Hunter
  52. 145.560408f, // Rogue
  53. 0.0f, // Priest
  54. 47.003525f, // DK
  55. 145.560408f, // Shaman
  56. 0.0f, // Mage
  57. 0.0f, // Warlock
  58. 0.0f, // ??
  59. 0.0f, // Druid
  60. 0.0f // Necromancer
  61. };
  62.  
  63. // No parry
  64. float value = 0.0f;
  65. uint32 pclass = getClass()-1;
  66. if (CanParry() && parry_cap[pclass] > 0.0f)
  67. {
  68. float nondiminishing = 5.0f;
  69. // Parry from rating
  70. float diminishing = GetRatingBonusValue(CR_PARRY);
  71. // Modify value from defense skill (only bonus from defense rating diminishes)
  72. nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f;
  73. diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f;
  74. // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
  75. nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT);
  76. // apply diminishing formula to diminishing parry chance
  77. value = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);
  78.  
  79. if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
  80. value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) : value;
  81.  
  82. value = value < 0.0f ? 0.0f : value;
  83. }
  84. SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
  85. }
  86.  
  87. void Player::UpdateDodgePercentage()
  88. {
  89. const float dodge_cap[MAX_CLASSES] =
  90. {
  91. 88.129021f, // Warrior
  92. 88.129021f, // Paladin
  93. 145.560408f, // Hunter
  94. 145.560408f, // Rogue
  95. 150.375940f, // Priest
  96. 88.129021f, // DK
  97. 145.560408f, // Shaman
  98. 150.375940f, // Mage
  99. 150.375940f, // Warlock
  100. 0.0f, // ??
  101. 116.890707f, // Druid
  102. 150.375940f // Necromancer
  103. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement