Skip to content

Commit a386dd4

Browse files
committed
d
1 parent 6185be0 commit a386dd4

2 files changed

Lines changed: 42 additions & 17 deletions

File tree

main.py

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,31 @@ def abbreviate(number, suffixes, decimals, greaterthan, rounda):
269269
if Decimal(fexp(Decimal(number)))%3 == 2:
270270
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals+2)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number/100))))
271271
elif Decimal.__abs__(Decimal(fexp(Decimal(number)))) < 10**6:
272-
return (str(round(fman(Decimal(number)), decimals)) + "e" + str(fexp(Decimal(number))))
272+
if suffixes == "sci":
273+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number))))
274+
elif suffixes == "eng":
275+
if Decimal(fexp(Decimal(number)))%3 == 0:
276+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number))))
277+
if Decimal(fexp(Decimal(number)))%3 == 1:
278+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals+1)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number/10))))
279+
if Decimal(fexp(Decimal(number)))%3 == 2:
280+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals+2)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number/100))))
281+
else:
282+
return (str(round(fman(Decimal(number)), decimals)) + "e" + str(fexp(Decimal(number))))
273283
elif Decimal.__abs__(Decimal(fexp(Decimal(number)))) < 10**10002 * 3:
274284
if suffixes == "l":
275285
return (str(round(fman(Decimal(number)), decimals)) + "e" + str(round(fexp(Decimal(number)) / 10**(Decimal.__floor__(Decimal.log10(Decimal.__abs__(Decimal(fexp(Decimal(number)))))/3)*3), 3)) + LongSuffixes[Decimal.__floor__(Decimal.log10(Decimal.__abs__(Decimal(fexp(Decimal(number)))))/3)+0])
276286
elif suffixes == "s":
277287
return (str(round(fman(Decimal(number)), decimals)) + "e" + str(round(fexp(Decimal(number)) / 10**(Decimal.__floor__(Decimal.log10(Decimal.__abs__(Decimal(fexp(Decimal(number)))))/3)*3), 3)) + ShortSuffixes[Decimal.__floor__(Decimal.log10(Decimal.__abs__(Decimal(fexp(Decimal(number)))))/3)+0])
288+
elif suffixes == "sci":
289+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number))))
290+
elif suffixes == "eng":
291+
if Decimal(fexp(Decimal(number)))%3 == 0:
292+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number))))
293+
if Decimal(fexp(Decimal(number)))%3 == 1:
294+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals+1)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number/10))))
295+
if Decimal(fexp(Decimal(number)))%3 == 2:
296+
return str(str(Decimal.__round__(Decimal(fman(Decimal(number)))*(Decimal(10)**Decimal(decimals+2)))/Decimal(Decimal(10)**Decimal(decimals))) + "e" + str(fexp(Decimal(number/100))))
278297
else:
279298
return (str(round(fman(Decimal(number)), decimals)) + "e" + str(round(fexp(Decimal(number)) / 10**(Decimal.__floor__(Decimal.log10(Decimal.__abs__(Decimal(fexp(Decimal(number))))))), 3)) + "e" + Decimal.__floor__(Decimal.log10(Decimal.__abs__(Decimal(fexp(Decimal(number)))))))
280299

