Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys,os,random
- weapons = {"OH SHIT! Sword":10}
- class Player:
- def __init__(self,name):
- self.name = name
- self.maxhealth = 100
- self.health = self.maxhealth
- self.base_attack = 10
- self.gold = 100
- self.pots = 2
- self.weap = ['OH SHIT! Sword']
- self.curweap = ['OH SHIT! Sword']
- @property
- def attack(self):
- attack = self.base_attack
- if self.curweap == 'Dildo':
- self.attack += 10
- if self.curweap == "OH SHIT! Sword":
- attack += 9000
- return attack
- class Goblin:
- def __init__(self,name):
- self.name = name
- self.maxhealth = 50
- self.health = self.maxhealth
- self.attack = 800
- self.goldgoin = 10
- GoblinIG = Goblin('Goblin')
- class Zombie:
- def __init__(self,name):
- self.name = name
- self.maxhealth = 70
- self.health = self.maxhealth
- self.attack = 800
- self.goldgoin = 12
- ZombieIG = Zombie('Zombie')
- def main():
- os.system('cls')
- print('welcome to my game\n')
- print('1.) Start')
- print('2.) Load')
- print('3.) Exit\n')
- option = input('-->')
- if option=="1":
- start()
- elif option=="2":
- pass
- elif option=="3":
- sys.exit()
- else:
- main()
- def start():
- os.system('cls')
- print ('hello, what is your name?')
- option = input('-->')
- global PlayerIG
- PlayerIG = Player(option)
- start1()
- def start1():
- os.system('cls')
- print('Name: %s' % PlayerIG.name)
- print('Attack: %i' % PlayerIG.attack)
- print('Health: %i/%i\n' % (PlayerIG.health, PlayerIG.maxhealth))
- print('Current Weapons: %s' % PlayerIG.curweap)
- print('Gold: %d' % PlayerIG.gold)
- print('Potions: %d\n' % PlayerIG.pots)
- print('1.) Fight')
- print('2.) Store')
- print('3.) Save')
- print('4.) Exit')
- option = input('-->')
- if option=='1':
- prefight()
- elif option=='2':
- store()
- elif option=='3':
- pass
- elif option =='4':
- sys.exit()
- else:
- start1()
- def prefight():
- global enemy
- enemynum = random.randint(1, 2)
- if enemynum==1:
- enemy=GoblinIG
- else:
- enemy=ZombieIG
- fight()
- def fight():
- print('\n%s VS %s\n' % (PlayerIG.name,enemy.name))
- print("%s's health: %d/%d %s's Health: %i/%i\n" % (PlayerIG.name,PlayerIG.health,PlayerIG.maxhealth,enemy.name,enemy.health,enemy.maxhealth))
- print('potions: %s\n' % PlayerIG.pots)
- print('1.) Attack')
- print('2.) Drink Potion')
- print('3.) Run')
- option = input(' ')
- if option=='1':
- attack()
- elif option=='2':
- drinkpot()
- elif option=='3':
- run()
- else:
- fight()
- def attack():
- os.system('cls')
- PAttack = random.randint(PlayerIG.attack /2, PlayerIG.attack)
- EAttack = random.randint(enemy.attack /2, enemy.attack)
- if PAttack == PlayerIG.attack/2:
- print ('YOU MISS!')
- fight()
- else:
- enemy.health -= PAttack
- print ('you deal %i damage' % PAttack)
- if enemy.health<=0:
- win()
- if EAttack == enemy.attack/2:
- print ('ENEMY MISS!')
- option = input(' ')
- os.system('cls')
- fight()
- else:
- PlayerIG.health -= EAttack
- print ('enemy deal %i damage' % EAttack)
- option=input(' ')
- os.system('cls')
- if PlayerIG.health <= 0:
- dead()
- else:
- fight()
- def drinkpot():
- os.system('cls')
- if PlayerIG.pots == 0:
- print('you have no potions')
- fight()
- else:
- PlayerIG.health+=50
- PlayerIG.pots-=1
- if PlayerIG.health > PlayerIG.maxhealth:
- PlayerIG.health = PlayerIG.maxhealth
- print('You drank a potion')
- option = input(' ')
- fight()
- def run():
- runnum = random.randint(1,3)
- EAttack = random.randint(enemy.attack /2, enemy.attack)
- if runnum == 1:
- print('you successfully ran away')
- option=input(' ')
- start1()
- else:
- print('you failed to run away')
- if EAttack == enemy.attack/2:
- print ('ENEMY MISS!')
- option = input(' ')
- fight()
- else:
- PlayerIG.health -= EAttack
- print ('enemy deal %i damage' % EAttack)
- os.system('cls')
- option=input(' ')
- if PlayerIG.health <= 0:
- dead()
- else:
- fight()
- def win():
- os.system('cls')
- enemy.health = enemy.maxhealth
- PlayerIG.gold += enemy.goldgoin
- print('you have defeated the %s' % enemy.name)
- print('you have found %i gold' % enemy.goldgoin)
- option = input(' ')
- start1()
- def dead():
- os.system('cls')
- print('you have died')
- option=input(' ')
- def store():
- os.system('cls')
- print ('Hello Welcome to the shop!')
- print ('\nWhat are you buyin?')
- print ('1.) OH SHIT! Sword')
- print (' ')
- option=input(' ')
- if option in weapons:
- if PlayerIG.gold >= weapons[option]:
- os.system('cls')
- PlayerIG.gold -= weapons[option]
- PlayerIG.weap.append(option)
- print('you have purchased the %s' % option)
- store()
- else:
- os.system('cls')
- print("you don't have enough")
- option = input(' ')
- store()
- elif option == "back":
- start1()
- else:
- os.system(' ')
- print('this does not exist here')
- option=input(' ')
- store()
- main()
Advertisement
Add Comment
Please, Sign In to add comment