Skip to content

Commit

Permalink
Minor tweak to creep strength calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Dec 18, 2024
1 parent e5772bd commit 6b0b41b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Changed
- Slight tweak to strength calculation to prevent creep levels being calculated incorrectly in some cases and don't average hero levels as unessecary.

### Deprecated
- (DevTools) 'race_ancient_expansion_strength' setting does not do anything anymore as it uses actual strength to determine feasability of attack.

Expand Down
4 changes: 2 additions & 2 deletions REFORGED/GlobalSettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ ver_food_limit GetPlayerState(ai_player, PLAYER_STATE_FOOD_CAP_CEILING) what is
normal_battle_radius 1500 units within that radius are considered belonging to the current battle
creep_battle_radius 750 same as with normal_battle_radius, but for battles against creeps
expansion_taken_radius 1300 how near a mine a enemy building must be to make amai recognize it as taken
ver_hero_base_value 4 what is the base strength of a hero (the level number is added to get the actual strength) ?
ver_hero_base_value 3 what is the base strength of a hero (the level number is added to get the actual strength) ?
ver_hero_ultimate_level 6 at what level do the heroes get their ultimates ?
ver_hero_ultimate_value 6 how much extra strength does the ultimate give to the hero ?
ver_hero_ultimate_value 3 how much extra strength does the ultimate give to the hero ?
ver_creeps_attack_buildings_dist 1850 how far away do creeps attack buildings ?
ver_mercs_night_buy false can mercs be bought at night without waking up creeps ?
ver_tower_check_radius 2000 check for towers in this radius around a target
Expand Down
2 changes: 1 addition & 1 deletion TFT/Elf/Settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ race_farms_at_mine 0 the first that many farms will be built at the mine
race_max_expa_mine_distance 850 the maximum distance between the mine and the expansion building
race_has_moonwells true Racial farms have healing properties
race_towerrush_hero_rush_level 1 the bonus strength value hero must have to be able to do the tower rush
race_ancient_expansion_hero_rush_level 2 the bonus strength value hero must have to be able to do the ancient expansion
race_ancient_expansion_hero_rush_level 1 the bonus strength value hero must have to be able to do the ancient expansion
ghoul_prio 250 priority for ghoul building
race_min_ghouls 2 smallest number of ghouls to build at all times
race_max_ghouls 5 maximum number of ghouls to build in low lumber situations
Expand Down
6 changes: 3 additions & 3 deletions TFT/GlobalSettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ ver_food_limit GetPlayerState(ai_player, PLAYER_STATE_FOOD_CAP_CEILING) what is
normal_battle_radius 1500 units within that radius are considered belonging to the current battle
creep_battle_radius 750 same as with normal_battle_radius, but for battles against creeps
expansion_taken_radius 1300 how near a mine a enemy building must be to make amai recognize it as taken
ver_hero_base_value 4 what is the base strength of a hero (the level number is added to get the actual strength) ?
ver_hero_base_value 3 what is the base strength of a hero (the level number is added to get the actual strength) ?
ver_hero_ultimate_level 6 at what level do the heroes get their ultimates ?
ver_hero_ultimate_value 6 how much extra strength does the ultimate give to the hero ?
ver_creeps_attack_buildings_dist 1600 how far away do creeps attack buildings ?
ver_hero_ultimate_value 3 how much extra strength does the ultimate give to the hero ?
ver_creeps_attack_buildings_dist 1850 how far away do creeps attack buildings ?
ver_mercs_night_buy false can mercs be bought at night without waking up creeps ?
ver_tower_check_radius 2000 check for towers in this radius around a target
ver_harass_tower_check_radius 2200 check for towers in this radius during harassing
Expand Down
19 changes: 7 additions & 12 deletions common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -5339,9 +5339,9 @@ function GetHeroStrength takes unit u returns integer
local integer lvl = GetHeroLevel(u)
if GetOwningPlayer(u) != ai_player or not IsUnitInGroup(u, unit_healing) then
if lvl >= ver_hero_ultimate_level then
return R2I((ver_hero_base_value + lvl + ver_hero_ultimate_value)/2 + 0.5)
return R2I(ver_hero_base_value + lvl + ver_hero_ultimate_value + 0.5)
else
return R2I((ver_hero_base_value + lvl)/2 + 0.5)
return R2I(ver_hero_base_value + lvl + 0.5)
endif
endif
return 0
Expand Down Expand Up @@ -5370,19 +5370,14 @@ endfunction

//============================================================================
function GetUnitStrengthEx takes unit u returns integer
local integer f = GetUnitLevel(u)
if GetOwningPlayer(u) != Player(PLAYER_NEUTRAL_AGGRESSIVE) then
if IsUnitType(u, UNIT_TYPE_HERO) then
return GetHeroStrength(u)
else
return R2I((GetUnitFoodUsed(u) + f) / 2 + 0.5)
return R2I((GetUnitFoodUsed(u) + GetUnitLevel(u)) / 2 + 0.5) // +0.5 for rounding , food used often matches the level but can be weaker or stronger forms of a lvl 2 unit so uses average
endif
else
if f >= ver_hero_ultimate_level then
return R2I((GetUnitFoodUsed(u)+ f + ver_hero_ultimate_value) / 2 + 0.5)
else
return R2I((GetUnitFoodUsed(u) + f) / 2 + 0.5)
endif
return R2I(GetUnitLevel(u) / 2 + 0.5) // Creeps entirely use the level in evaluating strength
endif
return 0
endfunction
Expand Down Expand Up @@ -5684,9 +5679,9 @@ endfunction
function GetCreepBonus takes unit u, real radius returns integer
local integer i = GetLocationCreepStrength(GetUnitX(u), GetUnitY(u), radius)
//call Trace("Got bonus")
if i >= 20 then
if i >= 20 then // lvl 20 or more
return i + red_creep_camp_strength_bonus
elseif i >= 10 then
elseif i >= 10 then // lvl 10 - 19
return i + orange_creep_camp_strength_bonus
else
return i + green_creep_camp_strength_bonus
Expand Down Expand Up @@ -5903,7 +5898,7 @@ function GetLocationInDistanceFromLoc takes location loc, real dist, boolean inj
//return null
endif
if injob then
call TQSleep(0.2)
call Sleep(0.2)
else
call Sleep(0.2)
endif
Expand Down

0 comments on commit 6b0b41b

Please sign in to comment.