Diablo 3 Damage Reduction
HTML
<body>
<H1>Damage Reduction and EHP simulator</H1>
<label for="barbmonk">Barbar/Monk 30% DR</label> <input id="barbmonk" type="checkbox"><br/>
<label for="prismatic">Prismatic</label> <input id="prismatic" type="checkbox"><br/>
<label for="archon">Archon</label> <input id="archon" type="checkbox"><br/>
<label for="imunity">Imunity</label> <input id="imunity" type="checkbox"><br/>
<p>Monster Level: <span class="value mobLevel"></span></p>
<div id="slider-mobLevel" class="slider"></div>
<p>Armor: <span class="value armor armorColor"></span></p>
<div id="slider-armor" class="slider"></div>
<p class="comment">
Damage reduction from armor =
<span class="value armorBuffed armorColor"></span> <small>Armor</small> / (50 × <span class="value mobLevel"></span> <small>Monster Level</small>
+ <span class="value armorBuffed armorColor"></span> <small>Armor</small>)
= <span class="value armorDR"></span>
= <span class="value armorDRpct"></span>
</p>
<p>AllRes: <span class="value allres allresColor"></span></p>
<div id="slider-allres" class="slider"></div>
<p class="comment">
Damage reduction from resistance =
<span class="value allresBuffed allresColor"></span> <small>Resistance</small> / (5 × <span class="value mobLevel"></span> <small>Monster Level</small>
+ <span class="value allresBuffed allresColor"></span> <small>Resistance</small>)
= <span class="value allresDR"></span>
= <span class="value allresDRpct"></span>
</p>
<p class="comment">
Total damage reduction =
1 - ((1 - <span class="value armorDR"></span> <small>DR from Armor</small>) × (1 - <span class="value allresDR"></span> <small>DR from Resistance</small>) × (1 - <span class="value barbarmonk"></span> <small>Barbar/Monk DR</small>))
= <span class="value totalDR"></span>
= <span class="value totalDRpct"></span>
</p>
<p>Life: <span...
CSS
h1 {
font-size: 20px;
}
.value {
width: 60px;
border: 0;
color: #f6931f;
font-weight: bold;
}
.armorColor {
color: #663366;
}
.allresColor {
color: #339999;
}
.lifeColor {
color: #cc3333;
}
.armorDR, .allresDR, .totalDR, .ehpColor {
color: #339933;
}
.armorDRpct, .allresDRpct, .totalDRpct, .pctColor {
color: #333399;
}
.slider {
width: 500px;
}
.comment {
color: #666;
}
.active {
color: #303;
}
.inactive {
color: #999;
}
JavaScript
// diablo 3 simulator
// Dmg reduction calculation by LeonardoCA based on http://www.clicktoloot.com/p/combat.html
var mobLevel = 63;
var simulator = {
barbarmonk: 0,
prismatic: 0,
archon: 0,
imunity: 0,
armor: 6296,
allres: 717,
life: 117054,
armorBuffed: function () {
return this.armor * (1 + 0.35 * this.prismatic) * (1 + 0.4 * this.archon) * (1 + 0.2 * this.imunity);
},
allresBuffed: function () {
return this.allres * (1 + 0.25 * this.prismatic) * (1 + 0.4 * this.archon) * (1 + 0.2 * this.imunity);
},
armorDR: function (mobLevel) {
return this.armorBuffed() / (50 * mobLevel + this.armorBuffed());
},
allresDR: function (mobLevel) {
return this.allresBuffed() / (5 * mobLevel + this.allresBuffed());
},
totalDR: function (mobLevel) {
return 1 - ((1 - this.armorDR(mobLevel)) * (1 - this.allresDR(mobLevel)) * (1 - this.barbarmonk));
},
ehp: function (mobLevel) {
return this.life / ((1 - this.armorDR(mobLevel)) * (1 - this.allresDR(mobLevel)) * (1 - this.barbarmonk));
},
format: function (value) {
return Number(value).toFixed(4);
},
formatPct: function (value) {
return Number(value*100).toFixed(2) + '%';
},
formatActive: function (value) {
return value ? 'active' : 'inactive';
},
toCompare: function (mobLevel) {
return '<small>Mob level:</small> <span class="value">' + mobLevel + '</span> '
+ '<small>Armor:</small> <span class="value armorColor">' + this.armor + '</span> '
+ '<small>AllRes:</small> <span class="value allresColor">' + this.allres + '</span> '
+ '<small>Barbar/Monk DR:</small> <span class="value allresColor">' + (this.barbarmonk * 100) + '% </span> '
+ '<small>Total DR:</small> <span class="value pctColor">' + this.formatPct(this.totalDR(mobLevel)) + '</span> '
+ '<small>Life:</small> <span class="value...