ArcEmu: Dodge Calculation - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Dodge Calculation Get the right Values

#1 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 16 June 2010 - 12:27 PM

Patch Title: Dodge fix (the x'd time)
What bug does this patch fix: fix the wrong dodge ratio which is used to get the full dodge.
Detailed Explanation: dodgeRation is static, but it's a better way to take the values from dbc. Also mangos did it, as i finished the patch. Updated the right values for the base dodge from http://www.wowwiki.com/Dodge for 3.3
How to reproduce: NULL

Link to thread(s) in bug reports section if available:
Patch:
Index: Player.cpp
===================================================================
--- Player.cpp	(Revision 3466)
+++ Player.cpp	(Arbeitskopie)
@@ -5223,6 +5223,7 @@
 
 float Player::GetDefenseChance(uint32 opLevel)
 {
+
 	float chance = _GetSkillLineCurrent( SKILL_DEFENSE, true ) - ( opLevel * 5.0f );
 	chance += CalcRating( PLAYER_RATING_MODIFIER_DEFENCE );
 	chance = floorf( chance ) * 0.04f; // defense skill is treated as an integer on retail
@@ -5243,7 +5244,11 @@
 	chance = baseDodge[pClass];
 
 	// Dodge from agility
-	chance += float( GetStat(STAT_AGILITY) / dodgeRatio[getLevel()-1][pClass] );
+	float rat = GetDodgeRatio();
+       if(rat!= 0)
+         chance += float( GetStat(STAT_AGILITY) / rat );
+       else
+         sLog.outError("Wrong DodgeRatio Value, Dodge takes not the dodge from agility.");
 
 	// Dodge from dodge rating
 	chance += CalcRating( PLAYER_RATING_MODIFIER_DODGE );
@@ -5254,6 +5259,21 @@
 	return max( chance, 0.0f ); // Make sure we don't have a negative chance
 }
 
+float Player::GetDodgeRatio()
+{
+       uint32 pClass = (uint32)getClass();
+       uint32 level = getLevel();
+
+    if (level>100) 
+               level = 100; //dbc takes ! >lvl 100 so if it is higher lvl, it's easyly 100
+       //dont need to get the values from a struct, a better way to use the dbc, first i see @ http://www.wowwiki.com/Dodge, then mangos did it also.
+    gtFloat const * dodgeRatio = dbcMeleeCrit.LookupEntry((pClass-1)*100 + (level-1));
+   
+       if (dodgeRatio==NULL || pClass > MAX_CLASSES)
+        return 0.0f;
+	   float dodge=(baseDodge[pClass] + GetStat(STAT_AGILITY) * dodgeRatio->val * crit_to_dodge[pClass]) *100;
+       return dodge;
+}
 // Gets block chances before defense skill is applied
 // Assumes the caller will check for shields
 float Player::GetBlockChance()
@@ -5301,7 +5321,7 @@
 	defence_contribution = GetDefenseChance( pLevel );
 
 	// Dodge
-	tmp = GetDodgeChance();
+	tmp= GetDodgeChance();
 	tmp += defence_contribution;
 	tmp = min( max ( tmp, 0.0f ), 95.0f );
 	SetFloatValue( PLAYER_DODGE_PERCENTAGE, tmp );
@@ -5334,7 +5354,7 @@
 
 	// Critical
 	gtFloat* baseCrit = dbcMeleeCritBase.LookupEntry(pClass-1);
-	gtFloat* CritPerAgi = dbcMeleeCrit.LookupEntry(pLevel - 1 + (pClass-1)*100);
+	gtFloat* CritPerAgi = dbcMeleeCrit.LookupEntry((pLevel - 1) + (pClass-1)*100);
 
 	tmp = 100*(baseCrit->val + GetStat(STAT_AGILITY) * CritPerAgi->val);
 
@@ -5370,7 +5390,7 @@
 	SetFloatValue( PLAYER_RANGED_CRIT_PERCENTAGE, min( rcr, 95.0f ) );
 
 	gtFloat* SpellCritBase  = dbcSpellCritBase.LookupEntry(pClass-1);
-	gtFloat* SpellCritPerInt = dbcSpellCrit.LookupEntry(pLevel - 1 + (pClass-1)*100);
+	gtFloat* SpellCritPerInt = dbcSpellCrit.LookupEntry((pLevel - 1) + (pClass-1)*100);
 
 	spellcritperc = 100*(SpellCritBase->val + GetStat(STAT_INTELLECT) * SpellCritPerInt->val) +
 		this->GetSpellCritFromSpell() +
@@ -8489,7 +8509,7 @@
 	if( level > 100 )
 		level = 100;
 
-	CombatRatingDBC * pDBCEntry = dbcCombatRating.LookupEntryForced( relative_index * 100 + level - 1 );
+	CombatRatingDBC * pDBCEntry = dbcCombatRating.LookupEntryForced( relative_index * 100 + (level - 1) );
 	if( pDBCEntry == NULL )
 		return rating;
 	else
Index: Player.h
===================================================================
--- Player.h	(Revision 3466)
+++ Player.h	(Arbeitskopie)
@@ -75,7 +75,7 @@
 //  Holds the display id and item type id for objects in
 //  a character's inventory
 //====================================================================
-
+#define MAX_CLASSES 11
 enum Classes
 {
 	WARRIOR = 1,
@@ -557,12 +557,26 @@
 	uint32 charges;
 };
 
-// Dodge ( class base ) - UNUSED, Warrior, Paladin, Hunter, Rogue, Priest, Death Knight(taken from pala), Shaman, Mage, Warlock, UNUSED, Druid
-const float baseDodge[12] = { 0.0f, 0.7580f, 0.6520f, -5.4500f, -0.5900f, 3.1830f, 0.6520f, 1.6750f, 3.4575f, 2.0350f, 0.0f, -1.8720f };
+// Dodge ( class base ) -             UNUSED, Warrior,  Paladin, Hunter,    Rogue,    Priest,  Death Knight, Shaman, Mage,     Warlock, UNUSED,     Druid      all values are taken from http://www.wowwiki.com/Dodge
+const float baseDodge[12] = { 0.0f , 3.66400f, 3.49430f,-4.08730f, 2.09570f, 3.41780f, 3.664f,      2.108f, 3.65870f, 2.42110f, 0.0f, 	 5.60970f };
 
+const float crit_to_dodge[MAX_CLASSES] = {
+         1.1f,      // Warrior
+         1.0f,      // Paladin
+         1.6f,      // Hunter
+         2.0f,      // Rogue
+         1.0f,      // Priest
+         1.0f,      // DK?
+         1.0f,      // Shaman
+         1.0f,      // Mage
+         1.0f,      // Warlock
+         0.0f,      // ??
+         1.7f       // Druid
+    };
+
 // Dodge ( class ratio ) - UNUSED, Warrior, Paladin, Hunter, Rogue, Priest, Death Knight(taken from pala), Shaman, Mage, Warlock, UNUSED, Druid
 // TODO: get proper ratios for all levels, we only have values for level 70 currently
-const float dodgeRatio[PLAYER_LEVEL_CAP][12] = {
+/*const float dodgeRatio[PLAYER_LEVEL_CAP][12] = {
 {0.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 0.000000f , 5.000000f , } , // Level 1
 {0.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 0.000000f , 5.000000f , } , // Level 2
 {0.000000f , 5.157590f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 5.000000f , 0.000000f , 5.000000f , } , // Level 3
@@ -646,7 +660,7 @@
 {0.000000f , 31.800000f , 26.800000f , 26.800000f , 21.100000f , 26.800000f , 26.800000f , 26.800000f , 26.800000f , 26.800000f , 0.000000f , 15.605900f , } , // Level 79
 {0.000000f , 32.000000f , 27.000000f , 27.000000f , 22.200000f , 27.000000f , 27.000000f , 27.000000f , 27.000000f , 27.000000f , 0.000000f , 15.705900f , } , // Level 80
 #endif
-};
+};*/
 
 struct FactionReputation
 {
@@ -1505,6 +1519,7 @@
 	void UpdateAttackSpeed();
 	float GetDefenseChance(uint32 opLevel);
 	float GetDodgeChance();
+	float GetDodgeRatio();
 	float GetBlockChance();
 	float GetParryChance();
 	void UpdateChances();

Attached File(s)


This post has been edited by suchASunthan: 02 July 2010 - 01:11 PM

Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

#2 User is offline   Laerg619 

  • Member
  • Pip
  • Group: Members
  • Posts: 50
  • Joined: 08-June 08
  • Location:California, USA

Posted 01 July 2010 - 12:47 AM

Will test this out. I've noticed the dodge calculation is horribly wonky currently. I'm not sure if it's only certain classes, but it seems rogues are gaining around 6-8% dodge with every piece of higher-iLevel equipment.
0

#3 User is offline   Laerg619 

  • Member
  • Pip
  • Group: Members
  • Posts: 50
  • Joined: 08-June 08
  • Location:California, USA

Posted 01 July 2010 - 03:08 AM

To note, after applying the patch, Dodge Chance was set at 95% permanently - even without any gear. (Granted, I only checked on a couple of level 80s)
0

#4 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 01 July 2010 - 03:55 AM

thx, i take a look.

oops forgot some... try it for a second time please.
Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

#5 User is offline   Laerg619 

  • Member
  • Pip
  • Group: Members
  • Posts: 50
  • Joined: 08-June 08
  • Location:California, USA

Posted 01 July 2010 - 06:48 AM

View PostsuchASunthan, on 01 July 2010 - 03:55 AM, said:

thx, i take a look.

oops forgot some... try it for a second time please.

I'm afraid even with the changes, it's still a flat 95% dodge rate regardless of level or class.
0

#6 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 01 July 2010 - 03:15 PM

i see, the problem of it is, that the calculation @
GetDodgeRatio()
fails. i look abouve mangos, how they did it. please do not apply this. can a mod please took this patch backwards "Patch workshop"
Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

#7 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 02 July 2010 - 08:02 AM

tested the actually patch. now i get on lvl 80 as druid 5.75 % dodge with 400/400 defense. i dont know if these values are right, but i cant think that you get at level 80 47.84688995 %( WoWWiki - Dodge ) dodge... could anyone explain what the real values has to be?
thanks

LG Sunthan
Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

#8 User is offline   suchASunthan 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 246
  • Joined: 29-November 08
  • Gender:Male
  • Location:Frankfurt
  • Interests:Vcpp, vb, sql, all programmlanguages
    more informations >:-]

Posted 03 July 2010 - 08:51 AM

tested and works fine. only problems are in the basestats value. so this is now finished.

please take this to "patch submission".
Koninzidenz begründet keine Korrelation und ist kein Beweis für Kausalität!

coincidence causes no correlation and in´t a argument for causality!

Posted Image
Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users