From c62162c2d374ad38dda10c7015c02c1649561a2f Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Sep 2021 01:45:30 -0400 Subject: [PATCH] Changed weights of cr calculation and exp from cr formula. --- CHANGELOG.md | 1 + common/src/combat.rs | 26 ++++++---- common/src/comp/body.rs | 12 ++--- server/src/events/entity_manipulation.rs | 61 ++++++++++++++---------- voxygen/src/hud/bag.rs | 4 ++ voxygen/src/hud/group.rs | 7 ++- voxygen/src/hud/mod.rs | 21 ++++++-- 7 files changed, 86 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4108ccf082..3fb375711c 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 ### Changed - Made dungeon tiers 3, 4, and 5 more common +- Tweaked CR and exp calculation formula ### Removed diff --git a/common/src/combat.rs b/common/src/combat.rs index cdd5be06c6..c633a952ba 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -888,27 +888,34 @@ pub fn combat_rating( inventory: &Inventory, health: &Health, energy: &Energy, + poise: &Poise, skill_set: &SkillSet, body: Body, msm: &MaterialStatManifest, ) -> f32 { const WEAPON_WEIGHT: f32 = 1.0; - const HEALTH_WEIGHT: f32 = 0.5; + const HEALTH_WEIGHT: f32 = 1.5; const ENERGY_WEIGHT: f32 = 0.5; const SKILLS_WEIGHT: f32 = 1.0; const POISE_WEIGHT: f32 = 0.5; - const CRIT_WEIGHT: f32 = 0.6; - // Assumes a "standard" max health of 100 - let health_rating = 10.0 * health.base_max() + const CRIT_WEIGHT: f32 = 0.5; + // Normalzied with a standard max health of 100 + let health_rating = health.base_max() / 100.0 / (1.0 - Damage::compute_damage_reduction(Some(inventory), None, None)).max(0.00001); - // Assumes a "standard" max energy of 100 and energy reward multiplier of 1.0 - let energy_rating = 5.0 * energy.maximum() * compute_energy_reward_mod(Some(inventory)) / 100.0; + // Normalzied with a standard max energy of 100 and energy reward multiplier of + // x1 + let energy_rating = (energy.base_max() + compute_max_energy_mod(Some(inventory))) / 100.0 + * compute_energy_reward_mod(Some(inventory)); - let poise_rating = 10.0 / (1.0 - Poise::compute_poise_damage_reduction(inventory)).max(0.00001); + // Normalzied with a standard max poise of 100 + let poise_rating = poise.base_max() as f32 + / 100.0 + / (1.0 - Poise::compute_poise_damage_reduction(inventory)).max(0.00001); - let crit_rating = 10.0 * compute_crit_mult(Some(inventory)); + // Normalzied with a standard crit multiplier of 1.2 + let crit_rating = compute_crit_mult(Some(inventory)) / 1.2; // Assumes a standard person has earned 20 skill points in the general skill // tree and 10 skill points for the weapon skill tree @@ -916,8 +923,7 @@ pub fn combat_rating( + weapon_skills(inventory, skill_set) / 10.0) / 2.0; - //Multiply weapon rating by 10 to keep it in the same scale as the others - let weapon_rating = 10.0 * get_weapon_rating(inventory, msm); + let weapon_rating = get_weapon_rating(inventory, msm); let combined_rating = (health_rating * HEALTH_WEIGHT + energy_rating * ENERGY_WEIGHT diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index e4cfc07e56..596801c7ce 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -759,15 +759,15 @@ impl Body { match self { Body::Object(_) | Body::Ship(_) => 0.0, Body::BipedLarge(b) => match b.species { - biped_large::Species::Mindflayer => 4.8, - biped_large::Species::Minotaur => 3.2, - biped_large::Species::Tidalwarrior => 2.25, - biped_large::Species::Yeti => 2.0, - biped_large::Species::Harvester => 2.4, + biped_large::Species::Mindflayer => 4.35, + biped_large::Species::Minotaur => 4.05, + biped_large::Species::Tidalwarrior => 2.75, + biped_large::Species::Yeti => 2.25, + biped_large::Species::Harvester => 2.1, _ => 1.0, }, Body::Golem(g) => match g.species { - golem::Species::ClayGolem => 2.0, + golem::Species::ClayGolem => 2.45, _ => 1.0, }, _ => 1.0, diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 66333056ee..5e3498943d 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -194,6 +194,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt let inventories = state.ecs().read_storage::(); let players = state.ecs().read_storage::(); let bodies = state.ecs().read_storage::(); + let poises = state.ecs().read_storage::(); let by = if let Some(by) = last_change.by { by } else { @@ -204,30 +205,39 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt } else { return; }; - let (entity_skill_set, entity_health, entity_energy, entity_inventory, entity_body) = - if let ( - Some(entity_skill_set), - Some(entity_health), - Some(entity_energy), - Some(entity_inventory), - Some(entity_body), - ) = ( - skill_set.get(entity), - healths.get(entity), - energies.get(entity), - inventories.get(entity), - bodies.get(entity), - ) { - ( - entity_skill_set, - entity_health, - entity_energy, - entity_inventory, - entity_body, - ) - } else { - return; - }; + let ( + entity_skill_set, + entity_health, + entity_energy, + entity_inventory, + entity_body, + entity_poise, + ) = if let ( + Some(entity_skill_set), + Some(entity_health), + Some(entity_energy), + Some(entity_inventory), + Some(entity_body), + Some(entity_poise), + ) = ( + skill_set.get(entity), + healths.get(entity), + energies.get(entity), + inventories.get(entity), + bodies.get(entity), + poises.get(entity), + ) { + ( + entity_skill_set, + entity_health, + entity_energy, + entity_inventory, + entity_body, + entity_poise, + ) + } else { + return; + }; let groups = state.ecs().read_storage::(); let attacker_group = groups.get(attacker); @@ -249,10 +259,11 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, last_change: Healt entity_inventory, entity_health, entity_energy, + entity_poise, entity_skill_set, *entity_body, &msm, - ) * 2.5; + ) * 20.0; // Distribute EXP to group let positions = state.ecs().read_storage::(); diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 8c9c2d81bc..be66dcf485 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -547,6 +547,7 @@ pub struct Bag<'a> { show: &'a Show, body: &'a Body, msm: &'a MaterialStatManifest, + poise: &'a Poise, } impl<'a> Bag<'a> { @@ -570,6 +571,7 @@ impl<'a> Bag<'a> { show: &'a Show, body: &'a Body, msm: &'a MaterialStatManifest, + poise: &'a Poise, ) -> Self { Self { client, @@ -591,6 +593,7 @@ impl<'a> Bag<'a> { show, body, msm, + poise, } } } @@ -869,6 +872,7 @@ impl<'a> Widget for Bag<'a> { inventory, self.health, self.energy, + self.poise, self.skill_set, *self.body, self.msm, diff --git a/voxygen/src/hud/group.rs b/voxygen/src/hud/group.rs index 2f4069f448..3d44d302b6 100644 --- a/voxygen/src/hud/group.rs +++ b/voxygen/src/hud/group.rs @@ -355,6 +355,7 @@ impl<'a> Widget for Group<'a> { let inventory = client_state.ecs().read_storage::(); let uid_allocator = client_state.ecs().read_resource::(); let bodies = client_state.ecs().read_storage::(); + let poises = client_state.ecs().read_storage::(); // Keep track of the total number of widget ids we are using for buffs let mut total_buff_count = 0; @@ -369,6 +370,7 @@ impl<'a> Widget for Group<'a> { let inventory = entity.and_then(|entity| inventory.get(entity)); let is_leader = uid == leader; let body = entity.and_then(|entity| bodies.get(entity)); + let poise = entity.and_then(|entity| poises.get(entity)); if let ( Some(stats), @@ -377,10 +379,11 @@ impl<'a> Widget for Group<'a> { Some(health), Some(energy), Some(body), - ) = (stats, skill_set, inventory, health, energy, body) + Some(poise), + ) = (stats, skill_set, inventory, health, energy, body, poise) { let combat_rating = combat::combat_rating( - inventory, health, energy, skill_set, *body, self.msm, + inventory, health, energy, poise, skill_set, *body, self.msm, ); let char_name = stats.name.to_string(); let health_perc = health.current() / health.base_max().max(health.maximum()); diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index a26f542db2..212bc1ddcf 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1110,6 +1110,7 @@ impl Hud { let msm = ecs.read_resource::(); let entities = ecs.entities(); let me = client.entity(); + let poises = ecs.read_storage::(); if (client.pending_trade().is_some() && !self.show.trade) || (client.pending_trade().is_none() && self.show.trade) @@ -1722,6 +1723,7 @@ impl Hud { &uids, &inventories, players.maybe(), + poises.maybe(), ) .join() .filter(|t| { @@ -1745,6 +1747,7 @@ impl Hud { uid, inventory, player, + poise, )| { // Use interpolated position if available let pos = interpolated.map_or(pos.0, |i| i.pos); @@ -1784,9 +1787,11 @@ impl Hud { health, buffs, energy, - combat_rating: if let (Some(health), Some(energy)) = (health, energy) { + combat_rating: if let (Some(health), Some(energy), Some(poise)) = + (health, energy, poise) + { combat::combat_rating( - inventory, health, energy, skill_set, *body, &msm, + inventory, health, energy, poise, skill_set, *body, &msm, ) } else { 0.0 @@ -2663,6 +2668,7 @@ impl Hud { let character_states = ecs.read_storage::(); let controllers = ecs.read_storage::(); let bodies = ecs.read_storage::(); + let poises = ecs.read_storage::(); // Combo floater stuffs self.floaters .combo_floaters @@ -2720,12 +2726,20 @@ impl Hud { } // Bag contents if self.show.bag { - if let (Some(player_stats), Some(skill_set), Some(health), Some(energy), Some(body)) = ( + if let ( + Some(player_stats), + Some(skill_set), + Some(health), + Some(energy), + Some(body), + Some(poise), + ) = ( stats.get(client.entity()), skill_sets.get(client.entity()), healths.get(entity), energies.get(entity), bodies.get(entity), + poises.get(entity), ) { match Bag::new( client, @@ -2746,6 +2760,7 @@ impl Hud { &self.show, body, &msm, + poise, ) .set(self.ids.bag, ui_widgets) {