-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.js
3452 lines (3426 loc) · 193 KB
/
main.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
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
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"use strict";
const basesave = {
playerName:"EMD"+String(ranint(0,9999)).padStart(4,"0"),
exoticmatter:c.d0,
exoticmatterThisStardustReset:c.d0,
exoticmatterThisWormholeReset:c.d0,
exoticmatterThisSpacetimeReset:c.d0,
totalexoticmatter:c.d0,
XAxis:c.d0,
YAxis:c.d0,
ZAxis:c.d0,
WAxis:c.d0,
VAxis:c.d0,
UAxis:c.d0,
TAxis:c.d0,
SAxis:c.d0,
RAxis:c.d0,
QAxis:c.d0,
PAxis:c.d0,
OAxis:c.d0,
masteryPower:c.d0,
baseMasteryPowerGain:c.d1,
activeMasteries:[null,0,0,0,0,0,0,0,0,0,0],
masteryContainerStyle:"Legacy",
masteryIdsShown:true,
masteryBoostsShown:true,
masteryActivityShown:true,
masteryRowsReversed:false,
timePlayed:0,
truetimePlayed:c.d0,
featuresUnlocked:[],
colortheme:"Default",
footerDisplay:"All tabs",
achOnProgressBar:"N", // "N" = none, can't use undefined or null due to issues
activeTab:"main",
activeSubtabs:Object.fromEntries(Object.keys(subtabList).map(x=>[x,subtabList[x][0]])),
timeThisStardustReset:0,
truetimeThisStardustReset:c.d0,
fastestStardustReset:c.d9e15,
timeThisWormholeReset:0,
truetimeThisWormholeReset:c.d0,
fastestWormholeReset:c.d9e15,
timeThisSpacetimeReset:0,
truetimeThisSpacetimeReset:c.d0,
fastestSpacetimeReset:c.d9e15,
storySnippets:[],
timeLeft:Date.now(),
dilatedTime:0,
dilationPower:1,
dilationUpgrades:[null,0,0,0,0],
dilationUpgradesUnlocked:0,
notation:"Mixed scientific",
newsTickerActive:true,
newsTickerSpeed:80,
newsTickerDilation:0.125,
zipPoints:0,
zipPointMulti:1,
version:1,
alwaysBeta:false,
topResourcesShown:{
exoticmatter:true,
masteryPower:false,
stardust:true,
darkmatter:false,
hr:true,
antimatter:false
},
glowOptions:{
buyAxis:true,
emptyMasteryRow:true,
overclock:false,
buyStardustUpgrade:true,
buyStar:true,
assignStar:true,
buyDarkAxis:true,
gainDarkStar:true,
study12:true,
observe:true,
buyPermanentResearch:true,
noChromaGeneration:true,
createGalaxy:false,
buyLuckRune:true,
buyLuckUpgrade:false,
buyPrismaticUpgrade:true,
buyRefundablePrismaticUpgrade:false,
buyAntiAxis:true,
buyWormholeUpgrade:true,
},
confirmations:{
doubleClickToBuy:false,
stardustReset:false,
ironWillStardustReset:false,
buyStardustUpgrade:false, // not a confirmation but whatever
wormholeReset:false,
researchDoubleClick:false,
},
hotkeys:savefileHotkeyProperties(),
EMDLevel:1, // dynamic quantity but we store it regardless for compatibility with subpages
EMDLevelDisplayInFooter:1,
achievement:Object.fromEntries(achievement.all.map(x=>[x,false])),
secretAchievement:Object.fromEntries(Object.keys(secretAchievementList).map(x=>[x,false])),
achievementIDShown:true,
completedAchievementTiersShown:true,
achievementTiersReversed:false,
clickedInStudy1:false,
StardustResets:0,
TotalStardustResets:0,
previousStardustRuns:{last10:[],wormhole:{fastest:previousPrestige.generate(1,2,true),highest:previousPrestige.generate(1,2,true)},spacetime:{fastest:previousPrestige.generate(1,3,true),highest:previousPrestige.generate(1,3,true)},eternity:{fastest:previousPrestige.generate(1,4,true),highest:previousPrestige.generate(1,4,true)}},
previousWormholeRuns:{last10:[],spacetime:{fastest:previousPrestige.generate(2,3,true),highest:previousPrestige.generate(2,3,true),efficientest:previousPrestige.generate(2,3,true)},eternity:{fastest:previousPrestige.generate(2,4,true),highest:previousPrestige.generate(2,4,true),efficientest:previousPrestige.generate(2,4,true)}},
stardust:c.d0,
stardustThisWormholeReset:c.d0,
stardustThisSpacetimeReset:c.d0,
totalstardust:c.d0,
autosaveIsOn:true,
stardustUpgrades:[0,0,0,0,0],
showingCappedStardustUpgrades:true,
axisAutobuyerOn:false,
axisAutobuyerUpgrades:0,
axisAutobuyerCaps:Array(12).fill("u"),
stars:0,
star:Object.fromEntries(starList.map(x=>[x,false])),
starContainerStyle:"Legacy",
starIdsShown:true,
starActivityShown:true,
darkmatter:c.d0,
darkmatterThisWormholeReset:c.d0,
darkmatterThisSpacetimeReset:c.d0,
totaldarkmatter:c.d0,
darkXAxis:c.d0,
darkYAxis:c.d0,
darkZAxis:c.d0,
darkWAxis:c.d0,
darkVAxis:c.d0,
darkUAxis:c.d0,
darkTAxis:c.d0,
darkSAxis:c.d0,
darkRAxis:c.d0,
darkQAxis:c.d0,
darkPAxis:c.d0,
darkOAxis:c.d0,
darkstars:c.d0,
darkstarBulk:true,
darkEnergy:c.d1,
stelliferousEnergy:c.d1,
gravitationalEnergy:c.d1,
spatialEnergy:c.d1,
neuralEnergy:c.d1,
metaEnergy:c.d1,
vacuumEnergy:c.d1,
mentalEnergy:c.d1,
dimensionalEnergy:c.d1,
temporalEnergy:c.d1,
hawkingradiation:c.d0,
hawkingradiationThisSpacetimeReset:c.d0,
totalhawkingradiation:c.d0,
WormholeResets:0,
TotalWormholeResets:0,
ach505Progress:c.d0,
shiningBrightTonight:true,
ach519possible:true,
ach524possible:true,
ach525possible:true,
ach526possible:true,
darkAxisAutobuyerOn:false,
darkAxisAutobuyerUpgrades:0,
darkAxisAutobuyerCaps:Array(13).fill("u"), // 13th item = dark stars
stardustUpgradeAutobuyerOn:false,
stardustUpgradeAutobuyerUpgrades:0,
stardustUpgradeAutobuyerCaps:Array(5).fill("u"),
starAutobuyerOn:false,
starAutobuyerUpgrades:0,
starAutobuyerCap:"u",
starAllocatorOn:false,
starAllocatorBuild:[],
wormholeAutomatorOn:false,
wormholeAutomatorMode:0,
wormholeAutomatorValue:"1",
stardustAutomatorOn:false,
stardustAutomatorMode:0,
stardustAutomatorValue:"1",
research:Object.fromEntries(Object.keys(research).map(x=>[x,false])),
researchVisibility:[],
researchRespec:false,
buyMaxResearch:false,
researchLoadouts:(function(){
let out = []
for (let i=0;i<9;i++) out.push({
name:"Loadout "+(i+1),
savedResearch:[]
})
return out
})(),
totalDiscoveries:c.d0,
spentDiscoveries:c.d0,
observations:Array(4).fill(c.d0),
knowledge:c.d0,
activeStudy:0,
studyCompletions:[null,0,0,0,0,0,0,0,0,0,0,0,0,0],
studyContainerStyle:"Compact",
studyContainerCompactSelected:undefined,
completedStudiesShown:true,
restoreResearchAfterStudy:false,
chroma:Array(9).fill(c.d0),
lumens:Array(9).fill(c.d0),
activeChroma:null,
showLightEffectsFrom0:false,
haltChromaIfLacking:false,
galaxies:0,
highestGalaxies:0,
highestGalaxiesSpacetime:0,
ach711Progress:61,
luckEssence:0,
luckShards:c.d0,
totalLuckRunes:Object.fromEntries(luckRuneTypes.map(x=>[x,c.d0])),
spentLuckRunes:Object.fromEntries(luckRuneTypes.map(x=>[x,c.d0])),
luckUpgrades:Object.fromEntries(luckRuneTypes.map(x=>[x,Object.fromEntries(luckUpgradeList[x].map(y=>[y,c.d0]))])),
luckShardSpendFactor:c.d0,
luckRuneSpendFactor:c.d0,
prismatic:c.d0,
prismaticUpgrades:Object.fromEntries(prismaticUpgradeList.map(x=>[x,c.d0])),
prismaticSpendFactor:c.d0,
study9:{
xp:c.d0,
fracxp:c.d0,
start:0,
resets:0
},
antimatter:c.d0,
antimatterThisSpacetimeReset:c.d0,
totalantimatter:c.d0,
antiXAxis:c.d0,
antiYAxis:c.d0,
antiZAxis:c.d0,
antiWAxis:c.d0,
antiVAxis:c.d0,
antiUAxis:c.d0,
antiTAxis:c.d0,
antiSAxis:c.d0,
antiRAxis:c.d0,
antiQAxis:c.d0,
antiPAxis:c.d0,
antiOAxis:c.d0,
antimatterGalaxies:c.d0,
antimatterGalaxyBulk:true,
ach815RewardActive:true,
study10Options:[],
researchAutobuyerOn:false,
researchAutobuyerUpgrades:0,
researchAutobuyerMode:0,
ach825possible:true,
study12:{
empowerments:c.d0,
fortitude:c.d0
},
wormholeUpgrades:[null,...Array(12).fill(0)],
ach901Int:c.d0,
bestTickspeedThisMatrix:c.d1,
bestTickspeed:c.d1,
ach907Progress:0,
ach908possible:true,
ach920Completions:0, // stored as bitfield: 1-bit = I, 2-bit = II, 4-bit = III, 8-bit = IV, etc.
baselessMilestones:Array(5).fill(1), // for achievements 921-925
study13Bindings:Object.fromEntries(study13.allBindings.map(x=>[x,false])),
study13ShowParentBindings:false,
corruptionsUnlocked:0,
};
var g = decimalStructuredClone(basesave); // "game"}
const empowerableAxis = {
normal:["Y"],
dark:["W"],
anti:["V"]
}
const selections = {
achievement:undefined,
secretAchievement:undefined,
mastery:undefined,
masteryClick:undefined,
star:undefined,
starClick:undefined,
research:undefined,
study13Binding:undefined,
}
var timeSinceGameOpened = 0; // "halted" achievements were being awarded randomly on load
var totalAchievements = 0;
var totalSecretAchievements = 0;
var totalStars = 0;
var totalResearch = {
temporary:0,
permanent:0,
overall:function(){return this.temporary+this.permanent}
}
var overclockSpeedupFactor = 1;
var secretAchievementPoints = 0;
var savecounter = 0; // will prevent save before load
var olddelta = Date.now()
var axisAutobuyerProgress = 0;
var wormholeAnimationActive = false;
var wormholeAnimationStart = 0;
var darkAxisAutobuyerProgress = 0;
var stardustUpgradeAutobuyerProgress = 0;
var starAutobuyerProgress = 0;
var researchAutobuyerProgress = 0;
var deltatime = 0;
var lagAchievementTicks = 0;
var fpsAchievementTicks = 0;
var themeAchievementCount = 0;
function gameClick() {
g.clickedInStudy1=true
}
// Options & Display
function changePlayerName() {
popup({
text:"Input your player name:",
input:g.playerName,
buttons:[["Confirm","if (popupInput().length>40) {notify('Maximum of 40 characters for player names')} else {g.playerName=popupInput()}"]]
})
}
function availableThemes() {
let out = ["Default","Red","Green","Blue","Cyan","Magenta","Yellow","Light Gray","Dark Gray","Black","Light"];
if (g.secretAchievement[16]) out.push("Wormhole");
return out;
}
function selectOption(variable,values,flavor="mode",variableCallback=x=>x) {
popup({
text:"We're sorry to hear that you hate "+variableCallback(g[variable])+". Which "+flavor+" do you want to try on next?",
buttons:values.map(x => [variableCallback(x),"g."+variable+"="+((typeof x==="string")?("'"+x+"'"):x)])
})
}
function changeTheme() {
popup({
text:"We're sorry to hear that you hate "+g.colortheme+". Which theme do you want to try on next?",
buttons:availableThemes().map(x => [x,"g.colortheme='"+x+"';theme()"])
})
}
function theme() {
let scheme = dictionary(g.colortheme,{
"Default":["color:#39f","background:#190033"],
"Red":["color:#f00","background:#300"],
"Green":["color:#0f0","background:#030"],
"Blue":["color:#00f","background:#003"],
"Cyan":["color:#0ff","background:#033"],
"Magenta":["color:#f0f","background:#303"],
"Yellow":["color:#ff0","background:#330"],
"Light Gray":["color:#ccc","background:#666"],
"Dark Gray":["color:#666","background:#333"],
"Black":["color:#fff","background:#000"],
"Light":["color:#000","background:#fff"],
"Wormhole":["color:#39f","background-image:repeating-radial-gradient(circle at "+(viewportWidth()/2)+"px "+(viewportHeight()/2)+"px, #190033, #330066 "+(viewportDiagonalLength/20)+"px, #190033 "+(viewportDiagonalLength/10)+"px); background-size:cover"]
})
document.body.style = scheme[0];
d.element("background").style = scheme[1];
themeAchievementCount++;
addSecretAchievement(16);
}
function EMDLevel() {
if (unlocked("Study XIII")) {return 9}
if (unlocked("Luck")||unlocked("Prismatic")||unlocked("Antimatter")) {return 8}
if (unlocked("Galaxies")) {return 7}
if (unlocked("Light")) {return 6}
if (unlocked("Hawking Radiation")) {return 5}
if (unlocked("Energy")) {return 4}
if (unlocked("Dark Matter")) {return 3}
if (unlocked("Stardust")) {return 2}
return 1
}
function showEMDLevelTooltip(){
popup({
text:"Your EMD Level is an indicator of how far you have progressed in the game. It increments at certain major progression milestones.<br><br>EMD Level is used purely to indicate how far you have progressed (for features such as the Discord and save bank) and has no effect on gameplay.",
buttons:[["Close",""]]
})
}
/*
Factors used to calculate EMD Score out of 1 000 000 are:
(a) total exotic matter and prestige currencies, with the following approximate weightings:
(i) exotic matter = 5
(ii) most recent prestige currency = 5 if unlocked in this EMD level, then 4, then 3
(iii) most recent new matter = 5 if unlocked in this EMD level, then 4, then 3
(iv) Matrix currencies = 1/2 of normal value
Round as appropriate.
(250 000)
(b) main feature at this stage (450 000)
(c) other features at this stage, or if nothing meaningful available add on to (a) (150 000)
(d) achievements (150 000)
EMD Score should never decrease.
*/
function EMDScore(showTooltip,valueArray,level=g.EMDLevel) {
let factors
function giveScore(min,val,max,tariff,formula,taper) {
let scaled = Decimal.div(Decimal.sub(formula(val),formula(min)),Decimal.sub(formula(max),formula(min))).toNumber()
scaled = taper?((scaled>0.95)?(1-0.05*Math.exp(19-scaled*20)):(scaled<0.05)?(min.eq(c.d0)?Math.max(scaled,0):(0.05*Math.exp(scaled*20-1))):scaled):Math.max(0,Math.min(1,scaled))
return Math.round(tariff*scaled)
}
// array = [resource name, minimum, maximum, score, tariff]
if (level===1) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(c.d0,x,N(1e22),400000,n=>n.div(c.e2).add(c.d1).log10(),true),400000],
["Total axis",stat.totalAxis,x=>x.min(c.d60).toNumber()*7500,450000],
["Tier 1 achievements",achievement.ownedInTier(1),x=>x*10000,150000]
]} else if (level===2) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(c.e25,x,N(1e150),125000,n=>n.add(c.d10).log10().log10(),true),125000],
["Total stardust",g.totalstardust,x=>giveScore(c.d0,x,c.e12,575000,n=>n.div(c.e2).add(c.d1).log10(),true),575000],
["Stars",g.stars,x=>(x>=6)?(150000-10000*0.4**(x-6)):(x*25000),150000],
["Tier 2 achievements",achievement.ownedInTier(2),x=>(x===17)?150000:(x===16)?147500:(x===1)?2500:(x===0)?0:((x-1)*10000),150000]
]} else if (level===3) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(N(1e125),x,N("e1800"),90000,n=>n.add(c.d10).log10().log10(),true),90000],
["Total stardust",g.totalstardust,x=>giveScore(N(1e11),x,N(1e70),70000,n=>n.add(c.d10).log10().log10(),true),70000],
["Total dark matter",g.totaldarkmatter,x=>giveScore(c.d0,x,N(1e35),450000,n=>n.div(c.e3).add(c.d1).log10(),true),450000],
["Dark stars",g.darkstars,x=>90250-(9.5-x.min(c.d9).toNumber())**2*1000,90000],
["Stars",g.stars,x=>x*22500-127500,150000],
["Tier 3 achievements",achievement.ownedInTier(3),x=>x*12500,150000]
]} else if (level===4) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(N("e1500"),x,N("e3e5"),100000,n=>n.add(c.d10).log10().log10(),true),100000],
["Total stardust",g.totalstardust,x=>giveScore(N(1e55),x,N("e3000"),80000,n=>n.add(c.d10).log10().log10(),true),80000],
["Total dark matter",g.totaldarkmatter,x=>giveScore(N(1e25),x,N("e4000"),70000,n=>n.add(c.d10).log10().log10(),true),70000],
["Energy types unlocked",g.stardustUpgrades[4]-1,x=>(x-1)*60000,300000],
["Stardust Upgrades 1-4",g.stardustUpgrades.slice(0,4).sum(),x=>(x>=19)?(27000*x-498000):(12500*2**(x-18)),150000],
["Stars",g.stars,x=>x*4000-47000,90000],
["Dark stars",g.darkstars,x=>x.toNumber()*1000,60000],
["Tier 4 achievements",achievement.ownedInTier(4),x=>x*12000-6000,150000],
]} else if (level===5) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(N("e2e5"),x,N("e8e7"),75000,n=>n.add(c.d10).log10().log10().sub(c.d5).max(c.d0).pow(c.d2),true),75000],
["Total stardust",g.totalstardust,x=>giveScore(N("e1500"),x,N("e5e4"),50000,n=>n.add(c.d10).log10().log10().sub(c.d3).max(c.d0).pow(c.d2),true),50000],
["Total dark matter",g.totaldarkmatter,x=>giveScore(N("e2500"),x,N("ee5"),50000,n=>n.add(c.d10).log10().log10().sub(c.d3).max(c.d0).pow(c.d2),true),50000],
["Total Hawking radiation",g.totalhawkingradiation,x=>giveScore(c.d0,x,N(1e12),75000,n=>n.div(c.d10).add(c.d1).log10(),true),75000],
["Knowledge",g.knowledge,x=>giveScore(c.d0,x,N("1e500"),337500,n=>n.add(c.d10).log10().pow(c.d0_5),true),337500],
[unlocked("Studies")?"Study completions":"? ? ?",g.studyCompletions.slice(1).sum(),x=>x*10000,75000],
["Tier 5 achievements",achievement.ownedInTier(5),x=>x*11250,337500]
]} else if (level===6) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(N("e5e7"),x,N("e4e8"),80000,n=>n.add(c.d10).log10().log10(),true),80000],
["Total stardust",g.totalstardust,x=>giveScore(N("e4e4"),x,N("e2e5"),50000,n=>n.add(c.d10).log10().log10(),true),50000],
["Total dark matter",g.totaldarkmatter,x=>giveScore(N("e6e4"),x,N("e2.5e5"),50000,n=>n.add(c.d10).log10().log10(),true),50000],
["Total Hawking radiation",g.totalhawkingradiation,x=>giveScore(c.e10,x,N(1e30),70000,n=>n.add(c.d10).log10().log10(),true),70000],
["Total RGB lumens",g.lumens.slice(0,3).sumDecimals(),x=>giveScore(c.d0,x,N(150),450000,n=>n,true),450000],
["Knowledge",g.knowledge,x=>giveScore(N("1e450"),x,N("e5000"),60000,n=>n.add(c.d10).log10().log10(),true),60000],
["Study completions",g.studyCompletions.slice(1).sum(),x=>10000*(x-6),90000],
["Tier 6 achievements",achievement.ownedInTier(6),x=>Math.max(x*5000,(x-1)*10000),150000]
]} else if (level===7) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(N("e3e8"),x,N("e8e8"),85000,n=>n.add(c.d10).log10().log10(),true),85000],
["Total stardust",g.totalstardust,x=>giveScore(N("e1.5e5"),x,N("e3.5e5"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Total dark matter",g.totaldarkmatter,x=>giveScore(N("e1.5e5"),x,N("e1.2e6"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Total Hawking radiation",g.totalhawkingradiation,x=>giveScore(N("e25"),x,N("e80"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Highest galaxies",g.highestGalaxies,x=>50000*(x-1),150000],
["Knowledge",g.knowledge,x=>giveScore(N("e4000"),x,N("e2.5e4"),100000,n=>n.add(c.d10).log10().log10(),true),100000],
["Study completions",g.studyCompletions.slice(1).sum(),x=>12500*(x-12),100000],
["Total lumens",g.lumens.sumDecimals(),x=>x.gt(c.d2e3)?250000:x.gt(1600)?(x.toNumber()*125):x.gt(1250)?((x.toNumber()-200)*1000/7):x.gt(1000)?((x.toNumber()-500)*200):x.gt(800)?((x.toNumber()-600)*250):x.gt(640)?((x.toNumber()-640)*312.5):0,250000],
["Tier 7 achievements",achievement.ownedInTier(7),x=>x*8000-2000,150000]
]} else if (level===8) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(N("e7e8"),x,N("e3e10"),85000,n=>n.add(c.d10).log10().log10(),true),85000],
["Total stardust",g.totalstardust,x=>giveScore(N("e2.5e5"),x,N("e3e6"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Total dark matter",g.totaldarkmatter,x=>giveScore(N("ee6"),x,N("e3e7"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Total Hawking radiation",g.totalhawkingradiation,x=>giveScore(N("e60"),x,N("e6000"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
[g.research.r24_5?"Trifolium runes":"? ? ? (Buy Research 24-5)",g.totalLuckRunes.trifolium,x=>giveScore(c.d0,x,N(25000),50000,n=>n,true),50000],
[g.research.r24_3?"Quatrefolium runes":"? ? ? (Buy Research 24-3)",g.totalLuckRunes.quatrefolium,x=>giveScore(c.d0,x,N(2500),50000,n=>n,true),50000],
[g.research.r25_3?"Cinquefolium runes":"? ? ? (Buy Research 25-3)",g.totalLuckRunes.cinquefolium,x=>giveScore(c.d0,x,N(200),50000,n=>n,true),50000],
[unlocked("Prismatic")?"Non-refundable Prismatic Upgrades":"? ? ? (Buy Research 20-8)",nonRefundablePrismaticUpgrades.map(x=>g.prismaticUpgrades[x]).sumDecimals(),x=>giveScore(c.d0,x,N(2400),150000,n=>n,true),150000],
[unlocked("Antimatter")?"Total anti-axis":"? ? ? (Complete Study IX)",stat.totalAntiAxis,x=>giveScore(c.d0,x,N(625),150000,n=>n,true),150000],
["Knowledge",g.knowledge,x=>giveScore(N("e1.75e4"),x,N("e1.5e6"),37500,n=>n.add(c.d10).log10().log10(),true),37500],
["Study completions",g.studyCompletions.slice(1).sum(),x=>1500*(x-21),37500],
["Total lumens",g.lumens.sumDecimals(),x=>giveScore(N(1500),x,N(2e5),37500,n=>n.add(c.d1).log10(),true),37500],
["Highest galaxies",g.highestGalaxies,x=>x*6000-22500,37500],
["Tier 8 achievements",achievement.ownedInTier(8),x=>x*6000,150000]
]} else if (level===9) {factors = [
["Total exotic matter",g.totalexoticmatter,x=>giveScore(N("e2e10"),x,N("ee13"),85000,n=>n.add(c.d10).log10().log10(),true),85000],
["Total stardust",g.totalstardust,x=>giveScore(N("e2e6"),x,N("e4e7"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Total dark matter",g.totaldarkmatter,x=>giveScore(N("e2e7"),x,N("ee9"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Total Hawking radiation",g.totalhawkingradiation,x=>giveScore(N("e4000"),x,N("ee5"),55000,n=>n.add(c.d10).log10().log10(),true),55000],
["Study XIII completions",g.studyCompletions[13],x=>(x===256)?450000:(x>=200)?(900*x+195000):(x>=144)?(900*x+170400):(x>=96)?(1050*x+124200):(x>=56)?(1260*x+79440):(x>=24)?(1575*x+37200):(2100*x),450000],
["Knowledge",g.knowledge,x=>giveScore(N("ee6"),x,N("ee8"),30000,n=>n.add(c.d10).log10().log10(),true),30000],
["Study completions excluding XIII",g.studyCompletions.slice(1,13).sum(),x=>Math.max(x-43.5,0)**2*1500-375,30000],
["Total lumens",g.lumens.sumDecimals(),x=>giveScore(N(1.5e5),x,N(1.5e6),30000,n=>n.add(c.d1).log10(),true),30000],
["Cinquefolium runes",g.totalLuckRunes.cinquefolium,x=>giveScore(N(150),x,N(750),15000,n=>n,true),15000],
[prismaticUpgradeName("prismaticSpeed"),g.prismaticUpgrades.prismaticSpeed,x=>giveScore(N(675),x,N(4050),15000,n=>n,true),15000],
["Anti-X axis",g.antiXAxis,x=>giveScore(N(200),x,N(700),15000,n=>n,true),15000],
["Non-repeatable Wormhole Upgrades",g.wormholeUpgrades.slice(1,10).sum(),x=>x*1000,9000],
["Repeatable Wormhole Upgrades",g.wormholeUpgrades.slice(10,13).sum(),x=>x*100,6000],
["Tier 9 achievements",achievement.ownedInTier(9),x=>(x>=9)?(6000*x-48000):[0,10,30,70,150,350,750,1500,3000][x],150000]
]}
function scoreFactor(i) {return Math.max(0,Math.min(factors[i][3],Math.round(factors[i][2]((valueArray===undefined)?factors[i][1]:valueArray[i]))))}
if (showTooltip) popup({
text:"Your EMD Level is a numeric indicator of your progression within the game as a whole. It will increment at major progression milestones.<br><br>EMD Level is only used for spoiler-free progression indicators such as in the save bank and Discord, and has no effect on gameplay.<br><br>Your EMD Level is <b>"+level+"</b>.<hr>EMD Score is used to further sub-divide each EMD Level in cases like the save bank (where saves are sorted according to progression). EMD Score is an indicator of how far you have progressed within the current EMD Level: it is given out of 1,000,000 and will decrease upon unlocking a new level. Like EMD Level, it has no effect on gameplay.<br><br>Your EMD Score is:<br><table style=\"width:95%\"><colgroup><col style=\"width:30%\"/><col style=\"width:25%\"/><col style=\"width:20%\"/><col style=\"width:20%\"/></colgroup><tbody style=\"width:100%\"><tr><th style=\"text-align:left;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">Factor</th><th style=\"text-align:center;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">Factor Value</th><th style=\"text-align:right;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">Score</th><th style=\"text-align:right;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">Maximum Score</th></tr>"+factors.map((x,i)=>"<tr><td style=\"text-align:left;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">"+x[0]+"</td><td style=\"text-align:center;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">"+BEformat(x[1])+"</td></td><td style=\"text-align:right;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">"+BEformat(scoreFactor(i))+"</td><td style=\"text-align:right;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">"+BEformat(x[3])+"</td></tr>").join("")+"<tr><td style=\"text-align:left;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">Overall</td><td style=\"text-align:center;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\"></td><td style=\"text-align:right;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">"+BEformat(countTo(factors.length,true).map(x=>scoreFactor(x)).sum())+"</td><td style=\"text-align:right;border-style:solid;border-width:1px;border-color:rgba(0,255,0,0.5);\">1,000,000</td></tr></tbody></table><br><i>Note that EMD Score is a composite indicator so cannot be accurately used for gatekeeping purposes.</i>",
buttons:[["Close",""]]
})
return countTo(factors.length,true).map(x=>scoreFactor(x)).sum()
}
// Offline Time
var timeState = 0 // 0 = normal, 1 = overclock, 2 = frozen, 3 = equalized
const dilationUpgrades = [
null,
{
tooltip:"Increase the limit of Overclock to {e}×",
cost:function(x=g.dilationUpgrades[1]){return this.effect(x+1)*144},
cap:22,
effect:function(x=g.dilationUpgrades[1]){return Decimal.decibel(x+18).toNumber()},
effectFormat:function(x=g.dilationUpgrades[1]){return this.effect(x).toFixed(0)},
tickspeedNeeded:c.d8
},
{
tooltip:"Overclock softcap starts {e} later",
cost:function(x=g.dilationUpgrades[2]){return 1440+60*Math.max(0,Math.max(x,x*4-141)-23)+Math.max(0,Math.max(x,x*4-141)-23)**2*1.25},
cap:84,
effect:function(x=g.dilationUpgrades[2]){return Math.max(2*x,3*x-60)},
effectFormat:function(x=g.dilationUpgrades[2]){return this.effect(x).toFixed(0)},
tickspeedNeeded:N(128),
},
{
tooltip:"The Overclock softcap is reduced by {e}%",
cost:function(x=g.dilationUpgrades[3]){return 64800+43200*x},
cap:10,
effect:function(x=g.dilationUpgrades[3]){return x===10?0.1:x===0?1:Decimal.decibel(-x).toNumber()},
effectFormat:function(x=g.dilationUpgrades[3]){return N((1-this.effect(x))*100).noLeadFormat(2)},
tickspeedNeeded:N(32768)
},
{
tooltip:"Tickspeed is increased by {e}%",
cost:function(x=g.dilationUpgrades[4]){return 150+300*x},
cap:24,
effect:function(x=g.dilationUpgrades[4]){return x===24?c.d2:x===0?c.d1:N(1+Math.round(x*4+x**2/144)/100)},
effectFormat:function(x=g.dilationUpgrades[4]){return this.effect(x).sub(c.d1).mul(c.e2).toFixed(0)},
tickspeedNeeded:c.d2pow31
}
]
function buyDilationUpgrade(x) {
if ((g.dilationUpgrades[x]<dilationUpgrades[x].cap)&&(g.dilatedTime>dilationUpgrades[x].cost())) {
g.dilatedTime -= dilationUpgrades[x].cost()
g.dilationUpgrades[x]++
}
updateOverclockScrollbar()
}
function unlockDilationUpgrade() {
g.dilationUpgradesUnlocked++
popup({
text:"By reaching "+BEformat(dilationUpgrades[g.dilationUpgradesUnlocked].tickspeedNeeded)+"× tickspeed, you have unlocked a new Dilation Upgrade! Find it in the 'Offline Time' subtab.",
buttons:[["Close",""]]
})
}
function overclockToSoftcap() {
g.dilationPower=Math.log2(stat.overclockSoftcap)
updateOverclockScrollbar()
}
function setTimeState(x) {timeState = (timeState===x)?0:x}
function timeAlwaysEqualized() {return StudyE(3)||StudyE(9)||study13.bound(236)}
function updateOverclockScrollbar() {
d.element('dilationSpeedupFactor').max = Math.ceil(Math.log2(dilationUpgrades[1].effect())*1000)/1000
d.element('dilationSpeedupFactor').value = g.dilationPower
}
function getRealOverclockSpeedup() {
if (timeState===2) {
overclockSpeedupFactor = 0
g.dilatedTime += deltatime
} else if (timeState===1) {
let added = stat.baseOverclockSpeedup-1
let cost = stat.overclockCost*deltatime
let affordable = Math.min(1,g.dilatedTime/cost)
overclockSpeedupFactor = 1+added*affordable
g.dilatedTime -= cost*affordable
if (Math.abs(g.dilatedTime)<1e-12) {g.dilatedTime = 0}
if (affordable<1) {timeState = 0}
} else {
overclockSpeedupFactor = 1
}
}
function wormholeAmplificationMultiplier() {
return Math.floor(Math.min(2**d.element("wormholeAmplification").value,1+g.dilatedTime/g.timeThisWormholeReset))
}
function wormholeAmplificationCost() {
return g.timeThisWormholeReset*(wormholeAmplificationMultiplier()-1)
}
// Story & Features
function unlockFeature(x) {
if (!g.featuresUnlocked.includes(x)) {
openStory(x);
g.featuresUnlocked.push(x);
}
}
function unlocked(x) {
return g.featuresUnlocked.includes(x);
}
const storyEntries = (()=>{
function EMDLevelIncrement(x){return (g.EMDLevel<x)?"<p style=\"font-weight:700;color:#00ff00;\">Your EMD Level has increased.</p>":""}
return {
"Stardust":{dt:2700,text:function(){return "<p>The universe has collapsed due to negative mass, yielding "+BEformat(Decimal.add(g.stardust,stat.pendingstardust))+" atoms of <span class=\"_stardust\">Stardust</span>. This powerful resource will allow your exotic matter to increase faster than before - however, its creation has consumed all of your exotic matter.</p><p>Due to radioactive decay, all your Stardust is destroyed each time you create more. As a result, you need more exotic matter to gain Stardust each time.</p><p style=\"font-weight:700;\" class=\"blue\">Note that Masteries persist on all resets. Story entries which you have already seen can be accessed again in Options > Hotkeys.</p>"+EMDLevelIncrement(2)}},
"Dark Matter":{dt:1800,text:function(){return "<p>You have just condensed 500 billion Stardust atoms into a <span class=\"_darkmatter\">particle with positive mass</span>.</p><p>It seems useless at first glance, but like your sprawling galaxies of fundamentally inert exotic matter, it can probably be formed into an Axis.</p>"+EMDLevelIncrement(3)}},
"Energy":{dt:2400,text:function(){return "<p>Well, you have a universe<sup>"+BEformat(g.totalexoticmatter.log10().div(c.d80).floor())+"</sup> filled with exotic matter. But, you realise that all those particles have virtually no <span class=\"_energy\">Energy</span>!</p><p>You managed to shape the stardust into a sort of breeder reactor which produces an exponentially growing supply of dark energy - unfortunately, the sprawling sixteen-dimensional space you find yourself in must be filled with exorbitant amounts of it before it can help you in any way."+EMDLevelIncrement(4)}},
"Black hole":{dt:300,text:function(){return "<p>The large quantities of dark matter in your universe have resulted in the formation of a black hole.</p><p>At its current size it is of no use to you... but what if you add some dark matter to it? You feel tempted to try it 'in the name of <span class=\"_research\">science</span>'.</p>"}},
"Hawking Radiation":{dt:14400,text:function(){return "<p>Perhaps you acted too soon. The black hole grew in size until it consumed all the particles in your universe.</p><p>As the black hole evaporated, it created a wave of <span class=\"_wormhole\">Hawking radiation</span>.</p><p>For the first time since you started, you have no idea why you need this new resource. Perhaps it is time to conduct some <span class=\"_research\">research</span>?</p>"+EMDLevelIncrement(5)}},
"Studies":{dt:3600,text:function(){return "<p>You decide that, for some Wormhole soon, you'll create a universe "+(visibleStudies().includes(1)?"and not interfere with it at all":visibleStudies().includes(2)?"with very limited star formation":"<span style=\"color:#ff0000\">error</span>")+". In theory this is a harmful idea, but you feel like doing this will give you <span style=\"color:#cc0000\">enlightenment</span>.</p>"}},
"Light":{dt:5400,text:function(){return "<p>Having traversed "+BEformat(N(g.TotalWormholeResets))+" universes, it's easy to feel as if you've \"seen it all\". You take a moment to appreciate the simple things in your existence, like the color of exotic matter... and you realise that it doesn't seem to have one. Everything is illuminated by the same constant gray light!</p><p>Surely there is a way to create "+gradientText("color","-webkit-linear-gradient(0deg,#ff0000,#00ff00,#0000ff)")+" in this place?</p>"+EMDLevelIncrement(6)}},
"Galaxies":{dt:7200,text:function(){return "<p>The dark matter has made your stars unstable, and now if you have more than 60 in close proximity to each other they'll all collapse.</p><p>You'll need to practice working with stronger, smaller <span class=\"_galaxies\">galaxies</span> to succeed.</p>"+EMDLevelIncrement(7)}},
"Luck":{dt:6300,text:function(){return "<p>In the beginning it was so easy to create <span class=\"_exoticmatter\">space</span>, to form <span class=\"_stars\">stars</span> and <span class=\"_research\">discover</span> the universe.</p><p>What has happened now? What was once enough exotic matter to create "+g.totalexoticmatter.mul(realAxisCostDivisor("X")).root(realAxisCostExponent("X")).div(c.d5).log(c.d6).floor().add(c.d1).format()+" metres of X axis now only provides "+maxAffordableAxis("X").format()+"; new observations come rarely, if at all. A galaxy of 61 stars will now never come to be, no matter how long you wait.</p><p>It's almost as if an <span class=\"blue\">invisible blue hand</span> is putting 'diminishing returns for balance' in your way to annoy you. But perhaps, if <span class=\"_luck\">luck</span> is not on your side, you can create your own?</p>"+EMDLevelIncrement(8)}},
"Prismatic":{dt:7200,text:function(){function c(x){return "<span class=\""+x+"\">"+x+"</span>"};return "<p>The exotic matter is now "+c("green")+"; Hawking radiation is "+c("blue")+"; the stars are "+c("white")+" specks in the distance surrounded by nebulae of "+c("cyan")+" research papers. At the far end of the universe are dark "+c("red")+" rifts to the "+numword(visibleStudies().length)+" Study dimensions you've discovered, all against a backdrop of "+c("magenta")+" and "+c("yellow")+" crafted from the essence of pure achievement.</p><p>This is such an eyesore! It looks almost like something out of a coloring book... you feel determined to blend the <span class=\"_prismatic\">colors</span> together to create a beautiful universe, though you don't see how that will help you.</p>"+EMDLevelIncrement(8)}},
"Antimatter":{dt:8100,text:function(){return "<p>The universe is perfectly balanced, the exotic matter pulling everything apart and the dark matter holding it together.</p><p>How long has it been this way? A year? Ten years? "+timeFormat(g.truetimePlayed)+"?</p><p>For as long as you remember, you've been drifting through this void of sixteen dimensions, creating space and filling it with stars and galaxies... but what is it all for? Is there something watching you? Are you a part of some callous celestial experiment?</p><p>Surely that can't be true... either way, you resolve to tear your way out of this place and you won't let anything stop you. Perhaps disrupting the balance with a <span class=\"_antimatter\">new substance</span> is a good start?</p>"+EMDLevelIncrement(8)}},
"Corruption":{dt:2700,text:function(){let corrupt = corruption.unlocked("axis")?axisCodes.filter(x=>corruption.list.axis.isCorrupted(x))[0]:corruption.unlocked("darkAxis")?("dark "+axisCodes.filter(x=>corruption.list.darkAxis.isCorrupted(x))[0]):corruption.unlocked("antiAxis")?("anti-"+axisCodes.filter(x=>corruption.list.antiAxis.isCorrupted(x))[0]):"<span style=\"color:#ff0000\">error</span>";return "<p>What's this? Some sort of wall? It's almost as if the "+corrupt+" axis is actively resisting expansion...</p><p>Something is clearly trying to stop you now.</p>"}},
"Study XIII":{dt:23400,text:function(){return "<p>A new <span style=\"color:#cc0000\">Study</span> subverse flickers into existence, but this one seems different...</p><p>All the ones before this one were already filled with bindings and knowledge to be harnessed, named and protected by a barrier. This one, however, seems to have neither a name nor any bindings, there are no visible paradigms to be salvaged from within and the barrier which must normally be weakened with resources to enter seems to be broken.</p><p>It's almost as if you've stumbled upon a blank universe... did you just create this yourself? Perhaps you can create your own bindings and rewards as well...</p>"+EMDLevelIncrement(9)}},
"":{dt:900,text:function(){return }}
}
})()
function openStory(x) {
if (storyEntries[x]!==undefined) {
timeState = 0
if (!g.storySnippets.includes(x)) g.storySnippets.push(x);
popup({text:"<h1 id=\"storyTitle\">"+x+"</h1>"+storyEntries[x].text(),buttons:[["Close",""]]})
}
}
function showPreviousStory() {
popup({
text:"Which story entry would you like to see again?",
buttons:g.storySnippets.map(x=>[x,"openStory('"+x+"')"])
})
}
// Exotic Matter
const exoticmatterVariables = ["exoticmatter","exoticmatterThisStardustReset","exoticmatterThisWormholeReset","exoticmatterThisSpacetimeReset","totalexoticmatter"]
function incrementExoticMatter(x) {
x=x.fix(c.d0);
for (let i of exoticmatterVariables) o.add(i,x)
}
const axisEffectHTML = {
X:"Exotic matter gain is multiplied by {e}",
darkX:"Dark matter gain is multiplied by {e}",
antiX:"Antimatter gain is multiplied by {e}",
Y:"Increase X axis effect by +{e}×",
YEmpowered:"Empowered Y axis multiply the X axis effect as well as adding to it (only applies if effect is above 1×)",
darkY:"All dark axis are {e}× cheaper",
antiY:"Luck shard, prismatic and antimatter gain is multiplied by {e}",
Z:"Exotic matter gain is multiplied by {e} (based on exotic matter)",
darkZ:"Dark matter gain is multiplied by {e} (based on exotic matter)",
antiZ:"Multiply the anti-X axis effect by {e}",
W:"Exotic matter gain is multiplied by {e} (increases over time)",
darkW:"Mastery power gain is multiplied by {e}",
darkWEmpowered:"Empowered dark W axis multiply chroma gain by the same amount they multiply mastery power gain",
antiW:"All anti-axis are {e}× cheaper (based on antimatter)",
V:"All normal axis are {e}× cheaper",
darkV:"Normal V axis is {e}% stronger",
antiV:"Dark Y axis is {e}% stronger",
antiVEmpowered:"Empowered anti-V axis boost the anti-T axis by the same amount they boost the dark Y axis",
U:"Stardust gain is multiplied by {e} (based on unspent stardust)",
darkU:"Dark matter gain is multiplied by {e} per dark axis owned<br><span class=\"small\">(currently: {e2}×)</span>",
antiU:"The anti-Z axis effect is multiplied by {e} per anti-axis owned<br><span class=\"small\">(currently: {e2}×)</span>",
T:"Exotic matter gain is multiplied by {e} (based on total normal axis)",
darkT:"Dark matter gain is multiplied by {e} (based on time this stardust reset)",
antiT:"Add {e} to the observation effect<br><span class=\"small\">(currently equivalent to {e2}× knowledge)</span>",
S:"Exotic matter gain is raised to the power of {e}",
darkS:"Dark matter gain is raised to the power of {e}",
antiS:"Antimatter gain is raised to the power of {e}",
R:"All normal axis costs are raised to the power of {e}",
darkR:"Normal R axis cost is raised to the power of {e}",
antiR:"Anti-W axis is {e}% stronger",
Q:"Energy gain is multiplied by {e}",
darkQ:"Hawking radiation gain is multiplied by {e} (based on unspent Hawking radiation)",
antiQ:"All anti-axis costs are raised to the power of {e}",
P:"Y axis effect is multiplied by {e}",
darkP:"All dark axis costs are raised to the power of {e}",
antiP:"Dark P axis cost is raised to the power of {e}",
O:"The effective levels of the first eleven normal axis are multiplied by {e}",
darkO:"The effective levels of the first eleven dark axis are multiplied by {e}",
antiO:"The effective levels of the first eleven anti-axis are multiplied by {e}",
};
function realAxisCostDivisor(type) {
let output = stat.axisCostDivisor;
if (type==="X") {output=output.mul(stat.stardustBoost5.pow(g.XAxis));}
if (type==="Y"&&g.achievement[312]) {output=output.mul(stat.stardustBoost5.pow(g.YAxis.mul(c.d0_04)));}
if (study13.bound(25)) {output=output.layerf(x=>Math.max(x-study13.bindingEff(25).toNumber(),-1)).max(c.minvalue);}
return output;
}
function realAxisCostExponent(type) {
let typeNum = axisCodes.indexOf(type)
let output = stat.axisCostExponent;
if (type==="S"&&g.research.r3_5) {output = output.mul(researchEffect(3,5));}
if (typeNum<8) {
let tier7res = ["r16_2","r15_2","r14_2","r13_2","r13_1","r14_1","r15_1","r16_1"][axisCodes.indexOf(type)]
if (g.research[tier7res]) output = output.mul(researchEffect(researchRow(tier7res),researchCol(tier7res)))
}
for (let i of researchGroupList.spatialsynergism.effectors[type]) {if (g.research[i]) {output = output.div(research[i].value())}}
if (type==="R") {output = output.mul(stat.darkRAxisEffect.pow(stat.realdarkRAxis))}
return output;
}
function realAxisScalePower(type){
let out=stat.axisScalingPower
if (type==="O") {out=out.mul(c.d2)}
return out
}
function realAxisSuperscalePower(type){
let out=stat.axisSuperscalingPower
if (type==="S") {out=out.mul(c.d5)}
if (type==="R") {out=out.mul(c.d5)}
if (type==="O") {out=out.mul(c.d9)}
return out
}
function axisCost(type,axis) {
axis = (axis === undefined)?g[type+"Axis"]:N(axis);
let cost = null;
axis = Decimal.semiexpScaling(axis,stat.axisSuperscalingStart,realAxisSuperscalePower(type));
axis = Decimal.linearScaling(axis,stat.axisScalingStart,realAxisScalePower(type));
if (type==="X") cost = c.d6.pow(axis).mul(c.d5);
else if (type==="Y") cost = c.d1_5.pow(axis.simplex(2)).mul(c.e2);
else if (type==="Z") cost = c.d10.pow(axis.pow(c.d1_379654224)).mul(c.e6);
else if (type==="W") cost = c.d10.pow(axis.simplex(2)).mul(c.d5e7);
else if (type==="V") cost = c.d10.pow(axis).mul(c.e20);
else if (type==="U") cost = c.d10.pow(axis.pow(c.d1_5)).mul(c.e100);
else if (type==="T") cost = axis.mul(c.d10).add(c.d180).pow10();
else if (type==="S") cost = c.inf.pow(c.d1_25.pow(axis));
else if (type==="R") cost = [N("e7.5e12"),c.d4div3,axis].decimalPowerTower()
else if (type==="Q") cost = [N("e4e13"),c.d1_1,axis].decimalPowerTower()
else if (type==="P") cost = [N("e1.3e14"),c.d1_03,axis].decimalPowerTower()
else if (type==="O") cost = axis.add(c.d35).div(c.d30).layerplus(3)
else functionError("axisCost",type)
cost = corruption.value("axis",cost)
cost = cost.pow(realAxisCostExponent(type));
cost = cost.div(realAxisCostDivisor(type));
return cost;
}
function maxAffordableAxis(type,em=g.exoticmatter) {
if (axisCost(type).gte(em)&&em.eq(g.exoticmatter)) return g[type+"Axis"];
let effective_EM = corruption.invertValue("axis",em.mul(realAxisCostDivisor(type)).root(realAxisCostExponent(type)));
let axis; // prevent "lexical declaration cannot appear in single-statement context"
if (type==="X") {axis = effective_EM.lte(c.d5)?c.dm1:effective_EM.div(c.d5).log(c.d6);}
else if (type==="Y") {axis = effective_EM.lte(c.e2)?c.dm1:effective_EM.div(c.e2).log(c.d1_5).mul(c.d2).add(c.d0_25).pow(c.d0_5).sub(c.d0_5);}
else if (type==="Z") {axis = effective_EM.lte(c.e6)?c.dm1:effective_EM.log10().sub(c.d6).pow(c.d0_7248191884897692);}
else if (type==="W") {axis = effective_EM.lte(c.d5e7)?c.dm1:effective_EM.div(c.d5e7).log10().mul(c.d2).add(c.d0_25).pow(c.d0_5).sub(c.d0_5);}
else if (type==="V") {axis = effective_EM.lte(c.e20)?c.dm1:effective_EM.log10().sub(c.d20);}
else if (type==="U") {axis = effective_EM.lte(c.e100)?c.dm1:effective_EM.log10().sub(c.e2).pow(c.d2div3);}
else if (type==="T") {axis = effective_EM.lte(c.e180)?c.dm1:effective_EM.log10().sub(c.d180).div(c.d10);}
else if (type==="S") {axis = effective_EM.lte(c.inf)?c.dm1:effective_EM.log(c.d2).div(c.d1024).log(c.d1_25);}
else if (type==="R") {axis = effective_EM.lte("e7.5e12")?c.dm1:effective_EM.log10().div(7.5e12).log(c.d4div3);}
else if (type==="Q") {axis = effective_EM.lte("e4e13")?c.dm1:effective_EM.log10().div(4e13).log(c.d1_1);}
else if (type==="P") {axis = effective_EM.lte("e1.3e14")?c.dm1:effective_EM.log10().div(1.3e14).log(c.d1_03);}
else if (type==="O") {axis = effective_EM.lte(N(35/30).layerplus(3))?c.dm1:effective_EM.layerplus(-3).mul(c.d30).sub(c.d35);}
else functionError("maxAffordableAxis",arguments);
axis = Decimal.linearSoftcap(axis,stat.axisScalingStart,realAxisScalePower(type));
axis = Decimal.semilogSoftcap(axis,stat.axisSuperscalingStart,realAxisSuperscalePower(type));
return axis.floor().add(c.d1);
}
function maxAxisForAchievement(type) {
if (achievement.maxForLocks.axis[g.achOnProgressBar]!==undefined) {if (achievement.locking(g.achOnProgressBar)) {if (achievement.maxForLocks.axis[g.achOnProgressBar][type]!==undefined) {return achievement.maxForLocks.axis[g.achOnProgressBar][type]}}}
return c.maxvalue
}
function buyAxis(x,manual=false) {
if (Decimal.eq(maxAxisForAchievement(x),g[x+"Axis"])) {if (manual) {achievement.lockPopup()};return}
if ((g.exoticmatter.gte(axisCost(x)))&&(stat.axisUnlocked>axisCodes.indexOf(x))) {
o.sub("exoticmatter",axisCost(x));
o.add(x+"Axis",c.d1);
if (g.XAxis.gt(c.d0)) unlockFeature("Masteries");
}
if (g.SAxis.gt(c.d0)) g.ach525possible=false;
if (axisCodes.map(x => g[x+"Axis"].eq(c.d0)).includes(false)) g.ach526possible=false;
addAchievements("axisBuy");
}
function buyMaxAxis(caps,manual=false) {
let total = axisCodes.map(x=>g[x+"Axis"]).sumDecimals()
let totalBefore = stat.totalNormalAxis;
axis: for (let j=0; j<stat.axisUnlocked; j++) {
for (let i=0;i<4;i++) {if ((g.achOnProgressBar===(202+i))&&(i===j)) {continue axis}}
let amount = caps[j]==="u"?maxAffordableAxis(axisCodes[j]):Decimal.min(maxAffordableAxis(axisCodes[j]),N(caps[j]).fix(c.d0,false));
if (amount==="NA") continue;
if (amount.lte(g[axisCodes[j]+"Axis"])) continue;
amount = amount.min(maxAxisForAchievement(axisCodes[j]))
if (axisCost(axisCodes[j],amount.sub(c.d1)).lt(g.exoticmatter)) o.sub("exoticmatter",axisCost(axisCodes[j],amount.sub(c.d1)));
g[axisCodes[j]+"Axis"]=amount;
}
g.exoticmatter=g.exoticmatter.max(c.d0); // maxAffordableAxis() doesn't seem to work properly because people are getting negative EM.
if (g.SAxis.gt(c.d0)) g.ach525possible=false;
if (axisCodes.map(x => g[x+"Axis"].eq(c.d0)).includes(false)) g.ach526possible=false;
if (axisCodes.map(x => g[x+"Axis"]).sumDecimals().sub(totalBefore).gte(c.d4800)) addAchievement(530);
if (g.XAxis.gt(c.d0)) unlockFeature("Masteries");
addAchievements("axisBuy");
if (manual&&(achievement.maxForLocks.axis[g.achOnProgressBar]!==undefined)&&achievement.locking(g.achOnProgressBar)&&axisCodes.map(x=>g[x+"Axis"]).sumDecimals().eq(total)) {achievement.lockPopup();}
}
var empoweredAxisBought = 0;
function buyEmpoweredAxis() {
empoweredAxisBought++;
for (let i=18;i<23;i++) addSecretAchievement(i);
}
// Masteries
const masteryData = {
11:{icon:"<span class=\"_exoticmatter\">EM</span><sup>+</sup>"},
12:{icon:"<span class=\"_exoticmatter\">A$</span><sup>-</sup>"},
21:{icon:"<span class=\"_exoticmatter\">X</span><sup>+</sup>"},
22:{icon:"<span class=\"_exoticmatter\">Y</span><sup>+</sup>"},
31:{icon:"<span class=\"_exoticmatter\">Z</span><sup>+</sup>"},
32:{icon:"<span class=\"_exoticmatter\">W</span><sup>+</sup>"},
41:{icon:"<span class=\"_mastery\">M</span><span class=\"xscript\"><sup>+</sup><sub class=\"_mastery\">x1</sub></span>"},
42:{icon:"<span class=\"_stardust\">S</span><sup>+</sup>",req:function(){return g.exoticmatterThisSpacetimeReset.gte(stat.stardustExoticMatterReq)||(g.StardustResets>0)||(g.WormholeResets>0)}},
43:{icon:"<span class=\"_mastery\">M</span><span class=\"xscript\"><sup>+</sup><sub class=\"_mastery\">x2</sub></span>"},
51:{icon:"<span class=\"_exoticmatter\">X</span><sup>+</sup>"},
52:{icon:"<span class=\"_mastery\">M</span><span class=\"xscript\"><sup>+</sup><sub class=\"_mastery\">1x</sub></span>"},
61:{icon:"<span class=\"_darkmatter\">X</span><sup>+</sup>"},
62:{icon:"<span class=\"_darkmatter\">A</span><sup>-</sup>"},
63:{icon:"<span class=\"_darkmatter\">DS$</span><sup>-</sup>"},
71:{icon:"<span class=\"_energy\">E</span><sup>+</sup>"},
72:{icon:"<span class=\"_energy\">E</span><sup>^</sup>"},
81:{icon:"<span class=\"_exoticmatter\">X</span>→<span class=\"_mastery\">MP</span>"},
82:{icon:"<span class=\"_exoticmatter\">EM</span>→<span class=\"_mastery\">MP</span>"},
83:{icon:"<span class=\"_darkmatter\">DM</span>→<span class=\"_mastery\">MP</span>"},
84:{icon:"<span class=\"_stardust\">S</span>→<span class=\"_mastery\">MP</span>"},
85:{icon:"<span class=\"_mastery\">MP</span><sup>+</sup>"},
91:{icon:"<span class=\"_time\">t</span>→<span class=\"_mastery\">M<sub>8x</sub></span>"},
92:{icon:"<span class=\"_time\">t</span><sup>-1</sup>→<span class=\"_mastery\">M<sub>8x</sub></span>"},
101:{icon:"<span class=\"_achievements\">A</span><span class=\"xscript\"><sup>+</sup><sub class=\"_achievements\">501</sub></span>",softcap:function(){return g.wormholeUpgrades[5]?wormholeUpgrades[5].eff():c.d75}},
102:{icon:"<span class=\"_wormhole\">HR</span><sup>+</sup>"},
103:{icon:"<span class=\"_research\">K</span><sup>+</sup>"},
104:{icon:"<span class=\"_stars\">C</span><sup>+</sup>",req:function(){return g.research.r10_11}},
105:{icon:"<span class=\"_stars\">"+icon.star("")+"$</span><sup>-</sup>",req:function(){return g.achievement[711]}},
111:{icon:"<span class=\"_mastery\">M<sub>104</sub></span>→<span class=\"_prismatic\">P</span>",req:function(){return g.research.r23_6}},
112:{icon:"<span class=\"_mastery\">M</span><span class=\"xscript\"><sup>+</sup><sub class=\"_mastery\">104</sub></span>",req:function(){return g.research.r23_10}}
}
const totalMasteryRows = Math.floor(Object.keys(masteryData).map(x => Number(x)).reduce((x,y) => Math.max(x,y))/10);
function fixMasteryArrays() {
let masteryArrays = ["activeMasteries"];
for (let i of masteryArrays) while (g[i].length<=totalMasteryRows) g[i].push(0);
}
fixMasteryArrays();
function MasteryE(x) {
x=Number(x)
if (masteryData[x].req !== undefined) {if (!masteryData[x].req()) return false}
let row = Math.floor(x/10);
if (g.activeMasteries[row]===0) return false;
if (StudyE(8)) return g.activeMasteries[row]===(x%10) // ignore all "multi-activate" effects
if (g.achievement[708]&&(row===10)&&[101,103].includes(x)&&[1,3].includes(g.activeMasteries[10])) return true
return (g.activeMasteries[row]===(x%10))||masteredRow(row);
}
function masteredRow(x) {
if (x===1) return g.stardustUpgrades[3]>0;
if (x<=9) return g.star[[51,52,53,54,101,102,103,104][x-2]];
if (x===11) {return g.prismaticUpgrades.masterSpark.gt(c.d0)}
return false;
}
function tryToggleMastery(x) {
if (g.confirmations.doubleClickToBuy&&(g.masteryContainerStyle==="Modern")) {
if (selections.masteryClick===x) {
toggleMastery(x,true)
}
} else {
toggleMastery(x,true)
}
selections.masteryClick = x
}
function toggleMastery(x,manual=false) {
if (achievement.maxForLocks.mastery.includes(Number(g.achOnProgressBar))&&achievement.locking(g.achOnProgressBar)) {if (manual) {achievement.lockPopup()};return}
let row = Math.floor(x/10);
if (!(x===g.activeMasteries[row])) {
if ((g.activeMasteries[row]!==0)&&(!MasteryE(x))) masteryReset()
g.activeMasteries[row]=x%10;
}
g.ach524possible=g.ach524possible&&achievement(524).active();
}
function unassignMasteryRow(row) {
if (g.activeMasteries[row]!==0) {
g.activeMasteries[row]=0
masteryReset()
}
}
function masteryEffect(x) {
if (x===11) return g.masteryPower.add(c.d1).pow(masteryBoost(11).mul(c.d0_1));
if (x===12) return g.masteryPower.add(c.d1).pow(masteryBoost(12).mul(c.d0_15));
if (x===21) return Decimal.logarithmicSoftcap(g.masteryPower.add(c.d1).dilate(c.d0_6).pow(masteryBoost(21).mul(c.d0_0175)),c.e50,c.d0_2);
if (x===22) return Decimal.logarithmicSoftcap(g.masteryPower.add(c.d1).dilate(c.d0_6).pow(masteryBoost(22).mul(c.d0_035)),c.e100,c.d0_1);
if ([31,32].includes(x)) return g.masteryPower.add(c.d1).log10().pow(c.d0_5).mul(c.d0_75).mul(masteryBoost(x));
if ([41,43].includes(x)) return Decimal.logarithmicSoftcap(g.masteryPower.add(c.d1).log10().div(c.d15),c.d1,c.d2).mul(masteryBoost(x)).add(c.d1);
if (x===42) return g.masteryPower.add(c.e4).dilate(c.d0_5).div(c.e2).pow(masteryBoost(42));
if (x===51) return g.masteryPower.add(c.d1).log10().pow(c.d0_6).mul(c.d2_5).mul(masteryBoost(51));
if (x===52) {
let out = g.masteryPower.add(c.d1).log10().pow(c.d0_4).mul(c.d2_5).mul(masteryBoost(52)).add(c.d1);
if (g.research.r19_9) out = out.pow(researchEffect(19,9))
return out
}
if (x===61) return g.masteryPower.add(c.d10).log10().pow(c.d0_1).sub(c.d1).mul(masteryBoost(61)).add(c.d1);
if (x===62) return g.masteryPower.add(c.d10).log10().pow(masteryBoost(62).mul(-0.04));
if (x===63) return g.masteryPower.add1Log(c.d10).pow(c.d0_8).mul(masteryBoost(63));
if (x===71) return g.masteryPower.pow(c.d1_25).add(c.e10).log10().log10().pow(masteryBoost(71));
if (x===72) return Decimal.logarithmicSoftcap(g.masteryPower.pow(c.d1_25).add(c.e10).log10().log10().pow(c.d0_5).sub(c.d1),c.d1,c.d5).mul(masteryBoost(72)).add(c.d1);
if ([81,82,83,84].includes(x)) {
let output = [g.masteryPower.add(c.d1).log10().pow(c.d0_5),[c.d0_03,c.d0_1,c.d0_2,c.d0_24][x-81],masteryBoost(x)].productDecimals();
if (x===81) output = output.mul(g.XAxis.pow(c.d0_4));
if (x===82) output = output.mul(g.exoticmatter.add(c.d10).log10().log10());
if (x===83) output = output.mul(g.darkmatter.add(c.d10).log10().log10().pow(c.d0_75));
if (x===84) output = output.mul(g.stardust.add(c.d10).log10().log10().pow(c.d0_5));
return Decimal.logarithmicSoftcap(output,c.e2,c.d1).pow10();
}
if (x===85) return [g.masteryPower.add(c.d10).log10().log10(),masteryBoost(85),c.d0_2].productDecimals();
if (x===91) return g.masteryPower.add(c.d10).log10().log10().div(c.d10).mul(Decimal.mul(c.d0_3,g.truetimeThisStardustReset.add(c.d10).log10())).mul(masteryBoost(91)).add(c.d1);
if (x===92) return g.masteryPower.add(c.d10).log10().log10().div(c.d10).div(Decimal.mul(c.d0_3,g.truetimeThisStardustReset.add(c.d10).log10())).mul(masteryBoost(92)).add(c.d1);
if (x===101) return Decimal.logarithmicSoftcap(g.masteryPower.add(c.d1).log10().add(c.d1).pow(masteryBoost(101).div(c.d2)),masteryData[101].softcap(),c.d2);
if (x===102) return g.masteryPower.add(c.d1).dilate(c.d2div3).pow(masteryBoost(102).mul(c.d0_0175));
if (x===103) return g.masteryPower.add(c.d10).dilate(c.d0_2).sub(c.d9).pow(masteryBoost(103));
if (x===104) return masteryBoost(104).mul(g.masteryPower.gt(c.ee3)?g.masteryPower.log10().sub(c.d500):g.masteryPower.add(c.d1).log10().pow(c.d2).div(2000)).div(500).pow10()
if (x===105) return c.d1.sub(g.masteryPower.add(c.d1).log10().div(c.e2).add(c.d10).log10().pow(c.d0_5)).mul(masteryBoost(105)).pow10()
if (x===111) return masteryBoost(111).div(c.d32)
if (x===112) return g.masteryPower.add(c.d1).log10().div(c.e2).add(c.d1).pow(masteryBoost(112).div(c.d32))
functionError("masteryEffect",arguments)
}
function masteryBoost(x) {
x=Number(x)
let row = Math.floor(x/10);
let b=stat.knowledgeEffect.div(c.e2).add(c.d1);
let excessMasteryResearch = ownedResearchInGroup("mastery").length-g.studyCompletions[8]
if (excessMasteryResearch>0) b = b.mul(Math.max(0,1-excessMasteryResearch/3))
// inter-row effects
if ([11,21,31].includes(x)&&MasteryE(41)) b = b.mul(masteryEffect(41));
if ([12,22,32].includes(x)&&MasteryE(43)) b = b.mul(masteryEffect(43));
if (g.achievement[516]&&(row>=2)&&(row<=9)) if (g.star[[51,52,53,54,101,102,103,104][row-2]]) b = b.mul(c.d1_01);
if (g.research.r6_11) {
let row = Math.floor(x/10);
let owned = 0
for (let i=1;i<5;i++) if (g.star[row*10+i]) owned++;
b = b.mul(researchEffect(6,11).div(c.e2).mul(owned).add(c.d1));
}
if (study13.bound(196)&&((row%2)===1)) {b = b.mul(study13.bindingEff(196))}
if (study13.bound(234)) {b = b.mul(study13.bindingEff(234).pow(row))}
// single row effects
if (row===1) {
if (StudyE(11)) return c.d0
if (g.achievement[105]) b = b.mul(achievement(105).effect().div(c.e2).add(c.d1));
if (MasteryE(52)) b = b.mul(masteryEffect(52))
if ((x===11)&&g.research.r4_6) b = b.mul(researchEffect(4,6));
if ((x===12)&&g.research.r4_10) b = b.mul(researchEffect(4,10));
if (study13.bound(53)) {b = b.mul(study13.bindingEff(53))}
}
if (row===2) {
if (g.research.r5_13) b = b.mul(stat.spatialEnergyEffect.pow(researchEffect(5,13)));
}
if (row===3) {
if (g.achievement[825]) b = b.mul(c.d3)
if (study13.bound(44)) {b = b.mul(study13.bindingEff(44))}
}
if (row===4) {
if (g.achievement[201]) b = b.mul(achievement(201).effect().div(c.e2).add(c.d1));
if (x===42) {
b = b.mul(studies[4].reward(2))
if (study13.rewardLevels.masterNumber>0) {b = b.mul(2.3)}
if (study13.rewardLevels.masterNumber>3) {b = b.mul(1+0.013*g.studyCompletions[13])}
}
}
if (row===6) {
if (g.research.r20_7&&(x!==62)) {b = b.mul(researchEffect(20,7))}
if ((x===63)&&(study13.rewardLevels.masterNumber>1)) {b = b.mul(1.3)}
if ((x===63)&&(study13.rewardLevels.masterNumber>4)) {b = b.mul(g.darkstars.mul(0.0013).add(c.d1))}
}
if (row===8) {
for (let i of [91,92]) {if (MasteryE(i)) {b = b.mul(masteryEffect(i))}}
if (x===85) {b = b.mul(studies[8].reward(2).mul(achievement.ownedInTier(8)).div(c.e2).add(c.d1))}
if (study13.bound(64)) {b = b.mul(study13.bindingEff(64))}
}
if (row===10) {
b = b.mul(stat.stardustBoost11);
if (achievement.ownedInTier(5)>=27) b = b.mul(wormholeMilestone27.eff().div(c.e2).add(c.d1));
if (g.research.r20_9&&[102,104].includes(x)) b = b.mul(researchEffect(20,9))
if (x===101) {
if (study13.bound(186)) {b = b.mul(study13.bindingEff(186))}
}
if (x===103) {
if (g.achievement[710]) {b = b.mul(c.d9);}
}
if (x===104) {
if (MasteryE(112)) {b = b.mul(masteryEffect(112))}
}
if (x===105) {
b = b.mul(achievement(711).effect())
if (study13.rewardLevels.masterNumber>2) {b = b.mul(1+0.0013*study13.rewards.masterNumber.l3Mult())}
}
}
if (row===11) {
b = b.mul(prismaticUpgrades.masterSpark.eff())
}
return b.fix(c.d0);
}
const percentableMasteries = [41,43,61,72,91,92] // masteries with effects that can be formatted as a percentage
function masteryEffFormat(x,getPrec=false) {
let precision = [101].includes(x)?4:[52,62,85,105].includes(x)?3:2
if (getPrec) {return precision;}
let percentable = percentableMasteries.includes(x)
let func = [].includes(x)?"noLeadFormat":"format"
let eff = masteryEffect(x)
if (percentable) {
if (eff.gte(c.d10)) return eff[func](precision)+"×"
return eff.sub(c.d1).mul(c.e2)[func](precision)+"%"
}
return eff[func](precision)
}
function masteryFormula(x) {
if ([11,12].includes(x)) return "(MP + 1)<sup>"+masteryBoost(x).mul(x===12?c.d0_15:c.d0_1).noLeadFormat(3)+"</sup>"
if ([21,22].includes(x)) {
let out = "log(MP + 1)<sup>0.6</sup>"+formulaFormat.mult(masteryBoost(x).mul(x===22?c.d0_035:c.d0_0175)) // this is the exponent
if (masteryEffect(x).gt(x===22?c.e100:c.e50)) out = "(("+out+" - "+(x===22?"100":"50")+") × "+(x===22?"0.23026":"0.46052")+" + 1)<sup>"+(x===22?"10":"5")+"</sup>"+formulaFormat.mult(x===22?c.e100:c.e50)
else out = "10<sup>"+out+"</sup>"
return out
}
if ([31,32].includes(x)) return "log(MP + 1)<sup>0.5</sup>"+formulaFormat.mult(masteryBoost(x).mul(c.d0_75))
if ([41,43].includes(x)) return formulaFormat.logSoftcap("log(MP+1) ÷ 15",c.d1,c.d1,g.masteryPower.gte(c.e15))+formulaFormat.mult(masteryBoost(x))+" + 1"
if (x===42) return "10<sup>(log(MP + "+c.e4.format()+")<sup>0.5</sup> - 2)"+formulaFormat.mult(masteryBoost(42))+"</sup>"
if ([51,52].includes(x)) {
let out = "log(MP+1)<sup>0."+(x===52?"4":"6")+"</sup>"+formulaFormat.mult(masteryBoost(x).mul(c.d2_5))+(x===52?" + 1":"")
if (x===52&&g.research.r19_9) out = "("+out+")"+formulaFormat.exp(researchEffect(19,9))
return out
}
if (x===61) {