1
0
Fork 0

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/>
Move Score: <?php echo number_format($character->moveScore(), 2, '.', ','); ?><br/>
Paragon Score: <?php echo number_format($character->paragonScore(), 2, '.', ','); ?><br/>
Misc Score: <?php echo number_format($character->miscScore(), 2, '.', ','); ?><br/>
<hr/>
<?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) {
case 'barbarian':
return new Barbarian($characterPage, $elementalOnWeapon);
case 'wizard':
return new Wizard($characterPage, $elementalOnWeapon);
case 'demonhunter':
return new DemonHunter($characterPage, $elementalOnWeapon);
default:
return false;
}
@ -20,7 +20,7 @@ class DPClassFactory {
function findClass($characterPage) {
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() {
return $this->DPSScore() * $this->EHPScore() * $this->sustainScore()
* $this->moveScore() * $this->paragonScore();
* $this->moveScore() * $this->paragonScore() * $this->miscScore();
}
function DPSScore() {
@ -92,6 +92,10 @@ class DPClass {
return 1 + $this->stats['Paragon Level'] / 2 / 100;
}
function miscScore() {
return 1;
}
protected
function isParagonMaxed() {
return $this->getStat('Paragon Level') == 100;