-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFluffyBot !dailyAt.js
More file actions
957 lines (923 loc) · 30 KB
/
FluffyBot !dailyAt.js
File metadata and controls
957 lines (923 loc) · 30 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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
//!dailyAt Month Day Year
function getDailyAt(Month,Day,Year) {
let today = new Date();
let date = new Date(Year, Month-1, Day);
return getDailyDescription(Date.daysBetween(today,date));
}
function getDailyAt(Month,Day) {
let today = new Date();
let date = new Date(today.getUTCFullYear(), Month-1, Day);
return getDailyDescription(Date.daysBetween(today,date));
}
Date.daysBetween = function( date1, date2 ) {
//Get 1 day in milliseconds
var one_day=1000*60*60*24;
// Convert both dates to milliseconds
var date1_ms = date1.getTime();
var date2_ms = date2.getTime();
// Calculate the difference in milliseconds
var difference_ms = date2_ms - date1_ms;
// Convert back to days and return
return Math.round(difference_ms/one_day);
}
function seededRandom(seed){
var x = Math.sin(seed++) * 10000;
return parseFloat((x - Math.floor(x)).toFixed(7));
}
function getRandomIntSeeded(seed, minIncl, maxExcl) {
var toReturn = Math.floor(seededRandom(seed) * (maxExcl - minIncl)) + minIncl;
return (toReturn === maxExcl) ? minIncl : toReturn;
}
function everythingInArrayGreaterEqual(smaller, bigger){
if (bigger.length < smaller.length) return false;
for (var x = 0; x < smaller.length; x++){
if (smaller[x] > bigger[x]) return false;
}
return true;
}
function prettifySub(number){
number = parseFloat(number);
var floor = Math.floor(number);
if (number === floor) // number is an integer, just show it as-is
return number;
var precision = 3 - floor.toString().length; // use the right number of digits
return number.toFixed(3 - floor.toString().length);
}
function getDailyHeliumValue(weight){
//min 2, max 6
var value = 75 * weight + 20;
if (value < 100) value = 100;
else if (value > 500) value = 500;
value += 100; //Yes we assume Fluffy
return value;
}
function countDailyWeight(dailyObj){
var weight = 0;
for (var item in dailyObj){
if (item == "seed") continue;
weight += dailyModifiers[item].getWeight(dailyObj[item].strength);
}
return weight;
}
function getDailyDescription(n) {
let daily = getDailyChallengeAt(n);
let returnText = "";
for (var item in daily){
if (item == 'seed') continue;
returnText += dailyModifiers[item].description(daily[item].strength) + "\n";
}
returnText += "Challenge has no end point, and grants an additional " + prettifySub(getDailyHeliumValue(countDailyWeight(daily))) + "% of all helium earned before finishing.";
return returnText;
}
function getDailyTimeString(add, makePretty, getDayOfWeek){
var today = new Date();
if (!add) add = 0;
let lastAdd = 0;
today.setUTCDate(today.getUTCDate() + add + lastAdd);
var year = today.getUTCFullYear();
var month = today.getUTCMonth() + 1; //For some reason January is month 0? Why u do dis?
if (month < 10) month = "0" + month;
var day = today.getUTCDate();
if (day < 10) day = "0" + day;
var seedStr = String(year) + String(month) + String(day);
seedStr = parseInt(seedStr, 10);
return seedStr;
}
function getDailyChallengeAt(add){
var now = new Date().getTime();
var dateSeed = getDailyTimeString(add);
var returnText = "";
var seedStr = getRandomIntSeeded(dateSeed + 2, 1, 1e9);
var weightTarget = getRandomIntSeeded(seedStr++, 25, 51) / 10;
var modifierList = [];
var totalChance = 0;
var dailyObject = {};
for (var item in dailyModifiers){
modifierList.push(item);
totalChance += dailyModifiers[item].chance;
}
var chanceMod = 1000 / totalChance;
var currentWeight = 0;
var maxLoops = modifierList.length;
var sizeCount = [0,0,0];// < 0.3, < 1, >= 1
var sizeTarget = [getRandomIntSeeded(seedStr++, 0, 2), getRandomIntSeeded(seedStr++, 1, 5), getRandomIntSeeded(seedStr++, 2, 6)]
if (weightTarget < 2.75) {
sizeTarget[2] = 0; sizeTarget[0] += 2;
}
mainLoop:
for (var x = 0; x < maxLoops; x++){
var maxZLoops = modifierList.length;
var firstChoice = [];
modLoop:
for (var z = 0; z < maxZLoops; z++){
var roll = getRandomIntSeeded(seedStr++, 0, 1000);
var selectedIndex;
var checkedTotal = 0;
lookupLoop:
for (var y = 0; y < modifierList.length; y++){
checkedTotal += dailyModifiers[modifierList[y]].chance * chanceMod;
if ((roll < checkedTotal) || y == modifierList.length - 1){
totalChance -= dailyModifiers[modifierList[y]].chance;
chanceMod = 1000 / totalChance;
selectedIndex = y;
break lookupLoop;
}
}
var selectedMod = modifierList[selectedIndex];
var modObj = dailyModifiers[selectedMod];
var str = modObj.minMaxStep[0] + (getRandomIntSeeded(seedStr++, 0, Math.floor(((modObj.minMaxStep[1] + modObj.minMaxStep[2]) * (1 / modObj.minMaxStep[2]))) - modObj.minMaxStep[0]) * modObj.minMaxStep[2]);
var modWeight = modObj.getWeight(str);
var modSize = (modWeight < 0.85) ? 0 : ((modWeight < 1.85) ? 1 : 2);
if ((modWeight + currentWeight > weightTarget + 1) ) continue;
if (everythingInArrayGreaterEqual(sizeTarget, sizeCount)){
//use it and stuff
}
else if (sizeCount[modSize] >= sizeTarget[modSize] && z != maxZLoops - 1){
if (!firstChoice.length) firstChoice = [selectedMod, str, selectedIndex, modSize, modWeight];
continue modLoop;
}
else if (z == maxZLoops - 1 && firstChoice.length){
selectedMod = firstChoice[0];
modObj = dailyModifiers[selectedMod];
selectedIndex = firstChoice[2];
str = firstChoice[1];
modSize = firstChoice[3];
modWeight = firstChoice[4];
}
//It's been officially selected by this point
sizeCount[modSize]++;
dailyObject[modifierList[selectedIndex]] = {strength: str, stacks: 0};
currentWeight += modWeight;
if (x > 0 && (currentWeight > weightTarget || (currentWeight >= weightTarget - 0.5 && currentWeight <= weightTarget + 0.5))){
break mainLoop;
}
modifierList.splice(selectedIndex, 1);
if (modObj.incompatible){
for (var x = 0; x < modObj.incompatible.length; x++){
var incompatibleIndex = modifierList.indexOf(modObj.incompatible[x]);
if (incompatibleIndex >= 0){
modifierList.splice(incompatibleIndex, 1);
}
}
}
break modLoop;
}
}
dailyObject.seed = dateSeed;
return dailyObject;
}
var dailyModifiers = {
minDamage: {
description: function (str) {
return "Trimp min damage reduced by " + prettifySub(this.getMult(str) * 100) + "% (additive).";
},
getMult: function (str) {
return 0.1 + ((str - 1) * 0.01);
},
getWeight: function (str) {
return (1 / ((1.2 + (1 - this.getMult(str))) / 2 / 1.1)) - 1;
},
minMaxStep: [41, 90, 1],
chance: 1
},
maxDamage: {
description: function (str) {
return "Trimp max damage increased by " + prettifySub(this.getMult(str) * 100) + "% (additive).";
},
getMult: function (str) {
return str;
},
getWeight: function (str) {
return (1 - ((1.2 + (1 + str)) / 2 / 1.1));
},
minMaxStep: [1, 5, 0.25],
chance: 1
},
plague: { //Half of electricity
description: function (str) {
return "Enemies stack a debuff with each attack, damaging Trimps for " + prettifySub(this.getMult(str, 1) * 100) + "% of total health per turn per stack, resets on Trimp death."
},
getMult: function (str, stacks) {
return 0.01 * str * stacks;
},
getWeight: function (str) {
var count = Math.ceil((1 + Math.sqrt(1 + 800/str))/2);
return (6 - (0.1 * count) + (0.8 / count) + (str / 8)) / 1.75;
},
minMaxStep: [1, 10, 1],
chance: 0.3,
icon: "*bug2",
incompatible: ["rampage", "weakness"],
stackDesc: function (str, stacks) {
return "Your Trimps are taking " + prettifySub(this.getMult(str, stacks) * 100) + "% damage after each attack.";
}
},
weakness: {
description: function (str) {
return "Enemies stack a debuff with each attack, reducing Trimp attack by " + prettifySub(100 - this.getMult(str, 1) * 100) + "% per stack. Stacks cap at 9 and reset on Trimp death.";
},
getMult: function (str, stacks) {
return 1 - (0.01 * str * stacks);
},
getWeight: function (str) {
return str / 4;
},
minMaxStep: [1, 10, 1],
chance: 0.6,
icon: "fire",
incompatible: ["bogged", "plague"],
stackDesc: function (str, stacks) {
return "Your Trimps have " + prettifySub(100 - this.getMult(str, stacks) * 100) + "% less attack.";
}
},
large: {
description: function (str) {
return "All housing can store " + prettifySub(100 - this.getMult(str) * 100) + "% fewer Trimps";
},
getMult: function(str) {
return 1 - (0.01 * str);
},
getWeight: function (str) {
return (1 / this.getMult(str) - 1) * 2;
},
start: function (str) {
game.resources.trimps.maxMod = this.getMult(str);
},
abandon: function (str) {
game.resources.trimps.maxMod = 1;
},
minMaxStep: [10, 60, 1],
chance: 1
},
dedication: {
description: function (str) {
return "Gain " + prettifySub((this.getMult(str) * 100) - 100) + "% more resources from gathering";
},
getMult: function(str) {
return 1 + (0.1 * str);
},
getWeight: function (str) {
return 0.075 * str * -1;
},
incompatible: ["famine"],
minMaxStep: [5, 40, 1],
chance: 0.75
},
famine: {
description: function (str) {
return "Gain " + prettifySub(100 - (this.getMult(str) * 100)) + "% less Metal, Food, Wood, and Gems from all sources";
},
getMult: function (str) {
return 1 - (0.01 * str);
},
getWeight: function (str) {
return (1 / this.getMult(str) - 1) / 2;
},
incompatible: ["dedication"],
minMaxStep: [40, 80, 1],
chance: 2
},
badStrength: {
description: function (str) {
return "Enemy attack increased by " + prettifySub((this.getMult(str) * 100) - 100) + "%.";
},
getMult: function (str) {
return 1 + (0.2 * str);
},
getWeight: function (str){
return 0.1 * str;
},
minMaxStep: [5, 15, 1],
chance: 1
},
badHealth: {
description: function (str) {
return "Enemy health increased by " + prettifySub((this.getMult(str) * 100) - 100) + "%.";
},
getMult: function (str) {
return 1 + (0.2 * str);
},
getWeight: function (str){
return 0.2 * str;
},
minMaxStep: [3, 15, 1],
chance: 1
},
badMapStrength: {
description: function (str) {
return "Enemy attack in maps increased by " + prettifySub((this.getMult(str) * 100) - 100) + "%.";
},
getMult: function (str) {
return 1 + (0.3 * str);
},
getWeight: function (str){
return (0.1 * (1 + 1/3)) * str;
},
minMaxStep: [3, 15, 1],
chance: 1
},
badMapHealth: {
description: function (str) {
return "Enemy health in maps increased by " + prettifySub((this.getMult(str) * 100) - 100) + "%.";
},
getMult: function (str) {
return 1 + (0.3 * str);
},
getWeight: function (str){
return (0.3 * str) * (5 / 8);
},
minMaxStep: [3, 10, 1],
chance: 1
},
crits: {
description: function (str) {
return "Enemies have a 25% chance to crit for " + prettifySub(this.getMult(str) * 100) + "% of normal damage.";
},
getMult: function (str) {
return 1 + (0.5 * str);
},
getWeight: function (str) {
return 0.15 * this.getMult(str);
},
minMaxStep: [1, 24, 1],
chance: 0.75
},
trimpCritChanceUp: {
description: function (str) {
return "Your Trimps have +" + prettifySub(this.getMult(str) * 100) + "% Crit Chance.";
},
getMult: function(str) {
return str / 10;
},
getWeight: function (str) {
return .25 * str * -1;
},
minMaxStep: [5, 10, 1],
incompatible: ["trimpCritChanceDown"],
chance: 1.25
},
trimpCritChanceDown: {
description: function (str) {
return "Your Trimps have -" + prettifySub(this.getMult(str) * 100) + "% Crit Chance.";
},
getMult: function (str) {
return str / 10;
},
getWeight: function (str) {
return (str / 4.5);
},
minMaxStep: [2, 7, 1],
incompatible: ["trimpCritChanceUp"],
chance: 0.75
},
bogged: {
description: function (str) {
return "Your Trimps lose " + prettifySub(this.getMult(str) * 100) + "% of their max health after each attack.";
},
getMult: function (str) {
return 0.01 * str;
},
getWeight: function (str) {
var count = Math.ceil(1 / this.getMult(str));
return (6 - ((0.2 * (count > 60 ? 60 : count) / 2)) + ((((500 * count + 400) / count) / 500)-1)) / 1.5;
},
incompatible: ["rampage", "weakness"],
minMaxStep: [1, 5, 1],
chance: 0.3
},
dysfunctional: {
description: function (str) {
return "Your Trimps breed " + prettifySub(100 - (this.getMult(str) * 100)) + "% slower";
},
getMult: function (str) {
return 1 - (str * 0.05);
},
getWeight: function (str){
return ((1 / this.getMult(str))-1)/6;
},
minMaxStep: [10, 18, 1],
chance: 1
},
oddTrimpNerf: {
description: function (str) {
return "Trimps have " + prettifySub(100 - (this.getMult(str) * 100)) + "% less attack on odd numbered Zones";
},
getMult: function (str) {
return 1 - (str * 0.02);
},
getWeight: function (str){
return (1 / this.getMult(str) - 1) / 1.5;
},
minMaxStep: [15, 40, 1],
chance: 1
},
evenTrimpBuff: {
description: function (str) {
return "Trimps have " + prettifySub((this.getMult(str) * 100) - 100) + "% more attack on even numbered Zones";
},
getMult: function (str) {
return 1 + (str * 0.2);
},
getWeight: function (str){
return (this.getMult(str) - 1) * -1;
},
minMaxStep: [1, 10, 1],
chance: 1
},
karma: {
description: function (str) {
return 'Gain a stack after killing an enemy, increasing all non Helium loot by ' + prettifySub((this.getMult(str, 1) * 100) - 100) + '%. Stacks cap at ' + this.getMaxStacks(str) + ', and reset after clearing a Zone.';
},
stackDesc: function (str, stacks){
return "Your Trimps are finding " + prettifySub((this.getMult(str, stacks) * 100) - 100) + "% more loot!";
},
getMaxStacks: function (str) {
return Math.floor((str % 9) * 25) + 300;
},
getMult: function (str, stacks) {
var realStrength = Math.ceil(str / 9);
return 1 + (0.0015 * realStrength * stacks);
},
getWeight: function (str){
return (this.getMult(str, this.getMaxStacks(str)) - 1) / -2;
},
icon: "*arrow-up",
minMaxStep: [1, 45, 1],
chance: 1
},
toxic: {
description: function (str) {
return "Gain a stack after killing an enemy, reducing breed speed by " + prettifySub(100 - (this.getMult(str, 1) * 100)) + '% (compounding). Stacks cap at ' + this.getMaxStacks(str) + ', and reset after clearing a Zone.';
},
stackDesc: function (str, stacks){
return "Your Trimps are breeding " + prettifySub(100 - (this.getMult(str, stacks) * 100)) + "% slower.";
},
getMaxStacks: function (str) {
return Math.floor((str % 9) * 25) + 300;
},
getMult: function (str, stacks) {
var realStrength = Math.ceil(str / 9);
return Math.pow((1 - 0.001 * realStrength), stacks);
},
getWeight: function (str){
return (1 / this.getMult(str, this.getMaxStacks(str)) - 1) / 6;
},
icon: "*radioactive",
minMaxStep: [1, 45, 1],
chance: 1
},
bloodthirst: {
description: function (str) {
return "Enemies gain a stack of Bloodthirst whenever Trimps die. Every " + this.getFreq(str) + " stacks, enemies will heal to full and gain an additive 50% attack. Stacks cap at " + this.getMaxStacks(str) + " and reset after killing an enemy.";
},
stackDesc: function (str, stacks) {
var freq = this.getFreq(str);
var max = this.getMaxStacks(str);
var text = "This Bad Guy";
if (stacks < max) {
var next = (freq - (stacks % freq));
text += " will heal to full and gain attack in " + next + " stack" + ((next == 1) ? "" : "s") + ", " + ((stacks >= freq) ? "" : " and") + " gains 1 stack whenever Trimps die";
}
if (stacks >= freq){
if (stacks < max) text += ", and";
text += " currently has " + prettifySub((this.getMult(str, stacks) * 100) - 100) + "% more attack";
}
text += ".";
return text;
},
getMaxStacks: function (str) {
return (this.getFreq(str) * (2 + Math.floor(str / 2)));
},
getFreq: function(str){
return 10 - str;
},
getMult: function (str, stacks){
var count = Math.floor(stacks / this.getFreq(str));
return 1 + (0.5 * count);
},
getWeight: function (str) {
return 0.5 + (0.25 * Math.floor(str / 2));
},
minMaxStep: [1, 7, 1],
chance: 1,
icon: "*flask",
iconOnEnemy: true
},
explosive: {
description: function (str) {
var text = "Enemies instantly deal " + prettifySub(this.getMult(str) * 100) + "% of their attack damage when killed";
if (str > 15) {
text += " unless your block is as high as your maximum health";
}
text += ".";
return text;
},
getMult: function (str) {
return str;
},
getWeight: function (str) {
var mult = this.getMult(str);
if (str <= 15){
return (3/20 * mult) + (1/4);
}
else {
return (1/14 * mult) - (1/7);
}
},
minMaxStep: [5, 30, 1],
chance: 1
},
slippery: {
description: function (str) {
return "Enemies have a " + prettifySub(this.getMult(str) * 100) + "% chance to dodge your attacks on " + ((str <= 15) ? "odd" : "even") + " Zones.";
},
getMult: function (str){
if (str > 15) str -= 15;
return 0.02 * str;
},
getWeight: function (str) {
return (1 / (1 - this.getMult(str)) - 1) * 10 / 1.5;
},
minMaxStep: [1, 30, 1],
chance: 1
},
rampage: {
description: function (str) {
return "Gain a stack after killing an enemy, increasing Trimp attack by " + prettifySub((this.getMult(str, 1) * 100) - 100) + '% (additive). Stacks cap at ' + this.getMaxStacks(str) + ', and reset when your Trimps die.';
},
stackDesc: function (str, stacks){
return "Your Trimps are dealing " + prettifySub((this.getMult(str, stacks) * 100) - 100) + "% more damage.";
},
getMaxStacks: function (str) {
return Math.floor((str % 10 + 1) * 10);
},
getMult: function (str, stacks) {
var realStrength = Math.ceil(str / 10);
return 1 + (0.01 * realStrength * stacks);
},
getWeight: function (str){
return (1 - this.getMult(str, 1)) * this.getMaxStacks(str);
},
icon: "*fire",
incompatible: ["plague", "bogged"],
minMaxStep: [1, 40, 1],
chance: 1
},
mutimps: {
description: function (str) {
var size = str % 5;
if (size == 0) size = "";
else size = "the first " + prettifySub(size * 2) + " rows of";
var name = (str < 4) ? "Mutimps" : "Hulking Mutimps";
return "40% of Bad Guys in " + size + " the World will be mutated into " + name + ".";
},
getWeight: function (str) {
return (str / 10) * 1.5;
},
getMaxCellNum: function (str) {
if (str > 5) str -= 5;
str--;
var values = [19, 39, 59, 79, 99];
return values[str];
},
minMaxStep: [1, 10, 1],
chance: 1
},
empower: {
description: function (str) {
var s = (str == 1) ? "" : "s";
return "All enemies gain " + str + " stack" + s + " of Empower whenever your Trimps die in the World. Empower increases the attack and health of Bad Guys in the World by 0.2% per stack, can stack to 9999, and never resets.";
},
getWeight: function (str) {
return (str / 6) * 2;
},
stackDesc: function (str, stacks){
return "This Bad Guy is Empowered and has " + prettifySub((this.getMult(str, stacks) * 100) - 100) + "% more health and attack.";
},
stacksToAdd: function (str){
return str;
},
getMult: function (str, stacks){
return 1 + (0.002 * stacks);
},
getMaxStacks: function (str) {
return 9999;
},
worldStacksOnly: true,
iconOnEnemy: true,
icon: "baby-formula",
minMaxStep: [1, 10, 1],
chance: 1
},
pressure: {
description: function (str) {
return "Trimps gain a stack of Pressure every " + Math.round(this.timePerStack(str)) + " seconds. Each stack of pressure reduces Trimp health by 1%. Max of " + Math.round(this.getMaxStacks(str)) + " stacks, stacks reset after clearing a Zone.";
},
getWeight: function(str){
var time = (105 - this.timePerStack(str));
var stacks = this.getMaxStacks(str);
return (((time * 1.3) + stacks) / 200);
},
getMult: function(str, stacks){
return Math.pow(0.99, stacks);
},
addSecond: function(){
var modifier = game.global.dailyChallenge.pressure;
modifier.timer = (modifier.timer) ? modifier.timer + 1 : 1;
if (modifier.timer >= 60){
this.addStack();
modifier.timer = 0;
}
updateDailyStacks('pressure');
},
addStack: function() {
var global = game.global;
var challenge = global.dailyChallenge.pressure;
if (this.getMaxStacks(challenge.strength) <= challenge.stacks) {
return;
}
challenge.stacks++;
if (global.fighting){
global.soldierHealthMax *= 0.99;
if (global.soldierHealthMax < global.soldierHealth)
global.soldierHealth = global.soldierHealthMax;
if (global.soldierHealth < 0)
global.soldierHealth = 0;
}
},
timePerStack: function(str){
var thisStr = Math.ceil(str / 4) - 1;
return (45 + (thisStr * 5));
},
resetTimer: function(){
var modifier = game.global.dailyChallenge.pressure;
modifier.timer = 0;
modifier.stacks = 0;
updateDailyStacks('pressure');
},
stackDesc: function(str, stacks){
return "Your Trimps are under a lot of pressure. Maximum health is reduced by " + prettifySub((1 - this.getMult(str, stacks)) * 100) + "%.";
},
getMaxStacks: function(str){
var thisStr = Math.floor(str % 4);
return (45 + (thisStr * 5));
},
icon: "*heart3",
minMaxStep: [1, 16, 1],
chance: 1
},
mirrored: {
description: function (str) {
var reflectChance = this.getReflectChance(str);
return "Enemies have a" + (reflectChance.toString()[0] == '8' ? 'n' : '') + " " + prettifySub(reflectChance) + "% chance to reflect an attack, dealing " + prettifySub(this.getMult(str) * 100) + "% of damage taken back to your Trimps.";
},
getReflectChance: function(str){
return (Math.ceil(str / 10)) * 10;
},
getMult: function(str){
return ((str % 10) + 1) / 10;
},
getWeight: function(str){
return ((((this.getReflectChance(str) + 90) / 100) * 0.85) * ((this.getMult(str) + 0.9) * 0.85));
},
testWeights: function(){
var min = 0;
var max = 0;
var results = [];
for (var x = this.minMaxStep[0]; x <= this.minMaxStep[1]; x += this.minMaxStep[2]){
var result = this.getWeight(x);
if (min == 0)
min = result;
else if (result < min)
min = result;
if (result > max)
max = result;
results.push(result);
}
console.log(results);
return "Min: " + min + ", Max: " + max;
},
reflectDamage: function(str, attack){
if (Math.floor(Math.random() * 100) >= this.getReflectChance(str))
return 0;
return this.getMult(str) * attack;
},
minMaxStep: [1, 100, 1],
chance: 1
},
metallicThumb: {
description: function (str) {
return "Equipment is " + prettifySub((1 - this.getMult(str)) * 100) + "% cheaper.";
},
getWeight: function (str) {
return ((str + 3) / 26);
},
getMult: function(str){
return 1 - (str/100 * 5);
},
minMaxStep: [1, 10, 1],
chance: 1
}
};
var dmgMod = 1;
var min = 1;
var max = 1.2;
var daily;
function f(n) {
return f(n,1,false);
}
function f(n,mult) {
return f(n,mult,false);
}
var f = (n,mult,rtnArr) => {
let i = 0;
let nCount = 0;
let arr = [];
while (true) {
daily = getDailyChallengeAt(i);
dmgMod = 1;
min = 1;
max = 1.2;
for (let item in daily) {
if (item === 'seed' && getAvg() > mult) {
if (rtnArr) arr[nCount] = i;
if (nCount++ !== n) continue;
if (rtnArr) return arr.map(i => console.log(new Date(new Date().getTime() + i * 1000 * 60 * 60 * 24) + "\n" + getDailyDescription(i) + "\nDamage Mod: " + getAvg()));
let result = new Date(new Date().getTime() + i * 1000 * 60 * 60 * 24) + "\n";
return result + getDailyDescription(i) + "\nDamage Mod: " + getAvg();
}
evalMod(item);
}
i++;
}
};
var getAvg = () => (dmgMod * min + dmgMod * max)/2.2;
var evalMult = (item) => dailyModifiers[item].getMult(daily[item].strength);
var evalMod = function (item) {
switch (item) {
case "minDamage":
min *= 1 - evalMult(item);
break;
case "maxDamage":
max *= 1 + evalMult(item);
break;
case "plague": //losing health
dmgMod *= 0;
break;
case "weakness":
dmgMod *= dailyModifiers[item].getMult(daily[item].strength, 9);
break;
case "large":
break;
case "dedication":
break;
case "famine":
break;
case "badStrength":
break;
case "badHealth":
dmgMod /= evalMult(item);
break;
case "badMapStrength":
break;
case "badMapHealth":
dmgMod /= evalMult(item);
break;
case "crits":
break;
case "trimpCritChanceUp":
base = 8 * .5 + 64 * .5;
cChance = .5 + evalMult(item));
if (cChance <= 1) {
dmgMod *= ((1 - cChance) * 8 + cChance * 64) / base;
}
else {
dmgMod *= ((2 - cChance) * 64 + (cChance - 1) * 512) / base;
}
break;
case "trimpCritChanceDown":
base = 8 * .5 + 64 * .5;
cChance = Math.ceil(100 * (.5 - evalMult(item))) / 100;
dmgMod *= (cChance > 0 ? ((1 - cChance) * 8 + cChance * 64) : (cChance + 1) * 8 + (cChance * -1)) / base;
break;
case "bogged": //losing health
dmgMod *= evalMult(item) > .3 ? 0 : .9;
break;
case "dysfunctional":
break;
case "oddTrimpNerf":
dmgMod *= 1 - ((1 - evalMult(item)) / 2);
break;
case "evenTrimpBuff":
dmgMod *= evalMult(item);
break;
case "karma":
break;
case "toxic":
break;
case "bloodthirst":
break;
case "explosive":
break;
case "slippery":
dmgMod *= 1 - evalMult(item) / 2;
break;
case "rampage":
let str = daily[item].strength;
dmgMod *= dailyModifiers[item].getMult(str, Math.floor((str % 10 + 1) * 10));
break;
case "mutimps":
break;
case "empower":
break;
case "pressure":
break;
case "mirrored":
break;
case "metallicThumb":
break;
default:
break;
}
};
switch(item) {
case "minDamage":
min *= 1-evalMult(item);
break;
case "maxDamage":
max *= 1 + evalMult(item);
break;
case "plague": //losing health
dmgMod *= 0;
break;
case "weakness":
dmgMod *= dailyModifiers[item].getMult(daily[item].strength,9);
break;
case "large":
break;
case "dedication":
break;
case "famine":
break;
case "badStrength":
break;
case "badHealth":
dmgMod /= evalMult(item);
break;
case "badMapStrength":
break;
case "badMapHealth":
dmgMod /= evalMult(item);
break;
case "crits":
break;
case "trimpCritChanceUp":
base = 8 * .5 + 64 * .5;
cChance = Math.min(1,.5+evalMult(item));
dmgMod *= ((1-cChance)*8 + cChance * 64)/base;
break;
case "trimpCritChanceDown":
base = 8 * .5 + 64 * .5;
cChance = Math.ceil(100*(.5-evalMult(item)))/100;
dmgMod *= (cChance > 0 ? ((1-cChance)*8 + cChance * 64) : (cChance+1)*8 + (cChance*-1))/base;
break;
case "bogged": //losing health
dmgMod *= evalMult(item) > .3 ? 0 : .9;
break;
case "dysfunctional":
break;
case "oddTrimpNerf":
dmgMod *= 1-((1-evalMult(item))/2);
break;
case "evenTrimpBuff":
dmgMod *= evalMult(item);
break;
case "karma":
break;
case "toxic":
break;
case "bloodthirst":
break;
case "explosive":
break;
case "slippery":
dmgMod *= 1-evalMult(item)/2;
break;
case "rampage":
let str = daily[item].strength;
dmgMod *= dailyModifiers[item].getMult(str,Math.floor((str % 10 + 1) * 10));
break;
case "mutimps":
break;
case "empower":
break;
case "pressure":
break;
case "mirrored":
break;
case "metallicThumb":
break;
default:
break;
}
};