[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)
This commit is contained in:
2026-04-12 23:02:35 +02:00
parent f26d43a97d
commit a43173a940
15 changed files with 1293 additions and 22 deletions

43
data/imp_target.lua Normal file
View File

@@ -0,0 +1,43 @@
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