From 2155e43a7acdbc91ef561ae1cfd06eae297020e7 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Thu, 7 Jun 2018 16:44:26 +0200 Subject: add_{armor,weapon}, coefs, db stores stats. --- src/shared/struct/sh_statistics.erl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/shared/struct/sh_statistics.erl') diff --git a/src/shared/struct/sh_statistics.erl b/src/shared/struct/sh_statistics.erl index 92cd8d6..e2b8543 100644 --- a/src/shared/struct/sh_statistics.erl +++ b/src/shared/struct/sh_statistics.erl @@ -47,7 +47,7 @@ -export ( [ - new/2 + new/3 ] ). @@ -144,14 +144,21 @@ get_damages (Stats) -> -spec new ( sh_attributes:type(), - {sh_weapon:id(), sh_weapon:id()} + {sh_weapon:id(), sh_weapon:id()}, + sh_armor:id() ) -> type(). -new (BaseAttributes, WeaponIDs) -> +new (BaseAttributes, WeaponIDs, ArmorID) -> {ActiveWeaponID, _} = WeaponIDs, ActiveWeapon = sh_weapon:from_id(ActiveWeaponID), {MinDamage, MaxDamage} = sh_weapon:get_damages(ActiveWeapon), - Attributes = sh_weapon:apply_to_attributes(BaseAttributes, ActiveWeapon), + Armor = sh_armor:from_id(ArmorID), + Attributes = + sh_armor:apply_to_attributes + ( + Armor, + sh_weapon:apply_to_attributes(ActiveWeapon, BaseAttributes) + ), Constitution = sh_attributes:get_constitution(Attributes), Dexterity = sh_attributes:get_dexterity(Attributes), Intelligence = sh_attributes:get_intelligence(Attributes), -- cgit v1.2.3-70-g09d2