1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-26 20:54:12 +02:00

need to figure out spawner scaling and fix spitter. remove autoplace

it is too slow
This commit is contained in:
Aaron Veden 2018-01-18 23:25:32 -08:00
parent ccfdeec5c4
commit 3b7746614c
10 changed files with 995 additions and 498 deletions

View File

@ -113,6 +113,38 @@ local function unitSetToProbabilityTable(points, upgradeTable, unitSet)
return result
end
local function processUpgradeTable(upgradeTable)
for i=1,#upgradeTable do
local bonuses = upgradeTable[i]
for ii=1,#bonuses do
local bonus = bonuses[ii]
if (bonus.type == "attribute") or (bonus.type == "attack") then
if not bonus.mapping then
for x = 1, #bonus do
bonus[x] = bonus[x] * 0.10
end
end
elseif (bonus.type == "resistance") then
if bonus.decrease then
for x = 1, #bonus.decrease do
bonus.decrease[x] = bonus.decrease[x] * 0.10
end
end
if bonus.percent then
for x = 1, #bonus.percent do
bonus.percent[x] = bonus.percent[x] * 0.10
end
end
end
end
end
return upgradeTable
end
local function upgradeEntity(points, entity, upgradeTable, tier)
local remainingPoints = points
if upgradeTable then
@ -127,7 +159,7 @@ local function upgradeEntity(points, entity, upgradeTable, tier)
entity.attributes[bonus.name] = bonus.mapping[entity.attributes[bonus.name] or "default"]
else
local adj = bonus[tier]
adj = gaussianRandomRangeRG(adj, adj * 0.2, adj * 0.75, adj * 1.25, xorRandom)
adj = gaussianRandomRangeRG(adj, adj * 0.2, adj * 0.875, adj * 1.25, xorRandom)
entity.attributes[bonus.name] = (entity.attributes[bonus.name] or 0) + adj
end
end
@ -155,8 +187,8 @@ local function upgradeEntity(points, entity, upgradeTable, tier)
-- adj = -adj
-- adj = -gaussianRandomRangeRG(adj, adj * 0.2, adj * 0.75, adj * 1.25, xorRandom)
-- else
adj = gaussianRandomRangeRG(adj, adj * 0.2, adj * 0.75, adj * 1.25, xorRandom)
--end
adj = gaussianRandomRangeRG(adj, adj * 0.2, adj * 0.875, adj * 1.25, xorRandom)
--end
entity.attack[bonus.name] = (entity.attack[bonus.name] or 0) + adj
end
end
@ -167,36 +199,26 @@ local function upgradeEntity(points, entity, upgradeTable, tier)
end
end
local function generateApperance(unit, tier)
local scale = gaussianRandomRangeRG(unit.scale, unit.scale * 0.12, unit.scale * 0.60, unit.scale * 1.40, xorRandom) + (0.05 * tier)
local r,g,b,a
local function calculateRGBa(tint, tier)
local r = gaussianRandomRangeRG(tint.r, tint.r * 0.10 + (0.005 * tier), mMax(tint.r * 0.85 - (0.005 * tier), 0), mMin(tint.r * 1.15, 1), xorRandom)
local g = gaussianRandomRangeRG(tint.g, tint.g * 0.10 + (0.005 * tier), mMax(tint.g * 0.85 - (0.005 * tier), 0), mMin(tint.g * 1.15, 1), xorRandom)
local b = gaussianRandomRangeRG(tint.b, tint.b * 0.10 + (0.005 * tier), mMax(tint.b * 0.85 - (0.005 * tier), 0), mMin(tint.b * 1.15, 1), xorRandom)
local a = gaussianRandomRangeRG(tint.a, tint.a * 0.10 + (0.005 * tier), mMax(tint.a * 0.85 - (0.005 * tier), 0), mMin(tint.a * 1.15, 1), xorRandom)
if unit.tint then
r = gaussianRandomRangeRG(unit.tint.r, unit.tint.r * 0.10 + (0.005 * tier), mMax(unit.tint.r * 0.85 - (0.005 * tier), 0), mMin(unit.tint.r * 1.15, 1), xorRandom)
g = gaussianRandomRangeRG(unit.tint.g, unit.tint.g * 0.10 + (0.005 * tier), mMax(unit.tint.g * 0.85 - (0.005 * tier), 0), mMin(unit.tint.g * 1.15, 1), xorRandom)
b = gaussianRandomRangeRG(unit.tint.b, unit.tint.b * 0.10 + (0.005 * tier), mMax(unit.tint.b * 0.85 - (0.005 * tier), 0), mMin(unit.tint.b * 1.15, 1), xorRandom)
a = gaussianRandomRangeRG(unit.tint.a, unit.tint.a * 0.10 + (0.005 * tier), mMax(unit.tint.a * 0.85 - (0.005 * tier), 0), mMin(unit.tint.a * 1.15, 1), xorRandom)
local tint = { r=r, g=g, b=b, a=a }
return { r=r, g=g, b=b, a=a }
end
local function generateApperance(unit, tier)
local scaleValue = unit.scale[tier]
local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.12, scaleValue * 0.60, scaleValue * 1.40, xorRandom) + (0.05 * tier)
if unit.tint then
unit.attributes.scale = scale
unit.attributes.tint = tint
else
r = gaussianRandomRangeRG(unit.tint1.r, unit.tint1.r * 0.10 + (0.005 * tier), mMax(unit.tint1.r * 0.85 - (0.005 * tier), 0), mMin(unit.tint1.r * 1.15, 1), xorRandom)
g = gaussianRandomRangeRG(unit.tint1.g, unit.tint1.g * 0.10 + (0.005 * tier), mMax(unit.tint1.g * 0.85 - (0.005 * tier), 0), mMin(unit.tint1.g * 1.15, 1), xorRandom)
b = gaussianRandomRangeRG(unit.tint1.b, unit.tint1.b * 0.10 + (0.005 * tier), mMax(unit.tint1.b * 0.85 - (0.005 * tier), 0), mMin(unit.tint1.b * 1.15, 1), xorRandom)
a = gaussianRandomRangeRG(unit.tint1.a, unit.tint1.a * 0.10 + (0.005 * tier), mMax(unit.tint1.a * 0.85 - (0.005 * tier), 0), mMin(unit.tint1.a * 1.15, 1), xorRandom)
unit.attributes.tint = calculateRGBa(unit.tint, tier)
else
local tint1 = calculateRGBa(unit.tint1, tier)
local tint2 = calculateRGBa(unit.tint2, tier)
local tint1 = { r=r, g=g, b=b, a=a }
r = gaussianRandomRangeRG(unit.tint2.r, unit.tint2.r * 0.10 + (0.005 * tier), mMax(unit.tint2.r * 0.85 - (0.005 * tier), 0), mMin(unit.tint2.r * 1.15, 1), xorRandom)
g = gaussianRandomRangeRG(unit.tint2.g, unit.tint2.g * 0.10 + (0.005 * tier), mMax(unit.tint2.g * 0.85 - (0.005 * tier), 0), mMin(unit.tint2.g * 1.15, 1), xorRandom)
b = gaussianRandomRangeRG(unit.tint2.b, unit.tint2.b * 0.10 + (0.005 * tier), mMax(unit.tint2.b * 0.85 - (0.005 * tier), 0), mMin(unit.tint2.b * 1.15, 1), xorRandom)
a = gaussianRandomRangeRG(unit.tint2.a, unit.tint2.a * 0.10 + (0.005 * tier), mMax(unit.tint2.a * 0.85 - (0.005 * tier), 0), mMin(unit.tint2.a * 1.15, 1), xorRandom)
local tint2 = { r=r, g=g, b=b, a=a }
unit.attributes.scale = scale
unit.attributes.tint1 = tint1
unit.attributes.tint2 = tint2
@ -204,10 +226,19 @@ local function generateApperance(unit, tier)
unit.attack.scale = scale
unit.attack.tint1 = tint1
unit.attack.tint2 = tint2
if unit.pTint then
unit.attack.pTint = calculateRGBa(unit.pTint, tier)
end
if unit.sTint then
unit.attack.sTint = calculateRGBa(unit.sTint, tier)
end
if unit.smTint then
unit.attack.smTint = calculateRGBa(unit.smTint, tier)
end
end
end
local function buildUnits(startingPoints, template, attackGenerator, upgradeTable, variations, tiers, multipler)
local function buildUnits(startingPoints, template, attackGenerator, upgradeTable, variations, tiers)
local unitSet = {}
for t=1, tiers do
@ -219,6 +250,10 @@ local function buildUnits(startingPoints, template, attackGenerator, upgradeTabl
generateApperance(unit, t)
upgradeEntity(startingPoints, unit, upgradeTable, t)
if unit.attackName then
unit.attack.name = unit.attackName .. "-v" .. i .. "-t" .. t .. "-rampant"
end
local entity
if (unit.type == "spitter") then
entity = makeSpitter(unit.name,
@ -243,35 +278,8 @@ local function buildUnits(startingPoints, template, attackGenerator, upgradeTabl
return unitSet
end
local function processUpgradeTable(upgradeTable)
for i=1,#upgradeTable do
local bonus = upgradeTable[i]
if (bonus.type == "attribute") or (bonus.type == "attack") then
if not bonus.mapping then
for x = 1, #bonus do
bonus[x] = bonus[x] * 0.10
end
end
elseif (bonus.type == "resistance") then
if bonus.decrease then
for x = 1, #bonus.decrease do
bonus.decrease[x] = bonus.decrease[x] * 0.10
end
end
if bonus.percent then
for x = 1, #bonus.percent do
bonus.percent[x] = bonus.percent[x] * 0.10
end
end
end
end
return upgradeTable
end
function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, variations, tiers)
local unitPoints = #upgradeTable.units * 10
local unitPoints = #upgradeTable.unit * 10
local unitSpawnerPoints = #upgradeTable.unitSpawner * 10
local probabilityPoints = #upgradeTable.probabilityTable * 10
@ -296,6 +304,9 @@ function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, v
generateApperance(unitSpawner, t)
upgradeEntity(unitSpawnerPoints, unitSpawner, upgradeTable.unitSpawner, t)
if unitSpawner.autoplace then
unitSpawner.attributes["autoplace"] = unitSpawner.autoplace[t]
end
data:extend({
makeUnitSpawner(unitSpawner.name,
unitSpawner.attributes,
@ -318,7 +329,14 @@ function swarmUtils.buildWorm(template, upgradeTable, attackGenerator, variation
worm.name = worm.name .. "-v" .. i .. "-t" .. t .. "-rampant"
generateApperance(worm, t)
upgradeEntity(wormPoints, worm, upgradeTable, t)
if worm.attackName then
worm.attack.name = worm.attackName .. "-v" .. i .. "-t" .. t .. "-rampant"
end
if worm.autoplace then
worm.attributes["autoplace"] = worm.autoplace[t]
end
data:extend({
makeWorm(worm.name,
worm.attributes,

View File

@ -1,8 +1,10 @@
-- imports
local acidBall = require("prototypes/enemies/AttackAcidBall")
local biterUtils = require("prototypes/enemies/BiterUtils")
local swarmUtils = require("SwarmUtils")
local constants = require("libs/Constants")
local colorUtils = require("ColorUtils")
-- constants
@ -15,17 +17,16 @@ local NEUTRAL_NEST_VARIATIONS = constants.NEUTRAL_NEST_VARIATIONS
-- imported functions
local makeColor = colorUtils.makeColor
local buildUnitSpawner = swarmUtils.buildUnitSpawner
local createAcidBall = acidBall.createAcidBall
local createSuicideAttack = biterUtils.createSuicideAttack
local createMeleeAttack = biterUtils.createMeleeAttack
-- module code
-- suicide
-- buildUnitSpawner(
-- {
@ -200,7 +201,7 @@ local createMeleeAttack = biterUtils.createMeleeAttack
-- }
-- )
-- neutral
-- neutral biters
buildUnitSpawner(
{
unit = {
@ -213,37 +214,51 @@ buildUnitSpawner(
resistances = {},
type = "biter",
scale = 0.5,
scale = {
[1] = 0.5,
[2] = 0.6,
[3] = 0.7,
[4] = 0.8,
[5] = 0.9,
[6] = 1,
[7] = 1.1,
[8] = 1.2,
[9] = 1.3,
[10] = 1.4
},
tint1 = {r=0.56, g=0.46, b=0.42, a=0.65},
tint2 = {r=1, g=0.63, b=0, a=0.4}
},
unitSpawner = {
name = "neutral-biter-nest",
attributes = {
health = 300,
healing = 0.01,
unitsOwned = 7,
unitsToSpawn = 5,
spawingCooldownStart = 360,
spawingCooldownStop = 150,
attributes = {},
resistances = {},
scale = {
[1] = 0.5,
[2] = 0.6,
[3] = 0.7,
[4] = 0.8,
[5] = 0.9,
[6] = 1,
[7] = 1.1,
[8] = 1.2,
[9] = 1.3,
[10] = 1.4
},
resistances = {
explosion = {
decrease = 3,
percent = 10
},
physical = {
decrease = 1,
percent = 10
},
fire = {
decrease = 1.5,
percent = 40
}
autoplace = {
[1] = 0,
[2] = 2,
[3] = 3,
[4] = 4,
[5] = 5,
[6] = 6,
[7] = 7,
[8] = 8,
[9] = 9,
[10] = 10
},
scale = 1,
tint = {r=1.0, g=1.0, b=1.0, a=1.0}
}
},
@ -267,6 +282,57 @@ buildUnitSpawner(
}
},
{
{
type = "attack",
name = "cooldown",
[1] = 35,
[2] = 35,
[3] = 35,
[4] = 35,
[5] = 35,
[6] = 35,
[7] = 50,
[8] = 50,
[9] = 55,
[10] = 57
}
},
{
{
type = "attribute",
name = "spawningTimeModifer",
[1] = 0,
[2] = 0,
[3] = 1,
[4] = 2,
[5] = 3,
[6] = 7,
[7] = 10,
[8] = 10,
[9] = 12,
[10] = 12
}
},
{
{
type = "attribute",
name = "pollutionToAttack",
[1] = 200,
[2] = 750,
[3] = 1750,
[4] = 3500,
[5] = 5000,
[6] = 10000,
[7] = 20000,
[8] = 25000,
[9] = 30000,
[10] = 40000
}
},
{
{
type = "attack",
@ -283,21 +349,21 @@ buildUnitSpawner(
[10] = 200
}
},
{
{
type = "attribute",
name = "healing",
[1] = 0.01,
[2] = 0.01,
[3] = 0.012,
[4] = 0.013,
[5] = 0.014,
[6] = 0.016,
[7] = 0.017,
[8] = 0.02,
[9] = 0.022,
[10] = 0.028
[3] = 0.015,
[4] = 0.02,
[5] = 0.05,
[6] = 0.075,
[7] = 0.1,
[8] = 0.12,
[9] = 0.14,
[10] = 0.16
}
},
@ -353,12 +419,40 @@ buildUnitSpawner(
[2] = 0,
[3] = 0,
[4] = 10,
[5] = 10,
[6] = 10,
[5] = 12,
[6] = 12,
[7] = 13,
[8] = 13,
[9] = 14,
[10] = 15
}
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = 0,
[2] = 0,
[3] = 0,
[4] = 0,
[5] = 0,
[6] = 0,
[7] = 10,
[8] = 10,
[9] = 10,
[10] = 10
[8] = 12,
[9] = 14,
[10] = 15
},
percent = {
[1] = 0,
[2] = 0,
[3] = 0,
[4] = 10,
[5] = 12,
[6] = 12,
[7] = 13,
[8] = 13,
[9] = 14,
[10] = 15
}
}
},
@ -388,7 +482,16 @@ buildUnitSpawner(
{
type = "attribute",
name = "health",
adjustment = 50
[1] = 350,
[2] = 500,
[3] = 750,
[4] = 1500,
[5] = 2500,
[6] = 3500,
[7] = 5000,
[8] = 7000,
[9] = 10000,
[10] = 15000
}
},
@ -396,48 +499,101 @@ buildUnitSpawner(
{
type = "attribute",
name = "healing",
adjustment = 0.02
[1] = 0.02,
[2] = 0.02,
[3] = 0.022,
[4] = 0.024,
[5] = 0.026,
[6] = 0.028,
[7] = 0.03,
[8] = 0.032,
[9] = 0.034,
[10] = 0.036
}
},
{
{
type = "attribute",
name = "spawingCooldownStart",
adjustment = -10
},
{
type = "attribute",
name = "spawingCooldownEnd",
adjustment = -10
},
{
type = "attribute",
name = "evolutionRequirement",
adjustment = 0.01
[1] = 360,
[2] = 360,
[3] = 355,
[4] = 355,
[5] = 350,
[6] = 350,
[7] = 345,
[8] = 345,
[9] = 340,
[10] = 340
}
},
{
{
type = "attribute",
name = "unitsOwned",
adjustment = 2
},
{
type = "attribute",
name = "unitsToSpawn",
adjustment = 1
},
name = "spawingCooldownEnd",
[1] = 150,
[2] = 150,
[3] = 145,
[4] = 145,
[5] = 140,
[6] = 140,
[7] = 135,
[8] = 135,
[9] = 130,
[10] = 130
}
},
{
{
type = "attribute",
name = "evolutionRequirement",
adjustment = 0.01
[1] = 0,
[2] = 0.1,
[3] = 0.2,
[4] = 0.3,
[5] = 0.4,
[6] = 0.5,
[7] = 0.6,
[8] = 0.7,
[9] = 0.8,
[10] = 0.9
}
},
{
{
type = "attribute",
name = "unitsOwned",
[1] = 7,
[2] = 7,
[3] = 8,
[4] = 8,
[5] = 9,
[6] = 9,
[7] = 10,
[8] = 10,
[9] = 11,
[10] = 11
}
},
{
{
type = "attribute",
name = "unitsToSpawn",
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
},
{
@ -445,20 +601,86 @@ buildUnitSpawner(
{
type = "resistance",
name = "physical",
decrease = 0.5,
percent = 2
decrease = {
[1] = 2,
[2] = 2,
[3] = 4,
[4] = 4,
[5] = 6,
[6] = 6,
[7] = 10,
[8] = 12,
[9] = 12,
[10] = 14
},
percent = {
[1] = 15,
[2] = 15,
[3] = 17,
[4] = 17,
[5] = 18,
[6] = 18,
[7] = 19,
[8] = 19,
[9] = 20,
[10] = 20
}
},
{
type = "resistance",
name = "explosion",
decrease = 1,
percent = 2
decrease = {
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
percent = {
[1] = 15,
[2] = 15,
[3] = 17,
[4] = 17,
[5] = 18,
[6] = 18,
[7] = 19,
[8] = 19,
[9] = 20,
[10] = 20
}
},
{
type = "resistance",
name = "fire",
decrease = 0.7,
percent = 5
decrease = {
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 6,
[6] = 6,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
percent = {
[1] = 60,
[2] = 60,
[3] = 62,
[4] = 62,
[5] = 63,
[6] = 63,
[7] = 64,
[8] = 64,
[9] = 65,
[10] = 65
}
}
}
@ -492,20 +714,479 @@ buildUnitSpawner(
}
)
for k,v in pairs(data.raw.unit) do
print(k)
end
print(serpent.dump(data.raw.unit['neutral-biter-v1-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v2-t10-rampant']))
-- neutral spitters
buildUnitSpawner(
{
unit = {
name = "neutral-spitter",
print(serpent.dump(data.raw.unit['neutral-biter-v3-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v4-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v5-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v6-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v7-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v8-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v9-t1-rampant']))
print(serpent.dump(data.raw.unit['neutral-biter-v10-t1-rampant']))
attributes = {
explosion = "blood-explosion-small"
},
attack = {},
resistances = {},
--print(serpent.dump(data.raw.unit))
constants.et()
type = "spitter",
scale = {
[1] = 0.5,
[2] = 0.6,
[3] = 0.7,
[4] = 0.8,
[5] = 0.9,
[6] = 1,
[7] = 1.1,
[8] = 1.2,
[9] = 1.3,
[10] = 1.4
},
attackName = "acid-ball",
tint = {r=0.56, g=0.46, b=0.42, a=0.65},
pTint = {r=0, g=1, b=1, a=0.5},
sTint = {r=0, g=1, b=1, a=0.5},
smTint = makeColor(0.3, 0.75, 0.3, 0.1)
},
unitSpawner = {
name = "neutral-spitter-nest",
attributes = {},
resistances = {},
scale = {
[1] = 0.5,
[2] = 0.6,
[3] = 0.7,
[4] = 0.8,
[5] = 0.9,
[6] = 1,
[7] = 1.1,
[8] = 1.2,
[9] = 1.3,
[10] = 1.4
},
autoplace = {
[1] = 2,
[2] = 3,
[3] = 4,
[4] = 5,
[5] = 6,
[6] = 7,
[7] = 8,
[8] = 9,
[9] = 10,
[10] = 11
},
tint = {r=0.99, g=0.09, b=0.09, a=1}
}
},
{
unit = {
{
{
type = "attribute",
name = "health",
[1] = 10,
[2] = 50,
[3] = 200,
[4] = 350,
[5] = 750,
[6] = 1000,
[7] = 1500,
[8] = 1500,
[9] = 2500,
[10] = 4500
}
},
{
{
type = "attack",
name = "cooldown",
[1] = 100,
[2] = 100,
[3] = 97,
[4] = 97,
[5] = 95,
[6] = 95,
[7] = 93,
[8] = 93,
[9] = 90,
[10] = 90
}
},
{
{
type = "attribute",
name = "spawningTimeModifer",
[1] = 0,
[2] = 0,
[3] = 1,
[4] = 2,
[5] = 3,
[6] = 7,
[7] = 10,
[8] = 10,
[9] = 12,
[10] = 12
}
},
{
{
type = "attribute",
name = "pollutionToAttack",
[1] = 200,
[2] = 750,
[3] = 1200,
[4] = 1750,
[5] = 2500,
[6] = 5000,
[7] = 10000,
[8] = 12500,
[9] = 15000,
[10] = 20000
}
},
{
{
type = "attack",
name = "damage",
[1] = 4,
[2] = 9,
[3] = 14,
[4] = 23,
[5] = 30,
[6] = 37,
[7] = 45,
[8] = 57,
[9] = 70,
[10] = 80
}
},
{
{
type = "attribute",
name = "healing",
[1] = 0.01,
[2] = 0.01,
[3] = 0.015,
[4] = 0.02,
[5] = 0.05,
[6] = 0.075,
[7] = 0.1,
[8] = 0.12,
[9] = 0.14,
[10] = 0.16
}
},
{
{
type = "attribute",
name = "movement",
[1] = 0.185,
[2] = 0.18,
[3] = 0.18,
[4] = 0.17,
[5] = 0.17,
[6] = 0.16,
[7] = 0.16,
[8] = 0.15,
[9] = 0.15,
[10] = 0.14
},
{
type = "attribute",
name = "distancePerFrame",
[1] = 0.04,
[2] = 0.045,
[3] = 0.050,
[4] = 0.055,
[5] = 0.060,
[6] = 0.065,
[7] = 0.070,
[8] = 0.075,
[9] = 0.08,
[10] = 0.084
}
},
{
{
type = "resistance",
name = "explosion",
percent = {
[1] = 0,
[2] = 0,
[3] = 10,
[4] = 10,
[5] = 20,
[6] = 20,
[7] = 30,
[8] = 30,
[9] = 40,
[10] = 40
}
}
},
{
{
type = "attack",
name = "range",
[1] = 13,
[2] = 13,
[3] = 14,
[4] = 14,
[5] = 15,
[6] = 15,
[7] = 16,
[8] = 16,
[9] = 17,
[10] = 17
}
}
},
unitSpawner = {
{
{
type = "attribute",
name = "health",
[1] = 350,
[2] = 500,
[3] = 750,
[4] = 1500,
[5] = 2500,
[6] = 3500,
[7] = 5000,
[8] = 7000,
[9] = 10000,
[10] = 15000
}
},
{
{
type = "attribute",
name = "healing",
[1] = 0.02,
[2] = 0.02,
[3] = 0.022,
[4] = 0.024,
[5] = 0.026,
[6] = 0.028,
[7] = 0.03,
[8] = 0.032,
[9] = 0.034,
[10] = 0.036
}
},
{
{
type = "attribute",
name = "spawingCooldownStart",
[1] = 360,
[2] = 360,
[3] = 355,
[4] = 355,
[5] = 350,
[6] = 350,
[7] = 345,
[8] = 345,
[9] = 340,
[10] = 340
}
},
{
{
type = "attribute",
name = "spawingCooldownEnd",
[1] = 150,
[2] = 150,
[3] = 145,
[4] = 145,
[5] = 140,
[6] = 140,
[7] = 135,
[8] = 135,
[9] = 130,
[10] = 130
}
},
{
{
type = "attribute",
name = "evolutionRequirement",
[1] = 0,
[2] = 0.1,
[3] = 0.2,
[4] = 0.3,
[5] = 0.4,
[6] = 0.5,
[7] = 0.6,
[8] = 0.7,
[9] = 0.8,
[10] = 0.9
}
},
{
{
type = "attribute",
name = "unitsOwned",
[1] = 7,
[2] = 7,
[3] = 8,
[4] = 8,
[5] = 9,
[6] = 9,
[7] = 10,
[8] = 10,
[9] = 11,
[10] = 11
}
},
{
{
type = "attribute",
name = "unitsToSpawn",
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
},
{
{
type = "resistance",
name = "physical",
decrease = {
[1] = 2,
[2] = 2,
[3] = 4,
[4] = 4,
[5] = 6,
[6] = 6,
[7] = 10,
[8] = 12,
[9] = 12,
[10] = 14
},
percent = {
[1] = 15,
[2] = 15,
[3] = 17,
[4] = 17,
[5] = 18,
[6] = 18,
[7] = 19,
[8] = 19,
[9] = 20,
[10] = 20
}
},
{
type = "resistance",
name = "explosion",
decrease = {
[1] = 5,
[2] = 5,
[3] = 6,
[4] = 6,
[5] = 7,
[6] = 7,
[7] = 8,
[8] = 8,
[9] = 9,
[10] = 9
},
percent = {
[1] = 15,
[2] = 15,
[3] = 17,
[4] = 17,
[5] = 18,
[6] = 18,
[7] = 19,
[8] = 19,
[9] = 20,
[10] = 20
}
},
{
type = "resistance",
name = "fire",
decrease = {
[1] = 3,
[2] = 3,
[3] = 4,
[4] = 4,
[5] = 6,
[6] = 6,
[7] = 6,
[8] = 6,
[9] = 7,
[10] = 7
},
percent = {
[1] = 60,
[2] = 60,
[3] = 62,
[4] = 62,
[5] = 63,
[6] = 63,
[7] = 64,
[8] = 64,
[9] = 65,
[10] = 65
}
}
}
},
probabilityTable = {
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
[5] = 1,
[6] = 1,
[7] = 1,
[8] = 1,
[9] = 1,
[10] = 1,
}
},
createMeleeAttack,
{
unit = 10,
unitSpawner = NEUTRAL_NEST_VARIATIONS
},
{
unit = 10,
unitSpawner = NEUTRAL_NEST_TIERS
}
)

View File

@ -258,16 +258,16 @@ local function rebuildNativeTables()
local position = { x = 0, y = 0 }
for v = 1, SUICIDE_BITER_NEST_VARIATIONS do
for t = 1, SUICIDE_BITER_NEST_TIERS do
local entity = surface.create_entity({
name="suicide-biter-nest-v" .. v .. "-t" .. t .. "-rampant",
position = position
})
fileEntity(BASE_ALIGNMENT_SUICIDE, entity)
entity.destroy()
end
end
-- for v = 1, SUICIDE_BITER_NEST_VARIATIONS do
-- for t = 1, SUICIDE_BITER_NEST_TIERS do
-- local entity = surface.create_entity({
-- name="suicide-biter-nest-v" .. v .. "-t" .. t .. "-rampant",
-- position = position
-- })
-- fileEntity(BASE_ALIGNMENT_SUICIDE, entity)
-- entity.destroy()
-- end
-- end
for v=1,NEUTRAL_NEST_VARIATIONS do
for t=1,NEUTRAL_NEST_TIERS do
local entity = surface.create_entity({

View File

@ -1,5 +1,21 @@
local stringUtils = require("libs/StringUtils")
local vanillaBuildings = require("prototypes/buildings/UpdatesVanilla")
local isRampant = stringUtils.isRampant
if settings.startup["rampant-newEnemies"].value then
for k,v in pairs(data.raw["unit-spawner"]) do
if not isRampant(k) then
v.autoplace = nil
end
end
for k,v in pairs(data.raw["turret"]) do
if not isRampant(k) then
v.autoplace = nil
end
end
end
if settings.startup["rampant-enableSwarm"] then
for k, unit in pairs(data.raw["unit"]) do
if (string.find(k, "biter") or string.find(k, "spitter")) and unit.collision_box then

View File

@ -1,12 +1,15 @@
require("prototypes/enemies/AttackAcidBall")
require("prototypes/enemies/AttackAcidFlame")
local acidBall = require("prototypes/enemies/AttackAcidBall")
require("prototypes/buildings/tunnel")
require("prototypes/buildings/UnitSpawners")
if settings.startup["rampant-useDumbProjectiles"].value then
acidBall.generateLegacy()
end
require("prototypes/tile/fillableDirt")
-- require("prototypes/enemies/AttackAcidFlame")
-- require("prototypes/buildings/tunnel")
require("prototypes/buildings/ChunkScanner")
-- require("prototypes/tile/fillableDirt")
if settings.startup["rampant-newEnemies"].value then
require("UnitClasses")

View File

@ -1,7 +1,7 @@
local stringUtils = {}
function stringUtils.isRampant(str)
return (string.sub(str,1,7) == "rampant")
return stringUtils.ends(str, "rampant")
end
function stringUtils.starts(str, start)

View File

@ -0,0 +1,62 @@
data:extend({
{
type = "container",
name = "chunk-scanner-ns-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_mask = {"player-layer", "object-layer", "water-tile"},
collision_box = {{-0.5, 0}, {0, 32}},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
priority = "extra-high",
width = 46,
height = 33,
shift = {0.25, 0.015625}
},
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
},
{
type = "container",
name = "chunk-scanner-ew-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_box = {{0, -0.5}, {32, 0}},
collision_mask = {"player-layer", "object-layer", "water-tile"},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
priority = "extra-high",
width = 46,
height = 33,
shift = {0.25, 0.015625}
},
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
}
})

View File

@ -1,251 +0,0 @@
function spawner_idle_animation(variation, tint)
return
{
layers =
{
{
filename = "__base__/graphics/entity/spawner/spawner-idle.png",
line_length = 8,
width = 243,
height = 181,
frame_count = 8,
animation_speed = 0.18,
direction_count = 1,
run_mode = "forward-then-backward",
shift = {0.140625 - 0.65, -0.234375},
y = variation * 181
},
{
filename = "__base__/graphics/entity/spawner/spawner-idle-mask.png",
flags = { "mask" },
width = 166,
height = 148,
frame_count = 8,
animation_speed = 0.18,
run_mode = "forward-then-backward",
shift = {-0.34375 - 0.65, -0.375},
line_length = 8,
tint = tint,
y = variation * 148
}
}
}
end
function spawner_die_animation(variation, tint)
return
{
layers =
{
{
width = 255,
height = 184,
frame_count = 20,
direction_count = 1,
shift = {-0.015625 - 0.65, -0.28125},
stripes =
{
{
filename = "__base__/graphics/entity/spawner/spawner-die-01.png",
width_in_frames = 7,
height_in_frames = 4,
y = variation * 184
},
{
filename = "__base__/graphics/entity/spawner/spawner-die-02.png",
width_in_frames = 7,
height_in_frames = 4,
y = variation * 184
},
{
filename = "__base__/graphics/entity/spawner/spawner-die-03.png",
width_in_frames = 6,
height_in_frames = 4,
y = variation * 184
}
}
},
{
flags = { "mask" },
width = 166,
height = 148,
frame_count = 20,
direction_count = 1,
shift = {-0.34375 - 0.65, -0.375},
tint = tint,
stripes =
{
{
filename = "__base__/graphics/entity/spawner/spawner-die-mask-01.png",
width_in_frames = 10,
height_in_frames = 4,
y = variation * 148
},
{
filename = "__base__/graphics/entity/spawner/spawner-die-mask-02.png",
width_in_frames = 10,
height_in_frames = 4,
y = variation * 148
}
}
}
}
}
end
local biter_spawner_powered_tint = {r=1.0, g=0, b=0, a=1.0}
data:extend({
{
type = "unit-spawner",
name = "biter-spawner-hive-rampant",
icon = "__base__/graphics/icons/biter-spawner.png",
icon_size = 32,
flags = {"placeable-player", "placeable-enemy", "not-repairable"},
max_health = 350,
order="b-b-g",
subgroup="enemies",
resistances =
{
{
type = "physical",
decrease = 2,
percent = 15
},
{
type = "explosion",
decrease = 5,
percent = 15,
},
{
type = "fire",
decrease = 3,
percent = 60,
}
},
working_sound = {
sound =
{
{
filename = "__base__/sound/creatures/spawner.ogg",
volume = 1.0
}
},
apparent_volume = 2
},
dying_sound =
{
{
filename = "__base__/sound/creatures/spawner-death-1.ogg",
volume = 1.0
},
{
filename = "__base__/sound/creatures/spawner-death-2.ogg",
volume = 1.0
}
},
healing_per_tick = 0.02,
collision_box = {{-6, -6}, {6, 6}},
selection_box = {{-6, -6}, {6, 6}},
-- in ticks per 1 pu
pollution_absorbtion_absolute = 20,
pollution_absorbtion_proportional = 0.01,
corpse = "biter-spawner-corpse",
dying_explosion = "blood-explosion-huge",
max_count_of_owned_units = 7,
max_friends_around_to_spawn = 5,
animations =
{
spawner_idle_animation(0, biter_spawner_powered_tint),
spawner_idle_animation(1, biter_spawner_powered_tint),
spawner_idle_animation(2, biter_spawner_powered_tint),
spawner_idle_animation(3, biter_spawner_powered_tint)
},
result_units = (function()
local res = {}
res[1] = {"small-biter", {{0.0, 0.3}, {0.6, 0.0}}}
if not data.is_demo then
-- from evolution_factor 0.3 the weight for medium-biter is linearly rising from 0 to 0.3
-- this means for example that when the evolution_factor is 0.45 the probability of spawning
-- a small biter is 66% while probability for medium biter is 33%.
res[2] = {"medium-biter", {{0.2, 0.0}, {0.6, 0.3}, {0.7, 0.1}}}
-- for evolution factor of 1 the spawning probabilities are: small-biter 0%, medium-biter 1/8, big-biter 4/8, behemoth biter 3/8
res[3] = {"big-biter", {{0.5, 0.0}, {1.0, 0.4}}}
res[4] = {"behemoth-biter", {{0.9, 0.0}, {1.0, 0.3}}}
end
return res
end)(),
-- With zero evolution the spawn rate is 6 seconds, with max evolution it is 2.5 seconds
spawning_cooldown = {360, 150},
spawning_radius = 10,
spawning_spacing = 3,
max_spawn_shift = 0,
max_richness_for_spawn_shift = 100,
call_for_help_radius = 50
},
{
type = "container",
name = "chunk-scanner-ns-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_mask = {"player-layer", "object-layer", "water-tile"},
collision_box = {{-0.5, 0}, {0, 32}},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
priority = "extra-high",
width = 46,
height = 33,
shift = {0.25, 0.015625}
},
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
},
{
type = "container",
name = "chunk-scanner-ew-rampant",
icon = "__base__/graphics/icons/wooden-chest.png",
icon_size = 32,
flags = {},
collision_box = {{0, -0.5}, {32, 0}},
collision_mask = {"player-layer", "object-layer", "water-tile"},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
fast_replaceable_group = "container",
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
priority = "extra-high",
width = 46,
height = 33,
shift = {0.25, 0.015625}
},
circuit_wire_connection_point = circuit_connector_definitions["chest"].points,
circuit_connector_sprites = circuit_connector_definitions["chest"].sprites,
circuit_wire_max_distance = default_circuit_wire_max_distance
}
})

View File

@ -9,96 +9,64 @@ local makeStream = streamUtils.makeStream
local makeColor = colorUtils.makeColor
-- dumb acid projectiles
local acidBall = {}
local templateDamage = { amount = 4, type = "acid" }
local templateArea = {
type = "area",
radius = 1.2,
action_delivery =
{
function acidBall.createAcidBall(attributes)
local templateDamage = { amount = attributes.damage, type = "acid" }
local templateArea = {
type = "area",
radius = attributes.radius,
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "instant",
target_effects =
{
type = "damage",
damage = templateDamage
{
type = "damage",
damage = templateDamage
}
}
}
}
}
}
}
}
local templateActions = {
templateArea,
{
type = "direct",
action_delivery = {
type = "instant",
target_effects = {
type= "create-entity",
entity_name = "acid-splash-purple"
local templateActions = {
templateArea,
{
type = "direct",
action_delivery = {
type = "instant",
target_effects = {
type= "create-entity",
entity_name = "acid-splash-purple"
}
}
}
}
}
local template = {
name = "acid-ball",
particleTint = {r=0, g=1, b=1, a=0.5},
spineAnimationTint = {r=0, g=1, b=1, a=0.5},
softSmokeTint = makeColor(0.3, 0.75, 0.3, 0.1),
actions = templateActions
}
local template = {
name = attributes.name,
particleTint = attributes.pTint,
spineAnimationTint = attributes.sTint,
softSmokeTint = attributes.smTint,
actions = templateActions
}
makeStream(template)
makeStream(template)
end
--
function acidBall.generateLegacy()
acidBall.createAcidBall({name="acid-ball", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=4, radius=1.2})
acidBall.createAcidBall({name="acid-ball-1", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=9, radius=1.3})
acidBall.createAcidBall({name="acid-ball-2", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=14, radius=1.4})
acidBall.createAcidBall({name="acid-ball-3", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=23, radius=1.5})
acidBall.createAcidBall({name="wide-acid-ball", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=18, radius=3})
acidBall.createAcidBall({name="acid-ball-4", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=25, radius=1.75})
acidBall.createAcidBall({name="acid-ball-5", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=50, radius=2})
acidBall.createAcidBall({name="acid-ball-6", pTint={r=0, g=1, b=1, a=0.5}, sTint={r=0, g=1, b=1, a=0.5}, smTint=makeColor(0.3, 0.75, 0.3, 0.1), damage=70, radius=2.5})
end
template.name = "acid-ball-1"
templateDamage.amount = 9
templateArea.radius = 1.3
makeStream(template)
--
template.name = "acid-ball-2"
templateDamage.amount = 14
templateArea.radius = 1.4
makeStream(template)
--
template.name = "acid-ball-3"
templateDamage.amount = 23
templateArea.radius = 1.5
makeStream(template)
--
template.name = "wide-acid-ball"
templateDamage.amount = 18
templateArea.radius = 3
makeStream(template)
--
template.name = "acid-ball-4"
templateDamage.amount = 25
templateArea.radius = 1.75
makeStream(template)
--
template.name = "acid-ball-5"
templateDamage.amount = 50
templateArea.radius = 2
makeStream(template)
--
template.name = "acid-ball-6"
templateDamage.amount = 70
templateArea.radius = 2.5
makeStream(template)
return acidBall

View File

@ -72,9 +72,9 @@ function biterFunctions.makeSpitter(name, biterAttributes, biterAttack, biterRes
distraction_cooldown = biterAttributes.distractionCooldown or 300,
corpse = biterAttributes.corpse,
dying_explosion = biterAttributes.explosion,
dying_sound = make_biter_dying_sounds(1.0),
dying_sound = make_spitter_dying_sounds(0.8),
working_sound = make_biter_calls(0.7),
run_animation = spitterrunanimation(biterAttributes.scale, biterAttributes.tint1, biterAttributes.tint2)
run_animation = spitterrunanimation(biterAttributes.scale, biterAttributes.tint)
}
end
@ -313,7 +313,7 @@ function biterFunctions.createMeleeAttack(attributes)
{
type = "projectile",
range = attributes.range or 0.5,
cooldown = attributes.cooldown or 30,
cooldown = attributes.cooldown or 35,
ammo_category = "melee",
ammo_type = {
category = "melee",
@ -428,7 +428,7 @@ function biterFunctions.createFireAttack(attributes, fireAttack)
}
}
if (attributes.tint1 ~= nil) then
if (attributes.tint ~= nil) then
attack.animation = spitterattackanimation(attributes.scale,
attributes.tint1,
attributes.tint2)