Example #1
0
 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))
Example #2
0
 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
Example #3
0
 def on_exit(self):
     print(format_message("{1} exit moveState", self.hero.name))
Example #4
0
 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))
Example #5
0
 def on_exit(self):
     print(format_message("{0} exit idleState", self.hero.name))
Example #6
0
 def on_enter(self):
     print(format_message("{0} enter idleState", self.hero.name))
     print(format_message("{0}|ready", self.hero.name))
Example #7
0
 def pause(self, hero):
     print(format_message("{0}|die", hero.name))
     self.change_state(IdleState(hero))
     self.paused = True
Example #8
0
 def on_exit(self):
     pass
     print(format_message("{0} exit fightState", self.hero.name))
Example #9
0
 def on_enter(self):
     print(format_message("{0} enter fightState", self.hero.name))
     print(format_message("{0}|readyFight", self.hero.name))