1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-05 22:53:24 +02:00
Rampant/prototypes/Poison.lua

318 lines
9.9 KiB
Lua
Raw Normal View History

2019-02-14 07:53:31 +02:00
-- imports
local physicalBall = require("utils/AttackBall")
local biterUtils = require("utils/BiterUtils")
local smokeUtils = require("utils/SmokeUtils")
local swarmUtils = require("SwarmUtils")
2019-02-28 04:53:59 +02:00
local constants = require("__Rampant__/libs/Constants")
2019-11-04 08:19:22 +02:00
local particleUtils = require("utils/ParticleUtils")
2019-02-14 07:53:31 +02:00
-- constants
local poison = {}
-- imported functions
2019-11-04 08:19:22 +02:00
local makeBloodFountains = particleUtils.makeBloodFountains
2019-02-14 07:53:31 +02:00
local buildUnitSpawner = swarmUtils.buildUnitSpawner
local buildWorm = swarmUtils.buildWorm
local createAttackBall = physicalBall.createAttackBall
local createRangedAttack = biterUtils.createRangedAttack
local createMeleeAttack = biterUtils.createMeleeAttack
local makeCloud = smokeUtils.makeCloud
local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
2019-11-04 08:19:22 +02:00
local function evolutionFunction(tier)
if (tier == 0) then
return 0
else
return 0.15 + ((tier - 2) * 0.10)
end
end
2019-02-14 07:53:31 +02:00
function poison.addFaction()
local biterLoot = makeUnitAlienLootTable("green")
local spawnerLoot = makeSpawnerAlienLootTable("green")
local wormLoot = makeWormAlienLootTable("green")
data:extend({
{
type = "damage-type",
name = "healing"
2019-11-07 07:56:09 +02:00
}
2019-02-14 07:53:31 +02:00
})
2019-11-07 07:56:09 +02:00
2019-11-04 08:19:22 +02:00
local bloodFountains = {
type = "attribute",
mapping = "explosion",
[1] = "poison-blood-explosion-small-rampant",
[2] = "poison-blood-explosion-small-rampant",
[3] = "poison-blood-explosion-small-rampant",
[4] = "poison-blood-explosion-small-rampant",
[5] = "poison-blood-explosion-big-rampant",
[6] = "poison-blood-explosion-big-rampant",
[7] = "poison-blood-explosion-big-rampant",
[8] = "poison-blood-explosion-huge-rampant",
[9] = "poison-blood-explosion-huge-rampant",
[10] = "poison-blood-explosion-huge-rampant",
}
makeBloodFountains({
name = "poison",
tint = {r=0, g=0.7, b=0, a=1}
})
2019-02-14 07:53:31 +02:00
for i=1,10 do
makeCloud(
{
name = "poison-cloud-v" .. i,
scale = 0.80 + (i * 0.15),
wind = true,
slowdown = -1.3,
2019-10-30 04:36:18 +02:00
duration = 10 * (i * 5),
cooldown = 5
2019-02-14 07:53:31 +02:00
},
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
type = "nested-result",
action =
{
{
type = "area",
radius = 2 + (i * 0.5),
force = "ally",
entity_flags = {"placeable-enemy"},
action_delivery =
{
type = "instant",
target_effects =
{
type = "damage",
2019-10-30 04:36:18 +02:00
damage = { amount = -2 * i, type = "healing"}
2019-02-14 07:53:31 +02:00
}
}
},
{
type = "area",
radius = 2 + (i * 0.5),
force = "enemy",
action_delivery =
{
type = "instant",
target_effects =
{
type = "damage",
2019-10-30 04:36:18 +02:00
damage = { amount = 1.2 * i, type = "poison"}
2019-02-14 07:53:31 +02:00
}
}
}
}
}
}
}
)
end
2019-11-07 07:56:09 +02:00
-- data:extend({
-- {
-- type = "explosion",
-- name = "poisonTester",
-- flags = {"not-on-map"},
-- animations =
-- {
-- {
-- filename = "__core__/graphics/empty.png",
-- priority = "high",
-- width = 1,
-- height = 1,
-- frame_count = 1
-- }
-- },
-- created_effect =
-- {
-- type = "direct",
-- action_delivery =
-- {
-- type = "instant",
-- target_effects =
-- {
-- {
-- type = "create-entity",
-- entity_name = "assembling-machine-1"
-- }
-- }
-- }
-- }
-- }
-- })
2019-02-14 07:53:31 +02:00
-- poison biters
buildUnitSpawner(
{
unit = {
name = "poison-biter",
loot = biterLoot,
attributes = {
},
attack = {
damageType = "poison"
},
resistances = {},
type = "biter",
2019-11-04 08:19:22 +02:00
tint = {r=0.4, g=0.6, b=0.5, a=1},
tint2 = {r=0, g=0.7, b=0, a=1}
2019-02-14 07:53:31 +02:00
},
unitSpawner = {
2019-05-10 02:46:57 +02:00
name = "poison-biter-spawner",
2019-02-14 07:53:31 +02:00
loot = spawnerLoot,
attributes = {},
resistances = {},
2019-11-04 08:19:22 +02:00
tint = {r=0.4, g=0.6, b=0.5, a=1},
tint2 = {r=0, g=0.7, b=0, a=1}
2019-02-14 07:53:31 +02:00
}
},
{
unit = {
2019-11-04 08:19:22 +02:00
bloodFountains,
2019-02-14 07:53:31 +02:00
{
2019-11-04 08:19:22 +02:00
type = "majorResistances",
entries = {"poison"}
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "minorResistances",
entries = {"fire"}
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "minorWeaknesses",
entries = {"electric", "explosion", "laser"}
2019-02-14 07:53:31 +02:00
}
},
unitSpawner = {
2019-11-04 08:19:22 +02:00
bloodFountains,
2019-03-12 08:03:26 +02:00
{
type = "attribute",
name = "evolutionRequirement",
2019-11-04 08:19:22 +02:00
formula = evolutionFunction
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "majorResistances",
entries = {"poison"}
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "minorResistances",
entries = {"fire"}
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "minorWeaknesses",
entries = {"electric", "explosion", "laser"}
2019-02-14 07:53:31 +02:00
}
}
},
2019-11-04 08:19:22 +02:00
createMeleeAttack
2019-02-14 07:53:31 +02:00
)
-- poison worms
buildWorm(
{
name = "poison-worm",
loot = wormLoot,
attributes = {
},
attack = {
type = "projectile",
damageType = "poison",
pointEffects = function(attributes)
2019-11-04 08:19:22 +02:00
return
{
2019-02-14 07:53:31 +02:00
{
type="create-entity",
entity_name = attributes.cloud
}
}
end
},
resistances = {},
attackName = "poison-worm",
2019-11-04 08:19:22 +02:00
tint = {r=0.4, g=0.6, b=0.5, a=1},
tint2 = {r=0, g=0.7, b=0, a=1}
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
bloodFountains,
2019-02-14 07:53:31 +02:00
{
type = "attack",
mapping = "cloud",
[1] = "poison-cloud-v1-cloud-rampant",
[2] = "poison-cloud-v2-cloud-rampant",
[3] = "poison-cloud-v3-cloud-rampant",
[4] = "poison-cloud-v4-cloud-rampant",
[5] = "poison-cloud-v5-cloud-rampant",
[6] = "poison-cloud-v6-cloud-rampant",
[7] = "poison-cloud-v7-cloud-rampant",
[8] = "poison-cloud-v8-cloud-rampant",
[9] = "poison-cloud-v9-cloud-rampant",
[10] = "poison-cloud-v10-cloud-rampant"
},
2019-03-12 08:03:26 +02:00
{
type = "attribute",
name = "evolutionRequirement",
2019-11-04 08:19:22 +02:00
formula = evolutionFunction
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "majorResistances",
entries = {"poison"}
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "minorResistances",
entries = {"fire"}
2019-02-14 07:53:31 +02:00
},
{
2019-11-04 08:19:22 +02:00
type = "minorWeaknesses",
entries = {"electric", "explosion", "laser"}
2019-02-14 07:53:31 +02:00
}
},
function (attack, attributes, tier)
return createRangedAttack(attack,
createAttackBall(attack))
2019-11-04 08:19:22 +02:00
end
2019-02-14 07:53:31 +02:00
)
end
return poison