function imp:choose_action() -- antic imp:move if self.mood==self.moods.stop then return self.mood end if DEBUG_FN_NAME then print("choose_action "..self.mood) end local next_action = self.actions.no_action -- Si no te ganes de fer res, no moure if self.mood==self.moods.stop then return self.actions.no_action end if self.analisis.going_to_fall then self.action_event="prefall" end if self.analisis.target_reached then self.action_event="target" end if self.analisis.can_go_altar then self:super_ready() end -- if self.fight_mode == self.fight_modes["super"] then self.action_event="super" end -- if self.fight_mode == self.fight_modes["end_super"] then self.action_event="end_super" end next_action = self:next_action() if self.analisis.target_reached and next_action=="super" then -- print("Super READY!") self.action_event = "super_ready" -- next_action = self:next_action() self:super() end if self.old_action~=next_action then self.old_action=next_action -- print(self.old_action) end self.action = next_action return next_action end function imp:next_action() local next_action = self.actions.no_action -- Si el blanc està a tir if self.timers.shot<=0 then if h_collision(self, self.shot_target) then next_action = self.actions.shot end end if next_action==self.actions.no_action then if self.move_type==self.move_types.free then -- msg_print(10,20,"FREE",true) next_action = self:free_next_action() elseif self.move_type==self.move_types.pattern then -- msg_print(10,20,"PATTERN "..self.action_event,true) next_action=self:pattern_next_action() elseif self.move_type==self.move_types.super then -- msg_print(10,20,"SUPER "..self.action_event,true) end end return next_action end function imp:free_next_action() if DEBUG_FN_NAME then print("free_next_action") end -- Moviment horitzontal if self.target.x+self.target.bb.x>=self.x+self.bb.x then action="right" elseif self.target.x+self.target.bb.xself.target.y or self.y0 then -- -- self:pattern_movement() -- self:reset_target_timer() -- self:next_target() -- action = self:path_action() -- else -- action = self:pattern_recovery() -- print("PNA Recovery "..action) -- end -- return action -- end