-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.py
888 lines (690 loc) · 35.1 KB
/
player.py
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
import os
import sys
import math
import uuid
import random
import pickle
from halo import Halo
from weapons import WeaponType
from weapons import get_weapon
from items import ItemType
from load_photos import resource_path
from themedstuff import themed_ajt
from themedstuff import themed_names
spinner = Halo(text='Loading', spinner='dots', color='green')
starting_max_blessing = 5
class Player:
def __init__(self, name):
"""
Initializes a new player character.
"""
self.PlayerName: str = name
self.level: int = 1
self.MHP: int = 1000 * self.level
self.HP: int = self.MHP
self.Def: int = 25
self.Atk: int = 250
self.Regain: float = 0.02
self.Vitality: float = 1
self.Bleed: float = 0
self.CritRate: float = 0.03
self.CritDamageMod: float = 2
self.DodgeOdds: float = 0.03
self.DamageTaken: int = 0
self.DamageDealt: int = 0
self.RushStat: int = 3
self.Logs: list = []
self.Inv: list[WeaponType] = [get_weapon('game_bit')]
self.Items: list[ItemType] = []
self.photo: str = "player.png"
def save(self):
with open(f'{self.PlayerName}.dat', 'wb') as f:
pickle.dump(self.__dict__, f)
def load(self):
try:
with open(f'{self.PlayerName}.dat', 'rb') as f:
self.__dict__ = pickle.load(f)
except FileNotFoundError:
print(f"Save file for {self.PlayerName} not found. Starting new game.")
except Exception as e:
print(f"Error loading save file: {e}")
self.check_stats()
def set_photo(self, photo):
if os.path.exists(resource_path(os.path.join("photos", f"{photo}.png"))):
self.photo: str = resource_path(os.path.join("photos", f"{photo}.png"))
else:
photos = os.listdir(resource_path(os.path.join("photos", "fallbacks")))
self.photo: str = resource_path(os.path.join(os.path.join("photos", "fallbacks"), f"{random.choice(photos)}"))
def load_mimic(self):
for filename in os.listdir("."):
if ".dat" in filename.lower():
try:
with open(f'{filename}', 'rb') as f:
self.__dict__ = pickle.load(f)
except FileNotFoundError:
print(f"Save file for {filename} not found. Error...")
except Exception as e:
print(f"Error loading save file: {e}")
def load_past_lives(self):
past_lives_folder = "past_lives"
if not os.path.exists(past_lives_folder):
os.makedirs(past_lives_folder)
print("No past lives found.")
return
spinner.start(text="Past Lifes: Starting")
total_items = len(os.listdir(past_lives_folder))
starting_items = 0
for filename in os.listdir(past_lives_folder):
if filename.endswith(".pastlife"):
filepath = os.path.join(past_lives_folder, filename)
starting_items += 1
spinner.start(text=f"({starting_items}/{total_items}) Past Lifes: {filepath}")
try:
with open(filepath, 'rb') as f:
past_life_data = pickle.load(f)
self.MHP: int = self.MHP + self.check_base_stats(self.MHP, int(past_life_data['MHP'] * total_items) + 100)
self.HP: int = self.MHP
self.Def: int = self.Def + self.check_base_stats(self.Def, int(past_life_data['Def']) + 100)
self.Atk: int = self.Atk + self.check_base_stats(self.Atk, int(past_life_data['Atk']) + 200)
self.Regain: float = self.Regain + float(past_life_data['Regain'] * 0.001) + 0.01
self.gain_crit_rate(float(past_life_data['CritRate'] * 0.001) + 0.01)
self.gain_crit_damage(float(past_life_data['CritDamageMod'] * 0.0003) + 0.001)
self.gain_dodgeodds_rate(float(past_life_data['DodgeOdds'] * 0.0025) + 0.001)
for item in past_life_data['Items']:
self.MHP: int = self.MHP + self.check_base_stats(self.MHP, 1000)
self.HP: int = self.MHP
self.Def: int = self.Def + self.check_base_stats(self.Def, 50)
self.Atk: int = self.Atk + self.check_base_stats(self.Atk, 50)
self.Regain: float = self.Regain + (0.01)
self.gain_crit_rate(0.01)
self.gain_crit_damage(0.01)
self.gain_dodgeodds_rate(0.001)
if past_life_data['Vitality'] < 0:
spinner.fail(text=f"Past Lifes: {filepath} failed to load (Vitality is negative. Deleting past life file.)")
os.remove(filepath)
continue
elif past_life_data['Vitality'] > 1.0000001:
temp_past_life_vitality = past_life_data['Vitality'] - 1
while temp_past_life_vitality > 0:
if self.Vitality > 5:
self.Vitality = self.Vitality + ((0.000001) / (self.Vitality ** 4))
elif self.Vitality > 2:
self.Vitality = self.Vitality + ((0.000001) / (self.Vitality ** 2))
else:
self.Vitality = self.Vitality + 0.000001
temp_past_life_vitality -= 0.00001
self.check_stats()
if len(str(past_life_data['Logs'])) > 1:
past_life_data['Logs'] = ""
with open(filepath, 'wb') as f:
pickle.dump(past_life_data, f)
except Exception as e:
spinner.fail(text=f"Past Lifes: {filepath} failed to load ({str(e)}. Deleting past life file.)")
os.remove(filepath)
continue
spinner.succeed(text=f"Past Lifes: Fully Loaded")
self.level = 1
def save_past_life(self):
past_lives_folder = "past_lives"
if not os.path.exists(past_lives_folder):
os.makedirs(past_lives_folder)
# Generate a UUID for the past life file
past_life_id = str(uuid.uuid4())
past_life_filename = os.path.join(past_lives_folder, f"{past_life_id}.pastlife")
self.Logs = []
# Save the current state as a past life
try:
with open(past_life_filename, 'wb') as f:
pickle.dump(self.__dict__, f)
print(f"Saved past life to {past_life_filename}")
except Exception as e:
print(f"Error saving past life: {e}")
# Remove the .dat file
try:
os.remove(f'{self.PlayerName}.dat')
except FileNotFoundError:
pass # Ignore if the file doesn't exist
def update_inv(self, item: WeaponType, add: bool):
if add:
self.Inv.append(item)
else:
self.Inv.remove(item)
def gain_dodgeodds_rate(self, points):
"""Increases dodge odds based on points, with increasing cost.
Every 1 dodge odds increase costs 2x more points.
"""
to_be_lowered_by = 2
current_rate = self.DodgeOdds
if current_rate > 1:
desired_increase = points / ((to_be_lowered_by * (current_rate // 2)) + 1)
else:
desired_increase = points
self.DodgeOdds = current_rate + desired_increase
def gain_crit_rate(self, points):
"""Increases crit rate based on points, with increasing cost.
Every 1 crit rate increase costs 1000x more points.
"""
to_be_lowered_by = 1000
current_rate = self.CritRate
if current_rate > 1:
desired_increase = points / ((to_be_lowered_by * (current_rate // 2)) + 1)
else:
desired_increase = points
self.CritRate = current_rate + desired_increase
def gain_crit_damage(self, points):
"""Increases crit damage based on points, with increasing cost.
Every 10 crit damage increase costs 100x more points.
"""
current_damage = self.CritDamageMod
to_be_lowered_by = 100
if current_damage > 10:
desired_increase = points / ((to_be_lowered_by * (current_damage // 10)) + 1)
else:
desired_increase = points
self.CritDamageMod += desired_increase
def check_base_stats(self, stat_total: int, stat_gain:int):
stats_to_start_lower = 50
to_be_lowered_by = 10 + (stat_total // 100000)
if stat_total > 1000000:
desired_increase = stat_gain / max(((to_be_lowered_by ** 10) * (stat_total // stats_to_start_lower)), 1)
elif stat_total > stats_to_start_lower:
desired_increase = stat_gain / max((to_be_lowered_by * (stat_total // stats_to_start_lower)), 1)
else:
desired_increase = stat_gain
for item in self.Items:
desired_increase = item.stat_gain(desired_increase)
return max(int(desired_increase), 5)
#themed_ajt = ["atrocious", "baneful", "barbaric", "beastly", "belligerent", "bloodthirsty", "brutal", "callous", "cannibalistic", "cowardly", "cruel", "cunning", "dangerous", "demonic", "depraved", "destructive", "diabolical", "disgusting", "dishonorable", "dreadful", "eerie", "evil", "execrable", "fiendish", "filthy", "foul", "frightening", "ghastly", "ghoulish", "gruesome", "heinous", "hideous", "homicidal", "horrible", "hostile", "inhumane", "insidious", "intimidating", "malevolent", "malicious", "monstrous", "murderous", "nasty", "nefarious", "noxious", "obscene", "odious", "ominous", "pernicious", "perverted", "poisonous", "predatory", "premeditated", "primal", "primitive", "profane", "psychopathic", "rabid", "relentless", "repulsive", "ruthless", "sadistic", "savage", "scary", "sinister", "sociopathic", "spiteful", "squalid", "terrifying", "threatening", "treacherous", "ugly", "unholy", "venomous", "vicious", "villainous", "violent", "wicked", "wrongful", "xenophobic"]
#themed_names = ["luna", "carly", "becca", "ally", "hilander", "chibi", "mimic", "mezzy", "graygray", "bubbles"]
def check_name_mod(self):
if themed_names[0] in self.PlayerName.lower():
dodge_buff = 0.015
max_hp_debuff = self.MHP / 8
while self.MHP > max_hp_debuff:
dodge_buff = dodge_buff + (0.0000007 * self.Vitality)
self.MHP = self.MHP - 1
self.Atk = int(self.Atk * 1)
self.Def = int(self.Def * 2)
self.gain_crit_rate(0.0001 * self.level)
self.DodgeOdds = (self.DodgeOdds + (dodge_buff * self.level)) * self.Vitality
if themed_names[1] in self.PlayerName.lower():
def_to_add = 100 * self.level
max_hp_debuff = max(self.MHP - random.randint(1000, 2000), 10)
max_crit_rate = self.CritRate / 100
max_atk_stat = self.Atk / 4
item_buff = random.uniform(0.0004, 0.0008)
while self.Vitality > 1.01:
item_buff += random.uniform(0.00002, 0.00003)
self.Vitality = self.Vitality - 0.01
if self.level > 3000:
while self.Def > 25000:
item_buff += random.uniform(0.00002, 0.00003)
self.Def = self.Def - 1000
for item in self.Items:
item.name = "Carly\'s Blessing of Defense"
item.power += self.level * item_buff
while self.MHP > max_hp_debuff:
self.Def += self.check_base_stats(self.Def, def_to_add)
self.MHP = self.MHP - 1
while self.CritRate > max_crit_rate:
self.Def += self.check_base_stats(self.Def, def_to_add)
self.CritRate -= self.CritRate / 15
while self.Atk > max_atk_stat:
self.Def += self.check_base_stats(self.Def, def_to_add)
self.Atk = self.Atk - 1
while self.Regain > 0.1:
self.Def += self.check_base_stats(self.Def, def_to_add)
self.Regain = self.Regain - 0.001
self.Atk = int(self.Atk) + 1
self.Def += self.check_base_stats(self.Def, int(self.Def * self.level) + 1)
self.gain_crit_damage((0.0002 * self.level))
if themed_names[2] in self.PlayerName.lower():
self.MHP = int(self.MHP * 15)
self.Atk = int(self.Atk * 8)
self.CritRate = self.CritRate / 1000
if themed_names[3] in self.PlayerName.lower():
self.Atk = int(self.Atk * 1.5)
self.Def = int(self.Def * 1.5)
self.CritDamageMod = self.CritDamageMod * ((0.005 * self.level) + 1)
self.DodgeOdds = self.DodgeOdds / 1000
if themed_names[4] in self.PlayerName.lower():
self.Atk = int(self.Atk * 1.5)
self.Def = int(self.Def * 0.5) + 1
self.gain_crit_rate(1)
self.CritDamageMod = self.CritDamageMod * ((0.035 * self.level) + 1)
if themed_names[5] in self.PlayerName.lower():
self.Vitality = self.Vitality + (0.0001 * self.level)
if themed_names[6] in self.PlayerName.lower():
tempname = self.PlayerName
self.load_mimic()
self.MHP = int(self.MHP / ((10000 / self.level) + 1))
self.Atk = int(self.Atk / 5)
self.Def = int(self.Def / 4)
self.Regain = self.Regain / 5
self.DodgeOdds = self.DodgeOdds / 4
self.Vitality -= self.Vitality / 4
if self.Vitality > 1:
self.Vitality = 1
self.PlayerName = tempname
self.set_photo("Player".lower())
if themed_names[7] in self.PlayerName.lower():
self.MHP = int(self.MHP * 150)
if themed_names[8] in self.PlayerName.lower():
self.Regain = self.Regain * (0.05 * self.level)
if themed_names[9] in self.PlayerName.lower():
for item in self.Items:
item.name = "Bubbles\'s Blessing of Damage, Defense, and Utility"
item.power += (self.level * 0.0003)
if themed_ajt[0] in self.PlayerName.lower(): # atrocious
self.MHP = int(self.MHP * 1.9)
self.Atk = int(self.Atk * 1.1)
if themed_ajt[1] in self.PlayerName.lower(): # baneful
self.Atk = int(self.Atk * 1.95)
self.CritDamageMod = self.CritDamageMod * 1.05
if themed_ajt[2] in self.PlayerName.lower(): # barbaric
self.MHP = int(self.MHP * 1.1)
self.Def = int(self.Def * 1.9)
if themed_ajt[3] in self.PlayerName.lower(): # beastly
self.MHP = int(self.MHP * 1.05)
self.Atk = int(self.Atk * 1.05)
if themed_ajt[4] in self.PlayerName.lower(): # belligerent
self.DodgeOdds = self.DodgeOdds * 1.9
self.Atk = int(self.Atk * 1.1)
if themed_ajt[5] in self.PlayerName.lower(): # bloodthirsty
self.MHP = int(self.MHP - (self.MHP * 0.1))
self.Atk = int(self.Atk + (self.Atk * 0.2))
if themed_ajt[6] in self.PlayerName.lower(): # brutal
self.CritRate = self.CritRate + 0.1
self.DodgeOdds = self.DodgeOdds * 1.9
if themed_ajt[7] in self.PlayerName.lower(): # callous
self.Def = int(self.Def * 1.1)
self.DodgeOdds = self.DodgeOdds * 1.9
if themed_ajt[8] in self.PlayerName.lower(): # cannibalistic
self.MHP = int(self.MHP + (self.MHP * 0.05))
if themed_ajt[9] in self.PlayerName.lower(): # cowardly
self.MHP = int(self.MHP * 1.2)
self.Atk = int(self.Atk * 0.8)
if themed_ajt[10] in self.PlayerName.lower(): # cruel
self.CritDamageMod = self.CritDamageMod * 1.05
if themed_ajt[11] in self.PlayerName.lower(): # cunning
self.DodgeOdds = self.DodgeOdds * 1.1
if themed_ajt[12] in self.PlayerName.lower(): # dangerous
self.Atk = int(self.Atk * 1.05)
self.CritRate = self.CritRate + 0.05
if themed_ajt[13] in self.PlayerName.lower(): # demonic
self.MHP = int(self.MHP * 1.9)
self.Atk = int(self.Atk * 1.15)
if themed_ajt[14] in self.PlayerName.lower(): # depraved
self.Def = int(self.Def - (self.Def * 0.1))
self.Atk = int(self.Atk + (self.Atk * 0.1))
if themed_ajt[15] in self.PlayerName.lower(): # destructive
self.Atk = int(self.Atk * 1.1)
self.CritRate = self.CritRate + 0.05
if themed_ajt[16] in self.PlayerName.lower(): # diabolical
self.Atk = int(self.Atk * 1.1)
self.DodgeOdds = self.DodgeOdds * 1.9
if themed_ajt[17] in self.PlayerName.lower(): # disgusting
self.Def = int(self.Def * 1.9)
if themed_ajt[18] in self.PlayerName.lower(): # dishonorable
self.Atk = int(self.Atk * 1.05)
self.Def = int(self.Def * 1.95)
if themed_ajt[19] in self.PlayerName.lower(): # dreadful
self.Atk = int(self.Atk * 1.05)
if themed_ajt[20] in self.PlayerName.lower(): # eerie
self.DodgeOdds = self.DodgeOdds * 1.05
if themed_ajt[21] in self.PlayerName.lower(): # evil
self.MHP = int(self.MHP * 1.95)
self.Atk = int(self.Atk * 1.05)
if themed_ajt[22] in self.PlayerName.lower(): # execrable
self.MHP = int(self.MHP * 1.9)
if themed_ajt[23] in self.PlayerName.lower(): # fiendish
self.DodgeOdds = self.DodgeOdds * 1.9
self.CritRate = self.CritRate + 0.1
if themed_ajt[24] in self.PlayerName.lower(): # filthy
self.Def = int(self.Def * 1.95)
if themed_ajt[25] in self.PlayerName.lower(): # foul
self.Def = int(self.Def * 1.95)
self.DodgeOdds = self.DodgeOdds * 1.95
if themed_ajt[26] in self.PlayerName.lower(): # frightening
self.Atk = int(self.Atk * 1.05)
self.DodgeOdds = self.DodgeOdds * 1.95
if themed_ajt[27] in self.PlayerName.lower(): # ghastly
self.MHP = int(self.MHP * 1.95)
self.DodgeOdds = self.DodgeOdds * 1.05
if themed_ajt[28] in self.PlayerName.lower(): # ghoulish
self.MHP = int(self.MHP * 1.95)
self.Atk = int(self.Atk * 1.05)
if themed_ajt[29] in self.PlayerName.lower(): # gruesome
self.Atk = int(self.Atk * 1.05)
self.CritDamageMod = self.CritDamageMod * 1.05
if themed_ajt[30] in self.PlayerName.lower(): # heinous
self.Atk = int(self.Atk * 1.1)
self.CritDamageMod = self.CritDamageMod * 1.1
if themed_ajt[31] in self.PlayerName.lower(): # hideous
self.Def = int(self.Def * 1.9)
self.MHP = int(self.MHP * 1.1)
if themed_ajt[32] in self.PlayerName.lower(): # homicidal
self.Atk = int(self.Atk * 1.15)
if themed_ajt[33] in self.PlayerName.lower(): # horrible
self.Atk = int(self.Atk * 1.02)
self.CritRate = self.CritRate + 0.02
if themed_ajt[34] in self.PlayerName.lower(): # hostile
self.Atk = int(self.Atk * 1.05)
self.Def = int(self.Def * 1.95)
if themed_ajt[35] in self.PlayerName.lower(): # inhumane
self.CritDamageMod = self.CritDamageMod * 1.1
if themed_ajt[36] in self.PlayerName.lower(): # insidious
self.Atk = int(self.Atk * 1.05)
self.DodgeOdds = self.DodgeOdds * 1.05
if themed_ajt[37] in self.PlayerName.lower(): # intimidating
self.Atk = int(self.Atk * 1.95)
self.Def = int(self.Def * 1.05)
if themed_ajt[38] in self.PlayerName.lower(): # malevolent
self.CritDamageMod = self.CritDamageMod * 1.05
self.DodgeOdds = self.DodgeOdds * 1.95
if themed_ajt[39] in self.PlayerName.lower(): # malicious
self.Atk = int(self.Atk * 1.07)
if themed_ajt[40] in self.PlayerName.lower(): # monstrous
self.MHP = int(self.MHP * 1.1)
self.Atk = int(self.Atk * 1.1)
if themed_ajt[41] in self.PlayerName.lower(): # murderous
self.CritRate = self.CritRate + 0.15
if themed_ajt[42] in self.PlayerName.lower(): # nasty
self.Atk = int(self.Atk * 1.05)
self.Def = int(self.Def * 1.95)
self.DodgeOdds = self.DodgeOdds * 1.95
if themed_ajt[43] in self.PlayerName.lower(): # nefarious
self.CritRate = self.CritRate + 0.05
self.CritDamageMod = self.CritDamageMod * 1.05
if themed_ajt[44] in self.PlayerName.lower(): # noxious
self.Atk = int(self.Atk * 1.05)
self.MHP = int(self.MHP * 1.95)
if themed_ajt[45] in self.PlayerName.lower(): # obscene
self.Def = int(self.Def * 1.9)
self.DodgeOdds = self.DodgeOdds * 1.9
if themed_ajt[46] in self.PlayerName.lower(): # odious
self.Def = int(self.Def * 1.95)
if themed_ajt[47] in self.PlayerName.lower(): # ominous
self.CritRate = self.CritRate + 0.02
self.CritDamageMod = self.CritDamageMod * 1.03
if themed_ajt[48] in self.PlayerName.lower(): # pernicious
self.MHP = int(self.MHP * 1.95)
self.CritRate = self.CritRate + 0.05
if themed_ajt[49] in self.PlayerName.lower(): # perverted
self.Def = int(self.Def * 1.9)
self.DodgeOdds = self.DodgeOdds * 1.1
if themed_ajt[50] in self.PlayerName.lower(): # poisonous
self.Atk = int(self.Atk * 1.07)
self.MHP = int(self.MHP * 1.93)
if themed_ajt[51] in self.PlayerName.lower(): # predatory
self.DodgeOdds = self.DodgeOdds * 1.1
self.CritRate = self.CritRate + 0.05
if themed_ajt[52] in self.PlayerName.lower(): # premeditated
self.CritRate = self.CritRate + 0.1
if themed_ajt[53] in self.PlayerName.lower(): # primal
self.Atk = int(self.Atk * 1.05)
self.Def = int(self.Def * 1.95)
self.MHP = int(self.MHP * 1.05)
if themed_ajt[54] in self.PlayerName.lower(): # primitive
self.Atk = int(self.Atk * 1.05)
self.Def = int(self.Def * 1.95)
if themed_ajt[55] in self.PlayerName.lower(): # profane
self.MHP = int(self.MHP * 1.9)
self.CritDamageMod = self.CritDamageMod * 1.1
if themed_ajt[56] in self.PlayerName.lower(): # psychopathic
self.DodgeOdds = self.DodgeOdds * 1.9
self.Atk = int(self.Atk * 1.1)
self.CritDamageMod = self.CritDamageMod * 1.1
if themed_ajt[57] in self.PlayerName.lower(): # rabid
self.Atk = int(self.Atk * 1.1)
self.Def = int(self.Def * 1.9)
if themed_ajt[58] in self.PlayerName.lower(): # relentless
self.DodgeOdds = self.DodgeOdds * 1.9
self.Atk = int(self.Atk * 1.05)
self.CritRate = self.CritRate + 0.05
if themed_ajt[59] in self.PlayerName.lower(): # repulsive
self.Def = int(self.Def * 1.9)
self.DodgeOdds = self.DodgeOdds * 1.1
if themed_ajt[60] in self.PlayerName.lower(): # ruthless
self.CritDamageMod = self.CritDamageMod * 1.15
if themed_ajt[61] in self.PlayerName.lower(): # sadistic
self.Atk = int(self.Atk * 1.02)
self.CritDamageMod = self.CritDamageMod * 1.08
if themed_ajt[62] in self.PlayerName.lower(): # savage
self.Atk = int(self.Atk * 1.1)
self.Def = int(self.Def * 1.9)
self.MHP = int(self.MHP * 1.1)
if themed_ajt[63] in self.PlayerName.lower(): # scary
self.Atk = int(self.Atk * 1.95)
self.DodgeOdds = self.DodgeOdds * 1.05
self.CritDamageMod = self.CritDamageMod * 1.05
if themed_ajt[64] in self.PlayerName.lower(): # sinister
self.DodgeOdds = self.DodgeOdds * 1.05
self.CritDamageMod = self.CritDamageMod * 1.05
if themed_ajt[65] in self.PlayerName.lower(): # sociopathic
self.DodgeOdds = self.DodgeOdds * 1.9
self.Atk = int(self.Atk * 1.15)
if themed_ajt[66] in self.PlayerName.lower(): # spiteful
self.Atk = int(self.Atk * 1.07)
self.MHP = int(self.MHP * 1.93)
if themed_ajt[67] in self.PlayerName.lower(): # squalid
self.Def = int(self.Def * 1.95)
self.MHP = int(self.MHP * 1.05)
if themed_ajt[68] in self.PlayerName.lower(): # terrifying
self.Atk = int(self.Atk * 1.9)
self.Def = int(self.Def * 1.1)
if themed_ajt[69] in self.PlayerName.lower(): # threatening
self.Atk = int(self.Atk * 1.05)
self.Def = int(self.Def * 1.95)
self.DodgeOdds = self.DodgeOdds * 1.95
if themed_ajt[70] in self.PlayerName.lower(): # treacherous
self.Atk = int(self.Atk * 1.05)
self.DodgeOdds = self.DodgeOdds * 1.05
self.CritRate = self.CritRate + 0.05
if themed_ajt[71] in self.PlayerName.lower(): # ugly
self.Def = int(self.Def * 1.1)
self.MHP = int(self.MHP * 1.9)
if themed_ajt[72] in self.PlayerName.lower(): # unholy
self.MHP = int(self.MHP * 5)
self.Atk = int(self.Atk * 2)
self.CritDamageMod = self.CritDamageMod * 0.8
if themed_ajt[73] in self.PlayerName.lower(): # venomous
self.Atk = int(self.Atk * 1.1)
self.MHP = int(self.MHP * 1.9)
if themed_ajt[74] in self.PlayerName.lower(): # vicious
self.Atk = int(self.Atk * 1.1)
self.CritRate = self.CritRate + 0.05
if themed_ajt[75] in self.PlayerName.lower(): # villainous
self.Atk = int(self.Atk * 1.05)
self.DodgeOdds = self.DodgeOdds * 1.95
self.CritRate = self.CritRate + 0.05
if themed_ajt[76] in self.PlayerName.lower(): # violent
self.Atk = int(self.Atk * 1.15)
self.Def = int(self.Def * 0.85)
if themed_ajt[77] in self.PlayerName.lower(): # wicked
self.Atk = int(self.Atk * 1.08)
self.CritDamageMod = self.CritDamageMod * 1.02
if themed_ajt[78] in self.PlayerName.lower(): # wrongful
self.Atk = int(self.Atk * 1.05)
self.Def = int(self.Def * 1.95)
self.CritDamageMod = self.CritDamageMod * 1.05
if themed_ajt[79] in self.PlayerName.lower(): # xenophobic
self.Def = int(self.Def * 1.1)
def check_stats(self):
max_dodgeodds = 5000
max_crit_rate = 15
def_up = 0
if self.DodgeOdds > (max_dodgeodds + 0.01):
mod_number_dodge = (self.DodgeOdds - (max_dodgeodds - 0.01))
def_up = def_up + int(mod_number_dodge)
self.gain_crit_rate(0.0001 * mod_number_dodge)
self.DodgeOdds = max_dodgeodds
if self.DodgeOdds > max_dodgeodds:
self.DodgeOdds = max_dodgeodds
if self.CritRate > (max_crit_rate + 0.01):
mod_number_crit = (self.CritRate - (max_crit_rate - 0.01))
def_up = def_up + int(mod_number_crit)
self.gain_crit_damage(0.001 * mod_number_crit)
self.CritRate = max_crit_rate
if self.CritRate > max_crit_rate:
self.CritRate = max_crit_rate
if def_up > 1:
def_up = self.check_base_stats(self.Def, def_up)
self.Def = self.Def + def_up
if self.Def < 5:
self.Def = 5
if self.Vitality < 0.001:
print("Warning Vitality is way too low... fixing...")
self.Vitality = 1
### Checking for hackers
if self.level > 500:
if self.Vitality == 1:
print("Hacking games is wrong, and you should not do that ;)")
os.remove(f'{self.PlayerName}.dat')
exit(404)
if self.MHP > 20000000000:
self.MHP = 1
def level_up(self, mod=1):
"""
Levels up the player by 1 and allows the user to choose which stat to increase.
"""
from gamestates import display_stats_menu
self.level += 1
mod_fixed = ((mod * 0.35) + 1) * self.Vitality * (self.level / 1000)
int_mod = max(int(mod_fixed * (self.level / 100)), 1)
hp_up: int = random.randint(400 * self.level, 550 * self.level * int_mod)
def_up: int = random.randint(5 * self.level, 200 * self.level * int_mod)
atk_up: int = random.randint(15 * self.level, 350 * self.level * int_mod)
regain_up: float = random.uniform(0.0001 * self.level, 0.0005 * self.level) * max((mod_fixed / 10000), 1)
critrate_up: float = random.uniform(0.001 * self.level, 0.0025 * self.level) * max((mod_fixed / 10000), 1)
critdamage_up: float = random.uniform(0.004 * self.level, 0.008 * self.level) * max((mod_fixed / 10000), 1)
dodgeodds_up: float = random.uniform(0.000002 * self.level, 0.00004 * self.level) * max((mod_fixed / 10000), 1)
vitality_up: float = (random.uniform(0.00000016 * self.level, 0.00000032 * self.level) / self.Vitality) * max((mod_fixed / 1000000), 1)
hp_up = self.check_base_stats(self.MHP, hp_up)
def_up = self.check_base_stats(self.Def, def_up)
atk_up = self.check_base_stats(self.Atk, atk_up)
# Autopick logic
if os.path.exists("auto.pick"):
choice = 9
else:
choice = display_stats_menu(f"{hp_up:.2f}", f"{def_up:.2f}", f"{atk_up:.2f}", f"{regain_up * 100:.2f}", f"{critrate_up * 100:.2f}%", f"{critdamage_up * 100:.2f}%", f"{dodgeodds_up * 100:.2f}%", self.DamageTaken, self.DamageDealt, self.Items)
if choice == 1:
self.MHP += int(hp_up)
self.HP += int(hp_up)
elif choice == 2:
self.Def += int(def_up)
elif choice == 3:
self.Atk += int(atk_up)
elif choice == 4:
self.Regain += regain_up
elif choice == 5:
self.gain_crit_rate(critrate_up)
elif choice == 6:
self.gain_crit_damage(critdamage_up)
elif choice == 7:
self.gain_dodgeodds_rate(dodgeodds_up)
elif choice == 8:
if len(self.Items) < starting_max_blessing:
self.Items.append(ItemType())
else:
random.choice(self.Items).upgrade(mod_fixed * 25)
elif choice == 9:
if self.level > 500:
self.MHP += int(hp_up)
self.HP += int(hp_up)
self.Def += int(def_up)
self.Atk += int(atk_up)
self.Regain += regain_up
self.gain_crit_rate(critrate_up)
self.gain_crit_damage(critdamage_up)
self.gain_dodgeodds_rate(dodgeodds_up)
if len(self.Items) < starting_max_blessing:
self.Items.append(ItemType())
else:
for item in self.Items:
item.upgrade(mod_fixed)
else:
self.MHP += int(hp_up / 2)
self.HP += int(hp_up / 2)
self.Def += int(def_up / 2)
self.Atk += int(atk_up / 2)
self.Regain += regain_up / 2
self.gain_crit_rate(critrate_up)
self.gain_crit_damage(critdamage_up)
self.gain_dodgeodds_rate(dodgeodds_up)
if len(self.Items) < starting_max_blessing:
self.Items.append(ItemType())
else:
for item in self.Items:
item.upgrade(mod_fixed)
if self.level > 500:
self.Vitality += vitality_up
self.check_stats()
print(f"Name: {self.PlayerName}")
print(f"Level: {self.level}")
print(f"MHP: {self.MHP}")
print(f"HP: {self.HP}")
print(f"Defense: {self.Def}")
print(f"Attack: {self.Atk}")
print(f"Regain: {self.Regain}")
print(f"Vitality: {self.Vitality}")
print(f"Crit Rate: {self.CritRate}")
print(f"Crit Damage Modifier: {self.CritDamageMod}")
print(f"Dodge Odds: {self.DodgeOdds}")
for item in self.Items:
print(f"Name: {item.name}, Power: {item.power:.2f}")
def set_level(self, level):
top_level = 10000
top_level_full = 5000
self.level = level
self.MHP: int = random.randint(10 * self.level, 15 * self.level) + 1000
self.HP: int = self.MHP
self.Def: int = self.Def + int(self.MHP * (0.0005 * self.level)) + 500
self.Atk: int = random.randint(10 * self.level, 20 * self.level) + (self.level * 2)
self.Regain: float = random.uniform(0.0001 * self.level, (self.level * 0.002)) + (self.level * 0.004)
self.CritRate: float = random.uniform(0.0001 * self.level, (self.level * 0.0002)) + (self.level * 0.0001)
self.CritDamageMod: float = 2 + (self.level * 0.00025)
self.DodgeOdds: float = 0.03 + (self.level * 0.0001)
self.Vitality: float = 1 + (self.level * 0.00002)
if level > 50:
self.MHP = self.MHP + (2 * level)
self.Atk = self.Atk + (20 * level)
# Apply bonus every xyz levels past 10
xyz = 10
bonus_levels = (level - 50) // xyz
self.MHP = self.MHP + (50 * bonus_levels)
self.Atk = self.Atk + (2 * bonus_levels)
self.Def = self.Def + (4 * bonus_levels)
self.CritRate = self.CritRate + (0.00001 * (bonus_levels * level))
for i in range(int((level - 50) // 50) + 1):
if len(self.Items) > starting_max_blessing:
random.choice(self.Items).upgrade((level / (bonus_levels * 200)))
else:
self.Items.append(ItemType())
self.check_stats()
self.check_name_mod()
pre_temp_vit = self.Vitality
post_temp_vit = (self.Vitality * (level / (top_level)))
self.Vitality = max(post_temp_vit, 0.75)
self.MHP = int(self.MHP * min((level / top_level), (4)) * post_temp_vit) + 5
self.Atk = int(self.Atk * min((level / top_level), (0.5)) * post_temp_vit) + 5
self.Def = int(self.Def * min((level / top_level_full), (2)) * post_temp_vit) + 5
self.gain_crit_rate(0.0002 * (level / top_level_full))
self.DodgeOdds = self.DodgeOdds * (level / (top_level_full * 2))
self.check_stats()
self.HP = self.MHP
print(f"Name: {self.PlayerName}")
print(f"Level: {self.level}")
print(f"MHP: {self.MHP}")
print(f"HP: {self.HP}")
print(f"Defense: {self.Def}")
print(f"Attack: {self.Atk}")
print(f"Regain: {self.Regain}")
print(f"Raw Vitality: {pre_temp_vit}")
print(f"Moded Vitality: {post_temp_vit}")
print(f"True Vitality: {self.Vitality}")
print(f"Crit Rate: {self.CritRate}")
print(f"Crit Damage Modifier: {self.CritDamageMod}")
print(f"Dodge Odds: {self.DodgeOdds}")
for item in self.Items:
print(f"Name: {item.name}, Power: {item.power:.2f}")