From 1b825a7c6766252589d178c455f15e66426c6c41 Mon Sep 17 00:00:00 2001 From: Slayer95 Date: Sat, 16 Nov 2024 12:58:20 -0500 Subject: [PATCH] Implement transfer to neutral victim on surrender and set as default (#425) * DETECT_DEFEAT: Transfer to neutral victim on surrender when pertinent * Default to transferring to neutral on defeat * Identify neutral victim in REFORGED --- Jobs/DETECT_DEFEAT.eai | 19 +++++++++++++------ REFORGED/GlobalSettings.txt | 2 +- REFORGED/custom_common.eai | 1 + ROC/GlobalSettings.txt | 2 +- ROC/custom_common.eai | 2 ++ TFT/GlobalSettings.txt | 2 +- TFT/custom_common.eai | 2 ++ common.eai | 3 ++- 8 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Jobs/DETECT_DEFEAT.eai b/Jobs/DETECT_DEFEAT.eai index c1be8ec17..178eb94a8 100644 --- a/Jobs/DETECT_DEFEAT.eai +++ b/Jobs/DETECT_DEFEAT.eai @@ -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 @@ -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) diff --git a/REFORGED/GlobalSettings.txt b/REFORGED/GlobalSettings.txt index f3ff7f6a2..b0b3e0960 100644 --- a/REFORGED/GlobalSettings.txt +++ b/REFORGED/GlobalSettings.txt @@ -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? diff --git a/REFORGED/custom_common.eai b/REFORGED/custom_common.eai index 105322825..1f7f7aa5e 100644 --- a/REFORGED/custom_common.eai +++ b/REFORGED/custom_common.eai @@ -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 diff --git a/ROC/GlobalSettings.txt b/ROC/GlobalSettings.txt index 72add47c5..e387c2ad4 100644 --- a/ROC/GlobalSettings.txt +++ b/ROC/GlobalSettings.txt @@ -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 diff --git a/ROC/custom_common.eai b/ROC/custom_common.eai index 1fa6b941a..8205e2009 100644 --- a/ROC/custom_common.eai +++ b/ROC/custom_common.eai @@ -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 @@ -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) diff --git a/TFT/GlobalSettings.txt b/TFT/GlobalSettings.txt index c8fc87c99..a0285b77c 100644 --- a/TFT/GlobalSettings.txt +++ b/TFT/GlobalSettings.txt @@ -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? diff --git a/TFT/custom_common.eai b/TFT/custom_common.eai index ef0ff05b0..0df32ee77 100644 --- a/TFT/custom_common.eai +++ b/TFT/custom_common.eai @@ -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 @@ -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) diff --git a/common.eai b/common.eai index 1a278aae5..ac42899f3 100644 --- a/common.eai +++ b/common.eai @@ -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 @@ -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?