-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
74 lines (63 loc) · 2.07 KB
/
main.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
import core.charerterinfo as chinfo
from core.standardcommands import clear, pause, title
import random, sys, time
title('RPG Adventure')
def main():
name = str(input('What is thy name: '))
hero = chinfo.Hero(name, 10, random.randint(1,10), random.randint(1,10), 0)
clear()
cool_print(f'Long ago in a land far away a young adventure named {name} set out an adventure.')
monster1 = chinfo.Character('Ogre', 10, random.randint(1,10), random.randint(1,10))
cool_print(f'Suddenly an Ogre appreared to fight {name}. What will he do')
fightloop = True
monster1_defenfing = False
hero_defending = False
hero
while fightloop is True:
title(f'RPG Adventure: HP {hero.hp}/{hero.maxhp}')
choice = int(input('1. Attack\n2. Defend\n3. Magic\n4. Heal\n'))
if choice == 1:
hero.attack_other(monster1)
elif choice == 2:
hero.add_defend()
hero_defending = True
elif choice == 3:
hero.magic(monster1)
elif choice == 4:
hero.heal()
else:
print(f'{hero.name} wasted a turn\n')
if monster1_defenfing is True:
monster1.remove_defend()
if monster1.hp <= 0:
fightloop = False
print(f'{monster1.name} has died congrats...\n')
hero.getxp()
print(f'You win...\n')
pause()
exit(0)
monster_choice = random.randint(1,4)
if monster_choice == 1:
monster1.attack_other(hero)
elif monster_choice == 2:
monster1.add_defend()
monster1_defenfing = True
elif monster_choice == 3:
monster1.magic(hero)
elif monster_choice == 4:
monster1.heal
if hero_defending is True:
hero.remove_defend()
if hero.hp <= 0:
fightloop = False
print(f'{monster1.name} had killed {hero.name}\n')
print(f'You lose...\n')
pause()
exit(0)
def cool_print(str):
for char in str:
sys.stdout.write(char)
sys.stdout.flush()
time.sleep(0.05) # Or whatever delay you'd like
print('\n') # One last print to make sure that you move to a new line
main()