summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared/battle-characters/BattleCharacters')
6 files changed, 49 insertions, 0 deletions
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Armor.elm b/src/shared/battle-characters/BattleCharacters/Struct/Armor.elm index 5cb99d6..93f768c 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/Armor.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/Armor.elm @@ -3,6 +3,7 @@ module BattleCharacters.Struct.Armor exposing Type, Ref, new, + find, get_id, get_name, get_image_id, @@ -13,6 +14,8 @@ module BattleCharacters.Struct.Armor exposing ) -- Elm ------------------------------------------------------------------------- +import Dict + import Json.Decode import Json.Decode.Pipeline @@ -38,6 +41,12 @@ type alias Ref = String -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- +find : (Dict.Dict Ref Type) -> Ref -> Type +find dict ref = + case (Dict.get ref dict) of + (Just e) -> e + Nothing -> none + new : String -> String -> Battle.Struct.Omnimods.Type -> Type new id name omnimods = { diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm index e3ba148..39c7d26 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm @@ -14,6 +14,7 @@ module BattleCharacters.Struct.Character exposing get_statistics, get_active_weapon, get_inactive_weapon, + is_using_secondary, switch_weapons, dirty_switch_weapons, decoder, @@ -148,6 +149,9 @@ get_attributes char = char.attributes get_statistics : Type -> Battle.Struct.Statistics.Type get_statistics char = char.statistics +is_using_secondary : Type -> Bool +is_using_secondary char = char.is_using_secondary + switch_weapons : Type -> Type switch_weapons char = (refresh_omnimods diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm b/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm index 4cadc6b..9a86fb4 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm @@ -2,6 +2,7 @@ module BattleCharacters.Struct.Glyph exposing ( Type, Ref, + find, get_name, get_id, get_omnimods, @@ -11,6 +12,8 @@ module BattleCharacters.Struct.Glyph exposing ) -- Elm ------------------------------------------------------------------------- +import Dict + import Json.Decode import Json.Decode.Pipeline @@ -36,6 +39,12 @@ type alias Ref = String -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- +find : (Dict.Dict Ref Type) -> Ref -> Type +find dict ref = + case (Dict.get ref dict) of + (Just e) -> e + Nothing -> none + get_id : Type -> Ref get_id g = g.id diff --git a/src/shared/battle-characters/BattleCharacters/Struct/GlyphBoard.elm b/src/shared/battle-characters/BattleCharacters/Struct/GlyphBoard.elm index 7d08ec0..e8fa0f6 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/GlyphBoard.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/GlyphBoard.elm @@ -2,6 +2,7 @@ module BattleCharacters.Struct.GlyphBoard exposing ( Type, Ref, + find, get_name, get_id, get_slots, @@ -15,6 +16,8 @@ module BattleCharacters.Struct.GlyphBoard exposing -- Elm ------------------------------------------------------------------------- import Array +import Dict + import List import Json.Decode @@ -46,6 +49,12 @@ type alias Ref = String -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- +find : (Dict.Dict Ref Type) -> Ref -> Type +find dict ref = + case (Dict.get ref dict) of + (Just e) -> e + Nothing -> none + get_id : Type -> String get_id g = g.id diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm b/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm index 35f5260..8fe92c0 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm @@ -2,6 +2,7 @@ module BattleCharacters.Struct.Portrait exposing ( Type, Ref, + find, default, get_id, get_name, @@ -11,6 +12,8 @@ module BattleCharacters.Struct.Portrait exposing ) -- Elm ------------------------------------------------------------------------- +import Dict + import Json.Decode import Json.Decode.Pipeline @@ -34,6 +37,12 @@ type alias Ref = String -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- +find : (Dict.Dict Ref Type) -> Ref -> Type +find dict ref = + case (Dict.get ref dict) of + (Just e) -> e + Nothing -> default + default : Type default = { diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm b/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm index 0aff932..cea3b0f 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm @@ -2,6 +2,7 @@ module BattleCharacters.Struct.Weapon exposing ( Type, Ref, + find, get_id, get_name, get_is_primary, @@ -15,6 +16,8 @@ module BattleCharacters.Struct.Weapon exposing ) -- Elm ------------------------------------------------------------------------- +import Dict + import Json.Decode import Json.Decode.Pipeline @@ -44,6 +47,12 @@ type alias Ref = String -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- +find : (Dict.Dict Ref Type) -> Ref -> Type +find dict ref = + case (Dict.get ref dict) of + (Just e) -> e + Nothing -> none + get_id : Type -> String get_id wp = wp.id |