mirror of
https://github.com/veden/Rampant.git
synced 2025-09-16 09:16:43 +02:00
siege groups now detect player structures on nextAttackChunk
This commit is contained in:
@@ -33,6 +33,7 @@ Date: 23. 11. 2021
|
|||||||
- Map cleanup is now processed regardless of current active map
|
- Map cleanup is now processed regardless of current active map
|
||||||
- Chunk pass scanning is now processed regardless of current active map
|
- Chunk pass scanning is now processed regardless of current active map
|
||||||
- Siege AI state now sends roughly 1 raid group every 3 settler groups if raiding is enabled
|
- Siege AI state now sends roughly 1 raid group every 3 settler groups if raiding is enabled
|
||||||
|
- Siege groups now try to settle just outside player structures as opposed to attacking
|
||||||
Tweaks:
|
Tweaks:
|
||||||
- Increase chance to upgrade an enemy structure from 5% to 30%
|
- Increase chance to upgrade an enemy structure from 5% to 30%
|
||||||
- New enemy regional bases that have two factions now do 75% on one faction and 25% on the faction for building and upgrading enemy structures
|
- New enemy regional bases that have two factions now do 75% on one faction and 25% on the faction for building and upgrading enemy structures
|
||||||
|
@@ -214,29 +214,32 @@ function mapUtils.positionFromDirectionAndChunk(direction, startPosition, endPos
|
|||||||
return endPosition
|
return endPosition
|
||||||
end
|
end
|
||||||
|
|
||||||
function mapUtils.positionFromDirectionAndFlat(direction, startPosition, endPosition)
|
function mapUtils.positionFromDirectionAndFlat(direction, startPosition, endPosition, multipler)
|
||||||
local lx = startPosition.x
|
local lx = startPosition.x
|
||||||
local ly = startPosition.y
|
local ly = startPosition.y
|
||||||
|
if not multipler then
|
||||||
|
multipler = 1
|
||||||
|
end
|
||||||
if (direction == 1) then
|
if (direction == 1) then
|
||||||
lx = lx - CHUNK_SIZE
|
lx = lx - CHUNK_SIZE * multipler
|
||||||
ly = ly - CHUNK_SIZE
|
ly = ly - CHUNK_SIZE * multipler
|
||||||
elseif (direction == 2) then
|
elseif (direction == 2) then
|
||||||
ly = ly - CHUNK_SIZE
|
ly = ly - CHUNK_SIZE * multipler
|
||||||
elseif (direction == 3) then
|
elseif (direction == 3) then
|
||||||
lx = lx + CHUNK_SIZE
|
lx = lx + CHUNK_SIZE * multipler
|
||||||
ly = ly - CHUNK_SIZE
|
ly = ly - CHUNK_SIZE * multipler
|
||||||
elseif (direction == 4) then
|
elseif (direction == 4) then
|
||||||
lx = lx - CHUNK_SIZE
|
lx = lx - CHUNK_SIZE * multipler
|
||||||
elseif (direction == 5) then
|
elseif (direction == 5) then
|
||||||
lx = lx + CHUNK_SIZE
|
lx = lx + CHUNK_SIZE * multipler
|
||||||
elseif (direction == 6) then
|
elseif (direction == 6) then
|
||||||
lx = lx - CHUNK_SIZE
|
lx = lx - CHUNK_SIZE * multipler
|
||||||
ly = ly + CHUNK_SIZE
|
ly = ly + CHUNK_SIZE * multipler
|
||||||
elseif (direction == 7) then
|
elseif (direction == 7) then
|
||||||
ly = ly + CHUNK_SIZE
|
ly = ly + CHUNK_SIZE * multipler
|
||||||
elseif (direction == 8) then
|
elseif (direction == 8) then
|
||||||
lx = lx + CHUNK_SIZE
|
lx = lx + CHUNK_SIZE * multipler
|
||||||
ly = ly + CHUNK_SIZE
|
ly = ly + CHUNK_SIZE * multipler
|
||||||
end
|
end
|
||||||
endPosition.x = lx
|
endPosition.x = lx
|
||||||
endPosition.y = ly
|
endPosition.y = ly
|
||||||
|
@@ -176,10 +176,19 @@ local function settleMove(map, squad)
|
|||||||
local attackPlayerThreshold = universe.attackPlayerThreshold
|
local attackPlayerThreshold = universe.attackPlayerThreshold
|
||||||
|
|
||||||
if (nextAttackChunk ~= -1) then
|
if (nextAttackChunk ~= -1) then
|
||||||
attackChunk = nextAttackChunk
|
if (getPlayerBaseGenerator(map,nextAttackChunk) == 0) or (map.state ~= AI_STATE_SIEGE) then
|
||||||
positionFromDirectionAndFlat(attackDirection, groupPosition, targetPosition)
|
attackChunk = nextAttackChunk
|
||||||
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
|
positionFromDirectionAndFlat(attackDirection, groupPosition, targetPosition)
|
||||||
position = findMovementPosition(surface, targetPosition2)
|
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
|
||||||
|
position = findMovementPosition(surface, targetPosition2)
|
||||||
|
else
|
||||||
|
positionFromDirectionAndFlat(nextAttackDirection, groupPosition, targetPosition, 1.3)
|
||||||
|
position = findMovementPosition(surface, targetPosition)
|
||||||
|
if not position then
|
||||||
|
positionFromDirectionAndFlat(attackDirection, groupPosition, targetPosition, 1.3)
|
||||||
|
position = findMovementPosition(surface, targetPosition)
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
positionFromDirectionAndFlat(attackDirection, groupPosition, targetPosition)
|
positionFromDirectionAndFlat(attackDirection, groupPosition, targetPosition)
|
||||||
position = findMovementPosition(surface, targetPosition)
|
position = findMovementPosition(surface, targetPosition)
|
||||||
@@ -199,7 +208,17 @@ local function settleMove(map, squad)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if (getPlayerBaseGenerator(map, attackChunk) ~= 0) or
|
if (nextAttackChunk ~= -1) and (map.state == AI_STATE_SIEGE) and (getPlayerBaseGenerator(map, nextAttackChunk) ~= 0) then
|
||||||
|
cmd = universe.settleCommand
|
||||||
|
cmd.destination.x = targetPosition.x
|
||||||
|
cmd.destination.y = targetPosition.y
|
||||||
|
squad.status = SQUAD_BUILDING
|
||||||
|
if squad.kamikaze then
|
||||||
|
cmd.distraction = DEFINES_DISTRACTION_NONE
|
||||||
|
else
|
||||||
|
cmd.distraction = DEFINES_DISTRACTION_BY_ENEMY
|
||||||
|
end
|
||||||
|
elseif (getPlayerBaseGenerator(map, attackChunk) ~= 0) or
|
||||||
(attackChunk[PLAYER_PHEROMONE] >= attackPlayerThreshold)
|
(attackChunk[PLAYER_PHEROMONE] >= attackPlayerThreshold)
|
||||||
then
|
then
|
||||||
cmd = universe.attackCommand
|
cmd = universe.attackCommand
|
||||||
|
Reference in New Issue
Block a user