Files
cacaus-arcade/data/imp_target.lua
JailGamer a43173a940 [WIP] Treballant en el jefe. Organitzant codi (Ha deixat de funcionar quasi tot)
[FIX] Els warps reutilitzats mantenien l'estat anterior
[NEW] Funcio distancia(a, b)
2026-04-12 23:06:20 +02:00

43 lines
1.3 KiB
Lua

function imp:choose_target()
-- Si no te ganes de fer res, no moure
if self.mood==self.moods.stop then return end
-- S'ha acabat el temps per a arribar a un target
if self.timers.target <= 0 then
-- Canviar a moviment lliure
self:free_movement()
-- Reinicialitzar el patró de moviment i el cooldown
self:reset_mood_timer()
self:path_reset()
-- Seleccionar el següent target
self:next_target()
end
end
function imp:next_target()
if self.move_type==self.move_types.free then
self:free_next_target()
elseif self.move_type==self.move_types.pattern then
self:pattern_next_target()
elseif self.move_type==self.move_types.super then
self:super_next_target()
end
end
function imp:free_next_target() --OK
if DEBUG_FN_NAME then print("free_next_target") end
---- Abans se seleccionava un target aleatoriament ...
-- local new_point = math.random(#self.hot_points)
-- if self.target == self.hot_points[new_point] then
-- new_point = ((new_point+1)%#self.hot_points)+1
-- end
-- self.old_target = self.target
-- self.target=self.hot_points[new_point]
---- ... ara s'intenta tornar al moviment per patró
self:pattern_recovery()
end