def update(self, loop_time): if self.cd > 0: self.cd -= loop_time return hero = self.hero hero.room.move_succ(hero, self.now_pos) print(format_message("{0}|reach|{1}", self.hero.name, self.now_pos)) hero.machine.change_state(IdleState(hero))
def update(self, loop_time): if self.__cd > 0: self.__cd -= loop_time return hero = self.hero att_dir, min_d, target = hero.room.find_target(hero) if target is None: hero.machine.change_state(IdleState(hero)) else: print( format_message("{0}|att|{1}|{2}|{3}", hero.name, target.name, hero.dam, target.hp)) target.hp -= hero.dam self.__cd = 0.2
def on_exit(self): print(format_message("{1} exit moveState", self.hero.name))
def on_enter(self): print(format_message("{0} enter moveState", self.hero.name)) print( format_message("{0}|move|{1}|{2}", self.hero.name, self.last_pos, self.now_pos))
def on_exit(self): print(format_message("{0} exit idleState", self.hero.name))
def on_enter(self): print(format_message("{0} enter idleState", self.hero.name)) print(format_message("{0}|ready", self.hero.name))
def pause(self, hero): print(format_message("{0}|die", hero.name)) self.change_state(IdleState(hero)) self.paused = True
def on_exit(self): pass print(format_message("{0} exit fightState", self.hero.name))
def on_enter(self): print(format_message("{0} enter fightState", self.hero.name)) print(format_message("{0}|readyFight", self.hero.name))