231 lines
5.3 KiB
Lua
231 lines
5.3 KiB
Lua
AttackPattern = {}
|
|
|
|
AttackPattern.Wait = function(entity,t,a,b,c)
|
|
entity.patternTime = 0.75
|
|
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 % 50 < 5 then AttackPattern.DrowningBarrage(entity,t,a,b,c) end
|
|
if t % 10 < 4 then AttackPattern.ShotAtPlayerTriple(entity,t,5) end
|
|
entity.shotTimer = 0.05
|
|
entity.patternTime = 4
|
|
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)
|
|
|
|
-- BULLETS DATA
|
|
b = b or {
|
|
damage = 3,
|
|
hits = 1,
|
|
moveSpeed = 4,
|
|
moveSpeedIncrease = 0.001,
|
|
moveHorizontalIncrease = 0.001,
|
|
moveSpeedLimits = { min = 2, max = 4},
|
|
animation = Animation.projectileGreen,
|
|
hostile = true,
|
|
maximumTurnRate = 0.05
|
|
}
|
|
c = c or {
|
|
damage = 3,
|
|
hits = 1,
|
|
moveSpeed = 4,
|
|
moveSpeedIncrease = 0.001,
|
|
moveHorizontalIncrease = -0.001,
|
|
moveSpeedLimits = { min = 2, max = 4},
|
|
animation = Animation.projectileGreen,
|
|
hostile = true,
|
|
maximumTurnRate = 0.05
|
|
}
|
|
|
|
|
|
-- Initialization if not initialized
|
|
local t = t or 0
|
|
if a == nil then
|
|
a = -10
|
|
end
|
|
|
|
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
|
|
)
|
|
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 = 2,
|
|
moveSpeedIncrease = -0.05,
|
|
moveSpeedLimits = { min = 2, max = 4},
|
|
animation = Animation.projectileRed,
|
|
hostile = true
|
|
}
|
|
local BulletDataBlue = {
|
|
damage = 3,
|
|
hits = 1,
|
|
moveSpeed = 3.5,
|
|
moveSpeedIncrease = -0.05,
|
|
moveSpeedLimits = { 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
|
|
Projectile: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
|
|
)
|
|
Projectile: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 = 2.5,
|
|
animation = Animation.projectileRed,
|
|
hostile = true,
|
|
maximumTurnRate = 0.5
|
|
}
|
|
local target_x = You.pos.x
|
|
local target_y = You.pos.y
|
|
entity.shotTimer = BulletData.shotCooldown
|
|
Projectile: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
|
|
Projectile: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,
|
|
maximumTurnRate = 0.2
|
|
}
|
|
local target_x = You.pos.x
|
|
local target_y = You.pos.y
|
|
entity.shotTimer = BulletData.shotCooldown
|
|
for i=-1, 1 do
|
|
Projectile: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
|