Skip to content

Commit

Permalink
Slightly tweaked version of ancient expansion check #372
Browse files Browse the repository at this point in the history
Will now use all 3 heroes to determine ancient expansion options.
  • Loading branch information
SMUnlimited committed Sep 20, 2024
1 parent e37a0a3 commit bd53f5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

- Peons with higher priority over a hall upgrade will now be favoured first if no other way to build more peons.
- If in an attack don't save gold and wood for items as hero is busy.
- Ancient expansion will now consider all 3 heroes to determine suitability instead of only the first hero.
- Teleport control improvements and fixes. (jzy-chitong56)

### Fixed
Expand Down
21 changes: 15 additions & 6 deletions Jobs/ANCIENT_EXPANSION_CHECK.eai
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,38 @@

function AncientExpansionCheck takes nothing returns nothing
local unit u = null
local integer i = 0
call DisplayToAllJobDebug("ANCIENT_EXPANSION_CHECK JOB START")
if not ancient_expanding then
// call DisplayToAll("Ancient Expansion Check")
// if ai_time > 60 then // 5 mins
// call DisplayToAll("Past time to expand with ancient")
// set ancient_expanding = false
// if GetExpansionStrength() < race_ancient_expansion_strength and u != null and (hero[1] == race_ancient_expansion_hero1 or hero[1] == race_ancient_expansion_hero2) then
if hero_unit[1] != null then
set i = hero_rush_bonus[hero[1]]
endif
if hero_unit[2] != null then
set i = i + hero_rush_bonus[hero[2]]
endif
if hero_unit[3] != null then
set i = i + hero_rush_bonus[hero[3]]
endif
if current_expansion != null and take_exp and not CheckExpansionTaken(current_expansion) then
set u = GetExpFoe(u)
call Trace("expansion free")
if GetExpansionStrength() < race_ancient_expansion_strength and u != null and hero_rush_bonus[hero[1]] >= race_ancient_expansion_hero_rush_level then
if GetExpansionStrength() < race_ancient_expansion_strength and u != null and i >= race_ancient_expansion_hero_rush_level then
call Trace("Ancient expansion - Begin Job")
if ancient_exp_loc == null then
set ancient_exp_loc = GetBuildLocationInDistanceFromLoc_d(old_id[racial_expansion], GetUnitLoc(current_expansion), ver_creeps_attack_buildings_dist + 500, true)
endif
if ancient_exp_loc == null then
set ancient_exp_loc = GetBuildLocationInDistanceFromLoc_d(old_id[racial_expansion], GetUnitLoc(current_expansion), ver_creeps_attack_buildings_dist + 500, true)
endif
set ancient_expanding = true
call TQAddJob(1, ANCIENT_EXPANSION, 0)
set u = null
return
elseif hero_rush_bonus[hero[1]] < race_ancient_expansion_hero_rush_level then
elseif i < race_ancient_expansion_hero_rush_level then
call Trace("Ancient Expansion not possible with hero")
set u = null
return
endif
set u = null
else
Expand Down

0 comments on commit bd53f5b

Please sign in to comment.