summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/roster-editor/src/Struct/Character.elm7
-rw-r--r--src/roster-editor/src/Struct/Inventory.elm9
-rw-r--r--src/roster-editor/src/Struct/Model.elm23
-rw-r--r--src/roster-editor/src/Update/SetGlyph.elm23
-rw-r--r--src/roster-editor/src/View/GlyphBoardSelection.elm18
-rw-r--r--src/roster-editor/src/View/GlyphManagement.elm44
-rw-r--r--src/roster-editor/src/View/GlyphSelection.elm17
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Character.elm3
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm2
9 files changed, 102 insertions, 44 deletions
diff --git a/src/roster-editor/src/Struct/Character.elm b/src/roster-editor/src/Struct/Character.elm
index 5dc7752..ee92f8b 100644
--- a/src/roster-editor/src/Struct/Character.elm
+++ b/src/roster-editor/src/Struct/Character.elm
@@ -26,6 +26,7 @@ import Battle.Struct.Omnimods
-- Battle Characters -----------------------------------------------------------
import BattleCharacters.Struct.Character
+import BattleCharacters.Struct.Equipment
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -62,10 +63,10 @@ get_battle_index c = c.battle_ix
set_battle_index : Int -> Type -> Type
set_battle_index battle_ix c = {c | battle_ix = battle_ix}
-get_base_character : Type -> BattleCharacter.Struct.Character
+get_base_character : Type -> BattleCharacters.Struct.Character.Type
get_base_character c = c.base
-set_base_character : BattleCharacter.Struct.Character -> Type -> Type
+set_base_character : BattleCharacters.Struct.Character.Type -> Type -> Type
set_base_character base c = {c | base = base }
get_was_edited : Type -> Bool
@@ -90,7 +91,7 @@ resolve equipment_resolver ref =
base =
(BattleCharacters.Struct.Character.resolve
(equipment_resolver)
- (Battle.Omnimods.none)
+ (Battle.Struct.Omnimods.none)
ref.base
)
}
diff --git a/src/roster-editor/src/Struct/Inventory.elm b/src/roster-editor/src/Struct/Inventory.elm
index 063c3ce..e04e828 100644
--- a/src/roster-editor/src/Struct/Inventory.elm
+++ b/src/roster-editor/src/Struct/Inventory.elm
@@ -63,39 +63,44 @@ has_armor inv id = (Set.member id inv.armors)
allows : Type -> BattleCharacters.Struct.Equipment.Type -> Bool
allows inv equipment =
- (and
+ (
(has_weapon
inv
(BattleCharacters.Struct.Weapon.get_id
(BattleCharacters.Struct.Equipment.get_primary_weapon equipment)
)
)
+ &&
(has_weapon
inv
(BattleCharacters.Struct.Weapon.get_id
(BattleCharacters.Struct.Equipment.get_secondary_weapon equipment)
)
)
+ &&
(has_armor
inv
(BattleCharacters.Struct.Armor.get_id
(BattleCharacters.Struct.Equipment.get_armor equipment)
)
)
+ &&
(has_portrait
inv
(BattleCharacters.Struct.Portrait.get_id
(BattleCharacters.Struct.Equipment.get_portrait equipment)
)
)
+ &&
(has_glyph_board
inv
(BattleCharacters.Struct.GlyphBoard.get_id
(BattleCharacters.Struct.Equipment.get_glyph_board equipment)
)
)
+ &&
(List.all
- ((BattleCharacters.Struct.Glyph.get_id) |> (has_glyph inv))
+ ((BattleCharacters.Struct.Glyph.get_id) >> (has_glyph inv))
(Array.toList (BattleCharacters.Struct.Equipment.get_glyphs equipment))
)
)
diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm
index b8886aa..2ba403d 100644
--- a/src/roster-editor/src/Struct/Model.elm
+++ b/src/roster-editor/src/Struct/Model.elm
@@ -3,7 +3,7 @@ module Struct.Model exposing
Type,
new,
add_unresolved_character,
- resolve_characters,
+ resolve_all_characters,
update_character,
update_character_fun,
save_character,
@@ -33,6 +33,7 @@ import BattleCharacters.Struct.Armor
import BattleCharacters.Struct.Portrait
import BattleCharacters.Struct.Weapon
import BattleCharacters.Struct.Glyph
+import BattleCharacters.Struct.Equipment
import BattleCharacters.Struct.GlyphBoard
-- Local Module ----------------------------------------------------------------
@@ -61,8 +62,16 @@ type alias Type =
BattleCharacters.Struct.Armor.Ref
BattleCharacters.Struct.Armor.Type
),
- glyphs : (Dict.Dict Struct.Glyph.Ref Struct.Glyph.Type),
- glyph_boards : (Dict.Dict Struct.GlyphBoard.Ref Struct.GlyphBoard.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
@@ -215,23 +224,23 @@ add_portrait pt model =
)
}
-add_glyph : Struct.Glyph.Type -> Type -> Type
+add_glyph : BattleCharacters.Struct.Glyph.Type -> Type -> Type
add_glyph gl model =
{model |
glyphs =
(Dict.insert
- (Struct.Glyph.get_id gl)
+ (BattleCharacters.Struct.Glyph.get_id gl)
gl
model.glyphs
)
}
-add_glyph_board : Struct.GlyphBoard.Type -> Type -> Type
+add_glyph_board : BattleCharacters.Struct.GlyphBoard.Type -> Type -> Type
add_glyph_board glb model =
{model |
glyph_boards =
(Dict.insert
- (Struct.GlyphBoard.get_id glb)
+ (BattleCharacters.Struct.GlyphBoard.get_id glb)
glb
model.glyph_boards
)
diff --git a/src/roster-editor/src/Update/SetGlyph.elm b/src/roster-editor/src/Update/SetGlyph.elm
index aff749b..5d0a7f6 100644
--- a/src/roster-editor/src/Update/SetGlyph.elm
+++ b/src/roster-editor/src/Update/SetGlyph.elm
@@ -3,10 +3,14 @@ module Update.SetGlyph exposing (apply_to)
-- Elm -------------------------------------------------------------------------
import Dict
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Glyph
+import BattleCharacters.Struct.Equipment
+import BattleCharacters.Struct.Character
+
-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
-import Struct.Glyph
import Struct.Model
import Struct.UI
@@ -19,7 +23,7 @@ import Struct.UI
--------------------------------------------------------------------------------
apply_to : (
Struct.Model.Type ->
- Struct.Glyph.Ref ->
+ BattleCharacters.Struct.Glyph.Ref ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model ref =
@@ -27,12 +31,21 @@ apply_to model ref =
(
case (model.edited_char, (Dict.get ref model.glyphs)) of
((Just char), (Just glyph)) ->
+ let base_char = (Struct.Character.get_base_character char) in
{model |
edited_char =
(Just
- (Struct.Character.set_glyph
- (Struct.UI.get_glyph_slot model.ui)
- glyph
+ (Struct.Character.set_base_character
+ (BattleCharacters.Struct.Character.set_equipment
+ (BattleCharacters.Struct.Equipment.set_glyph
+ (Struct.UI.get_glyph_slot model.ui)
+ glyph
+ (BattleCharacters.Struct.Character.get_equipment
+ base_char
+ )
+ )
+ base_char
+ )
char
)
),
diff --git a/src/roster-editor/src/View/GlyphBoardSelection.elm b/src/roster-editor/src/View/GlyphBoardSelection.elm
index b956e0b..f661809 100644
--- a/src/roster-editor/src/View/GlyphBoardSelection.elm
+++ b/src/roster-editor/src/View/GlyphBoardSelection.elm
@@ -10,12 +10,13 @@ import Html.Events
-- Battle ----------------------------------------------------------------------
import Battle.View.Omnimods
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.GlyphBoard
+
-- Local Module ----------------------------------------------------------------
-import Struct.GlyphBoard
import Struct.Event
import Struct.Model
-
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -35,7 +36,10 @@ get_mod_html mod =
]
)
-get_glyph_board_html : Struct.GlyphBoard.Type -> (Html.Html Struct.Event.Type)
+get_glyph_board_html : (
+ BattleCharacters.Struct.GlyphBoard.Type ->
+ (Html.Html Struct.Event.Type)
+ )
get_glyph_board_html glyph_board =
(Html.div
[
@@ -43,7 +47,7 @@ get_glyph_board_html glyph_board =
(Html.Attributes.class "clickable"),
(Html.Events.onClick
(Struct.Event.SelectedGlyphBoard
- (Struct.GlyphBoard.get_id glyph_board)
+ (BattleCharacters.Struct.GlyphBoard.get_id glyph_board)
)
)
]
@@ -53,11 +57,13 @@ get_glyph_board_html glyph_board =
(Html.Attributes.class "character-card-glyph-board-name")
]
[
- (Html.text (Struct.GlyphBoard.get_name glyph_board))
+ (Html.text
+ (BattleCharacters.Struct.GlyphBoard.get_name glyph_board)
+ )
]
),
(Battle.View.Omnimods.get_html
- (Struct.GlyphBoard.get_omnimods glyph_board)
+ (BattleCharacters.Struct.GlyphBoard.get_omnimods glyph_board)
)
]
)
diff --git a/src/roster-editor/src/View/GlyphManagement.elm b/src/roster-editor/src/View/GlyphManagement.elm
index 1fce7b2..11fd2fe 100644
--- a/src/roster-editor/src/View/GlyphManagement.elm
+++ b/src/roster-editor/src/View/GlyphManagement.elm
@@ -10,11 +10,15 @@ import Html.Events
-- Battle ----------------------------------------------------------------------
import Battle.Struct.Omnimods
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Glyph
+import BattleCharacters.Struct.GlyphBoard
+import BattleCharacters.Struct.Equipment
+import BattleCharacters.Struct.Character
+
-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
-import Struct.Glyph
-import Struct.GlyphBoard
import Struct.Model
--------------------------------------------------------------------------------
@@ -51,7 +55,7 @@ get_glyph_html modifier (index, glyph) =
[
(Html.text
(
- (Struct.Glyph.get_name glyph)
+ (BattleCharacters.Struct.Glyph.get_name glyph)
++ " ("
++ (String.fromInt modifier)
++ "%)"
@@ -63,7 +67,7 @@ get_glyph_html modifier (index, glyph) =
(List.map
(get_mod_html)
(Battle.Struct.Omnimods.get_all_mods
- (Struct.Glyph.get_omnimods glyph)
+ (BattleCharacters.Struct.Glyph.get_omnimods glyph)
)
)
)
@@ -85,18 +89,30 @@ get_html model =
(case model.edited_char of
Nothing -> (Html.div [] [(Html.text "No character selected")])
(Just char) ->
- (Html.div
- [
- (Html.Attributes.class "selection-window-listing")
- ]
- (List.map2
- (get_glyph_html)
- (Struct.GlyphBoard.get_slots
- (Struct.Character.get_glyph_board char)
+ let
+ equipment =
+ (BattleCharacters.Struct.Character.get_equipment
+ (Struct.Character.get_base_character char)
+ )
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "selection-window-listing")
+ ]
+ (List.map2
+ (get_glyph_html)
+ (BattleCharacters.Struct.GlyphBoard.get_slots
+ (BattleCharacters.Struct.Equipment.get_glyph_board
+ equipment
+ )
+ )
+ (Array.toIndexedList
+ (BattleCharacters.Struct.Equipment.get_glyphs
+ equipment
+ )
+ )
)
- (Array.toIndexedList (Struct.Character.get_glyphs char))
)
- )
)
]
)
diff --git a/src/roster-editor/src/View/GlyphSelection.elm b/src/roster-editor/src/View/GlyphSelection.elm
index 6d3eca2..e7b1da8 100644
--- a/src/roster-editor/src/View/GlyphSelection.elm
+++ b/src/roster-editor/src/View/GlyphSelection.elm
@@ -10,9 +10,11 @@ import Html.Events
-- Battle ----------------------------------------------------------------------
import Battle.View.Omnimods
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Glyph
+
-- Local Module ----------------------------------------------------------------
import Struct.Event
-import Struct.Glyph
import Struct.Model
--------------------------------------------------------------------------------
@@ -32,7 +34,10 @@ get_mod_html mod =
]
)
-get_glyph_html : Struct.Glyph.Type -> (Html.Html Struct.Event.Type)
+get_glyph_html : (
+ BattleCharacters.Struct.Glyph.Type ->
+ (Html.Html Struct.Event.Type)
+ )
get_glyph_html glyph =
(Html.div
[
@@ -40,13 +45,15 @@ get_glyph_html glyph =
(Html.Attributes.class "clickable"),
(Html.Events.onClick
(Struct.Event.SelectedGlyph
- (Struct.Glyph.get_id glyph)
+ (BattleCharacters.Struct.Glyph.get_id glyph)
)
)
]
[
- (Html.text (Struct.Glyph.get_name glyph)),
- (Battle.View.Omnimods.get_html (Struct.Glyph.get_omnimods glyph))
+ (Html.text (BattleCharacters.Struct.Glyph.get_name glyph)),
+ (Battle.View.Omnimods.get_html
+ (BattleCharacters.Struct.Glyph.get_omnimods glyph)
+ )
]
)
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm
index b91817c..e3ba148 100644
--- a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm
@@ -18,7 +18,8 @@ module BattleCharacters.Struct.Character exposing
dirty_switch_weapons,
decoder,
encode,
- resolve
+ resolve,
+ to_unresolved
)
-- Elm -------------------------------------------------------------------------
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm b/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm
index c277b20..4cadc6b 100644
--- a/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Glyph.elm
@@ -36,7 +36,7 @@ type alias Ref = String
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_id : Type -> String
+get_id : Type -> Ref
get_id g = g.id
get_name : Type -> String