| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2019-09-16 17:54:29 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2019-09-16 17:54:29 +0200 | 
| commit | 511cf3d3d11d8bbe6a11f439cc1786bed19b059d (patch) | |
| tree | ae96e650823e4cd49a62ae35e555dddf689e0304 /src/shared | |
| parent | 7bd57ea12ba9dde0b88b2476a91737fd4d3de840 (diff) | |
Dmg type from T-Data, no more atk sum.
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm | 32 | ||||
| -rw-r--r-- | src/shared/battle/Battle/Lang/English.elm | 5 | ||||
| -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.elm | 43 | 
4 files changed, 20 insertions, 85 deletions
| diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm b/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm index cea3b0f..f50409d 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm @@ -9,7 +9,6 @@ module BattleCharacters.Struct.Weapon exposing        get_attack_range,        get_defense_range,        get_omnimods, -      get_damage_sum,        decoder,        default,        none @@ -34,8 +33,7 @@ type alias Type =        is_primary : Bool,        def_range : Int,        atk_range : Int, -      omnimods : Battle.Struct.Omnimods.Type, -      damage_sum : Int +      omnimods : Battle.Struct.Omnimods.Type     }  type alias Ref = String @@ -71,25 +69,16 @@ get_defense_range wp = wp.def_range  get_omnimods : Type -> Battle.Struct.Omnimods.Type  get_omnimods wp = wp.omnimods -get_damage_sum : Type -> Int -get_damage_sum wp = wp.damage_sum -  decoder : (Json.Decode.Decoder Type)  decoder = -   (Json.Decode.map -      (\e -> -         {e | damage_sum = (Battle.Struct.Omnimods.get_damage_sum e.omnimods)} -      ) -      (Json.Decode.succeed -         Type -         |> (Json.Decode.Pipeline.required "id" Json.Decode.string) -         |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) -         |> (Json.Decode.Pipeline.required "pri" Json.Decode.bool) -         |> (Json.Decode.Pipeline.required "rmi" Json.Decode.int) -         |> (Json.Decode.Pipeline.required "rma" Json.Decode.int) -         |> (Json.Decode.Pipeline.required "omni" Battle.Struct.Omnimods.decoder) -         |> (Json.Decode.Pipeline.hardcoded 0) -      ) +   (Json.Decode.succeed +      Type +      |> (Json.Decode.Pipeline.required "id" Json.Decode.string) +      |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) +      |> (Json.Decode.Pipeline.required "pri" Json.Decode.bool) +      |> (Json.Decode.Pipeline.required "rmi" Json.Decode.int) +      |> (Json.Decode.Pipeline.required "rma" Json.Decode.int) +      |> (Json.Decode.Pipeline.required "omni" Battle.Struct.Omnimods.decoder)     )  none : Type @@ -100,8 +89,7 @@ none =        is_primary = False,        def_range = 0,        atk_range = 0, -      omnimods = (Battle.Struct.Omnimods.none), -      damage_sum = 0 +      omnimods = (Battle.Struct.Omnimods.none)     }  default : Type diff --git a/src/shared/battle/Battle/Lang/English.elm b/src/shared/battle/Battle/Lang/English.elm index d8b0254..228fb73 100644 --- a/src/shared/battle/Battle/Lang/English.elm +++ b/src/shared/battle/Battle/Lang/English.elm @@ -315,9 +315,6 @@ get_damage_type_help : (     )  get_damage_type_help cat =     case cat of -      Battle.Struct.DamageType.Base -> -         ((base), (base_help)) -        Battle.Struct.DamageType.Slash ->           ((slash), (slash_help)) @@ -326,5 +323,3 @@ get_damage_type_help cat =        Battle.Struct.DamageType.Pierce ->           ((pierce), (pierce_help)) - -      _ -> ("None Damage", (Html.div [] [(Html.text "Should not appear.")])) 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 | | 


