Scoped methods
This commit is contained in:
parent
bbf58e4d31
commit
7cab64e704
1 changed files with 84 additions and 82 deletions
124
libs/dpclass.php
124
libs/dpclass.php
|
@ -39,6 +39,69 @@ class DPClass {
|
|||
$this->parseStats();
|
||||
}
|
||||
|
||||
function hallScore() {
|
||||
return $this->DPSScore() * $this->EHPScore() * $this->sustainScore()
|
||||
* $this->moveScore() * $this->paragonScore();
|
||||
}
|
||||
|
||||
function DPSScore() {
|
||||
return $this->getStat('DPS Unbuffed') / 1000;
|
||||
}
|
||||
|
||||
function EHPScore() {
|
||||
$ehp = $this->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;
|
||||
}
|
||||
}
|
||||
|
||||
function sustainScore() {
|
||||
$effectiveLS = $this->getStat('DPS Unbuffed') *
|
||||
$this->getStat('Life Steal') * .5;
|
||||
$mitigation = $this->getStat('EHP Unbuffed') / $this->getStat('Life');
|
||||
|
||||
$rawSustainScore = 1 + $mitigation * ($this->getStat('Life on Hit') *
|
||||
(1 + ($this->getStat('Attacks per Second') - 1) / 2) +
|
||||
$effectiveLS + $this->getStat('Life per Second')) /
|
||||
($this->getStat('Life') * $this->EHPScore() * 10000 /
|
||||
$this->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 moveScore() {
|
||||
return ($this->getStat('Movement Speed') > .25) ? 1.25 : 1 + $this->getStat('Movement Speed');
|
||||
}
|
||||
|
||||
function paragonScore() {
|
||||
return 1 + $this->stats['Paragon Level'] / 2 / 100;
|
||||
}
|
||||
|
||||
protected
|
||||
function isParagonMaxed() {
|
||||
return $this->getStat('Paragon Level') == 100;
|
||||
}
|
||||
|
||||
function getStat($name) {
|
||||
return (isset($this->stats[$name])) ? $this->stats[$name] : 0;
|
||||
}
|
||||
|
||||
private
|
||||
function parseStats() {
|
||||
preg_match_all('{<div class="char_attr"><nobr><span class="char_attr_name">(.*?):<\/span> <span class="char_attr_value">(.*?)<\/span><\/nobr><\/div>}', $this->dpHTML, $attributes);
|
||||
|
||||
|
@ -113,65 +176,4 @@ class DPClass {
|
|||
(1 + $this->getStat('Life Bonus') + $this->getStat('Gem Life')) /
|
||||
(1 + $this->getStat('Life Bonus'));
|
||||
}
|
||||
|
||||
function isParagonMaxed() {
|
||||
return $this->getStat('Paragon Level') == 100;
|
||||
}
|
||||
|
||||
function hallScore() {
|
||||
return $this->DPSScore() * $this->EHPScore() * $this->sustainScore()
|
||||
* $this->moveScore() * $this->paragonScore();
|
||||
}
|
||||
|
||||
function DPSScore() {
|
||||
return $this->getStat('DPS Unbuffed') / 1000;
|
||||
}
|
||||
|
||||
function EHPScore() {
|
||||
$ehp = $this->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;
|
||||
}
|
||||
}
|
||||
|
||||
function sustainScore() {
|
||||
$effectiveLS = $this->getStat('DPS Unbuffed') *
|
||||
$this->getStat('Life Steal') * .5;
|
||||
$mitigation = $this->getStat('EHP Unbuffed') / $this->getStat('Life');
|
||||
|
||||
$rawSustainScore = 1 + $mitigation * ($this->getStat('Life on Hit') *
|
||||
(1 + ($this->getStat('Attacks per Second') - 1) / 2) +
|
||||
$effectiveLS + $this->getStat('Life per Second')) /
|
||||
($this->getStat('Life') * $this->EHPScore() * 10000 /
|
||||
$this->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 moveScore() {
|
||||
return ($this->getStat('Movement Speed') > .25) ? 1.25 : 1 + $this->getStat('Movement Speed');
|
||||
}
|
||||
|
||||
function paragonScore() {
|
||||
return 1 + $this->stats['Paragon Level'] / 2 / 100;
|
||||
}
|
||||
|
||||
function getStat($name) {
|
||||
return (isset($this->stats[$name])) ? $this->stats[$name] : 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue