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

FACTO-75: Fixed siege and aggressive squad counter and cleanup

This commit is contained in:
Aaron Veden 2022-03-19 19:57:36 -07:00
parent 35be753879
commit c0d2a8f70c
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
6 changed files with 11 additions and 12 deletions

View File

@ -3,7 +3,7 @@ Version: 3.0.0
improvement:
- Modified death pheromone squad path scoring
- AI is now per regional base
- Regional bases now have there own aggressive and siege squad counter
- Regional bases now have there own aggressive and siege squad counter and cleanup process
Tweaks:
- Added surface minime_dummy_dungeon and minime-preview-character to exclusion list
- Increased unit spawner cooldown by 2x

View File

@ -27,7 +27,6 @@ local chunkPropertyUtils = require("ChunkPropertyUtils")
local unitGroupUtils = require("UnitGroupUtils")
local movementUtils = require("MovementUtils")
local mathUtils = require("MathUtils")
local baseUtils = require("BaseUtils")
-- constants

View File

@ -55,6 +55,7 @@ local MINIMUM_AI_POINTS = constants.MINIMUM_AI_POINTS
local AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION
local AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION
local ACTIVE_NESTS_PER_AGGRESSIVE_GROUPS = constants.ACTIVE_NESTS_PER_AGGRESSIVE_GROUPS
local ALL_NESTS_PER_SIEGE_GROUPS = constants.ALL_NESTS_PER_SIEGE_GROUPS
local BASE_AI_STATE_PEACEFUL = constants.BASE_AI_STATE_PEACEFUL
local BASE_AI_STATE_AGGRESSIVE = constants.BASE_AI_STATE_AGGRESSIVE
@ -136,14 +137,8 @@ end
local function processBase(universe, base, tick)
if (base.canAttackTick < tick) then
base.maxAggressiveGroups = mCeil(base.activeNests / ACTIVE_NESTS_PER_AGGRESSIVE_GROUPS)
base.sentAggressiveGroups = 0
base.canAttackTick = randomTickEvent(universe.random,
tick,
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
end
base.maxAggressiveGroups = mCeil(base.activeNests / ACTIVE_NESTS_PER_AGGRESSIVE_GROUPS)
base.maxSiegeGroups = mCeil((base.activeNests + base.activeRaidNests) / ALL_NESTS_PER_SIEGE_GROUPS)
local points = (AI_POINT_GENERATOR_AMOUNT * universe.random()) +
(base.activeNests * 0.144) +
@ -351,7 +346,7 @@ local function temperamentPlanner(base, evolutionLevel)
base.surface.name .. "]" .. ", aS:" .. universe.squadCount .. ", aB:" .. universe.builderCount ..
", atkSize:" .. universe.attackWaveSize .. ", stlSize:" .. universe.settlerWaveSize ..
", formGroup:" .. universe.formSquadThreshold .. ", sAgg:".. base.sentAggressiveGroups ..
", mAgg:" .. base.maxAggressiveGroups .. ", baseState:" .. base.generationState ..
", mAgg:" .. base.maxAggressiveGroups .. ", baseState:" .. base.stateGeneration ..
", baseId:".. base.id)
end
end

View File

@ -486,7 +486,6 @@ function baseUtils.createBase(map, chunk, tick)
unitPoints = 0,
stateAI = BASE_AI_STATE_PEACEFUL,
stateAITick = 0,
canAttackTick = 0,
maxAggressiveGroups = 0,
sentAggressiveGroups = 0,
maxSiegeGroups = 0,

View File

@ -160,6 +160,7 @@ constants.BASE_GENERATION_STATE_ACTIVE = 1
-- constants.BASE_AI_STATE_MUTATE = 3
constants.ACTIVE_NESTS_PER_AGGRESSIVE_GROUPS = 30
constants.ALL_NESTS_PER_SIEGE_GROUPS = 150
constants.AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = 0.5
constants.AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION = 3

View File

@ -45,6 +45,7 @@ local SQUAD_GUARDING = constants.SQUAD_GUARDING
local SQUAD_RETREATING = constants.SQUAD_RETREATING
local BASE_AI_STATE_SIEGE = constants.BASE_AI_STATE_SIEGE
local BASE_AI_STATE_AGGRESSIVE = constants.BASE_AI_STATE_AGGRESSIVE
local PLAYER_PHEROMONE_MULTIPLER = constants.PLAYER_PHEROMONE_MULTIPLER
@ -446,6 +447,10 @@ function squadAttack.cleanSquads(universe, tick)
universe.builderCount = universe.builderCount - 1
else
universe.squadCount = universe.squadCount - 1
if squad.type == BASE_AI_STATE_AGGRESSIVE then
local base = squad.base
base.sentAggressiveGroups = base.sentAggressiveGroups - 1
end
end
squads[groupId] = nil
elseif (group.state == 4) then