From f0ba32cc74a7afca44e3cbcee2ac33d9e43eac49 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 16 Feb 2015 01:05:53 +0100 Subject: [PATCH] Some fixes to the tutorial_world mob. --- evennia/contrib/tutorial_world/mob.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/evennia/contrib/tutorial_world/mob.py b/evennia/contrib/tutorial_world/mob.py index c27061f209..60ceed8b4f 100644 --- a/evennia/contrib/tutorial_world/mob.py +++ b/evennia/contrib/tutorial_world/mob.py @@ -14,8 +14,9 @@ from evennia.contrib.tutorial_world import objects as tut_objects 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: + patrolling: if set, the mob will move randomly from room to room, but preferring to not return 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. TICKER_HANDLER.remove(self, last_interval, idstring) if not stop: - # now set the new ticker + # set the new ticker TICKER_HANDLER.add(self, interval, idstring, hook_key) def _find_target(self, location): @@ -324,10 +325,11 @@ class Mob(tut_objects.TutorialObject): Someone landed a hit on us. Check our status and start attacking if not already doing so. """ - if not weapon.db.magic: - damage = self.db.damage_resistance * damage - attacker.msg(self.db.weapon_ineffective_text) - self.db.health -= damage + if not self.db.immortal: + if not weapon.db.magic: + damage = self.db.damage_resistance * damage + attacker.msg(self.db.weapon_ineffective_text) + self.db.health -= damage # analyze the result if self.db.health <= 0: