Merge branch 'timo-balance' into 'master'

improvement: enemy balance

See merge request veloren/veloren!738
This commit is contained in:
Timo Koesters 2020-01-20 19:10:09 +00:00
commit ec0692249a
5 changed files with 16 additions and 8 deletions

View File

@ -71,7 +71,8 @@ impl Health {
self.last_change = (0.0, change);
}
pub fn set_maximum(&mut self, amount: u32) {
// This is private because max hp is based on the level
fn set_maximum(&mut self, amount: u32) {
self.maximum = amount;
self.current = self.current.min(self.maximum);
}
@ -160,7 +161,7 @@ impl Stats {
// TODO: Delete this once stat points will be a thing
pub fn update_max_hp(&mut self) {
self.health.set_maximum(42 * self.level.amount);
self.health.set_maximum(27 + 15 * self.level.amount);
}
}

View File

@ -132,7 +132,7 @@ impl<'a> System<'a> for Sys {
}
}
Agent::Enemy { bearing, target } => {
const SIGHT_DIST: f32 = 30.0;
const SIGHT_DIST: f32 = 18.0;
const MIN_ATTACK_DIST: f32 = 3.25;
let mut choose_new = false;

View File

@ -74,7 +74,7 @@ impl<'a> System<'a> for Sys {
{
kind.attack_recover_duration()
} else {
Duration::from_secs(1)
Duration::from_millis(250)
};
let (deal_damage, should_end) = if let Some(Attack { time_left, applied }) =

View File

@ -140,7 +140,7 @@ impl Sys {
// Attack
if !character.action.is_attack() {
Attack {
time_left: Duration::from_millis(100),
time_left: Duration::from_millis(250),
applied: false,
}
} else {

View File

@ -2,7 +2,7 @@ use super::SysTimer;
use crate::{chunk_generator::ChunkGenerator, client::Client, Tick};
use common::{
assets,
comp::{self, Player, Pos},
comp::{self, item, Player, Pos},
event::{EventBus, ServerEvent},
msg::ServerMsg,
state::TerrainChanges,
@ -111,7 +111,7 @@ impl<'a> System<'a> for Sys {
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, 10));
stats.level.set_level(rand::thread_rng().gen_range(1, 4));
if npc.boss {
if rand::random::<f32>() < 0.8 {
@ -121,7 +121,7 @@ impl<'a> System<'a> for Sys {
);
body = comp::Body::Humanoid(comp::humanoid::Body::random());
}
stats.level.set_level(rand::thread_rng().gen_range(20, 50));
stats.level.set_level(rand::thread_rng().gen_range(8, 15));
scale = 2.0 + rand::random::<f32>();
}
@ -129,6 +129,13 @@ impl<'a> System<'a> for Sys {
stats
.health
.set_to(stats.health.maximum(), comp::HealthSource::Revive);
if let Some(item::Item {
kind: item::ItemKind::Tool { power, .. },
..
}) = &mut stats.equipment.main
{
*power = stats.level.level() * 3;
}
server_emitter.emit(ServerEvent::CreateNpc {
pos: Pos(npc.pos),
stats,