Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. '''bureaucrat.py: This class describes government officials, the only enemies of the game.'''
  2.  
  3. import random
  4. from blessings import Terminal
  5.  
  6. import text
  7.  
  8. t = Terminal()
  9.  
  10.  
  11. class Bureaucrat:
  12.     '''A government employee who works at the Institution.'''
  13.     def __init__(self):
  14.         self.gender = random.random()
  15.         if self.gender >= 0.505:
  16.             self.gender = 'Her'  # the bureaucrat is female (~49,5%)
  17.         elif self.gender < 0.505 and self.gender >= 0.01:
  18.             self.gender = 'His'  # the bureaucrat is male (~49,5%)
  19.         else:
  20.             self.gender = "The bureaucrat's"  # the bureaucrat is intersex (~1%)
  21.         self.rank = random.choice(['low', 'medium', 'high'])
  22.         self.mood = random.choice(['bad', 'average', 'good'])
  23.         self.greet()  # new bureaucrats automatically greet the player
  24.  
  25.     def greet(self):
  26.         '''A random greeting from a government employee.'''
  27.         print('\n' + random.choice(text.greetings) +
  28.               '\nA wild bureaucrat of a {} rank appears!\n'.format(
  29.               t.bold(self.rank)) +
  30.               '{} mood seems to be {}.\n'.format(
  31.               self.gender, t.bold(self.mood)))
  32.  
  33.     def react_negatively(self):
  34.         '''A negative reaction to the choice of the player.'''
  35.         print(t.bold("\nIt doesn't affect the bureaucrat!\n") +
  36.               random.choice(text.negative_reactions) + '\n')
  37.  
  38.     def react_positively(self):
  39.         '''A positive reaction to the choice of the player.'''
  40.         print(t.bold("\nIt's super effective!\n") +
  41.               random.choice(text.positive_reactions))
  42.         self.bureaucrat = Bureaucrat()  # a new bureaucrat is generated