dkmud/typeclasses/mobs.py
Francesco Cappelli db12c674ef da da da.
2022-01-25 22:23:39 +01:00

45 lines
1.1 KiB
Python

import random
from evennia import create_object
from typeclasses.objects import Object
from typeclasses.scripts import Script
from typeclasses.mob_actions import ActionIdle
class Mob(Object):
def at_object_creation(self):
super().at_object_creation()
self.tags.add("ai_mob", category="general")
self.db.owner = None
self.db.health = 1
self.db.mana = 1
self.db.strength = 1
self.db.agility = 1
self.db.intellect = 1
# needs
self.db.energy = 100
def at_object_delete(self):
if self.db.action:
self.db.action.delete()
return True
def at_init(self):
self.db.action = None
def tick(self):
pass
def think(self):
if not self.db.action:
self.db.action = create_object(ActionIdle, key="action_idle")
self.db.action.prepare(self)
def emote(self):
if self.location:
self.location.msg_contents("{} is thinking something.".format(self.get_display_name(self.location)), exclude=self, from_obj=self)