2022-02-02 13:46:44 -05:00
|
|
|
use ::rltk::prelude::*;
|
2022-02-02 09:45:19 -05:00
|
|
|
|
|
|
|
use crate::{colors, gamelog};
|
|
|
|
|
|
|
|
#[derive(PartialEq, Copy, Clone)]
|
|
|
|
pub enum GameOverResult {
|
|
|
|
NoSelection,
|
|
|
|
QuitToMenu,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn game_over(ctx: &mut Rltk) -> GameOverResult {
|
2022-02-02 13:46:44 -05:00
|
|
|
let mut draw_batch = DrawBatch::new();
|
|
|
|
draw_batch.print_color_centered(
|
|
|
|
15,
|
|
|
|
"Your journey has ended!",
|
|
|
|
ColorPair::new(colors::YELLOW, colors::BLACK),
|
|
|
|
);
|
|
|
|
draw_batch.print_color_centered(
|
2022-02-02 09:45:19 -05:00
|
|
|
17,
|
|
|
|
"One day, we'll tell you all about how you did.",
|
2022-02-02 13:46:44 -05:00
|
|
|
ColorPair::new(colors::WHITE, colors::BLACK),
|
2022-02-02 09:45:19 -05:00
|
|
|
);
|
2022-02-02 13:46:44 -05:00
|
|
|
draw_batch.print_color_centered(
|
2022-02-02 09:45:19 -05:00
|
|
|
18,
|
|
|
|
"That day, sadly, is not in this chapter...",
|
2022-02-02 13:46:44 -05:00
|
|
|
ColorPair::new(colors::WHITE, colors::BLACK),
|
2022-02-02 09:45:19 -05:00
|
|
|
);
|
|
|
|
|
2022-02-02 13:46:44 -05:00
|
|
|
draw_batch.print_color_centered(
|
2022-02-02 09:45:19 -05:00
|
|
|
19,
|
|
|
|
format!("You lived for {} turns.", gamelog::get_event_count("Turn")),
|
2022-02-02 13:46:44 -05:00
|
|
|
ColorPair::new(colors::WHITE, colors::BLACK),
|
2022-02-02 09:45:19 -05:00
|
|
|
);
|
2022-02-02 13:46:44 -05:00
|
|
|
draw_batch.print_color_centered(
|
2022-02-02 09:45:19 -05:00
|
|
|
20,
|
|
|
|
&format!(
|
|
|
|
"You suffered {} points of damage.",
|
|
|
|
gamelog::get_event_count("Damage Taken")
|
|
|
|
),
|
2022-02-02 13:46:44 -05:00
|
|
|
ColorPair::new(colors::RED, colors::BLACK),
|
2022-02-02 09:45:19 -05:00
|
|
|
);
|
2022-02-02 13:46:44 -05:00
|
|
|
draw_batch.print_color_centered(
|
2022-02-02 09:45:19 -05:00
|
|
|
21,
|
|
|
|
&format!(
|
|
|
|
"You inflicted {} points of damage.",
|
|
|
|
gamelog::get_event_count("Damage Inflicted")
|
|
|
|
),
|
2022-02-02 13:46:44 -05:00
|
|
|
ColorPair::new(colors::RED, colors::BLACK),
|
2022-02-02 09:45:19 -05:00
|
|
|
);
|
|
|
|
|
2022-02-02 13:46:44 -05:00
|
|
|
draw_batch.print_color_centered(
|
2022-02-02 09:45:19 -05:00
|
|
|
23,
|
|
|
|
"Press any key to return to the menu.",
|
2022-02-02 13:46:44 -05:00
|
|
|
ColorPair::new(colors::MAGENTA, colors::BLACK),
|
2022-02-02 09:45:19 -05:00
|
|
|
);
|
|
|
|
|
2022-02-02 13:46:44 -05:00
|
|
|
draw_batch
|
|
|
|
.submit(6000)
|
|
|
|
.expect("Failed to batch draw Game Over menu");
|
|
|
|
|
2022-02-02 09:45:19 -05:00
|
|
|
match ctx.key {
|
|
|
|
None => GameOverResult::NoSelection,
|
|
|
|
Some(_) => GameOverResult::QuitToMenu,
|
|
|
|
}
|
|
|
|
}
|