Merge branch 'less-multihit-amps' into 'master'

Reduce multihit/staggered Amp gains

See merge request kart-krew-dev/ring-racers-internal!2854
This commit is contained in:
Oni VelocitOni 2025-09-16 01:10:58 +00:00
commit 9d1b104b9c
4 changed files with 27 additions and 0 deletions

View file

@ -1131,6 +1131,7 @@ struct player_t
UINT32 lastringboost; // What was our accumulated boost when locking the award?
UINT8 amps;
UINT8 recentamps;
UINT8 amppickup;
UINT8 ampspending;

View file

@ -4430,6 +4430,22 @@ void K_SpawnAmps(player_t *player, UINT8 amps, mobj_t *impact)
// FixedMul(scaledamps<<FRACBITS, itemdistmult)>>FRACBITS);
scaledamps = FixedMul(scaledamps<<FRACBITS, itemdistmult)>>FRACBITS;
//CONS_Printf("SA=%d ", scaledamps);
// Arbitrary tuning constants.
// Reduce amp payouts by 1/40th for each 2 amps obtained recently
UINT8 num = 40;
UINT8 div = 40;
UINT8 reduction = min(30, player->recentamps);
num -= reduction;
//CONS_Printf("N=%d D=%d RA=%d ", num, div, player->recentamps);
scaledamps = num * scaledamps / div;
//CONS_Printf("SA2=%d\n", scaledamps);
/*
if (player->position <= 1)
scaledamps /= 2;
@ -4446,6 +4462,7 @@ void K_SpawnAmps(player_t *player, UINT8 amps, mobj_t *impact)
pickup->color = player->skincolor;
P_SetTarget(&pickup->target, player->mo);
player->ampspending++;
player->recentamps++;
}
}
@ -10608,6 +10625,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
}
}
if (player->recentamps && (leveltime%TICRATE == 0))
player->recentamps--;
if (player->invincibilitytimer && (player->ignoreAirtimeLeniency > 0 || onground == true || K_PowerUpRemaining(player, POWERUP_SMONITOR)))
{
player->invincibilitytimer--;

View file

@ -295,6 +295,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->lastringboost);
else if (fastcmp(field,"amps"))
lua_pushinteger(L, plr->amps);
else if (fastcmp(field,"recentamps"))
lua_pushinteger(L, plr->recentamps);
else if (fastcmp(field,"amppickup"))
lua_pushinteger(L, plr->amppickup);
else if (fastcmp(field,"ampspending"))
@ -958,6 +960,8 @@ static int player_set(lua_State *L)
plr->lastringboost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"amps"))
plr->amps = luaL_checkinteger(L, 3);
else if (fastcmp(field,"recentamps"))
plr->recentamps = luaL_checkinteger(L, 3);
else if (fastcmp(field,"amppickup"))
plr->amppickup = luaL_checkinteger(L, 3);
else if (fastcmp(field,"ampspending"))

View file

@ -708,6 +708,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT32(save->p, players[i].lastringboost);
WRITEUINT8(save->p, players[i].amps);
WRITEUINT8(save->p, players[i].recentamps);
WRITEUINT8(save->p, players[i].amppickup);
WRITEUINT8(save->p, players[i].ampspending);
@ -1383,6 +1384,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].lastringboost = READUINT32(save->p);
players[i].amps =READUINT8(save->p);
players[i].recentamps =READUINT8(save->p);
players[i].amppickup =READUINT8(save->p);
players[i].ampspending =READUINT8(save->p);