mirror of
https://github.com/veden/Rampant.git
synced 2025-02-01 13:07:53 +02:00
changed to scaling based on squad size, evolution factor and flat 5 for kamikazes
This commit is contained in:
parent
b4b851436f
commit
9bdb3fefb6
@ -29,7 +29,9 @@ Base Expansion
|
||||
|
||||
# Version History
|
||||
|
||||
0.0.8 -
|
||||
0.0.8 - fixed retreat oscillations (https://forums.factorio.com/viewtopic.php?f=94&t=31445&start=10#p198750)
|
||||
added scaling for kamikaze attack (https://forums.factorio.com/viewtopic.php?f=94&t=31445&start=10#p199401)
|
||||
increased squad size max from 125 to 150, (larger waves)
|
||||
|
||||
0.0.7 - updated for 0.14
|
||||
|
||||
|
@ -138,15 +138,14 @@ end
|
||||
|
||||
function aiAttack.squadBeginAttack(natives, players, evolution_factor)
|
||||
local squads = natives.squads
|
||||
local threshold = 0.05 + (evolution_factor * 0.20)
|
||||
local groupSizeThreshold = mMax((evolution_factor * constants.AI_MAX_SQUAD_SIZE) + 1, 20)
|
||||
for i=1,#squads do
|
||||
local squad = squads[i]
|
||||
if (squad.status == SQUAD_GUARDING) and squad.group.valid then
|
||||
local threshold = 0.05 + (evolution_factor * 0.20) + (#squad.group.members * 0.0033)
|
||||
|
||||
-- check to hunt player
|
||||
if (math.random() < 0.30) and playersWithinProximityToPosition(players, squad.group.position, 100) then
|
||||
print("player hunt")
|
||||
if (math.random() < threshold) or (groupSizeThreshold <= #squad.group.members) then
|
||||
if (math.random() < threshold) then
|
||||
squad.status = SQUAD_SUICIDE_HUNT
|
||||
else
|
||||
squad.status = SQUAD_HUNTING
|
||||
@ -155,8 +154,7 @@ function aiAttack.squadBeginAttack(natives, players, evolution_factor)
|
||||
|
||||
-- check to raid base
|
||||
if (squad.status == SQUAD_GUARDING) and (math.random() < 0.70) then
|
||||
print("raid")
|
||||
if (math.random() < threshold) or (groupSizeThreshold <= #squad.group.members) then
|
||||
if (math.random() < threshold) then
|
||||
squad.status = SQUAD_SUICIDE_RAID
|
||||
else
|
||||
squad.status = SQUAD_RAIDING
|
||||
|
@ -55,9 +55,9 @@ local function validRetreatLocation(x, chunk, neighborChunk)
|
||||
end
|
||||
|
||||
local function scoreRetreatLocation(position, squad, neighborChunk, surface)
|
||||
local avoidScore = neighborChunk[ENEMY_BASE_PHEROMONE] + (neighborChunk[ENEMY_BASE_GENERATOR] * 6)
|
||||
local dangerScore = neighborChunk[DEATH_PHEROMONE] + surface.get_pollution(position) + neighborChunk[PLAYER_PHEROMONE] + neighborChunk[PLAYER_DEFENSE_PHEROMONE]
|
||||
return avoidScore - dangerScore
|
||||
local safeScore = neighborChunk[ENEMY_BASE_PHEROMONE]
|
||||
local dangerScore = neighborChunk[DEATH_PHEROMONE] + surface.get_pollution(position) + neighborChunk[PLAYER_PHEROMONE] + neighborChunk[PLAYER_DEFENSE_PHEROMONE] + (neighborChunk[ENEMY_BASE_GENERATOR] * 6)
|
||||
return safeScore - dangerScore
|
||||
end
|
||||
|
||||
function aiDefense.retreatUnits(position, squad, regionMap, surface, natives)
|
||||
|
Loading…
x
Reference in New Issue
Block a user