A couple of terrain types added. First adventure added, incomplete.
This commit is contained in:
81
src/bosses/adventure_system.nvgt
Normal file
81
src/bosses/adventure_system.nvgt
Normal file
@@ -0,0 +1,81 @@
|
||||
// Adventure System
|
||||
// Handles triggering and managing terrain-specific adventures
|
||||
|
||||
#include "src/bosses/unicorn/unicorn_boss.nvgt"
|
||||
|
||||
void check_adventure_menu(int player_x) {
|
||||
if (key_pressed(KEY_TAB)) {
|
||||
run_adventure_menu(player_x);
|
||||
}
|
||||
}
|
||||
|
||||
void run_adventure_menu(int player_x) {
|
||||
if (player_x <= BASE_END) {
|
||||
speak_with_history("No adventures available in the base.", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (last_adventure_day == current_day) {
|
||||
speak_with_history("You have already attempted an adventure today.", true);
|
||||
return;
|
||||
}
|
||||
|
||||
string terrain = get_terrain_at_position(player_x);
|
||||
MountainRange@ mountain = get_mountain_at(player_x);
|
||||
|
||||
// Check available adventures based on terrain
|
||||
string[] options;
|
||||
int[] adventure_ids; // 1 = Unicorn
|
||||
|
||||
if (mountain !is null) {
|
||||
// Mountain terrain
|
||||
options.insert_last("Unicorn Hunt (Mountain Boss)");
|
||||
adventure_ids.insert_last(1);
|
||||
}
|
||||
|
||||
if (options.length() == 0) {
|
||||
speak_with_history("No adventures found in this area.", true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Show Menu
|
||||
speak_with_history("Adventure Menu.", true);
|
||||
int selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
|
||||
while (true) {
|
||||
wait(5);
|
||||
|
||||
if (key_pressed(KEY_ESCAPE)) {
|
||||
speak_with_history("Closed.", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_DOWN)) {
|
||||
selection++;
|
||||
if (selection >= options.length()) selection = 0;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP)) {
|
||||
selection--;
|
||||
if (selection < 0) selection = options.length() - 1;
|
||||
speak_with_history(options[selection], true);
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_RETURN)) {
|
||||
start_adventure(adventure_ids[selection]);
|
||||
// Adventure has finished (it blocks until done)
|
||||
// Resume main game ambience
|
||||
update_ambience(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void start_adventure(int adventure_id) {
|
||||
last_adventure_day = current_day;
|
||||
if (adventure_id == 1) {
|
||||
run_unicorn_adventure();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user