Skip to content

Commit

Permalink
Change AttitudeTo code: skip grudges if already busy killing
Browse files Browse the repository at this point in the history
  • Loading branch information
wallabra committed Dec 2, 2023
1 parent 09e005e commit c579a91
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Classes/MushBeacon.uc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function float RateSelf(out int bUseAltMode)
}

// don't use if EPRL is suspected and not wielding a Sporifier
if (EPRL.bSuspected && Sporifier(Pawn(Owner).Enemy.Weapon) == None) {
if (EPRL.bIsSuspected && Sporifier(Pawn(Owner).Enemy.Weapon) == None) {
return -1;
}

Expand Down
27 changes: 27 additions & 0 deletions Classes/MushMatchInfo.uc
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,32 @@ simulated event string TeamTextStatus(PlayerReplicationInfo PRI, PlayerPawn Othe
return "...";
}

// Whether a busy bot (who's already killing someone) may consider switching to
// target this.
function bool MayConsiderRetargeting(MushMatchPRL BotPRL, MushMatchPRL OtherPRL) {
if (BotPRL.bMush) {
return true;
}

if (OtherPRL.bKnownMush) {
return true;
}

if (OtherPRL.bIsSuspected) {
return true;
}

return false;
}

function bool BusyKilling(Pawn aBot) {
return (aBot.Enemy != None || aBot.IsInState('Attacking')) && MushBeacon(aBot.Weapon) == None;
}

function bool TooBusy(Pawn aBot, MushMatchPRL BotPRL, MushMatchPRL OtherPRL) {
return BusyKilling(aBot) && !MayConsiderRetargeting(BotPRL, OtherPRL);
}

function byte MushMatchAssessBotAttitude(Pawn aBot, Pawn Other) {
local Pawn P;
local MushMatchInfo MMI;
Expand Down Expand Up @@ -559,6 +585,7 @@ function byte MushMatchAssessBotAttitude(Pawn aBot, Pawn Other) {
&& MMI.CheckHate(OtherPRI, BotPRI)
&& !(OtherMPRL.bMush && BotMPRL.bMush)
&& FRand() < DecideChance_GrudgeAttack
&& !TooBusy(aBot, BotMPRL, OtherMPRL)
)
||
(
Expand Down
2 changes: 1 addition & 1 deletion buildconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
export name="Mush Match"
export package=MushMatch
export version=1.3.4
export build=20231205
export build=20231206
export debug=1
export makeint=1
export incl_readme=1
Expand Down

0 comments on commit c579a91

Please sign in to comment.