summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/battlemap/src/View/Controlled/CharacterCard.elm145
-rw-r--r--src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm337
2 files changed, 123 insertions, 359 deletions
diff --git a/src/battlemap/src/View/Controlled/CharacterCard.elm b/src/battlemap/src/View/Controlled/CharacterCard.elm
index 89d82ae..0d1d3d1 100644
--- a/src/battlemap/src/View/Controlled/CharacterCard.elm
+++ b/src/battlemap/src/View/Controlled/CharacterCard.elm
@@ -10,6 +10,7 @@ import Html
import Html.Attributes
-- Battlemap -------------------------------------------------------------------
+import Struct.Attributes
import Struct.Armor
import Struct.Character
import Struct.CharacterTurn
@@ -307,13 +308,44 @@ stat_val val perc =
]
)
+att_dual_val : Int -> Int -> (Html.Html Struct.Event.Type)
+att_dual_val base active =
+ let
+ diff = (active - base)
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-att-dual-val")
+ ]
+ [
+ (Html.text
+ (
+ (toString base)
+ ++ " ("
+ ++
+ (
+ if (diff > 0)
+ then
+ ("+" ++ (toString diff))
+ else
+ if (diff == 0)
+ then
+ "~"
+ else
+ (toString diff)
+ )
+ ++ ")"
+ )
+ )
+ ]
+ )
+
get_relevant_stats : (
- Struct.Model.Type ->
Struct.Character.Type ->
Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_relevant_stats model char weapon =
+get_relevant_stats char weapon =
let
stats = (Struct.Character.get_statistics char)
in
@@ -341,6 +373,59 @@ get_relevant_stats model char weapon =
]
)
+get_attributes : (
+ Struct.Character.Type ->
+ Struct.Weapon.Type ->
+ Struct.Armor.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_attributes char weapon armor =
+ let
+ base_atts = (Struct.Character.get_attributes char)
+ active_atts =
+ (Struct.Armor.apply_to_attributes
+ armor
+ (Struct.Weapon.apply_to_attributes weapon base_atts)
+ )
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-stats")
+ ]
+ [
+ (stat_name "Con"),
+ (att_dual_val
+ (Struct.Attributes.get_constitution base_atts)
+ (Struct.Attributes.get_constitution active_atts)
+ ),
+ (stat_name "Dex"),
+ (att_dual_val
+ (Struct.Attributes.get_dexterity base_atts)
+ (Struct.Attributes.get_dexterity active_atts)
+ ),
+ (stat_name "Int"),
+ (att_dual_val
+ (Struct.Attributes.get_intelligence base_atts)
+ (Struct.Attributes.get_intelligence active_atts)
+ ),
+ (stat_name "Min"),
+ (att_dual_val
+ (Struct.Attributes.get_mind base_atts)
+ (Struct.Attributes.get_mind active_atts)
+ ),
+ (stat_name "Spe"),
+ (att_dual_val
+ (Struct.Attributes.get_speed base_atts)
+ (Struct.Attributes.get_speed active_atts)
+ ),
+ (stat_name "Str"),
+ (att_dual_val
+ (Struct.Attributes.get_strength base_atts)
+ (Struct.Attributes.get_strength active_atts)
+ )
+ ]
+ )
+
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -400,7 +485,7 @@ get_summary_html model char =
),
(get_weapon_details char_statistics main_weapon),
(get_armor_details (Struct.Character.get_armor char)),
- (get_relevant_stats model char main_weapon),
+ (get_relevant_stats char main_weapon),
(get_weapon_summary secondary_weapon)
]
)
@@ -408,28 +493,36 @@ get_summary_html model char =
get_full_html : (
Struct.Model.Type ->
Struct.Character.Type ->
- Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_full_html model char weapon =
- (Html.div
- [
- (Html.Attributes.class "battlemap-character-card")
- ]
- [
- (get_name char),
- (Html.div
- [
- (Html.Attributes.class "battlemap-character-card-top")
- ]
- [
- (View.Character.get_portrait_html model.player_id char),
- (get_health_bar char),
- (get_movement_bar model char)
- ]
- ),
- (get_weapon_details (Struct.Character.get_statistics char) weapon),
- (get_armor_details (Struct.Character.get_armor char)),
- (get_relevant_stats model char weapon)
- ]
- )
+get_full_html model char =
+ let
+ weapon_set = (Struct.Character.get_weapons char)
+ main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set)
+ char_statistics = (Struct.Character.get_statistics char)
+ secondary_weapon = (Struct.WeaponSet.get_secondary_weapon weapon_set)
+ armor = (Struct.Character.get_armor char)
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card")
+ ]
+ [
+ (get_name char),
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-top")
+ ]
+ [
+ (View.Character.get_portrait_html model.player_id char),
+ (get_health_bar char),
+ (get_movement_bar model char)
+ ]
+ ),
+ (get_weapon_details char_statistics main_weapon),
+ (get_armor_details armor),
+ (get_relevant_stats char main_weapon),
+ (get_weapon_summary secondary_weapon),
+ (get_attributes char main_weapon armor)
+ ]
+ )
diff --git a/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm b/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm
index d5eb8b7..1713fdd 100644
--- a/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm
+++ b/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm
@@ -5,253 +5,15 @@ import Html
import Html.Attributes
-- Struct.Battlemap -------------------------------------------------------------------
-import Struct.Attributes
import Struct.Character
import Struct.Event
import Struct.Model
-import Struct.Statistics
-import Struct.Weapon
-import Struct.WeaponSet
+
+import View.Controlled.CharacterCard
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_attributes_html: (
- Struct.Attributes.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_attributes_html att =
- (Html.ul
- [
- ]
- [
- (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
- (
- "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 (Base): "
- ++ (toString (Struct.Statistics.get_dodges stats))
- ++ "%"
- )
- )
- ]
- ),
- (Html.li
- []
- [
- (Html.text
- (
- "Chance to Parry: "
- ++ (toString (Struct.Statistics.get_parries stats))
- ++ "%"
- )
- )
- ]
- ),
- (Html.li
- []
- [
- (Html.text
- (
- "Actual Damage: ["
- ++ (toString (Struct.Statistics.get_damage_min stats))
- ++ ", "
- ++ (toString (Struct.Statistics.get_damage_max stats))
- ++ "]"
- )
- )
- ]
- ),
- (Html.li
- []
- [
- (Html.text
- (
- "Accuracy: "
- ++ (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))
- ++ "%"
- )
- )
- ]
- )
- ]
- )
-
-get_weapon_name_html : Struct.Weapon.Type -> (Html.Html Struct.Event.Type)
-get_weapon_name_html wp =
- (Html.text
- (
- (Struct.Weapon.get_name wp)
- ++ " ("
- ++
- (case (Struct.Weapon.get_range_modifier wp) of
- Struct.Weapon.Short -> "Short"
- Struct.Weapon.Long -> "Long"
- )
- ++ " "
- ++
- (case (Struct.Weapon.get_damage_modifier wp) of
- Struct.Weapon.Heavy -> "Heavy"
- Struct.Weapon.Light -> "Light"
- )
- ++ " "
- ++
- (case (Struct.Weapon.get_range_type wp) of
- Struct.Weapon.Ranged -> "Ranged"
- Struct.Weapon.Melee -> "Melee"
- )
- ++ ")"
- )
- )
-
-get_weapon_html : Struct.Weapon.Type -> (Html.Html Struct.Event.Type)
-get_weapon_html wp =
- (Html.ul
- [
- ]
- [
- (Html.li
- []
- [ (get_weapon_name_html wp) ]
- ),
- (Html.li
- []
- [
- (Html.text
- (
- "Damage: ["
- ++ (toString (Struct.Weapon.get_min_damage wp))
- ++ ", "
- ++ (toString (Struct.Weapon.get_max_damage wp))
- ++ "] "
- ++
- (case (Struct.Weapon.get_damage_type wp) of
- Struct.Weapon.Slash -> "Slashing"
- Struct.Weapon.Pierce -> "Piercing"
- Struct.Weapon.Blunt -> "Bludgeoning"
- )
- )
- )
- ]
- ),
- (Html.li
- []
- [
- (Html.text
- (
- "Range: ("
- ++ (toString (Struct.Weapon.get_defense_range wp))
- ++ ", "
- ++ (toString (Struct.Weapon.get_attack_range wp))
- ++ ")"
- )
- )
- ]
- )
- ]
- )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -267,98 +29,7 @@ get_html model char =
(Html.Attributes.class "battlemap-tabmenu-character-info")
]
[
- (Html.text ("Focusing " ++ char.name ++ ":")),
- (Html.dl
- [
- ]
- [
- (Html.dt [] [(Html.text "Location")]),
- (Html.dd
- []
- (
- let
- location = (Struct.Character.get_location char)
- in
- [
- (Html.text
- (
- (toString location.x)
- ++
- ", "
- ++
- (toString location.y)
- )
- )
- ]
- )
- ),
- (Html.dt [] [(Html.text "Player")]),
- (Html.dd
- []
- [
- (Html.text
- (Struct.Character.get_player_id char)
- )
- ]
- ),
- (Html.dt [] [(Html.text "Health")]),
- (Html.dd
- []
- [
- (Html.text
- (
- (toString
- (Struct.Character.get_current_health char)
- )
- ++ "/"
- ++
- (toString
- (Struct.Statistics.get_max_health
- (Struct.Character.get_statistics char)
- )
- )
- )
- )
- ]
- ),
- (Html.dt [] [(Html.text "Movement Points")]),
- (Html.dd
- []
- [
- (Html.text
- (toString
- (Struct.Statistics.get_movement_points
- (Struct.Character.get_statistics char)
- )
- )
- )
- ]
- ),
- (Html.dt [] [(Html.text "Active Weapon:")]),
- (Html.dd
- []
- [
- (get_weapon_html
- (Struct.WeaponSet.get_active_weapon
- (Struct.Character.get_weapons char)
- )
- )
- ]
- ),
- (Html.dt [] [(Html.text "Secondary Weapon:")]),
- (Html.dd
- []
- [
- (get_weapon_html
- (Struct.WeaponSet.get_secondary_weapon
- (Struct.Character.get_weapons char)
- )
- )
- ]
- )
- ]
- ),
- (get_attributes_html (Struct.Character.get_attributes char)),
- (get_statistics_html (Struct.Character.get_statistics char))
+ (Html.text ("Focusing:")),
+ (View.Controlled.CharacterCard.get_full_html model char)
]
)