You are on page 1of 8

Jefrelyn Mae G.

Banaag

BIT CPET-1201

CODES:

print("Hello,Welcome to my programming code! This code is a simple text adventure game with a little
bit of d&d and guessing game style.")

import random

while True:

health= 100

sphinx= 100

defend = random.randint(5, 15)

dodge = random.randint(5, 15)

attack = random.randint(0, 10)

print("\nYou are an adventurer in pursuit to find the mysterious ruins, rumored to held a magical
treasure. After many journeys and challenges, you're now finally standing infront of the ruins.\n\nTwo
doors stand infront of you. \n\nThe left door carries an aura of mystery, and you could feel a slight cold
breeze from underneath it, the sounds from the other side calling out to you in an echo.\n\nHowever,
the right door carries a sense of comfort and warm, and there seems to be a light on the other side, like
a warm sunny day.")

doors = str(input("\nWhich door will you choose?\n a.)left \n b.)right \n"))

if doors == "a" :

print("\nYou enter the cold and dark room, illuminated only by the softlight of torches. And from the
end of the room,you heard a silent hiss.\n\nYou immediately scrambled to get a torch and pointed it
towards the source of the sound,only for you to meet face to face with a giant Sphinx. The room was
suddenly illuminated with light, the Sphinx finally found out.")

print("\nThe Sphinx raised its claws at you, about to attack. Quick! What do you do?")

print("\nYour health:",health,"\nSphinx health:",sphinx)


monster=input("\n a.)dodge the attack \n b.)block the claws with your shield \n c.)face the Sphinx
head on \n")

if monster == "a":

if dodge >= 10:

sphinx-=30

print("Great reflex,adventurer! The Sphinx missed and crashed into a nearby wall. It's health is
now:",sphinx)

else:

health-=30

print("Oh dear, you were too slow to dodge succesfully. Your health is now: ",health)

if monster == "b":

if defend >= 10:

sphinx-=30

print("Great job, adventurer! The Sphinx's attack bounced off of your shield. You manage to
make it taken aback by your actions.")

else:

health-=30

print("Oh no, you failed to block the attack succesfully. Your health is now: ",health)

if monster == "c":

if attack >= 10:

sphinx-=30

print("Daring move! You immediately took out your sword and rushed towards the Sphinx. It
was taken aback by such action, which gave you an opportunity to hit it with your weapon. It's health is
now:",sphinx)

else:
health-=30

print("The Sphinx anticipated your move and ducked, before hitting you with its claws. Your
health is now: ",health)

print("\nThe Sphinx is now angry. It circled around you for a while, thinking of its next move.
However,you are much prepared now,your eyes followed where the monster go.")

print("\nYou are in your defensive stance, and the monster have decided to rush towards you.\
nQuick,adventurer! What do you do?")

print("\nYour current health:",health,"\nSphinx's current health:",sphinx)

monster=input("\n a.)dodge to the side \n b.)attack the Sphinx head on \n")

if monster == "a":

if dodge >= 10:

sphinx-=30

print("Great reflex,adventurer! The sphinx missed and crashed into a nearby wall.It's health is
now:",sphinx)

else:

health-=30

print("Oh dear,you were too slow to dodge succesfully. Your health is now: ",health)

if monster == "b":

if attack >= 10:

sphinx-=30

print("Hurray!You managed to attack the creature succesfully. It's health is now:",sphinx)

else:

health-=30

print("The Sphinx's reflexes are much faster than your attack. It counter attack you. Your health
is now: ",health)
print("\nThis is the final shot. What your actions right now will determine whether you will defeat
this creature successfully or not. It starts sprinting towards you.\nQuick,adventurer! What is your final
move?")

print("\nYour current health:",health,"\nSphinx's current health:",sphinx)

monster=input("\n a.)block the impact with your shield \n b.)attack with your sword \n")

if monster == "a":

if defend >= 10:

sphinx-=40

print("Great job,adventurer! Your great blocking stunned the creature,and you used the
opportunity to hit it with your weapon as powerful as you can.It's health is now:",sphinx)

else:

health-=30

print("Oh no, you timed it wrong. the creature ducked to the side before hitting you. Your
health is now: ",health)

if monster == "b":

if attack >= 10:

sphinx-=40

print("Hurray!Your attack was sure and true. It's health is now:",sphinx)

else:

health-=30

print("The Sphinx's reflexes are much faster than your attack. It dodged to the side and hit you
with its talons. Your health is now: ",health)

print("\nYour current health:",health,"\nSphinx's current health:",sphinx)

if sphinx<=40:

print("\nThe creature is far too tired to fight back, it collapses to the ground.")

print("\nAfter the fight, You walked around the room,looking around for any treasure. You saw a
door at a corner and went inside. There, you found three mysterious chests.")

dict={1:'Flaming sword',2:'A vial of immortality',3:'Powerful staff'}


choice = int(input("You think of what chest to choose.1, 2, or 3: "))

if choice==1:

print("Congratulations! You got yourself a: ", dict[1],"!")

if choice==2:

print("Congratulations! You got yourself a: ", dict[2],"!")

if choice==3:

print("Congratulations! You got yourself a: ", dict[3],"!")

print("\nAfter taking the treasure, you went on and tried to open the two other chests. However,
just as you were about to make you move,the rest of the chests crumbled and turned into ashes. \nYou
shrugged your shoulders and proceeded to leave the place.\n\n'Oh well, atleast I got something', were
your thoughts as you walk out of the ruins.")

break

print("The end.")

if sphinx==0:

print("You have completely defeated the creature with your abilities.")

print("After the fight, You walked around the room,looking around for any treasure. You saw a
door at a corner and went inside.There, you found three mysterious chests.")

dict={1:'Flaming sword',2:'A vial of immortality',3:'Powerful staff'}

choice = int(input("You think of what chest to choose. 1, 2, or 3: "))

if choice==1:

print("Congratulations! You got yourself a: ", dict[1],"!")

if choice==2:

print("Congratulations! You got yourself a: ", dict[2],"!")

if choice==3:

print("Congratulations! You got yourself a: ", dict[3],"!")

print("\nAfter taking the treasure, you went on and tried to open the two other chests. However,
just as you were about to make you move,the rest of the chests crumbled and turned into ashes. \nYou
shrugged your shoulders and just proceeded to leave the place.\n\n'Oh well, atleast I got something',
were your thoughts as you walk out of the ruins.")

print("The end.")

break
if sphinx>40:

print("The sphinx stands still. And before you could move any further, it swoop you with its
claws,swallowing you whole. You are now gone.")

print("The end.")

break

if doors == "b":

print("\nYou enter the much more welcoming door. What greets you on the other side is a forest,
filled with many various kinds of trees and plants, and a small pond by the side.\n As you were walking
around, admiring the place, a voice from a nearby tree spoke. ")

print("\n'Adventurer, what brings you here?' the soft voice asked in amusement. And from behind
the tree, a dryad showed up; her skin was covered with barks of trees and her hair was made of leaves.\
n\n'I've come to seek the magical treasure of this place', you replied.\n\nThe dryad hummed in thought,
'Magical treasure,you say? Hmm...Tell you what, I'll help you with your journey. However, answer my
riddles first. If you win,I'll point you to the direction of where you will find your treasure.' ")

print("'\nAnd if I lose?', you asked cautiously, narrowing your eyes at her in suspicion. The dryad
shrugged her shoulders casually, 'Then I won't point you the direction. Simple as that.'\n\nShe then
chuckled and spoke in that soft voice once, 'If you're worried I'll do something bad, don't be. Living in
this place for hindreds of years have come to be boring at times, only a few adveturers visits.' ")

score=0

words = ["fauna", "dessert", "earth", "sun", "moon"]

word = random.choice(words)

gword=(random.sample(word, len(word)))

jword= ''.join(gword)

print("'So, shall we start?' She asked. She then cleared her throat and presented you jumbled letters.
\n\n'What is the word for this'",": ",jword)

while True:

answer = input("\nEnter your answer. Type it in lowercase:")

if answer == word:

print("Hey,not bad.You managed to guess it correctly on your first problem.")

score+=1

else:
print("Tough luck. Better luck next time adventurer.")

words = ["fauna", "dessert", "earth", "sun", "moon"]

word = random.choice(words)

gword=(random.sample(word, len(word)))

jword= ''.join(gword)

print("\nShe showed another batch of letters and spoke 'Here's another word'",":", jword,"'")

answer = input("Enter your answer. Type it in lowercase: ")

if answer == word:

print("Great job. Keep up the work and I may just point you towards the direction.")

score+=1

else:

print("'Such a shame. Try again, adventurer.'")

words = ["fauna", "dessert", "earth", "sun", "moon"]

word = random.choice(words)

gword=(random.sample(word, len(word)))

jword= ''.join(gword)

print("\nShe showed the last batch of letters and spoke 'Here is the last one. Answer correctly and
I'll show you where the treasure is'",": ",jword)

answer = input("Enter your answer. Type it in lowercase: ")

if answer == word:

print("'Great! you have managed to answer me correctly!', she spoke in a happy tone.")

score+=1

else:

print("Tough luck. Better luck next time adventurer.")

if score>=2:
print("\nGiven how you passed",score, "of her three questions, the dryad led you to a room.
There,she showed you three boxes. ")

dict={1:'Flaming sword',2:'A vial of immortality',3:'Powerful staff'}

choice = int(input("She spoke to you, 'Go on, choose what you want. 1, 2,or 3: "))

if choice==1:

print("Congratulations! You got yourself a: ", dict[1],"!")

if choice==2:

print("Congratulations! You got yourself a: ", dict[2],"!")

if choice==3:

print("Congratulations! You got yourself a: ", dict[3],"!")

print("After taking the treasure,you thanked her and bid your goodbye,leaving the ruins
happily.")

break

else:

print("'\nHow saddening.',the dryad spoke in dissapointment. 'And here I thought you were
different than others who came before you.' \n\nYou can't deny it. Even you were dissapointed of just
being able to have",score,"correct answer out of her three questions.")

print( "'You barely passed. Goodbye' she spoke casually, bored at her wits.\n\n'What do you
mean-', before you could finish your sentence, vines wrapped around your body,dragging you to the
pond,down to the bottom of it.\n\nThe dryad lied to you. Those were your last thoughts before you lose
consciousness,never to be seen again.")

print("\nThe end.")

break

break

You might also like