1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

Optimized energy thief attack

This commit is contained in:
Aaron Veden 2021-12-11 12:46:56 -08:00
parent 58bfbcce6b
commit ac7003faef
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
4 changed files with 47 additions and 13 deletions

View File

@ -13,7 +13,7 @@ Date: 23. 11. 2021
- Optimized adding new chunks to the Rampant in-memory state map
- Added minimum building cost upgrade check before base upgrade performs scanning
- Added max number of wander commands in a row for squads that aren't going anywhere before disbanding squad
- Optimized energy thief faction
- Optimized energy thief faction by switch to electric AOE projectile
- Factorissimo, Space Exploration Orbits, asteroid belts, secret maps, starmap, AAI-signal, NiceFill, Blueprint lab surfaces are no longer processed
- Map processing around player now changes to the surface the player is standing on
- Squads now get processed regardless of the current active map being processed

View File

@ -599,7 +599,7 @@ end
local function onTriggerEntityCreated(event)
if (event.effect_id == "rampant-drain-trigger") then
local entity = event.target_entity
if (entity.valid) then
if (entity and entity.valid) then
local map = universe.maps[event.surface_index]
if not map then
return
@ -608,6 +608,15 @@ local function onTriggerEntityCreated(event)
if (chunk ~= -1) then
setDrainedTick(map, chunk, event.tick)
end
elseif (event.target_position) then
local map = universe.maps[event.surface_index]
if not map then
return
end
local chunk = getChunkByPosition(map, event.target_position)
if (chunk ~= -1) then
setDrainedTick(map, chunk, event.tick)
end
end
end
end

View File

@ -1390,7 +1390,7 @@ if settings.startup["rampant--energyThiefEnemy"].value then
units = {
{
type = "biter",
attackAttributes = {"beam", "electric", "drainCrystal"},
attackAttributes = {"spit", "electric", "drainCrystal"},
name = "biter",
majorResistances = {"electric", "laser"},
minorResistances = {},

View File

@ -149,6 +149,13 @@ local clusterAttackNumeric = {
["startingSpeed"] = { 0.25, 0.25, 0.27, 0.27, 0.29, 0.29, 0.31, 0.31, 0.33, 0.33 }
}
local liteClusterAttackNumeric = {
["clusterDistance"] = { 2, 2, 3, 3, 3, 4, 4, 4, 5, 5 },
["clusters"] = { 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 },
["startingSpeed"] = { 0.25, 0.25, 0.27, 0.27, 0.29, 0.29, 0.31, 0.31, 0.33, 0.33 },
["damage"] = { 4, 7.5, 11.25, 15, 22.5, 27.5, 32.5, 37.5, 42.5, 47.5 }
}
local biterAttributeNumeric = {
["range"] = { 0.5, 0.5, 0.75, 0.75, 1.0, 1.0, 1.25, 1.50, 1.75, 2.0 },
["radius"] = { 0.5, 0.65, 0.75, 0.85, 0.95, 1.1, 1.2, 1.3, 1.4, 1.5 },
@ -914,21 +921,39 @@ local function buildAttack(faction, template)
attack.tint2)) or nil)
end
elseif (attack == "drainCrystal") then
template.actions = function(attributes, electricBeam)
template.range = { 6, 6, 7, 7, 8, 8, 9, 9, 10, 10 }
template.addon[#template.addon+1] = liteClusterAttackNumeric
template.attackPointEffects = function(attributes)
return
{
{
type = "instant",
target_effects =
{
type = "script",
effect_id = "rampant-drain-trigger"
}
type = "script",
effect_id = "rampant-drain-trigger"
},
{
type = "beam",
beam = electricBeam or "electric-beam",
duration = attributes.duration * 2
type = "damage",
damage = { type="laser", amount = attributes.damage }
},
{
type="nested-result",
action = {
{
type = "cluster",
cluster_count = attributes.clusters,
distance = attributes.clusterDistance,
distance_deviation = 1,
action_delivery =
{
type = "projectile",
projectile = makeLaser(attributes),
duration = 20,
direction_deviation = 0.6,
starting_speed = attributes.startingSpeed,
starting_speed_deviation = 0.3
},
repeat_count = 2
}
}
}
}
end