Some fixes to the tutorial_world mob.

This commit is contained in:
Griatch 2015-02-16 01:05:53 +01:00
parent be482c31e7
commit f0ba32cc74

View file

@ -14,8 +14,9 @@ from evennia.contrib.tutorial_world import objects as tut_objects
class Mob(tut_objects.TutorialObject): class Mob(tut_objects.TutorialObject):
""" """
This is a mobile. It has several states which This is a state-machine AI mobile. It has several states which
are controlled from setting various Attributes: are controlled from setting various Attributes:
patrolling: if set, the mob will move randomly patrolling: if set, the mob will move randomly
from room to room, but preferring to not return from room to room, but preferring to not return
the way it came. If unset, the mob will remain the way it came. If unset, the mob will remain
@ -133,7 +134,7 @@ class Mob(tut_objects.TutorialObject):
# we have a previous subscription, kill this first. # we have a previous subscription, kill this first.
TICKER_HANDLER.remove(self, last_interval, idstring) TICKER_HANDLER.remove(self, last_interval, idstring)
if not stop: if not stop:
# now set the new ticker # set the new ticker
TICKER_HANDLER.add(self, interval, idstring, hook_key) TICKER_HANDLER.add(self, interval, idstring, hook_key)
def _find_target(self, location): def _find_target(self, location):
@ -324,10 +325,11 @@ class Mob(tut_objects.TutorialObject):
Someone landed a hit on us. Check our status Someone landed a hit on us. Check our status
and start attacking if not already doing so. and start attacking if not already doing so.
""" """
if not weapon.db.magic: if not self.db.immortal:
damage = self.db.damage_resistance * damage if not weapon.db.magic:
attacker.msg(self.db.weapon_ineffective_text) damage = self.db.damage_resistance * damage
self.db.health -= damage attacker.msg(self.db.weapon_ineffective_text)
self.db.health -= damage
# analyze the result # analyze the result
if self.db.health <= 0: if self.db.health <= 0: