Teamplay gameplay refinements

This commit is contained in:
Antonio Martinez 2025-05-22 00:32:14 -04:00
parent c400c5ea07
commit bd250e34c8
3 changed files with 44 additions and 2 deletions

View file

@ -1478,6 +1478,9 @@ static boolean K_TryDraft(player_t *player, mobj_t *dest, fixed_t minDist, fixed
return false; return false;
} }
if (dest->player && G_SameTeam(player, dest->player))
draftdistance = FixedMul(draftdistance, K_TeamComebackMultiplier(player));
// Not close enough to draft. // Not close enough to draft.
if (dist > draftdistance && draftdistance > 0) if (dist > draftdistance && draftdistance > 0)
{ {
@ -15505,6 +15508,9 @@ fixed_t K_GetGradingMultAdjustment(player_t *player)
fixed_t stablerate = 3*FRACUNIT/10; // how low is your placement before losing XP? 4*FRACUNIT/10 = top 40% of race will gain fixed_t stablerate = 3*FRACUNIT/10; // how low is your placement before losing XP? 4*FRACUNIT/10 = top 40% of race will gain
fixed_t result = 0; fixed_t result = 0;
if (g_teamplay)
power = 3 * power / 4;
INT32 live_players = 0; // players we are competing against INT32 live_players = 0; // players we are competing against
for (INT32 i = 0; i < MAXPLAYERS; i++) for (INT32 i = 0; i < MAXPLAYERS; i++)
@ -15716,4 +15722,33 @@ boolean K_TryPickMeUp(mobj_t *m1, mobj_t *m2)
return true; return true;
} }
fixed_t K_TeamComebackMultiplier(player_t *player)
{
INT32 myteam = player->team;
INT32 theirteam = (myteam == TEAM_ORANGE) ? TEAM_BLUE : TEAM_ORANGE;
if (g_teamscores[myteam] >= g_teamscores[theirteam])
return FRACUNIT;
UINT32 ourdistance = 0;
UINT32 theirdistance = 0;
for (UINT8 i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (players[i].team == myteam)
ourdistance += K_GetItemRouletteDistance(&players[i], players[i].itemRoulette.playing);
else
theirdistance += K_GetItemRouletteDistance(&players[i], players[i].itemRoulette.playing);
}
fixed_t multiplier = FixedDiv(ourdistance, theirdistance);
multiplier = min(multiplier, 3*FRACUNIT);
multiplier = max(multiplier, FRACUNIT);
return multiplier;
}
//} //}

View file

@ -322,6 +322,8 @@ void K_BotHitPenalty(player_t *player);
boolean K_TryPickMeUp(mobj_t *m1, mobj_t *m2); boolean K_TryPickMeUp(mobj_t *m1, mobj_t *m2);
fixed_t K_TeamComebackMultiplier(player_t *player);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif

View file

@ -3209,7 +3209,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
K_SpawnAmps(source->player, K_PvPAmpReward((type == DMG_WHUMBLE) ? 30 : 20, source->player, player), target); K_SpawnAmps(source->player, K_PvPAmpReward((type == DMG_WHUMBLE) ? 30 : 20, source->player, player), target);
K_BotHitPenalty(player); K_BotHitPenalty(player);
if (g_teamplay) if (G_SameTeam(source->player, player))
{
if (type != DMG_EXPLODE)
type = DMG_STUMBLE;
}
else
{ {
for (UINT8 i = 0; i < MAXPLAYERS; i++) for (UINT8 i = 0; i < MAXPLAYERS; i++)
{ {
@ -3219,7 +3224,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
continue; continue;
if (source->player == &players[i]) if (source->player == &players[i])
continue; continue;
K_SpawnAmps(&players[i], 5, target); K_SpawnAmps(&players[i], FixedInt(FixedMul(5, K_TeamComebackMultiplier(player))), target);
} }
} }