-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombat.py
More file actions
134 lines (124 loc) · 5.61 KB
/
combat.py
File metadata and controls
134 lines (124 loc) · 5.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import keyboard as k
import mods
from random import choice as ch, randint as r
from mods import update, clear, statBar as bar
from entities import entity
import time as t
def battle(name,mob):
k.press_and_release('backspace')
if mob == 'Zombie':
xpset = r(5,12)
if mob == 'Witch':
xpset = r(10,16)
if mob == 'Berserker':
xpset = r(14,18)
plr = entity(name)
mob = entity(mob)
mobMaxHp = mob.hpcap
maxPlrHp = plr.hpcap
xp = plr.xp
res = True
import random
lm = ''
while True:
clear()
if plr.hp < 0:
plr.hp = 0
if mob.hp < 0:
mob.hp = 0
print(f"{plr.n} > ",bar(plr.hp,plr.hpcap,10),plr.hp,"|",mob.hp,'['+bar(mob.hp,mob.hpcap,10)[1:-1][::-1]+']',f" < {mob.n}")
print()
pcrit = False
mcrit = False
cr = list(range(1,101))
cRez = []
for i in range(plr.crit):
x = ch(cr)
cRez.append(x)
cr.remove(x)
for i in cRez:
if i in range(1,plr.crit + 1):
pcrit = True
for i in range(mob.crit):
x = ch(cr)
cRez.append(x)
cr.remove(x)
for i in cRez:
if i in range(1,mob.crit + 1):
mcrit = True
if pcrit == False:
pcrit = 1
elif pcrit == True:
pcrit = 2
if mcrit == False:
mcrit = 1
elif mcrit == True:
mcrit = 2
m = r(1, 3)
dmg = r(5,20) / 100
temp = r(1,5) / 100
d = {1:'Hammer Strike',2:'Precision Thrust',3:'Barrier'}
print(lm)
print()
if plr.hp <= 0:
print("You died :/ Bot")
t.sleep(2)
clear()
print('[!] GAME OVER T_T')
t.sleep(5)
res = False
break
elif mob.hp <= 0:
print("Victory! :)")
xp += xpset
t.sleep(2)
res = True
break
try:
i = eval(input(f"1) {d[1]}\n2) {d[2]}\n3) {d[3]}\nAction [1/2/3]: "))
if str(type(i)) == "<class 'int'>":
i = int(i)
if i == 1 and m == 3:
lm = f"{mob.n} casted a Barrier and reflected the damage to you...You took {int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit} DMG!"
plr.hp -= int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit
elif i == 1 and m == 2:
lm = f"Your strike smashed through {mob.n}'s attack...You dealt {int(round((dmg * plr.atk)-(dmg * plr.atk)*(mob.d/100),0)) * pcrit} DMG!"
mob.hp -= int(round((dmg * plr.atk)-(dmg * plr.atk)*(mob.d/100),0)) * pcrit
elif i == 2 and m == 1:
lm = f"{mob.n} sent you flying...You took {int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit} DMG!"
plr.hp -= int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit
elif i == 2 and m == 3:
lm = f"You shattered {mob.n}'s Barrier... dealing {int(round((dmg * plr.atk)-(dmg * plr.atk)*(mob.d/100),0)) * mcrit} DMG!"
mob.hp -= int(round((dmg * plr.atk)-(dmg * plr.atk)*(mob.d/100),0)) * mcrit
elif i == 3 and m == 1:
lm = f"You casted a powerful Barrier and reflected {mob.n}'s attack... returned {int(round((dmg * plr.atk)-(dmg * plr.atk)*(mob.d/100),0)) * mcrit} DMG!"
mob.hp -= int(round((dmg * plr.atk)-(dmg * plr.atk)*(mob.d/100),0)) * mcrit
elif i == 3 and m == 2:
lm = f"{mob.n} shattered your Barrier... You took {int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit} DMG!"
plr.hp -= int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit
elif i == m == 1:
lm = f"You and {mob.n} sent each other flying... you took {int(round((temp * mob.atk)-(temp * mob.atk)*(plr.d/100),0)) * mcrit} DMG while {mob.n} took {int(round((temp * plr.atk)-(temp * plr.atk)*(mob.d/100),0)) * mcrit}"
mob.hp -= int(round((temp * plr.atk)-(temp * plr.atk)*(mob.d/100),0)) * mcrit
plr.hp -= int(round((temp * mob.atk)-(temp * mob.atk)*(plr.d/100),0)) * mcrit
elif i == m == 2:
lm = f"You and {mob.n} stabbed each other... taking {int(round((temp * mob.atk)-(temp * mob.atk)*(plr.d/100),0)) * mcrit} DMG and dealing {int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit} DMG!"
mob.hp -= int(round((dmg * mob.atk)-(dmg * mob.atk)*(plr.d/100),0)) * mcrit
plr.hp -= int(round((temp * mob.atk)-(temp * mob.atk)*(plr.d/100),0)) * mcrit
elif i == m == 3:
h = random.randint(1,5)
lm = f"You and {mob.n} created Barriers and just stood there... healing {h} HP!"
plr.hp += h
if plr.hp > maxPlrHp:
plr.hp = maxPlrHp
else:
lm = "[!] Choose an option from the move list!"
print()
else:
lm = "[!] Enter a valid input!"
print()
except (NameError,SyntaxError):
lm = '[!] Enter a valid input!'
update(plr.n, plr.lvl,plr.hp,plr.hpcap,xp,plr.xpcap,plr.atk,plr.d,plr.crit)
mods.levelUp(name)
clear()
return res