From 0af4f6c8a558c1cd7affac35fb0583c74cd1c103 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 22 Jan 2018 16:27:02 +0100 Subject: Starting to add stats display client-side. --- src/battlemap/src/Struct/Attributes.elm | 68 ++++++++++++++++++++++++++++ src/battlemap/src/Struct/Character.elm | 8 ++-- src/battlemap/src/Struct/Statistics.elm | 79 +++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 src/battlemap/src/Struct/Attributes.elm create mode 100644 src/battlemap/src/Struct/Statistics.elm (limited to 'src') diff --git a/src/battlemap/src/Struct/Attributes.elm b/src/battlemap/src/Struct/Attributes.elm new file mode 100644 index 0000000..bacd414 --- /dev/null +++ b/src/battlemap/src/Struct/Attributes.elm @@ -0,0 +1,68 @@ +module Struct.Attributes exposing + ( + Type, + get_constitution, + get_dexterity, + get_intelligence, + get_mind, + get_speed, + get_strength, + new + ) + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type alias Type = + { + constitution : Int, + dexterity : Int, + intelligence : Int, + mind : Int, + speed : Int, + strength : Int + } + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_constitution : Type -> Int +get_constitution t = t.constitution + +get_dexterity : Type -> Int +get_dexterity t = t.dexterity + +get_intelligence : Type -> Int +get_intelligence t = t.intelligence + +get_mind : Type -> Int +get_mind = t.mind + +get_speed : Type -> Int +get_speed = t.speed + +get_strength : Type -> Int +get_strength = t.strength + +new : ( + Int -> -- constitution + Int -> -- dexterity + Int -> -- intelligence + Int -> -- mind + Int -> -- speed + Int -> -- strength + Type + ) +new con dex int min spe str = + { + constitution = con, + dexterity = dex, + intelligence = int, + mind = min, + speed = spe, + strength = str + } diff --git a/src/battlemap/src/Struct/Character.elm b/src/battlemap/src/Struct/Character.elm index 1d5b269..3f340d7 100644 --- a/src/battlemap/src/Struct/Character.elm +++ b/src/battlemap/src/Struct/Character.elm @@ -18,6 +18,7 @@ module Struct.Character exposing ) -- Battlemap ------------------------------------------------------------------- +import Struct.Attributes import Struct.Location -------------------------------------------------------------------------------- @@ -31,11 +32,10 @@ type alias Type = portrait : String, location : Struct.Location.Type, health : Int, - max_health : Int, team : Int, - movement_points : Int, - atk_dist : Int, - enabled : Bool + enabled : Bool, + attributes : Struct.Attributes.Type, + statistics : Struct.Statistics.Type } type alias Ref = String diff --git a/src/battlemap/src/Struct/Statistics.elm b/src/battlemap/src/Struct/Statistics.elm new file mode 100644 index 0000000..b1690a5 --- /dev/null +++ b/src/battlemap/src/Struct/Statistics.elm @@ -0,0 +1,79 @@ +module Struct.Statistics exposing + ( + Type, + get_movement_points, + get_max_health, + get_dodges, + get_parries, + get_damage_min, + get_damage_max, + get_accuracy, + get_double_hits, + get_critical_hits, + new + ) + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type alias Type = + { + movement_points : Int, + max_health : Int, + dodges : Int, + parries : Int, + damage_min : Int, + damage_max : Int, + accuracy : Int, + double_hits : Int, + critical_hits : Int + } + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_movement_points : Type -> Int +get_movement_points t = t.movement_points + +get_max_health : Type -> Int +get_max_health t = t.max_health + +get_dodges : Type -> Int +get_dodges t = t.dodges + +get_parries : Type -> Int +get_parries = t.parries + +get_damage_min : Type -> Int +get_damage_min = t.damage_min + +get_damage_max : Type -> Int +get_damage_max = t.damage_max + +get_accuracy : Type -> Int +get_accuracy = t.accuracy + +get_double_hits : Type -> Int +get_double_hits = t.double_hits + +get_critical_hits : Type -> Int +get_critical_hits = t.critical_hits + +new : ( + Struct.Attributes.Type -> + Struct.Weapon.Type -> + Type + ) +new con dex int min spe str = + { + constitution = con, + dexterity = dex, + intelligence = int, + mind = min, + speed = spe, + strength = str + } -- cgit v1.2.3-70-g09d2