Skip to content

Commit

Permalink
Adjust Blue Redeemer Shell to target player doing best on winning team
Browse files Browse the repository at this point in the history
(In case someone on the losing team is doing really well)
  • Loading branch information
theastropath committed Feb 22, 2022
1 parent 5c93022 commit f20dc96
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion Classes/UT99CCEffects.uc
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,37 @@ function Pawn findPawnByScore(bool highest, int avoidTeam)
return cur;
}

function int FindTeamByTeamScore(bool HighTeam)
{
local int i,team;
local TeamGamePlus game;
team = 0;

if (Level.Game.bTeamGame==False){
return 255;
}

game = TeamGamePlus(Level.Game);

if (game == None){
return 255;
}

for (i=0;i<4;i++) {
if (HighTeam) {
if (game.Teams[i].Score > game.Teams[team].Score){
team = i;
}
} else {
if (game.Teams[i].Score < game.Teams[team].Score){
team = i;
}
}
}

return team;
}

function int FindTeamWithLeastPlayers()
{
local Pawn p;
Expand Down Expand Up @@ -724,6 +755,7 @@ function Bot SpawnBot(out NavigationPoint StartSpot, String botname)
local Pawn P;
local DeathMatchPlus game;
local int lowTeam;
local float skill;

game = DeathMatchPlus(Level.Game);

Expand All @@ -733,6 +765,9 @@ function Bot SpawnBot(out NavigationPoint StartSpot, String botname)
}

lowTeam = FindTeamWithLeastPlayers();

//Adjust skill based on whether or not the bot is going on the winning team
skill = game.BotConfig.Difficulty; //TODO: Actually adjust this difficulty


game.Difficulty = game.BotConfig.Difficulty;
Expand Down Expand Up @@ -775,6 +810,8 @@ function Bot SpawnBot(out NavigationPoint StartSpot, String botname)
NewBot.PlayerReplicationInfo.Team = lowTeam;
game.BotConfig.CHIndividualize(NewBot, BotN, game.NumBots);

NewBot.InitializeSkill(skill);

//Individualize uses the random selections for skins, including the team. Redo the SetMultiSkin, but force the team to the correct one
NewBot.Static.SetMultiSkin(NewBot,game.BotConfig.BotSkins[BotN],game.BotConfig.BotFaces[BotN],lowTeam);

Expand Down Expand Up @@ -1356,7 +1393,7 @@ function int BlueRedeemerShell(String viewer)
local int avoidTeam;


high = findPawnByScore(True,255); //Target individual player who is doing best
high = findPawnByScore(True,FindTeamByTeamScore(False)); //Target individual player who is doing best on a team that isn't in last place

if (Level.Game.bTeamGame==True){
avoidTeam = high.PlayerReplicationInfo.Team;
Expand Down

0 comments on commit f20dc96

Please sign in to comment.