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