summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/battle/Battle/Struct')
-rw-r--r--src/shared/battle/Battle/Struct/DamageType.elm.m4 (renamed from src/shared/battle/Battle/Struct/DamageType.elm)25
-rw-r--r--src/shared/battle/Battle/Struct/Omnimods.elm43
2 files changed, 10 insertions, 58 deletions
diff --git a/src/shared/battle/Battle/Struct/DamageType.elm b/src/shared/battle/Battle/Struct/DamageType.elm.m4
index 59ab19e..8c6601a 100644
--- a/src/shared/battle/Battle/Struct/DamageType.elm
+++ b/src/shared/battle/Battle/Struct/DamageType.elm.m4
@@ -14,11 +14,9 @@ module Battle.Struct.DamageType exposing
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type Type =
- Base
- | Slash
+ Slash
| Blunt
| Pierce
- | None
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -27,29 +25,26 @@ type Type =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
+
+m4_include(__MAKEFILE_DATA_DIR/names.m4.conf)
+
decode : String -> Type
decode str =
case str of
- "bse" -> Base
- "slh" -> Slash
- "pie" -> Pierce
- "blu" -> Blunt
- _ -> None
+ "__SN_SLASH" -> Slash
+ "__SN_PIERCE" -> Pierce
+ _ -> Blunt
encode : Type -> String
encode t =
case t of
- Base -> "bse"
- Slash -> "slh"
- Pierce -> "pie"
- Blunt -> "blu"
- None -> "non"
+ Slash -> "__SN_SLASH"
+ Pierce -> "__SN_PIERCE"
+ Blunt -> "__SN_BLUNT"
to_string : Type -> String
to_string t =
case t of
- Base -> "Base"
Slash -> "Slash"
Pierce -> "Piercing"
Blunt -> "Bludgeoning"
- None -> "ERROR"
diff --git a/src/shared/battle/Battle/Struct/Omnimods.elm b/src/shared/battle/Battle/Struct/Omnimods.elm
index f36efcd..8da3173 100644
--- a/src/shared/battle/Battle/Struct/Omnimods.elm
+++ b/src/shared/battle/Battle/Struct/Omnimods.elm
@@ -6,8 +6,6 @@ module Battle.Struct.Omnimods exposing
merge_attributes,
none,
apply_to_attributes,
- get_attack_damage,
- get_damage_sum,
get_attribute_mods,
get_attribute_mod,
get_attack_mods,
@@ -159,47 +157,6 @@ apply_to_attributes omnimods attributes =
omnimods.attributes
)
-get_damage_sum : Type -> Int
-get_damage_sum omni =
- (Dict.foldl (\t -> \v -> \result -> (result + v)) 0 omni.attack)
-
-get_attack_damage : Float -> Type -> Type -> Int
-get_attack_damage dmg_modifier atk_omni def_omni =
- let
- base_def =
- (
- case
- (Dict.get
- (Battle.Struct.DamageType.encode
- Battle.Struct.DamageType.Base
- )
- def_omni.defense
- )
- of
- (Just v) -> v
- Nothing -> 0
- )
- in
- (Dict.foldl
- (\t -> \v -> \result ->
- let
- actual_atk =
- (max
- 0
- (
- (ceiling ((toFloat v) * dmg_modifier))
- - base_def
- )
- )
- in
- case (Dict.get t def_omni.defense) of
- (Just def_v) -> (result + (max 0 (actual_atk - def_v)))
- Nothing -> (result + actual_atk)
- )
- 0
- atk_omni.attack
- )
-
apply_damage_modifier : Int -> Type -> Type
apply_damage_modifier damage_modifier omnimods =
{omnimods |