SHARE
TWEET

Untitled

a guest Mar 20th, 2017 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Traceback (most recent call last):
  3.   File "c:\evennia\evennia\evennia\commands\cmdhandler.py", line 509, in _run_command
  4.     ret = yield cmd.func()
  5.   File "C:\Evennia\tutorial\commands\command.py", line 302, in func
  6.     tickerhandler.add(15, rules.skill_combat(caller, target))
  7.   File "c:\evennia\evennia\evennia\scripts\tickerhandler.py", line 496, in add
  8.     obj, path, callfunc = self._get_callback(callback)
  9.   File "c:\evennia\evennia\evennia\scripts\tickerhandler.py", line 341, in _get_callback
  10.     raise TypeError("%s is not a callable function or method." %  callback)
  11. TypeError: None is not a callable function or method.
  12.  
  13. An untrapped error occurred.
  14.  
  15. --
  16.  
  17.     def func(self):
  18.         "implements the actual functionality"
  19.         caller = self.caller
  20.         target = caller.search(self.target)
  21.         # Beginning of the validation checks
  22.         if not target:
  23.             caller.msg("Hit whom?")
  24.             return
  25.         if not utils.inherits_from(target, 'typeclasses.characters.Character'):
  26.             caller.msg("This is not a valid target.")
  27.             return
  28.         if target == caller:
  29.             caller.msg("You affectionately pat yourself on the back.")
  30.             caller.location.msg_contents("{} affectionately pats themselves on the back.".format(caller.name), exclude=[caller])
  31.             return
  32.         tickerhandler.add(15, rules.skill_combat(caller, target))
  33.  
  34. ---
  35. def skill_combat(*args):
  36.     """
  37.     This determines outcome of combat.
  38.     The one who rolls under theri combat skill AND
  39.     higher than their opponent's roll hits.
  40.     Args:
  41.         *args:
  42.  
  43.     Returns:
  44.  
  45.     """
  46.     char1, char2 = args
  47.     roll1, roll2 = roll_hit(), roll_hit()
  48.     failtext = "You are hit by %s for %i damage!"
  49.     wintext = "You hit %s for %i damage!"
  50.     char1.msg("{} is char1. Their combat score is {}.".format(char1.name,char1.db.skills['combat']))
  51.     char1.msg("{} is char2. Their combat score is {}.".format(char2.name, char2.db.skills['combat']))
  52.     char1.msg("Roll1 = {}".format(roll1))
  53.     char1.msg("Roll2 = {}".format(roll2))
  54.     if char1.db.skills['combat'] >= roll1 > roll2:
  55.         # Char 1 hits
  56.         dmg = roll_dmg() + char1.db.str
  57.         char1.msg(wintext % (char2, dmg))
  58.         char2.msg(failtext % (char1, dmg))
  59.         char2.db.hp['Current'] -= dmg
  60.         check_defeat(char2)
  61.         update_prompt(char2)
  62.     elif char2.db.skills['combat'] >= roll2 > roll1:
  63.         # char 2 hits
  64.         dmg = roll_dmg() + char2.db.str
  65.         char1.msg(failtext % (char2, dmg))
  66.         char1.db.hp['Current'] -= dmg
  67.         check_defeat(char1)
  68.         char2.msg(wintext % (char1, dmg))
  69.         update_prompt(char1)
  70.     else:
  71.         # draw
  72.         drawtext = "Neither of you can find an opening."
  73.         char1.msg(drawtext)
  74.         char2.msg(drawtext)
RAW Paste Data
Top