Merge branch 'feature-pve_update'
This commit is contained in:
commit
354650e421
5 changed files with 275 additions and 107 deletions
|
@ -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);
|
||||
$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.');
|
||||
}
|
||||
?>
|
||||
<hr/>
|
||||
<b>Hall Score: <?php echo number_format($character->hallScore(), 2, '.', ','); ?></b><br/><br/>
|
||||
|
||||
DPS Score: <?php echo number_format($character->DPSScore(), 2, '.', ','); ?><br/>
|
||||
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/>
|
||||
<table border="1" cellpadding="3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>PvE</th>
|
||||
<th>PvP</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>Hall Score</b></td>
|
||||
<td><?php echo number_format($pve->hallScore(), 2, '.', ','); ?></td>
|
||||
<td><?php echo number_format($pvp->hallScore(), 2, '.', ','); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>DPS Score</b></td>
|
||||
<td><?php echo number_format($pve->DPSScore(), 2, '.', ','); ?></td>
|
||||
<td><?php echo number_format($pvp->DPSScore(), 2, '.', ','); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>EHP Score</b></td>
|
||||
<td><?php echo number_format($pve->EHPScore(), 2, '.', ','); ?></td>
|
||||
<td><?php echo number_format($pvp->EHPScore(), 2, '.', ','); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Sustain Score</b></td>
|
||||
<td><?php echo number_format($pve->sustainScore(), 2, '.', ','); ?></td>
|
||||
<td><?php echo number_format($pvp->sustainScore(), 2, '.', ','); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Move Score</b></td>
|
||||
<td><?php echo number_format($pve->moveScore(), 2, '.', ','); ?></td>
|
||||
<td><?php echo number_format($pvp->moveScore(), 2, '.', ','); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Paragon Score</b></td>
|
||||
<td><?php echo number_format($pve->paragonScore(), 2, '.', ','); ?></td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Misc Score</b></td>
|
||||
<td><?php echo number_format($pve->miscScore(), 2, '.', ','); ?></td>
|
||||
<td><?php echo number_format($pvp->miscScore(), 2, '.', ','); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr/>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -1,8 +1,68 @@
|
|||
<?php
|
||||
class Barbarian extends DiabloClass {
|
||||
function __construct($stats) {
|
||||
$this->class = $stats->class;
|
||||
|
||||
parent::__construct($stats);
|
||||
function __construct($stats, $type) {
|
||||
parent::__construct($stats, $type);
|
||||
}
|
||||
|
||||
function EHPScore() {
|
||||
$ehp = $this->calculateEHP();
|
||||
|
||||
if($this->type == 'pvp') {
|
||||
return $ehp / 10000;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
return $final_ehp;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,15 @@
|
|||
<?php
|
||||
class DemonHunter extends DiabloClass {
|
||||
function __construct($stats) {
|
||||
$this->class = $stats->class;
|
||||
|
||||
parent::__construct($stats);
|
||||
function __construct($stats, $type) {
|
||||
parent::__construct($stats, $type);
|
||||
}
|
||||
|
||||
|
||||
function EHPScore() {
|
||||
$ehp = $this->stats->getStat('EHP Unbuffed');
|
||||
$ehp = $this->calculateEHP();
|
||||
|
||||
if($this->type == 'pvp') {
|
||||
return $ehp / 10000;
|
||||
}
|
||||
|
||||
if($ehp <= 500000) {
|
||||
return $ehp / 10000;
|
||||
|
@ -21,15 +23,39 @@ class DemonHunter extends DiabloClass {
|
|||
}
|
||||
|
||||
function sustainScore() {
|
||||
$effectiveLs = $this->stats->getStat('DPS Unbuffed') *
|
||||
$this->stats->getStat('Life Steal') * .2;
|
||||
$mitigation = $this->stats->getStat('EHP Unbuffed') / $this->stats->getStat('Life');
|
||||
$ehp = $this->calculateEHP();
|
||||
if($this->stats->getStat('Attacks per Second') > 2) {
|
||||
$lsCoefficient = .1;
|
||||
} else {
|
||||
$lsCoefficient = .2;
|
||||
}
|
||||
|
||||
return 1 + $mitigation * ($this->stats->getStat('Life on Hit') *
|
||||
($this->stats->getStat('Attacks per Second') + 1) / 2 +
|
||||
$effectiveLs = $this->stats->getStat('DPS Unbuffed') *
|
||||
$this->stats->getStat('Life Steal') * $lsCoefficient;
|
||||
$mitigation = $ehp / $this->stats->getStat('Life');
|
||||
$loh = $this->stats->getStat('Life on Hit');
|
||||
|
||||
if($this->type == 'pvp') {
|
||||
$ls = 0;
|
||||
$loh = 0;
|
||||
}
|
||||
|
||||
|
||||
$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'));
|
||||
$ehp);
|
||||
|
||||
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() {
|
||||
|
@ -37,4 +63,48 @@ class DemonHunter extends DiabloClass {
|
|||
$this->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 = 0.30;$incoming_attack = 250000;
|
||||
$net_mod = .50; // no idea what this is for
|
||||
} else {
|
||||
$ar_mod = 315;$armor_mod = 3150;$inherent_red = 0.00;$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;
|
||||
return $final_ehp;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
class DiabloClassFactory {
|
||||
function createClassObject($class, $stats) {
|
||||
function createClassObject($class, $stats, $type) {
|
||||
if(!DiabloClassFactory::isValidClass($class)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
include_once(__DIR__ . "/$class.php");
|
||||
return new $class($stats);
|
||||
return new $class($stats, $type);
|
||||
}
|
||||
|
||||
private
|
||||
|
@ -23,15 +23,29 @@ class DiabloClassFactory {
|
|||
|
||||
class DiabloClass {
|
||||
var $class;
|
||||
var $type;
|
||||
var $stats = array();
|
||||
|
||||
function __construct($stats) {
|
||||
function __construct($stats, $type) {
|
||||
$this->stats = $stats;
|
||||
$this->type = $type;
|
||||
$this->class = $stats->class;
|
||||
|
||||
$this->modifyExpBonus();
|
||||
|
||||
$this->stats->stats['All Elemental Damage'] = $this->elementalDamage();
|
||||
|
||||
$this->modifyDPSUnbuffed();
|
||||
$this->calculateEHP();
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -39,29 +53,26 @@ 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() {
|
||||
$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');
|
||||
|
||||
$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 /
|
||||
$this->stats->getStat('EHP Unbuffed'));
|
||||
$ehp);
|
||||
|
||||
if($rawSustainScore <= 1.5) {
|
||||
return $rawSustainScore;
|
||||
|
@ -85,4 +96,51 @@ class DiabloClass {
|
|||
function miscScore() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected
|
||||
function isParagonMaxed() {
|
||||
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;
|
||||
foreach($this->stats as $stat => $value) {
|
||||
if(preg_match('/\+DPS \(.*\)/', $stat) > 0) {
|
||||
$totalElemental += $value;
|
||||
}
|
||||
}
|
||||
|
||||
return ($totalElemental > 0) ? $totalElemental : 0;
|
||||
}
|
||||
|
||||
function calculateGemLife() {
|
||||
if($this->isParagonMaxed() || $this->type == 'pvp') 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,6 @@ class DiabloProgressStats extends Stats {
|
|||
$this->parseStats();
|
||||
}
|
||||
|
||||
protected
|
||||
function isParagonMaxed() {
|
||||
return $this->getStat('Paragon Level') == 100;
|
||||
}
|
||||
|
||||
private
|
||||
function findClass() {
|
||||
preg_match('{<span class="diablo_.*?">(.*?)</span>}', $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'));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue