Merge branch 'sam/remove-fake-health' into 'master'

Removed health scaling from generation

Closes #1354

See merge request veloren/veloren!3100
This commit is contained in:
Samuel Keiffer 2022-01-15 22:34:48 +00:00
commit 7b7ad62be9
17 changed files with 38 additions and 154 deletions

View File

@ -14,5 +14,6 @@ EntityConfig (
meta: [ meta: [
LoadoutAsset("common.loadout.world.traveler"), LoadoutAsset("common.loadout.world.traveler"),
SkillSetAsset("common.skillset.preset.rank5.fullskill"),
], ],
) )

View File

@ -4,7 +4,7 @@ ItemDef(
kind: Armor(( kind: Armor((
kind: Back("Ferocious"), kind: Back("Ferocious"),
stats: ( stats: (
protection: Some(Normal(3.0)), protection: Some(Normal(6.0)),
), ),
)), )),
quality: Epic, quality: Epic,

View File

@ -4,7 +4,7 @@ ItemDef(
kind: Armor(( kind: Armor((
kind: Belt("Ferocious"), kind: Belt("Ferocious"),
stats: ( stats: (
protection: Some(Normal(6.0)), protection: Some(Normal(12.0)),
), ),
)), )),
quality: Epic, quality: Epic,

View File

@ -4,7 +4,7 @@ ItemDef(
kind: Armor(( kind: Armor((
kind: Chest("Ferocious"), kind: Chest("Ferocious"),
stats: ( stats: (
protection: Some(Normal(30.0)), protection: Some(Normal(60.0)),
), ),
)), )),
quality: Epic, quality: Epic,

View File

@ -4,7 +4,7 @@ ItemDef(
kind: Armor(( kind: Armor((
kind: Foot("Ferocious"), kind: Foot("Ferocious"),
stats: ( stats: (
protection: Some(Normal(6.0)), protection: Some(Normal(12.0)),
), ),
)), )),
quality: Epic, quality: Epic,

View File

@ -4,7 +4,7 @@ ItemDef(
kind: Armor(( kind: Armor((
kind: Hand("Ferocious"), kind: Hand("Ferocious"),
stats: ( stats: (
protection: Some(Normal(12.0)), protection: Some(Normal(24.0)),
), ),
)), )),
quality: Epic, quality: Epic,

View File

@ -4,7 +4,7 @@ ItemDef(
kind: Armor(( kind: Armor((
kind: Pants("Ferocious"), kind: Pants("Ferocious"),
stats: ( stats: (
protection: Some(Normal(24.0)), protection: Some(Normal(48.0)),
), ),
)), )),
quality: Epic, quality: Epic,

View File

@ -4,7 +4,7 @@ ItemDef(
kind: Armor(( kind: Armor((
kind: Shoulder("Ferocious"), kind: Shoulder("Ferocious"),
stats: ( stats: (
protection: Some(Normal(18.0)), protection: Some(Normal(36.0)),
), ),
)), )),
quality: Epic, quality: Epic,

View File

@ -16,7 +16,7 @@ pub mod theropod;
use crate::{ use crate::{
assets::{self, Asset}, assets::{self, Asset},
consts::{HUMANOID_HP_PER_LEVEL, HUMAN_DENSITY, WATER_DENSITY}, consts::{HUMAN_DENSITY, WATER_DENSITY},
make_case_elim, make_case_elim,
npc::NpcKind, npc::NpcKind,
}; };
@ -593,14 +593,16 @@ impl Body {
biped_large::Species::Blueoni => 240, biped_large::Species::Blueoni => 240,
biped_large::Species::Redoni => 240, biped_large::Species::Redoni => 240,
biped_large::Species::Huskbrute => 800, biped_large::Species::Huskbrute => 800,
biped_large::Species::Cultistwarlord => 250,
biped_large::Species::Cultistwarlock => 250,
_ => 120, _ => 120,
}, },
Body::BipedSmall(biped_small) => match biped_small.species { Body::BipedSmall(biped_small) => match biped_small.species {
biped_small::Species::Gnarling => 50, biped_small::Species::Gnarling => 50,
biped_small::Species::Adlet => 60, biped_small::Species::Adlet => 65,
biped_small::Species::Sahagin => 80, biped_small::Species::Sahagin => 85,
biped_small::Species::Haniwa => 90, biped_small::Species::Haniwa => 100,
biped_small::Species::Myrmidon => 90, biped_small::Species::Myrmidon => 100,
biped_small::Species::Husk => 20, biped_small::Species::Husk => 20,
_ => 60, _ => 60,
}, },
@ -642,110 +644,6 @@ impl Body {
} }
} }
#[allow(unreachable_patterns)]
pub fn base_health_increase(&self) -> u16 {
match self {
Body::Humanoid(_) => HUMANOID_HP_PER_LEVEL,
Body::QuadrupedSmall(quadruped_small) => match quadruped_small.species {
quadruped_small::Species::Boar => 2,
quadruped_small::Species::Batfox => 1,
quadruped_small::Species::Dodarock => 3,
quadruped_small::Species::Holladon => 3,
quadruped_small::Species::Hyena => 2,
quadruped_small::Species::Truffler => 2,
_ => 1,
},
Body::QuadrupedMedium(quadruped_medium) => match quadruped_medium.species {
quadruped_medium::Species::Grolgar => 3,
quadruped_medium::Species::Saber => 2,
quadruped_medium::Species::Tiger => 2,
quadruped_medium::Species::Tuskram => 3,
quadruped_medium::Species::Lion => 4,
quadruped_medium::Species::Tarasque => 6,
quadruped_medium::Species::Wolf => 2,
quadruped_medium::Species::Frostfang => 4,
quadruped_medium::Species::Mouflon => 3,
quadruped_medium::Species::Catoblepas => 5,
quadruped_medium::Species::Bonerattler => 3,
quadruped_medium::Species::Deer => 2,
quadruped_medium::Species::Hirdrasil => 3,
quadruped_medium::Species::Roshwalr => 4,
quadruped_medium::Species::Donkey => 3,
quadruped_medium::Species::Camel => 3,
quadruped_medium::Species::Zebra => 3,
quadruped_medium::Species::Antelope => 2,
quadruped_medium::Species::Kelpie => 3,
quadruped_medium::Species::Horse => 3,
quadruped_medium::Species::Barghest => 5,
quadruped_medium::Species::Cattle => 3,
quadruped_medium::Species::Highland => 3,
quadruped_medium::Species::Yak => 5,
quadruped_medium::Species::Panda => 4,
quadruped_medium::Species::Bear => 4,
quadruped_medium::Species::Moose => 3,
quadruped_medium::Species::Dreadhorn => 6,
quadruped_medium::Species::Mammoth => 8,
quadruped_medium::Species::Ngoubou => 7,
_ => 2,
},
Body::BirdMedium(bird_medium) => match bird_medium.species {
bird_medium::Species::Chicken => 1,
bird_medium::Species::Duck => 1,
bird_medium::Species::Goose => 1,
bird_medium::Species::Parrot => 1,
bird_medium::Species::Penguin => 1,
bird_medium::Species::Peacock => 1,
bird_medium::Species::Eagle => 1,
_ => 2,
},
Body::FishMedium(_) => 1,
Body::Dragon(_) => 50,
Body::BirdLarge(bird_large) => match bird_large.species {
bird_large::Species::Roc => 11,
_ => 12,
},
Body::FishSmall(_) => 1,
Body::BipedLarge(biped_large) => match biped_large.species {
biped_large::Species::Ogre => 7,
biped_large::Species::Cyclops => 8,
biped_large::Species::Wendigo => 8,
biped_large::Species::Cavetroll => 6,
biped_large::Species::Mountaintroll => 6,
biped_large::Species::Swamptroll => 6,
biped_large::Species::Dullahan => 12,
biped_large::Species::Huskbrute => 10,
// Boss enemies have their health set, not adjusted by level.
biped_large::Species::Huskbrute => 0,
biped_large::Species::Mindflayer => 0,
biped_large::Species::Minotaur => 0,
biped_large::Species::Tidalwarrior => 0,
biped_large::Species::Yeti => 0,
biped_large::Species::Harvester => 0,
_ => 10,
},
Body::BipedSmall(_) => 1,
Body::Object(_) => 1,
Body::Golem(_) => 0,
Body::Theropod(_) => 2,
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
quadruped_low::Species::Crocodile => 2,
quadruped_low::Species::Alligator => 2,
quadruped_low::Species::Salamander => 1,
quadruped_low::Species::Monitor => 1,
quadruped_low::Species::Asp => 1,
quadruped_low::Species::Tortoise => 2,
quadruped_low::Species::Rocksnapper => 5,
quadruped_low::Species::Pangolin => 1,
quadruped_low::Species::Maneater => 3,
quadruped_low::Species::Sandshark => 5,
quadruped_low::Species::Hakulaq => 1,
quadruped_low::Species::Deadwood => 3,
_ => 2,
},
Body::Ship(_) => 50,
}
}
pub fn flying_height(&self) -> f32 { pub fn flying_height(&self) -> f32 {
match self { match self {
Body::BirdLarge(_) => 50.0, Body::BirdLarge(_) => 50.0,

View File

@ -1,6 +1,6 @@
#[cfg(not(target_arch = "wasm32"))]
use crate::comp;
use crate::DamageSource; use crate::DamageSource;
#[cfg(not(target_arch = "wasm32"))]
use crate::{comp, consts::HP_PER_LEVEL};
use hashbrown::HashMap; use hashbrown::HashMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::convert::TryFrom; use std::convert::TryFrom;
@ -106,7 +106,7 @@ impl Health {
pub fn new(body: comp::Body, level: u16) -> Self { pub fn new(body: comp::Body, level: u16) -> Self {
let health = u32::from( let health = u32::from(
body.base_health() body.base_health()
.saturating_add(body.base_health_increase().saturating_mul(level)), .saturating_add(HP_PER_LEVEL.saturating_mul(level)),
) * Self::SCALING_FACTOR_INT; ) * Self::SCALING_FACTOR_INT;
Health { Health {
current: health, current: health,
@ -129,7 +129,7 @@ impl Health {
let old_max = self.base_max; let old_max = self.base_max;
self.base_max = u32::from( self.base_max = u32::from(
body.base_health() body.base_health()
.saturating_add(body.base_health_increase().saturating_mul(level)), .saturating_add(HP_PER_LEVEL.saturating_mul(level)),
) * Self::SCALING_FACTOR_INT; ) * Self::SCALING_FACTOR_INT;
self.current = (self.current + self.base_max - old_max).min(self.maximum); self.current = (self.current + self.base_max - old_max).min(self.maximum);
} }

View File

@ -30,4 +30,4 @@ pub const SOUND_TRAVEL_DIST_PER_VOLUME: f32 = 3.0;
// Stat increase per level (multiplied by 10 compared to what you'll see in UI) // Stat increase per level (multiplied by 10 compared to what you'll see in UI)
pub const ENERGY_PER_LEVEL: u16 = 5; pub const ENERGY_PER_LEVEL: u16 = 5;
pub const HUMANOID_HP_PER_LEVEL: u16 = 5; pub const HP_PER_LEVEL: u16 = 5;

View File

@ -166,8 +166,6 @@ pub struct EntityInfo {
pub main_tool: Option<Item>, pub main_tool: Option<Item>,
pub second_tool: Option<Item>, pub second_tool: Option<Item>,
pub scale: f32, pub scale: f32,
// TODO: Properly give NPCs skills
pub health_scaling: Option<u16>,
pub loot: LootSpec<String>, pub loot: LootSpec<String>,
pub loadout_asset: Option<String>, pub loadout_asset: Option<String>,
pub make_loadout: Option<fn(LoadoutBuilder, Option<&trade::SiteInformation>) -> LoadoutBuilder>, pub make_loadout: Option<fn(LoadoutBuilder, Option<&trade::SiteInformation>) -> LoadoutBuilder>,
@ -191,7 +189,6 @@ impl EntityInfo {
main_tool: None, main_tool: None,
second_tool: None, second_tool: None,
scale: 1.0, scale: 1.0,
health_scaling: None,
loot: LootSpec::Nothing, loot: LootSpec::Nothing,
loadout_asset: None, loadout_asset: None,
make_loadout: None, make_loadout: None,
@ -368,12 +365,6 @@ impl EntityInfo {
self self
} }
#[must_use]
pub fn with_health_scaling(mut self, level: u16) -> Self {
self.health_scaling = Some(level);
self
}
#[must_use] #[must_use]
pub fn with_loadout_asset(mut self, asset: String) -> Self { pub fn with_loadout_asset(mut self, asset: String) -> Self {
self.loadout_asset = Some(asset); self.loadout_asset = Some(asset);

View File

@ -137,8 +137,7 @@ impl<'a> System<'a> for Sys {
let mut entity_info = EntityInfo::at(pos.0) let mut entity_info = EntityInfo::at(pos.0)
.with_entity_config(entity_config, Some(entity_config_path)) .with_entity_config(entity_config, Some(entity_config_path))
.with_lazy_loadout(ad_hoc_loadout) .with_lazy_loadout(ad_hoc_loadout);
.with_health_scaling(10);
// Merchants can be traded with // Merchants can be traded with
if let Some(economy) = entity.get_trade_info(&world, &index) { if let Some(economy) = entity.get_trade_info(&world, &index) {
entity_info = entity_info entity_info = entity_info

View File

@ -16,7 +16,9 @@ use crate::{
}; };
use common::{ use common::{
calendar::Calendar, calendar::Calendar,
comp::{self, agent, bird_medium, BehaviorCapability, ForceUpdate, Pos, Waypoint}, comp::{
self, agent, bird_medium, skillset::skills, BehaviorCapability, ForceUpdate, Pos, Waypoint,
},
event::{EventBus, ServerEvent}, event::{EventBus, ServerEvent},
generation::EntityInfo, generation::EntityInfo,
lottery::LootSpec, lottery::LootSpec,
@ -412,7 +414,6 @@ impl NpcData {
name, name,
scale, scale,
pos, pos,
health_scaling,
loot, loot,
// tools and skills // tools and skills
skillset_asset, skillset_asset,
@ -471,7 +472,10 @@ impl NpcData {
loadout_builder.build() loadout_builder.build()
}; };
let health = Some(comp::Health::new(body, health_scaling.unwrap_or(0))); let health_level = skill_set
.skill_level(skills::Skill::General(skills::GeneralSkill::HealthIncrease))
.unwrap_or(0);
let health = Some(comp::Health::new(body, health_level));
let poise = comp::Poise::new(body); let poise = comp::Poise::new(body);
// Allow Humanoid, BirdMedium, and Parrot to speak // Allow Humanoid, BirdMedium, and Parrot to speak

View File

@ -25,7 +25,7 @@ use common::{
}, },
skillset::{SkillGroupKind, SkillSet}, skillset::{SkillGroupKind, SkillSet},
}, },
consts::{ENERGY_PER_LEVEL, HUMANOID_HP_PER_LEVEL}, consts::{ENERGY_PER_LEVEL, HP_PER_LEVEL},
}; };
use std::borrow::Cow; use std::borrow::Cow;
@ -2091,7 +2091,7 @@ fn general_skill_strings(skill: GeneralSkill, i18n: &Localization) -> (&str, Cow
i18n, i18n,
"hud.skill.inc_health_title", "hud.skill.inc_health_title",
"hud.skill.inc_health", "hud.skill.inc_health",
u32::from(HUMANOID_HP_PER_LEVEL), u32::from(HP_PER_LEVEL),
), ),
GeneralSkill::EnergyIncrease => splice_constant( GeneralSkill::EnergyIncrease => splice_constant(
i18n, i18n,

View File

@ -1007,13 +1007,11 @@ fn humanoid(pos: Vec3<f32>, economy: &SiteInformation, dynamic_rng: &mut impl Rn
0 | 1 => entity 0 | 1 => entity
.with_agent_mark(agent::Mark::Guard) .with_agent_mark(agent::Mark::Guard)
.with_lazy_loadout(guard_loadout) .with_lazy_loadout(guard_loadout)
.with_health_scaling(dynamic_rng.gen_range(10..15))
.with_asset_expect("common.entity.village.guard"), .with_asset_expect("common.entity.village.guard"),
2 => entity 2 => entity
.with_agent_mark(agent::Mark::Merchant) .with_agent_mark(agent::Mark::Merchant)
.with_economy(economy) .with_economy(economy)
.with_lazy_loadout(merchant_loadout) .with_lazy_loadout(merchant_loadout)
.with_health_scaling(dynamic_rng.gen_range(10..15))
.with_asset_expect("common.entity.village.merchant"), .with_asset_expect("common.entity.village.merchant"),
_ => entity _ => entity
.with_lazy_loadout(villager_loadout) .with_lazy_loadout(villager_loadout)

View File

@ -674,8 +674,7 @@ fn enemy_0(dynamic_rng: &mut impl Rng, tile_wcenter: Vec3<i32>) -> Vec<EntityInf
let mut entities = Vec::new(); let mut entities = Vec::new();
entities.resize_with(number, || { entities.resize_with(number, || {
// TODO: give enemies health skills? // TODO: give enemies health skills?
let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32));
.with_health_scaling(dynamic_rng.gen_range(3..4));
match dynamic_rng.gen_range(0..=4) { match dynamic_rng.gen_range(0..=4) {
0 => entity.with_asset_expect("common.entity.dungeon.tier-0.mugger"), 0 => entity.with_asset_expect("common.entity.dungeon.tier-0.mugger"),
1 => entity.with_asset_expect("common.entity.dungeon.tier-0.stalker"), 1 => entity.with_asset_expect("common.entity.dungeon.tier-0.stalker"),
@ -691,8 +690,7 @@ fn enemy_1(dynamic_rng: &mut impl Rng, tile_wcenter: Vec3<i32>) -> Vec<EntityInf
let mut entities = Vec::new(); let mut entities = Vec::new();
entities.resize_with(number, || { entities.resize_with(number, || {
// TODO: give enemies health skills? // TODO: give enemies health skills?
let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32));
.with_health_scaling(dynamic_rng.gen_range(4..5));
match dynamic_rng.gen_range(0..=4) { match dynamic_rng.gen_range(0..=4) {
0 => entity.with_asset_expect("common.entity.dungeon.tier-1.bow"), 0 => entity.with_asset_expect("common.entity.dungeon.tier-1.bow"),
1 => entity.with_asset_expect("common.entity.dungeon.tier-1.staff"), 1 => entity.with_asset_expect("common.entity.dungeon.tier-1.staff"),
@ -708,8 +706,7 @@ fn enemy_2(dynamic_rng: &mut impl Rng, tile_wcenter: Vec3<i32>) -> Vec<EntityInf
let mut entities = Vec::new(); let mut entities = Vec::new();
entities.resize_with(number, || { entities.resize_with(number, || {
// TODO: give enemies health skills? // TODO: give enemies health skills?
let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32));
.with_health_scaling(dynamic_rng.gen_range(5..7));
match dynamic_rng.gen_range(0..=4) { match dynamic_rng.gen_range(0..=4) {
0 => entity.with_asset_expect("common.entity.dungeon.tier-2.bow"), 0 => entity.with_asset_expect("common.entity.dungeon.tier-2.bow"),
1 => entity.with_asset_expect("common.entity.dungeon.tier-2.staff"), 1 => entity.with_asset_expect("common.entity.dungeon.tier-2.staff"),
@ -725,8 +722,7 @@ fn enemy_3(dynamic_rng: &mut impl Rng, tile_wcenter: Vec3<i32>) -> Vec<EntityInf
let mut entities = Vec::new(); let mut entities = Vec::new();
entities.resize_with(number, || { entities.resize_with(number, || {
// TODO: give enemies health skills? // TODO: give enemies health skills?
let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32));
.with_health_scaling(dynamic_rng.gen_range(7..9));
match dynamic_rng.gen_range(0..=4) { match dynamic_rng.gen_range(0..=4) {
0 => entity.with_asset_expect("common.entity.dungeon.tier-3.bow"), 0 => entity.with_asset_expect("common.entity.dungeon.tier-3.bow"),
1 => entity.with_asset_expect("common.entity.dungeon.tier-3.staff"), 1 => entity.with_asset_expect("common.entity.dungeon.tier-3.staff"),
@ -742,8 +738,7 @@ fn enemy_4(dynamic_rng: &mut impl Rng, tile_wcenter: Vec3<i32>) -> Vec<EntityInf
let mut entities = Vec::new(); let mut entities = Vec::new();
entities.resize_with(number, || { entities.resize_with(number, || {
// TODO: give enemies health skills? // TODO: give enemies health skills?
let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32));
.with_health_scaling(dynamic_rng.gen_range(9..12));
match dynamic_rng.gen_range(0..=4) { match dynamic_rng.gen_range(0..=4) {
0 => entity.with_asset_expect("common.entity.dungeon.tier-4.bow"), 0 => entity.with_asset_expect("common.entity.dungeon.tier-4.bow"),
1 => entity.with_asset_expect("common.entity.dungeon.tier-4.staff"), 1 => entity.with_asset_expect("common.entity.dungeon.tier-4.staff"),
@ -759,8 +754,7 @@ fn enemy_5(dynamic_rng: &mut impl Rng, tile_wcenter: Vec3<i32>) -> Vec<EntityInf
let mut entities = Vec::new(); let mut entities = Vec::new();
entities.resize_with(number, || { entities.resize_with(number, || {
// TODO: give enemies health skills? // TODO: give enemies health skills?
let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32));
.with_health_scaling(dynamic_rng.gen_range(10..15));
match dynamic_rng.gen_range(0..=4) { match dynamic_rng.gen_range(0..=4) {
0 => entity.with_asset_expect("common.entity.dungeon.tier-5.warlock"), 0 => entity.with_asset_expect("common.entity.dungeon.tier-5.warlock"),
1 => entity.with_asset_expect("common.entity.dungeon.tier-5.warlord"), 1 => entity.with_asset_expect("common.entity.dungeon.tier-5.warlord"),
@ -888,10 +882,9 @@ fn mini_boss_5(dynamic_rng: &mut impl Rng, tile_wcenter: Vec3<i32>) -> Vec<Entit
0 => { 0 => {
entities.push( entities.push(
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_asset_expect("common.entity.dungeon.tier-5.beastmaster") .with_asset_expect("common.entity.dungeon.tier-5.beastmaster"),
.with_health_scaling(dynamic_rng.gen_range(50..75)),
); );
entities.resize_with(entities.len() + 2, || { entities.resize_with(entities.len() + 4, || {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_asset_expect("common.entity.dungeon.tier-5.hound") .with_asset_expect("common.entity.dungeon.tier-5.hound")
}); });