summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-01-23 16:37:50 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-01-23 16:37:50 +0100 |
commit | 1755baf50913c822035b973b6cb499e7b78c91eb (patch) | |
tree | 90c2a3bfe33ebc278c0790585ba89b28e5b92540 | |
parent | 1c5640a56a14623c0c92233a22403c1a05d1b492 (diff) |
Quickly preparing to display stats/attributes.
-rw-r--r-- | src/battlemap/src/Struct/Character.elm | 37 | ||||
-rw-r--r-- | src/battlemap/src/Struct/Statistics.elm | 3 | ||||
-rw-r--r-- | src/battlemap/src/Struct/Weapon.elm | 26 | ||||
-rw-r--r-- | src/battlemap/src/View/Footer.elm | 9 | ||||
-rw-r--r-- | src/battlemap/src/View/SideBar/TabMenu/Status.elm | 17 | ||||
-rw-r--r-- | src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm | 191 | ||||
-rw-r--r-- | src/battlemap/src/View/SideBar/Targets.elm | 17 |
7 files changed, 255 insertions, 45 deletions
diff --git a/src/battlemap/src/Struct/Character.elm b/src/battlemap/src/Struct/Character.elm index dc64c97..a1d0597 100644 --- a/src/battlemap/src/Struct/Character.elm +++ b/src/battlemap/src/Struct/Character.elm @@ -8,11 +8,10 @@ module Struct.Character exposing get_icon_id, get_portrait_id, get_current_health, - get_max_health, get_location, set_location, - get_movement_points, - get_attack_range, + get_attributes, + get_statistics, is_enabled, set_enabled ) @@ -21,6 +20,7 @@ module Struct.Character exposing import Struct.Attributes import Struct.Location import Struct.Statistics +import Struct.Weapon -------------------------------------------------------------------------------- -- TYPES ----------------------------------------------------------------------- @@ -53,32 +53,28 @@ new : ( String -> -- name String -> -- icon String -> -- portrait - Int -> -- health - Int -> -- max_health Struct.Location.Type -> -- location + Int -> -- health + Struct.Attributes.Type -> Int -> -- team - Int -> -- movement_points - Int -> -- atk_dist Bool -> -- enabled Type ) new id name icon portrait - health max_health - location - team movement_points atk_dist - enabled = + location health + attributes + team enabled = { id = id, name = name, icon = icon, portrait = portrait, - health = health, - max_health = max_health, location = location, + health = health, + attributes = attributes, + statistics = (Struct.Statistics.new attributes (Struct.Weapon.none)), team = team, - movement_points = movement_points, - atk_dist = atk_dist, enabled = enabled } @@ -97,20 +93,17 @@ get_portrait_id c = c.portrait get_current_health : Type -> Int get_current_health c = c.health -get_max_health : Type -> Int -get_max_health c = c.max_health - get_location : Type -> Struct.Location.Type get_location t = t.location set_location : Struct.Location.Type -> Type -> Type set_location location char = {char | location = location} -get_movement_points : Type -> Int -get_movement_points char = char.movement_points +get_attributes : Type -> Struct.Attributes.Type +get_attributes char = char.attributes -get_attack_range : Type -> Int -get_attack_range char = char.atk_dist +get_statistics : Type -> Struct.Statistics.Type +get_statistics char = char.statistics is_enabled : Type -> Bool is_enabled char = char.enabled diff --git a/src/battlemap/src/Struct/Statistics.elm b/src/battlemap/src/Struct/Statistics.elm index fa59bb5..4e7a0ea 100644 --- a/src/battlemap/src/Struct/Statistics.elm +++ b/src/battlemap/src/Struct/Statistics.elm @@ -18,6 +18,7 @@ import List -- Battlemap ------------------------------------------------------------------- import Struct.Attributes +import Struct.Weapon -------------------------------------------------------------------------------- -- TYPES ----------------------------------------------------------------------- @@ -38,7 +39,7 @@ type alias Type = -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -average : (Int List) -> Float +average : (List Int) -> Float average l = ((toFloat (List.sum l)) / (toFloat (List.length l))) float_to_int : Float -> Int diff --git a/src/battlemap/src/Struct/Weapon.elm b/src/battlemap/src/Struct/Weapon.elm new file mode 100644 index 0000000..4f0c518 --- /dev/null +++ b/src/battlemap/src/Struct/Weapon.elm @@ -0,0 +1,26 @@ +module Struct.Weapon exposing + ( + Type, + none + ) + +-- Battlemap ------------------------------------------------------------------- +import Struct.Location + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type alias Type = + { + id : Int + } + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +none : Type +none = { id = 0 } diff --git a/src/battlemap/src/View/Footer.elm b/src/battlemap/src/View/Footer.elm index aa900dc..8fa5bd9 100644 --- a/src/battlemap/src/View/Footer.elm +++ b/src/battlemap/src/View/Footer.elm @@ -8,12 +8,14 @@ import Html.Attributes import Html.Events -- Struct.Battlemap ------------------------------------------------------------------- +import Struct.Attributes import Struct.Battlemap import Struct.Character import Struct.CharacterTurn import Struct.Event import Struct.Model import Struct.Navigator +import Struct.Statistics import Struct.UI import Util.Html @@ -48,7 +50,12 @@ get_navigator_info model char = ( (toString (Struct.Navigator.get_remaining_points nav)) ++ "/" - ++ (toString (Struct.Character.get_movement_points char)) + ++ + (toString + (Struct.Statistics.get_movement_points + (Struct.Character.get_statistics char) + ) + ) ++ " movement points remaining" ) diff --git a/src/battlemap/src/View/SideBar/TabMenu/Status.elm b/src/battlemap/src/View/SideBar/TabMenu/Status.elm index 97325bc..f393e9e 100644 --- a/src/battlemap/src/View/SideBar/TabMenu/Status.elm +++ b/src/battlemap/src/View/SideBar/TabMenu/Status.elm @@ -13,6 +13,7 @@ import Struct.Error import Struct.Event import Struct.Location import Struct.Model +import Struct.Statistics import Struct.Tile import Struct.UI @@ -38,13 +39,23 @@ get_char_info_html model char_ref = ++ " (Team " ++ (toString (Struct.Character.get_team char)) ++ "): " - ++ (toString (Struct.Character.get_movement_points char)) + ++ + (toString + (Struct.Statistics.get_movement_points + (Struct.Character.get_statistics char) + ) + ) ++ " movement points; " - ++ (toString (Struct.Character.get_attack_range char)) + ++ "???" ++ " attack range. Health: " ++ (toString (Struct.Character.get_current_health char)) ++ "/" - ++ (toString (Struct.Character.get_max_health char)) + ++ + (toString + (Struct.Statistics.get_max_health + (Struct.Character.get_statistics char) + ) + ) ) ) diff --git a/src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm b/src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm index 699a5f1..211b6a0 100644 --- a/src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm +++ b/src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm @@ -7,26 +7,185 @@ import Html import Html.Attributes -- Struct.Battlemap ------------------------------------------------------------------- +import Struct.Attributes import Struct.Character import Struct.Event import Struct.Model +import Struct.Statistics -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_attributes_list: ( - Struct.Character.Type -> +get_attributes_html: ( + Struct.Attributes.Type -> (Html.Html Struct.Event.Type) ) -get_attributes_list char = +get_attributes_html att = (Html.ul [ ] [ - (Html.li [] [(Html.text "Agility: ???")]), - (Html.li [] [(Html.text "Dexterity: ???")]), - (Html.li [] [(Html.text "Sight: ???")]), - (Html.li [] [(Html.text "Strength: ???")]) + (Html.li + [] + [ + (Html.text + ( + "Constitution: " + ++ (toString (Struct.Attributes.get_constitution att)) + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Dexterity: " + ++ (toString (Struct.Attributes.get_dexterity att)) + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Dexterity: " + ++ (toString (Struct.Attributes.get_dexterity att)) + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Intelligence: " + ++ (toString (Struct.Attributes.get_intelligence att)) + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Mind: " + ++ (toString (Struct.Attributes.get_mind att)) + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Speed: " + ++ (toString (Struct.Attributes.get_speed att)) + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Strength: " + ++ (toString (Struct.Attributes.get_strength att)) + ) + ) + ] + ) + ] + ) + +get_statistics_html : ( + Struct.Statistics.Type -> + (Html.Html Struct.Event.Type) + ) +get_statistics_html stats = + (Html.ul + [ + ] + [ + (Html.li + [] + [ + (Html.text + ( + "Chance to Dodge (Graze): " + ++ (toString (Struct.Statistics.get_dodges stats)) + ++ "%" + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Chance to Parry: " + ++ (toString (Struct.Statistics.get_parries stats)) + ++ "%" + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Damage: [" + ++ (toString (Struct.Statistics.get_damage_min stats)) + ++ ", " + ++ (toString (Struct.Statistics.get_damage_max stats)) + ++ "]" + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Chance to Hit: " + ++ (toString (Struct.Statistics.get_accuracy stats)) + ++ "%" + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Chance to Double Hit: " + ++ (toString (Struct.Statistics.get_double_hits stats)) + ) + ) + ] + ), + (Html.li + [] + [ + (Html.text + ( + "Chance to Critical Hit: " + ++ (toString (Struct.Statistics.get_critical_hits stats)) + ) + ) + ] + ) ] ) @@ -72,7 +231,9 @@ get_html model char = ++ "/" ++ (toString - (Struct.Character.get_max_health char) + (Struct.Statistics.get_max_health + (Struct.Character.get_statistics char) + ) ) ) ) @@ -84,7 +245,9 @@ get_html model char = [ (Html.text (toString - (Struct.Character.get_movement_points char) + (Struct.Statistics.get_movement_points + (Struct.Character.get_statistics char) + ) ) ) ] @@ -93,14 +256,12 @@ get_html model char = (Html.dd [] [ - (Html.text - (toString - (Struct.Character.get_attack_range char) - ) - ) + (Html.text "???") ] ) ] - ) + ), + (get_attributes_html (Struct.Character.get_attributes char)), + (get_statistics_html (Struct.Character.get_statistics char)) ] ) diff --git a/src/battlemap/src/View/SideBar/Targets.elm b/src/battlemap/src/View/SideBar/Targets.elm index 46aedb9..55e3697 100644 --- a/src/battlemap/src/View/SideBar/Targets.elm +++ b/src/battlemap/src/View/SideBar/Targets.elm @@ -14,6 +14,7 @@ import Struct.Error import Struct.Event import Struct.Location import Struct.Model +import Struct.Statistics import Struct.Tile import Struct.UI @@ -39,13 +40,23 @@ get_target_info_html model char_ref = ++ " (Team " ++ (toString (Struct.Character.get_team char)) ++ "): " - ++ (toString (Struct.Character.get_movement_points char)) + ++ + (toString + (Struct.Statistics.get_movement_points + (Struct.Character.get_statistics char) + ) + ) ++ " movement points; " - ++ (toString (Struct.Character.get_attack_range char)) + ++ "???" ++ " attack range. Health: " ++ (toString (Struct.Character.get_current_health char)) ++ "/" - ++ (toString (Struct.Character.get_max_health char)) + ++ + (toString + (Struct.Statistics.get_max_health + (Struct.Character.get_statistics char) + ) + ) ) ) |