randomize artifact generation
This commit is contained in:
parent
e47036bd8d
commit
4a024a47d9
|
@ -11,7 +11,7 @@ use rand::rngs::ThreadRng;
|
|||
|
||||
use crate::level::{Level, StructureElement};
|
||||
use crate::monster::Monster;
|
||||
use crate::artifacts::{Artifact, Chest};
|
||||
use crate::artifacts::{Artifact, Chest, Potion};
|
||||
use crate::position::Position;
|
||||
|
||||
const ROOMS_VERTICAL: usize = 7;
|
||||
|
@ -264,7 +264,11 @@ impl LevelGenerator {
|
|||
if room.kind == RoomType::TreasureRoom {
|
||||
let t_x = left + room.offset_x + rng.gen_range(0..room.width);
|
||||
let t_y = top + room.offset_y + rng.gen_range(0..room.height);
|
||||
artifacts.push(Box::new(Chest::new(Position::new(self.level, t_x, t_y))));
|
||||
// TODO randomize artifacts
|
||||
match rng.gen_range(1..=100) {
|
||||
1..=50 => { artifacts.push(Box::new(Chest::new(Position::new(self.level, t_x, t_y)))); }
|
||||
_ => { artifacts.push(Box::new(Potion::new(Position::new(self.level, t_x, t_y)))); }
|
||||
};
|
||||
}
|
||||
if room.kind == RoomType::MonsterRoom {
|
||||
let t_x = left + room.offset_x + rng.gen_range(0..room.width);
|
||||
|
|
Loading…
Reference in New Issue