Guest User

Modifier example

a guest
Jan 28th, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. class EnlargePerson(Modifier):
  2.     def __init__(self):
  3.         self.name = "Enlarge Person"
  4.  
  5.     def apply_to(self, creature):
  6.         creature.str += 2
  7.         creature.dex += -2
  8.         creature.size += 1
  9.         creature.main_weapon.size += 1
  10.         creature.off_weapon.size += 1
  11.  
  12. buff = EnlargePerson() # Create an instance of our modifier
  13. your_character.modifiers.append(buff) # add modifier
  14. your_character.attack_roll() # do things with buff on
  15. your_character.modifiers.pop() # Removes the last modifier
Advertisement
Add Comment
Please, Sign In to add comment