Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. class Character():
  2.  
  3. # Create a character
  4. def __init__(self, char_name, char_description):
  5. self.name = char_name
  6. self.description = char_description
  7. self.conversation = None
  8.  
  9. # Describe this character
  10. def describe(self):
  11. print( self.name + " is here!" )
  12. print( self.description )
  13.  
  14. # Set what this character will say when talked to
  15. def set_conversation(self, conversation):
  16. self.conversation = conversation
  17.  
  18. # Talk to this character
  19. def talk(self):
  20. if self.conversation is not None:
  21. print("[" + self.name + " says]: " + self.conversation)
  22. else:
  23. print(self.name + " doesn't want to talk to you")
  24.  
  25. # Fight with this character
  26. def fight(self):
  27. print(self.name + " doesn't want to fight with you")
  28. return True
  29.  
  30.  
  31.  
  32. class Enemy(Character):
  33. def __init__(self, char_name, char_description):
  34. super().__init__(char_name, char_description)
  35. self.weakness = None
  36. self.possession=None
  37.  
  38. def set_weakness(self, weakness):
  39. self.weakness = weakness
  40.  
  41. def get_weakness(self):
  42. print("Weakness is > "+self.weakness)
  43. return self.weakness
  44.  
  45. def set_possession(self, possession):
  46. self.possession = possession
  47.  
  48. def get_possession(self):
  49. print("Possession is > "+self.possession)
  50. return self.possession
  51.  
  52.  
  53. def fight(self, combat_item):
  54. if combat_item == self.weakness:
  55. print("You fend " + self.name + " off with the " + combat_item )
  56. return True
  57. else:
  58. print(self.name + " crushes you, puny adventurer")
  59. return False
  60.  
  61. def steal(self):
  62. if self.possession is None:
  63. print("Ihave nothing to steal you stupid adventurer")
  64. else:
  65. print("you steal "+self.possession+ " from "+self.name)
  66.  
  67.  
  68.  
  69. class Friend(Character):
  70. def __init__(self, char_name, char_description):
  71. super().__init__(char_name, char_description)
  72. self.feeling=None
  73.  
  74. def hug(self):
  75. print(self.name+" hugs you back")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement