2021-12-31 01:46:21 +00:00
|
|
|
AttackPattern = {}
|
|
|
|
|
|
|
|
AttackPattern.Wait = function(entity,t,a,b,c)
|
2021-12-31 11:21:48 +00:00
|
|
|
entity.patternTime = 0.75
|
2021-12-31 01:46:21 +00:00
|
|
|
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
|
2021-12-31 11:21:48 +00:00
|
|
|
if t % 50 < 5 then AttackPattern.DrowningBarrage(entity,t,a,b,c) end
|
|
|
|
if t % 10 < 4 then AttackPattern.ShotAtPlayerTriple(entity,t,5) end
|
2021-12-31 01:46:21 +00:00
|
|
|
entity.shotTimer = 0.05
|
2021-12-31 11:21:48 +00:00
|
|
|
entity.patternTime = 4
|
2021-12-31 01:46:21 +00:00
|
|
|
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)
|
2021-12-31 11:21:48 +00:00
|
|
|
|
|
|
|
-- BULLETS DATA
|
|
|
|
b = b or {
|
2021-12-31 01:46:21 +00:00
|
|
|
damage = 3,
|
|
|
|
hits = 1,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeed = 4,
|
|
|
|
moveSpeedIncrease = 0.001,
|
2021-12-31 01:46:21 +00:00
|
|
|
moveHorizontalIncrease = 0.001,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeedLimits = { min = 2, max = 4},
|
2021-12-31 01:46:21 +00:00
|
|
|
animation = Animation.projectileGreen,
|
2021-12-31 11:21:48 +00:00
|
|
|
hostile = true,
|
|
|
|
maximumTurnRate = 0.05
|
2021-12-31 01:46:21 +00:00
|
|
|
}
|
2021-12-31 11:21:48 +00:00
|
|
|
c = c or {
|
2021-12-31 01:46:21 +00:00
|
|
|
damage = 3,
|
|
|
|
hits = 1,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeed = 4,
|
|
|
|
moveSpeedIncrease = 0.001,
|
2021-12-31 01:46:21 +00:00
|
|
|
moveHorizontalIncrease = -0.001,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeedLimits = { min = 2, max = 4},
|
2021-12-31 01:46:21 +00:00
|
|
|
animation = Animation.projectileGreen,
|
2021-12-31 11:21:48 +00:00
|
|
|
hostile = true,
|
|
|
|
maximumTurnRate = 0.05
|
2021-12-31 01:46:21 +00:00
|
|
|
}
|
2021-12-31 11:21:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
-- Initialization if not initialized
|
2021-12-31 01:46:21 +00:00
|
|
|
local t = t or 0
|
|
|
|
if a == nil then
|
|
|
|
a = -10
|
|
|
|
end
|
2021-12-31 11:21:48 +00:00
|
|
|
|
|
|
|
if t % 40 < 20 then
|
|
|
|
b.moveHorizontalIncrease = -b.moveHorizontalIncrease
|
|
|
|
c.moveHorizontalIncrease = -c.moveHorizontalIncrease
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Bullet Generation
|
|
|
|
Projectile:New(
|
|
|
|
entity.pos.x,
|
|
|
|
entity.pos.y,
|
|
|
|
math.rad(a *-math.cos( 5 )) + math.rad(90) + math.rad(40),
|
|
|
|
b
|
|
|
|
)
|
|
|
|
|
|
|
|
Projectile:New(
|
|
|
|
entity.pos.x,
|
|
|
|
entity.pos.y,
|
|
|
|
math.rad(a *math.cos( 5 )) + math.rad(90) - math.rad(40),
|
|
|
|
c
|
|
|
|
)
|
2021-12-31 01:46:21 +00:00
|
|
|
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,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeed = 2,
|
2021-12-31 01:46:21 +00:00
|
|
|
moveSpeedIncrease = -0.05,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeedLimits = { min = 2, max = 4},
|
2021-12-31 01:46:21 +00:00
|
|
|
animation = Animation.projectileRed,
|
|
|
|
hostile = true
|
|
|
|
}
|
|
|
|
local BulletDataBlue = {
|
|
|
|
damage = 3,
|
|
|
|
hits = 1,
|
|
|
|
moveSpeed = 3.5,
|
|
|
|
moveSpeedIncrease = -0.05,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeedLimits = { min = 2, max = 4},
|
2021-12-31 01:46:21 +00:00
|
|
|
animation = Animation.projectileBlue,
|
|
|
|
hostile = true
|
|
|
|
}
|
|
|
|
local target_x = You.pos.x
|
|
|
|
local target_y = You.pos.y
|
|
|
|
for i=-1, 1 do
|
2021-12-31 11:21:48 +00:00
|
|
|
Projectile:New(
|
2021-12-31 01:46:21 +00:00
|
|
|
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
|
|
|
|
)
|
2021-12-31 11:21:48 +00:00
|
|
|
Projectile:New(
|
2021-12-31 01:46:21 +00:00
|
|
|
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,
|
2021-12-31 11:21:48 +00:00
|
|
|
moveSpeed = 2.5,
|
2021-12-31 01:46:21 +00:00
|
|
|
animation = Animation.projectileRed,
|
2021-12-31 11:21:48 +00:00
|
|
|
hostile = true,
|
|
|
|
maximumTurnRate = 0.5
|
2021-12-31 01:46:21 +00:00
|
|
|
}
|
|
|
|
local target_x = You.pos.x
|
|
|
|
local target_y = You.pos.y
|
|
|
|
entity.shotTimer = BulletData.shotCooldown
|
2021-12-31 11:21:48 +00:00
|
|
|
Projectile:New(
|
2021-12-31 01:46:21 +00:00
|
|
|
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
|
2021-12-31 11:21:48 +00:00
|
|
|
Projectile:New(
|
2021-12-31 01:46:21 +00:00
|
|
|
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,
|
2021-12-31 11:21:48 +00:00
|
|
|
hostile = true,
|
|
|
|
maximumTurnRate = 0.2
|
2021-12-31 01:46:21 +00:00
|
|
|
}
|
|
|
|
local target_x = You.pos.x
|
|
|
|
local target_y = You.pos.y
|
|
|
|
entity.shotTimer = BulletData.shotCooldown
|
|
|
|
for i=-1, 1 do
|
2021-12-31 11:21:48 +00:00
|
|
|
Projectile:New(
|
2021-12-31 01:46:21 +00:00
|
|
|
entity.pos.x,
|
|
|
|
entity.pos.y,
|
|
|
|
math.rad(-15)*i + GetAngle(
|
|
|
|
target_x - entity.pos.x,
|
|
|
|
target_y - entity.pos.y),
|
|
|
|
BulletData
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|