Merge branch 'roidujeu/fix_combat_rating' into 'master'

changed the combat rating equation to a simpler one, which results in a better combat rating overall

See merge request veloren/veloren!3095
This commit is contained in:
Samuel Keiffer 2022-01-18 07:35:49 +00:00
commit e20c98189f
2 changed files with 33 additions and 5 deletions

View File

@ -18,4 +18,4 @@ ItemDef(
quality: Legendary,
tags: [],
ability_spec: None,
)
)

View File

@ -971,7 +971,13 @@ pub fn get_weapons(inv: &Inventory) -> (Option<ToolKind>, Option<ToolKind>) {
#[cfg(not(target_arch = "wasm32"))]
pub fn weapon_rating<T: ItemDesc>(item: &T, msm: &MaterialStatManifest) -> f32 {
const DAMAGE_WEIGHT: f32 = 2.0;
const SPEED_WEIGHT: f32 = 3.0;
const CRIT_CHANCE_WEIGHT: f32 = 1.25;
const RANGE_WEIGHT: f32 = 0.0;
const EFFECT_WEIGHT: f32 = 1.0;
const EQUIP_TIME_WEIGHT: f32 = 0.25;
const ENERGY_EFFICIENCY_WEIGHT: f32 = 0.0;
const BUFF_STRENGTH_WEIGHT: f32 = 0.0;
if let ItemKind::Tool(tool) = item.kind() {
let stats = tool::Stats::from((msm, item.components(), tool));
@ -979,11 +985,33 @@ pub fn weapon_rating<T: ItemDesc>(item: &T, msm: &MaterialStatManifest) -> f32 {
// TODO: Look into changing the 0.5 to reflect armor later maybe?
// Since it is only for weapon though, it probably makes sense to leave
// independent for now
let damage_rating = stats.power * stats.speed * (1.0 + stats.crit_chance * 0.5);
let effect_rating = stats.effect_power * stats.speed;
(damage_rating * DAMAGE_WEIGHT + effect_rating * EFFECT_WEIGHT)
/ (DAMAGE_WEIGHT + EFFECT_WEIGHT)
let damage_rating = stats.power - 1.0;
let speed_rating = stats.speed - 1.0;
let crit_chance_rating = stats.crit_chance - 0.1;
let range_rating = stats.range;
let effect_rating = stats.effect_power - 1.0;
let equip_time_rating = 1.0 / stats.equip_time_secs;
let energy_efficiency_rating = stats.energy_efficiency;
let buff_strength_rating = stats.buff_strength;
0.5 + (1.0
+ (damage_rating * DAMAGE_WEIGHT)
+ (speed_rating * SPEED_WEIGHT)
+ (crit_chance_rating * CRIT_CHANCE_WEIGHT)
+ (range_rating * RANGE_WEIGHT)
+ (effect_rating * EFFECT_WEIGHT)
+ (equip_time_rating * EQUIP_TIME_WEIGHT)
+ (energy_efficiency_rating * ENERGY_EFFICIENCY_WEIGHT)
+ (buff_strength_rating * BUFF_STRENGTH_WEIGHT))
/ (DAMAGE_WEIGHT
+ SPEED_WEIGHT
+ CRIT_CHANCE_WEIGHT
+ RANGE_WEIGHT
+ EFFECT_WEIGHT
+ EQUIP_TIME_WEIGHT
+ ENERGY_EFFICIENCY_WEIGHT
+ BUFF_STRENGTH_WEIGHT)
} else {
0.0
}