-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
155 lines (129 loc) · 6.78 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
const Ability = {
Judgement: "Judgement",
CrusaderStrike: "CrusaderStrike",
DivineStorm: "DivineStorm",
HammerOfWrath: "HammerOfWrath",
Exorcism: "Exorcism",
Consecration: "Consecration",
HolyWrath: "HolyWrath"
}
const GCDType = {
Melee: "Melee",
Spell: "Spell"
}
const SpellGCDType = {
Additive: "Additive",
Multiplicative: "Multiplicative"
}
//TODO Add Glove Enchant and make haste a list of times and percentages
const ms = 1
const s = 1000
const gcd = 1500
function findBestPrio() {
const spellCDs = new Map();
const spellDmgs = new Map();
const gcdTypes = new Map();
const abilitys = [];
let sealOfVengeanceDmg = 0
if (document.getElementById("SealOfVengeanceEnabled").checked){
sealOfVengeanceDmg = document.getElementById("SealOfVengeanceAvrCast").valueAsNumber;
}
let targetCount = document.getElementById("TargetCount").valueAsNumber
let sealOfCommandDmg = 0
if (document.getElementById("SealOfCommandEnabled").checked){
sealOfCommandDmg = document.getElementById("SealOfCommandAvrCast").valueAsNumber;
sealOfCommandDmg -= sealOfCommandDmg * document.getElementById("SealOfCommandMiss").valueAsNumber / 100
}
if (document.getElementById("JudgementEnabled").checked) {
abilitys.push(Ability.Judgement);
spellCDs.set(Ability.Judgement, document.getElementById("JudgementCD").valueAsNumber * s);
let avrCast = document.getElementById("JudgementAvrCast").valueAsNumber
let crit = document.getElementById("JudgementCrit").valueAsNumber / 100
let righteousVengeanceDmg = (avrCast / 3.06) * 2.06 * 0.3
spellDmgs.set(Ability.Judgement, avrCast + (righteousVengeanceDmg * crit) );
gcdTypes.set(Ability.Judgement, GCDType.Melee);
}
if (document.getElementById("CrusaderStrikeEnabled").checked) {
abilitys.push(Ability.CrusaderStrike);
spellCDs.set(Ability.CrusaderStrike, document.getElementById("CrusaderStrikeCD").valueAsNumber * s);
let avrCast = document.getElementById("CrusaderStrikeAvrCast").valueAsNumber
let crit = document.getElementById("CrusaderStrikeCrit").valueAsNumber / 100
let righteousVengeanceDmg = (avrCast / 3.06) * 2.06 * 0.3
let socDmg = sealOfCommandDmg * Math.max(targetCount, 3)
spellDmgs.set(Ability.CrusaderStrike, avrCast + sealOfVengeanceDmg + socDmg + (righteousVengeanceDmg * crit) );
gcdTypes.set(Ability.CrusaderStrike, GCDType.Melee);
}
if (document.getElementById("DivineStormEnabled").checked) {
abilitys.push(Ability.DivineStorm);
spellCDs.set(Ability.DivineStorm, document.getElementById("DivineStormCD").valueAsNumber * s);
let avrCast = document.getElementById("DivineStormAvrCast").valueAsNumber;
let crit = document.getElementById("DivineStormCrit").valueAsNumber / 100;
let righteousVengeanceDmg = (avrCast / 3.06) * 2.06 * 0.3
let socDmg = sealOfCommandDmg * Math.max(targetCount, 4)
spellDmgs.set(Ability.DivineStorm, avrCast + sealOfVengeanceDmg + socDmg + (righteousVengeanceDmg * crit) );
gcdTypes.set(Ability.DivineStorm, GCDType.Melee);
}
if (document.getElementById("HammerOfWrathEnabled").checked) {
abilitys.push(Ability.HammerOfWrath);
spellCDs.set(Ability.HammerOfWrath, document.getElementById("HammerOfWrathCD").valueAsNumber * s);
let avrCast = document.getElementById("HammerOfWrathAvrCast").valueAsNumber;
let socDmg = sealOfCommandDmg * Math.max(targetCount, 3)
spellDmgs.set(Ability.HammerOfWrath, avrCast + sealOfVengeanceDmg + socDmg);
gcdTypes.set(Ability.HammerOfWrath, GCDType.Melee);
}
if (document.getElementById("ExorcismEnabled").checked) {
abilitys.push(Ability.Exorcism);
spellCDs.set(Ability.Exorcism, document.getElementById("ExorcismCD").valueAsNumber * s);
spellDmgs.set(Ability.Exorcism, document.getElementById("ExorcismAvrCast").valueAsNumber);
gcdTypes.set(Ability.Exorcism, GCDType.Spell);
}
if (document.getElementById("ConsecrationEnabled").checked) {
abilitys.push(Ability.Consecration);
spellCDs.set(Ability.Consecration, document.getElementById("ConsecrationCD").valueAsNumber * s);
let avrHit = document.getElementById("ConsecrationAvrHit").valueAsNumber;
let miss = document.getElementById("ConsecrationMiss").valueAsNumber / 100;
spellDmgs.set(Ability.Consecration, (avrHit - (avrHit * miss)) * (spellCDs.get(Ability.Consecration) / s) * targetCount);
gcdTypes.set(Ability.Consecration, GCDType.Spell);
}
if (document.getElementById("HolyWrathEnabled").checked) {
abilitys.push(Ability.HolyWrath);
spellCDs.set(Ability.HolyWrath, document.getElementById("HolyWrathCD").valueAsNumber * s);
spellDmgs.set(Ability.HolyWrath, document.getElementById("HolyWrathAvrCast").valueAsNumber);
gcdTypes.set(Ability.HolyWrath, GCDType.Spell);
}
let startTime = document.getElementById("MinFightLength").valueAsNumber * s
let endTime = document.getElementById("MaxFightLength").valueAsNumber * s
let timeStep = document.getElementById("Timestep").valueAsNumber * s
let spellHaste = document.getElementById("SpellHaste").valueAsNumber
const hasteModifiers = [];
let heroismCastTimes = document.getElementById("HeroismCastTime").value.split(",").filter(x => x.trim().length && !isNaN(x)).map(Number)
for (const heroismCastTime of heroismCastTimes) {
hasteModifiers.push([heroismCastTime * s, 40 * s, SpellGCDType.Multiplicative, 1.3])
}
let speedPotionCastTimes = document.getElementById("SpeedPotionCastTime").value.split(",").filter(x => x.trim().length && !isNaN(x)).map(Number)
for (const speedPotionCastTime of speedPotionCastTimes) {
hasteModifiers.push([speedPotionCastTime * s, 15 * s, SpellGCDType.Additive, 500])
}
let hyperspeedAcceleratorsCastTimes = document.getElementById("HyperspeedAcceleratorsCastTime").value.split(",").filter(x => x.trim().length && !isNaN(x)).map(Number)
for (const hyperspeedAcceleratorsCastTime of hyperspeedAcceleratorsCastTimes) {
hasteModifiers.push([hyperspeedAcceleratorsCastTime * s, 12 * s, SpellGCDType.Additive, 340])
}
document.getElementById("RunButton").disabled = true;
const prioWorker = new Worker("./worker.js");
prioWorker.postMessage([abilitys, startTime, endTime, timeStep, spellCDs, spellDmgs, gcdTypes, spellHaste, hasteModifiers]);
//runRotation([Ability.HammerOfWrath, Ability.Judgement, Ability.CrusaderStrike, Ability.DivineStorm, Ability.Exorcism, Ability.HolyWrath, Ability.Consecration], spellCDs, //spellDmgs, gcdTypes, spellHaste, 180 * s, hasteModifiers)
prioWorker.onmessage = function(e) {
document.getElementById('OutputArea').value = e.data;
document.getElementById("RunButton").disabled = false;
}
}
document.getElementById('SealOfCommandEnabled').addEventListener('change', e => {
if(e.target.checked){
document.getElementById('SealOfVengeanceEnabled').checked = false;
}
});
document.getElementById('SealOfVengeanceEnabled').addEventListener('change', e => {
if(e.target.checked){
document.getElementById('SealOfCommandEnabled').checked = false;
}
});