Пример #1
0
 def post_action(self, actor, **kw):
     target = get_from_name(actor, kw["split_string"][1])[0]
     if target.is_attackable(actor):
         if target.stats["hp"] <= 0:
             target.flags.append("lootable")
             target.flags.append("dead")
             target.save_values()
             return ["\n You killed the {}".format(target.d_name)]
Пример #2
0
 def run_action(self, actor, **kw):
     t_name = kw["split_string"][1]
     target = get_from_name(actor, t_name)[0]
     if not target.is_inspectable(actor):
         return ["You cannot inspect that"]
     descriptions = []
     for obj in target.get_children():
         descriptions.append(obj.describe(actor))
     return descriptions
Пример #3
0
 def run_action(self, actor, **kw):
     obj_name = kw["split_string"][1]
     # get other objects in scope
     matching_obj_in_scope = get_from_name(actor, obj_name)
     descriptions = []
     for obj in matching_obj_in_scope:
         if obj.is_describable(actor):
             descriptions.append(obj.describe(actor))
     return descriptions
Пример #4
0
 def run_action(self, actor, **kw):
     item_name = kw["split_string"][1]
     target_name = kw["split_string"][3]
     t_obj = get_from_name(actor, target_name)[0]
     if not t_obj.is_lootable(actor):
         return ["You cannot take from this {}".format(t_obj.d_name)]
     for child in t_obj.get_children():
         if item_name in child.get_identifiers():
             transforms.move(child, actor)
             return [
                 "You took the {} from the {}".format(
                     child.d_name, t_obj.d_name)
             ]
Пример #5
0
    def do_action(self, actor, **kw):

        item_name = kw["split_string"][1]
        item_obj = get_from_name(actor, item_name)[0]
        response = []
        pre = self.pre_action(actor, item_obj, **kw)
        act = self.run_action(actor, item_obj, **kw)
        post = self.post_action(actor, item_obj, **kw)
        if pre:
            response = response + pre
        if act:
            response = response + act
        if post:
            response = response + post
        self.game.player_ouput(response)
Пример #6
0
 def run_action(self, actor, **kw):
     target_name = kw["split_string"][1]
     t_obj = get_from_name(actor, target_name)[0]
     if t_obj.is_attackable(actor):
         return [self.do_combat(actor, t_obj)]