Skip to content

Commit

Permalink
FACTO-127: moved enemy phermone multipler to pheromone processor
Browse files Browse the repository at this point in the history
instead of squads movement
  • Loading branch information
veden committed May 8, 2022
1 parent 4c7ea51 commit dfc2eb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion libs/PheromoneUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ local chunkPropertyUtils = require("ChunkPropertyUtils")

-- constants

local ENEMY_PHEROMONE_MULTIPLER = constants.ENEMY_PHEROMONE_MULTIPLER
local VICTORY_SCENT_MULTIPLER = constants.VICTORY_SCENT_MULTIPLER
local VICTORY_SCENT_BOUND = constants.VICTORY_SCENT_BOUND

Expand Down Expand Up @@ -377,7 +378,7 @@ function pheromoneUtils.processStaticPheromone(map, chunk)
chunk[BASE_PHEROMONE] = chunkBase * chunkPathRating
end

pheromone = getNestCount(map, chunk) + getHiveCount(map, chunk)
pheromone = (getNestCount(map, chunk) + getHiveCount(map, chunk)) * ENEMY_PHEROMONE_MULTIPLER
if chunkEnemy < pheromone then
chunk[ENEMY_PHEROMONE] = pheromone * chunkPathRating
else
Expand Down
9 changes: 4 additions & 5 deletions libs/SquadAttack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ 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
local ENEMY_PHEROMONE_MULTIPLER = constants.ENEMY_PHEROMONE_MULTIPLER

local DEFINES_DISTRACTION_NONE = defines.distraction.none
local DEFINES_DISTRACTION_BY_ENEMY = defines.distraction.by_enemy
Expand Down Expand Up @@ -92,14 +91,14 @@ local function scoreResourceLocationKamikaze(_, neighborChunk)
local settle = neighborChunk[RESOURCE_PHEROMONE]
return settle
- (neighborChunk[PLAYER_PHEROMONE] * PLAYER_PHEROMONE_MULTIPLER)
- (neighborChunk[ENEMY_PHEROMONE] * ENEMY_PHEROMONE_MULTIPLER)
- neighborChunk[ENEMY_PHEROMONE]
end

local function scoreSiegeLocationKamikaze(_, neighborChunk)
local settle = neighborChunk[BASE_PHEROMONE]
+ neighborChunk[RESOURCE_PHEROMONE]
+ (neighborChunk[PLAYER_PHEROMONE] * PLAYER_PHEROMONE_MULTIPLER)
- (neighborChunk[ENEMY_PHEROMONE] * ENEMY_PHEROMONE_MULTIPLER)
- neighborChunk[ENEMY_PHEROMONE]

return settle
end
Expand All @@ -108,14 +107,14 @@ local function scoreResourceLocation(map, neighborChunk)
local settle = (getDeathGeneratorRating(map, neighborChunk) * neighborChunk[RESOURCE_PHEROMONE])
return settle
- (neighborChunk[PLAYER_PHEROMONE] * PLAYER_PHEROMONE_MULTIPLER)
- (neighborChunk[ENEMY_PHEROMONE] * ENEMY_PHEROMONE_MULTIPLER)
- neighborChunk[ENEMY_PHEROMONE]
end

local function scoreSiegeLocation(map, neighborChunk)
local settle = neighborChunk[BASE_PHEROMONE]
+ neighborChunk[RESOURCE_PHEROMONE]
+ (neighborChunk[PLAYER_PHEROMONE] * PLAYER_PHEROMONE_MULTIPLER)
- (neighborChunk[ENEMY_PHEROMONE] * ENEMY_PHEROMONE_MULTIPLER)
- neighborChunk[ENEMY_PHEROMONE]

return settle * getDeathGeneratorRating(map, neighborChunk)
end
Expand Down

0 comments on commit dfc2eb9

Please sign in to comment.