From e39770d1d9bca17d09d1a31ab2362683489771a3 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 18 Sep 2020 16:28:21 -0500 Subject: [PATCH] Golem now spawns in dungeon. --- CHANGELOG.md | 1 + common/src/comp/inventory/item/tool.rs | 2 +- common/src/loadout_builder.rs | 71 ++++++++++++-------------- server/src/sys/terrain.rs | 5 +- voxygen/src/scene/figure/mod.rs | 9 ++++ world/src/site/dungeon/mod.rs | 22 +++----- 6 files changed, 52 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d21aeda126..d890aa03d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fireflies - Fullscreen modes now show two options (exclusive and borderless) - Added banlist and `/ban`, `/unban`, and `/kick` commands for admins +- A new dungeon boss (venture there and discover it yourself) ### Changed diff --git a/common/src/comp/inventory/item/tool.rs b/common/src/comp/inventory/item/tool.rs index cb73b19547..58e8489058 100644 --- a/common/src/comp/inventory/item/tool.rs +++ b/common/src/comp/inventory/item/tool.rs @@ -357,7 +357,7 @@ impl Tool { recover_duration: Duration::from_millis(250), knockback: 25.0, base_healthchange: -200, - range: 10.0, + range: 5.0, max_angle: 120.0, }, GroundShockwave { diff --git a/common/src/loadout_builder.rs b/common/src/loadout_builder.rs index 1030729764..7120b48f8a 100644 --- a/common/src/loadout_builder.rs +++ b/common/src/loadout_builder.rs @@ -1,9 +1,7 @@ -use crate::{ - comp::{ - golem, - item::{Item, ItemKind}, - Alignment, Body, CharacterAbility, ItemConfig, Loadout, - }, +use crate::comp::{ + golem, + item::{Item, ItemKind}, + Alignment, Body, CharacterAbility, ItemConfig, Loadout, }; use rand::Rng; use std::time::Duration; @@ -81,38 +79,37 @@ impl LoadoutBuilder { _ => {}, }; - let active_item = - if let Some(ItemKind::Tool(tool)) = main_tool.as_ref().map(|i| i.kind()) { - let mut abilities = tool.get_abilities(); - let mut ability_drain = abilities.drain(..); + let active_item = if let Some(ItemKind::Tool(tool)) = main_tool.as_ref().map(|i| i.kind()) { + let mut abilities = tool.get_abilities(); + let mut ability_drain = abilities.drain(..); - main_tool.map(|item| ItemConfig { - item, - ability1: ability_drain.next(), - ability2: ability_drain.next(), - ability3: ability_drain.next(), - block_ability: None, - dodge_ability: Some(CharacterAbility::Roll), - }) - } else { - Some(ItemConfig { - // We need the empty item so npcs can attack - item: Item::new_from_asset_expect("common.items.weapons.empty.empty"), - ability1: Some(CharacterAbility::BasicMelee { - energy_cost: 0, - buildup_duration: Duration::from_millis(0), - recover_duration: Duration::from_millis(400), - base_healthchange: -40, - knockback: 0.0, - range: 3.5, - max_angle: 15.0, - }), - ability2: None, - ability3: None, - block_ability: None, - dodge_ability: None, - }) - }; + main_tool.map(|item| ItemConfig { + item, + ability1: ability_drain.next(), + ability2: ability_drain.next(), + ability3: ability_drain.next(), + block_ability: None, + dodge_ability: Some(CharacterAbility::Roll), + }) + } else { + Some(ItemConfig { + // We need the empty item so npcs can attack + item: Item::new_from_asset_expect("common.items.weapons.empty.empty"), + ability1: Some(CharacterAbility::BasicMelee { + energy_cost: 0, + buildup_duration: Duration::from_millis(0), + recover_duration: Duration::from_millis(400), + base_healthchange: -40, + knockback: 0.0, + range: 3.5, + max_angle: 15.0, + }), + ability2: None, + ability3: None, + block_ability: None, + dodge_ability: None, + }) + }; let loadout = match body { Body::Humanoid(_) => match alignment { diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index 46b7cdd1ac..4329b48550 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -1,10 +1,7 @@ use super::SysTimer; use crate::{chunk_generator::ChunkGenerator, client::Client, Tick}; use common::{ - comp::{ - self, bird_medium, - Alignment, CharacterAbility, Player, Pos, - }, + comp::{self, bird_medium, Alignment, CharacterAbility, Player, Pos}, event::{EventBus, ServerEvent}, generation::get_npc_name, msg::ServerMsg, diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 7a6c93c8be..93793d9819 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -2115,6 +2115,15 @@ impl FigureMgr { skeleton_attr, ) }, + CharacterState::GroundShockwave(_) => { + anim::golem::ShockwaveAnimation::update_skeleton( + &target_base, + (vel.0.magnitude(), time), + state.state_time, + &mut state_animation_rate, + skeleton_attr, + ) + }, // TODO! _ => target_base, }; diff --git a/world/src/site/dungeon/mod.rs b/world/src/site/dungeon/mod.rs index db9817404b..a3a2890166 100644 --- a/world/src/site/dungeon/mod.rs +++ b/world/src/site/dungeon/mod.rs @@ -13,7 +13,6 @@ use common::{ comp::{self}, generation::{ChunkSupplement, EntityInfo}, lottery::Lottery, - npc, store::{Id, Store}, terrain::{Block, BlockKind, Structure, TerrainChunkSize}, vol::{BaseVol, ReadVol, RectSizedVol, RectVolSize, Vox, WriteVol}, @@ -509,22 +508,13 @@ impl Floor { ); let chosen = chosen.choose(); let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) - .with_scale(4.0) - .with_level(rng.gen_range(75, 100)) + .with_level(rng.gen_range(1, 5)) .with_alignment(comp::Alignment::Enemy) - .with_body(comp::Body::Humanoid(comp::humanoid::Body::random())) - .with_name(format!( - "Cult Leader {}", - npc::get_npc_name(npc::NpcKind::Humanoid) - )) - .with_main_tool(comp::Item::new_from_asset_expect( - match rng.gen_range(0, 1) { - //Add more possible cult leader npc_weapons here - _ => { - "common.items.npc_weapons.sword.cultist_purp_2h_boss-0" - }, - }, - )) + .with_body(comp::Body::Golem(comp::golem::Body::random_with( + rng, + &comp::golem::Species::StoneGolem, + ))) + .with_name("Stonework Defender".to_string()) .with_loot_drop(comp::Item::new_from_asset_expect(chosen)); supplement.add_entity(entity);