-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScythetech.java
More file actions
343 lines (310 loc) · 9.64 KB
/
Copy pathScythetech.java
File metadata and controls
343 lines (310 loc) · 9.64 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
import java.util.*;
class Scythetech {
// my stats .
int scytheMAR = 42936;
int scytheMax = 54;
int scytheSpeed = 5;
int BlowpipeMAR = 39845;
int BlowpipeMax = 35;
int BlowpipeSpeed = 2;
int BlowpipeTravelTime = 1;
int TbowMAR = 64927;
int TbowMax = 88;
int TbowSpeed = 5;
int TbowTravelTime = 1;
// npc stats. --------------
// BAT stats, 1x1
int BatMDR = 1535;
int BatHP = 10;
int BatDeathAnim = 3;
// Blob stats, 2x2
int BlobMDR = 2496;
int BlobHP = 20;
int BlobDeathAnim = 5;
// Ranger stats, 3x3
int RangeMDR = 4416;
int RangeHP = 40;
int RangeDeathAnim = 5;
// Meleer stats, 3x3
int MeleeMDR = 8256;
int MeleeHP = 80;
int MeleeDeathAnim = 5;
// Mager stats, 3x3
int MageMDR = 15936;
int MageHP = 160;
int MageDeathAnim = 5;
public int hp = 5000;
public int killTime = 0;
Random rand = new Random(System.nanoTime());
public Scythetech(){
}
public double calcAccuracy(double MAR, double MDR) {
double accuracy;
if (MAR > MDR) {
accuracy = 1 - (MDR + 2) / (2 * (MAR + 1));
} else {
accuracy = (MAR / (2 * (MDR + 1)));
}
return accuracy;
}
public void ScytheHit(int mob) {
/*
* 0 = bat,
* 1 = blob,
* 2 = ranger,
* 3 = meleer,
* 4 = mager
*/
double accuracy;
// Mob = Bat (1x1)
if (mob == 0) {
accuracy = calcAccuracy(scytheMAR, BatMDR);
if (accuracy > Math.random()) {
// First scythe hit.
hp -= rand.nextInt(scytheMax + 1);
}
}
// Mob = Big blob (2x2)
if (mob == 1) {
accuracy = calcAccuracy(scytheMAR, BlobMDR);
if (accuracy > Math.random()) {
// First scythe hit.
hp -= rand.nextInt(scytheMax + 1);
if (hp <= 0) {
//Death animation speedup will not actually save a tick
//killTime -= 1;
}
} if (accuracy > Math.random()) {
// Second scythe hit
hp -= rand.nextInt((int)Math.floor(scytheMax / 2) + 1);
}
}
// Mob = 3x3
if (mob > 1) {
// placeholder value for accuracy .
accuracy = calcAccuracy(scytheMAR, RangeMDR);
// Mob = ranger
if (mob == 2) {
accuracy = calcAccuracy(scytheMAR, RangeMDR);
} else if (mob == 3) { // Mob = meleer
accuracy = calcAccuracy(scytheMAR, MeleeMDR);
} else if (mob == 4) { // Mob = mager
accuracy = calcAccuracy(scytheMAR, MageMDR);
}
if (accuracy > Math.random()) { // First scythe hitsplat
hp -= rand.nextInt(scytheMax + 1);
} if (accuracy > Math.random()) { // Second scythe hitsplat
hp -= rand.nextInt((int)Math.floor(scytheMax / 2) + 1);
if (hp <= 0) { // If it is dead at this point, death animation is sped up by one tick.
killTime -= 1;
}
} if (accuracy > Math.random()) { // Third scythe hitsplat
hp -= rand.nextInt((int)Math.floor(scytheMax / 4) + 1);
}
}
}
public void BlowpipeHit(int mob) {
// 0 = bat, 1 = blob, 2 = ranger, 3 = meleer
double accuracy = 0;
if (mob == 0) { // bat
accuracy = calcAccuracy(BlowpipeMAR, BatMDR);
} if (mob == 1) { // blob
accuracy = calcAccuracy(BlowpipeMAR, BlobMDR);
} if (mob == 2) { // ranger
accuracy = calcAccuracy(BlowpipeMAR, RangeMDR);
} if (mob == 3 ) { // meleer
accuracy = calcAccuracy(BlowpipeMAR, MeleeMDR);
} if (mob == 4) { // mager
accuracy = calcAccuracy(BlowpipeMAR, MageMDR);
}
if (accuracy > Math.random()) {
hp -= rand.nextInt(BlowpipeMax + 1);
}
}
public void Tbowhit() {
double accuracy = calcAccuracy(TbowMAR, MageMDR);
int hit = 0;
if (accuracy > Math.random()) {
hit = rand.nextInt(TbowMax + 1);
hp -= hit;
}
}
public int simulateKill(int hpForSwitch, int mob) {
killTime = 0;
if (mob == 0) {
hp = 10;
} if (mob == 1) {
hp = 20;
} if (mob == 2) {
hp = 40;
} if (mob == 3) {
hp = 80;
} if (mob == 4) {
hp = 160;
}
while (hp > hpForSwitch) {
BlowpipeHit(mob);
killTime += BlowpipeSpeed;
if (hp <= 0) {
killTime -= BlowpipeSpeed;
killTime += 1;
}
}
while (hp > 0 && hp <= hpForSwitch) {
ScytheHit(mob);
killTime += scytheSpeed;
if (hp <= 0) {
killTime -= scytheSpeed;
killTime += 0;
}
}
return killTime;
}
public int simulateKill(int hpForSwitch, int mob, int hpForSwitchTbow) {
killTime = 0;
// i don't really know yet lol
if (mob == 4) {
hp = 160;
}
while (hp > hpForSwitchTbow && hp > hpForSwitch) {
Tbowhit();
killTime += TbowSpeed;
if (hp <= 0) {
killTime -= TbowSpeed;
killTime += TbowTravelTime;
}
}
while (hp > hpForSwitch) {
BlowpipeHit(mob);
killTime += BlowpipeSpeed;
if (hp <= 0) {
killTime -= BlowpipeSpeed;
killTime += BlowpipeTravelTime;
}
}
while (hp > 0 && hp <= hpForSwitch) {
ScytheHit(mob);
killTime += scytheSpeed;
if (hp <= 0) {
killTime -= scytheSpeed;
killTime += 0;
}
}
return killTime;
}
public static void main(String[] args) {
int runs = 10000001;
Scythetech st = new Scythetech();
ArrayList<Integer> scythetechtimes = new ArrayList<Integer>();
double bestTime = Integer.MAX_VALUE;
int switchHp = 161;
double totalTime = 0;
// BAT
for (int i = 5; i < st.BatHP + 1; i++) {
scythetechtimes = new ArrayList<Integer>();
for (int x = 0; x < runs; x++) {
scythetechtimes.add(st.simulateKill(i,0));
}
totalTime = 0;
for (double d: scythetechtimes) {
totalTime += d;
}
if (totalTime < bestTime) {
switchHp = i;
bestTime = totalTime;
}
}
System.out.println("Scythe tech bat hp to scythe: " + switchHp + ", average killtime " + (double)Math.round((bestTime / runs)*100)/100);
System.out.println("Time saved: " + (double)Math.round((1.7573412426587574 - bestTime / runs)*100)/100);
System.out.println();
scythetechtimes = new ArrayList<Integer>();
bestTime = Integer.MAX_VALUE;
switchHp = 161;
// BLOB
for (int i = 9; i < st.BlobHP + 1; i++) {
scythetechtimes = new ArrayList<Integer>();
for (int x = 0; x < runs; x++) {
scythetechtimes.add(st.simulateKill(i,1));
}
totalTime = 0;
for (double d: scythetechtimes) {
totalTime += d;
}
if (totalTime < bestTime) {
switchHp = i;
bestTime = totalTime;
}
}
System.out.println("Scythe tech blob hp to scythe: " + switchHp + ", average killtime " + (double)Math.round((bestTime / runs)*100)/100);
System.out.println("Time saved: " + (double)Math.round((2.773102226897773 - bestTime / runs)*100)/100);
System.out.println();
scythetechtimes = new ArrayList<Integer>();
bestTime = Integer.MAX_VALUE;
switchHp = 161;
// RANGE
for (int i = 25; i < st.RangeHP + 1; i++) {
scythetechtimes = new ArrayList<Integer>();
for (int x = 0; x < runs; x++) {
scythetechtimes.add(st.simulateKill(i,2));
}
totalTime = 0;
for (double d: scythetechtimes) {
totalTime += d;
}
if (totalTime < bestTime) {
bestTime = totalTime;
switchHp = i;
}
}
System.out.println("Scythe tech range hp to scythe: " + switchHp + ", average killtime " + (double)Math.round((bestTime / runs)*100)/100);
System.out.println("Time saved: " + (double)Math.round((5.596445403554596 - bestTime / runs)*100)/100);
System.out.println();
scythetechtimes = new ArrayList<Integer>();
bestTime = Integer.MAX_VALUE;
switchHp = 161;
// MELEE
for (int i = 0; i < 80; i++) {
scythetechtimes = new ArrayList<Integer>();
for (int x = 0; x < runs; x++) {
scythetechtimes.add(st.simulateKill(i,3));
}
totalTime = 0;
for (double d: scythetechtimes) {
totalTime += d;
}
if (totalTime < bestTime) {
switchHp = i;
bestTime = totalTime;
}
}
System.out.println("Scythe tech melee hp to scythe: " + switchHp + ", average killtime " + (double)Math.round((bestTime / runs)*100)/100);
System.out.println("Time saved: " + (double)Math.round((11.520807479192522 - bestTime / runs)*100)/100);
System.out.println();
int switchHpTbow = 161;
scythetechtimes = new ArrayList<Integer>();
bestTime = Integer.MAX_VALUE;
switchHp = 161;
// MAGE
for (int i = 10; i < 160; i++) {
for (int l = 0; l < 1; l++) {
scythetechtimes = new ArrayList<Integer>();
for (int x = 0; x < runs; x++) {
scythetechtimes.add(st.simulateKill(i,4,l));
}
totalTime = 0;
for (double d: scythetechtimes) {
totalTime += d;
}
if (totalTime < bestTime) {
switchHp = i;
switchHpTbow = l;
bestTime = totalTime;
}
//System.out.println("Average killtime l = " + l + ": " + totalTime / runs);
}
}
System.out.println("Scythe tech mage hp to blowpipe: " + switchHpTbow + ", hp to scythe: " + switchHp);
System.out.println("Average killtime: " + (double)Math.round((bestTime / runs)*100)/100);
System.out.println("Time saved: " + (double)Math.round((22.002443997556004 - bestTime / runs)*100)/100);
}
}