58 lines
1.5 KiB
Rust
58 lines
1.5 KiB
Rust
use crate::{
|
|
graphics::vga_color as vga,
|
|
resources::{sound_output::SoundSamples, SoundEffects},
|
|
};
|
|
use bracket_lib::prelude::*;
|
|
|
|
#[derive(Debug)]
|
|
pub struct Monster {
|
|
pub kind: MonsterKind,
|
|
pub ticks_until_move: i32,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
pub enum MonsterKind {
|
|
Slow,
|
|
Medium,
|
|
Fast,
|
|
}
|
|
|
|
pub fn glyphs_for_kind(kind: MonsterKind) -> Vec<u16> {
|
|
match kind {
|
|
MonsterKind::Slow => vec![to_cp437('Ä'), to_cp437('A')],
|
|
MonsterKind::Medium => vec![to_cp437('ö'), to_cp437('Ö')],
|
|
MonsterKind::Fast => vec![to_cp437('Ω')],
|
|
}
|
|
}
|
|
|
|
pub fn color_for_kind(kind: MonsterKind) -> RGB {
|
|
match kind {
|
|
MonsterKind::Slow => RGB::named(vga::RED_BRIGHT),
|
|
MonsterKind::Medium => RGB::named(vga::GREEN_BRIGHT),
|
|
MonsterKind::Fast => RGB::named(vga::BLUE_BRIGHT),
|
|
}
|
|
}
|
|
|
|
pub fn ticks_for_kind(kind: MonsterKind) -> i32 {
|
|
match kind {
|
|
MonsterKind::Slow => 10,
|
|
MonsterKind::Medium => 8,
|
|
MonsterKind::Fast => 6,
|
|
}
|
|
}
|
|
|
|
pub fn damage_for_kind(kind: MonsterKind) -> u32 {
|
|
match kind {
|
|
MonsterKind::Slow => 1,
|
|
MonsterKind::Medium => 2,
|
|
MonsterKind::Fast => 3,
|
|
}
|
|
}
|
|
|
|
pub fn sound_effect_for_kind(kind: MonsterKind, sound_effects: &SoundEffects) -> SoundSamples {
|
|
match kind {
|
|
MonsterKind::Slow => sound_effects.slow_hit.clone(),
|
|
MonsterKind::Medium => sound_effects.medium_hit.clone(),
|
|
MonsterKind::Fast => sound_effects.fast_hit.clone(),
|
|
}
|
|
}
|