#initial start up questions, pokemon select and nickname or not starter = raw_input("Which starter do you choose: Bulbasaur, Charmander, or Squirtle?\n") nicknameyn = raw_input("Would you like to give a nickname to your " + starter + "?\n") if nicknameyn == 'yes': nickname = raw_input("What name would you like to give it?\n") print nickname + " was added to your party." else: print starter + " was added to your party." nickname = starter #creation of user's party and bag party = [] party.append(nickname) print party print "In addition, you have the following items in your bag:" bag = ["5 Pokeballs", "1 Permarepel", "5 Potions", "0 dollars"] dollars = 0 print bag print "You are now ready to start your adventure in the world of Pythonmon!" #bulbasaur class class Bulbasaur(object): def __init__(self): self.data = [] def level(self): self.level = 5 def health(self): self.health = 22 print self.health def attack(self): self.attack = 7 print self.attack def speed(self): self.speed = 6 print self.speed def xp(self): self.xp = 0 #test Bulbasaur().health() #starter default stats starterdefhea = 22 starterdefatt = 7 starterdefspe = 7 starterlvl = 5 starterdefxp = 0 starterlvlupxp = 100 tackle = 5 growl = 0 starterhealth = 22 starterattack = 7 starterspeed = 7 starterxp = 0 #pidgey default stats pidgeydefhea = 18 pidgeydefatt = 5 pidgeydefspe = 6 pidgeydeflvl = 3 pidgeydefxp = 0 pidgeylvlupxp = 60 pidgeytackle = 3 pidgeysandattack = 0 pidgeyhealth = 18 pidgeyattack = 5 pidgeyspeed = 6 pidgeyvalues = [0, 3] def StarterLevelUp(): starterdefhea = starterdefhea + 2 starterdefatt = starterdefatt + 2 starterdefspe = starterdefspe + 1 starterlvl = starterlvl + 1 starterlvlupxp = starterlvlupxp + 10 tackle = tackle + 1 growl = 0 starterhealth = starterhealth + 2 starterattack = starterattack + 2 starterspeed = starterspeed + 1 #battle from random import * print "A Wild Pidgey has appeared!" x = True while x == True: if starterspeed > pidgeyspeed: move = raw_input("What move would you like to use?\n") if move == 'tackle': print starter + " used Tackle!" pidgeyhealth = pidgeyhealth - tackle if pidgeyhealth <= 0: print "Foe Pidgey has fainted!" starterxp = starterxp + 20 if starterxp == starterlvlupxp: starterxp = 0 StarterLevelUp() print "Your " + starter + " has grown to level " starterlvl + "!" x = False if starterxp > starterlvlupxp: starterxp = starterxp - starterlvlupxp StarterLevelUp() print "Your " + starter + " has grown to level " starterlvl + "!" x = False if move == 'growl': print starter + " used Growl!" pidgeydamage = random.choice(pidgeyvalues) if pidgeydamage == 3: print "Pidgey used Tackle!" starterhealth = starterhealth - 3 if starterhealth <= 0: print starter + " has fainted!" print "You scurry back to the nearest Pythonmon center and heal your injured Pythonmon." starterhealth = starterdefhea x = False if pidgeydamage == 0: print "Pidgey used Sand Attack!" if starterspeed < pidgeyspeed: pidgeydamage = random.choice(pidgeyvalues) if pidgeydamage = 3: print "Pidgey used Tackle!" starterhealth = starterhealth - 3 if starterhealth <= 0: print starter + " has fainted!" print "You scurry back to the nearest Pythonmon center and heal your injured Pythonmon." starterhealth = starterdefhea x = False if pidgeydamage = 0: print "Pidgey used Sand Attack!" move = raw_input("What move would you like to use?\n") if move == 'tackle': print starter + " used Tackle!" pidgeyhealth = pidgeyhealth - tackle if pidgeyhealth <= 0: print "Foe Pidgey has fainted!" starterxp = starterxp + 20 if starterxp == starterlvlupxp: starterxp = 0 StarterLevelUp() print "Your " + starter + " has grown to level " starterlvl + "!" x = False if starterxp > starterlvlupxp: starterxp = starterxp - starterlvlupxp StarterLevelUp() print "Your " + starter + " has grown to level " starterlvl + "!" x = False if move == 'growl': print starter + " used Growl!"
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question