summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Character.elm18
-rw-r--r--src/shared/battle/Battle/Lang/English.elm261
-rw-r--r--src/shared/battle/Battle/Struct/Attributes.elm204
-rw-r--r--src/shared/battle/Battle/Struct/Omnimods.elm33
-rw-r--r--src/shared/battle/Battle/Struct/Statistics.elm146
-rw-r--r--src/shared/battle/Battle/View/Attribute.elm179
-rw-r--r--src/shared/battle/Battle/View/Help/Attribute.elm62
-rw-r--r--src/shared/battle/Battle/View/Omnimods.elm30
8 files changed, 81 insertions, 852 deletions
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm
index 39c7d26..ce74b59 100644
--- a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm
@@ -10,7 +10,6 @@ module BattleCharacters.Struct.Character exposing
get_omnimods,
set_extra_omnimods,
dirty_set_extra_omnimods,
- get_attributes,
get_statistics,
get_active_weapon,
get_inactive_weapon,
@@ -31,7 +30,6 @@ import Json.Encode
-- Battle ----------------------------------------------------------------------
import Battle.Struct.Omnimods
-import Battle.Struct.Attributes
import Battle.Struct.Statistics
-- Battle Characters -----------------------------------------------------------
@@ -47,7 +45,6 @@ type alias Type =
{
name : String,
equipment : BattleCharacters.Struct.Equipment.Type,
- attributes : Battle.Struct.Attributes.Type,
statistics : Battle.Struct.Statistics.Type,
is_using_secondary : Bool,
omnimods : Battle.Struct.Omnimods.Type,
@@ -86,19 +83,13 @@ refresh_omnimods char =
(BattleCharacters.Struct.Equipment.get_glyph_board equipment)
)
)
- attributes =
- (Battle.Struct.Omnimods.apply_to_attributes
- omnimods
- (Battle.Struct.Attributes.default)
- )
statistics =
(Battle.Struct.Omnimods.apply_to_statistics
omnimods
- (Battle.Struct.Statistics.new_raw attributes)
+ (Battle.Struct.Statistics.default)
)
in
{char |
- attributes = attributes,
statistics = statistics,
omnimods = omnimods
}
@@ -143,9 +134,6 @@ set_extra_omnimods om char = (refresh_omnimods {char | extra_omnimods = om})
dirty_set_extra_omnimods : Battle.Struct.Omnimods.Type -> Type -> Type
dirty_set_extra_omnimods om char = {char | extra_omnimods = om}
-get_attributes : Type -> Battle.Struct.Attributes.Type
-get_attributes char = char.attributes
-
get_statistics : Type -> Battle.Struct.Statistics.Type
get_statistics char = char.statistics
@@ -204,13 +192,11 @@ resolve : (
Type
)
resolve resolve_equipment extra_omnimods ref =
- let default_attributes = (Battle.Struct.Attributes.default) in
(refresh_omnimods
{
name = ref.name,
equipment = (resolve_equipment ref.equipment),
- attributes = default_attributes,
- statistics = (Battle.Struct.Statistics.new_raw default_attributes),
+ statistics = (Battle.Struct.Statistics.default),
is_using_secondary = ref.is_using_secondary,
omnimods = (Battle.Struct.Omnimods.none),
extra_omnimods = extra_omnimods
diff --git a/src/shared/battle/Battle/Lang/English.elm b/src/shared/battle/Battle/Lang/English.elm
index bc8b378..2568260 100644
--- a/src/shared/battle/Battle/Lang/English.elm
+++ b/src/shared/battle/Battle/Lang/English.elm
@@ -6,7 +6,6 @@ import Html.Attributes
import Html.Events
-- Battle ----------------------------------------------------------------------
-import Battle.Struct.Attributes
import Battle.Struct.Statistics
import Battle.Struct.DamageType
@@ -27,26 +26,6 @@ import Struct.HelpRequest
--------------------------------------------------------------------------------
-- Nouns -----------------------------------------------------------------------
----- Attributes ----------------------------------------------------------------
-constitution : String
-constitution = "Constitution"
-
-dexterity : String
-dexterity = "Dexterity"
-
-intelligence : String
-intelligence = "Intelligence"
-
-mind : String
-mind = "Mind"
-
-speed : String
-speed = "Speed"
-
-strength : String
-strength = "Strength"
-
----- Statistics ----------------------------------------------------------------
max_health : String
max_health = "Max. Health"
@@ -68,6 +47,9 @@ double_hits = "Double Hit Chance"
critical_hits : String
critical_hits = "Critical Hit Chance"
+damage_modifier : String
+damage_modifier = "Damage Multiplier"
+
---- Damage Types --------------------------------------------------------------
slash : String
slash = "Slashing Damage"
@@ -82,97 +64,6 @@ base : String
base = "Universal Damage"
-- Help ------------------------------------------------------------------------
----- Attributes ----------------------------------------------------------------
-constitution_help : (Html.Html Struct.Event.Type)
-constitution_help =
- (Html.div
- [
- ]
- [
- (Html.text "Constitution influences "),
- (get_stats_reference_html Battle.Struct.Statistics.MaxHealth),
- (Html.text " (75%), and "),
- (get_stats_reference_html Battle.Struct.Statistics.MovementPoints),
- (Html.text " (~33%).")
- ]
- )
-
-dexterity_help : (Html.Html Struct.Event.Type)
-dexterity_help =
- (Html.div
- [
- ]
- [
- (Html.text "Dexterity influences "),
- (get_stats_reference_html Battle.Struct.Statistics.Accuracy),
- (Html.text " (100%), "),
- (get_stats_reference_html Battle.Struct.Statistics.Dodges),
- (Html.text " (~33%), and "),
- (get_stats_reference_html Battle.Struct.Statistics.Parries),
- (Html.text " (25%).")
- ]
- )
-
-intelligence_help : (Html.Html Struct.Event.Type)
-intelligence_help =
- (Html.div
- [
- ]
- [
- (Html.text "Intelligence influences "),
- (get_stats_reference_html Battle.Struct.Statistics.CriticalHits),
- (Html.text " (100%), and "),
- (get_stats_reference_html Battle.Struct.Statistics.Parries),
- (Html.text " (25%).")
- ]
- )
-
-mind_help : (Html.Html Struct.Event.Type)
-mind_help =
- (Html.div
- [
- ]
- [
- (Html.text "Mind influences "),
- (get_stats_reference_html Battle.Struct.Statistics.DoubleHits),
- (Html.text " (50%), "),
- (get_stats_reference_html Battle.Struct.Statistics.Dodges),
- (Html.text " (~33%), "),
- (get_stats_reference_html Battle.Struct.Statistics.MaxHealth),
- (Html.text " (25%), and "),
- (get_stats_reference_html Battle.Struct.Statistics.MovementPoints),
- (Html.text " (~16%).")
- ]
- )
-
-speed_help : (Html.Html Struct.Event.Type)
-speed_help =
- (Html.div
- [
- ]
- [
- (Html.text "Speed influences "),
- (get_stats_reference_html Battle.Struct.Statistics.MovementPoints),
- (Html.text " (50%), "),
- (get_stats_reference_html Battle.Struct.Statistics.DoubleHits),
- (Html.text " (50%), and "),
- (get_stats_reference_html Battle.Struct.Statistics.Dodges),
- (Html.text " (~33%).")
- ]
- )
-
-strength_help : (Html.Html Struct.Event.Type)
-strength_help =
- (Html.div
- [
- ]
- [
- (Html.text "Strength influences attack damage (100%), and "),
- (get_stats_reference_html Battle.Struct.Statistics.Parries),
- (Html.text " (25%).")
- ]
- )
-
---- Statistics ----------------------------------------------------------------
max_health_help : (Html.Html Struct.Event.Type)
max_health_help =
@@ -183,13 +74,9 @@ max_health_help =
(Html.text
"""
Maximum Health is the maximum amount of hit points the character can
- have. It is based on
+ have.
"""
- ),
- (get_atts_reference_html Battle.Struct.Attributes.Constitution),
- (Html.text " (75%), and "),
- (get_atts_reference_html Battle.Struct.Attributes.Mind),
- (Html.text " (25%).")
+ )
]
)
@@ -202,15 +89,9 @@ movement_points_help =
(Html.text
"""
Movement Points are an indication of how much this character can
- move every turn. They are based on
+ move every turn.
"""
- ),
- (get_atts_reference_html Battle.Struct.Attributes.Speed),
- (Html.text " (50%), "),
- (get_atts_reference_html Battle.Struct.Attributes.Constitution),
- (Html.text " (~33%), and "),
- (get_atts_reference_html Battle.Struct.Attributes.Mind),
- (Html.text " (~16%).")
+ )
]
)
@@ -229,16 +110,10 @@ dodges_help =
),
(get_stats_reference_html Battle.Struct.Statistics.Accuracy),
(Html.text
- """. Multiply by two to get the chance of avoiding partially (taking
- only half damage) an attack. Dodge Chance is based on
+ """. Multiply by two to get the chance of at least avoiding
+ partially (taking only half damage) an attack.
"""
- ),
- (get_atts_reference_html Battle.Struct.Attributes.Dexterity),
- (Html.text " (~33%), "),
- (get_atts_reference_html Battle.Struct.Attributes.Mind),
- (Html.text " (~33%), and "),
- (get_atts_reference_html Battle.Struct.Attributes.Speed),
- (Html.text " (~33%).")
+ )
]
)
@@ -251,18 +126,10 @@ parries_help =
(Html.text
"""
Parry Chance indicates how likely it is for this characters to void
- an incoming attack and replace it by one of their own. It is
- based on
+ an incoming attack and replace it by one of their own. This requires
+ a melee weapon. Attacks of Opportunity cannot be parried.
"""
- ),
- (get_atts_reference_html Battle.Struct.Attributes.Dexterity),
- (Html.text " (25%), "),
- (get_atts_reference_html Battle.Struct.Attributes.Intelligence),
- (Html.text " (25%), "),
- (get_atts_reference_html Battle.Struct.Attributes.Speed),
- (Html.text " (25%), and "),
- (get_atts_reference_html Battle.Struct.Attributes.Strength),
- (Html.text " (25%).")
+ )
]
)
@@ -276,9 +143,7 @@ accuracy_help =
"Accuracy lowers the target's chance to evade an incoming blow ("
),
(get_stats_reference_html Battle.Struct.Statistics.Dodges),
- (Html.text "). It is based on "),
- (get_atts_reference_html Battle.Struct.Attributes.Dexterity),
- (Html.text " (100%).")
+ (Html.text ").")
]
)
@@ -292,13 +157,9 @@ double_hits_help =
"""
Double Hit Chance indicate how likely this character is to perform
a follow-up attack (which takes place after their target's
- retaliation, if there is any). It is based on
+ retaliation, if there is any).
"""
- ),
- (get_atts_reference_html Battle.Struct.Attributes.Mind),
- (Html.text " (50%), and "),
- (get_atts_reference_html Battle.Struct.Attributes.Speed),
- (Html.text " (50%).")
+ )
]
)
@@ -311,11 +172,23 @@ critical_hits_help =
(Html.text
"""
Critical Hit Chance indicate how likely this character is to perform
- an attack with double the damage. It is based on
+ an attack with double the damage.
"""
- ),
- (get_atts_reference_html Battle.Struct.Attributes.Intelligence),
- (Html.text " (100%).")
+ )
+ ]
+ )
+damage_modifier_help : (Html.Html Struct.Event.Type)
+damage_modifier_help =
+ (Html.div
+ [
+ ]
+ [
+ (Html.text
+ """
+ Increases or decreases (if lower than 100%) the damage of all of
+ this character's attacks.
+ """
+ )
]
)
@@ -394,48 +267,6 @@ base_help =
]
)
-get_atts_reference_html : (
- Battle.Struct.Attributes.Category ->
- (Html.Html Struct.Event.Type)
- )
-get_atts_reference_html cat =
- (Html.div
- [
- (Html.Attributes.class "tooltip-reference"),
- (Html.Events.onClick
- (Struct.Event.RequestedHelp
- (Struct.HelpRequest.Attribute cat)
- )
- )
- ]
- [
- (Html.div
- [
- (Html.Attributes.class "omnimod-icon"),
- (Html.Attributes.class
- (
- "omnimod-icon-"
- ++ (Battle.Struct.Attributes.encode_category cat)
- )
- )
- ]
- [
- ]
- ),
- (Html.text (get_attribute_name cat))
- ]
- )
-
-get_attribute_name : Battle.Struct.Attributes.Category -> String
-get_attribute_name cat =
- case cat of
- Battle.Struct.Attributes.Constitution -> (constitution)
- Battle.Struct.Attributes.Dexterity -> (dexterity)
- Battle.Struct.Attributes.Intelligence -> (intelligence)
- Battle.Struct.Attributes.Mind -> (mind)
- Battle.Struct.Attributes.Speed -> (speed)
- Battle.Struct.Attributes.Strength -> (strength)
-
get_statistic_name : Battle.Struct.Statistics.Category -> String
get_statistic_name cat =
case cat of
@@ -446,30 +277,7 @@ get_statistic_name cat =
Battle.Struct.Statistics.Accuracy -> (accuracy)
Battle.Struct.Statistics.DoubleHits -> (double_hits)
Battle.Struct.Statistics.CriticalHits -> (critical_hits)
-
-get_attribute_category_help : (
- Battle.Struct.Attributes.Category ->
- (String, (Html.Html Struct.Event.Type))
- )
-get_attribute_category_help cat =
- case cat of
- Battle.Struct.Attributes.Constitution ->
- ((constitution), (constitution_help))
-
- Battle.Struct.Attributes.Dexterity ->
- ((dexterity), (dexterity_help))
-
- Battle.Struct.Attributes.Intelligence ->
- ((intelligence), (intelligence_help))
-
- Battle.Struct.Attributes.Mind ->
- ((mind), (mind_help))
-
- Battle.Struct.Attributes.Speed ->
- ((speed), (speed_help))
-
- Battle.Struct.Attributes.Strength ->
- ((strength), (strength_help))
+ Battle.Struct.Statistics.DamageModifier -> (damage_modifier)
get_statistic_category_help : (
Battle.Struct.Statistics.Category ->
@@ -498,6 +306,9 @@ get_statistic_category_help cat =
Battle.Struct.Statistics.CriticalHits ->
((critical_hits), (critical_hits_help))
+ Battle.Struct.Statistics.DamageModifier ->
+ ((damage_modifier), (damage_modifier_help))
+
get_damage_type_help : (
Battle.Struct.DamageType.Type ->
(String, (Html.Html Struct.Event.Type))
diff --git a/src/shared/battle/Battle/Struct/Attributes.elm b/src/shared/battle/Battle/Struct/Attributes.elm
deleted file mode 100644
index 9d83bef..0000000
--- a/src/shared/battle/Battle/Struct/Attributes.elm
+++ /dev/null
@@ -1,204 +0,0 @@
-module Battle.Struct.Attributes exposing
- (
- Type,
- Category(..),
- get_constitution,
- get_dexterity,
- get_intelligence,
- get_mind,
- get_speed,
- get_strength,
- get_effective_constitution,
- get_effective_dexterity,
- get_effective_intelligence,
- get_effective_mind,
- get_effective_speed,
- get_effective_strength,
- mod_constitution,
- mod_dexterity,
- mod_intelligence,
- mod_mind,
- mod_speed,
- mod_strength,
- mod,
- get,
- new,
- decode_category,
- encode_category,
- default
- )
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type Category =
- Constitution
- | Dexterity
- | Intelligence
- | Mind
- | Speed
- | Strength
-
-type alias Type =
- {
- constitution : Int,
- dexterity : Int,
- intelligence : Int,
- mind : Int,
- speed : Int,
- strength : Int
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_within_range : Int -> Int -> Int -> Int
-get_within_range vmin vmax v = (min vmax (max vmin v))
-
-get_within_att_range : Int -> Int
-get_within_att_range v = (get_within_range 0 100 v)
-
---------------------------------------------------------------------------------
--- 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 = t.mind
-
-get_speed : Type -> Int
-get_speed t = t.speed
-
-get_strength : Type -> Int
-get_strength t = t.strength
-
-get_effective_constitution : Type -> Int
-get_effective_constitution t = (get_within_att_range t.constitution)
-
-get_effective_dexterity : Type -> Int
-get_effective_dexterity t = (get_within_att_range t.dexterity)
-
-get_effective_intelligence : Type -> Int
-get_effective_intelligence t = (get_within_att_range t.intelligence)
-
-get_effective_mind : Type -> Int
-get_effective_mind t = (get_within_att_range t.mind)
-
-get_effective_speed : Type -> Int
-get_effective_speed t = (get_within_att_range t.speed)
-
-get_effective_strength : Type -> Int
-get_effective_strength t = (get_within_att_range t.strength)
-
-mod_constitution : Int -> Type -> Type
-mod_constitution i t =
- {t |
- constitution = (i + t.constitution)
- }
-
-mod_dexterity : Int -> Type -> Type
-mod_dexterity i t =
- {t |
- dexterity = (i + t.dexterity)
- }
-
-mod_intelligence : Int -> Type -> Type
-mod_intelligence i t =
- {t |
- intelligence = (i + t.intelligence)
- }
-
-mod_mind : Int -> Type -> Type
-mod_mind i t =
- {t |
- mind = (i + t.mind)
- }
-
-mod_speed : Int -> Type -> Type
-mod_speed i t =
- {t |
- speed = (i + t.speed)
- }
-
-mod_strength : Int -> Type -> Type
-mod_strength i t =
- {t |
- strength = (i + t.strength)
- }
-
-mod : Category -> Int -> Type -> Type
-mod cat i t =
- case cat of
- Constitution -> (mod_constitution i t)
- Dexterity -> (mod_dexterity i t)
- Intelligence -> (mod_intelligence i t)
- Mind -> (mod_mind i t)
- Speed -> (mod_speed i t)
- Strength -> (mod_strength i t)
-
-get : Category -> Type -> Int
-get cat t =
- case cat of
- Constitution -> (get_constitution t)
- Dexterity -> (get_dexterity t)
- Intelligence -> (get_intelligence t)
- Mind -> (get_mind t)
- Speed -> (get_speed t)
- Strength -> (get_strength t)
-
-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
- }
-
-default : Type
-default =
- {
- constitution = 50,
- dexterity = 50,
- intelligence = 50,
- mind = 50,
- speed = 50,
- strength = 50
- }
-
-decode_category : String -> Category
-decode_category str =
- case str of
- "con" -> Constitution
- "dex" -> Dexterity
- "int" -> Intelligence
- "min" -> Mind
- "spe" -> Speed
- _ -> Strength
-
-encode_category : Category -> String
-encode_category cat =
- case cat of
- Constitution -> "con"
- Dexterity -> "dex"
- Intelligence -> "int"
- Mind -> "min"
- Speed -> "spe"
- Strength -> "str"
diff --git a/src/shared/battle/Battle/Struct/Omnimods.elm b/src/shared/battle/Battle/Struct/Omnimods.elm
index fd0088b..92bf636 100644
--- a/src/shared/battle/Battle/Struct/Omnimods.elm
+++ b/src/shared/battle/Battle/Struct/Omnimods.elm
@@ -4,11 +4,9 @@ module Battle.Struct.Omnimods exposing
new,
merge,
none,
- apply_to_attributes,
apply_to_statistics,
get_attack_damage,
get_damage_sum,
- get_attributes_mods,
get_statistics_mods,
get_attack_mods,
get_defense_mods,
@@ -24,7 +22,6 @@ import Json.Decode
import Json.Decode.Pipeline
-- Battle ----------------------------------------------------------------------
-import Battle.Struct.Attributes
import Battle.Struct.Statistics
import Battle.Struct.DamageType
@@ -33,7 +30,6 @@ import Battle.Struct.DamageType
--------------------------------------------------------------------------------
type alias Type =
{
- attributes : (Dict.Dict String Int),
statistics : (Dict.Dict String Int),
attack : (Dict.Dict String Int),
defense : (Dict.Dict String Int)
@@ -88,7 +84,6 @@ decoder : (Json.Decode.Decoder Type)
decoder =
(Json.Decode.succeed
Type
- |> (Json.Decode.Pipeline.required "attm" generic_mods_decoder)
|> (Json.Decode.Pipeline.required "stam" generic_mods_decoder)
|> (Json.Decode.Pipeline.required "atkm" generic_mods_decoder)
|> (Json.Decode.Pipeline.required "defm" generic_mods_decoder)
@@ -98,12 +93,10 @@ new : (
(List (String, Int)) ->
(List (String, Int)) ->
(List (String, Int)) ->
- (List (String, Int)) ->
Type
)
-new attribute_mods statistic_mods attack_mods defense_mods =
+new statistic_mods attack_mods defense_mods =
{
- attributes = (Dict.fromList attribute_mods),
statistics = (Dict.fromList statistic_mods),
attack = (Dict.fromList attack_mods),
defense = (Dict.fromList defense_mods)
@@ -112,7 +105,6 @@ new attribute_mods statistic_mods attack_mods defense_mods =
none : Type
none =
{
- attributes = (Dict.empty),
statistics = (Dict.empty),
attack = (Dict.empty),
defense = (Dict.empty)
@@ -121,27 +113,11 @@ none =
merge : Type -> Type -> Type
merge omni_a omni_b =
{
- attributes = (merge_mods omni_a.attributes omni_b.attributes),
statistics = (merge_mods omni_a.statistics omni_b.statistics),
attack = (merge_mods omni_a.attack omni_b.attack),
defense = (merge_mods omni_a.defense omni_b.defense)
}
-apply_to_attributes : (
- Type ->
- Battle.Struct.Attributes.Type
- -> Battle.Struct.Attributes.Type
- )
-apply_to_attributes omnimods attributes =
- (Dict.foldl
- (
- (Battle.Struct.Attributes.decode_category)
- >> (Battle.Struct.Attributes.mod)
- )
- attributes
- omnimods.attributes
- )
-
apply_to_statistics : (
Type ->
Battle.Struct.Statistics.Type ->
@@ -201,16 +177,12 @@ get_attack_damage dmg_modifier atk_omni def_omni =
scale : Float -> Type -> Type
scale multiplier omnimods =
{omnimods |
- attributes = (Dict.map (scale_dict_value multiplier) omnimods.attributes),
statistics = (Dict.map (scale_dict_value multiplier) omnimods.statistics),
attack = (Dict.map (scale_dict_value multiplier) omnimods.attack),
defense =
(Dict.map (scale_dict_value multiplier) omnimods.defense)
}
-get_attributes_mods : Type -> (List (String, Int))
-get_attributes_mods omnimods = (Dict.toList omnimods.attributes)
-
get_statistics_mods : Type -> (List (String, Int))
get_statistics_mods omnimods = (Dict.toList omnimods.statistics)
@@ -223,8 +195,7 @@ get_defense_mods omnimods = (Dict.toList omnimods.defense)
get_all_mods : Type -> (List (String, Int))
get_all_mods omnimods =
(
- (get_attributes_mods omnimods)
- ++ (get_statistics_mods omnimods)
+ (get_statistics_mods omnimods)
++ (get_attack_mods omnimods)
++ (get_defense_mods omnimods)
)
diff --git a/src/shared/battle/Battle/Struct/Statistics.elm b/src/shared/battle/Battle/Struct/Statistics.elm
index 9847f1c..74eea8d 100644
--- a/src/shared/battle/Battle/Struct/Statistics.elm
+++ b/src/shared/battle/Battle/Struct/Statistics.elm
@@ -10,19 +10,17 @@ module Battle.Struct.Statistics exposing
get_double_hits,
get_critical_hits,
get_damage_modifier,
+ get_damage_multiplier,
decode_category,
encode_category,
mod,
- new_raw,
+ default,
is_percent
)
-- Elm -------------------------------------------------------------------------
import List
--- Battle ----------------------------------------------------------------------
-import Battle.Struct.Attributes
-
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -34,6 +32,7 @@ type Category =
| Accuracy
| DoubleHits
| CriticalHits
+ | DamageModifier
type alias Type =
{
@@ -44,120 +43,71 @@ type alias Type =
accuracy : Int,
double_hits : Int,
critical_hits : Int,
- damage_modifier : Float
+ damage_modifier : Int
}
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-average : (List Int) -> Float
-average l = ((toFloat (List.sum l)) / (toFloat (List.length l)))
-
-float_to_int : Float -> Int
-float_to_int f =
- (ceiling f)
-
-gentle_squared_growth : Int -> Int
-gentle_squared_growth v = (float_to_int (((toFloat v)^1.8)/20.0))
-
-gentle_squared_growth_f : Float -> Int
-gentle_squared_growth_f v = (float_to_int ((v^1.8)/20.0))
-
-sudden_squared_growth : Int -> Int
-sudden_squared_growth v = (float_to_int (((toFloat v)^2.5)/1000.0))
-
-sudden_squared_growth_f : Float -> Int
-sudden_squared_growth_f v = (float_to_int ((v^2.5)/1000.0))
-
-sudden_exp_growth : Int -> Int
-sudden_exp_growth v = (float_to_int (4.0^((toFloat v)/25.0)))
-
-sudden_exp_growth_f : Float -> Int
-sudden_exp_growth_f f = (float_to_int (4.0^(f/25.0)))
-
-damage_base_mod : Float -> Float
-damage_base_mod str = ((((str + 10) * 4)^1.5)/3000.0)
-
-make_movement_points_safe : Int -> Int
-make_movement_points_safe val = (clamp 0 200 val)
-
-make_max_health_safe : Int -> Int
-make_max_health_safe val = (max 1 val)
-
-make_dodges_safe : Int -> Int
-make_dodges_safe val = (clamp 0 100 val)
-
-make_parries_safe : Int -> Int
-make_parries_safe val = (clamp 0 75 val)
-
-make_accuracy_safe : Int -> Int
-make_accuracy_safe val = (clamp 0 100 val)
-
-make_double_hits_safe : Int -> Int
-make_double_hits_safe val = (clamp 0 100 val)
-
-make_critical_hits_safe : Int -> Int
-make_critical_hits_safe val = (clamp 0 100 val)
-
mod_movement_points : Int -> Type -> Type
mod_movement_points v t =
{t |
- movement_points = (make_movement_points_safe (t.movement_points + v))
+ movement_points = (t.movement_points + v)
}
mod_max_health : Int -> Type -> Type
mod_max_health v t =
{t |
- max_health = (make_max_health_safe (t.max_health + v))
+ max_health = (t.max_health + v)
}
mod_dodges : Int -> Type -> Type
-mod_dodges v t = {t | dodges = (make_dodges_safe (t.dodges + v))}
+mod_dodges v t = {t | dodges = (t.dodges + v)}
mod_parries : Int -> Type -> Type
-mod_parries v t = {t | parries = (make_parries_safe (t.parries + v))}
+mod_parries v t = {t | parries = (t.parries + v)}
mod_accuracy : Int -> Type -> Type
-mod_accuracy v t = {t | accuracy = (make_accuracy_safe (t.accuracy + v))}
+mod_accuracy v t = {t | accuracy = (t.accuracy + v)}
mod_double_hits : Int -> Type -> Type
-mod_double_hits v t =
- {t |
- double_hits = (make_double_hits_safe (t.double_hits + v))
- }
+mod_double_hits v t = {t | double_hits = (t.double_hits + v)}
mod_critical_hits : Int -> Type -> Type
-mod_critical_hits v t =
- {t |
- critical_hits = (make_critical_hits_safe (t.critical_hits + v))
- }
+mod_critical_hits v t = {t | critical_hits = (t.critical_hits + v)}
+
+mod_damage_modifier : Int -> Type -> Type
+mod_damage_modifier v t = {t | damage_modifier = (t.damage_modifier + v)}
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_movement_points : Type -> Int
-get_movement_points t = t.movement_points
+get_movement_points t = (max 0 t.movement_points)
get_max_health : Type -> Int
-get_max_health t = t.max_health
+get_max_health t = (max 1 t.max_health)
get_dodges : Type -> Int
-get_dodges t = t.dodges
+get_dodges t = (max 0 t.dodges)
get_parries : Type -> Int
-get_parries t = t.parries
+get_parries t = (max 0 t.parries)
get_accuracy : Type -> Int
-get_accuracy t = t.accuracy
+get_accuracy t = (max 0 t.accuracy)
get_double_hits : Type -> Int
-get_double_hits t = t.double_hits
+get_double_hits t = (max 0 t.double_hits)
get_critical_hits : Type -> Int
-get_critical_hits t = t.critical_hits
+get_critical_hits t = (max 0 t.critical_hits)
-get_damage_modifier : Type -> Float
-get_damage_modifier t = t.damage_modifier
+get_damage_modifier : Type -> Int
+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)
mod : Category -> Int -> Type -> Type
mod cat v t =
@@ -169,36 +119,20 @@ mod cat v t =
Accuracy -> (mod_accuracy v t)
DoubleHits -> (mod_double_hits v t)
CriticalHits -> (mod_critical_hits v t)
+ DamageModifier -> (mod_damage_modifier v t)
-new_raw : (Battle.Struct.Attributes.Type -> Type)
-new_raw att =
- let
- constitution = (Battle.Struct.Attributes.get_effective_constitution att)
- dexterity = (Battle.Struct.Attributes.get_effective_dexterity att)
- intelligence = (Battle.Struct.Attributes.get_effective_intelligence att)
- mind = (Battle.Struct.Attributes.get_effective_mind att)
- speed = (Battle.Struct.Attributes.get_effective_speed att)
- strength = (Battle.Struct.Attributes.get_effective_strength att)
- in
- {
- movement_points =
- (gentle_squared_growth_f
- (average [mind, constitution, constitution, speed, speed, speed])
- ),
- max_health =
- (gentle_squared_growth_f
- (average [constitution, constitution, constitution, mind])
- ),
- dodges = (sudden_exp_growth_f (average [dexterity, mind, speed])),
- parries =
- (sudden_exp_growth_f
- (average [dexterity, intelligence, speed, strength])
- ),
- accuracy = (sudden_squared_growth dexterity),
- double_hits = (sudden_squared_growth_f (average [mind, speed])),
- critical_hits = (sudden_squared_growth intelligence),
- damage_modifier = (damage_base_mod (toFloat strength))
- }
+default : Type
+default =
+ {
+ movement_points = 0,
+ max_health = 1,
+ dodges = 0,
+ parries = 0,
+ accuracy = 0,
+ double_hits = 0,
+ critical_hits = 0,
+ damage_modifier = 0
+ }
decode_category : String -> Category
decode_category str =
@@ -209,6 +143,7 @@ decode_category str =
"pary" -> Parries
"accu" -> Accuracy
"dhit" -> DoubleHits
+ "dmgm" -> DamageModifier
_ -> CriticalHits
encode_category : Category -> String
@@ -221,6 +156,7 @@ encode_category cat =
Accuracy -> "accu"
DoubleHits -> "dhit"
CriticalHits -> "crit"
+ DamageModifier -> "dmgm"
is_percent : Category -> Bool
is_percent cat = ((cat /= MaxHealth) && (cat /= MovementPoints))
diff --git a/src/shared/battle/Battle/View/Attribute.elm b/src/shared/battle/Battle/View/Attribute.elm
deleted file mode 100644
index 091f3c3..0000000
--- a/src/shared/battle/Battle/View/Attribute.elm
+++ /dev/null
@@ -1,179 +0,0 @@
-module Battle.View.Attribute exposing
- (
- get_html,
- get_all_html,
- get_signed_html,
- get_all_signed_html
- )
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-import Html.Events
-
--- Battle ----------------------------------------------------------------------
-import Battle.Struct.Attributes
-
--- Local Module ----------------------------------------------------------------
-import Struct.Event
-import Struct.HelpRequest
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Battle.Struct.Attributes.Category ->
- Int ->
- (Html.Html Struct.Event.Type)
- )
-get_html attribute value =
- (Html.div
- [
- (Html.Events.onClick
- (Struct.Event.RequestedHelp
- (Struct.HelpRequest.Attribute attribute)
- )
- )
- ]
- [
- (Html.div
- [
- (Html.Attributes.class "omnimod-icon"),
- (Html.Attributes.class
- (
- "omnimod-icon-"
- ++ (Battle.Struct.Attributes.encode_category attribute)
- )
- )
- ]
- [
- ]
- ),
- (Html.div
- [
- (Html.Attributes.class "omnimod-value")
- ]
- [
- (Html.text (String.fromInt value))
- ]
- )
- ]
- )
-
-get_signed_html : (
- Battle.Struct.Attributes.Category ->
- Int ->
- (Html.Html Struct.Event.Type)
- )
-get_signed_html attribute value =
- (Html.div
- [
- (
- if (value < 0)
- then (Html.Attributes.class "omnimod-negative")
- else (Html.Attributes.class "omnimod-positive")
- ),
- (Html.Events.onClick
- (Struct.Event.RequestedHelp
- (Struct.HelpRequest.Attribute attribute)
- )
- )
- ]
- [
- (Html.div
- [
- (Html.Attributes.class "omnimod-icon"),
- (Html.Attributes.class
- (
- "omnimod-icon-"
- ++ (Battle.Struct.Attributes.encode_category attribute)
- )
- )
- ]
- [
- ]
- ),
- (Html.div
- [
- (Html.Attributes.class "omnimod-value")
- ]
- [
- (Html.text
- (
- if (value > 0)
- then ("+" ++ (String.fromInt value))
- else (String.fromInt value)
- )
- )
- ]
- )
- ]
- )
-
-get_all_html : (
- Battle.Struct.Attributes.Type ->
- (List (Html.Html Struct.Event.Type))
- )
-get_all_html atts =
- [
- (get_html
- Battle.Struct.Attributes.Constitution
- (Battle.Struct.Attributes.get_constitution atts)
- ),
- (get_html
- Battle.Struct.Attributes.Strength
- (Battle.Struct.Attributes.get_strength atts)
- ),
- (get_html
- Battle.Struct.Attributes.Dexterity
- (Battle.Struct.Attributes.get_dexterity atts)
- ),
- (get_html
- Battle.Struct.Attributes.Speed
- (Battle.Struct.Attributes.get_speed atts)
- ),
- (get_html
- Battle.Struct.Attributes.Intelligence
- (Battle.Struct.Attributes.get_intelligence atts)
- ),
- (get_html
- Battle.Struct.Attributes.Mind
- (Battle.Struct.Attributes.get_mind atts)
- )
- ]
-
-get_all_signed_html : (
- Battle.Struct.Attributes.Type ->
- (List (Html.Html Struct.Event.Type))
- )
-get_all_signed_html atts =
- [
- (get_signed_html
- Battle.Struct.Attributes.Constitution
- (Battle.Struct.Attributes.get_constitution atts)
- ),
- (get_signed_html
- Battle.Struct.Attributes.Strength
- (Battle.Struct.Attributes.get_strength atts)
- ),
- (get_signed_html
- Battle.Struct.Attributes.Dexterity
- (Battle.Struct.Attributes.get_dexterity atts)
- ),
- (get_signed_html
- Battle.Struct.Attributes.Speed
- (Battle.Struct.Attributes.get_speed atts)
- ),
- (get_signed_html
- Battle.Struct.Attributes.Intelligence
- (Battle.Struct.Attributes.get_intelligence atts)
- ),
- (get_signed_html
- Battle.Struct.Attributes.Mind
- (Battle.Struct.Attributes.get_mind atts)
- )
- ]
diff --git a/src/shared/battle/Battle/View/Help/Attribute.elm b/src/shared/battle/Battle/View/Help/Attribute.elm
deleted file mode 100644
index f7bd9e1..0000000
--- a/src/shared/battle/Battle/View/Help/Attribute.elm
+++ /dev/null
@@ -1,62 +0,0 @@
-module Battle.View.Help.Attribute exposing (get_html_contents)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-
--- Battle ----------------------------------------------------------------------
-import Battle.Struct.Attributes
-import Battle.Lang.English
-
--- Local Module ----------------------------------------------------------------
-import Struct.Event
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_header_html : (
- Battle.Struct.Attributes.Category ->
- String ->
- (Html.Html Struct.Event.Type)
- )
-get_header_html cat name =
- (Html.h1
- []
- [
- (Html.div
- [(Html.Attributes.class "help-guide-icon")]
- []
- ),
- (Html.text " "),
- (Html.div
- [
- (Html.Attributes.class "omnimod-icon"),
- (Html.Attributes.class
- (
- "omnimod-icon-"
- ++ (Battle.Struct.Attributes.encode_category cat)
- )
- )
- ]
- [
- ]
- ),
- (Html.text name)
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html_contents : (
- Battle.Struct.Attributes.Category ->
- (List (Html.Html Struct.Event.Type))
- )
-get_html_contents cat =
- let
- (name, tooltip) = (Battle.Lang.English.get_attribute_category_help cat)
- in
- [
- (get_header_html cat name),
- tooltip
- ]
diff --git a/src/shared/battle/Battle/View/Omnimods.elm b/src/shared/battle/Battle/View/Omnimods.elm
index 6a61c4b..a41afba 100644
--- a/src/shared/battle/Battle/View/Omnimods.elm
+++ b/src/shared/battle/Battle/View/Omnimods.elm
@@ -12,12 +12,10 @@ import Html.Attributes
import Html.Events
-- Battle ----------------------------------------------------------------------
-import Battle.Struct.Attributes
import Battle.Struct.DamageType
import Battle.Struct.Omnimods
import Battle.Struct.Statistics
-import Battle.View.Attribute
import Battle.View.DamageType
import Battle.View.Statistic
@@ -72,20 +70,6 @@ get_html_with_modifier attack_multiplier omnimods =
),
(Html.div
[
- (Html.Attributes.class "omnimod-attribute-mods")
- ]
- (List.map
- (\(k, v) ->
- (Battle.View.Attribute.get_signed_html
- (Battle.Struct.Attributes.decode_category k)
- v
- )
- )
- (Battle.Struct.Omnimods.get_attributes_mods omnimods)
- )
- ),
- (Html.div
- [
(Html.Attributes.class "omnimod-statistics-mods")
]
(List.map
@@ -138,20 +122,6 @@ get_html omnimods =
),
(Html.div
[
- (Html.Attributes.class "omnimod-attribute-mods")
- ]
- (List.map
- (\(k, v) ->
- (Battle.View.Attribute.get_signed_html
- (Battle.Struct.Attributes.decode_category k)
- v
- )
- )
- (Battle.Struct.Omnimods.get_attributes_mods omnimods)
- )
- ),
- (Html.div
- [
(Html.Attributes.class "omnimod-statistics-mods")
]
(List.map