10-23-2009, 02:38 PM
Code:
def a(classname,highdamageweaponname,lowdamageweaponname,ldmgname,hdmgname,yourhealth,enemyhealth,ldmgspellname,hdmgspellname):
import os
import random
os.system("clear")
monsters = ['cyclopse', 'duck', 'dragon', 'wizard', 'magician']
randommonster = random.choice(monsters)
print "Class: %s" % classname
print "1) %s (More damage, but less armor)" % highdamageweaponname
print "2) %s (Less damage, but more armor)" % lowdamageweaponname
a = int(raw_input("You are battling a %s what weapon do you want?: " % randommonster))
while enemyhealth >= -1 and yourhealth >= -1:
hdmg = [0,5,0,15,0,20,30]
ldmg = [0,5,6,7,8,9,10]
ldmgrandom = random.choice(ldmg)
hdmgrandom = random.choice(hdmg)
edmg = [ldmgrandom,hdmgrandom]
edmgrandom = random.choice(edmg)
mdmg = [1,2,3]
mdmgrandom = random.choice(mdmg)
os.system("clear")
if a == 1:
print "you have chosen a %s" % highdamageweaponname
print "Your Armor: ", yourhealth
print "Enemy Armor: ", enemyhealth
print "1) %s (High damage | High chance of missing)" % hdmgname
print "2) %s (Low damage | Low chance of missing)" % ldmgname
c = int(raw_input("Choose your attack: "))
if c == 1:
ddmg = hdmgrandom
yourhealth = yourhealth - edmgrandom
enemyhealth= enemyhealth- ddmg
print "You Did ", ddmg, "Damage"
raw_input("Press Enter To Continue")
elif c == 2:
ddmg = hdmgrandom
yourhealth = yourhealth - edmgrandom
enemyhealth= enemyhealth- ddmg
print "You Did ", ddmg, "Damage"
raw_input("Press Enter To Continue")
if a == 2:
print "you have chosen a %s" % lowdamageweaponname
print "Your Armor: ", yourhealth + 20
print "Enemy Armor: ", enemyhealth
print "1) %s (High damage | High chance of missing)" % hdmgspellname
print "2) %s (Low damage | Low chance of missing)" % ldmgspellname
c = int(raw_input("Choose your attack: "))
if c == 1:
ddmg = hdmgrandom
yourhealth = yourhealth - edmgrandom
enemyhealth= enemyhealth- (ddmg - mdmgrandom)
print "You Did ", ddmg, "Damage"
raw_input("Press Enter To Continue")
elif c == 2:
ddmg = ldmgrandom
yourhealth = yourhealth - edmgrandom
enemyhealth= enemyhealth- (ddmg - mdmgrandom)
print "You Did ", ddmg, "Damage"
raw_input("Press Enter To Continue")
if c > 2 or c < 1:
print "Invalid attack"
raw_input("Press Enter To Continue")
if yourhealth <= 0:
os.system("clear")
print "You Died..."
elif enemyhealth<= 0:
os.system("clear")
print "You Killed Him!"
def menu():
import os
import random
os.system("clear")
print "############################################"
print " City of Warscape "
print "###########################################"
print " "
print "Choose Your Class"
print "1) Warrior"
print "2) Ranger"
print "3) Mage"
x = int(raw_input("What Class What You Like To Be?: "))
if x == 1:
a('Warrior','Mace','Sword','Pound','Bash',100,100,'Slice','Dice')
if x == 2:
a('Ranger','Bow','Knives','Steady Shot','Power Shot',100,100,'Toss','Hurl')
if x == 3:
a('Mage','Staff','Wand','Poke','Slash',100,100,'Fireball','Froststrike')
menu()