Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def clear(num):
- for i in range(num):
- print
- enemy_hp = random.randrange(50, 150)
- player_hp = 100
- weapon_stats = {'knife': 15, 'hammer': 21, '9mm pistol': 67, '5.56 hunting rifle': 240}
- weapons_list = ['knife', 'hammer', '9mm pistol', '5.56 hunting rifle']
- weapon = []
- print "======================================"
- print "You found yourself in combat situation"
- print "There is cabinet with weapons"
- print " Content of cabinet: "
- print "---------------"
- for x in weapons_list:
- print x
- print "---------------"
- print
- print "which weapon you take out of cabinet ?"
- answer = raw_input("Make your choice : ")
- for x in weapons_list:
- if x == answer:
- weapon.append(x)
- print "You took", weapon, " armed with it you hope to prevail"
- print
- while enemy_hp > 0 and player_hp > 0:
- print " ", player_hp, " PLAYER HEALTH"
- print " ", enemy_hp, " ENEMY HEALTH"
- print "=============================================================="
- print "You have option to attack HEAD or BODY, which do you choose ?"
- print "(targeting head has lower chance of success but damage is much more lethal !)"
- answer2 = raw_input("select a or b: ")
- if answer2 == "a":
- if random.randrange(1, 20) > 15:
- enemy_hp -= (4 * weapon_stats[weapon[0]])
- clear(40)
- print "You struck enemy !"
- if random.randrange(1, 20) > 10:
- player_hp -= 20
- print "Enemy struck you !"
- print
- else:
- print "enemy missed"
- print
- else:
- clear(40)
- print " You missed "
- if random.randrange(1, 20) > 10:
- player_hp -= 20
- print "Enemy struck you !"
- print
- else:
- print "enemy missed"
- print
- elif answer2 == "b":
- if random.randrange(1, 20) > 7:
- enemy_hp -= weapon_stats[weapon[0]]
- clear(40)
- print "You struck enemy !"
- if random.randrange(1, 20) > 10:
- player_hp -= 20
- print "Enemy struck you !"
- print
- else:
- print "enemy missed"
- print
- else:
- clear(40)
- print " You missed "
- if random.randrange(1, 20) > 10:
- player_hp -= 20
- print "Enemy struck you !"
- print
- else:
- print "enemy missed"
- print
- print "=============="
- print "=============="
- print "=============="
- if player_hp <= 0:
- print "You died today"
- else:
- print "You live another day"
- raw_input("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement