41 lines
949 B
Python
41 lines
949 B
Python
import random
|
|
from evennia import gametime
|
|
|
|
from typeclasses.objects import Object
|
|
|
|
class Action(Object):
|
|
def at_object_creation(self):
|
|
super().at_object_creation()
|
|
|
|
self.db.action_time = 0
|
|
self.db.action_completion_time = 0
|
|
|
|
def prepare(self, actor):
|
|
#set duration of action
|
|
self.db.action_completion_time = gametime.gametime() + self.db.action_time
|
|
|
|
def update(self, actor):
|
|
pass
|
|
|
|
def complete(self, actor):
|
|
pass
|
|
|
|
def completion_time(self):
|
|
return self.db.action_completion_time
|
|
|
|
class ActionIdle(Action):
|
|
def at_object_creation(self):
|
|
super().at_object_creation()
|
|
|
|
self.db.action_time = 10
|
|
|
|
def update(self, actor):
|
|
pass
|
|
|
|
def complete(self, actor):
|
|
roll = random.randrange(100)
|
|
if roll < 10:
|
|
actor.emote()
|
|
|
|
#TEST
|
|
actor.db.energy = 0 if actor.db.energy == 0 else actor.db.energy - 1
|