more work on dungeon slayer
This commit is contained in:
parent
cad08bd300
commit
0b08cb41c2
|
@ -175,6 +175,7 @@ impl Game {
|
||||||
// monster died, player gains experience
|
// monster died, player gains experience
|
||||||
if m.is_dead() {
|
if m.is_dead() {
|
||||||
self.player.gain_experience(m.get_experience_gain());
|
self.player.gain_experience(m.get_experience_gain());
|
||||||
|
self.messages.insert(0, format!("you killed the {}..", m.get_name()).to_string());
|
||||||
}
|
}
|
||||||
return m.is_dead();
|
return m.is_dead();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ use rand::rngs::ThreadRng;
|
||||||
|
|
||||||
use crate::artifacts::{Artifact, Chest, Potion};
|
use crate::artifacts::{Artifact, Chest, Potion};
|
||||||
use crate::level::{Level, StructureElement};
|
use crate::level::{Level, StructureElement};
|
||||||
use crate::monster::{Monster, Orc, Rat};
|
use crate::monster::{LowerDaemon, Monster, Orc, Rat};
|
||||||
use crate::position::Position;
|
use crate::position::Position;
|
||||||
|
|
||||||
const ROOMS_VERTICAL: usize = 7;
|
const ROOMS_VERTICAL: usize = 7;
|
||||||
|
@ -276,7 +276,7 @@ impl LevelGenerator {
|
||||||
// TODO randomize enemies here
|
// TODO randomize enemies here
|
||||||
match rng.gen_range(1..=100) {
|
match rng.gen_range(1..=100) {
|
||||||
1..=50 => {
|
1..=50 => {
|
||||||
enemies.push(Box::new(Orc::new_with_position(Position::new(self.level, t_x, t_y))));
|
enemies.push(Box::new(LowerDaemon::new_with_position(Position::new(self.level, t_x, t_y))));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
enemies.push(Box::new(Rat::new_with_position(Position::new(self.level, t_x, t_y))));
|
enemies.push(Box::new(Rat::new_with_position(Position::new(self.level, t_x, t_y))));
|
||||||
|
|
|
@ -44,6 +44,58 @@ macro_rules! default_monster {
|
||||||
)+)
|
)+)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Lower Daemon
|
||||||
|
/// Page: 107
|
||||||
|
/// GH: 1
|
||||||
|
pub struct LowerDaemon {
|
||||||
|
name: String,
|
||||||
|
life: usize,
|
||||||
|
position: Position,
|
||||||
|
symbol: String,
|
||||||
|
color: Color,
|
||||||
|
experience_gain: usize,
|
||||||
|
ticks_between_steps: u128,
|
||||||
|
monster_stats: MonsterStats,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl crate::monster::LowerDaemon {
|
||||||
|
pub fn new_with_position(position: Position) -> Self {
|
||||||
|
let monster_stats = MonsterStats {
|
||||||
|
body: 5,
|
||||||
|
agility: 5,
|
||||||
|
mind: 5,
|
||||||
|
strength: 2,
|
||||||
|
toughness: 2,
|
||||||
|
movement: 2,
|
||||||
|
dexterity: 2,
|
||||||
|
wisdom: 2,
|
||||||
|
aura: 2,
|
||||||
|
max_life: 9,
|
||||||
|
defense: 9,
|
||||||
|
initiative: 7,
|
||||||
|
walk: 3,
|
||||||
|
hit: 8,
|
||||||
|
shoot: 0,
|
||||||
|
cast: 0,
|
||||||
|
targeted_cast: 0,
|
||||||
|
};
|
||||||
|
Self {
|
||||||
|
name: "lower daemon".to_string(),
|
||||||
|
life: monster_stats.max_life as usize,
|
||||||
|
position,
|
||||||
|
symbol: String::from("d"),
|
||||||
|
color: Color::Black,
|
||||||
|
experience_gain: 104,
|
||||||
|
ticks_between_steps: 5,
|
||||||
|
monster_stats,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default_monster!(LowerDaemon);
|
||||||
|
|
||||||
|
/// Rat
|
||||||
|
/// Page: 119
|
||||||
|
/// GH: 1
|
||||||
pub struct Rat {
|
pub struct Rat {
|
||||||
name: String,
|
name: String,
|
||||||
life: usize,
|
life: usize,
|
||||||
|
@ -78,11 +130,11 @@ impl Rat {
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
name: "rat".to_string(),
|
name: "rat".to_string(),
|
||||||
life: 3,
|
life: monster_stats.max_life as usize,
|
||||||
position,
|
position,
|
||||||
symbol: String::from("R"),
|
symbol: String::from("R"),
|
||||||
color: Color::Black,
|
color: Color::Black,
|
||||||
experience_gain: 5,
|
experience_gain: 26,
|
||||||
ticks_between_steps: 5,
|
ticks_between_steps: 5,
|
||||||
monster_stats,
|
monster_stats,
|
||||||
}
|
}
|
||||||
|
@ -90,6 +142,9 @@ impl Rat {
|
||||||
}
|
}
|
||||||
default_monster!(Rat);
|
default_monster!(Rat);
|
||||||
|
|
||||||
|
/// Orc
|
||||||
|
/// Page: 118
|
||||||
|
/// GH: 2
|
||||||
pub struct Orc {
|
pub struct Orc {
|
||||||
name: String,
|
name: String,
|
||||||
life: usize,
|
life: usize,
|
||||||
|
@ -124,11 +179,11 @@ impl Orc {
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
name: "orc".to_string(),
|
name: "orc".to_string(),
|
||||||
life: 23,
|
life: monster_stats.max_life as usize,
|
||||||
position,
|
position,
|
||||||
symbol: String::from("O"),
|
symbol: String::from("O"),
|
||||||
color: Color::DarkGray,
|
color: Color::DarkGray,
|
||||||
experience_gain: 10,
|
experience_gain: 63,
|
||||||
ticks_between_steps: 10,
|
ticks_between_steps: 10,
|
||||||
monster_stats,
|
monster_stats,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue