Skip to content

Commit

Permalink
Implement transfer to neutral victim on surrender and set as default (#…
Browse files Browse the repository at this point in the history
…425)

* DETECT_DEFEAT: Transfer to neutral victim on surrender when pertinent

* Default to transferring to neutral on defeat

* Identify neutral victim in REFORGED
  • Loading branch information
Slayer95 authored Nov 16, 2024
1 parent f3d454a commit 1b825a7
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 10 deletions.
19 changes: 13 additions & 6 deletions Jobs/DETECT_DEFEAT.eai
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,24 @@ function KillYourself takes boolean end_ai returns nothing
set g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, ai_player, null)
set g = SelectByAlive(g, true)
if destroy_buildings_on_defeat and (no_ai_ally and not humanPlayerAllys) then
if no_ai_ally and not humanPlayerAllys then
loop
set u = FirstOfGroup(g)
exitwhen u == null
call KillUnit(u)
if destroy_buildings_on_defeat then
call KillUnit(u)
else
call SetUnitOwner(u, Player(PLAYER_AMAI_NEUTRAL_VICTIM), true)
endif
call GroupRemoveUnit(g, u )
endloop

if not destroy_buildings_on_defeat then
// Trigger Melee defeat conditions
set u = CreateUnit(ai_player, structid, 0.0, 0.0, 270.00)
call KillUnit(u)
set u = null
endif
else
loop
exitwhen i >= c_ally_total
Expand Down Expand Up @@ -122,10 +133,6 @@ function KillYourself takes boolean end_ai returns nothing
set player_defeated = true
call DestroyGroup(g)
set g = null
//if not destroy_buildings_on_defeat then
//call SetPlayerAlliance(ai_player, Player(PLAYER_NEUTRAL_AGGRESSIVE), ALLIANCE_PASSIVE, true) // trigger the victory/defeat recognition triggers
//call SetPlayerAlliance(ai_player, Player(PLAYER_NEUTRAL_AGGRESSIVE), ALLIANCE_PASSIVE, false)
//endif
endif
// if end_ai then
// call PauseCompAI(ai_player,true)
Expand Down
2 changes: 1 addition & 1 deletion REFORGED/GlobalSettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ 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
ver_strat_change_enemy_strength_min 25 don't allow strategy change unless the maximum strength of all enemy players in the game is above this.
destroy_buildings_on_defeat true Should the buildings of the AI be destroyed on defeat or given to neutral player ?
destroy_buildings_on_defeat false Should the buildings of the AI be destroyed on defeat or given to neutral player ?
attack_reform_length 10 reform the attack group (getting new units) every that time on an attack (in seconds / 2)
front_base_distance difficulty * 50 + 900 the distance of the front locations from the start location
ver_heroes true Does this version have heroes?
Expand Down
1 change: 1 addition & 0 deletions REFORGED/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

integer PLAYER_AMAI_NEUTRAL_PASSIVE = GetPlayerNeutralPassive()
integer PLAYER_AMAI_NEUTRAL_AGGRESSIVE = GetPlayerNeutralAggressive()
integer PLAYER_AMAI_NEUTRAL_VICTIM = GetBJPlayerNeutralVictim()
boolean legacyCamera = false
boolean skillfix = false
boolean AatpAbility = true
Expand Down
2 changes: 1 addition & 1 deletion ROC/GlobalSettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ver_creeps_attack_buildings_dist 1500 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 1400 check for towers in this radius during harassing
destroy_buildings_on_defeat true Should the buildings of the AI be destroyed on defeat or given to neutral player ?
destroy_buildings_on_defeat false Should the buildings of the AI be destroyed on defeat or given to neutral player ?
attack_reform_length 10 reform the attack group (getting new units) every that time on an attack (in seconds / 2)
ver_heroes true Does this version have heroes?
front_base_distance difficulty * 50 + 900 the distance of the front locations from the start location
Expand Down
2 changes: 2 additions & 0 deletions ROC/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
integer bj_MAX_PLAYER_SLOTS_AMAI = 16
integer PLAYER_AMAI_NEUTRAL_PASSIVE = 15
integer PLAYER_AMAI_NEUTRAL_AGGRESSIVE = 12
integer PLAYER_AMAI_NEUTRAL_VICTIM = 13
boolean legacyCamera = true
boolean skillfix = false
#ELSE
Expand All @@ -28,6 +29,7 @@ function VersionCheck takes nothing returns nothing
set bj_PLAYER_NEUTRAL_EXTRA_AMAI = 26
set PLAYER_AMAI_NEUTRAL_PASSIVE = 27
set PLAYER_AMAI_NEUTRAL_AGGRESSIVE = 24
set PLAYER_AMAI_NEUTRAL_VICTIM = 25
set PLAYER_COLOR_MAROON = ConvertPlayerColor(12)
set PLAYER_COLOR_NAVY = ConvertPlayerColor(13)
set PLAYER_COLOR_TURQUOISE = ConvertPlayerColor(14)
Expand Down
2 changes: 1 addition & 1 deletion TFT/GlobalSettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ 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
ver_strat_change_enemy_strength_min 25 don't allow strategy change unless the maximum strength of all enemy players in the game is above this.
destroy_buildings_on_defeat true Should the buildings of the AI be destroyed on defeat or given to neutral player ?
destroy_buildings_on_defeat false Should the buildings of the AI be destroyed on defeat or given to neutral player ?
attack_reform_length 10 reform the attack group (getting new units) every that time on an attack (in seconds / 2)
front_base_distance difficulty * 50 + 900 the distance of the front locations from the start location
ver_heroes true Does this version have heroes?
Expand Down
2 changes: 2 additions & 0 deletions TFT/custom_common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
integer bj_MAX_PLAYER_SLOTS_AMAI = 16
integer PLAYER_AMAI_NEUTRAL_PASSIVE = 15
integer PLAYER_AMAI_NEUTRAL_AGGRESSIVE = 12
integer PLAYER_AMAI_NEUTRAL_VICTIM = 13
boolean legacyCamera = true
boolean skillfix = false
boolean AatpAbility = false
Expand All @@ -30,6 +31,7 @@ function VersionCheck takes nothing returns nothing
set bj_PLAYER_NEUTRAL_EXTRA_AMAI = 26
set PLAYER_AMAI_NEUTRAL_PASSIVE = 27
set PLAYER_AMAI_NEUTRAL_AGGRESSIVE = 24
set PLAYER_AMAI_NEUTRAL_VICTIM = 25
set PLAYER_COLOR_MAROON = ConvertPlayerColor(12)
set PLAYER_COLOR_NAVY = ConvertPlayerColor(13)
set PLAYER_COLOR_TURQUOISE = ConvertPlayerColor(14)
Expand Down
3 changes: 2 additions & 1 deletion common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ globals
boolean race_has_moonwells = false // Racial farms have healing properties
integer groundid = 'ewsp' // Used to create path units, must be different from race peon
integer racial_burrow = 0 // Building id that can house peons/units and then shoot enemies.
integer structid = 'ngnh' // Used to trigger melee defeat conditions on surrender.

#PRAGMA END RACIAL SETTINGS

Expand All @@ -429,7 +430,7 @@ globals
//==============================================================

#PRAGMA START VERSION SETTINGS
boolean destroy_buildings_on_defeat = true // Should the buildings of the AI be destroyed on defeat or given to neutral player ?
boolean destroy_buildings_on_defeat = false // Should the buildings of the AI be destroyed on defeat or given to neutral player ?
integer attack_reform_length = 20 // reform the attack group (getting new units) every that time on an attack (in seconds / 2)
real front_base_distance = 1100 // the distance of the front locations from the start location
boolean ver_heroes = true // Does this version have heroes?
Expand Down

0 comments on commit 1b825a7

Please sign in to comment.