From 962d5db3be62773db715b4a4705f5ba5ed6b67ff Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 17:21:49 -0400 Subject: [PATCH 01/26] Update with new EHP formula: WIP --- libs/barbarian.php | 46 ++++++++++++++++++++++++++++++++++++++++++++ libs/diabloclass.php | 12 +----------- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/libs/barbarian.php b/libs/barbarian.php index c146ff4..dc9fe54 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -5,4 +5,50 @@ class Barbarian extends DiabloClass { parent::__construct($stats); } + + function EHPScore() { + $ehp = $this->stats->getStat('EHP Unbuffed'); + + if($ehp < 1000000) { + return $ehp / 10000; + } elseif(1000000 <= $ehp && $ehp <= 2000000) { + return 100 + ($ehp - 1000000) / 20000; + } elseif(2000000 <= $ehp && $ehp <= 5000000) { + return 150 + ($ehp - 2000000) / 40000; + } elseif($ehp >= 5000000) { + return 225 + ($ehp - 5000000) / 100000; + } + } + + private + function calculateEHP() { + $incoming_attack = 100000; + $block_amount = 4206; + $ar_red = $this->getStat('Resistance') / + ($this->getStat('Resistance') + 315); + $armor_red = $this->getStat('Armor') / + ($this->getStat('Armor') + 3150); + $inherent_red = .3; + + $total_red = (1 - $ar_red) * (1 - $armor_red) * (1 - $inherent_red); + $raw_ehp = $this->getStat('Life') / $total_red; + + $net = $incoming_attack * $total_red; + + $after_block = $net * (1 - $this->getStat('Block')) + ($net - $block_amount) + * $this->getStat('Block'); + + $new_mit = $after_block / $incoming_attack; + + $raw_no_dodge = $this->getStat('Life') / $new_mit; + $net_no_dodge = $raw_no_dodge; + + $raw_ehp_dodge = $net_no_dodge / (1 - $this->getStat('Dodge Chance')); + $net_ehp_dodge = ($raw_ehp_dodge - $net_no_dodge) * .75 + $net_no_dodge; + + $final_ehp = $net_ehp_dodge * (1 + $this->getStat('Melee Damage Reduction') + + $this->getStat('Missile Damage Reduction') / 2); + + $this->stats->stats['EHP Unbuffed'] = $final_ehp; + } } \ No newline at end of file diff --git a/libs/diabloclass.php b/libs/diabloclass.php index c08b2ac..60ae1e7 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -39,17 +39,7 @@ class DiabloClass { } function EHPScore() { - $ehp = $this->stats->getStat('EHP Unbuffed'); - - if($ehp < 1000000) { - return $ehp / 10000; - } elseif(1000000 <= $ehp && $ehp <= 2000000) { - return 100 + ($ehp - 1000000) / 20000; - } elseif(2000000 <= $ehp && $ehp <= 5000000) { - return 150 + ($ehp - 2000000) / 40000; - } elseif($ehp >= 5000000) { - return 225 + ($ehp - 5000000) / 100000; - } + return 0; } function sustainScore() { From 6f5bd88ff09984a32a065796d1e0a0ca6dc92256 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 18:44:04 -0400 Subject: [PATCH 02/26] Various stuff in prep for pvp vs pve; WIP --- d3hog_driver.php | 2 +- libs/barbarian.php | 47 ++++++++++++++++++++++++++------------------ libs/demonhunter.php | 2 -- libs/diabloclass.php | 9 ++++++--- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/d3hog_driver.php b/d3hog_driver.php index 4103e9d..aaceb5c 100644 --- a/d3hog_driver.php +++ b/d3hog_driver.php @@ -16,7 +16,7 @@ if($_POST['submit']) { die('Bad provider. Either your provider could not be detected or we do not support your provider at this time.'); } - $character = DiabloClassFactory::createClassObject($stats->class, $stats); + $character = DiabloClassFactory::createClassObject($stats->class, $stats, 'pvp'); if($character === FALSE) { die('Bad class. Either your class could not be detected or we do not support your class at this time.'); diff --git a/libs/barbarian.php b/libs/barbarian.php index dc9fe54..a62c899 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -1,12 +1,11 @@ class = $stats->class; - - parent::__construct($stats); + function __construct($stats, $type) { + parent::__construct($stats, $type); } function EHPScore() { + $this->calculateEHP(); $ehp = $this->stats->getStat('EHP Unbuffed'); if($ehp < 1000000) { @@ -22,32 +21,42 @@ class Barbarian extends DiabloClass { private function calculateEHP() { - $incoming_attack = 100000; + if($this->type == 'pvp') { + $ar_mod = 300;$armor_mod = 3000;$inherent_red = .35;$incoming_attack = 250000; + $net_mod = .50; // no idea what this is for + } else { + $ar_mod = 315;$armor_mod = 3150;$inherent_red = .30;$incoming_attack = 100000; + $net_mod = .75; // no idea what this is for + } + $block_amount = 4206; - $ar_red = $this->getStat('Resistance') / - ($this->getStat('Resistance') + 315); - $armor_red = $this->getStat('Armor') / - ($this->getStat('Armor') + 3150); - $inherent_red = .3; + $ar_red = $this->stats->getStat('Resistance') / + ($this->stats->getStat('Resistance') + $ar_mod); + $armor_red = $this->stats->getStat('Armor') / + ($this->stats->getStat('Armor') + $armor_mod); $total_red = (1 - $ar_red) * (1 - $armor_red) * (1 - $inherent_red); - $raw_ehp = $this->getStat('Life') / $total_red; + $raw_ehp = $this->stats->getStat('Life') / $total_red; $net = $incoming_attack * $total_red; - $after_block = $net * (1 - $this->getStat('Block')) + ($net - $block_amount) - * $this->getStat('Block'); + $after_block = $net * (1 - $this->stats->getStat('Block')) + ($net - $block_amount) + * $this->stats->getStat('Block'); $new_mit = $after_block / $incoming_attack; - $raw_no_dodge = $this->getStat('Life') / $new_mit; - $net_no_dodge = $raw_no_dodge; + $raw_no_dodge = $this->stats->getStat('Life') / $new_mit; + if($this->type == 'pvp') { + $net_no_dodge = ($raw_no_dodge - $raw_ehp) * .75 + $raw_ehp; + } else { + $net_no_dodge = $raw_no_dodge; + } - $raw_ehp_dodge = $net_no_dodge / (1 - $this->getStat('Dodge Chance')); - $net_ehp_dodge = ($raw_ehp_dodge - $net_no_dodge) * .75 + $net_no_dodge; + $raw_ehp_dodge = $net_no_dodge / (1 - $this->stats->getStat('Dodge Chance')); + $net_ehp_dodge = ($raw_ehp_dodge - $net_no_dodge) * $net_mod + $net_no_dodge; - $final_ehp = $net_ehp_dodge * (1 + $this->getStat('Melee Damage Reduction') - + $this->getStat('Missile Damage Reduction') / 2); + $final_ehp = $net_ehp_dodge * (1 + $this->stats->getStat('Melee Damage Reduction') + + $this->stats->getStat('Missile Damage Reduction') / 2); $this->stats->stats['EHP Unbuffed'] = $final_ehp; } diff --git a/libs/demonhunter.php b/libs/demonhunter.php index 5d67d25..0e3265a 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -1,8 +1,6 @@ class = $stats->class; - parent::__construct($stats); } diff --git a/libs/diabloclass.php b/libs/diabloclass.php index 60ae1e7..1fe9128 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -1,13 +1,13 @@ stats = $stats; + $this->type = $type; + $this->class = $stats->class; } function hallScore() { From 17cd8ab158085be8d7ee4d4661f2bdf220d1eea8 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 19:26:38 -0400 Subject: [PATCH 03/26] Update driver to display side-by-side table --- d3hog_driver.php | 62 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/d3hog_driver.php b/d3hog_driver.php index aaceb5c..e6bb4bb 100644 --- a/d3hog_driver.php +++ b/d3hog_driver.php @@ -16,21 +16,63 @@ if($_POST['submit']) { die('Bad provider. Either your provider could not be detected or we do not support your provider at this time.'); } - $character = DiabloClassFactory::createClassObject($stats->class, $stats, 'pvp'); + $pve = DiabloClassFactory::createClassObject($stats->class, $stats, 'pve'); + $pvp = DiabloClassFactory::createClassObject($stats->class, $stats, 'pvp'); - if($character === FALSE) { + if($pve === FALSE) { + die('Bad class. Either your class could not be detected or we do not support your class at this time.'); + } + if($pvp === FALSE) { die('Bad class. Either your class could not be detected or we do not support your class at this time.'); } ?>
-Hall Score: hallScore(), 2, '.', ','); ?>

- -DPS Score: DPSScore(), 2, '.', ','); ?>
-EHP Score: EHPScore(), 2, '.', ','); ?>
-Sustain Score: sustainScore(), 2, '.', ','); ?>
-Move Score: moveScore(), 2, '.', ','); ?>
-Paragon Score: paragonScore(), 2, '.', ','); ?>
-Misc Score: miscScore(), 2, '.', ','); ?>
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PvEPvP
Hall ScorehallScore(), 2, '.', ','); ?>hallScore(), 2, '.', ','); ?>
DPS ScoreDPSScore(), 2, '.', ','); ?>DPSScore(), 2, '.', ','); ?>
EHP ScoreEHPScore(), 2, '.', ','); ?>EHPScore(), 2, '.', ','); ?>
Sustain ScoresustainScore(), 2, '.', ','); ?>sustainScore(), 2, '.', ','); ?>
Move ScoremoveScore(), 2, '.', ','); ?>moveScore(), 2, '.', ','); ?>
Paragon ScoreparagonScore(), 2, '.', ','); ?>paragonScore(), 2, '.', ','); ?>
Misc ScoremiscScore(), 2, '.', ','); ?>miscScore(), 2, '.', ','); ?>

