diff --git a/README.md b/README.md index d1ec608..a71dff0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/libs/AIAttack.lua b/libs/AIAttack.lua index 39015e2..21c523c 100755 --- a/libs/AIAttack.lua +++ b/libs/AIAttack.lua @@ -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 diff --git a/libs/AIDefense.lua b/libs/AIDefense.lua index 4d7d727..be5c1da 100755 --- a/libs/AIDefense.lua +++ b/libs/AIDefense.lua @@ -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)