summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-03-06 18:44:57 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-03-06 18:44:57 +0100
commit24efb898f526e0aa02a0e15b74436da8ba166cac (patch)
tree5d5e6e682e0012787255de520dd29292e793d6ad /src/map-editor
parentb05eb97d89e690737418ca2aa2e49e9c9da83184 (diff)
Impr. MapEd tile focus, CSS factoring.
Diffstat (limited to 'src/map-editor')
-rw-r--r--src/map-editor/src/Struct/Attributes.elm173
-rw-r--r--src/map-editor/src/Struct/DamageType.elm55
-rw-r--r--src/map-editor/src/Struct/Map.elm22
-rw-r--r--src/map-editor/src/Struct/Model.elm7
-rw-r--r--src/map-editor/src/Struct/Omnimods.elm91
-rw-r--r--src/map-editor/src/Struct/Statistics.elm210
-rw-r--r--src/map-editor/src/Struct/Tile.elm20
-rw-r--r--src/map-editor/src/View/Map.elm2
-rw-r--r--src/map-editor/src/View/Map/Tile.elm16
-rw-r--r--src/map-editor/src/View/SubMenu.elm4
-rw-r--r--src/map-editor/src/View/SubMenu/Status.elm40
-rw-r--r--src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm34
-rw-r--r--src/map-editor/src/View/SubMenu/Status/TileInfo.elm134
-rw-r--r--src/map-editor/src/View/SubMenu/TileStatus.elm208
-rw-r--r--src/map-editor/src/View/SubMenu/Tiles.elm6
-rw-r--r--src/map-editor/src/View/Toolbox.elm6
16 files changed, 789 insertions, 239 deletions
diff --git a/src/map-editor/src/Struct/Attributes.elm b/src/map-editor/src/Struct/Attributes.elm
new file mode 100644
index 0000000..ce871dd
--- /dev/null
+++ b/src/map-editor/src/Struct/Attributes.elm
@@ -0,0 +1,173 @@
+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/map-editor/src/Struct/DamageType.elm b/src/map-editor/src/Struct/DamageType.elm
new file mode 100644
index 0000000..b7bced7
--- /dev/null
+++ b/src/map-editor/src/Struct/DamageType.elm
@@ -0,0 +1,55 @@
+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/map-editor/src/Struct/Map.elm b/src/map-editor/src/Struct/Map.elm
index c175de0..9a09d17 100644
--- a/src/map-editor/src/Struct/Map.elm
+++ b/src/map-editor/src/Struct/Map.elm
@@ -9,6 +9,7 @@ module Struct.Map exposing
get_tiles,
set_tile_to,
solve_tiles,
+ get_omnimods_at,
try_getting_tile_at,
decoder
)
@@ -21,10 +22,11 @@ import Dict
import Json.Decode
-- Map Editor ------------------------------------------------------------------
-import Struct.Tile
import Struct.Location
-import Struct.TileInstance
import Struct.MapMarker
+import Struct.Omnimods
+import Struct.Tile
+import Struct.TileInstance
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -108,6 +110,22 @@ solve_tiles tiles map =
content = (Array.map (Struct.TileInstance.solve tiles) map.content)
}
+get_omnimods_at : (
+ Struct.Location.Type ->
+ (Dict.Dict Struct.Tile.Ref Struct.Tile.Type) ->
+ Type ->
+ Struct.Omnimods.Type
+ )
+get_omnimods_at loc tiles_solver map =
+ case (try_getting_tile_at loc map) of
+ Nothing -> (Struct.Omnimods.none)
+ (Just tile_inst) ->
+ case
+ (Dict.get (Struct.TileInstance.get_class_id tile_inst) tiles_solver)
+ of
+ Nothing -> (Struct.Omnimods.none)
+ (Just tile) -> (Struct.Tile.get_omnimods tile)
+
decoder : (Json.Decode.Decoder Type)
decoder =
(Json.Decode.andThen
diff --git a/src/map-editor/src/Struct/Model.elm b/src/map-editor/src/Struct/Model.elm
index 7b04aa8..419a0e9 100644
--- a/src/map-editor/src/Struct/Model.elm
+++ b/src/map-editor/src/Struct/Model.elm
@@ -1,6 +1,7 @@
module Struct.Model exposing
(
Type,
+ tile_omnimods_fun,
new,
invalidate,
add_tile,
@@ -18,7 +19,9 @@ import Struct.Flags
-- Map Editor ------------------------------------------------------------------
import Struct.Error
import Struct.HelpRequest
+import Struct.Location
import Struct.Map
+import Struct.Omnimods
import Struct.Tile
import Struct.TilePattern
import Struct.Toolbox
@@ -54,6 +57,10 @@ type alias Type =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
+tile_omnimods_fun : Type -> (Struct.Location.Type -> Struct.Omnimods.Type)
+tile_omnimods_fun model =
+ (\loc -> (Struct.Map.get_omnimods_at loc model.tiles model.map))
+
new : Struct.Flags.Type -> Type
new flags =
let
diff --git a/src/map-editor/src/Struct/Omnimods.elm b/src/map-editor/src/Struct/Omnimods.elm
new file mode 100644
index 0000000..80fc509
--- /dev/null
+++ b/src/map-editor/src/Struct/Omnimods.elm
@@ -0,0 +1,91 @@
+module Struct.Omnimods exposing
+ (
+ Type,
+ none,
+ get_attributes_mods,
+ get_statistics_mods,
+ get_attack_mods,
+ get_defense_mods,
+ decoder
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+import Json.Decode
+import Json.Decode.Pipeline
+
+-- Map Editor ------------------------------------------------------------------
+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)
+ (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)
+ )
+ )
+ )
+ )
+
+--------------------------------------------------------------------------------
+-- 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)
+ )
+
+none : Type
+none =
+ let empty_dict = (Dict.empty) in
+ {
+ attributes = empty_dict,
+ statistics = empty_dict,
+ attack = empty_dict,
+ defense = empty_dict
+ }
+
+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)
diff --git a/src/map-editor/src/Struct/Statistics.elm b/src/map-editor/src/Struct/Statistics.elm
new file mode 100644
index 0000000..f676648
--- /dev/null
+++ b/src/map-editor/src/Struct/Statistics.elm
@@ -0,0 +1,210 @@
+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/map-editor/src/Struct/Tile.elm b/src/map-editor/src/Struct/Tile.elm
index b9d8de2..cafcf03 100644
--- a/src/map-editor/src/Struct/Tile.elm
+++ b/src/map-editor/src/Struct/Tile.elm
@@ -4,10 +4,10 @@ module Struct.Tile exposing
VariantID,
FamilyID,
Type,
- new,
get_id,
get_name,
get_cost,
+ get_omnimods,
get_family,
decoder
)
@@ -23,6 +23,7 @@ import Constants.UI
import Constants.Movement
import Struct.Location
+import Struct.Omnimods
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -37,7 +38,8 @@ type alias Type =
name : String,
crossing_cost : Int,
family : FamilyID,
- depth : Int
+ depth : Int,
+ omnimods : Struct.Omnimods.Type
}
--------------------------------------------------------------------------------
@@ -47,16 +49,6 @@ type alias Type =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-new : Ref -> String -> Int -> FamilyID -> Int -> Type
-new id name crossing_cost family depth =
- {
- id = id,
- name = name,
- crossing_cost = crossing_cost,
- family = family,
- depth = depth
- }
-
get_id : Type -> Ref
get_id tile = tile.id
@@ -69,6 +61,9 @@ get_name tile = tile.name
get_family : Type -> FamilyID
get_family tile = tile.family
+get_omnimods : Type -> Struct.Omnimods.Type
+get_omnimods t = t.omnimods
+
decoder : (Json.Decode.Decoder Type)
decoder =
(Json.Decode.succeed
@@ -78,4 +73,5 @@ decoder =
|> (Json.Decode.Pipeline.required "ct" Json.Decode.int)
|> (Json.Decode.Pipeline.required "fa" Json.Decode.string)
|> (Json.Decode.Pipeline.required "de" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
)
diff --git a/src/map-editor/src/View/Map.elm b/src/map-editor/src/View/Map.elm
index d98c088..a022850 100644
--- a/src/map-editor/src/View/Map.elm
+++ b/src/map-editor/src/View/Map.elm
@@ -31,7 +31,7 @@ get_tiles_html : (
get_tiles_html tb map =
(Html.div
[
- (Html.Attributes.class "map-tiles-layer"),
+ (Html.Attributes.class "tiles-layer"),
(Html.Attributes.style
"width"
(
diff --git a/src/map-editor/src/View/Map/Tile.elm b/src/map-editor/src/View/Map/Tile.elm
index b5e3505..96fdee6 100644
--- a/src/map-editor/src/View/Map/Tile.elm
+++ b/src/map-editor/src/View/Map/Tile.elm
@@ -26,7 +26,7 @@ get_layer_html index border =
(Html.div
[
(Html.Attributes.class
- ("map-tile-icon-f-" ++ (String.fromInt index))
+ ("tile-icon-f-" ++ (String.fromInt index))
),
(Html.Attributes.style
"background-image"
@@ -54,7 +54,7 @@ get_content_html tile =
(
(Html.div
[
- (Html.Attributes.class "map-tile-icon-bg"),
+ (Html.Attributes.class "tile-icon-bg"),
(Html.Attributes.style
"background-image"
(
@@ -71,7 +71,7 @@ get_content_html tile =
(
(Html.div
[
- (Html.Attributes.class "map-tile-icon-dt"),
+ (Html.Attributes.class "tile-icon-dt"),
(Html.Attributes.style
"background-image"
(
@@ -105,21 +105,21 @@ get_html tb tile =
in
(Html.div
[
- (Html.Attributes.class "map-tile-icon"),
- (Html.Attributes.class "map-tiled"),
+ (Html.Attributes.class "tile-icon"),
+ (Html.Attributes.class "tiled"),
(
if (Struct.Toolbox.is_selected tile_loc tb)
- then (Html.Attributes.class "map-tile-selected")
+ then (Html.Attributes.class "tile-selected")
else (Html.Attributes.class "")
),
(
if (Struct.Toolbox.is_square_corner tile_loc tb)
- then (Html.Attributes.class "map-tile-square-corner")
+ then (Html.Attributes.class "tile-square-corner")
else (Html.Attributes.class "")
),
(Html.Attributes.class
(
- "map-tile-variant-"
+ "tile-variant-"
++
(String.fromInt
(Struct.TileInstance.get_local_variant_ix tile)
diff --git a/src/map-editor/src/View/SubMenu.elm b/src/map-editor/src/View/SubMenu.elm
index 0b1fbea..70e66cf 100644
--- a/src/map-editor/src/View/SubMenu.elm
+++ b/src/map-editor/src/View/SubMenu.elm
@@ -13,7 +13,7 @@ import Util.Html
import View.SubMenu.Tiles
import View.SubMenu.Settings
-import View.SubMenu.Status
+import View.SubMenu.TileStatus
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -26,7 +26,7 @@ get_inner_html : (
get_inner_html model tab =
case tab of
Struct.UI.StatusTab ->
- (View.SubMenu.Status.get_html model)
+ (View.SubMenu.TileStatus.get_html model)
Struct.UI.TilesTab ->
(View.SubMenu.Tiles.get_html model)
diff --git a/src/map-editor/src/View/SubMenu/Status.elm b/src/map-editor/src/View/SubMenu/Status.elm
deleted file mode 100644
index 69f5842..0000000
--- a/src/map-editor/src/View/SubMenu/Status.elm
+++ /dev/null
@@ -1,40 +0,0 @@
-module View.SubMenu.Status exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-
--- Struct.Battlemap -------------------------------------------------------------------
-import Struct.Event
-import Struct.Location
-import Struct.Model
-import Struct.UI
-
-import View.SubMenu.Status.TileInfo
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
-get_html model =
- (Html.div
- [
- (Html.Attributes.class "tabmenu-content"),
- (Html.Attributes.class "tabmenu-content-status")
- ]
- [
- (case (Struct.UI.get_previous_action model.ui) of
- (Just (Struct.UI.SelectedLocation loc)) ->
- (View.SubMenu.Status.TileInfo.get_html
- model
- (Struct.Location.from_ref loc)
- )
-
- _ ->
- (Html.text "Nothing is being focused.")
- )
- ]
- )
diff --git a/src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm b/src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm
deleted file mode 100644
index 6bfca87..0000000
--- a/src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm
+++ /dev/null
@@ -1,34 +0,0 @@
-module View.SubMenu.Status.CharacterInfo exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-
--- Struct.Battlemap -------------------------------------------------------------------
-import Struct.Character
-import Struct.Event
-
-import View.Controlled.CharacterCard
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Int ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_html player_ix char =
- (Html.div
- [
- (Html.Attributes.class "tabmenu-character-info")
- ]
- [
- (Html.text ("Focusing:")),
- (View.Controlled.CharacterCard.get_full_html player_ix char)
- ]
- )
diff --git a/src/map-editor/src/View/SubMenu/Status/TileInfo.elm b/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
deleted file mode 100644
index 166dc42..0000000
--- a/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
+++ /dev/null
@@ -1,134 +0,0 @@
-module View.SubMenu.Status.TileInfo exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Dict
-
-import Html
-import Html.Attributes
-
--- Map Editor ------------------------------------------------------------------
-import Constants.Movement
-
-import Struct.Map
-import Struct.Event
-import Struct.Location
-import Struct.Model
-import Struct.Tile
-import Struct.TileInstance
-
-import Util.Html
-
-import View.Map.Tile
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_icon : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
-get_icon tile =
- (Html.div
- [
- (Html.Attributes.class "map-tile-card-icon"),
- (Html.Attributes.class
- (
- "map-tile-variant-"
- ++
- (String.fromInt
- (Struct.TileInstance.get_local_variant_ix tile)
- )
- )
- )
- ]
- (View.Map.Tile.get_content_html tile)
- )
-
-get_name : (
- Struct.Model.Type ->
- Struct.TileInstance.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_name model tile =
- case (Dict.get (Struct.TileInstance.get_class_id tile) model.tiles) of
- Nothing -> (Util.Html.nothing)
- (Just tile_type) ->
- (Html.div
- [
- (Html.Attributes.class "map-tile-card-name")
- ]
- [
- (Html.text (Struct.Tile.get_name tile_type))
- ]
- )
-
-get_cost : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
-get_cost tile =
- let
- cost = (Struct.TileInstance.get_cost tile)
- text =
- if (cost > Constants.Movement.max_points)
- then
- "Obstructed"
- else
- ("Cost: " ++ (String.fromInt cost))
- in
- (Html.div
- [
- (Html.Attributes.class "map-tile-card-cost")
- ]
- [
- (Html.text text)
- ]
- )
-
-get_location : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
-get_location tile =
- let
- tile_location = (Struct.TileInstance.get_location tile)
- in
- (Html.div
- [
- (Html.Attributes.class "map-tile-card-location")
- ]
- [
- (Html.text
- (
- "{x: "
- ++ (String.fromInt tile_location.x)
- ++ "; y: "
- ++ (String.fromInt tile_location.y)
- ++ "}"
- )
- )
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.Model.Type ->
- Struct.Location.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_html model loc =
- case (Struct.Map.try_getting_tile_at loc model.map) of
- (Just tile) ->
- (Html.div
- [
- (Html.Attributes.class "map-tile-card")
- ]
- [
- (get_name model tile),
- (Html.div
- [
- (Html.Attributes.class "map-tile-card-top")
- ]
- [
- (get_icon tile),
- (get_location tile),
- (get_cost tile)
- ]
- )
- ]
- )
-
- Nothing -> (Html.text "Error: Unknown tile location selected.")
diff --git a/src/map-editor/src/View/SubMenu/TileStatus.elm b/src/map-editor/src/View/SubMenu/TileStatus.elm
new file mode 100644
index 0000000..0fd5031
--- /dev/null
+++ b/src/map-editor/src/View/SubMenu/TileStatus.elm
@@ -0,0 +1,208 @@
+module View.SubMenu.TileStatus exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+import Html
+import Html.Attributes
+
+-- Map Editor ------------------------------------------------------------------
+import Constants.Movement
+
+import Struct.Event
+import Struct.Location
+import Struct.Map
+import Struct.Model
+import Struct.Omnimods
+import Struct.Tile
+import Struct.TileInstance
+import Struct.UI
+
+import Util.Html
+
+import View.Map.Tile
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_icon : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
+get_icon tile =
+ (Html.div
+ [
+ (Html.Attributes.class "tile-card-icon"),
+ (Html.Attributes.class "info-card-picture"),
+ (Html.Attributes.class
+ (
+ "tile-variant-"
+ ++
+ (String.fromInt
+ (Struct.TileInstance.get_local_variant_ix tile)
+ )
+ )
+ )
+ ]
+ (View.Map.Tile.get_content_html tile)
+ )
+
+get_name : (
+ Struct.Model.Type ->
+ Struct.TileInstance.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_name model tile_inst =
+ case (Dict.get (Struct.TileInstance.get_class_id tile_inst) model.tiles) of
+ Nothing -> (Util.Html.nothing)
+ (Just tile) ->
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-name"),
+ (Html.Attributes.class "info-card-text-field"),
+ (Html.Attributes.class "tile-card-name")
+ ]
+ [
+ (Html.text (Struct.Tile.get_name tile))
+ ]
+ )
+
+get_cost : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
+get_cost tile_inst =
+ let
+ cost = (Struct.TileInstance.get_cost tile_inst)
+ text =
+ if (cost > Constants.Movement.max_points)
+ then
+ "Obstructed"
+ else
+ ("Cost: " ++ (String.fromInt cost))
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-text-field"),
+ (Html.Attributes.class "tile-card-cost")
+ ]
+ [
+ (Html.text text)
+ ]
+ )
+
+get_location : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
+get_location tile_inst =
+ let
+ tile_location = (Struct.TileInstance.get_location tile_inst)
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-text-field"),
+ (Html.Attributes.class "tile-card-location")
+ ]
+ [
+ (Html.text
+ (
+ "{x: "
+ ++ (String.fromInt tile_location.x)
+ ++ "; y: "
+ ++ (String.fromInt tile_location.y)
+ ++ "}"
+ )
+ )
+ ]
+ )
+
+get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type)
+get_mod_html mod =
+ let
+ (category, value) = mod
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-mod")
+ ]
+ [
+ (Html.text
+ (category ++ ": " ++ (String.fromInt value))
+ )
+ ]
+ )
+
+get_omnimods_listing : (List (String, Int)) -> (Html.Html Struct.Event.Type)
+get_omnimods_listing mod_list =
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-omnimods-listing")
+ ]
+ (List.map (get_mod_html) mod_list)
+ )
+
+get_omnimods : Struct.Omnimods.Type -> (Html.Html Struct.Event.Type)
+get_omnimods omnimods =
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-omnimods")
+ ]
+ [
+ (Html.text "Attribute Modifiers"),
+ (get_omnimods_listing (Struct.Omnimods.get_attributes_mods omnimods)),
+ (Html.text "Statistics Modifiers"),
+ (get_omnimods_listing (Struct.Omnimods.get_statistics_mods omnimods)),
+ (Html.text "Attack Modifiers"),
+ (get_omnimods_listing (Struct.Omnimods.get_attack_mods omnimods)),
+ (Html.text "Defense Modifiers"),
+ (get_omnimods_listing (Struct.Omnimods.get_defense_mods omnimods))
+ ]
+ )
+
+get_tile_info_html : (
+ Struct.Model.Type ->
+ Struct.Location.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_tile_info_html model loc =
+ case (Struct.Map.try_getting_tile_at loc model.map) of
+ (Just tile) ->
+ (Html.div
+ [
+ (Html.Attributes.class "info-card"),
+ (Html.Attributes.class "tile-card")
+ ]
+ [
+ (get_name model tile),
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-top"),
+ (Html.Attributes.class "tile-card-top")
+ ]
+ [
+ (get_icon tile),
+ (get_location tile),
+ (get_cost tile)
+ ]
+ ),
+ (get_omnimods ((Struct.Model.tile_omnimods_fun model) loc))
+ ]
+ )
+
+ Nothing -> (Html.text "Error: Unknown tile location selected.")
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
+get_html model =
+ (Html.div
+ [
+ (Html.Attributes.class "tabmenu-content"),
+ (Html.Attributes.class "tabmenu-content-status")
+ ]
+ [
+ (case (Struct.UI.get_previous_action model.ui) of
+ (Just (Struct.UI.SelectedLocation loc)) ->
+ (get_tile_info_html
+ model
+ (Struct.Location.from_ref loc)
+ )
+
+ _ ->
+ (Html.text "Nothing is being focused.")
+ )
+ ]
+ )
diff --git a/src/map-editor/src/View/SubMenu/Tiles.elm b/src/map-editor/src/View/SubMenu/Tiles.elm
index 5ef324f..511980d 100644
--- a/src/map-editor/src/View/SubMenu/Tiles.elm
+++ b/src/map-editor/src/View/SubMenu/Tiles.elm
@@ -25,10 +25,10 @@ get_icon_html : (
get_icon_html (ref, tile) =
(Html.div
[
- (Html.Attributes.class "map-tile"),
- (Html.Attributes.class "map-tiled"),
+ (Html.Attributes.class "tile"),
+ (Html.Attributes.class "tiled"),
(Html.Attributes.class "clickable"),
- (Html.Attributes.class "map-tile-variant-0"),
+ (Html.Attributes.class "tile-variant-0"),
(Html.Events.onClick
(Struct.Event.TemplateRequested ((Struct.Tile.get_id tile), "0"))
)
diff --git a/src/map-editor/src/View/Toolbox.elm b/src/map-editor/src/View/Toolbox.elm
index a5ab910..442d01b 100644
--- a/src/map-editor/src/View/Toolbox.elm
+++ b/src/map-editor/src/View/Toolbox.elm
@@ -28,9 +28,9 @@ get_template_icon_html template =
(Html.div
[
(Html.Attributes.class "toolbox-template"),
- (Html.Attributes.class "map-tiled"),
- (Html.Attributes.class "map-tile"),
- (Html.Attributes.class "map-tile-variant-0")
+ (Html.Attributes.class "tiled"),
+ (Html.Attributes.class "tile"),
+ (Html.Attributes.class "tile-variant-0")
]
(View.Map.Tile.get_content_html template)
)