summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-06-08 18:26:49 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-06-08 18:26:49 +0200
commitb6b4759bca18c9c22797388ce842df02160c484a (patch)
tree87842424faca6f4dabe40ffdcc23b530e44d17ce
parentfb7eaf7da26f9343c5295dbf527ab4e88a1d2fe8 (diff)
Still improving those CharacterCards...
-rw-r--r--src/battlemap/src/View/Controlled.elm10
-rw-r--r--src/battlemap/src/View/Controlled/CharacterCard.elm108
-rw-r--r--src/battlemap/src/View/SubMenu.elm5
-rw-r--r--src/battlemap/src/View/SubMenu/Characters.elm8
-rw-r--r--src/battlemap/www/style.css16
5 files changed, 96 insertions, 51 deletions
diff --git a/src/battlemap/src/View/Controlled.elm b/src/battlemap/src/View/Controlled.elm
index 9b78b57..fed78e2 100644
--- a/src/battlemap/src/View/Controlled.elm
+++ b/src/battlemap/src/View/Controlled.elm
@@ -6,12 +6,10 @@ import Html.Attributes
import Html.Events
-- Struct.Battlemap -------------------------------------------------------------------
-import Struct.Character
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
import Struct.Navigator
-import Struct.WeaponSet
import Util.Html
@@ -106,13 +104,7 @@ get_html model =
(Html.div
[(Html.Attributes.class "battlemap-controlled")]
[
- (View.Controlled.CharacterCard.get_summary_html
- model
- char
- (Struct.WeaponSet.get_active_weapon
- (Struct.Character.get_weapons char)
- )
- ),
+ (View.Controlled.CharacterCard.get_summary_html model char),
(
if
(
diff --git a/src/battlemap/src/View/Controlled/CharacterCard.elm b/src/battlemap/src/View/Controlled/CharacterCard.elm
index dab163a..89d82ae 100644
--- a/src/battlemap/src/View/Controlled/CharacterCard.elm
+++ b/src/battlemap/src/View/Controlled/CharacterCard.elm
@@ -18,6 +18,7 @@ import Struct.Model
import Struct.Navigator
import Struct.Statistics
import Struct.Weapon
+import Struct.WeaponSet
import View.Character
import View.Gauge
@@ -139,12 +140,11 @@ get_movement_bar model char =
(get_inactive_movement_bar char)
get_weapon_details : (
- Struct.Model.Type ->
Struct.Statistics.Type ->
Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_weapon_details model stats weapon =
+get_weapon_details stats weapon =
(Html.div
[
(Html.Attributes.class "battlemap-character-card-weapon")
@@ -188,6 +188,48 @@ get_weapon_details model stats weapon =
]
)
+get_weapon_summary : (
+ Struct.Weapon.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_weapon_summary weapon =
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-weapon-summary")
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-weapon-name")
+ ]
+ [
+ (Html.text (Struct.Weapon.get_name weapon))
+ ]
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-weapon-name")
+ ]
+ [
+ (Html.text
+ (
+ (case (Struct.Weapon.get_damage_type weapon) of
+ Struct.Weapon.Slash -> "Slashing "
+ Struct.Weapon.Pierce -> "Piercing "
+ Struct.Weapon.Blunt -> "Bludgeoning "
+ )
+ ++
+ (case (Struct.Weapon.get_range_type weapon) of
+ Struct.Weapon.Ranged -> "ranged"
+ Struct.Weapon.Melee -> "melee"
+ )
+ )
+ )
+ ]
+ )
+ ]
+ )
+
get_armor_details : (
Struct.Armor.Type ->
(Html.Html Struct.Event.Type)
@@ -331,35 +373,37 @@ get_minimal_html model char =
get_summary_html : (
Struct.Model.Type ->
Struct.Character.Type ->
- Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_summary_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
- model
- (Struct.Character.get_statistics char)
- weapon
- ),
- (get_armor_details (Struct.Character.get_armor char)),
- (get_relevant_stats model char weapon)
- ]
- )
+get_summary_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)
+ 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 (Struct.Character.get_armor char)),
+ (get_relevant_stats model char main_weapon),
+ (get_weapon_summary secondary_weapon)
+ ]
+ )
get_full_html : (
Struct.Model.Type ->
@@ -384,11 +428,7 @@ get_full_html model char weapon =
(get_movement_bar model char)
]
),
- (get_weapon_details
- model
- (Struct.Character.get_statistics char)
- weapon
- ),
+ (get_weapon_details (Struct.Character.get_statistics char) weapon),
(get_armor_details (Struct.Character.get_armor char)),
(get_relevant_stats model char weapon)
]
diff --git a/src/battlemap/src/View/SubMenu.elm b/src/battlemap/src/View/SubMenu.elm
index b23273e..ed3ebb9 100644
--- a/src/battlemap/src/View/SubMenu.elm
+++ b/src/battlemap/src/View/SubMenu.elm
@@ -7,12 +7,10 @@ import Html
import Html.Attributes
-- Battlemap -------------------------------------------------------------------
-import Struct.Character
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
import Struct.UI
-import Struct.WeaponSet
import Util.Html
@@ -69,9 +67,6 @@ get_html model =
(View.Controlled.CharacterCard.get_summary_html
model
char
- (Struct.WeaponSet.get_active_weapon
- (Struct.Character.get_weapons char)
- )
)
]
)
diff --git a/src/battlemap/src/View/SubMenu/Characters.elm b/src/battlemap/src/View/SubMenu/Characters.elm
index 6e19619..92cf52e 100644
--- a/src/battlemap/src/View/SubMenu/Characters.elm
+++ b/src/battlemap/src/View/SubMenu/Characters.elm
@@ -26,7 +26,13 @@ get_character_element_html model char =
(Html.div
[
(Html.Attributes.class "battlemap-characters-element"),
- (Html.Attributes.class "clickable"),
+ (
+ if (Struct.Character.is_alive char)
+ then
+ (Html.Attributes.class "clickable")
+ else
+ (Html.Attributes.class "")
+ ),
(Html.Events.onClick
(Struct.Event.LookingForCharacter (Struct.Character.get_ref char))
),
diff --git a/src/battlemap/www/style.css b/src/battlemap/www/style.css
index 5a80563..c9c6cea 100644
--- a/src/battlemap/www/style.css
+++ b/src/battlemap/www/style.css
@@ -192,6 +192,7 @@
align-items: center;
justify-content: left;
+ margin-top: 0.3em;
}
.battlemap-character-card .battlemap-character-portrait
@@ -278,14 +279,25 @@
background-color: darkgrey;
}
-.battlemap-character-card-weapon
+.battlemap-character-card-weapon,
+.battlemap-character-card-weapon-summary
{
display: grid;
border-radius: 5px;
- background-color: #6C5D53;
padding: 0.3em;
+ margin-top: 0.3em;
+}
+
+.battlemap-character-card-weapon
+{
+ background-color: #6C5D53;
+}
+
+.battlemap-character-card-weapon-summary
+{
+ background-color: #393939;
}
.battlemap-character-card-armor