Skip to content

Commit

Permalink
Harass timings based on profile aggression #473
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Dec 18, 2024
1 parent 6b0b41b commit 4bb4531
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Changed
- 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.

### Deprecated
- (DevTools) 'race_ancient_expansion_strength' setting does not do anything anymore as it uses actual strength to determine feasability of attack.
Expand Down
15 changes: 12 additions & 3 deletions common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -10142,9 +10142,18 @@ function GetHarassGroupStrength takes integer groupnum returns real
endfunction

function Harass takes integer groupnum, integer harass_target, boolean avoid_towers, real strength_limit, real flee_percent, integer flee_number, boolean cond, integer min_time, integer time returns nothing
if cond and ai_time - harass_time[groupnum] >= time and ai_time >= min_time and not attack_running then
call StartHarass(groupnum, harass_target, avoid_towers, strength_limit, flee_percent, flee_number, 0, 0)
endif
local integer aggression = attacking_aggression + added_aggression
local integer chance = R2I(LinearInterpolation(-15,15,10,100,attacking_aggression + added_aggression))
// If aggression too low skip this instance of harassing

if cond and ai_time - harass_time[groupnum] >= time and ai_time >= min_time and not attack_running then
if GetRandomInt(1, 100) <= chance then
call StartHarass(groupnum, harass_target, avoid_towers, strength_limit, flee_percent, flee_number, 0, 0)
else
set harass_time[groupnum] = ai_time
endif
endif

endfunction

//============================================================================
Expand Down

0 comments on commit 4bb4531

Please sign in to comment.