From 825c07c6559230f930fbe38db10cfa56d3e0747c Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Wed, 27 Jun 2018 12:05:37 +0200 Subject: Small changes in stats calculation. --- src/shared/struct/sh_armor.erl | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'src/shared/struct/sh_armor.erl') diff --git a/src/shared/struct/sh_armor.erl b/src/shared/struct/sh_armor.erl index dcbb379..1fda4eb 100644 --- a/src/shared/struct/sh_armor.erl +++ b/src/shared/struct/sh_armor.erl @@ -115,31 +115,47 @@ random_id () -> sh_roll:between(0, 4). ) -> sh_attributes:type(). apply_to_attributes (Ar, Att) -> + Constitution = sh_attributes:get_constitution(Att), Dexterity = sh_attributes:get_dexterity(Att), Speed = sh_attributes:get_speed(Att), Strength = sh_attributes:get_strength(Att), Mind = sh_attributes:get_mind(Att), Impact = sh_math_util:ceil(20.0 * Ar#armor.coef), + HalfImpact = sh_math_util:ceil(10.0 * Ar#armor.coef), Category = Ar#armor.category, case Category of kinetic -> sh_attributes:set_unsafe_mind((Mind - Impact), Att); - leather -> sh_attributes:set_unsafe_dexterity((Dexterity - Impact), Att); + leather -> + sh_attributes:set_unsafe_constitution + ( + (Constitution - HalfImpact), + sh_attributes:set_unsafe_dexterity((Dexterity - HalfImpact), Att) + ); + chain -> - sh_attributes:set_unsafe_dexterity + sh_attributes:set_unsafe_constitution ( - (Dexterity - Impact), - sh_attributes:set_unsafe_speed((Speed - Impact), Att) + (Constitution - HalfImpact), + sh_attributes:set_unsafe_dexterity + ( + (Dexterity - HalfImpact), + sh_attributes:set_unsafe_speed((Speed - Impact), Att) + ) ); plate -> - sh_attributes:set_unsafe_dexterity + sh_attributes:set_unsafe_constitution ( - (Dexterity - Impact), - sh_attributes:set_unsafe_speed + (Constitution - HalfImpact), + sh_attributes:set_unsafe_dexterity ( - (Speed - Impact), - sh_attributes:set_unsafe_strength((Strength - Impact), Att) + (Dexterity - HalfImpact), + sh_attributes:set_unsafe_speed + ( + (Speed - Impact), + sh_attributes:set_unsafe_strength((Strength - Impact), Att) + ) ) ) end. -- cgit v1.2.3-70-g09d2