summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-11-19 18:07:19 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-11-19 18:07:19 +0100
commit6375ecebd314a070b0514e70fd31dc9e3002dfe5 (patch)
tree671954fcc8a4f20d173d7d21afc862e1823152be
parent587c59f6a34eb9392ce24c062a501d371ed9c791 (diff)
...
-rw-r--r--src/battle/src/Struct/Model.elm24
-rw-r--r--src/roster-editor/src/Struct/Model.elm108
-rw-r--r--src/roster-editor/src/Update/HandleServerReply.elm32
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Equipment.elm32
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Inventory.elm266
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Skill.elm123
6 files changed, 440 insertions, 145 deletions
diff --git a/src/battle/src/Struct/Model.elm b/src/battle/src/Struct/Model.elm
index c4fe728..314a7a5 100644
--- a/src/battle/src/Struct/Model.elm
+++ b/src/battle/src/Struct/Model.elm
@@ -10,6 +10,7 @@ module Struct.Model exposing
add_portrait,
add_glyph_board,
add_glyph,
+ add_skill,
add_player,
add_tile,
invalidate,
@@ -36,11 +37,12 @@ import Struct.Flags
import Battle.Struct.Omnimods
-- Battle Characters -----------------------------------------------------------
-import BattleCharacters.Struct.Character
import BattleCharacters.Struct.Armor
-import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Character
import BattleCharacters.Struct.Glyph
import BattleCharacters.Struct.GlyphBoard
+import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Skill
import BattleCharacters.Struct.Weapon
-- Battle Map ------------------------------------------------------------------
@@ -97,6 +99,11 @@ type alias Type =
BattleCharacters.Struct.Glyph.Ref
BattleCharacters.Struct.Glyph.Type
),
+ skills :
+ (Dict.Dict
+ BattleCharacters.Struct.Skill.Ref
+ BattleCharacters.Struct.Skill.Type
+ ),
tiles : (Dict.Dict BattleMap.Struct.Tile.Ref BattleMap.Struct.Tile.Type),
error : (Maybe Struct.Error.Type),
player_id : String,
@@ -184,6 +191,7 @@ new flags =
portraits = (Dict.empty),
glyph_boards = (Dict.empty),
glyphs = (Dict.empty),
+ skills = (Dict.empty),
tiles = (Dict.empty),
players = (Array.empty),
error = Nothing,
@@ -277,6 +285,17 @@ add_glyph pt model =
)
}
+add_skill : BattleCharacters.Struct.Skill.Type -> Type -> Type
+add_skill sk model =
+ {model |
+ skills =
+ (Dict.insert
+ (BattleCharacters.Struct.Skill.get_id sk)
+ sk
+ model.skills
+ )
+ }
+
add_player : Struct.Player.Type -> Type -> Type
add_player pl model =
{model |
@@ -326,6 +345,7 @@ full_debug_reset model =
portraits = (Dict.empty),
glyph_boards = (Dict.empty),
glyphs = (Dict.empty),
+ skills = (Dict.empty),
tiles = (Dict.empty),
error = Nothing,
ui = (Struct.UI.default),
diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm
index 879e185..3e573f9 100644
--- a/src/roster-editor/src/Struct/Model.elm
+++ b/src/roster-editor/src/Struct/Model.elm
@@ -7,11 +7,6 @@ module Struct.Model exposing
update_character,
update_character_fun,
save_character,
- add_weapon,
- add_armor,
- add_portrait,
- add_glyph,
- add_glyph_board,
invalidate,
clear_error
)
@@ -52,31 +47,7 @@ type alias Type =
help_request : Struct.HelpRequest.Type,
characters : (Array.Array Struct.Character.Type),
unresolved_characters : (List Struct.Character.Unresolved),
- weapons :
- (Dict.Dict
- BattleCharacters.Struct.Weapon.Ref
- BattleCharacters.Struct.Weapon.Type
- ),
- armors :
- (Dict.Dict
- BattleCharacters.Struct.Armor.Ref
- BattleCharacters.Struct.Armor.Type
- ),
- glyphs :
- (Dict.Dict
- BattleCharacters.Struct.Glyph.Ref
- BattleCharacters.Struct.Glyph.Type
- ),
- glyph_boards :
- (Dict.Dict
- BattleCharacters.Struct.GlyphBoard.Ref
- BattleCharacters.Struct.GlyphBoard.Type
- ),
- portraits :
- (Dict.Dict
- BattleCharacters.Struct.Portrait.Ref
- BattleCharacters.Struct.Portrait.Type
- ),
+ inventory : BattleCharacters.Struct.Inventory.Type,
error : (Maybe Struct.Error.Type),
battle_order : (Array.Array Int),
player_id : String,
@@ -95,13 +66,7 @@ add_character_from_unresolved char_ref model =
let
char =
(Struct.Character.resolve
- (BattleCharacters.Struct.Equipment.resolve
- (BattleCharacters.Struct.Weapon.find model.weapons)
- (BattleCharacters.Struct.Armor.find model.armors)
- (BattleCharacters.Struct.Portrait.find model.portraits)
- (BattleCharacters.Struct.GlyphBoard.find model.glyph_boards)
- (BattleCharacters.Struct.Glyph.find model.glyphs)
- )
+ (BattleCharacters.Struct.Equipment.resolve model.inventory)
char_ref
)
in
@@ -118,14 +83,7 @@ has_loaded_data : Type -> Bool
has_loaded_data model =
(
((Array.length model.characters) > 0)
- ||
- (
- (model.portraits /= (Dict.empty))
- && (model.weapons /= (Dict.empty))
- && (model.armors /= (Dict.empty))
- && (model.glyph_boards /= (Dict.empty))
- && (model.glyphs /= (Dict.empty))
- )
+ || (BattleCharacters.Struct.Inventory.is_ready model.inventory)
)
--------------------------------------------------------------------------------
@@ -138,11 +96,7 @@ new flags =
help_request = Struct.HelpRequest.None,
characters = (Array.empty),
unresolved_characters = [],
- weapons = (Dict.empty),
- armors = (Dict.empty),
- glyphs = (Dict.empty),
- glyph_boards = (Dict.empty),
- portraits = (Dict.empty),
+ inventory = (BattleCharacters.Struct.Inventory.new),
error = Nothing,
roster_id = "",
player_id =
@@ -191,60 +145,6 @@ resolve_all_characters model =
else
model
-add_weapon : BattleCharacters.Struct.Weapon.Type -> Type -> Type
-add_weapon wp model =
- {model |
- weapons =
- (Dict.insert
- (BattleCharacters.Struct.Weapon.get_id wp)
- wp
- model.weapons
- )
- }
-
-add_armor : BattleCharacters.Struct.Armor.Type -> Type -> Type
-add_armor ar model =
- {model |
- armors =
- (Dict.insert
- (BattleCharacters.Struct.Armor.get_id ar)
- ar
- model.armors
- )
- }
-
-add_portrait : BattleCharacters.Struct.Portrait.Type -> Type -> Type
-add_portrait pt model =
- {model |
- portraits =
- (Dict.insert
- (BattleCharacters.Struct.Portrait.get_id pt)
- pt
- model.portraits
- )
- }
-
-add_glyph : BattleCharacters.Struct.Glyph.Type -> Type -> Type
-add_glyph gl model =
- {model |
- glyphs =
- (Dict.insert
- (BattleCharacters.Struct.Glyph.get_id gl)
- gl
- model.glyphs
- )
- }
-
-add_glyph_board : BattleCharacters.Struct.GlyphBoard.Type -> Type -> Type
-add_glyph_board glb model =
- {model |
- glyph_boards =
- (Dict.insert
- (BattleCharacters.Struct.GlyphBoard.get_id glb)
- glb
- model.glyph_boards
- )
- }
update_character : Int -> Struct.Character.Type -> Type -> Type
update_character ix new_val model =
diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm
index 5f1bc52..617b72a 100644
--- a/src/roster-editor/src/Update/HandleServerReply.elm
+++ b/src/roster-editor/src/Update/HandleServerReply.elm
@@ -38,38 +38,6 @@ import Struct.ServerReply
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-weapon_getter : (
- Struct.Model.Type ->
- BattleCharacters.Struct.Weapon.Ref ->
- BattleCharacters.Struct.Weapon.Type
- )
-weapon_getter model ref =
- case (Dict.get ref model.weapons) of
- (Just w) -> w
- Nothing -> BattleCharacters.Struct.Weapon.none
-
-armor_getter : (
- Struct.Model.Type ->
- BattleCharacters.Struct.Armor.Ref ->
- BattleCharacters.Struct.Armor.Type
- )
-armor_getter model ref =
- case (Dict.get ref model.armors) of
- (Just w) -> w
- Nothing -> BattleCharacters.Struct.Armor.none
-
-portrait_getter : (
- Struct.Model.Type ->
- BattleCharacters.Struct.Portrait.Ref ->
- BattleCharacters.Struct.Portrait.Type
- )
-portrait_getter model ref =
- case (Dict.get ref model.portraits) of
- (Just w) -> w
- Nothing -> BattleCharacters.Struct.Portrait.default
-
------------
-
disconnected : (
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Equipment.elm b/src/shared/battle-characters/BattleCharacters/Struct/Equipment.elm
index 4d0b1fb..0722a96 100644
--- a/src/shared/battle-characters/BattleCharacters/Struct/Equipment.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Equipment.elm
@@ -8,6 +8,7 @@ module BattleCharacters.Struct.Equipment exposing
get_portrait,
get_glyph_board,
get_glyphs,
+ get_skill,
set_primary_weapon,
set_secondary_weapon,
set_armor,
@@ -15,6 +16,7 @@ module BattleCharacters.Struct.Equipment exposing
set_glyph_board,
set_glyphs,
set_glyph,
+ set_skill,
decoder,
encode,
resolve,
@@ -32,11 +34,12 @@ import Json.Decode.Pipeline
import Json.Encode
-- Battle ----------------------------------------------------------------------
-import BattleCharacters.Struct.Weapon
import BattleCharacters.Struct.Armor
-import BattleCharacters.Struct.Portrait
import BattleCharacters.Struct.Glyph
import BattleCharacters.Struct.GlyphBoard
+import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Skill
+import BattleCharacters.Struct.Weapon
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -48,7 +51,8 @@ type alias Type =
armor : BattleCharacters.Struct.Armor.Type,
portrait : BattleCharacters.Struct.Portrait.Type,
glyph_board : BattleCharacters.Struct.GlyphBoard.Type,
- glyphs : (Array.Array BattleCharacters.Struct.Glyph.Type)
+ glyphs : (Array.Array BattleCharacters.Struct.Glyph.Type),
+ skill : BattleCharacters.Struct.Skill.Type
}
type alias Unresolved =
@@ -58,7 +62,8 @@ type alias Unresolved =
armor : BattleCharacters.Struct.Armor.Ref,
portrait : BattleCharacters.Struct.Portrait.Ref,
glyph_board : BattleCharacters.Struct.GlyphBoard.Ref,
- glyphs : (Array.Array BattleCharacters.Struct.Glyph.Ref)
+ glyphs : (Array.Array BattleCharacters.Struct.Glyph.Ref),
+ skill : BattleCharacters.Struct.Skill.Ref
}
--------------------------------------------------------------------------------
@@ -86,6 +91,9 @@ get_glyph_board equipment = equipment.glyph_board
get_glyphs : Type -> (Array.Array BattleCharacters.Struct.Glyph.Type)
get_glyphs equipment = equipment.glyphs
+get_skill : Type -> BattleCharacters.Struct.Skill.Type
+get_skill equipment = equipment.skill
+
set_primary_weapon : BattleCharacters.Struct.Weapon.Type -> Type -> Type
set_primary_weapon wp equipment = { equipment | primary = wp }
@@ -116,6 +124,9 @@ set_glyph : Int -> BattleCharacters.Struct.Glyph.Type -> Type -> Type
set_glyph index glyph equipment =
{ equipment | glyphs = (Array.set index glyph equipment.glyphs) }
+set_skill : BattleCharacters.Struct.Skill.Type -> Type -> Type
+set_skill sk equipment = { equipment | skill = sk }
+
decoder : (Json.Decode.Decoder Unresolved)
decoder =
(Json.Decode.succeed
@@ -130,6 +141,7 @@ decoder =
"gl"
(Json.Decode.array (Json.Decode.string))
)
+ |> (Json.Decode.Pipeline.required "sk" Json.Decode.string)
)
encode : Unresolved -> Json.Encode.Value
@@ -166,17 +178,22 @@ resolve : (
BattleCharacters.Struct.Glyph.Ref ->
BattleCharacters.Struct.Glyph.Type
) ->
+ (
+ BattleCharacters.Struct.Skill.Ref ->
+ BattleCharacters.Struct.Skill.Type
+ ) ->
Unresolved ->
Type
)
-resolve resolve_wp resolve_ar resolve_pt resolve_gb resolve_gl ref =
+resolve resolve_wp resolve_ar resolve_pt resolve_gb resolve_gl resolve_sk ref =
{
primary = (resolve_wp ref.primary),
secondary = (resolve_wp ref.secondary),
armor = (resolve_ar ref.armor),
portrait = (resolve_pt ref.portrait),
glyph_board = (resolve_gb ref.glyph_board),
- glyphs = (Array.map (resolve_gl) ref.glyphs)
+ glyphs = (Array.map (resolve_gl) ref.glyphs),
+ skill = (resolve_sk ref.skill)
}
to_unresolved : Type -> Unresolved
@@ -189,6 +206,7 @@ to_unresolved equipment =
glyph_board =
(BattleCharacters.Struct.GlyphBoard.get_id equipment.glyph_board),
glyphs =
- (Array.map (BattleCharacters.Struct.Glyph.get_id) equipment.glyphs)
+ (Array.map (BattleCharacters.Struct.Glyph.get_id) equipment.glyphs),
+ skill = (BattleCharacters.Struct.Skill.get_id equipment.skill)
}
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Inventory.elm b/src/shared/battle-characters/BattleCharacters/Struct/Inventory.elm
new file mode 100644
index 0000000..9e1347e
--- /dev/null
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Inventory.elm
@@ -0,0 +1,266 @@
+module BattleCharacters.Struct.Inventory exposing
+ (
+ Type,
+ new,
+ is_ready,
+ get_weapon,
+ add_weapon,
+ get_armor,
+ add_armor,
+ get_portrait,
+ add_portrait,
+ get_glyph,
+ add_glyph,
+ get_glyph_board,
+ add_glyph_board,
+ get_skill,
+ add_skill
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+-- Battle ----------------------------------------------------------------------
+import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Glyph
+import BattleCharacters.Struct.GlyphBoard
+import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Skill
+import BattleCharacters.Struct.Weapon
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type alias Type =
+ {
+ weapons :
+ (Dict.Dict
+ BattleCharacters.Struct.Weapon.Ref
+ BattleCharacters.Struct.Weapon.Type
+ ),
+ armors :
+ (Dict.Dict
+ BattleCharacters.Struct.Armor.Ref
+ BattleCharacters.Struct.Armor.Type
+ ),
+ glyphs :
+ (Dict.Dict
+ BattleCharacters.Struct.Glyph.Ref
+ BattleCharacters.Struct.Glyph.Type
+ ),
+ glyph_boards :
+ (Dict.Dict
+ BattleCharacters.Struct.GlyphBoard.Ref
+ BattleCharacters.Struct.GlyphBoard.Type
+ ),
+ portraits :
+ (Dict.Dict
+ BattleCharacters.Struct.Portrait.Ref
+ BattleCharacters.Struct.Portrait.Type
+ ),
+ skills :
+ (Dict.Dict
+ BattleCharacters.Struct.Skill.Ref
+ BattleCharacters.Struct.Skill.Type
+ )
+ }
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+new : Type
+new =
+ {
+ weapons :
+ (Dict.Dict
+ BattleCharacters.Struct.Weapon.Ref
+ BattleCharacters.Struct.Weapon.Type
+ ),
+ armors :
+ (Dict.Dict
+ BattleCharacters.Struct.Armor.Ref
+ BattleCharacters.Struct.Armor.Type
+ ),
+ glyphs :
+ (Dict.Dict
+ BattleCharacters.Struct.Glyph.Ref
+ BattleCharacters.Struct.Glyph.Type
+ ),
+ glyph_boards :
+ (Dict.Dict
+ BattleCharacters.Struct.GlyphBoard.Ref
+ BattleCharacters.Struct.GlyphBoard.Type
+ ),
+ portraits :
+ (Dict.Dict
+ BattleCharacters.Struct.Portrait.Ref
+ BattleCharacters.Struct.Portrait.Type
+ ),
+ skills :
+ (Dict.Dict
+ BattleCharacters.Struct.Portrait.Ref
+ BattleCharacters.Struct.Portrait.Type
+ ),
+ }
+
+is_ready : Type -> Bool
+is_ready inventory =
+ (
+ (inventory.portraits /= (Dict.empty))
+ && (inventory.weapons /= (Dict.empty))
+ && (inventory.armors /= (Dict.empty))
+ && (inventory.glyph_boards /= (Dict.empty))
+ && (inventory.glyphs /= (Dict.empty))
+ && (inventory.skills /= (Dict.empty))
+ )
+
+---- Accessors -----------------------------------------------------------------
+
+----------------
+---- Weapon ----
+----------------
+get_weapon : (
+ BattleCharacters.Struct.Weapon.Ref ->
+ Type ->
+ BattleCharacters.Struct.Weapon.Type
+ )
+get_weapon wp_id inventory =
+ case (Dict.get wp_id inventory.weapons) of
+ (Just wp) -> wp
+ Nothing -> BattleCharacters.Struct.Weapon.none
+
+add_weapon : BattleCharacters.Struct.Weapon.Type -> Type -> Type
+add_weapon wp inventory =
+ {inventory |
+ weapons =
+ (Dict.insert
+ (BattleCharacters.Struct.Weapon.get_id wp)
+ wp
+ inventory.weapons
+ )
+ }
+
+---------------
+---- Armor ----
+---------------
+get_armor : (
+ BattleCharacters.Struct.Armor.Ref ->
+ Type ->
+ BattleCharacters.Struct.Armor.Type
+ )
+get_armor ar_id inventory =
+ case (Dict.get ar_id inventory.armors) of
+ (Just ar) -> ar
+ Nothing -> BattleCharacters.Struct.Armor.none
+
+add_armor : BattleCharacters.Struct.Armor.Type -> Type -> Type
+add_armor ar inventory =
+ {inventory |
+ armors =
+ (Dict.insert
+ (BattleCharacters.Struct.Armor.get_id ar)
+ ar
+ inventory.armors
+ )
+ }
+
+------------------
+---- Portrait ----
+------------------
+get_portrait : (
+ BattleCharacters.Struct.Portrait.Ref ->
+ Type ->
+ BattleCharacters.Struct.Portrait.Type
+ )
+get_portrait pt_id inventory =
+ case (Dict.get pt_id inventory.portraits) of
+ (Just pt) -> pt
+ Nothing -> BattleCharacters.Struct.Portrait.none
+
+add_portrait : BattleCharacters.Struct.Portrait.Type -> Type -> Type
+add_portrait pt inventory =
+ {inventory |
+ portraits =
+ (Dict.insert
+ (BattleCharacters.Struct.Portrait.get_id pt)
+ pt
+ inventory.portraits
+ )
+ }
+
+---------------
+---- Glyph ----
+---------------
+get_glyph : (
+ BattleCharacters.Struct.Glyph.Ref ->
+ Type ->
+ BattleCharacters.Struct.Glyph.Type
+ )
+get_glyph gl_id inventory =
+ case (Dict.get gl_id inventory.glyphs) of
+ (Just gl) -> gl
+ Nothing -> BattleCharacters.Struct.Glyph.none
+
+add_glyph : BattleCharacters.Struct.Glyph.Type -> Type -> Type
+add_glyph gl inventory =
+ {inventory |
+ glyphs =
+ (Dict.insert
+ (BattleCharacters.Struct.Glyph.get_id gl)
+ gl
+ inventory.glyphs
+ )
+ }
+
+---------------------
+---- Glyph Board ----
+---------------------
+get_glyph_board : (
+ BattleCharacters.Struct.GlyphBoard.Ref ->
+ Type ->
+ BattleCharacters.Struct.GlyphBoard.Type
+ )
+get_glyph_board gb_id inventory =
+ case (Dict.get gb_id inventory.glyph_boards) of
+ (Just gb) -> gb
+ Nothing -> BattleCharacters.Struct.GlyphBoard.none
+
+add_glyph_board : BattleCharacters.Struct.GlyphBoard.Type -> Type -> Type
+add_glyph_board glb inventory =
+ {inventory |
+ glyph_boards =
+ (Dict.insert
+ (BattleCharacters.Struct.GlyphBoard.get_id glb)
+ glb
+ inventory.glyph_boards
+ )
+ }
+
+---------------
+---- Skill ----
+---------------
+get_skill : (
+ BattleCharacters.Struct.Skill.Ref ->
+ Type ->
+ BattleCharacters.Struct.Skill.Type
+ )
+get_skill sk_id inventory =
+ case (Dict.get sk_id inventory.skills) of
+ (Just sk) -> sk
+ Nothing -> BattleCharacters.Struct.Skill.none
+
+add_skill : BattleCharacters.Struct.Skill.Type -> Type -> Type
+add_skill sk inventory =
+ {inventory |
+ skills =
+ (Dict.insert
+ (BattleCharacters.Struct.Skill.get_id sk)
+ sk
+ inventory.skills
+ )
+ }
+
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Skill.elm b/src/shared/battle-characters/BattleCharacters/Struct/Skill.elm
new file mode 100644
index 0000000..709c17f
--- /dev/null
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Skill.elm
@@ -0,0 +1,123 @@
+module BattleCharacters.Struct.Skill exposing
+ (
+ Type,
+ Ref,
+ find,
+ default,
+ get_id,
+ get_name,
+ get_cost,
+ get_reserve,
+ get_locations,
+ get_duration,
+ get_uses,
+ get_chance,
+ get_power,
+ get_range,
+ decoder
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+import Json.Decode
+import Json.Decode.Pipeline
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type alias Type =
+ {
+ id : String,
+ name : String,
+ cost : Int,
+ reserve : Int,
+ targets : Int,
+ locations : Int,
+ duration : Int,
+ uses : Int,
+ chance : Int,
+ power : Int,
+ range : Int
+ }
+
+type alias Ref = String
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- 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 =
+ {
+ id = "",
+ name = "Skill Not Found",
+ cost = 999,
+ reserve = 999,
+ targets = -1,
+ locations = -1,
+ duration = -1,
+ uses = -1,
+ chance = -1,
+ power = -1,
+ range = -1
+ }
+
+get_id : Type -> String
+get_id p = p.id
+
+get_name : Type -> String
+get_name p = p.name
+
+get_cost : Type -> Int
+get_cost p = p.cost
+
+get_reserve : Type -> Int
+get_reserve p = p.reserve
+
+get_targets : Type -> Int
+get_targets p = p.targets
+
+get_locations : Type -> Int
+get_locations p = p.locations
+
+get_duration : Type -> Int
+get_duration p = p.duration
+
+get_uses : Type -> Int
+get_uses p = p.uses
+
+get_chance : Type -> Int
+get_chance p = p.chance
+
+get_power : Type -> Int
+get_power p = p.power
+
+get_range : Type -> Int
+get_range p = p.range
+
+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 "cos" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "res" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "tar" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "loc" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "dur" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "use" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "cha" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "pow" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "ran" Json.Decode.int)
+ )