Skip to content

Commit

Permalink
stage: massively boost all-clear bonus
Browse files Browse the repository at this point in the history
Depends on PIV, current score, and difficulty
  • Loading branch information
Akaricchi committed Sep 7, 2023
1 parent de2f91a commit b8ad5f7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
19 changes: 11 additions & 8 deletions src/stage.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,26 +824,29 @@ static void stage_give_clear_bonus(const StageInfo *stage, StageClearBonus *bonu
StageInfo *next = stageinfo_get_by_id(stage->id + 1);

if(next == NULL || next->type != STAGE_STORY) {
bonus->all_clear = true;
bonus->all_clear.base = global.plr.point_item_value * 100 + global.plr.points / 10;
bonus->all_clear.diff_multiplier = difficulty_value(1.0, 1.1, 1.3, 1.6);
bonus->all_clear.diff_bonus = bonus->all_clear.base * (bonus->all_clear.diff_multiplier - 1.0);
}
}

if(stage->type == STAGE_STORY) {
bonus->base = stage->id * 1000000;
}

if(bonus->all_clear) {
bonus->base += global.plr.point_item_value * 100;
// TODO redesign this
// bonus->graze = global.plr.graze * (global.plr.point_item_value / 10);
}

bonus->voltage = imax(0, (int)global.plr.voltage - (int)global.voltage_threshold) * (global.plr.point_item_value / 25);
bonus->lives = global.plr.lives * global.plr.point_item_value * 5;

// TODO: maybe a difficulty multiplier?

bonus->total = bonus->base + bonus->voltage + bonus->lives + bonus->graze;
bonus->total = (
bonus->base +
bonus->voltage +
bonus->lives +
bonus->graze +
bonus->all_clear.base +
bonus->all_clear.diff_bonus +
0);
player_add_points(&global.plr, bonus->total, global.plr.pos);
}

Expand Down
7 changes: 6 additions & 1 deletion src/stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ typedef struct StageClearBonus {
uint64_t voltage;
uint64_t graze;
uint64_t total;
bool all_clear;

struct {
uint64_t base;
real diff_multiplier;
uint64_t diff_bonus;
} all_clear;
} StageClearBonus;

void stage_enter(StageInfo *stage, ResourceGroup *rg, CallChain next);
Expand Down
21 changes: 19 additions & 2 deletions src/stagedraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1864,12 +1864,29 @@ void stage_draw_hud(void) {

void stage_display_clear_screen(const StageClearBonus *bonus) {
StageTextTable tbl;
stagetext_begin_table(&tbl, bonus->all_clear ? "All Clear!" : "Stage Clear!", RGB(1, 1, 1), RGB(1, 1, 1), VIEWPORT_W/2,

bool all_clear = bonus->all_clear.base;
const char *title = all_clear ? "All Clear!" : "Stage Clear!";

stagetext_begin_table(&tbl, title, RGB(1, 1, 1), RGB(1, 1, 1), 2*VIEWPORT_W/3,
20, 5184000, 60, 60);
stagetext_table_add_numeric_nonzero(&tbl, "Clear bonus", bonus->base);
stagetext_table_add_numeric_nonzero(&tbl, "Stage Clear bonus", bonus->base);
stagetext_table_add_numeric_nonzero(&tbl, "Life bonus", bonus->lives);
stagetext_table_add_numeric_nonzero(&tbl, "Voltage bonus", bonus->voltage);
stagetext_table_add_numeric_nonzero(&tbl, "Graze bonus", bonus->graze);

if(all_clear) {
stagetext_table_add_separator(&tbl);
stagetext_table_add_numeric_nonzero(&tbl, "All Clear bonus", bonus->all_clear.base);

if(bonus->all_clear.diff_bonus) {
char tmp[128];
int percent = (bonus->all_clear.diff_multiplier - 1.0) * 100;
snprintf(tmp, sizeof(tmp), "Difficulty bonus (+%i%%)", percent);
stagetext_table_add_numeric_nonzero(&tbl, tmp, bonus->all_clear.diff_bonus);
}
}

stagetext_table_add_separator(&tbl);
stagetext_table_add_numeric(&tbl, "Total", bonus->total);
stagetext_end_table(&tbl);
Expand Down

0 comments on commit b8ad5f7

Please sign in to comment.