aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-09-12 12:49:38 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-09-12 12:49:38 +0200
commit18bd70b35597a0581cfe59f07927e03492a8be81 (patch)
tree6572816e7b998a61dad90a49e60c97203b92ba34
parentce03028ccd575af1dc38b26d23569601d3b5d491 (diff)
downloadtacticians-client-18bd70b35597a0581cfe59f07927e03492a8be81.zip
tacticians-client-18bd70b35597a0581cfe59f07927e03492a8be81.tar.bz2
Adds min values when displaying omnimods in battle.
-rw-r--r--src/shared/battle/Battle/Struct/Attributes.elm.m460
-rw-r--r--src/shared/battle/Battle/Struct/Omnimods.elm20
-rw-r--r--src/shared/battle/Battle/View/Omnimods.elm20
3 files changed, 83 insertions, 17 deletions
diff --git a/src/shared/battle/Battle/Struct/Attributes.elm.m4 b/src/shared/battle/Battle/Struct/Attributes.elm.m4
index d008618..aad8504 100644
--- a/src/shared/battle/Battle/Struct/Attributes.elm.m4
+++ b/src/shared/battle/Battle/Struct/Attributes.elm.m4
@@ -19,8 +19,11 @@ module Battle.Struct.Attributes exposing
get_true_double_hits,
get_true_critical_hits,
get_true_damage_modifier,
+ get,
+ get_true,
decode_category,
encode_category,
+ get_categories,
mod,
default,
is_percent
@@ -154,20 +157,59 @@ mod cat v t =
CriticalHits -> (mod_critical_hits v t)
DamageModifier -> (mod_damage_modifier v t)
--- TODO: Link this to the server using tacticians-data.
+get : Category -> Type -> Int
+get cat t =
+ case cat of
+ MaxHealth -> (get_max_health t)
+ MovementPoints -> (get_movement_points t)
+ Dodges -> (get_dodges t)
+ Parries -> (get_parries t)
+ Accuracy -> (get_accuracy t)
+ DoubleHits -> (get_double_hits t)
+ CriticalHits -> (get_critical_hits t)
+ DamageModifier -> (get_damage_modifier t)
+
+get_true : Category -> Type -> Int
+get_true cat t =
+ case cat of
+ MaxHealth -> (get_true_max_health t)
+ MovementPoints -> (get_true_movement_points t)
+ Dodges -> (get_true_dodges t)
+ Parries -> (get_true_parries t)
+ Accuracy -> (get_true_accuracy t)
+ DoubleHits -> (get_true_double_hits t)
+ CriticalHits -> (get_true_critical_hits t)
+ DamageModifier -> (get_true_damage_modifier t)
+
+get_categories : (List Category)
+get_categories =
+ [
+ MovementPoints,
+ MaxHealth,
+ Dodges,
+ Parries,
+ Accuracy,
+ DoubleHits,
+ CriticalHits,
+ DamageModifier
+ ]
+
+m4_include(__MAKEFILE_DATA_DIR/attributes.m4.conf)
+
default : Type
default =
{
- movement_points = 8,
- max_health = 1,
- dodges = 0,
- parries = 0,
- accuracy = 0,
- double_hits = 0,
- critical_hits = 0,
- damage_modifier = 0
+ movement_points = __ATT_MOVEMENT_POINTS_MIN,
+ max_health = __ATT_MAX_HEALTH_MIN,
+ dodges = __ATT_DODGE_MIN,
+ parries = __ATT_PARRY_MIN,
+ accuracy = __ATT_ACCURACY_MIN,
+ double_hits = __ATT_DOUBLE_HITS_MIN,
+ critical_hits = __ATT_CRITICAL_HIT_MIN,
+ damage_modifier = __ATT_DAMAGE_MODIFIER_MIN
}
+
m4_include(__MAKEFILE_DATA_DIR/names.m4.conf)
decode_category : String -> Category
diff --git a/src/shared/battle/Battle/Struct/Omnimods.elm b/src/shared/battle/Battle/Struct/Omnimods.elm
index e9c3089..80d97a5 100644
--- a/src/shared/battle/Battle/Struct/Omnimods.elm
+++ b/src/shared/battle/Battle/Struct/Omnimods.elm
@@ -3,6 +3,7 @@ module Battle.Struct.Omnimods exposing
Type,
new,
merge,
+ merge_attributes,
none,
apply_to_attributes,
get_attack_damage,
@@ -120,6 +121,25 @@ merge omni_a omni_b =
defense = (merge_mods omni_a.defense omni_b.defense)
}
+merge_attributes : Battle.Struct.Attributes.Type -> Type -> Type
+merge_attributes attributes omnimods =
+ (merge
+ omnimods
+ (new
+ (List.map
+ (\att ->
+ (
+ (Battle.Struct.Attributes.encode_category att),
+ (Battle.Struct.Attributes.get_true att attributes)
+ )
+ )
+ (Battle.Struct.Attributes.get_categories)
+ )
+ []
+ []
+ )
+ )
+
apply_to_attributes : (
Type ->
Battle.Struct.Attributes.Type ->
diff --git a/src/shared/battle/Battle/View/Omnimods.elm b/src/shared/battle/Battle/View/Omnimods.elm
index 7af5709..b914bca 100644
--- a/src/shared/battle/Battle/View/Omnimods.elm
+++ b/src/shared/battle/Battle/View/Omnimods.elm
@@ -144,14 +144,18 @@ get_user_friendly_html : (
)
get_user_friendly_html omnimods =
let
- -- TODO: Add minimal values to omnimods (e.g. +1 to health).
+ omnimods_with_mins =
+ (Battle.Struct.Omnimods.merge_attributes
+ (Battle.Struct.Attributes.default)
+ omnimods
+ )
scaled_omnimods =
(Battle.Struct.Omnimods.apply_damage_modifier
(Battle.Struct.Omnimods.get_attribute_mod
Battle.Struct.Attributes.DamageModifier
- omnimods
+ omnimods_with_mins
)
- omnimods
+ omnimods_with_mins
)
in
(Html.div
@@ -167,7 +171,7 @@ get_user_friendly_html omnimods =
(\(k, v) ->
(Battle.View.DamageType.get_html
(Battle.Struct.DamageType.decode k)
- v
+ (max 0 v)
)
)
(Battle.Struct.Omnimods.get_attack_mods scaled_omnimods)
@@ -181,10 +185,10 @@ get_user_friendly_html omnimods =
(\(k, v) ->
(Battle.View.DamageType.get_html
(Battle.Struct.DamageType.decode k)
- v
+ (max 0 v)
)
)
- (Battle.Struct.Omnimods.get_defense_mods omnimods)
+ (Battle.Struct.Omnimods.get_defense_mods scaled_omnimods)
)
),
(Html.div
@@ -195,10 +199,10 @@ get_user_friendly_html omnimods =
(\(k, v) ->
(Battle.View.Attribute.get_html
(Battle.Struct.Attributes.decode_category k)
- v
+ (max 0 v)
)
)
- (Battle.Struct.Omnimods.get_attribute_mods omnimods)
+ (Battle.Struct.Omnimods.get_attribute_mods scaled_omnimods)
)
)
]