A first-pass attempt at the "digestion" hidden stat for Battle - pushing just in case I fall asleep before we can explore this, and/or end up busy in the next few days.

* At the start of the first bar, everyone digests spheres at 1 per second, same as before.
* This actually only starts counting down from the most recent moment your spheres becomes nonzero, which is a very, VERY tiny buff to prevent their instant depletion.
* At around 40 spheres:
    * Chao digests them at 1 sphere per *tic*. Might be slightly too punishing.
    * Mecha Sonic digests them at 1 sphere per... 33 tics, or barely faster than before. Might be slightly not punishing enough.
    * Everyone else is linearily in between.
This commit is contained in:
toaster 2022-03-06 22:23:40 +00:00
parent f518ae5c58
commit 5f3bf3e8a2
4 changed files with 30 additions and 3 deletions

View file

@ -494,6 +494,7 @@ typedef struct player_s
INT16 karmadelay;
tic_t overtimekarma; // time to live in overtime comeback
INT16 spheres;
tic_t spheredigestion;
SINT8 glanceDir; // Direction the player is trying to look backwards in

View file

@ -7065,12 +7065,32 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
{
// Deplete 1 every tic when removed from the game.
player->spheres--;
player->spheredigestion = 0;
}
else
{
// Deplete 1 every second when playing.
if ((leveltime % TICRATE) == 0)
player->spheres--;
INT16 spheredigestion = TICRATE; // Base rate of 1 every second when playing.
INT16 digestionpower = ((10 - player->kartspeed) + (10 - player->kartweight))-1; // 1 to 17
spheredigestion -= ((player->spheres*digestionpower)/20);
if (spheredigestion < 1) // just in case
{
spheredigestion = 1;
}
if ((player->spheres > 0) && (player->spheredigestion > 0))
{
player->spheredigestion--;
if (player->spheredigestion == 0)
{
player->spheres--;
player->spheredigestion = (tic_t)spheredigestion;
}
}
else
{
player->spheredigestion = (tic_t)spheredigestion;
}
}
if (player->spheres > 40)

View file

@ -372,6 +372,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->karmadelay);
else if (fastcmp(field,"spheres"))
lua_pushinteger(L, plr->spheres);
else if (fastcmp(field,"spheredigestion"))
lua_pushinteger(L, plr->spheredigestion);
else if (fastcmp(field,"pflags"))
lua_pushinteger(L, plr->pflags);
else if (fastcmp(field,"panim"))
@ -714,6 +716,8 @@ static int player_set(lua_State *L)
plr->karmadelay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"spheres"))
plr->spheres = luaL_checkinteger(L, 3);
else if (fastcmp(field,"spheredigestion"))
plr->spheredigestion = luaL_checkinteger(L, 3);
else if (fastcmp(field,"kartspeed"))
plr->kartspeed = luaL_checkinteger(L, 3);
else if (fastcmp(field,"kartweight"))

View file

@ -333,6 +333,7 @@ static void P_NetArchivePlayers(void)
WRITEINT16(save_p, players[i].karmadelay);
WRITEUINT32(save_p, players[i].overtimekarma);
WRITEINT16(save_p, players[i].spheres);
WRITEINT16(save_p, players[i].spheredigestion);
WRITESINT8(save_p, players[i].glanceDir);
WRITEUINT8(save_p, players[i].tripWireState);
@ -597,6 +598,7 @@ static void P_NetUnArchivePlayers(void)
players[i].karmadelay = READINT16(save_p);
players[i].overtimekarma = READUINT32(save_p);
players[i].spheres = READINT16(save_p);
players[i].spheredigestion = READINT16(save_p);
players[i].glanceDir = READSINT8(save_p);
players[i].tripWireState = READUINT8(save_p);