summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-02-10 18:10:08 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-02-10 18:10:08 +0100 |
commit | d7b161da1c502402e0c0063c3ffbaa9042bfb24d (patch) | |
tree | 354ac75eb8a140dff80d7a5175b660eeeca35500 /src | |
parent | 73f531db4d999217447aff616313f6532a579610 (diff) |
Starting to add weapons to the mix.stats_calc
Diffstat (limited to 'src')
-rw-r--r-- | src/query/character_turn.erl | 9 | ||||
-rw-r--r-- | src/reply/add_char.erl | 6 | ||||
-rw-r--r-- | src/type/weapon.erl | 11 | ||||
-rw-r--r-- | src/type/weapon_shim.erl | 10 |
4 files changed, 22 insertions, 14 deletions
diff --git a/src/query/character_turn.erl b/src/query/character_turn.erl index f4df4ea..5a8ee96 100644 --- a/src/query/character_turn.erl +++ b/src/query/character_turn.erl @@ -183,10 +183,13 @@ handle_target (QueryState) -> {_, AttackRange} = weapon:get_ranges ( - character_instance:get_active_weapon + weapon:from_id ( - QueryState#query_state.main_char_inst, - QueryState#query_state.main_char + character_instance:get_active_weapon + ( + QueryState#query_state.main_char_inst, + QueryState#query_state.main_char + ) ) ), io:format diff --git a/src/reply/add_char.erl b/src/reply/add_char.erl index c730c24..64fc26c 100644 --- a/src/reply/add_char.erl +++ b/src/reply/add_char.erl @@ -27,8 +27,8 @@ attributes_as_json (Atts) -> encode (Char, CharInstance, IsEnabled) -> {X, Y} = character_instance:get_location(CharInstance), Atts = character:get_attributes(Char), + {Wp0, Wp1} = character:get_weapons(Char), ActWeapon = character_instance:get_active_weapon(CharInstance, Char), - {_MinRg, MaxRg} = weapon:get_ranges(ActWeapon), jiffy:encode ( { @@ -43,7 +43,9 @@ encode (Char, CharInstance, IsEnabled) -> {<<"team">>, character_instance:get_owner(CharInstance)}, {<<"enabled">>, IsEnabled}, {<<"att">>, attributes_as_json(Atts)}, - {<<"atk_rg">>, MaxRg} + {<<"wp_0">>, Wp0}, + {<<"wp_1">>, Wp1}, + {<<"act_wp">>, ActWeapon} ] } ). diff --git a/src/type/weapon.erl b/src/type/weapon.erl index b5e5e0c..c5533de 100644 --- a/src/type/weapon.erl +++ b/src/type/weapon.erl @@ -35,6 +35,7 @@ -export ( [ + from_id/1, get_category/1, get_ranges/1 ] @@ -78,3 +79,13 @@ get_min_power (Wp) -> Wp#weapon.pwr_min. get_ranges (Wp) -> ranges_of_type(Wp#weapon.type). get_category (Wp) -> category_of_type(Wp#weapon.type). + +from_id (0) -> + #weapon{ + id = 0, + name = "Shim Weapon 0", + icon = "0", + type = sword, + pwr_min = 10, + pwr_max = 90 + }. diff --git a/src/type/weapon_shim.erl b/src/type/weapon_shim.erl index 52d9069..6225e25 100644 --- a/src/type/weapon_shim.erl +++ b/src/type/weapon_shim.erl @@ -33,12 +33,4 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -rand() -> - #weapon{ - id = 0, - name = "Shim Weapon 0", - icon = "0", - type = sword, - pwr_min = 10, - pwr_max = 90 - }. +rand() -> 0. |