-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChallange 1.py
More file actions
143 lines (122 loc) · 4.96 KB
/
Challange 1.py
File metadata and controls
143 lines (122 loc) · 4.96 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
135
136
137
138
139
140
141
142
import math
import time
import random
#Had no idea what to do with % that is practical so here is an even odd use.
x=3
if x % 2 == 0:
print('X is even')
else:
print('X is not even')
# Key - Weapon = Wep, DmgRng = Weapon Damage Range,
# Crit = Critical Damage Multiplier,Adv = Adventurer,
# HPMax = Maximum Hitpoints, HPCur = Current Hitpoints,
# Occ = Occupation, M = Monster,
class Wep:
def __init__ (self, Wep, DmgRng, RandomDmg, Crit):
self.Wep = Wep
self.DmgRng = DmgRng
self.RandomDmg = float(RandomDmg)
self.Crit = float(Crit)
class Adv(Wep):
def __init__(self, Name, Level, HPMax, HPCur, Occ):
self.Name = Name
self.Level = int(Level)
self.HPMax = float(HPMax)
self.HPCur = float(HPCur)
self.Occ = Occ
class Potion():
def __init__ (self, heal, no):
self.heal = heal
self.no = no
class Monster:
def __init__ (monster, Type, MHPMax, MHPCur, MDmgRng, MRandomDmg):
monster.Type = Type
monster.MHPMax = float(MHPMax)
monster.MHPCur = float(MHPCur)
monster.MDmgRng = MDmgRng
monster.MRandomDmg = float(MRandomDmg)
#Includes for loop with Print
Potential_Adventurer_Names = ['Bob', 'Tim', 'Larry', 'Harry', 'Laura', 'Kassy']
print('Potential names for your Adventurer!')
for Names in Potential_Adventurer_Names:
print (Names)
#Print of Intiger, String and Float
time.sleep(0.5)
Adv1 = Adv(input('\nPlease type your Name here adventurer!'), 5, 20, 20, 'Warrior')
Adv1_Potion = Potion((0.5*Adv1.HPMax), 1)
Adv1_Wep = Wep('Greataxe', '1-12', 0, 3)
Goblin = Monster('Goblin', 20, 20, '1-10', 0)
time.sleep(0.5)
print('\nYour name is', Adv1.Name, ', here are your stats!')
time.sleep(0.5)
print('\n\nName: ', Adv1.Name)
print('Level: ', Adv1.Level)
print('Maximum Hitpoints: ', Adv1.HPMax)
print('Current Hitpoints: ', Adv1.HPCur)
print('Occupation: ', Adv1.Occ)
print ('\nEquiped Weapon: ', Adv1_Wep.Wep)
print ('Damage: ', Adv1_Wep.DmgRng)
time.sleep(0.5)
print('\n\n\nWarning! Potential monsters in the area!!!.')
time.sleep(0.5)
All_Monsters = ('Goblin', 'Ork', 'Bugbear', 'Giant Spider', 'Manicore')
for Monster in All_Monsters:
print(Monster)
time.sleep(0.5)
print('\nYou have been tasked to kill a goblin that is in the area, currently it stands before you.')
time.sleep(0.5)
print ('\nIt\'s claws are sharp and drool drips though sharp teeth as it sizes you up!!!')
time.sleep(0.5)
print ('\nYour choices are:')
print ('Attack, to swing your mightly axe at the monster!')
print ('Drink Potion, to consume a health tonic to replenish your lost HP.')
print ('Flee, to run from the battle and fail your mission!')
def start():
Adv1_Wep.RandomDmg = random.uniform(1,12)
Goblin.MRandomDmg = random.uniform(1,10)
battle = input('\nWhat will you do now?')
if battle == 'Attack':
Goblin.MHPCur = Goblin.MHPCur-Adv1_Wep.RandomDmg
print ('\nYou hack the goblin dealing', round(Adv1_Wep.RandomDmg,2), ' damage. Goblin is now at ', round(Goblin.MHPCur,2), ' HP\'s')
if Goblin.MHPCur > 0:
Adv1.HPCur = Adv1.HPCur-Goblin.MRandomDmg
print ('\nScreeching at your attack the Goblin swipes it\'s claws at you dealing ', round(Goblin.MRandomDmg,2), ' HP\'s of damage. Your current HP\'s are at ', round(Adv1.HPCur,2), '!')
if Adv1.HPCur > 0:
start()
elif Adv1.HPCur <= 0:
print ('You have died...')
quit()
elif Goblin.MHPCur <= 0:
print ('You have slain the goblin! YOU WIN!!!')
quit()
if battle == 'Drink Potion':
if Adv1_Potion.no == 1:
Adv1.HPCur = Adv1.HPCur + Adv1_Potion.heal
Adv1_Potion.no = Adv1_Potion.no - 1
print ('\nYou drink a potion replenishing 50% of your maxumim HP. Your HP is now ', round(Adv1.HPCur,2),'!')
Adv1.HPCur = Adv1.HPCur-(Goblin.MRandomDmg/2)
print ('Taking advantage of you, the goblin goes for a bite! It deals ', round((Goblin.MRandomDmg/2),2),' damage. Your HP is now ', round(Adv1.HPCur,2), '!')
Adv1_Wep.RandomDmg
Goblin.MRandomDmg
start()
elif Adv1_Potion.no == 0:
Adv1.HPCur = Adv1.HPCur-(Goblin.MRandomDmg/2)
print('You have no potions to drink, seeing you distracted looking for a potion the goblin takes an opertunistic swipe.')
print ('You take', round((Goblin.MRandomDmg/2),2), ' damage, you have' ,round(Adv1.HPCur,2), ' HP\'s left!')
if Adv1.HPCur <= 0:
print ('You have died...')
quit()
start()
elif battle == 'Flee':
print('\nYou run screaming from the battle, you have failed the mission...')
quit()
else:
print ('\nPlease enter, Attack, Drink Potion or Flee!')
start()
def reset():
Reset = input('\nTry again? Yes or No')
if Reset == 'Yes':
start()
if Reset == 'No':
quit()
start()