From 1666d872e245d720b812ebc84c7af1d313caa8b3 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 26 Aug 2023 23:22:55 -0700 Subject: [PATCH 1/2] No last-minute scams with Garden Top / Flame Shield --- src/k_kart.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 2e279c96e..5b87fd21a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9933,7 +9933,7 @@ void K_KartUpdatePosition(player_t *player) realplayers > 1) { /* grace period so you don't fall off INSTANTLY */ - if (position == 1 && player->topinfirst < 2*TICRATE) + if (K_GetItemRouletteDistance(player, 8) < 2000 && player->topinfirst < 2*TICRATE) // "Why 8?" Literally no reason, but since we intend for constant-ish distance we choose a fake fixed playercount. { player->topinfirst++; } @@ -10032,6 +10032,7 @@ static INT32 K_FlameShieldMax(player_t *player) UINT32 distv = 2048; distv = distv * 16 / FLAMESHIELD_MAX; // Old distv was based on a 16-segment bar UINT8 numplayers = 0; + UINT32 scamradius = 2000; // How close is close enough that we shouldn't be allowed to scam 1st? UINT8 i; if (gametyperules & GTR_CIRCUIT) @@ -10045,18 +10046,21 @@ static INT32 K_FlameShieldMax(player_t *player) } } + disttofinish = player->distancetofinish - disttofinish; + distv = FixedMul(distv, mapobjectscale); + if (numplayers <= 1) { return FLAMESHIELD_MAX; // max when alone, for testing // and when in battle, for chaos } - else if (player->position == 1) + else if (player->position == 1 || disttofinish < scamradius) { return 0; // minimum for first } - disttofinish = player->distancetofinish - disttofinish; - distv = FixedMul(distv, mapobjectscale); + disttofinish = disttofinish - scamradius; + return min(FLAMESHIELD_MAX, (FLAMESHIELD_MAX / 16) + (disttofinish / distv)); // Ditto for this minimum, old value was 1/16 } From d7e989c54c95f9da95c5746bd08dbc32f9c8e91e Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 26 Aug 2023 23:32:13 -0700 Subject: [PATCH 2/2] Buff Flame Shield bar-per-distance to compensate for scamlessness --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 5b87fd21a..c31ef9cdc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10029,7 +10029,7 @@ void K_StripOther(player_t *player) static INT32 K_FlameShieldMax(player_t *player) { UINT32 disttofinish = 0; - UINT32 distv = 2048; + UINT32 distv = 1024; // Pre no-scams: 2048 distv = distv * 16 / FLAMESHIELD_MAX; // Old distv was based on a 16-segment bar UINT8 numplayers = 0; UINT32 scamradius = 2000; // How close is close enough that we shouldn't be allowed to scam 1st?