0% found this document useful (0 votes)
16 views6 pages

Code Nico

Uploaded by

Ulda Aguilar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

Code Nico

Uploaded by

Ulda Aguilar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

import random

import time

def win():

print("You Saved the Village! They thank you and make you the town leader as a
reward!")

def gameOver():

print("Game OVER!!! Too Bad!")

retry = input("\n\nWant to try again? (yes or no)\n\n").lower()

if retry == "yes":

game()

else:

quit()

def game():

gold = 50

character_hp = 125

weapon_damage = 15

monster_damage = 25

monster_payout = 80

weapons = ["fists"]

MONSTERS = {

"goblin": 55,

"zombie": 80,

"wolf": 105,

"dragon": 150
}

name = input("\nWhat is your name?\n\n").title()

while name == "":

name = input("\nWhat is your name?\n\n").title()

print("\nWelcome", name, "Enjoy, Your Adventure!\n")

while character_hp > 0:

WEAPONS_STORE = {

"sword": 140,

"axe": 120,

"club": 75,

"bat": 45

store = input("\nDo you want to buy weapons? (yes or no)\n\n").lower()

if store == "yes":

print("\nWEAPON\t\tCOST\n")

for items in WEAPONS_STORE:

print(items, "\t\t", WEAPONS_STORE[items], "\n")

print("\nYou have", gold, "gold\n\n")

weapon_purchase = input("Which weapon would you like to


buy?\n\n").lower()

while weapon_purchase not in WEAPONS_STORE or weapon_purchase in


weapons:
weapon_purchase = input("Which weapon would you like to
buy?\n\n").lower()

if weapon_purchase in WEAPONS_STORE and weapon_purchase not in


weapons:

if gold >= WEAPONS_STORE[weapon_purchase]:

print("you bought a(n)", weapon_purchase, "\n")

gold -= WEAPONS_STORE[weapon_purchase]

weapons.append(weapon_purchase)

print("\nyou have", gold, "gold\n")

print("\nWeapons(s) you own", weapons,"\n")

elif gold <= WEAPONS_STORE[weapon_purchase]:

print("not enough gold")

if store == "no":

print("\nTime to destroy a monster from the village!\n")

print("\nMONSTERS\tHEALTH\t\n")

for monster in MONSTERS:

print(monster, "\t\t", MONSTERS[monster], "\n")

monchoice = input("Which Monster do you want to Destroy from the


Village\n\n").lower()

if monchoice in MONSTERS:

print("\nGood Luck! Destroy the", monchoice, "from the village")

else:

print("That monster is not in the village")

while monchoice not in MONSTERS:


monchoice = input("Which Monster do you want to Destroy from the
Village\n\n").lower()

print("\nWEAPONS YOU OWN\n")

for weapon in weapons:

print(weapon, "\n")

weapuse = input("Which weapon do you choose\n\n").lower()

if weapuse in weapons:

print("\nWise choice", name, "You will use the", weapuse, "against the",
monchoice)

else:

print(name, "\nYou don't own the", weapuse, "!")

while weapuse not in weapons:

weapuse = input("\nWhat weapon will you use?\n\n").lower()

print("\nWise choice", name, "You will use the", weapuse, "against the",
monchoice)

if weapuse == "fists" or weapuse == "bat":

while character_hp > 0 and MONSTERS[monchoice] > 0:

rand = random.randint(0, 7)

pdmg = weapon_damage + rand

mdmg = monster_damage

print(monchoice, "has", MONSTERS[monchoice], "health left\n\n")

time.sleep(1.5)

print("The", monchoice, "attacked YOU by", mdmg)

character_hp -= mdmg

if character_hp <= 0:
gameOver()

print(name,", your health is now", character_hp)

time.sleep(1.5)

print("\nYou attacked the", monchoice, "with the", weapuse, "for", pdmg)

MONSTERS[monchoice] -= pdmg

time.sleep(1.5)

print("damage!")

pdmg = weapon_damage + rand

mdmg = monster_damage

print(monchoice, "has", MONSTERS[monchoice], "health left\n\n")

time.sleep(1.5)

print("\nYou attacked the", monchoice, "with the", weapuse, "for", pdmg,


"damage!")

MONSTERS[monchoice] -= pdmg

time.sleep(1.5)

if weapuse == "club" or weapuse == "axe":

while character_hp > 0 and MONSTERS[monchoice] > 0:

rand = random.randint(0, 13)

pdmg = weapon_damage + rand

mdmg = monster_damage

print(monchoice, "has", MONSTERS[monchoice], "health left\n\n")

time.sleep(1.5)

print("The", monchoice, "attacked YOU by", mdmg)

character_hp -= mdmg

if character_hp <= 0:

gameOver()

print(name,", your health is now", character_hp)


time.sleep(1.5)

print("\nYou attacked the", monchoice, "with the", weapuse, "for", pdmg)

MONSTERS[monchoice] -= pdmg

time.sleep(1.5)

print("damage!")

elif weapuse == "sword":

while character_hp > 0 and MONSTERS[monchoice] > 0:

rand = random.randint(0, 19)

pdmg = weapon_damage + rand

mdmg = monster_damage

print(monchoice, "has", MONSTERS[monchoice], "health left\n\n")

time.sleep(1.5)

print("The", monchoice, "attacked YOU by", mdmg)

character_hp -= mdmg

if character_hp <= 0:

gameOver()

print(name,", your health is now", character_hp)

time.sleep(1.5)

print("\nYou attacked the", monchoice, "with the", weapuse, "for", pdmg)

MONSTERS[monchoice] -= pdmg

time.sleep(1.5)

else:

print(name, "\nYou don't own the", weapuse,"!")

while weapuse not in weapons:

weapuse = input("\nWhat weapon will you use?\n\n").lower()

print("\

You might also like