[WIP] Treballant en el jefe. Dispar al 50%
This commit is contained in:
45
data/imp.lua
45
data/imp.lua
@@ -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,13 +880,20 @@ end
|
|||||||
|
|
||||||
function imp:next_action()
|
function imp:next_action()
|
||||||
local action = "stay"
|
local action = "stay"
|
||||||
|
if self.shot_cooldown<=0 then
|
||||||
if self.movement_type=="free" then
|
if h_collision(self, abad) then
|
||||||
msg_print(10,20,"FREE",true)
|
action = "shot"
|
||||||
action = self:free_next_action()
|
end
|
||||||
else
|
end
|
||||||
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
|
end
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
@@ -930,11 +941,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.fight_mode==self.fight_modes["chase"] then
|
if self.flip_wait<=0 then
|
||||||
self:do_flip(abad)
|
if self.fight_mode==self.fight_modes["chase"] then
|
||||||
else
|
self:do_flip(abad)
|
||||||
self:do_flip(self.target)
|
else
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user