Health can now be scaled for npcs again.

This commit is contained in:
Sam 2021-01-04 13:14:07 -05:00
parent 1d90b64898
commit cb3e44a811
3 changed files with 7 additions and 6 deletions

View File

@ -20,7 +20,8 @@ pub struct EntityInfo {
pub main_tool: Option<Item>,
pub second_tool: Option<Item>,
pub scale: f32,
pub level: Option<u32>,
// TODO: Properly give NPCs skills
pub level: Option<u16>,
pub loot_drop: Option<Item>,
pub config: Option<LoadoutConfig>,
pub pet: Option<Box<EntityInfo>>,
@ -103,7 +104,7 @@ impl EntityInfo {
self
}
pub fn with_level(mut self, level: u32) -> Self {
pub fn with_level(mut self, level: u16) -> Self {
self.level = Some(level);
self
}

View File

@ -152,7 +152,7 @@ impl<'a> System<'a> for Sys {
let loadout = LoadoutBuilder::build_loadout(body, main_tool, config).build();
let health = comp::Health::new(stats.body_type, 0); // Placeholder 0
let health = comp::Health::new(stats.body_type, entity.level.unwrap_or(0));
let can_speak = match body {
comp::Body::Humanoid(_) => alignment == comp::Alignment::Npc,

View File

@ -604,7 +604,7 @@ impl Floor {
.with_level(dynamic_rng.gen_range(
(room.difficulty as f32).powf(1.25) + 3.0,
(room.difficulty as f32).powf(1.5) + 4.0,
).round() as u32);
).round() as u16);
let entity = match room.difficulty {
0 => entity
.with_name("Outcast")
@ -881,7 +881,7 @@ impl Floor {
(room.difficulty as f32).powf(1.5) + 4.0,
)
.round()
as u32
as u16
* 5,
)
.with_alignment(comp::Alignment::Enemy),
@ -1050,7 +1050,7 @@ impl Floor {
(room.difficulty as f32).powf(1.5) + 4.0,
)
.round()
as u32
as u16
* 5,
)
.with_alignment(comp::Alignment::Enemy),