1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-28 03:29:34 +02:00

kamikazeThreshold for settlers using settler max group size

This commit is contained in:
Aaron Veden 2021-12-10 13:30:11 -08:00
parent 2379298259
commit 04526dda70
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
3 changed files with 12 additions and 5 deletions

View File

@ -83,6 +83,7 @@ Date: 23. 11. 2021
- Fixed picking damageType during faction mutation (Thank you Garrotte13)
- Fixed surfaceTileChange trying to use a boolean inplace of an object (Thank you Garrotte13)
- Fixed onslaught AI state not using raid actived nests
- Fixed settlers calculating kamikazeThreshold using attackWaveMaxSize instead of settlerWaveMaxSize
Framework:
- Fixed Rampant in-memory map visualization tool for debugging
- Added debug mod settings for showing enemy structures being upgraded in place

View File

@ -40,7 +40,8 @@ local AI_STATE_RAIDING = constants.AI_STATE_RAIDING
local findNearbyBase = baseUtils.findNearbyBase
local calculateKamikazeThreshold = unitGroupUtils.calculateKamikazeThreshold
local calculateKamikazeSettlerThreshold = unitGroupUtils.calculateKamikazeSettlerThreshold
local calculateKamikazeSquadThreshold = unitGroupUtils.calculateKamikazeSquadThreshold
local positionFromDirectionAndChunk = mapUtils.positionFromDirectionAndChunk
@ -240,7 +241,7 @@ function aiAttackWave.formSettlers(map, chunk)
if universe.NEW_ENEMIES then
squad.base = findNearbyBase(map, chunk)
end
local kamikazeThreshold = calculateKamikazeThreshold(foundUnits, universe)
local kamikazeThreshold = calculateKamikazeSettlerThreshold(foundUnits, universe)
if map.state == AI_STATE_SIEGE then
kamikazeThreshold = kamikazeThreshold * 2.5
end
@ -295,7 +296,7 @@ function aiAttackWave.formVengenceSquad(map, chunk)
if universe.NEW_ENEMIES then
squad.base = findNearbyBase(map, chunk)
end
squad.kamikaze = map.random() < calculateKamikazeThreshold(foundUnits, universe)
squad.kamikaze = map.random() < calculateKamikazeSquadThreshold(foundUnits, universe)
universe.groupNumberToSquad[squad.groupNumber] = squad
universe.squadCount = universe.squadCount + 1
map.points = map.points - AI_VENGENCE_SQUAD_COST
@ -346,7 +347,7 @@ function aiAttackWave.formSquads(map, chunk)
if universe.NEW_ENEMIES then
squad.base = findNearbyBase(map, chunk)
end
squad.kamikaze = map.random() < calculateKamikazeThreshold(foundUnits, universe)
squad.kamikaze = map.random() < calculateKamikazeSquadThreshold(foundUnits, universe)
map.points = map.points - AI_SQUAD_COST
universe.squadCount = universe.squadCount + 1
universe.groupNumberToSquad[squad.groupNumber] = squad

View File

@ -108,10 +108,15 @@ function unitGroupUtils.createSquad(position, map, group, settlers)
return squad
end
function unitGroupUtils.calculateKamikazeThreshold(memberCount, universe)
function unitGroupUtils.calculateKamikazeSquadThreshold(memberCount, universe)
local threshold = (memberCount / universe.attackWaveMaxSize) * 0.2 + (universe.evolutionLevel * 0.2)
return threshold
end
function unitGroupUtils.calculateKamikazeSettlerThreshold(memberCount, universe)
local threshold = (memberCount / universe.expansionMaxSize) * 0.2 + (universe.evolutionLevel * 0.2)
return threshold
end
unitGroupUtilsG = unitGroupUtils
return unitGroupUtils