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
|
# 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
|
0.0.7 - updated for 0.14
|
||||||
|
|
||||||
|
@ -138,15 +138,14 @@ end
|
|||||||
|
|
||||||
function aiAttack.squadBeginAttack(natives, players, evolution_factor)
|
function aiAttack.squadBeginAttack(natives, players, evolution_factor)
|
||||||
local squads = natives.squads
|
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
|
for i=1,#squads do
|
||||||
local squad = squads[i]
|
local squad = squads[i]
|
||||||
if (squad.status == SQUAD_GUARDING) and squad.group.valid then
|
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
|
-- check to hunt player
|
||||||
if (math.random() < 0.30) and playersWithinProximityToPosition(players, squad.group.position, 100) then
|
if (math.random() < 0.30) and playersWithinProximityToPosition(players, squad.group.position, 100) then
|
||||||
print("player hunt")
|
if (math.random() < threshold) then
|
||||||
if (math.random() < threshold) or (groupSizeThreshold <= #squad.group.members) then
|
|
||||||
squad.status = SQUAD_SUICIDE_HUNT
|
squad.status = SQUAD_SUICIDE_HUNT
|
||||||
else
|
else
|
||||||
squad.status = SQUAD_HUNTING
|
squad.status = SQUAD_HUNTING
|
||||||
@ -155,8 +154,7 @@ function aiAttack.squadBeginAttack(natives, players, evolution_factor)
|
|||||||
|
|
||||||
-- check to raid base
|
-- check to raid base
|
||||||
if (squad.status == SQUAD_GUARDING) and (math.random() < 0.70) then
|
if (squad.status == SQUAD_GUARDING) and (math.random() < 0.70) then
|
||||||
print("raid")
|
if (math.random() < threshold) then
|
||||||
if (math.random() < threshold) or (groupSizeThreshold <= #squad.group.members) then
|
|
||||||
squad.status = SQUAD_SUICIDE_RAID
|
squad.status = SQUAD_SUICIDE_RAID
|
||||||
else
|
else
|
||||||
squad.status = SQUAD_RAIDING
|
squad.status = SQUAD_RAIDING
|
||||||
|
@ -55,9 +55,9 @@ local function validRetreatLocation(x, chunk, neighborChunk)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function scoreRetreatLocation(position, squad, neighborChunk, surface)
|
local function scoreRetreatLocation(position, squad, neighborChunk, surface)
|
||||||
local avoidScore = neighborChunk[ENEMY_BASE_PHEROMONE] + (neighborChunk[ENEMY_BASE_GENERATOR] * 6)
|
local safeScore = neighborChunk[ENEMY_BASE_PHEROMONE]
|
||||||
local dangerScore = neighborChunk[DEATH_PHEROMONE] + surface.get_pollution(position) + neighborChunk[PLAYER_PHEROMONE] + neighborChunk[PLAYER_DEFENSE_PHEROMONE]
|
local dangerScore = neighborChunk[DEATH_PHEROMONE] + surface.get_pollution(position) + neighborChunk[PLAYER_PHEROMONE] + neighborChunk[PLAYER_DEFENSE_PHEROMONE] + (neighborChunk[ENEMY_BASE_GENERATOR] * 6)
|
||||||
return avoidScore - dangerScore
|
return safeScore - dangerScore
|
||||||
end
|
end
|
||||||
|
|
||||||
function aiDefense.retreatUnits(position, squad, regionMap, surface, natives)
|
function aiDefense.retreatUnits(position, squad, regionMap, surface, natives)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user