Advertisement
Kovitikus

Crude Death

Aug 4th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. class DefaultMob(DefaultCharacter):
  2.     def at_object_creation(self):
  3.         self.db.hp = 100
  4.         self.db.ko = False
  5.     def take_damage(self, damage):
  6.         mob = self.key
  7.         location = self.location
  8.        
  9.         self.db.hp -= damage
  10.         hp = self.db.hp
  11.         location.msg_contents(f'{mob} has {hp} health remaining!')
  12.         if hp >= 1:
  13.             self.db.ko = False
  14.         elif hp <= 0 and self.db.ko != True:
  15.             self.db.ko = True
  16.             location.msg_contents(f'{mob} falls unconscious!')
  17.         if hp <= -100:
  18.             okay = self.delete()
  19.             if not okay:
  20.                 location.msg_contents(f'\nERROR: {mob} not deleted, probably because delete() returned False.')
  21.             else:
  22.                 location.msg_contents(f'{mob} breathes a final breath and expires.')
  23.         return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement