[WIP] Treballant en el jefe. Dispar al 50%

This commit is contained in:
2026-04-11 12:18:27 +02:00
parent d5dc2aba5f
commit 2e4453ecdb

View File

@@ -68,6 +68,7 @@ function imp.new(_hab, _x, _y)
analisis={}, -- Resultat de la informació extreta de l'entorn analisis={}, -- Resultat de la informació extreta de l'entorn
old_action="-", old_action="-",
invencible=false, invencible=false,
flip_wait=100, -- Temps per a forçar un flip
-- direccio=imp.direccio, -- direccio=imp.direccio,
draw=imp.draw, draw=imp.draw,
hit=imp.hit, hit=imp.hit,
@@ -492,8 +493,10 @@ end
function imp:shot(actor) function imp:shot(actor)
if DEBUG_FN_NAME then print("shot") end if DEBUG_FN_NAME then print("shot") end
self.fight_mode = self.fight_modes["shot"] -- self.fight_mode = self.fight_modes["shot"]
self:reset_fight_mode_cooldown(1) -- self:reset_fight_mode_cooldown(1)
self:do_flip(abad)
self.flip_wait=100
print("FIREBALL!!") print("FIREBALL!!")
self.shot_cooldown = 500 self.shot_cooldown = 500
end end
@@ -509,7 +512,8 @@ if DEBUG_FN_NAME then print("reduce_cooldown") end
self.fight_mode_cooldown = self.fight_mode_cooldown -1 self.fight_mode_cooldown = self.fight_mode_cooldown -1
self.super_cooldown = self.super_cooldown -1 self.super_cooldown = self.super_cooldown -1
self.shoot_cooldown = self.shoot_cooldown -1 self.shot_cooldown = self.shot_cooldown -1
self.flip_wait = self.flip_wait -1
end end
function imp:reset_fight_mode_cooldown( value ) function imp:reset_fight_mode_cooldown( value )
@@ -538,7 +542,7 @@ function imp:pattern_movement()
if DEBUG_FN_NAME then print("pattern_movement") end if DEBUG_FN_NAME then print("pattern_movement") end
self.movement_type = "pattern" self.movement_type = "pattern"
print("Pattern") -- print("Pattern")
end end
function imp:pattern_next_action() function imp:pattern_next_action()
@@ -876,7 +880,13 @@ end
function imp:next_action() function imp:next_action()
local action = "stay" local action = "stay"
if self.shot_cooldown<=0 then
if h_collision(self, abad) then
action = "shot"
end
end
if action=="stay" then
if self.movement_type=="free" then if self.movement_type=="free" then
msg_print(10,20,"FREE",true) msg_print(10,20,"FREE",true)
action = self:free_next_action() action = self:free_next_action()
@@ -884,6 +894,7 @@ function imp:next_action()
msg_print(10,20,"PATTERN "..self.action_event,true) msg_print(10,20,"PATTERN "..self.action_event,true)
action=self:pattern_next_action() action=self:pattern_next_action()
end end
end
return action return action
end end
@@ -931,11 +942,13 @@ if DEBUG_FN_NAME then print("move "..self.fight_mode) end
print("Next random target => "..self.target.id) print("Next random target => "..self.target.id)
end end
if self.flip_wait<=0 then
if self.fight_mode==self.fight_modes["chase"] then if self.fight_mode==self.fight_modes["chase"] then
self:do_flip(abad) self:do_flip(abad)
else else
self:do_flip(self.target) self:do_flip(self.target)
end end
end
if self.analisis.going_to_fall then self.action_event="prefall" 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.target_reached then self.action_event="target" end