summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/css/src/roster-editor/controlled-panel.scss17
-rw-r--r--src/roster-editor/src/Struct/Character.elm56
-rw-r--r--src/roster-editor/src/Struct/Model.elm4
-rw-r--r--src/roster-editor/src/View/CharacterCard.elm24
-rw-r--r--src/shared/battle/Battle/Struct/Attributes.elm33
-rw-r--r--src/shared/battle/Battle/View/Attribute.elm51
6 files changed, 170 insertions, 15 deletions
diff --git a/src/css/src/roster-editor/controlled-panel.scss b/src/css/src/roster-editor/controlled-panel.scss
index ace0cf0..c5a8030 100644
--- a/src/css/src/roster-editor/controlled-panel.scss
+++ b/src/css/src/roster-editor/controlled-panel.scss
@@ -1,3 +1,5 @@
+@import '../shared/colors';
+
@import '../shared/battle-view/constants';
@import '../shared/battle-view/menu-mixins';
@@ -21,3 +23,18 @@
flex-flow: column;
justify-content: space-between;
}
+
+
+.roster-editor-atts .omnimod-negative-value
+{
+ background-color: $RED-2;
+ border-radius: 6px;
+ border: solid 1px $RED-0;
+ padding: 2px;
+}
+
+.roster-editor-invalid-character > .info-card-name,
+.roster-editor-invalid-character > .character-card-name
+{
+ background-color: $RED-2;
+}
diff --git a/src/roster-editor/src/Struct/Character.elm b/src/roster-editor/src/Struct/Character.elm
index ee92f8b..003d466 100644
--- a/src/roster-editor/src/Struct/Character.elm
+++ b/src/roster-editor/src/Struct/Character.elm
@@ -9,6 +9,8 @@ module Struct.Character exposing
set_base_character,
set_was_edited,
get_was_edited,
+ set_is_valid,
+ get_is_valid,
resolve,
to_unresolved,
decoder,
@@ -22,6 +24,7 @@ import Json.Decode.Pipeline
import Json.Encode
-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Attributes
import Battle.Struct.Omnimods
-- Battle Characters -----------------------------------------------------------
@@ -36,6 +39,7 @@ type alias Type =
ix : Int,
battle_ix : Int,
was_edited : Bool,
+ is_valid : Bool,
base : BattleCharacters.Struct.Character.Type
}
@@ -44,6 +48,7 @@ type alias Unresolved =
ix : Int,
battle_ix : Int,
was_edited : Bool,
+ is_valid : Bool,
base : BattleCharacters.Struct.Character.Unresolved
}
@@ -75,6 +80,30 @@ get_was_edited char = char.was_edited
set_was_edited : Bool -> Type -> Type
set_was_edited val char = {char | was_edited = val}
+get_is_valid : Type -> Bool
+get_is_valid char = char.is_valid
+
+set_is_valid : Type -> Type
+set_is_valid char =
+ {char |
+ is_valid =
+ (
+ (List.all
+ (\(s, i) -> (i >= 0))
+ (Battle.Struct.Omnimods.get_all_mods
+ (BattleCharacters.Struct.Character.get_omnimods char.base)
+ )
+ )
+ &&
+ (
+ (Battle.Struct.Attributes.get_max_health
+ (BattleCharacters.Struct.Character.get_attributes char.base)
+ )
+ > 0
+ )
+ )
+ }
+
resolve : (
(
BattleCharacters.Struct.Equipment.Unresolved ->
@@ -84,17 +113,20 @@ resolve : (
Type
)
resolve equipment_resolver ref =
- {
- ix = ref.ix,
- battle_ix = ref.battle_ix,
- was_edited = ref.was_edited,
- base =
- (BattleCharacters.Struct.Character.resolve
- (equipment_resolver)
- (Battle.Struct.Omnimods.none)
- ref.base
- )
- }
+ (set_is_valid
+ {
+ ix = ref.ix,
+ battle_ix = ref.battle_ix,
+ was_edited = ref.was_edited,
+ is_valid = False,
+ base =
+ (BattleCharacters.Struct.Character.resolve
+ (equipment_resolver)
+ (Battle.Struct.Omnimods.none)
+ ref.base
+ )
+ }
+ )
to_unresolved : Type -> Unresolved
to_unresolved char =
@@ -102,6 +134,7 @@ to_unresolved char =
ix = char.ix,
battle_ix = char.battle_ix,
was_edited = char.was_edited,
+ is_valid = char.is_valid,
base = (BattleCharacters.Struct.Character.to_unresolved char.base)
}
@@ -112,6 +145,7 @@ decoder =
|> (Json.Decode.Pipeline.required "ix" Json.Decode.int)
|> (Json.Decode.Pipeline.hardcoded -1)
|> (Json.Decode.Pipeline.hardcoded False)
+ |> (Json.Decode.Pipeline.hardcoded True)
|>
(Json.Decode.Pipeline.required
"bas"
diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm
index 0c304c9..879e185 100644
--- a/src/roster-editor/src/Struct/Model.elm
+++ b/src/roster-editor/src/Struct/Model.elm
@@ -262,7 +262,9 @@ save_character model =
characters =
(Array.set
(Struct.Character.get_index char)
- (Struct.Character.set_was_edited True char)
+ (Struct.Character.set_is_valid
+ (Struct.Character.set_was_edited True char)
+ )
model.characters
)
}
diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm
index ca300b7..1f64f38 100644
--- a/src/roster-editor/src/View/CharacterCard.elm
+++ b/src/roster-editor/src/View/CharacterCard.elm
@@ -208,7 +208,17 @@ get_mod_html mod =
in
(Html.div
[
- (Html.Attributes.class "info-card-mod")
+ (Html.Attributes.class "info-card-mod"),
+ (Html.Attributes.class
+ (
+ if (value < 0)
+ then "omnimod-negative-value"
+ else
+ if (value > 0)
+ then "omnimod-positive-value"
+ else "omnimod-nil-value"
+ )
+ )
]
[
(Html.div
@@ -333,7 +343,8 @@ get_relevant_atts : (
get_relevant_atts omnimods atts =
(Html.div
[
- (Html.Attributes.class "character-card-atts")
+ (Html.Attributes.class "character-card-atts"),
+ (Html.Attributes.class "roster-editor-atts")
]
(
[
@@ -370,7 +381,7 @@ get_relevant_atts omnimods atts =
)
)
]
- ++ (Battle.View.Attribute.get_all_but_gauges_html atts)
+ ++ (Battle.View.Attribute.get_true_all_html atts)
)
)
@@ -390,6 +401,13 @@ get_minimal_html char =
(Html.Attributes.class "info-card-minimal"),
(Html.Attributes.class "character-card"),
(Html.Attributes.class "character-card-minimal"),
+ (Html.Attributes.class
+ (
+ if (Struct.Character.get_is_valid char)
+ then "roster-editor-valid-character"
+ else "roster-editor-invalid-character"
+ )
+ ),
(Html.Events.onClick
(Struct.Event.CharacterSelected
(Struct.Character.get_index char)
diff --git a/src/shared/battle/Battle/Struct/Attributes.elm b/src/shared/battle/Battle/Struct/Attributes.elm
index 134209d..bb6c06e 100644
--- a/src/shared/battle/Battle/Struct/Attributes.elm
+++ b/src/shared/battle/Battle/Struct/Attributes.elm
@@ -11,6 +11,14 @@ module Battle.Struct.Attributes exposing
get_critical_hits,
get_damage_modifier,
get_damage_multiplier,
+ get_true_movement_points,
+ get_true_max_health,
+ get_true_dodges,
+ get_true_parries,
+ get_true_accuracy,
+ get_true_double_hits,
+ get_true_critical_hits,
+ get_true_damage_modifier,
decode_category,
encode_category,
mod,
@@ -109,6 +117,31 @@ get_damage_modifier t = (max 0 t.damage_modifier)
get_damage_multiplier : Type -> Float
get_damage_multiplier t = ((toFloat (max 0 t.damage_modifier)) / 100.0)
+get_true_movement_points : Type -> Int
+get_true_movement_points t = t.movement_points
+
+get_true_max_health : Type -> Int
+get_true_max_health t = t.max_health
+
+get_true_dodges : Type -> Int
+get_true_dodges t = t.dodges
+
+get_true_parries : Type -> Int
+get_true_parries t = t.parries
+
+get_true_accuracy : Type -> Int
+get_true_accuracy t = t.accuracy
+
+get_true_double_hits : Type -> Int
+get_true_double_hits t = t.double_hits
+
+get_true_critical_hits : Type -> Int
+get_true_critical_hits t = t.critical_hits
+
+get_true_damage_modifier : Type -> Int
+get_true_damage_modifier t = t.damage_modifier
+
+
mod : Category -> Int -> Type -> Type
mod cat v t =
case cat of
diff --git a/src/shared/battle/Battle/View/Attribute.elm b/src/shared/battle/Battle/View/Attribute.elm
index 49fe7a8..9b2a8c7 100644
--- a/src/shared/battle/Battle/View/Attribute.elm
+++ b/src/shared/battle/Battle/View/Attribute.elm
@@ -2,6 +2,7 @@ module Battle.View.Attribute exposing
(
get_html,
get_all_html,
+ get_true_all_html,
get_all_but_gauges_html,
get_signed_html,
get_all_signed_html,
@@ -39,6 +40,16 @@ get_html attribute value =
(Struct.Event.RequestedHelp
(Struct.HelpRequest.Attribute attribute)
)
+ ),
+ (Html.Attributes.class
+ (
+ if (value < 0)
+ then "omnimod-negative-value"
+ else
+ if (value > 0)
+ then "omnimod-positive-value"
+ else "omnimod-nil-value"
+ )
)
]
[
@@ -170,6 +181,46 @@ get_all_html atts =
)
]
+get_true_all_html : (
+ Battle.Struct.Attributes.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_true_all_html atts =
+ [
+ (get_html
+ Battle.Struct.Attributes.Dodges
+ (Battle.Struct.Attributes.get_true_dodges atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.Parries
+ (Battle.Struct.Attributes.get_true_parries atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.Accuracy
+ (Battle.Struct.Attributes.get_true_accuracy atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.DoubleHits
+ (Battle.Struct.Attributes.get_true_double_hits atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.CriticalHits
+ (Battle.Struct.Attributes.get_true_critical_hits atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.MaxHealth
+ (Battle.Struct.Attributes.get_true_max_health atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.MovementPoints
+ (Battle.Struct.Attributes.get_true_movement_points atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.DamageModifier
+ (Battle.Struct.Attributes.get_true_damage_modifier atts)
+ )
+ ]
+
get_all_signed_html : (
Battle.Struct.Attributes.Type ->
(List (Html.Html Struct.Event.Type))