Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class grasspokemon:
- def __init__(self, name, health, attackmin, maxattack):
- self.name = name
- self.health = health
- self.attackmin = attackmin
- self.maxattack = maxattack
- class enemypokemon:
- def __init__(self, name, minhealth, maxhealth, minattack, maxattack):
- self.name = name
- self.minhealth = minhealth
- self.maxhealth = maxhealth
- self.minattack = minattack
- self.maxattack = maxattack
- Bulbasaur = grasspokemon('Bulbasaur', 5, 5, 10)
- rattatata = enemypokemon('Rattatata', 3, 10, 2, 4)
- pidgey = enemypokemon('Pidgey', 3, 10, 2, 4)
- geodude = enemypokemon('Geodude', 3, 10, 2, 4)
- wild = [rattatata, pidgey, geodude];
- m_index = random.randint(0,len(wild)-1)
- wild_pokemon = wild[m_index]
- print 'A wild', wild_pokemon.name, 'has appeared!'
- battle = raw_input('Will you battle? or flee? ')
- if battle == 'battle':
- while wild_pokemon.maxhealth >= 1:
- pokedam = random.randint(Bulbasaur.attackmin, Bulbasaur.maxattack)
- enemhealth = wild_pokemon.maxhealth
- damage = pokedam - enemhealth
- encounter = raw_input('Would you like to use vinewhip or razorleaf?')
- if encounter == 'vinewhip':
- enemhealth = enemhealth - damage
- print enemhealth
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement