mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Make enemies spawn with different levels
This commit is contained in:
parent
152efaee3b
commit
9e10c8b700
@ -12,6 +12,7 @@ pub enum HealthSource {
|
||||
Command,
|
||||
LevelUp,
|
||||
Item,
|
||||
Creation,
|
||||
Unknown,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
@ -133,10 +134,9 @@ impl Exp {
|
||||
}
|
||||
|
||||
impl Level {
|
||||
// TODO: Uncomment when needed
|
||||
// pub fn set_level(&mut self, level: u32) {
|
||||
// self.amount = level;
|
||||
// }
|
||||
pub fn set_level(&mut self, level: u32) {
|
||||
self.amount = level;
|
||||
}
|
||||
|
||||
pub fn level(&self) -> u32 {
|
||||
self.amount
|
||||
@ -167,6 +167,11 @@ impl Stats {
|
||||
.set_to(self.health.maximum(), HealthSource::Revive);
|
||||
self.is_dead = false;
|
||||
}
|
||||
|
||||
// TODO: Delet this once stat points will be a thing
|
||||
pub fn level_hp_bonus(&mut self, level: u32) {
|
||||
self.health.set_maximum((10 * level) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
impl Stats {
|
||||
|
@ -560,6 +560,12 @@ impl Server {
|
||||
};
|
||||
let mut scale = 1.0;
|
||||
|
||||
// TODO: Remove this and implement scaling or level depending on stuff like species instead
|
||||
stats.level.set_level(rand::thread_rng().gen_range(1, 20));
|
||||
if stats.level.level() > 1 {
|
||||
stats.level_hp_bonus(stats.level.level());
|
||||
}
|
||||
|
||||
if npc.boss {
|
||||
if rand::random::<f32>() < 0.8 {
|
||||
stats = comp::Stats::new(
|
||||
|
Loading…
Reference in New Issue
Block a user