Skip to content

Commit

Permalink
Stablise future army locations #482
Browse files Browse the repository at this point in the history
And prevent harvesting ghouls being detected as an army.
  • Loading branch information
SMUnlimited committed Dec 21, 2024
1 parent 34b764e commit ddce396
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Slight tweak to strength calculation to prevent creep levels being calculated incorrectly in some cases and don't average hero levels as unessecary.
- Harass attacks were occuring often for all AI's regardless of aggression level so they now occur less often for less aggressive profiles.
- AI with high food use will now reform less often during travel to make faster progress to their desired targets.
- Future army locations are now always calculated a fixed distance from the current location to avoid a town thinking its under threat but is no where near, the army just moved fast.

### Deprecated
- (DevTools) 'race_ancient_expansion_strength' setting does not do anything anymore as it uses actual strength to determine feasability of attack.
Expand All @@ -21,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed bug where ancient attacks didn't take account of ancient strength in retreat calculations.
- Item expansion now only occurs when the AI naturally wants to expand instead of making the AI expand earlier.
- Fixed an issue where as ghouls die in an attack, harvesting ghouls are being pulled off to fill dead/fleeing units.
- Fixed an issue where harvesting ghouls were detected as the main army in some cases.
- (DevTools) Removed use of hardcoded ids in expansion tracking for custom mod support.

## [3.4.1] - 2024-12-07
Expand Down
6 changes: 4 additions & 2 deletions Jobs/ARMY_TRACK.eai
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function TrackArmy takes integer num returns boolean
loop
set u = FirstOfGroup(g)
exitwhen u == null
if UnitAlive(u) and GetOwningPlayer(u) == Player(army_owner[num]) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitInGroup(u, in_army_group) and IsStandardUnit(u) and not IsUnitBuying(u) then
if UnitAlive(u) and GetOwningPlayer(u) == Player(army_owner[num]) and not IsUnitType(u, UNIT_TYPE_STRUCTURE) and not IsUnitType(u, UNIT_TYPE_PEON) and not IsUnitInGroup(u, in_army_group) and IsStandardUnit(u) and not IsUnitBuying(u) and GetUnitCurrentOrder(u) != OrderId("harvest") and GetUnitCurrentOrder(u) != OrderId("resumeharvesting") then // harvest check to ignore harvesting ghouls as they not an army
if tmpmainarmy < 0 and u == major_hero then
set tmpmainarmy = num // fallback main army
set main_army = num
Expand Down Expand Up @@ -96,7 +96,9 @@ function TrackArmy takes integer num returns boolean
endif
set army_loc[num] = Location(GetLocationX(l), GetLocationY(l))
call RemoveLocation(army_future[num])
set army_future[num] = GetSumLoc_kd(army_loc[num], GetMultipleLoc(army_dir[num], army_future_mult))
call RemoveLocation(l)
set l = GetSumLoc_kd(army_loc[num], GetMultipleLoc(army_dir[num], army_future_mult)) // This just sets a point in direction we want
set army_future[num] = GetProjectedLoc(army_loc[num], l, no_threat_distance) // Fixed location in direction army is going

// if army_strength[num] != 0 then
// call PingMinimap(GetLocationX(l), GetLocationY(l), 4)
Expand Down

0 comments on commit ddce396

Please sign in to comment.