[WIP] Treballant en el jefe. Pattern recovery
This commit is contained in:
@@ -248,8 +248,10 @@ if DEBUG_FN_NAME then print_dbg("fight") end
|
||||
self:create_hot_points()
|
||||
self:load_pattern_paths()
|
||||
|
||||
self.pattern.manual_target = self.pattern.node[6]
|
||||
self.pattern.manual_path = {target=6, actions={{action="right",event="target"}}}
|
||||
local node = 6
|
||||
local path = {target=6, actions={{action="right",event="target"}}}
|
||||
self.pattern:add_manual_target ( node, path )
|
||||
-- self.pattern.recovery = imp.pattern_recovery
|
||||
|
||||
self.shot_target = abad
|
||||
|
||||
@@ -452,6 +454,59 @@ if DEBUG_FN_NAME then print_dbg("pattern_movement") end
|
||||
-- print("Pattern")
|
||||
end
|
||||
|
||||
function imp:pattern_recovery() -- OK
|
||||
-- print("Pattern recovery")
|
||||
self:pattern_movement() -- Canviar a moviment per patró
|
||||
|
||||
-- Situar-se en el mapa respecte als punts de recuperació (els tres punts del pis)
|
||||
local x_after_4 = false
|
||||
local x_after_5 = false
|
||||
local x_after_6 = false
|
||||
local y_upper_4 = false
|
||||
local y_upper_5 = false
|
||||
local y_upper_6 = false
|
||||
|
||||
if self.pattern.node[4].x<self.x then x_after_4 = true end
|
||||
if self.pattern.node[5].x<self.x then x_after_5 = true end
|
||||
if self.pattern.node[6].x<self.x then x_after_6 = true end
|
||||
-- Comparar en el punt dels peus
|
||||
if self.pattern.node[4].y>self.y+self.h then y_upper_4 = true end
|
||||
if self.pattern.node[5].y>self.y+self.h then y_upper_5 = true end
|
||||
if self.pattern.node[6].y>self.y+self.h then y_upper_6 = true end
|
||||
|
||||
local node = 0
|
||||
local path = {}
|
||||
-- Seleccionar les instruccions segons la posicio
|
||||
if not y_upper_5 then
|
||||
-- target 5
|
||||
node = 5
|
||||
if not x_after_5 then
|
||||
-- right target
|
||||
path = {target=5, actions={{action="right",event="target"}}}
|
||||
else
|
||||
-- left target
|
||||
path = {target=5, actions={{action="left",event="target"}}}
|
||||
end
|
||||
else
|
||||
if x_after_5 then
|
||||
--target 4
|
||||
node = 4
|
||||
-- left target
|
||||
path = {target=4, actions={{action="left",event="target"}}}
|
||||
else
|
||||
--target 6
|
||||
node = 6
|
||||
-- right target
|
||||
path = {target=6, actions={{action="right",event="target"}}}
|
||||
end
|
||||
end
|
||||
self.pattern:add_manual_target ( node, path )
|
||||
|
||||
-- Tornar l'acció a fer
|
||||
-- return self.actions[self.path.actions[1].action]
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- // ACTION
|
||||
function imp:next_action()
|
||||
@@ -464,6 +519,10 @@ function imp:next_action()
|
||||
|
||||
-- Resta d'accions
|
||||
if next_action==self.actions.no_action then
|
||||
if self.timers.target<=0 then
|
||||
self:pattern_recovery()
|
||||
self:reset_timer("target")
|
||||
end
|
||||
if self.move_type==self.move_types.free then
|
||||
-- FREE
|
||||
-- next_action = self:free_next_action()
|
||||
|
||||
Reference in New Issue
Block a user