Add Demon Hunter Class

Implement a new class for handling Demon Hunters.  Demon Hunter
formulas are slightly different and can be maintained via the
Demon Hunter class file.
This commit is contained in:
Andrew Tomaka 2012-12-03 14:03:26 -05:00
parent a4dc61ff09
commit 557157238e
3 changed files with 43 additions and 4 deletions

View file

@ -31,6 +31,7 @@ EHP Score: <?php echo number_format($character->EHPScore(), 2, '.', ','); ?><br/
Sustain Score: <?php echo number_format($character->sustainScore(), 2, '.', ','); ?><br/> Sustain Score: <?php echo number_format($character->sustainScore(), 2, '.', ','); ?><br/>
Move Score: <?php echo number_format($character->moveScore(), 2, '.', ','); ?><br/> Move Score: <?php echo number_format($character->moveScore(), 2, '.', ','); ?><br/>
Paragon Score: <?php echo number_format($character->paragonScore(), 2, '.', ','); ?><br/> Paragon Score: <?php echo number_format($character->paragonScore(), 2, '.', ','); ?><br/>
Misc Score: <?php echo number_format($character->miscScore(), 2, '.', ','); ?><br/>
<hr/> <hr/>
<?php <?php
} }

34
libs/demonhunter.php Normal file
View file

@ -0,0 +1,34 @@
<?php
class DemonHunter extends DPClass {
function EHPScore() {
$ehp = $this->getStat('EHP Unbuffed');
if($ehp <= 500000) {
return $ehp / 10000;
} elseif(500000 < $ehp && $ehp <= 1000000) {
return 50 + ($ehp-500000) / 20000;
} elseif(1000000 < $ehp && $ehp <= 2000000) {
return 75 + ($ehp - 1000000) / 40000;
} else {
return 100 + ($ehp - 2000000) / 100000;
}
}
function sustainScore() {
$effectiveLs = $this->getStat('DPS Unbuffed') *
$this->getStat('Life Steal') * .2;
$mitigation = $this->getStat('EHP Unbuffed') / $this->getStat('Life');
return 1 + $mitigation * ($this->getStat('Life on Hit') *
($this->getStat('Attacks per Second') + 1) / 2 +
$this->getStat('Life per Second') + $effectiveLs) /
($this->getStat('Life') * $this->EHPScore() * 10000 /
$this->getStat('EHP Unbuffed'));
}
function miscScore() {
return 1 + ($this->getStat('+Maximum Discipline') / 2 +
$this->getStat('+Hatred Regenerated per Second') * 2 +
$this->getStat('+Discipline Regenerated per Second') * 15) / 100;
}
}

View file

@ -9,8 +9,8 @@ class DPClassFactory {
switch($class) { switch($class) {
case 'barbarian': case 'barbarian':
return new Barbarian($characterPage, $elementalOnWeapon); return new Barbarian($characterPage, $elementalOnWeapon);
case 'wizard': case 'demonhunter':
return new Wizard($characterPage, $elementalOnWeapon); return new DemonHunter($characterPage, $elementalOnWeapon);
default: default:
return false; return false;
} }
@ -20,7 +20,7 @@ class DPClassFactory {
function findClass($characterPage) { function findClass($characterPage) {
preg_match('{<span class="diablo_.*?">(.*?)</span>}', $characterPage, $class); preg_match('{<span class="diablo_.*?">(.*?)</span>}', $characterPage, $class);
return strtolower($class[1]); return str_replace(' ', '', strtolower($class[1]));
} }
} }
@ -41,7 +41,7 @@ class DPClass {
function hallScore() { function hallScore() {
return $this->DPSScore() * $this->EHPScore() * $this->sustainScore() return $this->DPSScore() * $this->EHPScore() * $this->sustainScore()
* $this->moveScore() * $this->paragonScore(); * $this->moveScore() * $this->paragonScore() * $this->miscScore();
} }
function DPSScore() { function DPSScore() {
@ -92,6 +92,10 @@ class DPClass {
return 1 + $this->stats['Paragon Level'] / 2 / 100; return 1 + $this->stats['Paragon Level'] / 2 / 100;
} }
function miscScore() {
return 1;
}
protected protected
function isParagonMaxed() { function isParagonMaxed() {
return $this->getStat('Paragon Level') == 100; return $this->getStat('Paragon Level') == 100;