summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-09-11 17:07:23 +0200
committernsensfel <SpamShield0@noot-noot.org>2019-09-11 17:07:23 +0200
commit6a294ff0ed9c69be2c49aa18a1589ef0a4be83f6 (patch)
tree604bf0da5f07756a37e9aee63c4313ddddb4e532 /src/shared/battle/Battle/Struct/Omnimods.elm
parent75dfc9fcc6c119bbea63414fad8d754a1ea513a9 (diff)
...
Diffstat (limited to 'src/shared/battle/Battle/Struct/Omnimods.elm')
-rw-r--r--src/shared/battle/Battle/Struct/Omnimods.elm18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/shared/battle/Battle/Struct/Omnimods.elm b/src/shared/battle/Battle/Struct/Omnimods.elm
index 7a61153..2b3c011 100644
--- a/src/shared/battle/Battle/Struct/Omnimods.elm
+++ b/src/shared/battle/Battle/Struct/Omnimods.elm
@@ -8,9 +8,11 @@ module Battle.Struct.Omnimods exposing
get_attack_damage,
get_damage_sum,
get_attribute_mods,
+ get_attribute_mod,
get_attack_mods,
get_defense_mods,
get_all_mods,
+ apply_damage_modifier,
scale,
decoder
)
@@ -174,6 +176,16 @@ get_attack_damage dmg_modifier atk_omni def_omni =
atk_omni.attack
)
+apply_damage_modifier : Int -> Type -> Type
+apply_damage_modifier damage_modifier omnimods =
+ {omnimods |
+ attack =
+ (Dict.map
+ (scale_dict_value ((toFloat damage_modifier) / 100.0))
+ omnimods.attack
+ )
+ }
+
scale : Float -> Type -> Type
scale multiplier omnimods =
{omnimods |
@@ -183,6 +195,12 @@ scale multiplier omnimods =
(Dict.map (scale_dict_value multiplier) omnimods.defense)
}
+get_attribute_mod : String -> Type -> Int
+get_attribute_mod att_name omnimods =
+ case (Dict.get att_name omnimods.attributes) of
+ (Just e) -> e
+ Nothing -> 0
+
get_attribute_mods : Type -> (List (String, Int))
get_attribute_mods omnimods = (Dict.toList omnimods.attributes)