@@ -842,38 +861,39 @@ def reset():
842861
buttonshake = [0,0]
843862
buttonshake2 = [0,0]
844863
notation = "s"
864+
enemyhealthsmoothper = 1.0
845865
while running:
846866
click_damage = Decimal(click_value)*Decimal(click_value_multi) + Decimal(cps_to_cpc)*Decimal(auto_click_value)*Decimal(auto_click_rate)
847867
def checkenemyded():
848868
global enemy_hp, enemy_max_hp, score, monsterskilled
849869
while Decimal(enemy_hp) <= 0:
850870
monsterskilled += Decimal(1)
851871
score += Decimal(random.uniform(.5, 1.5))*Decimal(enemy_max_hp)
852-
enemy_max_hp = Decimal(10) * Decimal(Decimal(1.1)**Decimal(monsterskilled // 5))
872+
enemy_max_hp = Decimal(10) * Decimal(Decimal.__pow__(Decimal(1.1),Decimal(Decimal(monsterskilled) // Decimal(5))))
853873
enemy_hp += Decimal(enemy_max_hp)
854874
punch_sound_death.play()
855875
while Decimal((Decimal(click_value)*Decimal(random.uniform(0.95, 1.05))*Decimal(click_value_multi) + Decimal(cps_to_cpc)*Decimal(auto_click_value)*Decimal(auto_click_rate))*Decimal(gemboost)) / (Decimal(1.1**100)) >= Decimal(enemy_max_hp):
856876
monsterskilled += Decimal(500)
857-
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal(Decimal(1.1)**Decimal(Decimal(monsterskilled)-1 // 5))
858-
enemy_max_hp = Decimal(10) * Decimal(Decimal(1.1)**Decimal(monsterskilled // 5))
877+
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal(Decimal(1.1)**Decimal(Decimal(monsterskilled-1) // Decimal(5)))
878+
enemy_max_hp = Decimal(10) * Decimal(Decimal.__pow__(Decimal(1.1),Decimal(Decimal(monsterskilled) // Decimal(5))))
859879
enemy_hp += Decimal(enemy_max_hp)
860880
punch_sound_death.play()
861881
while Decimal((Decimal(click_value)*Decimal(random.uniform(0.95, 1.05))*Decimal(click_value_multi) + Decimal(cps_to_cpc)*Decimal(auto_click_value)*Decimal(auto_click_rate))*Decimal(gemboost)) / (Decimal(1.1**1000)) >= Decimal(enemy_max_hp):
862882
monsterskilled += Decimal(5000)
863-
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal(Decimal(1.1)**Decimal(Decimal(monsterskilled)-1 // 5))
864-
enemy_max_hp = Decimal(10) * Decimal(Decimal(1.1)**Decimal(monsterskilled // 5))
883+
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal(Decimal(1.1)**Decimal(Decimal(monsterskilled-1) // Decimal(5)))
884+
enemy_max_hp = Decimal(10) * Decimal(Decimal.__pow__(Decimal(1.1),Decimal(Decimal(monsterskilled) // Decimal(5))))
865885
enemy_hp += Decimal(enemy_max_hp)
866886
punch_sound_death.play()
867887
while Decimal((Decimal(click_value)*Decimal(random.uniform(0.95, 1.05))*Decimal(click_value_multi) + Decimal(cps_to_cpc)*Decimal(auto_click_value)*Decimal(auto_click_rate))*Decimal(gemboost)) / Decimal.__pow__(Decimal(1.1),Decimal(10000)) >= Decimal(enemy_max_hp):
868888
monsterskilled += Decimal(50000)
869-
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal(Decimal(1.1)**Decimal(Decimal(monsterskilled)-1 // 5))
870-
enemy_max_hp = Decimal(10) * Decimal(Decimal(1.1)**Decimal(monsterskilled // 5))
889+
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal(Decimal(1.1)**Decimal(Decimal(monsterskilled-1) // Decimal(5)))
890+
enemy_max_hp = Decimal(10) * Decimal(Decimal.__pow__(Decimal(1.1),Decimal(monsterskilled) // Decimal(5)))
871891
enemy_hp += Decimal(enemy_max_hp)
872892
punch_sound_death.play()
873893
while Decimal((Decimal(click_value)*Decimal(random.uniform(0.95, 1.05))*Decimal(click_value_multi) + Decimal(cps_to_cpc)*Decimal(auto_click_value)*Decimal(auto_click_rate))*Decimal(gemboost)) / Decimal.__pow__(Decimal(1.1),Decimal(100000)) >= Decimal(enemy_max_hp):
874894
monsterskilled += Decimal(500000)
875-
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal(Decimal(1.1)**Decimal(Decimal(monsterskilled)-1 // 5))
876-
enemy_max_hp = Decimal(10) * Decimal(Decimal(1.1)**Decimal(monsterskilled // 5))
895+
score += Decimal(random.uniform(.5, 1.5))*Decimal(10) * Decimal.__pow__(Decimal(1.1),Decimal(Decimal(monsterskilled-1) // Decimal(5)))
896+
enemy_max_hp = Decimal(10) * Decimal(Decimal.__pow__(Decimal(1.1),Decimal(monsterskilled) // Decimal(5)))
877897
enemy_hp += Decimal(enemy_max_hp)
878898
punch_sound_death.play()
879899
speedmusic = constrain(speedmusic + (1-speedmusic)/(0.75/delta_time), 1, 3)
@@ -1246,8 +1266,13 @@ def draw_text(text, font, color, x, y, align, alpha):
12461266
draw_text(f"Clicks Per Second: {ClicksPerSecond}", font, WHITE, 10*WindowScale2 + CamPos[0]*WindowXscale, 220*WindowScale2 + CamPos[1]*WindowYscale, "left", 255)
12471267
draw_text(f"Max Clicks Per Second: {MaxClicksPerSecond}", font, WHITE, 10*WindowScale2 + CamPos[0]*WindowXscale, 250*WindowScale2 + CamPos[1]*WindowYscale, "left", 255)
12481268
draw_text(f"Total Clicks: {TotalClicks}", font, WHITE, 10*WindowScale2 + CamPos[0]*WindowXscale, 280*WindowScale2 + CamPos[1]*WindowYscale, "left", 255)
1269+
enemyhealthsmoothper += (float(Decimal(enemy_hp)/Decimal(enemy_max_hp))-enemyhealthsmoothper)/(0.15/delta_time)
1270+
enemyhealthsmoothper = constrain(enemyhealthsmoothper, 0, 1)
1271+
smoothhealthbarenemy_rect_surface = pygame.Surface((constrain(300*enemyhealthsmoothper, 0, 300)*WindowScale2, 40*WindowScale2), pygame.SRCALPHA)
1272+
smoothhealthbarenemy_rect_surface.fill((int(constrain(math.cos((math.pi/2)*constrain(enemyhealthsmoothper, 0, 1))*256, 0, 255)), int(constrain(math.sin((math.pi/2)*constrain(enemyhealthsmoothper, 0, 1))*256, 0, 255)), 0, 192)) # Fill with white and set alpha to 128 (50% transparent)
12491273
pygame.draw.rect(screen, (0, 0, 0), (10*WindowScale2 + CamPos[0]*WindowXscale, 310*WindowScale2 + CamPos[1]*WindowYscale, 300*WindowScale2, 40*WindowScale2))
12501274
pygame.draw.rect(screen, (constrain(math.cos((math.pi/2)*constrain(float(Decimal(enemy_hp)/Decimal(enemy_max_hp)), 0, 1))*256, 0, 255), constrain(math.sin((math.pi/2)*constrain(float(Decimal(enemy_hp)/Decimal(enemy_max_hp)), 0, 1))*256, 0, 255), 0), (10*WindowScale2 + CamPos[0]*WindowXscale, 310*WindowScale2 + CamPos[1]*WindowYscale, (float(Decimal(enemy_hp)/Decimal(enemy_max_hp)))*300*WindowScale2, 40*WindowScale2))
1275+
screen.blit(smoothhealthbarenemy_rect_surface, (10*WindowScale2 + CamPos[0]*WindowXscale, 310*WindowScale2 + CamPos[1]*WindowYscale))
12511276
def prestige():
12521277
global score, gems, musicplays, musicplays2, enemy_hp, enemy_max_hp, monsterskilled, click_damage
12531278
score = 0
@@ -1266,7 +1291,7 @@ def prestige():
12661291

12671292
# Draw upgrade buttons
12681293
for i, button in enumerate(Settings_buttons):
1269-
setx = Settings_button_x[i] + CamPos[0]*WindowXscale
1294+
setx = Settings_button_x[i] + CamPos[0]*WindowXscale/WindowScale2
12701295
sety = constrain(Settings_button_y[i] + Settings_Button_Y_scroll + Settings_Button_Y_scroll_vel, screen_height*-3, screen_height*0.8) + CamPos[1]*WindowYscale/WindowYscale
12711296
if isinstance(Settings[i]["value"], Decimal):
12721297
if Settings[i]["held"] and Settings[i]["holdable"]:
@@ -1291,8 +1316,8 @@ def prestige():
12911316
draw_text(f"{Settings[i]['name']}", font, WHITE, setx*WindowXscale + Settings_button_width[i]*WindowXscale/2, sety*WindowYscale + (Settings_button_height[i]*WindowScale2)/2, "center", 255)
12921317
#pygame.draw.rect(screen, (30, 30, 30), (900*WindowXscale + CamPos[0]*WindowXscale, WindowHeight*0.35 + CamPos[1]*WindowYscale, 380*WindowXscale, WindowHeight*1))
12931318
for i, button in enumerate(Buy_buttons):
1294-
setx = Buy_button_X[i] + CamPos[0]*WindowXscale
1295-
sety = Buy_button_Y[i] + CamPos[1]*WindowYscale/WindowYscale
1319+
setx = Buy_button_X[i] + CamPos[0]*WindowXscale/WindowScale2
1320+
sety = Buy_button_Y[i] + CamPos[1]*WindowYscale
12961321
if isinstance(BuyThing[i]["value"], Decimal):
12971322
if BuyThing[i]["held"] and BuyThing[i]["holdable"]:
12981323
if mos_x/WindowXscale <= setx + Buy_button_Width[i]/2:
@@ -1340,11 +1365,11 @@ def calcmax():
13401365
pygame.draw.rect(screen, (UpgradeButtonColorRed[i], UpgradeButtonColorGreen[i], UpgradeButtonColorBlue[i]), (upgx*WindowScale2, upgy, upgrade_button_width[i]*WindowScale2, upgrade_button_height[i]*WindowScale2))
13411366
draw_text(f"{upgrades[i]['name']} - {abbreviate(upgrades[i]['cost'], notation, 3, 10000, False)}", font, WHITE, upgx*WindowScale2 + upgrade_button_width[i]*WindowScale2/2, upgy + upgrade_button_height[i]*WindowScale2/2, "center", 255)
13421367
if bulkbuy == "Max":
1343-
draw_text(f"{abbreviate(upgrades[i]["bought"], notation, 3, 100000, True)} + Max ({Decimal(calcmax())})", font, WHITE, upgx*WindowScale2, upgy - 38*WindowScale2, "left", 255)
1368+
draw_text(f"{abbreviate(upgrades[i]["bought"], notation, 3, 1000, True)} + Max ({abbreviate(Decimal(calcmax()), notation, 3, 1000, True)})", font, WHITE, upgx*WindowScale2, upgy - 38*WindowScale2, "left", 255)
13441369
elif BuyThing[1]["value"] == "ON":
1345-
draw_text(f"{abbreviate(upgrades[i]["bought"], notation, 3, 100000, True)} + {Decimal(upgrades[i]["bought"]) - Decimal(upgrades[i]["bought"]) % Decimal(bulkbuy) + Decimal(bulkbuy) - Decimal(upgrades[i]["bought"])}", font, WHITE, upgx*WindowScale2, upgy - 38*WindowScale2, "left", 255)
1370+
draw_text(f"{abbreviate(upgrades[i]["bought"], notation, 3, 1000, True)} + {Decimal(upgrades[i]["bought"]) - Decimal(upgrades[i]["bought"]) % Decimal(bulkbuy) + Decimal(bulkbuy) - Decimal(upgrades[i]["bought"])}", font, WHITE, upgx*WindowScale2, upgy - 38*WindowScale2, "left", 255)
13461371
else:
1347-
draw_text(f"{abbreviate(upgrades[i]["bought"], notation, 3, 100000, True)} + {bulkbuy}", font, WHITE, upgx*WindowScale2, upgy - 38*WindowScale2, "left", 255)
1372+
draw_text(f"{abbreviate(upgrades[i]["bought"], notation, 3, 1000, True)} + {bulkbuy}", font, WHITE, upgx*WindowScale2, upgy - 38*WindowScale2, "left", 255)
13481373
def distance_to(ax, ay, bx, by):
13491374
return math.sqrt((ax - bx)**2 + (ay - by)**2)
13501375
"""realarrowdownimg1.set_alpha(200 - distance_to(mos_x, mos_y, 1100*WindowXscale + CamPos[0]*WindowXscale, 252*WindowYscale + CamPos[1]*WindowYscale))
@@ -1409,7 +1434,7 @@ def distance_to(ax, ay, bx, by):
14091434
buttonshake[0] = random.uniform(-buttonshake2[0], buttonshake2[0])
14101435
buttonshake[1] = random.uniform(-buttonshake2[1], buttonshake2[1])
14111436
CamPos = [CamPos[0] + (CamPos2[0]-CamPos[0])/(0.15/delta_time), CamPos[1] + (CamPos2[1]-CamPos[1])/(0.15/delta_time)]
1412-
Settings_button_x = [490 + 1280*WindowXscale, 490 + 1280*WindowXscale, 490 + 1280*WindowXscale, 490 + 1280*WindowXscale, 490 + 1280*WindowXscale, 490 + 1280*WindowXscale, 490 + 1280*WindowXscale]
1437+
Settings_button_x = [490 + 1280*WindowXscale/WindowScale2, 490 + 1280*WindowXscale/WindowScale2, 490 + 1280*WindowXscale/WindowScale2, 490 + 1280*WindowXscale/WindowScale2, 490 + 1280*WindowXscale/WindowScale2, 490 + 1280*WindowXscale/WindowScale2, 490 + 1280*WindowXscale/WindowScale2]
14131438
if (rl.get_music_time_played(music1) >= rl.get_music_time_length(music1)-.03) and musicplays2 == 0:
14141439
musicplays2 = 1
14151440
if musicplays >= 0.03:

save/SaveData.pickle

55 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)