ZLP1/scripts/attack_patterns.lua

218 lines
5.2 KiB
Lua

AttackPattern = {}
AttackPattern.Wait = function(entity,t,a,b,c)
entity.patternTime = 2
entity.nextPattern = AttackPattern.PressureWebOfLies
end
AttackPattern.PressureWebOfLies = function(entity,t,a,b,c)
if t % 2 == 0 then AttackPattern.FixatedWeb(entity,t,a,b,c) end
if t % 10 > 7 then AttackPattern.ShotAtPlayerTriple(entity,t,5) end
entity.shotTimer = 0.05
entity.patternTime = 10
entity.nextPattern = AttackPattern.Wait
end
AttackPattern.MortalDrowningBarrage = function(entity,t,a,b,c)
AttackPattern.DrowningBarrage(entity,t,a,b,c)
if t % 10 > 4 then AttackPattern.ShotAtPlayerDouble(entity,t,a,b,c) end
entity.patternTime = 10
end
AttackPattern.FixatedWeb = function(entity,t,a,b,c)
local BulletDataLeft = {
damage = 3,
hits = 1,
moveSpeed = 7,
moveSpeedIncrease = 0.1,
moveHorizontalIncrease = 0.001,
moveSpeedValues = { min = 2, max = 4},
animation = Animation.projectileGreen,
hostile = true
}
local BulletDataRight = {
damage = 3,
hits = 1,
moveSpeed = 7,
moveSpeedIncrease = 0.1,
moveHorizontalIncrease = -0.001,
moveSpeedValues = { min = 2, max = 4},
animation = Animation.projectileGreen,
hostile = true
}
local t = t or 0
if a == nil then
a = -10
end
gunBullet:New(
entity.pos.x,
entity.pos.y,
math.rad(a *-math.cos( 5 )) + math.rad(90) + math.rad(40) --[[GetAngle(
target_x - entity.pos.x,
target_y - entity.pos.y)]],
BulletDataLeft
)
gunBullet:New(
entity.pos.x,
entity.pos.y,
math.rad(a *math.cos( 5 )) + math.rad(90) - math.rad(40) --[[GetAngle(
target_x - entity.pos.x,
target_y - entity.pos.y)]],
BulletDataRight
)
entity.patternTime = 4
entity.shotTimer = 0.3
entity.nextPattern = AttackPattern.FixatedWeb
end
AttackPattern.TwinRays = function(entity,t,a,b,c)
-- variable t is time as always
-- variable a is amplited of the arc
-- variable b is individual bullet (what is calculated)
-- variable c is so it comes back :3
local t = t or 0
if a == nil then
a = -10
end
local BulletDataRed = {
damage = 3,
hits = 1,
moveSpeed = 3.5,
moveSpeedIncrease = -0.05,
moveSpeedValues = { min = 2, max = 4},
animation = Animation.projectileRed,
hostile = true
}
local BulletDataBlue = {
damage = 3,
hits = 1,
moveSpeed = 3.5,
moveSpeedIncrease = -0.05,
moveSpeedValues = { min = 2, max = 4},
animation = Animation.projectileBlue,
hostile = true
}
local target_x = You.pos.x
local target_y = You.pos.y
for i=-1, 1 do
gunBullet:New(
entity.pos.x,
entity.pos.y,
math.rad(a *math.cos(t/5 )) + math.rad(90) + math.rad(45)* i --[[GetAngle(
target_x - entity.pos.x,
target_y - entity.pos.y)]],
BulletDataRed
)
gunBullet:New(
entity.pos.x,
entity.pos.y,
math.rad(a *-math.cos(t/5 )) + math.rad(90) + math.rad(45)* i --[[GetAngle(
target_x - entity.pos.x,
target_y - entity.pos.y)]],
BulletDataBlue
)
end
entity.patternTime = 20
entity.shotTimer = 0.05
entity.nextPattern = AttackPattern.Wait
end
AttackPattern.DrowningBarrage = function(entity,t,a,b,c)
-- variable t is time as always
-- variable a is amplited of the arc
-- variable b is individual bullet (what is calculated)
-- variable c is so it comes back :3
local t = t or 0
if a == nil then
a = -10
end
if b == nil then
b = 0
end
b = b + a
if c == nil then
c = 100
end
if math.abs(b) > c then
a = -a
b = c * -math.sign(a)
end
local BulletData = {
shotCooldown = 0.05,
damage = 3,
hits = 1,
moveSpeed = 3.5,
animation = Animation.projectileRed,
hostile = true
}
local target_x = You.pos.x
local target_y = You.pos.y
entity.shotTimer = BulletData.shotCooldown
gunBullet:New(
entity.pos.x,
entity.pos.y,
math.rad(b *math.cos(t)) + GetAngle(
target_x - entity.pos.x,
target_y - entity.pos.y),
BulletData
)
entity.patternTime = 2
entity.nextPattern = AttackPattern.Wait
end
AttackPattern.ShotAtPlayerDouble = function(entity)
local BulletData = {
shotCooldown = 0.1,
damage = 3,
hits = 1,
moveSpeed = 3,
animation = Animation.projectileGreen,
hostile = true
}
local target_x = You.pos.x
local target_y = You.pos.y
entity.shotTimer = BulletData.shotCooldown
for i=-1, 1 do
if i ~= 0 then
gunBullet:New(
entity.pos.x,
entity.pos.y,
math.rad(-10)*i + GetAngle(
target_x - entity.pos.x,
target_y - entity.pos.y),
BulletData
)
end
end
end
AttackPattern.ShotAtPlayerTriple = function(entity,t,a)
local BulletData = {
shotCooldown = 0.1,
damage = 3,
hits = 1,
moveSpeed = a,
animation = Animation.projectileBlue,
hostile = true
}
local target_x = You.pos.x
local target_y = You.pos.y
entity.shotTimer = BulletData.shotCooldown
for i=-1, 1 do
gunBullet:New(
entity.pos.x,
entity.pos.y,
math.rad(-15)*i + GetAngle(
target_x - entity.pos.x,
target_y - entity.pos.y),
BulletData
)
end
end