Date: Mon, 8 Apr 2013 19:54:30 -0400 Subject: [PATCH 04/26] LoH and LS not tracked for PvP --- d3hog_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3hog_driver.php b/d3hog_driver.php index e6bb4bb..6b50a03 100644 --- a/d3hog_driver.php +++ b/d3hog_driver.php @@ -64,7 +64,7 @@ if($_POST['submit']) { Paragon Score paragonScore(), 2, '.', ','); ?> - paragonScore(), 2, '.', ','); ?> + 0 Misc Score From 34462191bbda56367a2309d730be28c358cd9e5d Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 19:58:34 -0400 Subject: [PATCH 05/26] No DR on EHP in PvP --- libs/barbarian.php | 4 ++++ libs/diabloclass.php | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libs/barbarian.php b/libs/barbarian.php index a62c899..ade6e84 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -8,6 +8,10 @@ class Barbarian extends DiabloClass { $this->calculateEHP(); $ehp = $this->stats->getStat('EHP Unbuffed'); + if($this->type == 'pvp') { + return $ehp / 10000; + } + if($ehp < 1000000) { return $ehp / 10000; } elseif(1000000 <= $ehp && $ehp <= 2000000) { diff --git a/libs/diabloclass.php b/libs/diabloclass.php index 1fe9128..59b91b1 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -33,8 +33,12 @@ class DiabloClass { } function hallScore() { - return $this->DPSScore() * $this->EHPScore() * $this->sustainScore() - * $this->moveScore() * $this->paragonScore() * $this->miscScore(); + $hallScore = $this->DPSScore() * $this->EHPScore() * $this->sustainScore() + * $this->moveScore() * $this->miscScore(); + if($this->type == 'pve') { + $hallScore *= $this->paragonScore(); + } + return $hallScore; } function DPSScore() { @@ -49,8 +53,14 @@ class DiabloClass { $effectiveLS = $this->stats->getStat('DPS Unbuffed') * $this->stats->getStat('Life Steal') * .5; $mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life'); + $loh = $this->stats->getStat('Life on Hit'); - $rawSustainScore = 1 + $mitigation * ($this->stats->getStat('Life on Hit') * + if($this->type == 'pvp') { + $effectiveLS = 0; + $loh = 0; + } + + $rawSustainScore = 1 + $mitigation * ($loh * (1 + ($this->stats->getStat('Attacks per Second') - 1) / 2) + $effectiveLS + $this->stats->getStat('Life per Second')) / ($this->stats->getStat('Life') * $this->EHPScore() * 10000 / From 2f8c6e4a8ef330e0b6adbb2a7dfed2c66320a6a4 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 20:07:37 -0400 Subject: [PATCH 06/26] Move stat adjustments from stats class to d3class class --- libs/diabloclass.php | 63 +++++++++++++++++++++++++++++++++++ libs/diabloprogress_stats.php | 62 ---------------------------------- 2 files changed, 63 insertions(+), 62 deletions(-) diff --git a/libs/diabloclass.php b/libs/diabloclass.php index 59b91b1..ceb88d3 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -30,6 +30,15 @@ class DiabloClass { $this->stats = $stats; $this->type = $type; $this->class = $stats->class; + + $this->stats->stats['Gem Life'] = $this->calculateGemLife(); + $this->modifyExpBonus(); + + $this->stats->stats['All Elemental Damage'] = $this->elementalDamage(); + + $this->modifyDPSUnbuffed(); + $this->modifyEHP(); + $this->modifyHP(); } function hallScore() { @@ -88,4 +97,58 @@ class DiabloClass { function miscScore() { return 1; } + + protected + function isParagonMaxed() { + return $this->stats->getStat('Paragon Level') == 100; + } + + private + function elementalDamage() { + $totalElemental = 0; + foreach($this->stats as $stat => $value) { + if(preg_match('/\+DPS \(.*\)/', $stat) > 0) { + $totalElemental += $value; + } + } + + return ($totalElemental > 0) ? $totalElemental : 0; + } + + function calculateGemLife() { + if($this->isParagonMaxed()) return 0; + + switch($this->stats->getStat('Exp Bonus')) { + case .19: return .12; + case .21: return .14; + case .25: return .15; + case .27: return .16; + case .29: return .17; + case .31: return .18; + default: return 0; + } + } + + function modifyExpBonus() { + if($this->stats->getStat('Exp Bonus') >= .35) { + $this->stats->stats['Exp Bonus'] = $this->stats->getStat('Exp Bonus') - .35; + } + } + + function modifyDPSUnbuffed() { + $this->stats->stats['DPS Unbuffed'] = $this->stats->getStat('DPS Unbuffed') * + max(1, 1 + ($this->stats->getStat('+DPS Against Elites') / 2)); + } + + function modifyEHP() { + $this->stats->stats['EHP Unbuffed'] = $this->stats->getStat('EHP Unbuffed') * + (1 + $this->stats->getStat('Life Bonus') + $this->stats->getStat('Gem Life')) / + (1 + $this->stats->getStat('Life Bonus')); + } + + function modifyHP() { + $this->stats->stats['Life'] = $this->stats->getStat('Life') * + (1 + $this->stats->getStat('Life Bonus') + $this->stats->getStat('Gem Life')) / + (1 + $this->stats->getStat('Life Bonus')); + } } diff --git a/libs/diabloprogress_stats.php b/libs/diabloprogress_stats.php index 0c4479c..98bab01 100644 --- a/libs/diabloprogress_stats.php +++ b/libs/diabloprogress_stats.php @@ -6,11 +6,6 @@ class DiabloProgressStats extends Stats { $this->parseStats(); } - protected - function isParagonMaxed() { - return $this->getStat('Paragon Level') == 100; - } - private function findClass() { preg_match('{(.*?)}', $this->html, $class); @@ -29,62 +24,5 @@ class DiabloProgressStats extends Stats { } $this->stats[$attributes[1][$i]] = $attributes[2][$i]; } - - $this->stats['Gem Life'] = $this->calculateGemLife(); - $this->modifyExpBonus(); - - $this->stats['All Elemental Damage'] = $this->elementalDamage(); - - $this->modifyDPSUnbuffed(); - $this->modifyEHP(); - $this->modifyHP(); - } - - function elementalDamage() { - $totalElemental = 0; - foreach($this->stats as $stat => $value) { - if(preg_match('/\+DPS \(.*\)/', $stat) > 0) { - $totalElemental += $value; - } - } - - return ($totalElemental > 0) ? $totalElemental : 0; - } - - function calculateGemLife() { - if($this->isParagonMaxed()) return 0; - - switch($this->getStat('Exp Bonus')) { - case .19: return .12; - case .21: return .14; - case .25: return .15; - case .27: return .16; - case .29: return .17; - case .31: return .18; - default: return 0; - } - } - - function modifyExpBonus() { - if($this->getStat('Exp Bonus') >= .35) { - $this->stats['Exp Bonus'] = $this->getStat('Exp Bonus') - .35; - } - } - - function modifyDPSUnbuffed() { - $this->stats['DPS Unbuffed'] = $this->getStat('DPS Unbuffed') * - max(1, 1 + ($this->getStat('+DPS Against Elites') / 2)); - } - - function modifyEHP() { - $this->stats['EHP Unbuffed'] = $this->getStat('EHP Unbuffed') * - (1 + $this->getStat('Life Bonus') + $this->getStat('Gem Life')) / - (1 + $this->getStat('Life Bonus')); - } - - function modifyHP() { - $this->stats['Life'] = $this->getStat('Life') * - (1 + $this->getStat('Life Bonus') + $this->getStat('Gem Life')) / - (1 + $this->getStat('Life Bonus')); } } \ No newline at end of file From 14ff704b5fe0c1a3aab787b450c576b3b35dde27 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 20:12:30 -0400 Subject: [PATCH 07/26] Calculate EHP one time insead of every time --- libs/barbarian.php | 3 +-- libs/diabloclass.php | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libs/barbarian.php b/libs/barbarian.php index ade6e84..6bf7723 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -5,7 +5,6 @@ class Barbarian extends DiabloClass { } function EHPScore() { - $this->calculateEHP(); $ehp = $this->stats->getStat('EHP Unbuffed'); if($this->type == 'pvp') { @@ -23,7 +22,7 @@ class Barbarian extends DiabloClass { } } - private + protected function calculateEHP() { if($this->type == 'pvp') { $ar_mod = 300;$armor_mod = 3000;$inherent_red = .35;$incoming_attack = 250000; diff --git a/libs/diabloclass.php b/libs/diabloclass.php index ceb88d3..b7cdda7 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -141,9 +141,7 @@ class DiabloClass { } function modifyEHP() { - $this->stats->stats['EHP Unbuffed'] = $this->stats->getStat('EHP Unbuffed') * - (1 + $this->stats->getStat('Life Bonus') + $this->stats->getStat('Gem Life')) / - (1 + $this->stats->getStat('Life Bonus')); + $this->calculateEHP(); } function modifyHP() { From 3002330133babf30a2f90c641147b7b616536460 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 20:15:20 -0400 Subject: [PATCH 08/26] Ignore XP to Life gem conversion if PvP --- libs/diabloclass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/diabloclass.php b/libs/diabloclass.php index b7cdda7..7763347 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -116,7 +116,7 @@ class DiabloClass { } function calculateGemLife() { - if($this->isParagonMaxed()) return 0; + if($this->isParagonMaxed() || $this->type == 'pvp') return 0; switch($this->stats->getStat('Exp Bonus')) { case .19: return .12; From 98868172467334c6a5bf0960391642354a14a86e Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 20:30:49 -0400 Subject: [PATCH 09/26] Update lifesteal coefficient based on attack speed --- libs/demonhunter.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index 0e3265a..0a5d137 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -19,8 +19,14 @@ class DemonHunter extends DiabloClass { } function sustainScore() { + if($this->stats->getStat('Attacks per Second') > 2) { + $lsCoefficient = .1; + } else { + $lsCoefficient = .2; + } + $effectiveLs = $this->stats->getStat('DPS Unbuffed') * - $this->stats->getStat('Life Steal') * .2; + $this->stats->getStat('Life Steal') * $lsCoefficient; $mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life'); return 1 + $mitigation * ($this->stats->getStat('Life on Hit') * From 8eb7b206beaf29c18b20eb4cf4be629a6fd34f8c Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 20:38:42 -0400 Subject: [PATCH 10/26] Elite damage counts fully in PvP. --- libs/diabloclass.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/diabloclass.php b/libs/diabloclass.php index 7763347..a55ff00 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -136,8 +136,13 @@ class DiabloClass { } function modifyDPSUnbuffed() { + if($this->type == 'pvp') { + $eliteDivisor = 1; + } else { + $eliteDivisor = 2; + } $this->stats->stats['DPS Unbuffed'] = $this->stats->getStat('DPS Unbuffed') * - max(1, 1 + ($this->stats->getStat('+DPS Against Elites') / 2)); + max(1, 1 + ($this->stats->getStat('+DPS Against Elites') / $eliteDivisor)); } function modifyEHP() { From 5c1e26e39060e70de535ef4d085f9c0d98b6c6e3 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 8 Apr 2013 21:29:06 -0400 Subject: [PATCH 11/26] Life steal on LoH do not count for PvP --- libs/demonhunter.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index 0a5d137..28dfe2a 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -25,11 +25,19 @@ class DemonHunter extends DiabloClass { $lsCoefficient = .2; } + $ls = $this->stats->getStat('Life Steal'); + $loh = $this->stats->getStat('Life on Hit'); + + if($this->type == 'pvp') { + $ls = 0; + $loh = 0; + } + $effectiveLs = $this->stats->getStat('DPS Unbuffed') * - $this->stats->getStat('Life Steal') * $lsCoefficient; + $ls * $lsCoefficient; $mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life'); - return 1 + $mitigation * ($this->stats->getStat('Life on Hit') * + return 1 + $mitigation * ($loh * ($this->stats->getStat('Attacks per Second') + 1) / 2 + $this->stats->getStat('Life per Second') + $effectiveLs) / ($this->stats->getStat('Life') * $this->EHPScore() * 10000 / From 0f6b13f964e48030752878e1ae155665e84719e9 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 21:52:07 -0400 Subject: [PATCH 12/26] Excel sum has high order of operations --- libs/barbarian.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/barbarian.php b/libs/barbarian.php index 6bf7723..c298469 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -49,6 +49,7 @@ class Barbarian extends DiabloClass { $new_mit = $after_block / $incoming_attack; $raw_no_dodge = $this->stats->getStat('Life') / $new_mit; + if($this->type == 'pvp') { $net_no_dodge = ($raw_no_dodge - $raw_ehp) * .75 + $raw_ehp; } else { @@ -58,8 +59,8 @@ class Barbarian extends DiabloClass { $raw_ehp_dodge = $net_no_dodge / (1 - $this->stats->getStat('Dodge Chance')); $net_ehp_dodge = ($raw_ehp_dodge - $net_no_dodge) * $net_mod + $net_no_dodge; - $final_ehp = $net_ehp_dodge * (1 + $this->stats->getStat('Melee Damage Reduction') - + $this->stats->getStat('Missile Damage Reduction') / 2); + $final_ehp = $net_ehp_dodge * (1 + ($this->stats->getStat('Melee Damage Reduction') + + $this->stats->getStat('Missile Damage Reduction')) / 2); $this->stats->stats['EHP Unbuffed'] = $final_ehp; } From 171f701203479781034e41501a16a1f7a14918c1 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 21:57:33 -0400 Subject: [PATCH 13/26] Recaclulate EHP before using --- libs/barbarian.php | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/barbarian.php b/libs/barbarian.php index c298469..e428514 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -5,6 +5,7 @@ class Barbarian extends DiabloClass { } function EHPScore() { + $this->calculateEHP(); $ehp = $this->stats->getStat('EHP Unbuffed'); if($this->type == 'pvp') { From 771541dcf614f058231dd246a46ff1e12ec57188 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 22:26:59 -0400 Subject: [PATCH 14/26] 'Block Chance', not 'Block' for block percentage --- libs/barbarian.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/barbarian.php b/libs/barbarian.php index e428514..3f14056 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -44,8 +44,8 @@ class Barbarian extends DiabloClass { $net = $incoming_attack * $total_red; - $after_block = $net * (1 - $this->stats->getStat('Block')) + ($net - $block_amount) - * $this->stats->getStat('Block'); + $after_block = $net * (1 - $this->stats->getStat('Block Chance')) + ($net - $block_amount) + * $this->stats->getStat('Block Chance'); $new_mit = $after_block / $incoming_attack; From 06875717cdc02ed6fc2cb101348a31cc7f50f567 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 22:44:25 -0400 Subject: [PATCH 15/26] Use raw EHP when calculating raw EHP with dodge --- libs/barbarian.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/barbarian.php b/libs/barbarian.php index 3f14056..ca0a74c 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -57,7 +57,7 @@ class Barbarian extends DiabloClass { $net_no_dodge = $raw_no_dodge; } - $raw_ehp_dodge = $net_no_dodge / (1 - $this->stats->getStat('Dodge Chance')); + $raw_ehp_dodge = $raw_no_dodge / (1 - $this->stats->getStat('Dodge Chance')); $net_ehp_dodge = ($raw_ehp_dodge - $net_no_dodge) * $net_mod + $net_no_dodge; $final_ehp = $net_ehp_dodge * (1 + ($this->stats->getStat('Melee Damage Reduction') From 4f93c77afd28e7b5c2e588d7efa65dc407960208 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 22:49:45 -0400 Subject: [PATCH 16/26] Direct copy barb EHP caclulation for DH...DRY as hell --- libs/demonhunter.php | 47 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index 28dfe2a..a58a6a8 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -1,7 +1,7 @@ stats->getStat('+Hatred Regenerated per Second') * 2 + $this->stats->getStat('+Discipline Regenerated per Second') * 15) / 100; } + + protected + function calculateEHP() { + if($this->type == 'pvp') { + $ar_mod = 300;$armor_mod = 3000;$inherent_red = .35;$incoming_attack = 250000; + $net_mod = .50; // no idea what this is for + } else { + $ar_mod = 315;$armor_mod = 3150;$inherent_red = .30;$incoming_attack = 100000; + $net_mod = .75; // no idea what this is for + } + + $block_amount = 4206; + $ar_red = $this->stats->getStat('Resistance') / + ($this->stats->getStat('Resistance') + $ar_mod); + $armor_red = $this->stats->getStat('Armor') / + ($this->stats->getStat('Armor') + $armor_mod); + + $total_red = (1 - $ar_red) * (1 - $armor_red) * (1 - $inherent_red); + $raw_ehp = $this->stats->getStat('Life') / $total_red; + + $net = $incoming_attack * $total_red; + + $after_block = $net * (1 - $this->stats->getStat('Block Chance')) + ($net - $block_amount) + * $this->stats->getStat('Block Chance'); + + $new_mit = $after_block / $incoming_attack; + + $raw_no_dodge = $this->stats->getStat('Life') / $new_mit; + + if($this->type == 'pvp') { + $net_no_dodge = ($raw_no_dodge - $raw_ehp) * .75 + $raw_ehp; + } else { + $net_no_dodge = $raw_no_dodge; + } + + $raw_ehp_dodge = $raw_no_dodge / (1 - $this->stats->getStat('Dodge Chance')); + $net_ehp_dodge = ($raw_ehp_dodge - $net_no_dodge) * $net_mod + $net_no_dodge; + + $final_ehp = $net_ehp_dodge * (1 + ($this->stats->getStat('Melee Damage Reduction') + + $this->stats->getStat('Missile Damage Reduction')) / 2); + + $this->stats->stats['EHP Unbuffed'] = $final_ehp; + } } \ No newline at end of file From dd173978eaad66ebbbf1eb1663aecb76901beced Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 22:51:07 -0400 Subject: [PATCH 17/26] Update inherit DR values for DH --- libs/demonhunter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index a58a6a8..e4c7c7f 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -53,10 +53,10 @@ class DemonHunter extends DiabloClass { protected function calculateEHP() { if($this->type == 'pvp') { - $ar_mod = 300;$armor_mod = 3000;$inherent_red = .35;$incoming_attack = 250000; + $ar_mod = 300;$armor_mod = 3000;$inherent_red = 0.30;$incoming_attack = 250000; $net_mod = .50; // no idea what this is for } else { - $ar_mod = 315;$armor_mod = 3150;$inherent_red = .30;$incoming_attack = 100000; + $ar_mod = 315;$armor_mod = 3150;$inherent_red = 0.00;$incoming_attack = 100000; $net_mod = .75; // no idea what this is for } From 9c42d150e0ac98b3879a26e5b8f80be0d6ed7389 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 22:53:12 -0400 Subject: [PATCH 18/26] Update DH EHPScore to follow new rules --- libs/demonhunter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index e4c7c7f..4433802 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -5,8 +5,13 @@ class DemonHunter extends DiabloClass { } function EHPScore() { + $this->calculateEHP(); $ehp = $this->stats->getStat('EHP Unbuffed'); + if($this->type == 'pvp') { + return $ehp / 10000; + } + if($ehp <= 500000) { return $ehp / 10000; } elseif(500000 < $ehp && $ehp <= 1000000) { From 7b717c9c6afe572c9f6c944cce42fcaa29dd4334 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 23:02:03 -0400 Subject: [PATCH 19/26] DH requires DPS to be modified by attacks per second --- libs/demonhunter.php | 7 +++++++ libs/diabloclass.php | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index 4433802..4c18afd 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -55,6 +55,13 @@ class DemonHunter extends DiabloClass { $this->stats->getStat('+Discipline Regenerated per Second') * 15) / 100; } + function modifyDPSUnbuffed() { + parent::modifyDPSUnbuffed(); + + $this->stats->stats['DPS Unbuffed'] = $this->stats->stats['DPS Unbuffed'] / + (1 + $this->stats->stats['Attacks per Second'] / 2); + } + protected function calculateEHP() { if($this->type == 'pvp') { diff --git a/libs/diabloclass.php b/libs/diabloclass.php index a55ff00..1a3f783 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -103,6 +103,16 @@ class DiabloClass { return $this->stats->getStat('Paragon Level') == 100; } + function modifyDPSUnbuffed() { + if($this->type == 'pvp') { + $eliteDivisor = 1; + } else { + $eliteDivisor = 2; + } + $this->stats->stats['DPS Unbuffed'] = $this->stats->getStat('DPS Unbuffed') * + max(1, 1 + ($this->stats->getStat('+DPS Against Elites') / $eliteDivisor)); + } + private function elementalDamage() { $totalElemental = 0; @@ -135,16 +145,6 @@ class DiabloClass { } } - function modifyDPSUnbuffed() { - if($this->type == 'pvp') { - $eliteDivisor = 1; - } else { - $eliteDivisor = 2; - } - $this->stats->stats['DPS Unbuffed'] = $this->stats->getStat('DPS Unbuffed') * - max(1, 1 + ($this->stats->getStat('+DPS Against Elites') / $eliteDivisor)); - } - function modifyEHP() { $this->calculateEHP(); } From 8c2a855ed690caeaeff79423f272d6a085f821eb Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 23:21:04 -0400 Subject: [PATCH 20/26] Modify HP before calculating the EHP --- libs/diabloclass.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/diabloclass.php b/libs/diabloclass.php index 1a3f783..03ec588 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -36,9 +36,9 @@ class DiabloClass { $this->stats->stats['All Elemental Damage'] = $this->elementalDamage(); + $this->modifyHP(); $this->modifyDPSUnbuffed(); - $this->modifyEHP(); - $this->modifyHP(); + $this->modifyEHP(); } function hallScore() { From eceeaea55856624d88ef2e87ee48041bdf17e19c Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 23:23:19 -0400 Subject: [PATCH 21/26] Use getStat to view stats --- libs/demonhunter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index 4c18afd..b281c13 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -58,8 +58,8 @@ class DemonHunter extends DiabloClass { function modifyDPSUnbuffed() { parent::modifyDPSUnbuffed(); - $this->stats->stats['DPS Unbuffed'] = $this->stats->stats['DPS Unbuffed'] / - (1 + $this->stats->stats['Attacks per Second'] / 2); + $this->stats->stats['DPS Unbuffed'] = $this->stats->getStat('DPS Unbuffed') / + (1 + $this->stats->getStat('Attacks per Second') / 2); } protected From e39b550a48d4be1e4fed86889a582c93e4368216 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 23:32:59 -0400 Subject: [PATCH 22/26] No longer modify Gem Life for experience helm gem --- libs/diabloclass.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/libs/diabloclass.php b/libs/diabloclass.php index 03ec588..cf1178a 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -31,12 +31,10 @@ class DiabloClass { $this->type = $type; $this->class = $stats->class; - $this->stats->stats['Gem Life'] = $this->calculateGemLife(); $this->modifyExpBonus(); $this->stats->stats['All Elemental Damage'] = $this->elementalDamage(); - $this->modifyHP(); $this->modifyDPSUnbuffed(); $this->modifyEHP(); } @@ -148,10 +146,4 @@ class DiabloClass { function modifyEHP() { $this->calculateEHP(); } - - function modifyHP() { - $this->stats->stats['Life'] = $this->stats->getStat('Life') * - (1 + $this->stats->getStat('Life Bonus') + $this->stats->getStat('Gem Life')) / - (1 + $this->stats->getStat('Life Bonus')); - } } From 4a6cef16c6c29f767e826c91059a2e0ea8c36bae Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Apr 2013 23:49:19 -0400 Subject: [PATCH 23/26] Do not need to modify DPS for DH --- libs/demonhunter.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index b281c13..bfacd40 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -3,7 +3,7 @@ class DemonHunter extends DiabloClass { function __construct($stats, $type) { parent::__construct($stats, $type); } - + function EHPScore() { $this->calculateEHP(); $ehp = $this->stats->getStat('EHP Unbuffed'); @@ -55,13 +55,6 @@ class DemonHunter extends DiabloClass { $this->stats->getStat('+Discipline Regenerated per Second') * 15) / 100; } - function modifyDPSUnbuffed() { - parent::modifyDPSUnbuffed(); - - $this->stats->stats['DPS Unbuffed'] = $this->stats->getStat('DPS Unbuffed') / - (1 + $this->stats->getStat('Attacks per Second') / 2); - } - protected function calculateEHP() { if($this->type == 'pvp') { From c390fa89821fa84899b673792d81e0d967390a4a Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 10 Apr 2013 00:00:09 -0400 Subject: [PATCH 24/26] Move around to make similar to barb sustain --- libs/demonhunter.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index bfacd40..c61e4d7 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -30,7 +30,9 @@ class DemonHunter extends DiabloClass { $lsCoefficient = .2; } - $ls = $this->stats->getStat('Life Steal'); + $effectiveLs = $this->stats->getStat('DPS Unbuffed') * + $this->stats->getStat('Life Steal') * $lsCoefficient; + $mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life'); $loh = $this->stats->getStat('Life on Hit'); if($this->type == 'pvp') { @@ -38,12 +40,9 @@ class DemonHunter extends DiabloClass { $loh = 0; } - $effectiveLs = $this->stats->getStat('DPS Unbuffed') * - $ls * $lsCoefficient; - $mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life'); return 1 + $mitigation * ($loh * - ($this->stats->getStat('Attacks per Second') + 1) / 2 + + (1 + ($this->stats->getStat('Attacks per Second') - 1) / 2) + $this->stats->getStat('Life per Second') + $effectiveLs) / ($this->stats->getStat('Life') * $this->EHPScore() * 10000 / $this->stats->getStat('EHP Unbuffed')); From 1922897d05987195529d33fa40cd1957b3779337 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 10 Apr 2013 00:04:28 -0400 Subject: [PATCH 25/26] Add DRs for DH sustain formula --- libs/demonhunter.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/demonhunter.php b/libs/demonhunter.php index c61e4d7..9c12375 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -41,11 +41,21 @@ class DemonHunter extends DiabloClass { } - return 1 + $mitigation * ($loh * + $rawSustainScore = 1 + $mitigation * ($loh * (1 + ($this->stats->getStat('Attacks per Second') - 1) / 2) + $this->stats->getStat('Life per Second') + $effectiveLs) / ($this->stats->getStat('Life') * $this->EHPScore() * 10000 / $this->stats->getStat('EHP Unbuffed')); + + if($rawSustainScore <= 1.5) { + return $rawSustainScore; + } elseif(1.5 < $rawSustainScore && $rawSustainScore <= 2) { + return 1.5 + ($rawSustainScore - 1.5) / 2; + } elseif(2 < $rawSustainScore && $rawSustainScore <= 3) { + return 1.75 + ($rawSustainScore - 2) / 4; + } else { + return 2 + ($rawSustainScore - 3) / 10; + } } function miscScore() { From 167f7e59d53d98e581d5d5fb4478e91417506814 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 10 Apr 2013 00:23:03 -0400 Subject: [PATCH 26/26] Calculate EHP cleanly to correct issue with some overwriting variable...somewhere...??? --- libs/barbarian.php | 4 ++-- libs/demonhunter.php | 9 +++++---- libs/diabloclass.php | 11 ++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/libs/barbarian.php b/libs/barbarian.php index ca0a74c..b06a37b 100644 --- a/libs/barbarian.php +++ b/libs/barbarian.php @@ -5,8 +5,7 @@ class Barbarian extends DiabloClass { } function EHPScore() { - $this->calculateEHP(); - $ehp = $this->stats->getStat('EHP Unbuffed'); + $ehp = $this->calculateEHP(); if($this->type == 'pvp') { return $ehp / 10000; @@ -64,5 +63,6 @@ class Barbarian extends DiabloClass { + $this->stats->getStat('Missile Damage Reduction')) / 2); $this->stats->stats['EHP Unbuffed'] = $final_ehp; + return $final_ehp; } } \ No newline at end of file diff --git a/libs/demonhunter.php b/libs/demonhunter.php index 9c12375..0423bf1 100644 --- a/libs/demonhunter.php +++ b/libs/demonhunter.php @@ -5,8 +5,7 @@ class DemonHunter extends DiabloClass { } function EHPScore() { - $this->calculateEHP(); - $ehp = $this->stats->getStat('EHP Unbuffed'); + $ehp = $this->calculateEHP(); if($this->type == 'pvp') { return $ehp / 10000; @@ -24,6 +23,7 @@ class DemonHunter extends DiabloClass { } function sustainScore() { + $ehp = $this->calculateEHP(); if($this->stats->getStat('Attacks per Second') > 2) { $lsCoefficient = .1; } else { @@ -32,7 +32,7 @@ class DemonHunter extends DiabloClass { $effectiveLs = $this->stats->getStat('DPS Unbuffed') * $this->stats->getStat('Life Steal') * $lsCoefficient; - $mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life'); + $mitigation = $ehp / $this->stats->getStat('Life'); $loh = $this->stats->getStat('Life on Hit'); if($this->type == 'pvp') { @@ -45,7 +45,7 @@ class DemonHunter extends DiabloClass { (1 + ($this->stats->getStat('Attacks per Second') - 1) / 2) + $this->stats->getStat('Life per Second') + $effectiveLs) / ($this->stats->getStat('Life') * $this->EHPScore() * 10000 / - $this->stats->getStat('EHP Unbuffed')); + $ehp); if($rawSustainScore <= 1.5) { return $rawSustainScore; @@ -105,5 +105,6 @@ class DemonHunter extends DiabloClass { + $this->stats->getStat('Missile Damage Reduction')) / 2); $this->stats->stats['EHP Unbuffed'] = $final_ehp; + return $final_ehp; } } \ No newline at end of file diff --git a/libs/diabloclass.php b/libs/diabloclass.php index cf1178a..f745c3e 100644 --- a/libs/diabloclass.php +++ b/libs/diabloclass.php @@ -36,7 +36,7 @@ class DiabloClass { $this->stats->stats['All Elemental Damage'] = $this->elementalDamage(); $this->modifyDPSUnbuffed(); - $this->modifyEHP(); + $this->calculateEHP(); } function hallScore() { @@ -57,9 +57,10 @@ class DiabloClass { } function sustainScore() { + $ehp = $this->calculateEHP(); $effectiveLS = $this->stats->getStat('DPS Unbuffed') * $this->stats->getStat('Life Steal') * .5; - $mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life'); + $mitigation = $ehp / $this->stats->getStat('Life'); $loh = $this->stats->getStat('Life on Hit'); if($this->type == 'pvp') { @@ -71,7 +72,7 @@ class DiabloClass { (1 + ($this->stats->getStat('Attacks per Second') - 1) / 2) + $effectiveLS + $this->stats->getStat('Life per Second')) / ($this->stats->getStat('Life') * $this->EHPScore() * 10000 / - $this->stats->getStat('EHP Unbuffed')); + $ehp); if($rawSustainScore <= 1.5) { return $rawSustainScore; @@ -142,8 +143,4 @@ class DiabloClass { $this->stats->stats['Exp Bonus'] = $this->stats->getStat('Exp Bonus') - .35; } } - - function modifyEHP() { - $this->calculateEHP(); - } }