-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrpg.py
More file actions
120 lines (100 loc) · 3.26 KB
/
rpg.py
File metadata and controls
120 lines (100 loc) · 3.26 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
import time
import random
story = True
test = True
item = "nothing"
y = 0
class Item:
index = 0
class Weapon(Item):
def __init__(self, name, damage):
self.name = name
self.damage = damage
class Restorative(Item):
def __init__(self, name, hp):
self.name = name
self.hp = hp
BBoom = Weapon("Bladed Boomerang", 40)
PP = Restorative("Pink Potion", 10)
equipped = BBoom
# current inventory (item : quantity)
inventory = {
BBoom : 1,
PP : 3
}
# prints out inventory and quantities
def checkPack():
for i in inventory:
quantity = inventory[i]
print(i.name + " x" + str(quantity))
# dictionary of all monsters (name : health)
monsterDict = {
"Gelaton": 200
}
def battleInit(monster):
monsterHealth = monsterDict[monster]
num = 0
while monsterHealth > 0:
time.sleep(1)
print("What will you do now?")
action = input()
if action == "attack" or action == "hit" or action == "strike":
print("You swung at the " + monster + "!")
time.sleep(1)
chance = random.randint(1, 6)
damage = random.randint(45, 49)
if chance == 5:
for m in "A Critical Hit!":
print(" " * num + m)
num = num + 1
time.sleep(.5)
damage = damage * 2
print("You struck the " + monster + " for " + str(damage) + " damage!")
monsterHealth = monsterHealth - damage
if(monsterHealth > 0):
print("The " + monster + " has " + str(monsterHealth) + " health left!")
else:
break
else:
print("You struck the " + monster + " for " + str(damage) + " damage!")
monsterHealth = monsterHealth - damage
if(monsterHealth > 0):
print("The " + monster + " has " + str(monsterHealth) + " health left!")
else:
break
elif item == "crumpled up piece of paper." and action == "read paper" or item == "crumpled up piece of paper." and action == "read":
print("You unfold and read the piece of paper. It's a badly drawn picture of a banana. I don't know what it means either.")
elif action == "die":
monsterHealth = monsterHealth - 50000
else:
print("That won't work...")
if story == True:
time.sleep(.5)
print("The " + monster + "'s health goes below 0...")
time.sleep(.5)
print("But the " + monster + " didn't die?")
else:
time.sleep(.5)
print("The " + monster + " is slain!!")
time.sleep(.5)
print("You collected 'gold' and 'exp'.")
#/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/#
#------BEGINNING OF STORY-------#
time.sleep(1)
print("A gelatinous monster seeps out of nowhere!")
time.sleep(.5)
print("Approach the monster? Y/N")
answer = input()
if answer == 'Y' or answer == 'y':
print("You look into your backpack...")
checkPack()
battleInit("Gelaton")
print("Well", end = "")
time.sleep(.5)
print(".", end = "")
time.sleep(.5)
print(".", end = "")
time.sleep(.5)
print(".", end = "")
else:
print("You ran away!")