#!/usr/bin/python #to do: #make it not crash when you don't put in a number to choose your stats #make the user interface easier to use #expand what you can do import sys from random import randint def my_input(opt): sys.stdout.write( opt) sys.stdout.flush() response=sys.stdin.readline() r2=response.rstrip("\n\r") return r2 print '|------------------------------------------------------|' print '|Welcome. This is a single player developmental RPG. I |' print '|hope it is not too unberable to play. Please keep in |' print '|mind that I am not an expereanced programer and do not|' print '|have much time to write code. This currently is just a|' print '|preperation of a character. You play it minimaly. |' print '|------------------------------------------------------|' name= my_input("What is your character's name? ") y=1 z=0 #y = int(my_input("what is your level?")) #z = int(my_input("how much experiance do you have?")) n=0 if y==1: n=1000 elif y==2: n=3000 elif y==3: n=6000 elif y==4: n=10000 elif y==5: n=15000 elif y==6: n=21000 elif y==7: n=28000 elif y==8: n=36000 elif y==9: n=45000 elif y==10: n=55000 elif y==11: n=66000 elif y==12: n=78000 elif y==13: n=91000 elif y==14: n=105000 elif y==15: n=120000 elif y==16: n=136000 elif y==17: n=153000 elif y==18: n=171000 elif y==19: n=190000 else: n=2 print '------------------------------------------------------' race=my_input('''What race do you wish to be?: dwarf human elf half elf halfling Your race(if you choose none of these correctly spelled you will be a dwarf): ''') if race=='human': race1="human" elif race=='elf': race1="elven" elif race=='half elf': race1="half-elfen" elif race=='halfling': race1="halfling" else: race1="dwarven" race='dwarf' print '------------------------------------------------------' clas=my_input('''What class do you want to be?: fighter wizard cleric druid Your class:(if you choose none of these(spelled right) you will be a druid) ''') if clas!='fighter': if clas!='wizard': if clas!='cleric': if clas!='druid': clas='druid' gold=randint(20,35) else: gold=randint(20,35) else: gold=randint(30,45) else: gold=randint(40,50) else: gold=randint(50,65) print '------------------------------------------------------' print name, "the", race1, clas, "has:" if n==2: print z,"exp and you can't gain levels" else: print z,'exp,', n-z, 'exp to level' if race=='elf': gold=gold+randint(30,50) if race=='half-elf': gold=gold+randint(20,45) if race=='human': gold=gold+randint(40,60) if race=='dwarf': gold=gold+randint(50,70) if race=='halfling': gold=gold+randint(20,30) print 'you have', gold, 'gold' print '------------------------------------------------------' align1=my_input('''Choose the first part of your alignment: good neutral evil (if you choose none you will be neutral) ''') print '------------------------------------------------------' align2=my_input('''Choose the second part of your alignment: lawful neutral chaotic (if you choose none you will be neutral) ''') if align1=='good': alin=1 elif align1=='evil': alin=3 else: alin=2 align1='neutral' if align2=='lawful': if alin==1: alignment='lawful good' elif alin==2: alignment='lawful neutral' elif alin==3: alignment='lawful evil' elif align2=='chaotic': if alin==1: alignment='chaotic good' elif alin==2: alignment='chaotic neutral' elif alin==3: alignment='chaotic evil' else: align2='neutral' if alin==1: alignment='neutral good' elif alin==2: alignment='neutral' elif alin==3: alignment='neutral evil' print '------------------------------------------------------' print 'you are', alignment print '------------------------------------------------------' checkcleric=1 if clas=='cleric': youwantadeity='yes' else: youwantadeity=my_input('''do you want a deity(supernatural overseer) (must type yes if you want one, you only have one chance) ''') print '------------------------------------------------------' def check_deity(): global checkcleric global deity print 'you need to choose your deity' print 'choose from the list below' print 'elhorana (nature)' print 'jabid (arcane magic)' print 'sleapsho (trickery)' print 'kihhento (healing)' if align2=='good': print 'shagnast (good)' elif align2=='evil': print 'dahkan (evil)' print 'each one lets you cast an additonal spell for each level.' print 'the spells will be related to the (something)' deity=my_input('Your choice of deity is: ') if deity=='elhorana' or deity=='jabid' or deity=='shagnast' or deity=='sleapsho' or deity=='kihhento' or deity=='dahkan': checkcleric=checkcleric+1 if youwantadeity=='yes': while checkcleric==1: check_deity() print 'Your deity is', deity print '------------------------------------------------------' else: deity='not chosen' print name, "the level",y, race1, clas, "has:" if n==2: print z,"exp and you can't gain levels" else: print z,'exp,', n-z, 'exp to level' print 'you have', gold, 'gold' print 'you are', alignment print 'Your deity is', deity def all_but_lowest(n,m): from random import randint q=1 tot=0 while q<=n: z=randint(1,m) if q==1 or z0: good_stats=1 print '------------------------------------------------------' print stat1 print stat2 print stat3 print '------------------------------------------------------' check=0 stats=[stat1, stat2, stat3] while check==0: str=my_input('What do you want as your strength?') if int(str)==stat1: str=stat1 stats.remove(str) check=1 elif int(str)==stat2: str=stat2 stats.remove(str) check=1 elif int(str)==stat3: str=stat3 stats.remove(str) check=1 while check==1: dex=my_input('What do you want to be your dexterity?') if int(dex)==stats[0]: dex=stats[0] intel=stats[1] check=0 elif int(dex)==stats[1]: dex=stats[1] intel=stats[0] check=0 else: print 'not a good choice' if race=='elf': str=str-2 intel=intel+1 dex=dex+1 elif race=='half elf': str=str-1 dex=dex+1 elif race=='halfling': intel=intel-1 dex=dex+1 else: str=str+2 intel=intel-1 dex=dex-1 strbonous=stat_mod(str) intbonous=stat_mod(intel) dexbonous=stat_mod(dex) print '------------------------------------------------------' print 'str %2d %2d' % (str, strbonous) print 'dex %2d %2d' % (dex, dexbonous) print 'int %2d %2d' % (intel, intbonous) print '------------------------------------------------------' option='dude' inventory=[] inventory2=[] sliver=0 quarkydude=0 weight=0 def purchase_weapons(things): found=0 global weight global gold print 'Name Damage Weight Cost' for thing in things: print '%-14s 1d%-6d %-6d %-2d' % thing choice=raw_input('What do you want to buy?') for thingee in things: if thingee[0]==choice: if gold-thingee[3]<0: print "You don't have enough money" else: gold=gold-thingee[3] c=thingee[0] inventory.append(c) weight=weight+thingee[2] found=1 if found==0: print choice,'is not a valid choice' def purchase_armor(things): found=0 global weight global gold print 'Name Defence Weight Penalty Cost' for thing in things: print '%-16s %-7d %-6d %-7d %-2d' % thing choice=raw_input('What do you want to buy?') for thingee in things: if thingee[0]==choice: if gold-thingee[4]<0: print "You don't have enough money" else: gold=gold-thingee[4] c=thingee[0] inventory.append(c) weight=weight+thingee[2] found=1 if found==0: print choice,'is not a valid choice' def purchace_goods(things): found=0 global weight global gold print 'Name Weight Cost' for thing in things: print '%-15s %-6d %-4.1f' % thing choice=raw_input('What do you want to buy?') for thingee in things: if thingee[0]==choice: if gold-thingee[2]<0: print "You don't have enough money" else: gold=gold-thingee[2] c=thingee[0] inventory2.append(c) weight=weight+thingee[1] found=1 if found==0: print choice,'is not a valid choice' while option!='quit': option=my_input('What do you want to do? ') if option=='buy': purchace=my_input("What do you want to buy? armor, weapon, goods?") if purchace=='armor': armortype=my_input('lght, medm, hevy or shld?') if armortype=='lght': leather= ('leather', 2, 10, 0-0, 4) studded_leather=('studded leather', 3, 15, 0-1, 6) chain_shirt = ('chain shirt', 4, 20, 0-2, 10) light_armor=[leather, studded_leather, chain_shirt] purchase_armor(light_armor) if armortype=='medm': hide=('hide', 3, 20, 0-3, 15) chainmail=('chainmail', 4, 30, 0-4, 25) breastplate=('breastplate', 5, 35, 0-5, 30) medium_armor=[hide, chainmail, breastplate] purchase_armor(medium_armor) if armortype=='hevy': splint_mail=('splint mail', 6, 30, 0-5, 30) half_plate=('half plate', 7, 40, 0-5, 50) full_plate=('full plate', 8, 55, 0-6, 70) heavy_armor=[splint_mail, half_plate, full_plate] purchase_armor(heavy_armor) if armortype=='shld': lgt_wood=('light wood', 1, 10, 0-1, 5) lgt_stel=('light steel', 1, 15, 0-2, 10) hvy_wood=('heavy wood', 2, 15, 0-2, 10) hvy_stel=('heavy steel', 2, 20, 0-3, 15) tower= ('tower', 5, 40, 0-6, 35) shields=[lgt_wood, lgt_stel, hvy_wood, hvy_stel, tower] purchase_armor(shields) if purchace=='weapon': weapontype=my_input('What kind of weapon? light, one-hand, two-hand, ranged?') if weapontype=='light': dagger = ('dagger', 4, 1, 1) light_mace = ('light mace', 6, 3, 4) axe = ('axe', 6, 3, 5) short_sword = ('short sword', 6, 2, 9) numchak = ('numchak', 6, 2, 2) light_weapons=[dagger, light_mace, axe, short_sword, numchak] purchase_weapons(light_weapons) if weapontype=='one-hand': club = ('club', 6, 2, 0) longsword = ('longsword', 8, 5, 10) scimitar = ('scimitar', 6, 3, 10) bastard_sword= ('bastard sword', 10, 7, 23) one_hand_weapons=[club, longsword, scimitar, bastard_sword] purchase_weapons(one_hand_weapons) if weapontype=='two-hand': quarterstaff = ('quarterstaff', 12, 4, 0) great_axe = ('great_axe', 12, 12, 17) lance = ('lance', 8, 8, 8) two_handed_weapons=[lance, great_axe, quarterstaff] purchase_weapons(two_handed_weapons) if weapontype=='ranged': sling=('sling', 4, 0,0) longbow=('longbow', 8,3,50) shortbow=('shortbow',6,3,20) crossbow=('crossbow',8,2,50) ranged_weapons=[sling, longbow, shortbow, crossbow] purchase_weapons(ranged_weapons) if purchace=='goods': if 'backpack' in inventory2: bedroll=('bedroll', 4, .1) flint_steel=('flint and steel', 0, 1) lantern=('lantern', 2, 5) lantern_fuel=('lantern fuel', 1, 0.1) pole=('pole', 6, .2) rope=('rope', 5, 2) tent=('tent', 10, 5) torch=('torch', 1, .1) waterskin=('waterskin', 1, 1) goods=[bedroll, flint_steel, lantern, lantern_fuel, pole, rope, tent, torch, waterskin] purchace_goods(goods) else: choice=my_input('Do you want a backpack?(You must have one to buy goods)') if choice=='yes': if gold-2<0: print "You don't have enough gold." else: gold=gold-2 inventory2[0:0]=['backpack'] if option=='inv': print 'Your stuff weighs', weight, 'pound(s).' print 'Weapons and Armor:' for item in inventory: print item print 'Goods:' for item in inventory2: print item if option=='i': print 'Your stuff weighs', weight, 'pound(s).' print 'Weapons and Armor:' for item in inventory: print item print 'Goods:' for item in inventory2: print item if option=='inventory': print 'Your stuff weighs', weight, 'pound(s).' print 'Weapons and Armor:' for item in inventory: print item print 'Goods:' for item in inventory2: print item if option=='gold': print 'You have',gold,'gold.' if option=='money': print 'You have',gold,'gold.' if option=='info': print '|------------------------------------------------------|' print '|Welcome. This is a single player developmental RPG. I |' print '|hope it is not too unberable to play. Please keep in |' print '|mind that I am not an expereanced programer and do not|' print '|have much time to write code. This currently is just a|' print '|preperation of a character. You cannot play it. |' print '|------------------------------------------------------|' quarkydude=1 if quarkydude!=1: print '------------------------------------------------------' quarkydude=0 companian=0 print '''You begin your quest. You are in the small village you grew up in and are getting restless of the same terrain. The elders send you on your way. They ask you to give them 10% of your earnings for raising you.''' check=0 while check==0: choice=my_input('Do you accept this?(yes or no) ') if choice=='yes': check=1 print 'The elders give you thier blessing and a horse to ride.' elderdisplease=0 if choice=='no': check=1 elderdisplease=1 print 'The elders look displeased. The wisper behind their hands and then turn to you. They say,"You have displeased us but we will let you off this time with just leting you out of the village unharmed. But be warned: Do not cross us again."' print 'You look around the outside of the village and see a trail to the north-west that leads to the capitol of your city state, a forest directly to the west and a barren grassland to the south. The village is to your east.' while check==1: choice=my_input('Which way do you want to go?(nw,w,s,e)') if choice=='nw': check=2 elif choice=='w': check=2 elif choice=='s': check=2 elif choice=='e': if elderdisplease==1: print 'The elders see you walk in and their goons suround you and beat you senseless before you can do anything. You wake up outside the village with a big bump on your head.' print 'You look around the outside of the village and see a trail to the north-west that leads to the capitol of your city state, a forest directly to the west and a barren grassland to the south. The village is to your east.' while check==1: choice=my_input('Which way do you want to go?(nw,w,s)') if choice=='nw': check=2 elif choice=='w': check=2 elif choice=='s': check=2 else: print 'The elders invite you in and ask if you have made your fortune yet. When you shake your head they look slightly crestfallen. They give you reasuring comments and then send you on your way.' print 'You look around the outside of the village and see a trail to the north-west that leads to the capitol of your city state, a forest directly to the west and a barren grassland to the south. The village is to your east.' while check==1: choice=my_input('Which way do you want to go?(nw,w,s)') if choice=='nw': check=2 elif choice=='w': check=2 elif choice=='s': check=2 inv2='stuff:' for item in inventory2: inv2=inv2+' '+item+',' if choice=='nw': if elderdisplease==1: print 'You follow the path to the city and are forced to stop as the sky gets dark. You set out your', inv2, 'and prepare yourself for sleep.' modifier=0 if 'tent' in inventory2: print 'You set up your tent.' if 'bedroll' in inventory2: print 'In it you unroll your bedroll' elif 'bedroll' in inventory2: print 'In it you unroll your bedroll' if 'flint and steel' in inventory2: print 'You make a bright fire that illuminates the site' modifier=2 else: if 'torch' in inventory2: choice1=my_input('Do you want to light a torch? ') if choice1=='yes': print 'You light a torch that illuminates your campsite.' modifier=1 print 'You sleep soundly until midnight when you awaken suddenly.' test=1 while test==1: choice2=my_input('Do you want to search your campsite, sleep or try to keep following the road at night? (search, sleep, walk)') if choice2=='search': roll=randint(1,20) roll=roll+modifier if roll<10: print 'You see nothing' elif roll<15: print 'You see a shadowy figure moving away from your campsite.' elif roll>=15: print 'You supprize an old hermit who had followed the light.' test=2 elif choice2=='sleep': print '''You are rudely awoken by a man tossing you into a barred wagon. You are taken into the city and thrown in a jail cell. A few hours later, a police man walks into your cell and tells you: You have been taken into custody on these charges: 1 Vagrancy You have been seen homeless and unproductive for two months 2 Theivery You have been caught theiving and then released two times 3 Murder You were the sole witness durring the murder of two people that had recently fired you 4 Defacing royal property You were seen destroying statues in the city on two accounts''' while test==1: choice3=my_input('How do you plead to these charges?') if choice3=='innocent': print 'You are left in the cell with some food and water to eat and drink. After two days you think you might do something.' choice4=my_input('Do you want to try to:(get)attention, esacpe, wait') if choice4=='attention': print 'You rattle the bars in an attempt to get attetion. A ghost pops up from the toilet and advances on you, saying,"You woke me, You woke me".' position='ghost' elif choice4=='escape': print 'You create some crude tools and attempt to escape' roll=randint(1,20) if roll>12: print 'You manage to escape the little cell and enter the city.' position='city' else: print 'You cannot get out with the horrible attempt at tools you made. You get hungry and start to feel ill. You pass out and awake with a splittling headache.' choice3='guilty' else: print 'You wait another ten minutes and the guard comes in and says,"We figured out that it was someone else, so you are free." He lets you out of the jail and you are now in the city.' position='city' test=2 if choice3=='guilty': print "You are charged and tried, found guilty and told you will feed the gallow's crows on the following eve." position='crows' test=2 if choice3=='two': print 'You say the keyword that releases the sorcerer from his trapped form. He is forever endeted to you and joins your party. You continue along the road and reach the city.' companian=companian+1 position='city' test=2 elif choice2=='walk': print 'You wander about blindly until the sun comes up when you realize you are now in the forest' test=2 choice='w' else: print 'You have an uneventful trip to the city.' position='city' # 3 possabilitys.fight crows, fight ghost, in city if position=='crows': print 'You are lead to the gallows but realise that the guards want some sport and intend for you to fight the crows off for your life.' elif position=='ghost': print 'The ghost advances on you and draws a misty sword.' elif position=='city': print 'As you walk around the city.' if choice=='w': print 'The area to your w is under construction.' if choice=='s': print 'The area to your s is under construction.'