Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''bureaucrat.py: This class describes government officials, the only enemies of the game.'''
- import random
- from blessings import Terminal
- import text
- t = Terminal()
- class Bureaucrat:
- '''A government employee who works at the Institution.'''
- def __init__(self):
- self.gender = random.random()
- if self.gender >= 0.505:
- self.gender = 'Her' # the bureaucrat is female (~49,5%)
- elif self.gender < 0.505 and self.gender >= 0.01:
- self.gender = 'His' # the bureaucrat is male (~49,5%)
- else:
- self.gender = "The bureaucrat's" # the bureaucrat is intersex (~1%)
- self.rank = random.choice(['low', 'medium', 'high'])
- self.mood = random.choice(['bad', 'average', 'good'])
- self.greet() # new bureaucrats automatically greet the player
- def greet(self):
- '''A random greeting from a government employee.'''
- print('\n' + random.choice(text.greetings) +
- '\nA wild bureaucrat of a {} rank appears!\n'.format(
- t.bold(self.rank)) +
- '{} mood seems to be {}.\n'.format(
- self.gender, t.bold(self.mood)))
- def react_negatively(self):
- '''A negative reaction to the choice of the player.'''
- print(t.bold("\nIt doesn't affect the bureaucrat!\n") +
- random.choice(text.negative_reactions) + '\n')
- def react_positively(self):
- '''A positive reaction to the choice of the player.'''
- print(t.bold("\nIt's super effective!\n") +
- random.choice(text.positive_reactions))
- self.bureaucrat = Bureaucrat() # a new bureaucrat is generated
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement