1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-22 03:08:51 +02:00
Rampant/prototypes/Wasp.lua

573 lines
9.6 KiB
Lua
Raw Normal View History

2018-02-04 16:07:25 -08:00
-- imports
local acidBall = require("utils/AttackBall")
local droneUtils = require("utils/DroneUtils")
local biterUtils = require("utils/BiterUtils")
local swarmUtils = require("SwarmUtils")
package.path = "../libs/?.lua;" .. package.path
local constants = require("Constants")
-- constants
local wasp = {}
2018-02-04 16:07:25 -08:00
local WASP_UNIT_TIERS = constants.WASP_UNIT_TIERS
local WASP_UNIT_VARIATIONS = constants.WASP_UNIT_VARIATIONS
local WASP_NEST_TIERS = constants.WASP_NEST_TIERS
local WASP_NEST_VARIATIONS = constants.WASP_NEST_VARIATIONS
local WASP_WORM_TIERS = constants.WASP_WORM_TIERS
local WASP_WORM_VARIATIONS = constants.WASP_WORM_VARIATIONS
-- imported functions
local buildUnitSpawner = swarmUtils.buildUnitSpawner
local buildWorm = swarmUtils.buildWorm
local buildUnits = swarmUtils.buildUnits
local createAttackBall = acidBall.createAttackBall
2018-02-06 00:01:20 -08:00
local createProjectileAttack = biterUtils.createProjectileAttack
2018-02-04 16:07:25 -08:00
local biterAttackSounds = biterUtils.biterAttackSounds
local softSmoke = "the-soft-smoke-rampant"
local createCapsuleProjectile = droneUtils.createCapsuleProjectile
local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function wasp.addFaction()
2018-02-04 19:24:28 -08:00
local biterLoot = makeUnitAlienLootTable("purple")
local spawnerLoot = makeSpawnerAlienLootTable("purple")
local wormLoot = makeWormAlienLootTable("purple")
2018-02-04 16:07:25 -08:00
-- wasp
buildUnits(
{
name = "wasp-drone",
attributes = {
followsPlayer = true
},
attack = {
2018-02-06 00:01:20 -08:00
type = "stream",
2018-02-04 16:07:25 -08:00
softSmokeName = softSmoke
},
2018-02-04 19:24:28 -08:00
death = function (attributes)
return {
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
type = "create-entity",
entity_name = "acid-splash-purple"
}
}
}
end,
2018-02-04 16:07:25 -08:00
scales = {
[1] = 0.5,
[2] = 0.5,
[3] = 0.6,
[4] = 0.6,
[5] = 0.7,
[6] = 0.7,
[7] = 0.8,
[8] = 0.8,
[9] = 0.9,
[10] = 0.9
},
resistances = {},
type = "drone",
attackName = "wasp-drone",
2018-02-04 19:24:28 -08:00
tint = {r=1, g=1, b=0, a=1},
2018-02-04 16:07:25 -08:00
pTint = {r=0, g=1, b=1, a=0.5},
sTint = {r=0, g=1, b=1, a=0.5},
2018-02-04 19:24:28 -08:00
dTint = {r=0, g=0, b=1, a=1}
2018-02-04 16:07:25 -08:00
},
function (attack)
return {
type = "projectile",
2018-05-25 15:23:22 -07:00
ammo_category = "biological",
2018-02-04 16:07:25 -08:00
cooldown = attack.cooldown or 20,
projectile_center = {0, 1},
projectile_creation_distance = 0.6,
range = attack.range or 15,
sound = biterAttackSounds(),
ammo_type =
{
2018-05-25 15:23:22 -07:00
category = "biological",
2018-02-04 16:07:25 -08:00
action =
{
type = "direct",
action_delivery =
{
type = "stream",
stream = createAttackBall(attack),
duration = 160
}
}
}
}
end,
{
{
type = "attribute",
name = "health",
[1] = 10,
[2] = 15,
[3] = 20,
[4] = 25,
[5] = 30,
[6] = 35,
[7] = 40,
[8] = 45,
[9] = 50,
[10] = 55
},
{
type = "attack",
name = "cooldown",
[1] = 60,
[2] = 60,
[3] = 55,
[4] = 55,
[5] = 50,
[6] = 50,
[7] = 45,
[8] = 45,
[9] = 40,
[10] = 40
},
{
type = "attribute",
name = "ttl",
[1] = 300,
[2] = 300,
[3] = 350,
[4] = 350,
[5] = 400,
[6] = 400,
[7] = 450,
[8] = 450,
[9] = 500,
[10] = 500
},
{
type = "attack",
name = "damage",
[1] = 2,
[2] = 4,
[3] = 7,
[4] = 13,
[5] = 15,
[6] = 18,
[7] = 22,
[8] = 28,
[9] = 35,
[10] = 40
},
{
type = "attribute",
name = "movement",
2018-02-06 23:57:41 -08:00
[1] = 0.03,
[2] = 0.03,
[3] = 0.04,
[4] = 0.04,
[5] = 0.05,
[6] = 0.05,
[7] = 0.06,
[8] = 0.06,
[9] = 0.07,
[10] = 0.07
2018-02-04 16:07:25 -08:00
},
{
type = "attribute",
name = "distancePerFrame",
[1] = 0.013,
[2] = 0.013,
[3] = 0.014,
[4] = 0.014,
[5] = 0.015,
[6] = 0.015,
[7] = 0.016,
[8] = 0.016,
[9] = 0.017,
[10] = 0.017
},
{
type = "attack",
name = "rangeFromPlayer",
2018-02-06 23:57:41 -08:00
[1] = 18,
[2] = 18,
[3] = 19,
[4] = 19,
[5] = 20,
[6] = 20,
[7] = 21,
[8] = 21,
[9] = 22,
[10] = 22
2018-02-04 16:07:25 -08:00
},
{
type = "attack",
name = "range",
[1] = 10,
[2] = 10,
[3] = 11,
[4] = 11,
[5] = 12,
[6] = 12,
[7] = 13,
[8] = 13,
[9] = 14,
[10] = 14
},
{
type = "attack",
name = "radius",
[1] = 1.2,
[2] = 1.3,
[3] = 1.4,
[4] = 1.5,
[5] = 1.6,
[6] = 1.7,
[7] = 1.8,
[8] = 1.9,
[9] = 2.0,
[10] = 2.5
}
2018-02-04 16:07:25 -08:00
},
WASP_UNIT_VARIATIONS,
WASP_UNIT_TIERS
)
buildUnits(
{
name = "wasp-worm-drone",
attributes = {
},
attack = {
2018-02-06 00:01:20 -08:00
type = "stream",
2018-02-04 16:07:25 -08:00
softSmokeName = softSmoke
},
2018-02-04 19:24:28 -08:00
death = function (attributes)
return {
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
type = "create-entity",
entity_name = "acid-splash-purple"
}
}
}
end,
2018-02-04 16:07:25 -08:00
scales = {
[1] = 0.5,
[2] = 0.5,
[3] = 0.6,
[4] = 0.6,
[5] = 0.7,
[6] = 0.7,
[7] = 0.8,
[8] = 0.8,
[9] = 0.9,
[10] = 0.9
},
resistances = {},
type = "drone",
attackName = "wasp-worm-drone",
2018-02-04 19:24:28 -08:00
tint = {r=1, g=1, b=0, a=1},
2018-02-04 16:07:25 -08:00
pTint = {r=0, g=1, b=1, a=0.5},
sTint = {r=0, g=1, b=1, a=0.5},
2018-02-04 19:24:28 -08:00
dTint = {r=0, g=0, b=1, a=1}
2018-02-04 16:07:25 -08:00
},
function (attack)
return {
type = "projectile",
2018-05-25 15:23:22 -07:00
ammo_category = "biological",
2018-02-04 16:07:25 -08:00
cooldown = attack.cooldown or 20,
projectile_center = {0, 1},
projectile_creation_distance = 0.6,
range = attack.range or 15,
sound = biterAttackSounds(),
ammo_type =
{
2018-05-25 15:23:22 -07:00
category = "biological",
2018-02-04 16:07:25 -08:00
action =
{
type = "direct",
action_delivery =
{
type = "stream",
stream = createAttackBall(attack),
duration = 160
}
}
}
}
end,
{
{
type = "attribute",
name = "health",
[1] = 10,
[2] = 15,
[3] = 20,
[4] = 25,
[5] = 30,
[6] = 35,
[7] = 40,
[8] = 45,
[9] = 50,
[10] = 55
},
{
type = "attack",
name = "cooldown",
[1] = 60,
[2] = 60,
[3] = 55,
[4] = 55,
[5] = 50,
[6] = 50,
[7] = 45,
[8] = 45,
[9] = 40,
[10] = 40
},
{
type = "attribute",
name = "ttl",
[1] = 300,
[2] = 300,
[3] = 350,
[4] = 350,
[5] = 400,
[6] = 400,
[7] = 450,
[8] = 450,
[9] = 500,
[10] = 500
},
{
type = "attack",
name = "damage",
[1] = 2,
[2] = 4,
[3] = 7,
[4] = 13,
[5] = 15,
[6] = 18,
[7] = 22,
[8] = 28,
[9] = 35,
[10] = 40
},
{
type = "attack",
name = "rangeFromPlayer",
[1] = 10,
[2] = 10,
[3] = 11,
[4] = 11,
[5] = 12,
[6] = 12,
[7] = 13,
[8] = 13,
[9] = 14,
[10] = 14
},
{
type = "attribute",
name = "movement",
[1] = 0.01,
[2] = 0.01,
[3] = 0.02,
[4] = 0.02,
[5] = 0.03,
[6] = 0.03,
[7] = 0.04,
[8] = 0.04,
[9] = 0.05,
[10] = 0.05
},
{
type = "attribute",
name = "distancePerFrame",
[1] = 0.013,
[2] = 0.013,
[3] = 0.014,
[4] = 0.014,
[5] = 0.015,
[6] = 0.015,
[7] = 0.016,
[8] = 0.016,
[9] = 0.017,
[10] = 0.017
},
{
type = "attack",
name = "range",
[1] = 10,
[2] = 10,
[3] = 11,
[4] = 11,
[5] = 12,
[6] = 12,
[7] = 13,
[8] = 13,
[9] = 14,
[10] = 14
},
{
type = "attack",
name = "radius",
[1] = 1.2,
[2] = 1.3,
[3] = 1.4,
[4] = 1.5,
[5] = 1.6,
[6] = 1.7,
[7] = 1.8,
[8] = 1.9,
[9] = 2.0,
[10] = 2.5
}
2018-02-04 16:07:25 -08:00
},
2018-06-01 18:28:50 -07:00
WASP_WORM_VARIATIONS,
WASP_WORM_TIERS
2018-02-04 16:07:25 -08:00
)
-- wasp spitters
buildUnitSpawner(
{
unit = {
name = "wasp-spitter",
loot = biterLoot,
attributes = {
explosion = "blood-explosion-small"
},
attack = {
2018-02-06 23:57:41 -08:00
type = "projectile",
directionOnly = true,
collisionBox = {{0,0}, {0,0}},
2018-02-04 16:07:25 -08:00
softSmokeName = softSmoke
},
resistances = {},
type = "spitter",
attackName = "wasp-drone",
2018-02-04 19:24:28 -08:00
tint = {r=1, g=1, b=0, a=1},
2018-02-04 16:07:25 -08:00
pTint = {r=0, g=1, b=1, a=0.5},
sTint = {r=0, g=1, b=1, a=0.5}
},
unitSpawner = {
name = "wasp-spitter-nest",
loot = spawnerLoot,
attributes = {},
resistances = {},
2018-02-04 19:24:28 -08:00
tint = {r=1, g=1, b=0, a=1}
2018-02-04 16:07:25 -08:00
}
},
{
unit = {
2018-02-04 16:07:25 -08:00
},
unitSpawner = {
2018-02-04 16:07:25 -08:00
}
},
function (attributes)
2018-02-06 00:01:20 -08:00
return createProjectileAttack(attributes,
2018-02-04 19:24:28 -08:00
createCapsuleProjectile(attributes.name,
attributes,
2018-02-04 16:07:25 -08:00
attributes.name .. "-drone-rampant"),
spitterattackanimation(attributes.scale, attributes.tint))
end,
{
unit = WASP_UNIT_VARIATIONS,
unitSpawner = WASP_NEST_VARIATIONS
},
{
unit = WASP_UNIT_TIERS,
unitSpawner = WASP_NEST_TIERS
}
)
-- wasp worms
buildWorm(
{
name = "wasp-worm",
loot = wormLoot,
attributes = {
},
attack = {
2018-02-06 23:57:41 -08:00
type = "projectile",
collisionBox = {{0,0}, {0,0}},
2018-02-04 16:07:25 -08:00
softSmokeName = softSmoke
},
resistances = {},
attackName = "wasp-worm-drone",
2018-02-04 19:24:28 -08:00
tint = {r=1, g=1, b=0, a=1},
2018-02-04 16:07:25 -08:00
pTint = {r=0, g=1, b=1, a=0.5},
sTint = {r=0, g=1, b=1, a=0.5}
},
{
2018-02-04 16:07:25 -08:00
},
function (attributes)
2018-02-06 00:01:20 -08:00
return createProjectileAttack(attributes,
2018-02-06 23:57:41 -08:00
createCapsuleProjectile(attributes.name,
attributes,
attributes.name .. "-drone-rampant"))
2018-02-04 16:07:25 -08:00
end,
WASP_WORM_VARIATIONS,
WASP_WORM_TIERS
)
end
return wasp