summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2019-03-15 18:16:55 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2019-03-15 18:16:55 +0100 |
commit | 6678cfe464ed9ee595f4f3dd7398dec1416454c9 (patch) | |
tree | 2700668874e13a81ec7467dcf26a1d246caa23ff /src/roster-editor | |
parent | 24efb898f526e0aa02a0e15b74436da8ba166cac (diff) |
[Broken] Starting a code refactoring...
Diffstat (limited to 'src/roster-editor')
-rw-r--r-- | src/roster-editor/elm.json | 4 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/Armor.elm | 74 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/Attributes.elm | 173 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/DamageType.elm | 55 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/Omnimods.elm | 214 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/Portrait.elm | 68 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/Statistics.elm | 210 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/UI.elm | 16 | ||||
-rw-r--r-- | src/roster-editor/src/Struct/Weapon.elm | 97 |
9 files changed, 17 insertions, 894 deletions
diff --git a/src/roster-editor/elm.json b/src/roster-editor/elm.json index 929038d..75ba72e 100644 --- a/src/roster-editor/elm.json +++ b/src/roster-editor/elm.json @@ -2,7 +2,9 @@ "type": "application", "source-directories": [ "src", - "../shared/elm" + "../shared/elm", + "../shared/battle", + "../shared/battle-characters" ], "elm-version": "0.19.0", "dependencies": { diff --git a/src/roster-editor/src/Struct/Armor.elm b/src/roster-editor/src/Struct/Armor.elm deleted file mode 100644 index 06689f8..0000000 --- a/src/roster-editor/src/Struct/Armor.elm +++ /dev/null @@ -1,74 +0,0 @@ -module Struct.Armor exposing - ( - Type, - Ref, - new, - get_id, - get_name, - get_image_id, - get_omnimods, - decoder, - default, - none - ) - --- Elm ------------------------------------------------------------------------- -import Json.Decode -import Json.Decode.Pipeline - --- Battle ---------------------------------------------------------------------- -import Struct.Omnimods - --------------------------------------------------------------------------------- --- TYPES ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -type alias Type = - { - id : String, - name : String, - omnimods : Struct.Omnimods.Type - } - -type alias Ref = String - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -new : String -> String -> Struct.Omnimods.Type -> Type -new id name omnimods = - { - id = id, - name = name, - omnimods = omnimods - } - -get_id : Type -> Ref -get_id ar = ar.id - -get_name : Type -> String -get_name ar = ar.name - -get_image_id : Type -> String -get_image_id ar = ar.id - -get_omnimods : Type -> Struct.Omnimods.Type -get_omnimods ar = ar.omnimods - -decoder : (Json.Decode.Decoder Type) -decoder = - (Json.Decode.succeed - Type - |> (Json.Decode.Pipeline.required "id" Json.Decode.string) - |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) - |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder) - ) - -none : Type -none = (new "0" "None" (Struct.Omnimods.none)) - -default : Type -default = (none) diff --git a/src/roster-editor/src/Struct/Attributes.elm b/src/roster-editor/src/Struct/Attributes.elm deleted file mode 100644 index ce871dd..0000000 --- a/src/roster-editor/src/Struct/Attributes.elm +++ /dev/null @@ -1,173 +0,0 @@ -module Struct.Attributes exposing - ( - Type, - Category(..), - get_constitution, - get_dexterity, - get_intelligence, - get_mind, - get_speed, - get_strength, - mod_constitution, - mod_dexterity, - mod_intelligence, - mod_mind, - mod_speed, - mod_strength, - mod, - get, - new, - decode_category, - default - ) - --- Elm ------------------------------------------------------------------------- - --- Battle ---------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- 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 - -mod_constitution : Int -> Type -> Type -mod_constitution i t = - {t | - constitution = (get_within_att_range (i + t.constitution)) - } - -mod_dexterity : Int -> Type -> Type -mod_dexterity i t = - {t | - dexterity = (get_within_att_range (i + t.dexterity)) - } - -mod_intelligence : Int -> Type -> Type -mod_intelligence i t = - {t | - intelligence = (get_within_att_range (i + t.intelligence)) - } - -mod_mind : Int -> Type -> Type -mod_mind i t = - {t | - mind = (get_within_att_range (i + t.mind)) - } - -mod_speed : Int -> Type -> Type -mod_speed i t = - {t | - speed = (get_within_att_range (i + t.speed)) - } - -mod_strength : Int -> Type -> Type -mod_strength i t = - {t | - strength = (get_within_att_range (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 diff --git a/src/roster-editor/src/Struct/DamageType.elm b/src/roster-editor/src/Struct/DamageType.elm deleted file mode 100644 index b7bced7..0000000 --- a/src/roster-editor/src/Struct/DamageType.elm +++ /dev/null @@ -1,55 +0,0 @@ -module Struct.DamageType exposing - ( - Type(..), - encode, - decode, - to_string - ) - --- Elm ------------------------------------------------------------------------- - --- Map ------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- TYPES ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -type Type = - Base - | Slash - | Blunt - | Pierce - | None - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -decode : String -> Type -decode str = - case str of - "bse" -> Base - "slh" -> Slash - "pie" -> Pierce - "blu" -> Blunt - _ -> None - -encode : Type -> String -encode t = - case t of - Base -> "bse" - Slash -> "slh" - Pierce -> "pie" - Blunt -> "blu" - None -> "non" - -to_string : Type -> String -to_string t = - case t of - Base -> "Base" - Slash -> "Slash" - Pierce -> "Piercing" - Blunt -> "Bludgeoning" - None -> "ERROR" diff --git a/src/roster-editor/src/Struct/Omnimods.elm b/src/roster-editor/src/Struct/Omnimods.elm deleted file mode 100644 index 31f5939..0000000 --- a/src/roster-editor/src/Struct/Omnimods.elm +++ /dev/null @@ -1,214 +0,0 @@ -module Struct.Omnimods exposing - ( - Type, - 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, - get_all_mods, - scale, - decoder - ) - --- Elm ------------------------------------------------------------------------- -import Dict - -import Json.Decode -import Json.Decode.Pipeline - --- Map ------------------------------------------------------------------- -import Struct.Attributes -import Struct.Statistics -import Struct.DamageType - --------------------------------------------------------------------------------- --- TYPES ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -type alias Type = - { - attributes : (Dict.Dict String Int), - statistics : (Dict.Dict String Int), - attack : (Dict.Dict String Int), - defense : (Dict.Dict String Int) - } - -type alias GenericMod = - { - t : String, - v : Int - } --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -generic_mods_decoder : (Json.Decode.Decoder (Dict.Dict String Int)) -generic_mods_decoder = - (Json.Decode.map - ((Dict.fromList) >> (Dict.remove "none")) - (Json.Decode.list - (Json.Decode.map - (\gm -> (gm.t, gm.v)) - (Json.Decode.succeed - GenericMod - |> (Json.Decode.Pipeline.required "t" Json.Decode.string) - |> (Json.Decode.Pipeline.required "v" Json.Decode.int) - ) - ) - ) - ) - -merge_mods : ( - (Dict.Dict String Int) -> - (Dict.Dict String Int) -> - (Dict.Dict String Int) - ) -merge_mods a_mods b_mods = - (Dict.merge - (Dict.insert) - (\t -> \v_a -> \v_b -> \r -> (Dict.insert t (v_a + v_b) r)) - (Dict.insert) - a_mods - b_mods - (Dict.empty) - ) - -scale_dict_value : Float -> String -> Int -> Int -scale_dict_value modifier entry_name value = - (ceiling ((toFloat value) * modifier)) --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -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) - ) - -new : ( - (List (String, Int)) -> - (List (String, Int)) -> - (List (String, Int)) -> - (List (String, Int)) -> - Type - ) -new attribute_mods 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) - } - -none : Type -none = - { - attributes = (Dict.empty), - statistics = (Dict.empty), - attack = (Dict.empty), - defense = (Dict.empty) - } - -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 -> Struct.Attributes.Type -> Struct.Attributes.Type -apply_to_attributes omnimods attributes = - (Dict.foldl - ((Struct.Attributes.decode_category) >> (Struct.Attributes.mod)) - attributes - omnimods.attributes - ) - -apply_to_statistics : Type -> Struct.Statistics.Type -> Struct.Statistics.Type -apply_to_statistics omnimods statistics = - (Dict.foldl - ((Struct.Statistics.decode_category) >> (Struct.Statistics.mod)) - statistics - omnimods.statistics - ) - -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 - (Struct.DamageType.encode 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 - ) - -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) - -get_attack_mods : Type -> (List (String, Int)) -get_attack_mods omnimods = (Dict.toList omnimods.attack) - -get_defense_mods : Type -> (List (String, Int)) -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_attack_mods omnimods) - ++ (get_defense_mods omnimods) - ) diff --git a/src/roster-editor/src/Struct/Portrait.elm b/src/roster-editor/src/Struct/Portrait.elm deleted file mode 100644 index bcdf8ae..0000000 --- a/src/roster-editor/src/Struct/Portrait.elm +++ /dev/null @@ -1,68 +0,0 @@ -module Struct.Portrait exposing - ( - Type, - Ref, - default, - get_id, - get_name, - get_body_id, - get_icon_id, - decoder - ) - --- Elm ------------------------------------------------------------------------- -import Json.Decode -import Json.Decode.Pipeline - --- Roster Editor --------------------------------------------------------------- - --------------------------------------------------------------------------------- --- TYPES ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -type alias Type = - { - id : String, - name : String, - body_id : String, - icon_id : String - } - -type alias Ref = String - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -default : Type -default = - { - id = "cat", - name = "Black Cat", - body_id = "mammal", - icon_id = "cat" - } - -get_id : Type -> String -get_id p = p.id - -get_name : Type -> String -get_name p = p.name - -get_body_id : Type -> String -get_body_id p = p.body_id - -get_icon_id : Type -> String -get_icon_id p = p.icon_id - -decoder : (Json.Decode.Decoder Type) -decoder = - (Json.Decode.succeed - Type - |> (Json.Decode.Pipeline.required "id" Json.Decode.string) - |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) - |> (Json.Decode.Pipeline.required "bid" Json.Decode.string) - |> (Json.Decode.Pipeline.required "iid" Json.Decode.string) - ) diff --git a/src/roster-editor/src/Struct/Statistics.elm b/src/roster-editor/src/Struct/Statistics.elm deleted file mode 100644 index f676648..0000000 --- a/src/roster-editor/src/Struct/Statistics.elm +++ /dev/null @@ -1,210 +0,0 @@ -module Struct.Statistics exposing - ( - Type, - Category(..), - get_movement_points, - get_max_health, - get_dodges, - get_parries, - get_accuracy, - get_double_hits, - get_critical_hits, - get_damage_modifier, - decode_category, - mod, - new_raw - ) - --- Elm ------------------------------------------------------------------------- -import List - --- Battle ---------------------------------------------------------------------- -import Struct.Attributes - --------------------------------------------------------------------------------- --- TYPES ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -type Category = - MovementPoints - | MaxHealth - | Dodges - | Parries - | Accuracy - | DoubleHits - | CriticalHits - -type alias Type = - { - movement_points : Int, - max_health : Int, - dodges : Int, - parries : Int, - accuracy : Int, - double_hits : Int, - critical_hits : Int, - damage_modifier : Float - } - --------------------------------------------------------------------------------- --- 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)) - } - -mod_max_health : Int -> Type -> Type -mod_max_health v t = - {t | - max_health = (make_max_health_safe (t.max_health + v)) - } - -mod_dodges : Int -> Type -> Type -mod_dodges v t = {t | dodges = (make_dodges_safe (t.dodges + v))} - -mod_parries : Int -> Type -> Type -mod_parries v t = {t | parries = (make_parries_safe (t.parries + v))} - -mod_accuracy : Int -> Type -> Type -mod_accuracy v t = {t | accuracy = (make_accuracy_safe (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_critical_hits : Int -> Type -> Type -mod_critical_hits v t = - {t | - critical_hits = (make_critical_hits_safe (t.critical_hits + v)) - } - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_movement_points : Type -> Int -get_movement_points t = t.movement_points - -get_max_health : Type -> Int -get_max_health t = t.max_health - -get_dodges : Type -> Int -get_dodges t = t.dodges - -get_parries : Type -> Int -get_parries t = t.parries - -get_accuracy : Type -> Int -get_accuracy t = t.accuracy - -get_double_hits : Type -> Int -get_double_hits t = t.double_hits - -get_critical_hits : Type -> Int -get_critical_hits t = t.critical_hits - -get_damage_modifier : Type -> Float -get_damage_modifier t = t.damage_modifier - -mod : Category -> Int -> Type -> Type -mod cat v t = - case cat of - MaxHealth -> (mod_max_health v t) - MovementPoints -> (mod_movement_points v t) - Dodges -> (mod_dodges v t) - Parries -> (mod_parries v t) - Accuracy -> (mod_accuracy v t) - DoubleHits -> (mod_double_hits v t) - CriticalHits -> (mod_critical_hits v t) - -new_raw : (Struct.Attributes.Type -> Type) -new_raw att = - let - constitution = (Struct.Attributes.get_constitution att) - dexterity = (Struct.Attributes.get_dexterity att) - intelligence = (Struct.Attributes.get_intelligence att) - mind = (Struct.Attributes.get_mind att) - speed = (Struct.Attributes.get_speed att) - strength = (Struct.Attributes.get_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)) - } - -decode_category : String -> Category -decode_category str = - case str of - "mheal" -> MaxHealth - "mpts" -> MovementPoints - "dodg" -> Dodges - "pary" -> Parries - "accu" -> Accuracy - "dhit" -> DoubleHits - _ -> CriticalHits diff --git a/src/roster-editor/src/Struct/UI.elm b/src/roster-editor/src/Struct/UI.elm index 1c2041e..4bda5b5 100644 --- a/src/roster-editor/src/Struct/UI.elm +++ b/src/roster-editor/src/Struct/UI.elm @@ -9,7 +9,10 @@ module Struct.UI exposing reset_displayed_tab, -- Which glyph slot is being edited? set_glyph_slot, - get_glyph_slot + get_glyph_slot, + -- Display Tile Costs + get_display_tile_cost, + toggle_display_tile_cost ) -- Elm ------------------------------------------------------------------------- @@ -32,7 +35,8 @@ type Tab = type alias Type = { displayed_tab : Tab, - glyph_slot : Int + glyph_slot : Int, + display_tile_cost : Bool } -------------------------------------------------------------------------------- @@ -64,3 +68,11 @@ get_glyph_slot ui = ui.glyph_slot set_glyph_slot : Int -> Type -> Type set_glyph_slot tab ui = {ui | glyph_slot = tab} + +-- Tile Cost ------------------------------------------------------------------- +toggle_display_tile_cost : Type -> Type +toggle_display_tile_cost ui = + {ui | display_tile_cost = (not ui.display_tile_cost)} + +get_display_tile_cost : Type -> Bool +get_display_tile_cost ui = ui.display_tile_cost diff --git a/src/roster-editor/src/Struct/Weapon.elm b/src/roster-editor/src/Struct/Weapon.elm deleted file mode 100644 index 0ab0ec7..0000000 --- a/src/roster-editor/src/Struct/Weapon.elm +++ /dev/null @@ -1,97 +0,0 @@ -module Struct.Weapon exposing - ( - Type, - Ref, - get_id, - get_name, - get_is_primary, - get_attack_range, - get_defense_range, - get_omnimods, - get_damage_sum, - decoder, - default, - none - ) - --- Elm ------------------------------------------------------------------------- -import Json.Decode -import Json.Decode.Pipeline - --- Map ------------------------------------------------------------------- -import Struct.Omnimods - --------------------------------------------------------------------------------- --- TYPES ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -type alias Type = - { - id : String, - name : String, - is_primary : Bool, - def_range : Int, - atk_range : Int, - omnimods : Struct.Omnimods.Type, - damage_sum : Int - } - -type alias Ref = String - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_id : Type -> String -get_id wp = wp.id - -get_name : Type -> String -get_name wp = wp.name - -get_is_primary : Type -> Bool -get_is_primary wp = wp.is_primary - -get_attack_range : Type -> Int -get_attack_range wp = wp.atk_range - -get_defense_range : Type -> Int -get_defense_range wp = wp.def_range - -get_omnimods : Type -> 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 = (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" Struct.Omnimods.decoder) - |> (Json.Decode.Pipeline.hardcoded 0) - ) - ) - -none : Type -none = - { - id = "", - name = "None", - is_primary = False, - def_range = 0, - atk_range = 0, - omnimods = (Struct.Omnimods.none), - damage_sum = 0 - } - -default : Type -default = (none) |