Skip to content

Commit

Permalink
Ignore racial expansion in harvest controls if doing a fast expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Dec 18, 2024
1 parent 71d4c2a commit 20bd84c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion races.eai
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ function CanTowerRush takes nothing returns nothing
local real distance = GetNearestEnemyDistance()
local integer i = GetRandomInt(1,100)

if c_ally_total > 0 then
return // Cannot use in team games due to attack override bug
endif
if game_is_ffa then
set i = i + 40 // in ffa reduce likly hood of tower rush extremly
endif
Expand Down Expand Up @@ -714,7 +717,7 @@ function KeepHarvestLocal takes nothing returns nothing
exitwhen u == null
if GetUnitTypeId(u) == old_id[racial_peon] and UnitAlive(u) then
call CreateDebugTagLoc("O:" + Int2Str(GetUnitCurrentOrder(u)), 10, GetUnitX(u), GetUnitY(u), 1.00, 0.80)
if not IsUnitInGroup(u, harvestgrp) and DistanceBetweenPoints_dk(GetUnitLoc(u), home_location) > front_base_distance * 1.25 and IsConstructionOrder(GetUnitCurrentOrder(u)) and (racial_rushcreep == 0 or (TownCount(racial_rushcreep) <= 0 and GetUnitCurrentOrder(u) != old_id[racial_rushcreep])) then // going on adventure building far away too early so force them back
if not IsUnitInGroup(u, harvestgrp) and DistanceBetweenPoints_dk(GetUnitLoc(u), home_location) > front_base_distance * 1.25 and IsConstructionOrder(GetUnitCurrentOrder(u)) and (racial_rushcreep == 0 or (TownCount(racial_rushcreep) <= 0 and GetUnitCurrentOrder(u) != old_id[racial_rushcreep])) and GetUnitCurrentOrder(u) != old_id[racial_expansion] then // going on adventure building far away too early so force them back
set buildu = CreatePathingUnitFull(buildu, ai_player, GetUnitCurrentOrder(u), GetLocationX(home_location) + ISign() * GetRandomReal(500, 1000), GetLocationY(home_location) + ISign() * GetRandomReal(-1000, -500))
set buildx = GetUnitX(buildu)
set buildy = GetUnitY(buildu)
Expand Down

0 comments on commit 20bd84c

Please sign in to comment.