def add_status_effect(self, char, status_effect, repeats=None): """ Add status effect to the combat handler to add at the end of the turn. """ logger.log_infomsg("Calling the status effect function.") dbref = char.id self.db.turn_effects[dbref][status_effect] = repeats logger.log_infomsg("The turn_effect dict is now %s for %s" %\ (self.db.turn_effects[dbref], char.db.sdesc))
def at_stop(self): """ Called just before the script is stopped/destroyed. """ logger.log_infomsg("stopping the combat handler.") if any(self.db.characters): try: for character in list(self.db.characters.values()): # note: the list() call above disconnects listing # from database self._cleanup_character(character) except: pass
def end_turn(self): """ This resolves all actions by calling the rules module. It then resets everything and starts the next turn. """ self.at_bleed_tick() self.process_stop_requests() resolve_combat.resolve_combat(self.db.characters, self.db.turn_actions, self.db.turn_combos, self.db.pairs, self) # reset counters before next turn self.at_add_status_tick() for (dbref, character) in self.db.characters.items(): # 0 is the index for the character's move previous_move = self.db.turn_actions[dbref]["move"] self.db.turn_actions[dbref] = {"move":None, "previous_move":previous_move} self.db.turn_combos[dbref] = None self.db.turn_effects[dbref] = {} logger.log_infomsg("End turn.")
def end_turn(self): """ This resolves all actions by calling the rules module. It then resets everything and starts the next turn. """ self.at_bleed_tick() self.process_stop_requests() resolve_combat.resolve_combat(self.db.characters, self.db.turn_actions, self.db.turn_combos, self.db.pairs, self) # reset counters before next turn self.at_add_status_tick() for (dbref, character) in self.db.characters.items(): # 0 is the index for the character's move previous_move = self.db.turn_actions[dbref]["move"] self.db.turn_actions[dbref] = { "move": None, "previous_move": previous_move } self.db.turn_combos[dbref] = None self.db.turn_effects[dbref] = {} logger.log_infomsg("End turn.")
def log_info(message): """ Log a message to the info channel """ INFOCHANNEL.msg("{Y[ {g%s{Y | {n%s{Y ]" % (INFOCHANNEL.key, message)) logger.log_infomsg("log_info: %s" % (message))