Skip to content

Instantly share code, notes, and snippets.

@inkedawn inkedawn/calc.html
Created Jan 13, 2019

What would you like to do?
剑网3 会心/伤害(治疗)秘籍收益计算
<!DOCTYPE html>
<label for="criticalEffect">输入会效(%):</label>
<input type="text" placeholder="如175" id="criticalEffect" value="175">
<div id="result">
function esoterica(type, value) {
this.type = type; // damage or critical
this.value = value; // percentage
esoterica.prototype.calcRatio = function(criticalEffect) {
if (this.type === "damage") return 1*this.value;
if (this.type === "critical") return (criticalEffect-1)*this.value;
return 0;
esoterica.prototype.toString = function() {
if (this.type === "damage") return this.value.toString()+"%伤害(或治疗)";
if (this.type === "critical") return this.value.toString()+"%会心";
return "unknown esoterica";
function clearResult() {
let result = document.querySelector("#result");
for (elem of result.childNodes) {
document.querySelector("#criticalEffect").addEventListener("input", function(){
let effect = parseInt(document.querySelector("#criticalEffect").value)/100;
let eso = [];
for (var i=1; i<=6; i++) {
eso.push(new esoterica("damage", i));
eso.push(new esoterica("critical", i));
result.innerText = eso.join(" > ");
document.querySelector("#criticalEffect").dispatchEvent(new Event("input"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.